:root {
  color-scheme: light;
  --canvas: #f6f7f3;
  --surface: #fff;
  --ink: #202b22;
  --muted: #58655c;
  --quiet: #647269;
  --line: #e7ebe4;
  --forest: #193e30;
  --green: #35634e;
  --leaf: #dcef9e;
  --sage: #e9f1e7;
  --sidebar-width: 226px;
  --page-gutter: clamp(26px, 3vw, 46px);
  --radius: 17px;
  --shadow: 0 2px 3px #26382904, 0 10px 22px #26382903;
  --body-font: "DM Sans", "PingFang SC", "Microsoft YaHei UI", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  --display-font: "Bricolage Grotesque", var(--body-font);
}

*, *::before, *::after { box-sizing: border-box; }
html { min-width: 300px; }
body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font: 14px/1.55 var(--body-font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, p { margin: 0; }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; cursor: pointer; }
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
svg { display: block; }
[hidden] { display: none !important; }

:focus-visible {
  outline: 2px solid #4a785a;
  outline-offset: 3px;
}

.icon {
  flex: none;
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.btn, .icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 15px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  font-size: 13px;
  font-weight: 650;
  white-space: nowrap;
  transition: background .18s ease, border-color .18s ease, color .18s ease, box-shadow .18s ease;
}

