:root { color-scheme:light; --bg:#f7f8f3; --side:#edf1e8; --card:#fff; --ink:#29382c; --muted:#6b776c; --line:#e0e6da; --sage:#edf3e6; --green:#526e46; --soft:#dce8d1; --warm:#f9f4ea; --journal-field:#f2eadc; --journal-border:#d8c9b4; --blue:#657f99; --orange:#b58157; --shadow:0 10px 40px #2636230a; }
:root[data-theme="dark"] { color-scheme:dark; --bg:#141c16; --side:#19241c; --card:#202d23; --ink:#e7eee2; --muted:#a7b3a3; --line:#374738; --sage:#2a3927; --green:#b1cc9f; --soft:#3b5032; --warm:#302e24; --journal-field:#29291f; --journal-border:#4b493a; --blue:#94b1ce; --orange:#d3ad84; --shadow:none; }
.cloud-only { display:none; }
html[data-app-mode="cloud"] .cloud-only { display:block; }
html[data-app-mode="cloud"] .lan-only,
html[data-app-mode="cloud"] a[href="#history"],
html[data-app-mode="cloud"] a[href="#discover"],
html[data-app-mode="cloud"] .sidebar-foot a[href="/"] { display:none; }
html[data-app-mode="cloud"]:not([data-auth="ready"]) body { padding:0; }
html[data-app-mode="cloud"]:not([data-auth="ready"]) body > :is(main,.sidebar,.topbar,.mobile-scrim,dialog) { display:none; }
html[data-app-mode="cloud"] .account-gate { min-height:100dvh; display:grid; grid-template-columns:1.1fr 1fr; align-content:center; max-width:1080px; margin:auto; padding:64px 40px; gap:80px; }
html[data-auth="ready"] .account-gate { display:none; }
.account-intro { padding:30px 0; display:flex; flex-direction:column; align-items:flex-start; }
.account-intro .brand { margin-bottom:70px; padding:0; }
.account-intro .eyebrow { margin-bottom:16px; }
.account-intro h1 { font-size:52px; line-height:1.4; font-weight:600; margin-bottom:24px; text-wrap:balance; }
.account-intro > p:not(.eyebrow) { color:var(--muted); line-height:1.9; }
.account-intro-foot { margin-top:64px; padding-top:20px; border-top:1px solid var(--line); color:var(--green); font-size:12px; }
.account-entry { background:var(--card); padding:42px; border:1px solid var(--line); border-radius:24px; align-self:center; }
.account-entry h2 { margin:12px 0; font-size:25px; }
.account-entry form { margin-top:24px; }
.account-entry label { margin-bottom:6px; }
.account-entry input { margin-bottom:18px; }
.account-entry .primary { width:100%; margin-top:6px; }
.account-entry .caption { margin-top:24px; }
.account-settings { margin-bottom:20px; }
.admin-status { margin-bottom:20px; min-height:1.65em; }
.admin-metrics { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:20px; margin-bottom:20px; }
.admin-metrics h2 { font-size:14px; font-weight:500; color:var(--muted); }
.admin-number { display:block; font-size:36px; line-height:1.3; font-weight:600; font-variant-numeric:tabular-nums; margin:14px 0 8px; letter-spacing:-.04em; }
.admin-health-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:20px; margin-bottom:20px; }
.admin-service { background:var(--sage); }
.admin-facts { margin:20px 0; display:grid; gap:12px; }
.admin-facts > div { display:flex; justify-content:space-between; gap:16px; border-bottom:1px solid var(--line); padding-bottom:10px; }
.admin-facts dt { color:var(--muted); }
.admin-facts dd { margin:0; text-align:right; font-variant-numeric:tabular-nums; }
#adminBackupCard[data-state="failed"],#adminBackupCard[data-state="overdue"] { border-color:var(--orange); }
#adminBackupCard[data-state="failed"] h3,#adminBackupCard[data-state="overdue"] h3 { color:var(--orange); }
.admin-list { margin-bottom:20px; }
.admin-list .card-head { margin-bottom:8px; }
.admin-list-row { display:grid; grid-template-columns:minmax(0,1.5fr) minmax(0,1fr) auto; align-items:center; gap:20px; border-top:1px solid var(--line); padding:18px 0; }
.admin-list-row:first-child { border-top:0; }
.admin-list-row:last-child { padding-bottom:0; }
.admin-list-row > div { min-width:0; overflow-wrap:anywhere; }
.admin-list-row .chip { white-space:nowrap; }
.admin-empty { padding:16px 0 0; }
.admin-boundary { padding:4px 2px; }
@media(max-width:1100px) {
  .admin-health-grid { grid-template-columns:1fr; }
  .admin-number { font-size:28px; }
}
@media(max-width:600px) {
  .admin-metrics { grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px; }
  .admin-metrics .card:last-child { grid-column:1/-1; }
  .admin-metrics .card { padding:18px; }
  .admin-list-row { grid-template-columns:minmax(0,1fr) auto; gap:10px; }
  .admin-list-row > div:nth-child(2) { grid-column:1; grid-row:2; }
  .admin-list-row .chip { grid-column:2; grid-row:1; }
  .admin-facts > div { display:block; }
  .admin-facts dd { text-align:left; margin-top:3px; }
  #admin .page-heading { align-items:start; flex-direction:column; gap:12px; }
}
.account-settings > .card + .card { margin-top:20px; }
.account-card { display:flex; align-items:center; justify-content:space-between; flex-wrap:wrap; gap:16px; }
.account-card h2 { overflow-wrap:anywhere; }
.account-card .caption { margin-top:4px; }
.account-card .form-error { flex-basis:100%; }
.account-card .form-error:empty { display:none; }
.device-row { display:flex; align-items:center; justify-content:space-between; gap:20px; border-top:1px solid var(--line); padding:20px 0; }
.device-row > div { min-width:0; }
.device-row strong { overflow-wrap:anywhere; }
.device-row .button { flex:none; }
.device-enrolment { border-top:1px solid var(--line); padding-top:16px; margin-top:16px; }
.device-enrolment form { margin-top:20px; }
.consent-check { display:flex; gap:10px; align-items:flex-start; margin:20px 0; font-size:12px; color:var(--muted); }
.consent-check input { flex:none; width:18px; height:18px; min-height:0; margin-top:2px; accent-color:var(--green); }
.device-credential { margin-top:20px; padding:22px; border-radius:14px; border:1px solid var(--line); background:var(--sage); }
.device-credential .caption { margin-top:8px; margin-bottom:16px; }
.device-credential input { font-family:ui-monospace,monospace; font-size:13px; margin-bottom:12px; }
@media(max-width:800px) {
  html[data-app-mode="cloud"] .account-gate { grid-template-columns:1fr; gap:24px; max-width:520px; padding:32px 24px; }
  .account-intro { padding:0; }
  .account-intro .brand { margin-bottom:24px; justify-content:flex-start; }
  .account-intro .brand-name { display:block; }
  .account-intro h1 { font-size:32px; margin-bottom:12px; }
  .account-intro h1 br { display:none; }
  .account-intro .eyebrow,.account-intro-foot { display:none; }
  .account-entry { padding:26px; border-radius:20px; }
  .device-row { flex-wrap:wrap; gap:12px; }
}
* { box-sizing:border-box; }
html { scroll-padding-top:80px; }
body { --sidebar-width:208px; --topbar-height:64px; margin:0; padding-left:var(--sidebar-width); background:var(--bg); color:var(--ink); font:14px/1.65 "Avenir Next","PingFang SC","Microsoft YaHei",sans-serif; }
button,input,textarea,select { font:inherit; }
button,a,input,textarea,select,summary { -webkit-tap-highlight-color:transparent; }
button,a,summary { touch-action:manipulation; }
button { cursor:pointer; color:inherit; }
a { color:inherit; text-decoration:none; }
button:focus-visible,a:focus-visible,summary:focus-visible,input:focus-visible,textarea:focus-visible,select:focus-visible { outline:2px solid var(--green); outline-offset:4px; }
button:disabled { cursor:default; opacity:.5; }
[hidden] { display:none!important; }
.sprite { position:absolute; width:0; height:0; overflow:hidden; }
.icon { width:21px; height:21px; fill:none; stroke:currentColor; stroke-width:1.7; stroke-linecap:round; stroke-linejoin:round; flex:none; }
.sidebar { position:fixed; inset:0 auto 0 0; width:var(--sidebar-width); z-index:20; padding:30px 16px 20px; background:var(--side); display:flex; flex-direction:column; border-right:1px solid var(--line); overflow-y:auto; }
.brand { display:flex; align-items:center; gap:10px; padding:0 9px; font-weight:700; white-space:nowrap; }
.brand-mark { display:grid; place-items:center; width:32px; height:36px; background:var(--green); color:var(--bg); border-radius:12px 12px 4px 12px; font:italic 24px Georgia,serif; flex:none; }
.brand-name { font-size:13px; line-height:1.3; }
.sidebar .sidebar-toggle { display:none; }
nav { display:grid; gap:10px; margin-top:54px; }
.nav-button { display:flex; align-items:center; gap:14px; min-height:48px; border:0; border-radius:12px; padding:10px 15px; background:transparent; color:var(--muted); text-align:left; white-space:nowrap; }
.nav-button[aria-current="page"] { color:var(--green); background:var(--soft); font-weight:700; }
.nav-button:hover { background:var(--sage); }
.sidebar-foot { margin-top:auto; display:grid; gap:8px; }
.sidebar-note { font-size:11px; color:var(--muted); padding:14px 15px 0; border-top:1px solid var(--line); margin-top:12px; }
main { width:100%; margin-inline:auto; padding:24px 40px 48px; max-width:1840px; }
.topbar { position:fixed; top:0; left:var(--sidebar-width); right:0; z-index:15; height:var(--topbar-height); background:var(--bg); border-bottom:1px solid var(--line); }
.topbar-inner { height:100%; max-width:1840px; margin-inline:auto; padding-inline:40px; display:flex; align-items:center; justify-content:space-between; gap:16px; }
.breadcrumb { display:flex; align-items:center; gap:12px; font-size:12px; color:var(--muted); }
.preview-badge { color:var(--green); border:1px solid var(--line); border-radius:6px; padding:2px 7px; }
.topbar-actions { display:flex; gap:10px; align-items:center; flex:none; }
.icon-button { display:grid; place-items:center; height:40px; width:40px; border:1px solid var(--line); background:var(--card); border-radius:12px; }
.preview-note { margin:0 0 26px; color:var(--muted); font-size:12px; }
.page-heading { display:flex; justify-content:space-between; gap:16px; align-items:end; margin-bottom:26px; }
.eyebrow { color:var(--muted); margin:0 0 6px; font-size:12px; letter-spacing:.04em; }
h1 { font-size:32px; font-weight:650; letter-spacing:-.045em; line-height:1.3; margin:0; }
h2 { font-size:18px; margin:0; letter-spacing:-.025em; text-wrap:balance; }
h3 { font-size:15px; margin:0; }
p { margin:0; }
.muted { color:var(--muted); }
.small { font-size:12px; }
.button { min-height:40px; border:1px solid var(--line); border-radius:10px; padding:8px 14px; background:var(--card); display:inline-flex; align-items:center; justify-content:center; gap:7px; white-space:nowrap; }
.button.primary { border-color:var(--green); background:var(--green); color:var(--bg); }
.button.soft { background:var(--sage); color:var(--green); border-color:transparent; }
.text-button { background:none; border:0; color:var(--green); padding:7px 0; font-size:12px; }
.content-grid { display:grid; grid-template-columns:minmax(0,1.65fr) minmax(290px,1fr); gap:20px; align-items:start; }
.column { display:grid; gap:20px; min-width:0; }
.today-grid { grid-template-columns:minmax(0,1.35fr) minmax(340px,1fr); grid-template-areas:"story usage" "moments journal" "moments insight" "moments foot"; grid-template-rows:auto auto auto 1fr; }
.today-grid .story { grid-area:story; }
.today-grid .moments-card { grid-area:moments; }
.today-grid .usage-card { grid-area:usage; }
.today-grid .journal { grid-area:journal; }
.today-grid .insight-card { grid-area:insight; }
.today-grid .gentle { grid-area:foot; }
.card { padding:26px; border:1px solid var(--line); border-radius:20px; background:var(--card); min-width:0; }
.card-head { display:flex; justify-content:space-between; align-items:center; flex-wrap:wrap; gap:10px; margin-bottom:20px; }
.card-head h2 { display:flex; align-items:center; gap:9px; }
.story { position:relative; overflow:hidden; background:var(--sage); padding:30px; }
.story-content { position:relative; z-index:1; }
.story h2 { max-width:12em; font-size:27px; line-height:1.5; margin:14px 44px 13px 0; font-weight:600; }
.story p { max-width:90%; color:var(--muted); line-height:1.85; }
.chips { display:flex; flex-wrap:wrap; gap:8px; margin-top:20px; }
.chip { border:1px solid var(--line); padding:3px 10px; border-radius:20px; font-size:11px; color:var(--muted); }
.chip.manual { color:var(--orange); border-color:color-mix(in srgb,var(--orange) 35%,transparent); background:var(--warm); }
.story-foot { margin-top:22px; padding-top:15px; border-top:1px solid var(--line); display:flex; justify-content:space-between; gap:15px; font-size:11px; color:var(--muted); }
.segmented { display:flex; background:var(--bg); padding:3px; border:1px solid var(--line); border-radius:9px; }
.segmented button { background:transparent; border:0; border-radius:6px; padding:5px 9px; color:var(--muted); font-size:12px; }
.segmented button[aria-pressed="true"] { background:var(--card); color:var(--green); box-shadow:0 1px 4px #0000000c; }
.moment { display:grid; grid-template-columns:36px minmax(0,1fr); gap:13px; padding-bottom:22px; position:relative; }
.moment:not(:last-child)::before { content:''; position:absolute; left:17px; top:38px; bottom:2px; width:1px; background:var(--line); }
.moment-icon { display:grid; place-items:center; width:36px; height:36px; background:var(--sage); color:var(--green); border-radius:50%; }
.moment:nth-child(2) .moment-icon { background:var(--warm); color:var(--orange); }
.moment:nth-child(3) .moment-icon { color:var(--blue); background:color-mix(in srgb,var(--blue) 12%,var(--card)); }
.moment-time { color:var(--muted); font-size:11px; margin:0 0 5px; }
.moment h3 { margin-bottom:5px; }
.moment p { color:var(--muted); font-size:12px; }
details summary { cursor:pointer; color:var(--green); font-size:12px; width:fit-content; padding:8px 0 0; }
.manual-note { margin:13px 0 4px; padding:10px 12px; background:var(--warm); border-left:2px solid var(--orange); border-radius:0 9px 9px 0; font-size:12px; }
.manual-note small { display:block; color:var(--orange); margin-bottom:2px; }
.add-row { width:100%; min-height:44px; border:1px dashed var(--line); border-radius:10px; color:var(--green); background:transparent; text-align:center; }
label { display:grid; gap:6px; font-size:12px; color:var(--muted); margin-bottom:12px; }
input,select,textarea { width:100%; min-width:0; border:1px solid var(--line); border-radius:9px; background:var(--bg); color:var(--ink); padding:10px 12px; }
input,select { min-height:44px; }
textarea { display:block; min-height:170px; resize:vertical; font-size:14px; line-height:1.9; }
textarea::placeholder,input::placeholder { color:var(--muted); opacity:.8; }
.two-fields { display:grid; grid-template-columns:1fr 1fr; gap:12px; }
.form-foot { display:flex; flex-wrap:wrap; justify-content:space-between; align-items:center; gap:10px; margin-top:12px; }
.form-foot small { color:var(--muted); font-size:11px; }
.journal { background:var(--warm); }
.journal-entry { position:relative; }
.journal textarea { border:1px solid var(--journal-border); border-radius:12px; padding:14px 16px 14px 25px; background:var(--journal-field); min-height:145px; caret-color:var(--green); transition:border-color .18s ease,box-shadow .18s ease; }
.journal textarea:hover { border-color:color-mix(in srgb,var(--journal-border),var(--green) 35%); }
.journal textarea:focus { border-color:var(--green); box-shadow:0 0 0 3px color-mix(in srgb,var(--soft),transparent 18%); }
.journal label { color:var(--ink); margin-bottom:15px; cursor:text; }
.journal-caret { position:absolute; top:17px; left:16px; width:2px; height:20px; border-radius:1px; background:var(--green); pointer-events:none; animation:journal-caret-blink 1s steps(1,end) infinite; }
.journal textarea:focus + .journal-caret,.journal textarea:not(:placeholder-shown) + .journal-caret { display:none; }
.journal-foot { border-top:1px solid var(--line); padding-top:12px; display:flex; justify-content:space-between; gap:8px; font-size:11px; color:var(--muted); }
@keyframes journal-caret-blink { 0%,48% { opacity:1; } 49%,100% { opacity:0; } }
@media (prefers-reduced-motion:reduce) { .journal-caret { animation:none; } }
.donut { width:155px; height:155px; border-radius:50%; background:var(--line); margin:12px auto 22px; display:grid; place-items:center; }
.donut-center { width:113px; height:113px; border-radius:50%; display:flex; flex-direction:column; justify-content:center; align-items:center; background:var(--card); }
.donut strong { font-size:23px; font-weight:600; letter-spacing:-.04em; }
.donut small { color:var(--muted); font-size:10px; }
.distribution { display:grid; grid-template-columns:155px minmax(0,1fr); gap:24px; align-items:center; }
.distribution .donut { margin:8px 0; }
.legend { display:grid; gap:10px; }
.legend-row { display:flex; align-items:center; gap:9px; font-size:12px; }
.dot { width:8px; height:8px; border-radius:50%; background:var(--dot); flex:none; }
.legend-row b { margin-left:auto; font-weight:500; white-space:nowrap; }
.caption { color:var(--muted); font-size:11px; line-height:1.7; margin-top:18px; }
.gentle { border:0; background:none; padding:8px 10px; color:var(--muted); font-size:12px; }
.gentle strong { display:block; color:var(--green); font-weight:500; margin-bottom:5px; }
.memory { display:grid; grid-template-columns:50px minmax(0,1fr); gap:18px; padding:20px 0; border-bottom:1px solid var(--line); }
.memory:last-child { border:0; padding-bottom:0; }
.date-tile { font-size:25px; line-height:1.25; color:var(--green); }
.date-tile small { font-size:11px; display:block; color:var(--muted); }
.memory p { color:var(--muted); font-size:13px; margin-top:6px; }
.discovery-card { margin-top:18px; background:var(--sage); }
.discovery-layout { display:grid; grid-template-columns:minmax(0,1fr) minmax(0,1.1fr); gap:48px; align-items:center; padding-block:28px; }
.discovery-copy h2 { font-size:30px; line-height:1.5; font-weight:600; margin-bottom:16px; text-wrap:balance; }
.discovery-copy h2 > span { display:inline-block; max-width:100%; }
.discovery-phrase { display:inline-block; white-space:nowrap; }
.discovery-question { margin-top:24px; padding-left:16px; border-left:3px solid var(--green); }
.discovery-figure { margin:0; min-width:0; background:var(--card); padding:24px; border-radius:16px; }
.discovery-figure figcaption { font-size:13px; margin-bottom:24px; }
#discoveryChart { display:grid; grid-template-columns:repeat(8,minmax(0,1fr)); gap:8px; }
.distribution-bin { text-align:center; min-width:0; }
.distribution-bar { height:130px; display:flex; align-items:flex-end; margin-block:8px; }
.distribution-bar::after { content:''; display:block; width:100%; height:var(--bar-height); background:var(--soft); border-radius:6px 6px 2px 2px; }
.is-peak .distribution-bar::after { background:var(--green); }
.bin-value,.bin-label { display:block; font-size:10px; color:var(--muted); overflow-wrap:anywhere; }
.is-peak .bin-value,.is-peak .bin-label { color:var(--green); font-weight:650; }
.discovery-evidence { border-top:1px solid var(--line); padding-top:14px; }
.discovery-evidence summary,#discoveryReveal { cursor:pointer; color:var(--green); padding-block:8px; }
.discovery-feedback { border-top:1px solid var(--line); padding-top:18px; margin-top:18px; }
.discovery-feedback [aria-pressed="true"] { background:var(--green); color:var(--bg); }
.discovery-feedback p:empty { display:none; }
.discovery-feedback p { margin-top:8px; }
.discovery-foot { display:flex; flex-wrap:wrap; gap:12px; align-items:center; margin-top:20px; font-size:12px; }
.draft-recovery { padding:12px; border:1px solid var(--line); border-radius:10px; margin-block:12px; }
.draft-recovery textarea { min-height:120px; margin-block:10px; }
.timeline-focus { display:flex; align-items:center; justify-content:space-between; flex-wrap:wrap; gap:12px; padding:14px 18px; background:var(--sage); border-radius:12px; margin-bottom:14px; font-size:13px; }
.evidence-block.focus-match { outline:2px solid var(--ink); outline-offset:1px; z-index:2; }
.evidence-block.focus-muted { opacity:.35; }
.week-feedback { display:grid; gap:18px; margin-top:24px; }
.week-feedback-item { border-top:1px solid var(--line); padding-top:16px; }
.week-feedback-item h3 { font-size:13px; color:var(--green); margin-bottom:6px; }
.week-feedback-item p { margin:0; }
.week-feedback-item summary { font-size:12px; color:var(--muted); cursor:pointer; margin-top:8px; }
.week-feedback-item details button { margin-right:14px; }
@media(max-width:1100px) { .discovery-layout { grid-template-columns:1fr; gap:24px; } }
@media(max-width:480px) {
  .discovery-copy h2 { font-size:23px; } .discovery-figure { padding:16px 12px; }
  #discoveryChart { grid-template-columns:1fr; gap:12px; }
  .distribution-bin { display:grid; grid-template-columns:76px minmax(20px,1fr); gap:4px 8px; text-align:left; align-items:center; }
  .bin-label { grid-column:1; grid-row:1 / 3; font-size:11px; }
  .bin-value { grid-column:2; grid-row:1; font-size:11px; }
  .distribution-bar { grid-column:2; grid-row:2; height:8px; margin:0; }
  .distribution-bar::after { width:var(--bar-height); height:100%; border-radius:3px; }
  .discovery-card .card-head { flex-wrap:wrap; gap:8px; }
}
.settings-list { display:grid; gap:0; }
.setting-row { padding:18px 0; border-bottom:1px solid var(--line); display:flex; justify-content:space-between; align-items:center; gap:16px; }
.setting-row:last-child { border:0; }
.setting-row p { color:var(--muted); font-size:12px; }
.mobile-scrim { display:none; }
@media(min-width:1500px) { main { padding-inline:60px; } .content-grid { gap:26px; } }
@media(min-width:1101px) and (max-width:1279px) {
  .distribution { grid-template-columns:128px minmax(0,1fr); gap:12px; }
  .donut { width:128px; height:128px; } .donut-center { width:94px; height:94px; } .donut strong { font-size:19px; }
}
@media(max-width:1100px) { body { --sidebar-width:180px; } main { padding:22px; } .content-grid { grid-template-columns:minmax(0,1fr) 280px; gap:16px; } .today-grid { grid-template-columns:1fr; grid-template-areas:"story" "usage" "moments" "journal" "insight" "foot"; grid-template-rows:none; } .card { padding:22px; } .story h2 { font-size:24px; } }
@media(max-width:800px) {
  body { --sidebar-width:64px; }
  input,select,textarea { font-size:16px; }
  .sidebar { width:64px; padding:18px 8px max(18px,env(safe-area-inset-bottom)); }
  .brand { padding:0; justify-content:center; } .brand-name,.sidebar .nav-label,.sidebar-note { display:none; }
  .sidebar .sidebar-toggle { display:grid; margin:16px auto 0; background:transparent; border:0; }
  nav { margin-top:22px; gap:12px; } .nav-button { padding:11px; justify-content:center; min-height:46px; }
  main { padding:18px 18px 36px; }
  .content-grid { grid-template-columns:1fr; }
  .page-heading { align-items:start; margin-bottom:20px; } h1 { font-size:27px; }
  .page-heading > .button { font-size:12px; padding:7px 10px; }
  .preview-note { margin-bottom:22px; font-size:11px; }
  .card { padding:20px; border-radius:16px; } .story h2 { font-size:23px; margin-right:15px; } .story p { max-width:100%; }
  .story-foot { flex-wrap:wrap; }
  .sidebar-open .sidebar { width:220px; box-shadow:var(--shadow); }
  .sidebar-open .brand { justify-content:start; padding-left:10px; }
  .sidebar-open .brand-name,.sidebar-open .nav-label,.sidebar-open .sidebar-note { display:block; }
  .sidebar-open .nav-button { justify-content:start; padding-inline:18px; }
  .sidebar-open .sidebar-toggle { margin-left:auto; margin-right:10px; }
  .sidebar-open .mobile-scrim { display:block; position:fixed; inset:0 0 0 220px; z-index:19; border:0; background:#14201944; }
  .distribution { display:grid; grid-template-columns:145px minmax(0,1fr); gap:14px; align-items:center; }
  .donut { width:135px; height:135px; } .donut-center { width:98px; height:98px; } .donut strong { font-size:20px; }
}
@media(max-width:480px) {
  main { padding:16px 12px 32px; } .breadcrumb { gap:7px; font-size:11px; }
  h1 { font-size:25px; } h2 { font-size:17px; }
  .page-heading { flex-wrap:wrap; gap:12px; } .eyebrow { font-size:11px; }
  .card { padding:17px; } .story h2 { font-size:22px; }
  .card-head { align-items:start; } .segmented button { font-size:11px; padding-inline:7px; }
  .moment { grid-template-columns:28px minmax(0,1fr); gap:10px; }
  .moment-icon { width:28px; height:28px; } .moment-icon .icon { width:17px; height:17px; }
  .moment:not(:last-child)::before { left:13px; top:32px; }
  .distribution { grid-template-columns:1fr; } .distribution .donut { margin:0 auto 8px; }
  .two-fields { grid-template-columns:1fr; gap:0; }
  .memory { gap:8px; grid-template-columns:38px minmax(0,1fr); }
  .setting-row { flex-wrap:wrap; }
}
@media(max-height:550px) {
  .sidebar { padding-top:12px; padding-bottom:12px; }
  nav { margin-top:16px; gap:4px; }
  .sidebar-foot { margin-top:16px; gap:4px; }
  .sidebar-note { display:none; }
}

/* Real-data views share the same small-screen sidebar and colour tokens. */
.timeline-tools,.week-navigation,.inline-actions { display:flex; align-items:center; flex-wrap:wrap; gap:10px; }
.date-controls { display:flex; align-items:center; gap:6px; }
.date-controls input { width:148px; min-height:36px; padding:6px 9px; }
.date-controls .button { min-height:36px; width:32px; padding:0; }
.date-controls .text-button { padding-inline:8px; }
.topbar .icon-button { width:36px; height:36px; }
.error-banner { padding:12px 16px; border:1px solid var(--line); border-radius:12px; margin-bottom:18px; background:var(--sage); overflow-wrap:anywhere; }
.error-banner,.form-error { color:#a54435; }
:root[data-theme="dark"] .error-banner,:root[data-theme="dark"] .form-error { color:#f0b4a4; }
.error-banner { background:var(--warm); }
.form-error { margin:10px 0; }
.sr-only { position:absolute; width:1px; height:1px; padding:0; overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; }
.compact-select { width:auto; max-width:100%; min-height:36px; padding:5px 9px; font-size:12px; }
.donut strong { font-size:18px; white-space:nowrap; text-align:center; }
.detail-grid { display:grid; grid-template-columns:minmax(0,1.6fr) minmax(300px,1fr); gap:20px; margin-top:20px; align-items:start; }
.detail-grid > * { min-width:0; }
.page-tabs { width:fit-content; margin-bottom:16px; }
#weekStatus { margin-bottom:14px; }
.timeline-tools { margin-bottom:18px; }
.timeline-mode { border-color:var(--green); gap:3px; }
.timeline-mode button { min-height:40px; padding:7px 16px; font-size:14px; font-weight:600; color:var(--ink); }
.timeline-mode button[aria-pressed="true"] { background:var(--green); color:var(--bg); box-shadow:none; }
.timeline-range-actions { display:flex; gap:6px; }
.timeline-view-button { min-height:36px; padding:6px 11px; font-size:12px; }
.timeline-tools label { margin:0; }
.zoom-label { display:flex; align-items:center; gap:8px; }
.zoom-label input { width:140px; min-height:32px; padding:0; accent-color:var(--green); }
.zoom-label output { min-width:3ch; font-variant-numeric:tabular-nums; }
.evidence-scroll { overflow-x:auto; padding:4px 2px 12px; }
.evidence-canvas { min-width:100%; }
.evidence-scale { position:relative; margin-left:90px; height:34px; font-size:11px; color:var(--muted); border-bottom:1px solid var(--line); }
.scale-tick { position:absolute; bottom:0; height:5px; border-left:1px solid var(--line); }
.scale-tick.major { height:9px; border-color:var(--muted); }
.tick-label { position:absolute; bottom:12px; transform:translateX(-50%); white-space:nowrap; font-weight:400; }
.scale-tick:first-child .tick-label { transform:none; }
.scale-tick:last-child .tick-label { transform:translateX(-100%); }
.evidence-row { display:flex; align-items:center; gap:12px; margin-bottom:12px; }
.track-name { flex:0 0 78px; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-size:12px; position:sticky; left:0; z-index:2; background:var(--card); padding-block:12px; }
.evidence-track { position:relative; flex:1; min-width:0; height:42px; background:var(--bg); border-radius:8px; border:1px solid var(--line); }
.evidence-block { position:absolute; top:4px; height:32px; min-width:0; padding:0; border:0; border-radius:4px; overflow:hidden; white-space:nowrap; text-overflow:clip; font-size:11px; line-height:32px; text-align:center; background:var(--block-color); color:#fff; }
.evidence-block:focus-visible { z-index:3; }
.evidence-label { position:relative; z-index:1; pointer-events:none; }
.evidence-block.mixed-group { background:color-mix(in srgb,var(--block-color) 24%,var(--card)); color:var(--ink); border:1px dashed var(--block-color); }
.evidence-block.has-gaps { border-bottom:2px dashed var(--muted); }
.evidence-block.unknown { background:transparent; }
.group-gap-note { padding:9px 0; font-size:12px; color:var(--muted); border-bottom:1px dashed var(--line); }
.duration-presets { margin-bottom:10px; }
.evidence-block.idle,.evidence-block.locked,.evidence-block.corrected-afk { background:var(--line); color:var(--muted); }
.evidence-block.locked { background:color-mix(in srgb,var(--blue) 28%,var(--card)); }
.evidence-block.corrected-afk { border:1px dashed var(--muted); }
.evidence-block.manual-block { background:var(--warm); color:var(--orange); border:1px dashed var(--orange); height:30px; line-height:28px; }
.future-area { position:absolute; inset:0 0 0 auto; overflow:hidden; white-space:nowrap; font-size:11px; padding:10px 0; color:var(--muted); background:repeating-linear-gradient(135deg,transparent,transparent 5px,var(--line) 5px,var(--line) 6px); pointer-events:none; }
.record-list { max-height:670px; overflow-y:auto; }
.record-row { display:grid; grid-template-columns:minmax(0,1fr) auto auto; width:100%; gap:12px; align-items:center; padding:13px 0; text-align:left; background:none; border:0; border-bottom:1px solid var(--line); }
.record-row small,.rule-identity small { display:block; color:var(--muted); font-size:11px; }
.record-row strong,.rule-identity,.note-text,.memory p,.legend-row span { overflow-wrap:anywhere; }
button.record-row:hover { background:var(--sage); }
.record-row b { font-size:12px; white-space:nowrap; }
.record-row .chip { white-space:nowrap; }
.saved-note { padding:14px 0; border-bottom:1px solid var(--line); overflow-wrap:anywhere; }
.note-text { margin-top:6px; white-space:pre-wrap; }
.period-records { margin-top:10px; }
.rule-row { display:grid; grid-template-columns:minmax(0,1fr) 145px minmax(120px,auto); gap:18px; align-items:center; padding:18px 0; border-bottom:1px solid var(--line); }
.rule-row select { font-size:13px; }
.rule-row .inline-actions { justify-content:flex-end; }
.week-chart { display:grid; grid-template-columns:repeat(7,minmax(64px,1fr)); gap:8px; overflow-x:auto; padding:8px 0; }
.week-day { display:flex; flex-direction:column; gap:8px; align-items:center; padding:8px 0; border:0; border-radius:8px; background:transparent; min-width:0; font-size:12px; }
.week-day:hover:not(:disabled) { background:var(--sage); }
.week-day small { font-size:10px; color:var(--muted); white-space:nowrap; }
.week-bar-well { display:flex; align-items:end; height:140px; width:60%; max-width:46px; background:var(--bg); border-radius:7px; overflow:hidden; }
.week-bar { display:block; background:var(--green); width:100%; border-radius:7px; min-height:0; }
.week-change { padding:12px 0; border-bottom:1px solid var(--line); }
.week-change .chip { display:inline-block; margin-top:6px; }
.reflection-question { margin:16px 0; }
.wellbeing-card { margin-top:20px; background:var(--sage); }
.wellbeing-body { display:grid; grid-template-columns:1fr 1fr; align-items:center; gap:28px; margin-top:20px; }
.wellbeing-body h3 { font-size:23px; font-weight:600; line-height:1.4; margin-bottom:8px; }
.wellbeing-reminder { border-left:3px solid var(--green); padding:8px 0 8px 20px; line-height:1.9; }
.wellbeing-card summary { cursor:pointer; color:var(--green); font-size:13px; padding-top:20px; }
.wellbeing-night { display:flex; justify-content:space-between; align-items:center; gap:16px; padding:14px 0; border-bottom:1px solid var(--line); }
.wellbeing-night .text-button { flex-shrink:0; }
.night-actions { display:flex; flex-direction:column; align-items:flex-end; flex-shrink:0; }
.week-evidence { margin-top:16px; }
#weekHeadline { max-width:30em; }
.week-evidence summary,.memory-details summary { color:var(--green); cursor:pointer; font-size:12px; padding-block:8px; }
.observation-evidence { display:flex; flex-wrap:wrap; justify-content:space-between; gap:8px; align-items:center; font-size:12px; border-bottom:1px solid var(--line); padding-block:8px; }
.memory > div:last-child { min-width:0; }
.memory .journal-preview { color:var(--ink); margin-block:8px; overflow-wrap:anywhere; }
.memory-details { max-height:360px; overflow:auto; padding-right:4px; }
.memory .journal-full { white-space:pre-wrap; overflow-wrap:anywhere; color:var(--ink); margin-block:8px; }
.wellbeing-card .card-head { flex-wrap:wrap; }
@media(max-width:800px) { .wellbeing-body { grid-template-columns:1fr; gap:16px; } .wellbeing-body h3 { font-size:21px; } .wellbeing-night { flex-wrap:wrap; gap:8px; } }
dialog { width:min(560px,calc(100% - 32px)); max-height:calc(100dvh - 32px); padding:26px; border:1px solid var(--line); border-radius:20px; background:var(--card); color:var(--ink); overflow-y:auto; box-shadow:var(--shadow); }
dialog::backdrop { background:#14201977; backdrop-filter:blur(3px); }
dialog .card-head { margin-bottom:18px; }
dialog textarea { min-height:95px; }
dialog .caption { margin-bottom:16px; }
.group-description { margin-top:14px; overflow-wrap:anywhere; }
.group-distribution { margin-block:22px; }
.group-distribution .donut { margin-inline:auto; }
.group-time-section { margin-block:20px; }
.group-time-section h3 { font-size:13px; font-weight:500; }
.group-time-scale { display:flex; justify-content:space-between; gap:8px; margin:10px 0 7px; font-size:11px; color:var(--muted); font-variant-numeric:tabular-nums; }
.group-time-track { position:relative; height:34px; background:var(--bg); border:1px solid var(--line); border-radius:5px; }
.group-time-block { position:absolute; top:0; height:100%; min-width:0; padding:0; border:0; border-radius:2px; background:var(--block-color); color:#fff; font-size:10px; }
.group-time-block span { display:block; overflow:hidden; white-space:nowrap; text-overflow:ellipsis; padding-inline:3px; }
.group-time-block[aria-pressed="true"] { outline:2px solid var(--ink); outline-offset:2px; z-index:1; }
.group-time-selection { min-height:2.8em; margin-top:10px; font-size:11px; color:var(--muted); overflow-wrap:anywhere; }
#groupDialog details { border-top:1px solid var(--line); padding-block:12px; }
#groupDialog summary { cursor:pointer; color:var(--green); font-size:13px; }
#groupRecords,#groupAllAppsList { max-height:320px; overflow-y:auto; }
#groupRecords .record-row { display:block; font-size:12px; }
@media(max-width:1100px) { .detail-grid { grid-template-columns:1fr; gap:16px; } }
@media(max-width:800px) { .rule-row { grid-template-columns:minmax(0,1fr) 130px; gap:10px; } .rule-row .inline-actions { grid-column:1/-1; justify-content:flex-start; } }
@media(max-width:480px) {
  .record-row { grid-template-columns:minmax(0,1fr) auto; gap:6px; } .record-row > span:first-child { grid-column:1/-1; }
  .record-row .chip { justify-self:start; } .record-row b { justify-self:end; }
  .rule-row { grid-template-columns:minmax(0,1fr); } .rule-row select { width:100%; }
  dialog { padding:18px; }
}
/* Keep one compact bar above the scrolling page, including narrow phones. */
main { padding-top:calc(var(--topbar-height) + 24px); }
@media(min-width:1500px) { .topbar-inner { padding-inline:60px; } }
@media(max-width:1100px) { .topbar-inner { padding-inline:22px; } }
@media(max-width:800px) {
  body { --topbar-height:56px; }
  .topbar-inner { padding-inline:18px; }
  .topbar .breadcrumb { display:none; }
  .topbar-actions { width:100%; gap:8px; }
  .date-controls { margin-right:auto; }
  main { padding-top:calc(var(--topbar-height) + 20px); }
}
@media(max-width:480px) {
  .topbar-inner { padding-inline:10px; }
  .topbar-actions { gap:4px; }
  .date-controls { gap:4px; }
  .date-controls input { width:128px; padding-inline:3px; font-size:14px; }
  .date-controls .button { width:28px; }
  .topbar .icon-button { width:32px; height:36px; }
  #goToday { display:none; }
}
@media(max-width:380px) {
  .topbar-inner { padding-inline:8px; }
  .topbar-actions,.date-controls { gap:2px; }
  .date-controls input { width:110px; font-size:12px; }
  .date-controls .button { width:24px; }
  .topbar .icon-button { width:28px; }
}
/* Review navigation belongs to the fixed bar, not the report body. */
.history-controls { display:flex; align-items:center; gap:24px; flex:1; min-width:0; }
.history-controls .segmented { flex-shrink:0; }
.history-controls .week-navigation { margin-left:auto; flex-wrap:nowrap; gap:10px; }
.week-navigation strong { font-size:13px; white-space:nowrap; font-variant-numeric:tabular-nums; }
.topbar-notice { position:relative; color:var(--green); flex:none; }
.topbar-notice summary { display:flex; align-items:center; justify-content:center; height:36px; padding:0 10px; border-radius:9px; background:var(--soft); cursor:pointer; list-style:none; white-space:nowrap; font-size:12px; }
.topbar-notice summary::-webkit-details-marker { display:none; }
.topbar-notice p { position:absolute; right:0; top:44px; width:260px; max-width:calc(100vw - 90px); padding:12px 16px; border:1px solid var(--line); border-radius:12px; background:var(--card); color:var(--ink); box-shadow:var(--shadow); }
@media(max-width:1100px) {
  .history-page .topbar .breadcrumb { display:none; }
  .history-controls { gap:12px; }
  .topbar-notice summary { width:28px; padding:0; }
  .topbar-notice summary span { display:none; }
}
@media(max-width:800px) {
  .history-page { --topbar-height:96px; }
  .history-page .topbar-inner { display:grid; grid-template-columns:1fr auto; grid-template-rows:48px 48px; gap:0 8px; }
  .history-controls { display:contents; }
  .history-controls .segmented { grid-column:1; grid-row:1; width:fit-content; }
  .history-controls .week-navigation { grid-column:1/-1; grid-row:2; margin:0; justify-content:space-between; }
  .history-controls .week-navigation strong { min-width:0; white-space:normal; text-align:center; line-height:1.3; }
  .history-controls .week-navigation button { flex-shrink:0; }
  .history-page .topbar-actions { grid-column:2; grid-row:1; width:auto; }
}