.btn:hover, .icon-button:hover { background: #f3f6f1; border-color: #d5dfd1; }
.icon-button { width: 38px; padding: 0; }
.btn svg, .icon-button svg { flex: none; width: 16px; height: 16px; }
.btn-primary { color: #fff; background: var(--forest); border-color: var(--forest); }
.btn-primary:hover { color: #fff; background: #285541; border-color: #285541; }

.metric-card, .section-card {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.app-shell {
  min-height: 100dvh;
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  height: 100dvh;
  overflow-y: auto;
  background: #fcfdfa;
  border-right: 1px solid #e4e9e1;
  padding: 32px 20px 21px;
}

.brand {
  display: flex;
  align-items: center;
  align-self: flex-start;
  gap: 11px;
  margin-left: 8px;
  padding: 0;
  border: 0;
  background: transparent;
  text-align: left;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  align-items: center;
  justify-items: center;
  border: 1px solid #d8e5d5;
  border-radius: 12px;
  color: #264d3a;
  background: #e5efe2;
}

.brand-mark svg { width: 24px; height: 24px; }
.brand-text, .profile-copy { display: grid; }
.brand-text strong { font-size: 21px; line-height: 1.13; font-weight: 760; letter-spacing: .035em; }
.brand-text small { margin-top: 4px; color: #4f6858; font: 720 9px/1 var(--display-font); letter-spacing: .19em; }
.sidebar-main { display: grid; gap: 26px; margin-top: 43px; }
.nav-group { display: grid; gap: 5px; }
.nav-label { padding: 0 12px; margin-bottom: 5px; color: var(--quiet); font-size: 11px; letter-spacing: .09em; }
.nav-link {
  display: flex;
  position: relative;
  align-items: center;
  gap: 11px;
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: #4b584f;
  font-size: 13px;
  font-weight: 560;
  text-align: left;
  white-space: nowrap;
  transition: color .18s ease, background .18s ease, border-color .18s ease;
}

.nav-link svg { flex: none; width: 18px; height: 18px; }
.nav-link:hover { background: #f0f4ee; color: #274a37; }
.nav-link.is-active, .nav-link[aria-current="page"] { border-color: #e0ebdd; background: #e8f1e5; color: #234e38; font-weight: 730; }
.nav-link.is-active::after, .nav-link[aria-current="page"]::after {
  position: absolute;
  right: 12px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #5f8967;
  content: "";
}

.sidebar-footer { display: grid; gap: 16px; margin-top: auto; padding-top: 32px; }
.local-status {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  padding: 0 11px;
  color: #607267;
  font-size: 11px;
}

.status-dot { width: 7px; height: 7px; border-radius: 50%; background: #77a389; box-shadow: 0 0 0 3px #e5efe6; }
.local-status[data-connection="disconnected"] .status-dot { background: #ad833f; box-shadow: 0 0 0 3px #f5ecdb; }
.clear-demo { justify-self: start; margin: -15px 0 -3px 8px; padding: 4px 3px; border: 0; background: transparent; color: #627267; font-size: 11px; text-align: left; text-decoration: underline; text-underline-offset: 2px; }
.clear-demo:hover { color: #284c36; }
.connection-button { color: #466752; font-weight: 650; }
.profile { display: flex; align-items: center; gap: 10px; min-height: 55px; padding: 13px 7px 0; border-top: 1px solid var(--line); }
.avatar { display: grid; place-items: center; flex: none; width: 35px; height: 35px; color: #5b536e; background: #ece7f2; border-radius: 50%; font-size: 13px; font-weight: 750; }
.profile-copy { gap: 2px; }
.profile-copy strong { font-size: 12px; font-weight: 700; }
.profile-copy small { color: var(--quiet); font-size: 11px; }

.workspace { min-width: 0; }
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 72px;
  padding: 0 max(var(--page-gutter), calc((100% - 1340px) / 2));
  border-bottom: 1px solid #e4e9e1;
  background: #fafbf8;
}

.breadcrumbs, .topbar-actions { display: flex; align-items: center; gap: 10px; }
.breadcrumbs { min-width: 0; color: #627068; font-size: 12px; white-space: nowrap; }
.breadcrumbs strong { color: #29372e; font-weight: 710; }
.breadcrumbs svg { width: 15px; height: 15px; }
.breadcrumbs svg:nth-of-type(2) { width: 13px; height: 13px; color: #79867d; }
.topbar-actions .btn { min-height: 37px; }
.topbar-actions .btn-secondary { font-variant-numeric: tabular-nums; }
.date-control { position: relative; }
.date-input { position: absolute; bottom: 0; left: 0; width: 100%; height: 1px; padding: 0; border: 0; opacity: 0; pointer-events: none; }

.page-content {
  width: min(100%, 1432px);
  margin: 0 auto;
  padding: 28px var(--page-gutter) 45px;
}

.page-heading { margin-bottom: 22px; }
.page-heading h1 { font: 760 clamp(26px, 2.2vw, 34px)/1.28 var(--display-font); letter-spacing: -.045em; }
.page-heading p { margin-top: 5px; color: var(--muted); font-size: 13px; }

.hero {
  position: relative;
  isolation: isolate;
  display: flex;
  align-items: center;
  overflow: hidden;
  min-height: 226px;
  padding: 29px 32px;
  border: 1px solid #244734;
  border-radius: 20px;
  color: #f5f9ed;
  background: #173a2b;
  box-shadow: 0 5px 16px #183b2920;
}

.hero-art {
  position: absolute;
  z-index: -1;
  inset: 0 0 0 34%;
  overflow: hidden;
  background-color: #3a5838;
  background-image: linear-gradient(90deg, #173a2b, #173a2b0d 54%, #173a2b00), url("assets/hero.webp");
  background-position: center, center 52%;
  background-size: cover;
}

.hero::after {
  position: absolute;
  z-index: -1;
  inset: 0;
  background: linear-gradient(90deg, #173a2b 0%, #173a2b 25%, #173a2b82 56%, #173a2b00 75%);
  pointer-events: none;
  content: "";
}

.hero-copy { width: min(100%, 580px); }
.hero-kicker { display: flex; align-items: center; gap: 7px; margin-bottom: 10px; color: #d7e9b9; font-size: 11px; font-weight: 620; letter-spacing: .055em; }
.hero-kicker svg { width: 15px; height: 15px; }
.hero h2 { font: 760 clamp(26px, 3.2vw, 47px)/1.22 var(--display-font); letter-spacing: -.055em; text-wrap: balance; }
.hero p { margin-top: 9px; color: #deeadb; font-size: 13px; line-height: 1.65; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 19px; }
.btn-hero, .btn-hero-ghost { min-height: 38px; }
.btn-hero { border-color: #dcef9e; background: #dcef9e; color: #1d3825; }
.btn-hero:hover { border-color: #ebf5c4; background: #ebf5c4; }
.btn-hero-ghost { border-color: #cfe6ca61; background: #ecf7de0c; color: #f1f7ec; }
.btn-hero-ghost:hover { border-color: #cfe6cabb; background: #ecf7de22; }
.hero .btn:focus-visible { outline-color: #f5fadf; }

.metrics-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 15px; margin-top: 21px; }
.metric-card { padding: 15px 17px 14px; text-align: left; transition: background .18s ease, border-color .18s ease, box-shadow .18s ease; }
.metric-card:hover { border-color: #cfddcf; background: #fdfefc; box-shadow: 0 4px 12px #2638290a; }
.metric-head { display: flex; align-items: center; gap: 8px; color: #4e5d53; font-size: 12px; font-weight: 630; }
.metric-icon { display: grid; place-items: center; flex: none; width: 33px; height: 33px; border-radius: 9px; color: #41684d; background: var(--sage); }
.metric-icon svg { width: 16px; height: 16px; }
.tone-plan { color: #40634b; background: #e9f1e6; }
.tone-schedule { color: #526d80; background: #e8f0f4; }
.tone-sleep { color: #6b5b92; background: #efeaf8; }
.tone-activity { color: #8b643b; background: #f8efe0; }
.metric-value {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 8px;
  color: #253228;
  font: 750 clamp(22px, 2.15vw, 30px)/1.14 var(--display-font);
  font-variant-numeric: tabular-nums;
  letter-spacing: -.055em;
}

.metric-value small { margin-right: 1px; color: #526158; font: 600 12px/1.2 var(--body-font); letter-spacing: 0; }
.metric-note { display: block; margin-top: 5px; color: #627068; font-size: 11px; }

.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.38fr) minmax(0, 1fr); gap: 17px; margin-top: 21px; }
.section-card { padding: 19px 21px 20px; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 15px; }
.card-head h2 { color: #243228; font-size: 18px; line-height: 1.35; font-weight: 750; letter-spacing: -.027em; }
.card-head p { margin-top: 4px; color: var(--quiet); font-size: 11px; }
.card-actions { display: flex; flex: none; align-items: center; gap: 5px; }
.card-actions .btn, .card-actions .icon-button { min-height: 31px; padding: 0 8px; border-radius: 8px; font-size: 11px; }
.card-actions .icon-button { width: 31px; padding: 0; }
.card-actions .icon-button svg { width: 14px; height: 14px; }
.timeline-list { position: relative; display: grid; gap: 8px; }
.timeline-row { display: grid; position: relative; grid-template-columns: 41px 11px minmax(0, 1fr); align-items: stretch; gap: 9px; min-width: 0; }
.timeline-row:not(:last-child)::after { position: absolute; top: 23px; bottom: -29px; left: 55px; width: 1px; background: #e4e9e2; content: ""; }
.timeline-time { margin-top: 13px; color: #5b685f; font: 700 12px/1.5 var(--display-font); font-variant-numeric: tabular-nums; }
.timeline-pin { position: relative; z-index: 1; align-self: start; justify-self: center; width: 9px; height: 9px; margin-top: 17px; border: 2px solid #fff; border-radius: 50%; box-shadow: 0 0 0 1px var(--event-color, #7da889); background: var(--event-color, #7da889); }
.timeline-entry {
  display: grid;
  gap: 3px;
  min-width: 0;
  min-height: 52px;
  padding: 8px 11px;
  border: 1px solid transparent;
  border-left: 2px solid var(--event-color, #7da889);
  border-radius: 8px;
  background: var(--event-soft, #edf4ec);
  text-align: left;
  transition: border-color .18s ease, filter .18s ease;
}

.timeline-entry:hover { border-color: var(--event-color, #7da889); filter: saturate(1.1); }
.timeline-entry-title { min-width: 0; overflow-wrap: anywhere; color: #26372c; font-size: 12px; font-weight: 720; }
.timeline-entry-meta { min-width: 0; overflow-wrap: anywhere; color: #58675d; font-size: 10px; }

.segmented { display: inline-flex; flex: none; gap: 2px; padding: 3px; border: 1px solid #eef0eb; border-radius: 8px; background: #f3f5f1; }
.segmented button { padding: 3px 8px; border: 1px solid transparent; border-radius: 6px; color: #58685e; background: transparent; font-size: 10px; white-space: nowrap; }
.segmented button:hover { color: #284c36; }
.segmented button.is-active, .segmented button[aria-pressed="true"] { color: #294733; border-color: #e2e9df; background: #fff; font-weight: 720; box-shadow: 0 1px 2px #2638290a; }
.trend-group { --bar: #c3b1e1; --bar-current: #8c74b2; }
.activity-trend { --bar: #aaccad; --bar-current: #5b926a; }
.trend-group + .trend-group { margin-top: 12px; padding-top: 11px; border-top: 1px solid #edf0eb; }
.trend-head, .trend-label { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.trend-head { margin-bottom: 6px; }
.trend-label { color: #425247; font-size: 11px; font-weight: 690; }
.trend-label svg { width: 14px; height: 14px; color: var(--bar-current); }
.trend-legend { color: #56665c; font-size: 10px; font-variant-numeric: tabular-nums; }
.mini-chart { display: flex; justify-content: space-between; gap: clamp(2px, .6vw, 9px); padding: 1px 1px 0; }
.chart-column { display: grid; flex: 1 1 0; min-width: 0; justify-items: center; gap: 3px; }
.chart-track { display: flex; align-items: flex-end; justify-content: center; width: 100%; height: 43px; padding: 2px 1px; border-bottom: 1px solid #e9ede7; }
.chart-track i { display: block; width: 72%; max-width: 30px; height: var(--bar-height, 0%); border-radius: 3px 3px 1px 1px; background: var(--bar); transition: height .3s ease; }
.mini-chart[data-count="14"] { gap: clamp(1px, .25vw, 4px); }
.chart-column.is-selected i { background: var(--bar-current); }
.chart-column span { width: 100%; overflow: hidden; color: #606c63; font-size: 9px; text-align: center; white-space: nowrap; }
.chart-column.is-selected span { color: #344a3c; font-weight: 760; }

.time-overview, .tasks-card { margin-top: 19px; }
.task-overview { display: flex; align-items: center; gap: 9px; margin-bottom: 8px; color: var(--muted); font-size: 11px; }
.progress-track { display: block; overflow: hidden; width: min(100%, 154px); height: 5px; border-radius: 10px; background: #edf1eb; }
#task-progress-fill { display: block; height: 100%; border-radius: inherit; background: #79a485; transition: width .18s ease; }
.task-list { display: grid; }
.task-row { display: flex; align-items: center; gap: 10px; min-width: 0; min-height: 42px; border-bottom: 1px solid #edf0eb; }
.task-row:last-child { border-bottom: 0; }
.task-check { flex: none; width: 16px; height: 16px; margin: 0; accent-color: #4b7658; cursor: pointer; }
.task-title { flex: 1 1 auto; min-width: 0; padding: 8px 0; border: 0; background: transparent; font-size: 13px; text-align: left; overflow-wrap: anywhere; }
.task-title:hover { color: var(--green); text-decoration: underline; }
.task-row.is-done .task-title { color: #606e65; text-decoration: line-through; }
.task-category { flex: none; padding: 2px 7px; border-radius: 5px; color: #445348; background: var(--event-soft, #edf3eb); font-size: 10px; }
.empty-state { padding: 17px 13px; border-radius: 8px; color: #637167; background: #f4f7f3; font-size: 12px; }

.detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 17px; }
.detail-grid .section-card, #detail-content > .section-card { min-height: 150px; }
.detail-grid .trend-group { margin-top: 20px; }
.detail-grid .chart-track { height: 125px; }
.detail-grid .card-head .btn { min-height: 32px; padding-inline: 10px; }
.record-list { display: grid; gap: 7px; }
.record-row { display: grid; gap: 3px; width: 100%; min-width: 0; padding: 10px 13px; border: 1px solid #e9eee7; border-radius: 8px; background: #f5f8f3; text-align: left; transition: background .18s ease, border-color .18s ease; }
.record-row:hover { border-color: #d4e1d1; background: #eef4ee; }
.record-row-title { color: #34463a; font-size: 13px; font-weight: 690; overflow-wrap: anywhere; }
.record-row-meta { color: #59695d; font-size: 11px; overflow-wrap: anywhere; }

.chat-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.22fr) minmax(0, 1fr);
  align-items: start;
  gap: 17px;
}

.chat-context { color: var(--quiet); font-size: 12px; }
.chat-transcript {
  display: flex;
  flex-direction: column;
  gap: 11px;
  min-height: 180px;
  max-height: clamp(260px, 48dvh, 440px);
  padding: 13px;
  overflow-y: auto;
  overscroll-behavior: contain;
  border: 1px solid #e6ede4;
  border-radius: 12px;
  background: #f7f9f5;
  scrollbar-width: thin;
}

.chat-empty {
  display: grid;
  flex: 1;
  align-content: center;
  min-height: 105px;
  padding: 13px;
  color: var(--quiet);
  font-size: 13px;
  line-height: 1.7;
  overflow-wrap: anywhere;
}

.chat-message {
  display: grid;
  flex: none;
  align-self: flex-start;
  gap: 3px;
  min-width: 0;
  max-width: 88%;
  padding: 9px 12px;
  border: 1px solid #e3ebe0;
  border-radius: 4px 12px 12px 12px;
  background: #fff;
}

.chat-message-user {
  align-self: flex-end;
  border-color: #d7e5d4;
  border-radius: 12px 4px 12px 12px;
  background: #e6f0e3;
}

.chat-message-role { color: #4b6755; font-size: 10px; font-weight: 730; }
.chat-message-copy { color: #293d30; font-size: 13px; line-height: 1.65; white-space: pre-wrap; overflow-wrap: anywhere; }
.chat-form { display: grid; gap: 9px; margin-top: 14px; }
.chat-form .chat-input {
  min-height: 108px;
  padding: 10px 12px;
  border-color: #dce6d9;
  border-radius: 10px;
  background: #fdfefb;
  font-size: 15px;
  line-height: 1.55;
}

.chat-input::placeholder { color: #69776d; }
.chat-compose-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.chat-compose-actions .btn { min-height: 41px; }
.chat-input-hint, .chat-status { color: var(--quiet); font-size: 11px; overflow-wrap: anywhere; }
.chat-status { color: #3f6550; font-weight: 650; }
.chat-status[data-status="error"] { color: #984838; }
.chat-status[data-status="disconnected"] { color: #765927; }
.chat-retry { justify-self: start; }
.chat-grid .btn:disabled { opacity: .55; cursor: default; }

.chat-candidate-list { display: grid; gap: 8px; }
.chat-candidate {
  display: grid;
  gap: 3px;
  min-width: 0;
  padding: 9px 11px;
  border: 1px solid #e1eae0;
  border-radius: 9px;
  background: #f7faf5;
}

.chat-candidate-top { display: flex; align-items: center; justify-content: space-between; gap: 9px; min-width: 0; }
.chat-candidate-type { display: inline-flex; align-items: center; gap: 4px; padding: 3px 6px; border-radius: 6px; color: #41644d; background: #e5efe2; font-size: 10px; font-weight: 720; }
.chat-candidate-type svg { width: 13px; height: 13px; }
.chat-candidate[data-record-type="sleep"] .chat-candidate-type { color: #66558a; background: #ede8f7; }
.chat-candidate[data-record-type="activity"] .chat-candidate-type { color: #76552e; background: #f8efe1; }
.chat-candidate[data-record-type="schedule"] .chat-candidate-type { color: #40627b; background: #e8eff5; }
.chat-candidate-title { color: #304b37; font-size: 13px; font-weight: 720; overflow-wrap: anywhere; }
.chat-candidate-meta { color: #516456; font-size: 11px; overflow-wrap: anywhere; }
.chat-candidate-copy { color: #43584b; font-size: 12px; line-height: 1.65; white-space: pre-wrap; overflow-wrap: anywhere; }
.chat-candidate-remove { flex: none; width: 36px; min-height: 36px; color: #7a5045; }
.chat-candidate-remove:hover { border-color: #eed9d0; background: #fcf0ea; }
.chat-questions {
  margin-top: 12px;
  padding: 9px 11px;
  border: 1px solid #efe5d4;
  border-radius: 9px;
  color: #674d2b;
  background: #fbf5e9;
  font-size: 12px;
  overflow-wrap: anywhere;
}

.chat-questions ul { margin: 6px 0 0; padding-inline-start: 18px; }
.chat-questions h3 { font-size: 12px; }
.chat-questions li + li { margin-top: 4px; }
.chat-review-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-top: 14px; }
.chat-review-actions .btn { min-height: 41px; }
.chat-review-link { display: none; }

.journal-grid {
  grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr);
  align-items: start;
}

.journal-editor > .card-head {
  padding-bottom: 13px;
  border-bottom: 1px solid var(--line);
}

.journal-form { display: grid; gap: 14px; }
.journal-form #journal-title {
  min-height: 44px;
  padding-inline: 12px;
  font-size: 16px;
  font-weight: 620;
}

.journal-form .journal-textarea {
  min-height: 320px;
  padding: 12px 15px;
  font-size: 16px;
  line-height: 29px;
  letter-spacing: .01em;
  background-color: #fcfdf8;
  background-image: repeating-linear-gradient(to bottom, transparent 0 28px, #e8eee4 28px 29px);
  background-origin: content-box;
  background-clip: padding-box;
  background-attachment: local;
  resize: vertical;
}

.journal-form ::placeholder { color: #68766c; font-weight: 450; }
.journal-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 7px 9px;
}

.journal-status {
  flex: 1 1 131px;
  min-width: 0;
  margin-inline-end: auto;
  color: var(--quiet);
  font-size: 11px;
  overflow-wrap: anywhere;
}

.journal-status[data-status="saved"] { color: #3d654b; }
.journal-status[data-status="draft"] { color: #715727; }
.journal-status[data-status="error"] { color: #984938; }
.journal-actions .btn-danger { border-color: #f0e2dd; color: #984938; background: #fff9f6; }
.journal-actions .btn-danger:hover { border-color: #e9d3ca; background: #fcefe9; }
.journal-actions .btn:disabled { opacity: .55; cursor: default; }

.journal-entries { display: grid; gap: 7px; }
.journal-entry {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-width: 0;
  padding: 10px 11px;
  border: 1px solid #e9eee7;
  border-radius: 8px;
  background: #f8faf7;
  text-align: left;
  transition: background .18s ease, border-color .18s ease;
}

.journal-entry:hover { border-color: #d4e1d1; background: #f0f5ef; }
.journal-entry[aria-current="date"] { border-color: #cbdcc9; background: #edf4eb; }
.journal-entry-copy { display: grid; gap: 3px; min-width: 0; }
.journal-entry-title, .journal-entry-preview {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  overflow-wrap: anywhere;
}

.journal-entry-title { color: #304737; font-size: 13px; font-weight: 700; }
.journal-entry-preview { color: #59695d; font-size: 11px; }
.journal-entry-date { color: #52665a; font-size: 10px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.journal-entry svg { width: 14px; height: 14px; color: #6a7c6d; }

.time-detail-grid {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.36fr);
  align-items: start;
}

.time-summary-card .card-head { flex-wrap: wrap; }
.time-summary-card .card-actions { flex-wrap: wrap; max-width: 100%; margin-inline-start: auto; }
.time-summary-card .time-chart-switch { color: var(--green); }
.time-chart-switch svg { width: 14px; height: 14px; }

.time-summary { display: grid; gap: 14px; }
.time-overview .card-head .btn { min-height: 32px; padding-inline: 10px; }
.time-summary-compact {
  grid-template-columns: minmax(156px, 1fr) minmax(0, 4fr);
  align-items: stretch;
  column-gap: 16px;
}

.time-summary-total {
  display: grid;
  align-content: center;
  justify-items: start;
  gap: 3px;
  min-height: 77px;
  padding: 10px 13px;
  border: 1px solid #e3ebe0;
  border-radius: 10px;
  background: #f1f6ef;
  color: #244832;
}

.time-summary-label { font-size: 11px; font-weight: 670; }
.time-summary-value, .time-donut-value {
  font: 720 clamp(19px, 2.05vw, 27px)/1.25 var(--display-font);
  letter-spacing: -.035em;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

.time-summary-value small, .time-donut-value small {
  margin-inline: 3px 2px;
  color: #495e50;
  font: 650 12px/1.3 var(--body-font);
  letter-spacing: 0;
}

.time-breakdown { display: grid; align-content: center; gap: 10px; min-width: 0; }
.time-stack {
  display: flex;
  overflow: hidden;
  gap: 2px;
  height: 10px;
  border-radius: 10px;
  background: #edf1eb;
}

.time-segment { flex: 0 1 var(--time-share, 0%); background: var(--time-color, #709882); }

.time-plot {
  display: grid;
  gap: 10px;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid #e6ede3;
  border-radius: 10px;
  background: #f7f9f6;
}

.time-chart-label { color: #536459; font-size: 11px; font-weight: 680; }
.time-plot .time-stack { height: 13px; background: #e6ede3; }
.time-plot .empty-state { padding: 1px 0 4px; background: transparent; }

.time-donut {
  display: grid;
  place-items: center;
  justify-self: center;
  width: min(100%, 170px);
  aspect-ratio: 1;
  margin: 0 0 3px;
  border-radius: 50%;
  background: var(--time-donut-fill, #e6ede3);
}

.time-donut-center {
  display: grid;
  place-content: center;
  gap: 3px;
  width: 73%;
  aspect-ratio: 1;
  padding: 5px;
  border-radius: 50%;
  background: #fcfdfa;
  color: #244832;
  text-align: center;
}

.time-donut-label { color: #536459; font-size: 11px; font-weight: 650; }
.time-donut-value { font-size: clamp(18px, 1.85vw, 24px); }
.time-donut-value small { margin-inline: 1px; font-size: 10px; }

.time-dayline { min-width: 0; }
.time-dayline-labels {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr)) 0;
  margin-bottom: 5px;
  color: #56685b;
  font-size: 10px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

.time-dayline-labels span { justify-self: start; transform: translateX(-50%); white-space: nowrap; }
.time-dayline-labels span:first-child { transform: none; }
.time-dayline-labels span:last-child { transform: translateX(-100%); }
.time-dayline-lanes {
  display: grid;
  border: 1px solid #e3ebdf;
  border-radius: 5px;
  background: #f1f5ef;
}

.time-dayline-lane {
  position: relative;
  min-height: 31px;
  background: repeating-linear-gradient(to right, transparent 0 calc(25% - 1px), #dce6d9 calc(25% - 1px) 25%);
}

.time-dayline-lane + .time-dayline-lane { border-top: 1px solid #e3ebdf; }
.time-dayline-block {
  position: absolute;
  inset-block: 5px;
  inset-inline-start: min(var(--time-start, 0%), calc(100% - 2px));
  width: max(2px, var(--time-length, 0%));
  padding: 0;
  border: 0;
  border-radius: 3px;
  background: var(--time-color, #709882);
  box-shadow: inset -1px 0 #ffffff75;
  transition: filter .18s ease;
}

.time-dayline-block:hover { filter: brightness(.83); }
.time-dayline-block:focus-visible { z-index: 1; outline-offset: 1px; }

.time-category-list { display: grid; gap: 0; margin: 0; padding: 0; list-style: none; }
.time-category {
  display: grid;
  grid-template-columns: 7px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 7px;
  min-width: 0;
  padding: 6px 0;
  border-bottom: 1px solid #edf0eb;
  color: #45564a;
  font-size: 11px;
}

.time-category:last-child { border-bottom: 0; }
.time-category-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--time-color, #709882); }
.time-category-name { font-weight: 650; overflow-wrap: anywhere; }
.time-category-duration { color: #334b3b; font-weight: 730; font-variant-numeric: tabular-nums; }
.time-category-share { min-width: 38px; color: #617068; text-align: right; font-variant-numeric: tabular-nums; }
.time-summary-compact .time-category-list { grid-template-columns: repeat(auto-fit, minmax(115px, 1fr)); gap: 5px 11px; }
.time-summary-compact .time-category {
  grid-template-columns: 7px minmax(0, 1fr) auto;
  gap: 6px;
  padding: 4px 7px;
  border-bottom: 0;
  border-radius: 6px;
  background: #f5f7f3;
}
.time-summary-note { grid-column: 1 / -1; padding: 7px 10px; border-radius: 7px; color: #6b532d; background: #fbf4e8; font-size: 11px; }
.time-summary > .empty-state { align-self: stretch; align-content: center; }

.time-log-list { display: grid; gap: 7px; }
.time-log-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 11px;
  width: 100%;
  min-width: 0;
  padding: 9px 11px;
  border: 1px solid transparent;
  border-left: 2px solid var(--time-color, #709882);
  border-radius: 8px;
  background: var(--time-soft, #f1f6ef);
  text-align: left;
  transition: border-color .18s ease;
}

.time-log-row:hover { border-color: var(--time-color, #709882); }
.time-log-interval { color: #536358; font-size: 11px; font-weight: 680; font-variant-numeric: tabular-nums; white-space: nowrap; }
.time-log-main { display: grid; gap: 1px; min-width: 0; }
.time-log-title { color: #2b3e30; font-size: 13px; font-weight: 710; overflow-wrap: anywhere; }
.time-log-meta { color: #59695d; font-size: 10px; overflow-wrap: anywhere; }
.time-log-duration { color: #334b3b; font-size: 11px; font-weight: 710; font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.time-log-edit { color: #5e7063; }
.time-log-edit svg, svg.time-log-edit { width: 14px; height: 14px; }

.record-dialog {
  width: min(500px, calc(100% - 28px));
  max-height: calc(100dvh - 28px);
  overflow-y: auto;
  padding: 0;
  border: 1px solid #d9e4d8;
  border-radius: 20px;
  color: var(--ink);
  background: #fff;
  box-shadow: 0 20px 85px #15281c35;
}

.record-dialog::backdrop { background: #14261f67; backdrop-filter: blur(3px); }
.record-dialog form { padding: 23px; }
.connection-dialog > .modal-header { margin-bottom: 0; padding: 19px 23px 0; }
.connection-content { display: grid; gap: 10px; padding: 12px 23px 21px; }
.connection-content p { color: var(--muted); font-size: 12px; line-height: 1.6; }
.connection-link { display: grid; gap: 5px; color: #455b4b; font-size: 12px; font-weight: 660; }
.connection-link input { flex: 1 1 125px; min-width: 0; padding: 9px 10px; border: 1px solid #dce5da; border-radius: 8px; color: #2b4835; background: #f6f9f4; font-size: 14px; font-weight: 550; }
.connection-copy, .connection-transfer { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.connection-copy { justify-content: flex-end; }
.connection-content .connection-message { color: #3f6550; font-size: 11px; overflow-wrap: anywhere; }
.modal-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.modal-header h2 { font-size: 23px; font-weight: 750; }
.modal-header .icon-button { width: 34px; min-height: 34px; }
.type-choices { display: grid; grid-template-columns: repeat(5, minmax(max-content, 1fr)); gap: 6px; margin-bottom: 15px; }
.type-choice { display: grid; justify-items: center; gap: 5px; padding: 7px 3px; border: 1px solid var(--line); border-radius: 8px; color: #536256; background: #f7f9f6; font-size: 11px; text-align: center; white-space: nowrap; }
.type-choice svg { width: 16px; height: 16px; }
.type-choice:hover, .type-choice.is-active, .type-choice[aria-pressed="true"] { color: #285039; border-color: #c7dcc6; background: #e9f2e7; }
.type-choice:disabled { opacity: .55; cursor: default; }
.type-choice:disabled:hover { color: #536256; border-color: var(--line); background: #f7f9f6; }
.record-fields, .field-grid { display: grid; gap: 12px; }
.field-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.field-grid[data-record-type="time"] .form-field:last-child { grid-column: 1 / -1; }
.form-field { display: grid; min-width: 0; gap: 5px; color: #455449; font-size: 12px; font-weight: 650; }
.form-field input, .form-field select, .form-field textarea { width: 100%; min-width: 0; min-height: 39px; padding: 7px 9px; border: 1px solid #dce5da; border-radius: 8px; color: var(--ink); background: #fcfdfa; font-size: 13px; font-weight: 450; }
.form-field textarea { min-height: 67px; resize: vertical; }
.time-form-help {
  display: flex;
  grid-column: 1 / -1;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 5px 11px;
  padding: 8px 10px;
  border-radius: 8px;
  background: #f1f6ef;
  color: #526459;
  font-size: 11px;
}

.time-form-duration { color: #2d553d; font-weight: 730; font-variant-numeric: tabular-nums; }
.modal-footer { display: flex; justify-content: flex-end; align-items: center; flex-wrap: wrap; gap: 7px; margin-top: 19px; }
.modal-footer .btn-danger { margin-right: auto; border-color: #f3ded7; color: #964d3c; background: #fff6f3; }
.modal-footer .btn-danger:hover { background: #f9e7e0; }
.toast { position: fixed; z-index: 5; right: max(16px, env(safe-area-inset-right)); bottom: max(16px, env(safe-area-inset-bottom)); max-width: calc(100% - 32px); padding: 9px 13px; border-radius: 8px; color: #fff; background: #234b36; box-shadow: 0 5px 24px #172c2250; font-size: 13px; }
.toast:empty { display: none; }

@media (max-width: 1150px) {
  :root { --sidebar-width: 192px; --page-gutter: 27px; }
  .sidebar { padding-right: 15px; padding-left: 15px; }
  .metric-card { padding-inline: 13px; }
  .section-card { padding-inline: 16px; }
}

@media (max-width: 950px) {
  .chat-review-link { display: inline-flex; justify-self: start; }
  :root { --sidebar-width: 164px; --page-gutter: 22px; }
  .sidebar { padding-inline: 11px; }
  .brand { margin-left: 5px; }
  .nav-link.is-active::after, .nav-link[aria-current="page"]::after { display: none; }
  .hero { min-height: 208px; padding-inline: 25px; }
  .metrics-grid { gap: 10px; }
  .metric-note { font-size: 10px; }
  .dashboard-grid { gap: 12px; }
  .card-head { gap: 7px; }
  .card-head h2 { font-size: 16px; }
  .segmented button { padding-inline: 5px; }
  .time-detail-grid, .journal-grid, .chat-grid { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 760px) {
  :root { --page-gutter: 18px; }
  .app-shell { display: block; }
  .sidebar { position: static; height: auto; overflow: visible; padding: 15px var(--page-gutter) 10px; border-right: 0; border-bottom: 1px solid var(--line); }
  .brand { margin-left: 0; }
  .brand-mark { width: 35px; height: 35px; border-radius: 9px; }
  .brand-mark svg { width: 21px; height: 21px; }
  .brand-text strong { font-size: 17px; }
  .brand-text small { margin-top: 2px; font-size: 8px; }
  .sidebar-main { grid-template-columns: repeat(7, minmax(max-content, 1fr)); gap: 5px; margin-top: 12px; }
  .nav-group { display: contents; }
  .nav-label, .sidebar-footer .local-status, .sidebar-footer .profile { display: none; }
  .sidebar-footer { display: flex; align-items: center; position: absolute; top: 12px; right: var(--page-gutter); gap: 5px; margin: 0; padding: 0; }
  .clear-demo { min-height: 40px; margin: 0; }
  .nav-link { justify-content: center; gap: 5px; min-height: 44px; padding: 0 8px; font-size: 12px; }
  .nav-link svg { width: 15px; height: 15px; }
  .topbar { min-height: 58px; padding-block: 7px; }
  .topbar-actions .btn { min-height: 33px; padding-inline: 10px; font-size: 11px; }
  .page-content { padding-top: 20px; }
  .page-heading { margin-bottom: 15px; }
  .hero { border-radius: 15px; }
  .hero::after { background: linear-gradient(90deg, #173a2b 0%, #173a2b 20%, #173a2bb8 58%, #173a2b31 100%); }
  .metrics-grid { margin-top: 15px; }
  .dashboard-grid { margin-top: 15px; }
}

@media (max-width: 620px) {
  .sidebar-main { gap: 4px; }
  .nav-link { flex-direction: column; gap: 3px; min-width: 44px; min-height: 49px; padding-inline: 4px; font-size: 11px; }
}

@media (max-width: 550px) {
  .metrics-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-grid, .detail-grid { grid-template-columns: minmax(0, 1fr); }
  .breadcrumbs { gap: 5px; font-size: 11px; }
  .breadcrumbs svg { width: 12px; height: 12px; }
  .topbar { gap: 4px; }
  .topbar-actions { gap: 4px; }
  .topbar-actions .btn { gap: 4px; padding-inline: 7px; }
  .topbar-actions .btn svg { width: 13px; height: 13px; }
  .hero { min-height: 199px; padding: 22px 18px; }
  .hero-art { inset-inline-start: 19%; }
  .hero p { max-width: 260px; font-size: 12px; }
  .hero-actions .btn { gap: 6px; padding-inline: 11px; }
  .metric-value { font-size: 25px; }
  .section-card { padding: 15px; }
  .chart-track { height: 54px; }
  .time-summary-compact { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .time-summary-compact .time-summary-total { grid-template-columns: 1fr auto; align-items: center; min-height: 57px; }
  .time-donut { width: min(100%, 156px); }
  .time-log-row { gap: 7px; padding: 8px; }
  .journal-form .journal-textarea { height: 296px; min-height: 238px; padding-inline: 11px; }
  .journal-status { flex-basis: 100%; }
  .chat-transcript { min-height: 145px; max-height: clamp(200px, 40dvh, 340px); padding: 9px; }
  .chat-empty { padding-inline: 8px; }
  .chat-message { max-width: 94%; padding: 8px 10px; }
  .chat-form .chat-input { min-height: 96px; font-size: 16px; }
  .chat-compose-actions .btn, .chat-review-actions .btn { min-height: 44px; }
  .chat-candidate-remove { width: 41px; min-height: 41px; }
  .chat-review-actions .chat-save { width: 100%; }
  .connection-dialog > .modal-header { padding: 16px 17px 0; }
  .connection-content { padding: 12px 17px 17px; }
  .connection-link input { font-size: 16px; }
}

@media (max-width: 460px) {
  .sidebar-main { grid-template-columns: minmax(0, 1fr); }
  .nav-group { display: grid; grid-template-columns: repeat(4, minmax(max-content, 1fr)); gap: 4px; }
  .nav-group:last-child { grid-template-columns: repeat(3, minmax(max-content, 1fr)); }
  .nav-link { flex-direction: row; gap: 4px; min-height: 44px; padding-inline: 3px; }
  .nav-link svg { width: 13px; height: 13px; }
}

@media (max-width: 380px) {
  .nav-link { flex-direction: column; gap: 3px; min-height: 47px; }
  .breadcrumbs > span, .breadcrumbs > svg { display: none; }
  .topbar-actions .btn { padding-inline: 6px; }
  .field-grid { grid-template-columns: minmax(0, 1fr); }
  .time-log-row { grid-template-columns: minmax(0, 1fr) auto auto; }
  .time-log-interval { grid-column: 1; }
  .time-log-main { grid-column: 1; }
  .time-log-duration { grid-column: 2; grid-row: 1 / span 2; }
  .time-log-edit { grid-column: 3; grid-row: 1 / span 2; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
