/* Singularity design layer (VISUAL_SPEC v0.1), loaded last.
   Components read the seven spec variables; a theme only changes their values (VS-04).
   Older variable names are pointed at the spec variables so existing parts follow without edits.
   Chat keeps its own multi-colour accents (Kain 10/19). */

/* ---- Self-hosted fonts (Kain 10/21) ------------------------------------------------------ */
/* Latin and figures: Courier Prime (SIL OFL 1.1). Chinese: 朱雀仿宋 Zhuque Fangsong (SIL OFL 1.1), split by
   unicode-range into small files in /assets/fonts/zhuque/zhuque.css (cn-font-split), loaded only as characters
   appear. Receipt headings only: Special Elite (Apache 2.0). Licences: /assets/fonts/licenses/. */
@font-face { font-family: "Courier Prime"; font-style: normal; font-weight: 400; font-display: swap;
  src: local("Courier Prime"), url("/assets/fonts/CourierPrime-Regular.ttf") format("truetype"); }
@font-face { font-family: "Courier Prime"; font-style: normal; font-weight: 700; font-display: swap;
  src: local("Courier Prime Bold"), url("/assets/fonts/CourierPrime-Bold.ttf") format("truetype"); }
@font-face { font-family: "Special Elite"; font-style: normal; font-weight: 400; font-display: swap;
  src: local("Special Elite"), url("/assets/fonts/SpecialElite-Regular.ttf") format("truetype"); }

/* ---- Theme values --------------------------------------------------------------- */
:root,
html[data-theme="paper"] {
  color-scheme: light;
  /* VISUAL_SPEC v0.2 §3: one red-brown hue, from page to ink. Each value has one role. */
  --bg: #EEEAE4;
  --sunken: #F5F1EB;
  --paper: #FCFAF6;
  --line: #DED7CC;
  --muted: #665E55;          /* on paper only, never small text on --bg; one step darker for 朱雀 (10/21) */
  --label: #765649;          /* small labels and section titles */
  --accent: #8A4552;
  --accent-deep: #6A2F3B;
  --accent-soft: #F3E7E6;
  --ink: #2A2522;
  --on-accent: #FCFAF6;
  --sidebar: #E3DDD4;        /* one step deeper than --bg: sidebar and phone bottom bar (Kain 10/20) */
}
html[data-theme="moon"] {
  color-scheme: dark;
  --ink-strong: #E8E6E3;      /* headings keep the earlier brighter off-white */
  --bg: #111316;
  --sidebar: #0C0E10;
  --sunken: #16181C;
  --paper: #1C1F23;
  --ink: #D4D0C9;             /* body text: a slightly grey off-white, never pure white (Kain 10/21) */
  --muted: #A2A5AA;
  --line: #2B2F35;
  --accent: #A3B5CB;
  --accent-soft: #222932;
  --label: #B5ACA5;
  --accent-deep: #8FA3BC;
  --on-accent: #121316;
}
html[data-theme="chat"] {
  color-scheme: light;
  --bg: #EDF2F6;
  --paper: #FFFFFF;
  --ink: #202A34;
  --muted: #56636F;
  --line: rgba(40, 61, 82, .15);
  --accent: var(--cobalt-500, #3F7BD9);
  --accent-soft: rgba(63, 123, 217, .11);
  --on-accent: #FFFFFF;
}
html[data-theme="chat"][data-bubble-style="wechat"] {
  --accent: var(--wechat-green, #54B66A);
  --accent-soft: rgba(84, 182, 106, .13);
}
html[data-theme="ipod"] {
  color-scheme: light;
  --bg: #DFE2E5;
  --paper: #FAFBFC;
  --ink: #1B1F24;
  --muted: #4E555C;
  --line: rgba(30, 36, 44, .14);
  --accent: #2F5FD0;
  --accent-soft: rgba(47, 95, 208, .09);
  --on-accent: #FFFFFF;
}

/* ---- Older names follow the spec variables ------------------------------------------ */
/* html:root outranks the old files' :root defaults (which are the dark theme's values).
   Repeated on body: paper's colours are set on body (10/22), and an alias resolved on html would keep the old red-brown. */
html:root, html:root body {
  --sunk: var(--sunken);
  --text: var(--ink);
  --panel: var(--paper);
  --panel-strong: var(--paper);
  --surface-control: var(--paper);
  --surface-soft: var(--sunken, var(--bg));
  --surface-sidebar: var(--paper);
  --page-background: var(--bg);
  --accent-ink: var(--on-accent);
  --shadow: none;
  --lcd: var(--accent-soft);
  --lcd-inset: inset 0 0 0 1px var(--line);
}
/* One accent everywhere except Chat; failures are said in words, not in red (spec §4). */
html:not([data-theme="chat"]), html:not([data-theme="chat"]) body {
  --gold: var(--accent);
  --blue: var(--accent);
  --sage: var(--accent);
  --rose: var(--ink);
}

/* ---- Type ---------------------------------------------------------------------------- */
html:root,
html[data-cn-font] {
  /* Latin and figures fall to Courier Prime, Chinese to 朱雀仿宋; the system Song faces are the fallback. */
  --font-ui: "Courier Prime", "Zhuque Fangsong", "Songti SC", "STSong", "SimSun", "Noto Serif SC", serif;
  --font-display: var(--font-ui);
  --font-mono: var(--font-ui);
  --font-receipt: "Special Elite", var(--font-ui);
  --font-cn: var(--font-ui);
  --font-latin: var(--font-ui);
  /* 正文 never below 15px; labels 13px. 朱雀 strokes are thin, so small text is one step darker (Kain 10/21). */
  --text-label: 13px;
  --text-small: 15px;
  --text-body: 16px;
  --text-title: 28px;
  --text-display: 40px;
}
body {
  color: var(--ink);
  background: var(--bg);
  font-family: var(--font-ui);
  font-size: var(--text-body);
  line-height: 1.6;
}
time, .live-clock, .num, [data-num] { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

/* ---- Cards: 14px corners, one hairline border, no heavy shadow ------------------------- */
.card,
.pulse-card,
.pos-current,
.pos-capacity,
.pos-today-route,
.pos-strip,
.v2-insight,
.ia-pending,
.post-v1-panel {
  border: 1px solid var(--line) !important;
  border-radius: 14px !important;
  background: var(--paper) !important;
  box-shadow: none !important;
}

/* ---- Desktop layout: one left edge (spec §2) ------------------------------------------- */
@media (min-width: 1024px) {
  .shell {
    width: auto;
    max-width: none;
    margin: 0;
    padding-left: 24px;
    padding-right: 24px;
    grid-template-columns: 220px minmax(0, 1120px);
    column-gap: 32px;
  }
  .desktop-sidebar { padding: 16px 12px; }
  .shell > :not(.desktop-sidebar) { max-width: 1120px; margin-left: 0; margin-right: 0; }
  .ia-records-view, .ia-health-hub, .ia-learning-view, .ia-review-view,
  .ia-task-header, .ia-calendar-view,
  body.workspace-routed #todayDashboard { max-width: 1120px; margin-left: 0 !important; margin-right: 0 !important; }
  body.workspace-routed[data-active-view] #todayDashboard { max-width: 1120px !important; }
  /* Page titles start at the same left edge as the cards below them. */
  .v2-page-heading { justify-content: flex-start; gap: 16px; text-align: left; margin-left: 0; margin-right: 0; }
  .v2-page-heading h2 { font-family: var(--font-ui); font-size: var(--text-title); font-weight: 500; }
  .ia-section-links { justify-content: flex-start; }
}

/* ---- Sidebar and top bar text sizes ------------------------------------------------------ */
.desktop-sidebar nav a,
.desktop-sidebar nav button { font-size: var(--text-body); }
.workspace-context strong { font-size: 18px; font-weight: 500; }
.workspace-context span { font-size: var(--text-label); letter-spacing: .08em; color: var(--muted); }
@media (max-width: 1023px) {
  .v2-page-heading h2 { font-family: var(--font-ui); font-size: 24px; font-weight: 500; }
}

/* ---- 外观 dialog: preview swatch for the paper theme -------------------------------------- */
.paper-preview { display: grid; gap: 6px; padding: 10px; border: 1px solid #DED7CC; border-radius: 10px; background: #EEEAE4; }
.paper-preview i, .paper-preview b { display: block; height: 10px; border-radius: 4px; background: #FCFAF6; border: 1px solid #DED7CC; }
.paper-preview b { width: 60%; background: #8A4552; border-color: #8A4552; }

/* ---- Mobile ＋ (opens Momo): the accent colour, no coloured glow ------------------------- */
.mobile-bottom-nav .mobile-add { color: var(--on-accent); background: var(--accent); box-shadow: none; }
/* Phone bottom bar: same band colour as the sidebar, no border or shadow; current item in the accent. */
.mobile-bottom-nav { border-top: 0 !important; background: var(--sidebar, var(--paper)) !important; box-shadow: none !important; backdrop-filter: none !important; }
.mobile-bottom-nav button[aria-current] { color: var(--accent); background: var(--accent-soft); }
.mobile-bottom-nav button[aria-current] :is(span, small, svg) { color: var(--accent); }

/* ---- Views: 首页 = entry cards; 今日安排 = Current + capacity + route; 今日小票 = the paper ---- */
body.workspace-routed[data-active-view="overview"] :is(#overview, #captureRow, #personalOsCockpit, #postV1AuthorityShell, #dailyPulse,
  #overviewStrips, #todayLine, #todayDashboard, #todayTrainingRibbon, .quick-nav) { display: none !important; }
body.workspace-routed[data-active-view="overview"] #homeEntries { display: grid !important; }
body.workspace-routed:is([data-active-view="day"], [data-active-view="receipt"]) #personalOsCockpit {
  display: grid !important; grid-template-columns: minmax(0, 1fr); grid-template-areas: none; gap: 24px; margin: 0 0 32px;
}
body.workspace-routed:is([data-active-view="day"], [data-active-view="receipt"]) #personalOsCockpit > * { grid-area: auto; }
body.workspace-routed[data-active-view="day"] #personalOsCockpit > :not(#posCurrent, #posCapacity),
body.workspace-routed[data-active-view="receipt"] #personalOsCockpit > :not(#posReceipt) { display: none !important; }

/* ---- 首页 entry cards (spec §6) ------------------------------------------------------ */
.home-entries { grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 16px; margin: 0 0 48px; }
.home-date { grid-column: 1 / -1; margin: 0 0 8px; color: var(--muted); font-size: var(--text-small); }
.home-card {
  display: flex; flex-direction: column; gap: 8px; min-width: 0; min-height: 112px; padding: 20px;
  border: 1px solid var(--line); border-radius: 14px; background: var(--paper); color: var(--ink);
  text-decoration: none; cursor: pointer;
}
.home-card:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.home-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.home-name { margin: 0; font-family: var(--font-ui); font-size: 18px; font-weight: 500; line-height: 1.3; color: var(--ink); }
.home-line { margin: 0; color: var(--muted); font-size: var(--text-body); line-height: 1.5; }
.home-line:empty { display: none; }
.home-line a { color: var(--ink); text-decoration: none; }
.home-line a:hover { color: var(--accent); }
.home-display { font-family: var(--font-display); font-style: italic; font-size: 22px; line-height: 1; color: var(--muted); }
.home-momo { grid-column: 1 / -1; flex-direction: row; align-items: center; gap: 16px; min-height: 96px; }
.home-avatar { flex: none; width: 56px; height: 56px; border-radius: 50%; object-fit: cover; background: var(--accent-soft); }
.home-momo-copy { display: grid; gap: 4px; min-width: 0; }
.home-receipt { grid-column: span 6; grid-row: span 2; }
.home-receipt .home-line { display: grid; gap: 12px; margin-top: auto; }
.home-progress { display: flex; align-items: center; gap: 12px; color: var(--ink); }
.home-progress b { font-weight: 500; font-size: 24px; }
.home-dots { display: inline-flex; gap: 4px; }
.home-dots i { width: 8px; height: 8px; border-radius: 50%; border: 1px dotted var(--muted); }
.home-dots i.on { border: 0; background: var(--accent); }
.home-sub { color: var(--muted); }
.home-health { grid-column: span 3; grid-row: span 2; }
.home-stack { display: grid; gap: 12px; margin: auto 0 0; }
.home-stack div { display: grid; gap: 2px; }
.home-stack dt { color: var(--muted); font-size: var(--text-label); letter-spacing: .08em; }
.home-stack dd { margin: 0; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.home-tasks, .home-calendar { grid-column: span 3; }
.home-plain { grid-column: span 4; min-height: 72px; justify-content: center; }
@media (max-width: 767px) {
  .home-entries { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-bottom: 32px; }
  .home-momo, .home-receipt { grid-column: 1 / -1; grid-row: auto; }
  .home-health, .home-tasks, .home-calendar, .home-plain { grid-column: span 1; grid-row: auto; }
  .home-receipt { min-height: 140px; }
  .home-card { padding: 16px; }
  .home-plain { min-height: 64px; }
}

/* ---- 今日小票 paper (spec §7) -------------------------------------------------------- */
#posReceipt { width: 100%; }
.rcpt-stage { display: flex; justify-content: center; padding: 8px 0 32px; }
.rcpt-paper {
  position: relative; width: min(100%, 520px); padding: 36px 32px 28px;
  border: 1px solid var(--line); border-bottom: 0; border-radius: 4px 4px 0 0;
  background: var(--paper); color: var(--ink); font-family: var(--font-ui);
}
html:not([data-theme="moon"]) .rcpt-paper {
  background: repeating-linear-gradient(90deg, transparent 0 11px, color-mix(in srgb, var(--ink) 2%, transparent) 11px 12px), var(--paper);
}
.rcpt-paper::after {
  content: ""; position: absolute; left: -1px; right: -1px; bottom: -12px; height: 12px; background: var(--paper);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='12' viewBox='0 0 16 12'%3E%3Cpath d='M0 0H16V2L8 12L0 2Z' fill='%23000'/%3E%3C/svg%3E") left top / 16px 12px repeat-x;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='12' viewBox='0 0 16 12'%3E%3Cpath d='M0 0H16V2L8 12L0 2Z' fill='%23000'/%3E%3C/svg%3E") left top / 16px 12px repeat-x;
}
.rcpt-head { display: grid; justify-items: center; gap: 4px; text-align: center; }
.rcpt-display { margin: 0; font-family: var(--font-display); font-style: italic; font-size: var(--text-display); line-height: 1.1; color: var(--ink); }
.rcpt-title-cn { margin: 0; font-size: var(--text-small); font-weight: 400; letter-spacing: .3em; color: var(--muted); }
.rcpt-day-nav { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; font-family: var(--font-mono); font-size: var(--text-small); color: var(--muted); }
.rcpt-day-nav button, .rcpt-links button { min-height: 40px; padding: 0 12px; border: 0; background: none; color: var(--ink); font: inherit; cursor: pointer; }
.rcpt-day-nav button[disabled] { color: var(--line); cursor: default; }
.rcpt-rule { margin: 20px 0; border-top: 1px dashed var(--muted); opacity: .6; }
.rcpt-meta { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; padding: 3px 0; font-size: var(--text-body); }
.rcpt-meta span { color: var(--muted); }
.rcpt-meta b { font-family: var(--font-mono); font-weight: 400; font-variant-numeric: tabular-nums; }
.rcpt-meta-bar { align-items: center; }
.rcpt-progress { display: flex; align-items: center; gap: 12px; }
.rcpt-progress-track { display: inline-flex; gap: 3px; }
.rcpt-progress-track i { width: 6px; height: 10px; border-radius: 1px; border: 1px dotted var(--muted); }
.rcpt-progress-track i.on { border: 0; background: var(--accent); }
.rcpt-progress b { font-family: var(--font-mono); font-weight: 500; min-width: 3.5em; text-align: right; }
.rcpt-section { margin: 0 0 12px; font-family: var(--font-mono); font-size: var(--text-label); letter-spacing: .12em; color: var(--muted); }
.rcpt-list { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }
.rcpt-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: baseline; gap: 12px; }
.rcpt-check { font-family: var(--font-mono); color: var(--accent); }
.rcpt-title { overflow-wrap: anywhere; }
.rcpt-time { font-family: var(--font-mono); font-size: var(--text-small); color: var(--muted); font-variant-numeric: tabular-nums; }
.rcpt-row.is-done .rcpt-title { color: var(--muted); text-decoration: line-through; }
.rcpt-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.rcpt-links button { color: var(--muted); }
.rcpt-links button:hover { color: var(--accent); }
@media (max-width: 767px) {
  .rcpt-paper { padding: 28px 20px 24px; }
  .rcpt-display { font-size: 34px; }
  .rcpt-progress-track { gap: 2px; }
  .rcpt-progress-track i { width: 5px; }
}

/* ---- 今日安排 (#/day): Current, 今日容量, 今日路线 as three plain cards (spec §3, §5) ---------- */
.pos-capacity { border: 0 !important; background: none !important; border-radius: 0 !important; }
.pos-current::before, .pos-today-route::before, .pos-resurface-item::before { content: none; }
.pos-current, .pos-capacity-status, .pos-today-route, .pos-resurface-item {
  border: 1px solid var(--line); border-radius: 14px; background: var(--paper); box-shadow: none;
}
.pos-current { min-height: 0; padding: 24px; }
.pos-current-heading h2 { margin: 4px 0 0; font-size: var(--text-title); font-weight: 500; line-height: 1.3; letter-spacing: 0; }
.pos-eyebrow { color: var(--muted); font-family: var(--font-ui); font-size: var(--text-label); font-weight: 400; letter-spacing: .08em; }
.pos-status-dot { padding: 4px 12px; font-size: var(--text-small); background: none; }
.pos-status-dot::before { box-shadow: none; }
.pos-status-dot.is-active { color: var(--accent); }
.pos-current-body { margin-top: 24px; gap: 24px; }
.pos-current-intent dl { gap: 16px; }
.pos-current-intent dl > div { border-left: 2px solid var(--line); padding-left: 12px; }
.pos-current-intent dt { font-family: var(--font-ui); font-size: var(--text-label); font-weight: 400; letter-spacing: .08em; }
.pos-current-intent dd { margin-top: 2px; font-size: var(--text-body); }
.pos-current-timer { min-width: 0; }
.pos-current-timer small { font-size: var(--text-label); letter-spacing: .08em; }
.pos-current-timer time { font-family: var(--font-mono); font-size: var(--text-display); font-weight: 400; letter-spacing: 0; }
.pos-current-actions { margin-top: 24px; padding-top: 16px; gap: 8px; }
.pos-current-actions button, .pos-switch-form button, .pos-current-more summary {
  min-height: 40px; padding: 8px 16px; border: 1px solid var(--line); border-radius: 999px;
  background: var(--paper); color: var(--ink); font-family: var(--font-ui); font-size: var(--text-small); font-weight: 400; letter-spacing: 0;
}
.pos-current-actions .is-done { color: var(--on-accent); border-color: var(--accent); background: var(--accent); }
.pos-current-more > div { background: var(--paper); box-shadow: none; }
.pos-field { font-size: var(--text-small); }
.pos-field-title input { font-size: 20px; }
.pos-primary { min-width: 0; gap: 16px; font-family: var(--font-ui); font-size: var(--text-body); color: var(--on-accent); background: var(--accent); }

.pos-capacity-status { padding: 20px 24px; }
.pos-capacity-head h2 { margin: 0; font-family: var(--font-ui); font-size: 18px; font-weight: 500; letter-spacing: 0; }
.pos-capacity-level { margin: 4px 0 0; font-size: var(--text-title); line-height: 1.2; color: var(--ink); }
.pos-capacity-orb { width: 44px; height: 44px; box-shadow: none; }
.pos-capacity-orb i, .pos-capacity-orb.is-low i, .pos-capacity-orb.is-high i { background: var(--accent); opacity: 1; }
.pos-capacity-switch { margin-top: 16px; padding: 4px; background: var(--bg); }
.pos-capacity-switch button { min-height: 40px; font-family: var(--font-ui); font-size: var(--text-small); font-weight: 400; letter-spacing: 0; }
.pos-capacity-switch button[aria-pressed="true"] { color: var(--on-accent); background: var(--accent); }
.pos-capacity-details { margin-top: 16px; padding-top: 12px; }
.pos-capacity-details summary { font-size: var(--text-small); }
.pos-capacity-details label { gap: 4px; font-size: var(--text-small); }
.pos-capacity-details :is(input, select) { font-size: var(--text-body); }

.pos-today-route { padding: 20px 24px; }
.pos-today-route header h2 { margin: 0; font-family: var(--font-ui); font-size: 18px; font-weight: 500; letter-spacing: 0; }
.pos-route-list { margin: 16px 0 0; }
.pos-route-list::before { content: none; }
.pos-route-item { grid-template-columns: 72px minmax(0, 1fr); gap: 16px; min-height: 0; padding: 14px 0; border-top: 1px solid var(--line); }
.pos-route-item:last-child { border-bottom: 0; }
.pos-route-label { padding-top: 1px; color: var(--muted); font-family: var(--font-ui); font-size: var(--text-small); font-weight: 400; letter-spacing: 0; }
.pos-route-item[data-route-slot="main"] .pos-route-label { color: var(--accent); }
.pos-route-label i { font-size: 8px; }
.pos-route-copy strong { font-size: var(--text-body); font-weight: 500; }
.pos-floor-fallback { grid-template-columns: auto minmax(0, 1fr); gap: 4px 12px; margin-top: 8px; padding: 6px 0 6px 12px; border-left: 2px solid var(--line); background: none; }
.pos-floor-fallback > b { color: var(--muted); font-family: var(--font-ui); font-size: var(--text-small); font-weight: 400; letter-spacing: 0; }
.pos-floor-fallback > span { font-size: var(--text-small); font-weight: 400; }
.pos-provenance summary { font-size: var(--text-label); }
.pos-provenance li { font-size: var(--text-label); }
.pos-resurfacing > header h2 { font-size: 18px; font-weight: 500; }
.pos-resurface-item > header { font-family: var(--font-ui); font-size: var(--text-label); letter-spacing: .04em; }
.pos-resurface-item > p { font-size: var(--text-small); }

@media (min-width: 1024px) {
  body.workspace-routed[data-active-view="day"] #posCapacity { display: grid; grid-template-columns: minmax(0, 4fr) minmax(0, 8fr); gap: 16px; align-items: start; }
}
@media (max-width: 767px) {
  .pos-current { padding: 20px 16px; }
  .pos-current-heading h2 { font-size: 24px; }
  .pos-current-body { grid-template-columns: minmax(0, 1fr); }
  .pos-current-timer { text-align: left; }
  .pos-capacity-status, .pos-today-route { padding: 16px; }
  .pos-route-item { grid-template-columns: 56px minmax(0, 1fr); gap: 12px; }
}
.pos-inline-status { min-height: 0; color: var(--ink); font-size: var(--text-small); }
.pos-inline-status:empty { display: none; }
/* Themes change colours only (VS-04): no per-theme gradients or ornaments on these cards. */
html[data-theme] :is(.pos-current, .pos-capacity-status, .pos-today-route, .pos-resurface-item) { background: var(--paper); }
html[data-theme] .pos-current::after { content: none; }

/* ---- 今日小票: tick, edit in place, 撤销 ---------------------------------------------- */
button.rcpt-check { min-width: 40px; min-height: 40px; margin: -10px 0; padding: 0; border: 0; background: none; font: inherit; font-family: var(--font-mono); color: var(--accent); cursor: pointer; }
button.rcpt-check:focus-visible, .rcpt-title.is-editable:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.rcpt-row { grid-template-columns: 40px minmax(0, 1fr) auto; }
.rcpt-title.is-editable { cursor: text; border-radius: 4px; }
.rcpt-title.is-editable:hover { background: var(--accent-soft); }
.rcpt-edit { width: 100%; min-width: 0; margin: -4px 0; padding: 3px 6px; border: 1px solid var(--accent); border-radius: 6px; background: var(--paper); color: var(--ink); font: inherit; }
.rcpt-toast {
  position: fixed; left: 50%; bottom: 24px; z-index: 60; transform: translateX(-50%);
  display: flex; align-items: center; gap: 16px; max-width: calc(100vw - 32px); padding: 10px 12px 10px 20px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--ink); color: var(--paper); font-size: var(--text-small);
}
.rcpt-toast[hidden] { display: none; }
.rcpt-toast span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rcpt-toast button { min-height: 32px; padding: 0 12px; border: 0; border-radius: 999px; background: var(--paper); color: var(--ink); font: inherit; cursor: pointer; }
.rcpt-toast button[hidden] { display: none; }
@media (max-width: 767px) { .rcpt-toast { bottom: calc(96px + env(safe-area-inset-bottom, 0px)); } }

/* ---- Layering (Kain 10/20): the sidebar is a full-height band one step deeper than the page, no border ---- */
.desktop-sidebar { border: 0 !important; background: var(--sidebar, transparent) !important; box-shadow: none !important; backdrop-filter: none !important; }
@media (min-width: 1024px) {
  .shell { padding-left: 0; }
  .desktop-sidebar { position: sticky; top: 0; align-self: start; margin-top: -20px; min-height: 100dvh !important; max-height: 100dvh !important;
    padding: 36px 16px 20px !important; border-radius: 0 !important; }
}
.sidebar-link[aria-current] { color: var(--accent); border-color: transparent; background: var(--accent-soft); }
.sidebar-quick-add { color: var(--ink); border: 1px solid var(--line); background: var(--paper); }
/* Old health blocks each mixed their own tint (pink meals, grey medicine); they share the inset level now. */
.meal-box, .medication-box, .tutor-entry, .calendar-sync-item, .health-section {
  border-color: var(--line) !important; background: var(--sunken) !important;
}
.meal-row input, .supplement-row input[type="text"], .supplement-slot, .meal-tag-field, .meal-calorie { background: var(--paper); border-color: var(--line); }
.supplement-check input:checked + span, .supplement-history span.done { color: var(--on-accent); border-color: var(--accent); background: var(--accent); }

/* ---- 任务 page (VISUAL_SPEC §11) --------------------------------------------------------- */
body.workspace-routed[data-active-view="tasks"] #todayDashboard { display: none !important; }
body.workspace-routed[data-active-view="tasks"] #tasksPage { display: grid !important; }
.tk-page { gap: 24px; margin: 0 0 48px; }
.tk-page > .card { margin: 0 !important; padding: 20px 24px; }
.tk-timedock { margin-left: auto; color: var(--muted); font-size: var(--text-small); text-decoration: none; }
.tk-timedock:hover { color: var(--accent); }
.tk-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.tk-head h2 { margin: 0; font-family: var(--font-ui); font-size: 18px; font-weight: 500; }
.tk-count { color: var(--ink); font-size: var(--text-body); }
.tk-progress { display: inline-flex; gap: 3px; }
.tk-progress i { width: 6px; height: 10px; border-radius: 1px; border: 1px dotted var(--muted); }
.tk-progress i.on { border: 0; background: var(--accent); }
.tk-focus { margin-left: auto; min-height: 36px; padding: 0 14px; border: 1px solid var(--line); border-radius: 999px;
  background: var(--paper); color: var(--ink); font: inherit; font-size: var(--text-small); cursor: pointer; }
.tk-focus:hover { border-color: var(--accent); color: var(--accent); }
.tk-list { display: grid; margin: 12px 0 0; padding: 0; list-style: none; }
.tk-row { display: grid; grid-template-columns: 32px minmax(0, 1fr) auto 64px; align-items: center; gap: 12px;
  min-height: 52px; border-top: 1px solid var(--line); }
.tk-row:first-child { border-top: 0; }
.tk-check { width: 22px; height: 22px; padding: 0; border: 1.5px solid var(--muted); border-radius: 50%; background: transparent; cursor: pointer; }
.tk-check:hover { border-color: var(--accent); }
.tk-check[aria-pressed="true"] { border-color: var(--accent); background: var(--accent)
  url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 8.5l2.5 2.5L12 5.5' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 14px no-repeat; }
.tk-title { min-width: 0; overflow-wrap: anywhere; color: var(--ink); font-size: var(--text-body); border-radius: 4px; cursor: text; }
.tk-title[data-tk-edit]:hover { background: var(--accent-soft); }
.tk-title:focus-visible, .tk-check:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.tk-row.is-done .tk-title { color: var(--muted); text-decoration: line-through; }
.tk-time { padding: 0; background: none; color: var(--accent);
  font-family: var(--font-mono); font-size: var(--text-small); white-space: nowrap; }
.tk-time.is-note { color: var(--muted); font-family: inherit; }
.tk-row.is-done .tk-time { background: transparent; color: var(--muted); }
.tk-est { color: var(--muted); font-family: var(--font-mono); font-size: var(--text-label); text-align: right; white-space: nowrap; }
.tk-edit { width: 100%; min-width: 0; padding: 4px 8px; border: 1px solid var(--accent); border-radius: 6px; background: var(--paper); color: var(--ink); font: inherit; }
.tk-add { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 8px; margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); }
.tk-add input, .tk-add select { min-height: 44px; min-width: 0; padding: 0 12px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--sunken); color: var(--ink); font: inherit; font-size: var(--text-body); }
.tk-add input:focus, .tk-add select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.tk-add button { min-height: 44px; padding: 0 18px; border: 0; border-radius: 10px; background: var(--accent); color: var(--on-accent); font: inherit; cursor: pointer; }
.tk-add button:disabled { opacity: .6; }
.tk-day + .tk-day { margin-top: 12px; }
.tk-date { margin: 12px 0 0; color: var(--muted); font-size: var(--text-label); font-weight: 400; letter-spacing: .08em; }
.tk-row.is-later { min-height: 44px; }
.tk-dot { width: 6px; height: 6px; margin-left: 8px; border-radius: 50%; background: var(--line); }
/* 待定 card on the same scale */
#pendingTasks .ia-pending-group > summary h2 { font-family: var(--font-ui); font-size: 18px; font-weight: 500; }
#pendingTasks .ia-pending-group > summary::after, #pendingTasks .ia-pending-count { font-size: var(--text-small); }
#pendingTasks .ia-pending-name { font-size: var(--text-body); }
#pendingTasks .ia-pending-actions button, #pendingTasks .ia-pending-date button { font-size: var(--text-small); }
@media (max-width: 767px) {
  .tk-page { gap: 12px; margin-bottom: 32px; }
  .tk-page > .card { padding: 16px; }
  .tk-row { grid-template-columns: 28px minmax(0, 1fr) auto; }
  .tk-est { display: none; }
  .tk-add { grid-template-columns: minmax(0, 1fr) auto; }
  .tk-add input { grid-column: 1 / -1; }
}
.tk-check { flex: none; width: 22px !important; height: 22px !important; min-width: 22px; min-height: 0 !important; justify-self: center; }
/* Page titles sit on the left edge on phones too, with their link on the same line. */
@media (max-width: 1023px) {
  .v2-page-heading { display: flex; flex-direction: row; align-items: center; justify-content: flex-start; gap: 12px; text-align: left; }
  .v2-page-heading > div { text-align: left; }
}

/* ---- 健康 page (VISUAL_SPEC §7.6) --------------------------------------------------------- */
#healthHub .ia-section-links { gap: 8px; }
#healthHub .ia-section-links button { min-height: 40px; padding: 0 16px; border: 1px solid var(--line); border-radius: 999px;
  background: var(--paper); color: var(--muted); font-size: var(--text-small); }
#healthHub .ia-section-links button[aria-current] { border-color: var(--accent); background: var(--accent); color: var(--on-accent); }
#healthHub .ia-health-summary-grid { gap: 16px; }
#healthHub .ia-health-summary-grid article { padding: 20px; border: 1px solid var(--line); border-radius: 14px; background: var(--paper); box-shadow: none; }
#healthHub .ia-health-summary-grid span { color: var(--muted); font-size: var(--text-label); letter-spacing: .08em; }
#healthHub .ia-health-summary-grid strong { font-size: var(--text-body); font-weight: 500; }
#healthHub .ia-health-summary-grid strong:empty { display: none; }
#healthHub .ia-health-summary-grid button { color: var(--accent); font-size: var(--text-small); }
#healthHub .ia-activity-sources summary { color: var(--muted); font-size: var(--text-small); }

#health { padding: 24px; }
#health .card-head h2 { font-family: var(--font-ui); font-size: 18px; font-weight: 500; }
#health .pill { border-color: var(--line); background: var(--sunken); color: var(--muted); font-size: var(--text-label); }
#health .health-week-picker { padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--sunken); }
#health .health-week-toolbar strong { font-family: var(--font-mono); font-size: var(--text-small); font-weight: 400; }
#health .health-week-toolbar button { font-size: var(--text-small); }
#health .health-week-day { min-height: 72px; border-color: var(--line); background: var(--paper); color: var(--muted); }
#health .health-week-day span, #health .health-week-day small { font-size: var(--text-label); }
#health .health-week-day strong { font-family: var(--font-mono); font-size: 20px; font-weight: 400; color: var(--ink); }
#health .health-week-day.has-record small { color: var(--accent); }
#health .health-week-day.has-record::after { background: var(--accent); }
#health .health-week-day.is-today { box-shadow: inset 0 0 0 1px var(--accent); }
#health .health-week-day.is-selected { border-color: var(--accent); background: var(--accent); color: var(--on-accent); transform: none; }
#health .health-week-day.is-selected strong, #health .health-week-day.is-selected small { color: var(--on-accent); }
#health .health-date-hint { color: var(--ink); font-size: var(--text-small); }
#health .health-date-hint:empty { display: none; }

#health .field label, #health .compact-field span, #health .meal-label, #health .exercise-metric span { color: var(--muted); font-size: var(--text-small); }
#health :where(input:not([type="checkbox"]):not([type="radio"]), select) { min-height: 44px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--paper); color: var(--ink); font-size: var(--text-body); }
#health .health-section, #health .meal-box, #health .medication-box { padding: 20px; border-radius: 12px; }
#health .health-section h3, #health .meal-title, #health .medication-title { margin: 0; color: var(--ink); font-family: var(--font-ui); font-size: 16px; font-weight: 500; }
#health .medication-note, #health .supplement-title { color: var(--muted); font-size: var(--text-small); }
#health .sleep-summary { color: var(--ink); font-family: var(--font-mono); font-size: var(--text-small); font-weight: 400; }
#health .sleep-track { height: 12px; border-color: var(--line); background: var(--paper); }
#health .sleep-track span { background: var(--accent); }
#health .sleep-scale span { font-family: var(--font-mono); font-size: var(--text-label); color: var(--muted); }
#health .nap-row { font-size: var(--text-small); color: var(--muted); }
#health .sleep-momo-feedback { border-color: var(--line); background: var(--paper); }
#health .sleep-momo-feedback::after { background: var(--paper); }
#health .sleep-momo-feedback p { font-size: var(--text-small); color: var(--ink); }
#health .sleep-momo-feedback > span { color: var(--accent); }
#health .exercise-entry { min-height: 56px; border-color: var(--line); background: var(--paper); }
#health .exercise-toggle span { font-size: var(--text-body); font-weight: 400; }
#health .exercise-metric input { min-height: 0; border: 0; background: transparent; font-family: var(--font-mono); text-align: right; }
#health .calorie-budget { border-color: var(--line); background: var(--paper); }
#health .calorie-budget span { font-family: var(--font-mono); font-size: var(--text-label); }
#health .calorie-ring-copy strong { font-family: var(--font-mono); font-weight: 400; }
#health .calorie-ring-copy small, #health .calorie-delta { color: var(--muted); font-size: var(--text-label); }
#health .meal-tag { border-color: var(--line); background: var(--accent-soft); color: var(--ink); font-size: var(--text-small); }
#health .meal-tag-field input, #health .meal-calorie input { min-height: 0; border: 0; background: transparent; }
#health .dose-chip span { padding: 12px 8px; border-color: var(--line); background: var(--paper); color: var(--ink); font-size: var(--text-small); }
#health .dose-chip input:checked + span { border-color: var(--accent); background: var(--accent); color: var(--on-accent); }
#health .supplement-history span { font-size: var(--text-label); background: var(--paper); }
#health .add-supplement { color: var(--accent); font-size: var(--text-small); }
#health .save-row { justify-content: flex-end; margin-top: 16px; }
#health .save-row .button { min-height: 44px; padding: 0 20px; border-radius: 10px; background: var(--accent); color: var(--on-accent); font-size: var(--text-body); }
#health .saved { color: var(--muted); font-size: var(--text-small); }
@media (max-width: 767px) {
  #health { padding: 16px; }
  #health .health-section, #health .meal-box, #health .medication-box { padding: 16px; }
  #health .health-week-day { min-height: 64px; }
  #health .health-week-day strong { font-size: 17px; }
}
#healthHub .ia-section-links { scrollbar-width: none; }
#healthHub .ia-section-links::-webkit-scrollbar { display: none; }
#healthHub .ia-health-summary-grid article { min-height: 0 !important; }
@media (max-width: 767px) {
  #healthHub .ia-health-summary-grid { gap: 12px; }
  #healthHub .ia-health-summary-grid article { display: grid; grid-template-columns: 56px minmax(0, 1fr) auto; align-items: center; gap: 4px 12px; padding: 14px 16px; }
  #healthHub .ia-health-summary-grid article > * { margin: 0 !important; }
}
@media (max-width: 767px) {
  #health .health-week-day small { display: none; }
  #health .health-week-day { min-height: 56px; }
  #health .supplement-row .remove-supplement { grid-row: 1; grid-column: 4; }
  #health .supplement-row .supplement-history { grid-row: 2; }
}
#healthHub { margin-bottom: 24px !important; }
@media (max-width: 767px) { #healthHub { margin-bottom: 12px !important; } }

/* ---- 日历 page (VISUAL_SPEC §7.7) ---------------------------------------------------------- */
.cal-page { display: grid; grid-template-columns: minmax(0, 1fr); gap: 24px; align-items: start; margin-bottom: 24px; }
@media (min-width: 1280px) { .cal-page { grid-template-columns: minmax(0, 8fr) minmax(0, 4fr); } }
.cal-page > .card { margin: 0 !important; padding: 20px 24px; }
.cal-head { display: flex; align-items: center; gap: 8px; margin-bottom: 16px; }
.cal-title { margin: 0 8px; min-width: 7.5em; text-align: center; color: var(--ink); font-size: 18px; font-weight: 500; }
.cal-nav, .cal-today { min-width: 40px; min-height: 40px; padding: 0 12px; border: 1px solid var(--line); border-radius: 999px;
  background: var(--paper); color: var(--ink); font: inherit; font-size: var(--text-body); cursor: pointer; }
.cal-today { margin-left: auto; font-size: var(--text-small); }
.cal-nav:hover, .cal-today:hover { border-color: var(--accent); color: var(--accent); }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
.cal-weekday { padding: 8px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); background: var(--sunken);
  color: var(--muted); font-size: var(--text-label); font-weight: 400; text-align: center; }
.cal-cell { display: flex; flex-direction: column; align-items: stretch; gap: 3px; min-width: 0; min-height: 96px; padding: 6px 8px;
  border: 0; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); background: var(--paper);
  color: var(--ink); font: inherit; text-align: left; cursor: pointer; }
.cal-cell.is-outside { background: var(--sunken); cursor: default; }
.cal-cell:hover:not(.is-outside) { background: var(--accent-soft); }
.cal-cell time { font-size: var(--text-small); color: var(--ink); }
.cal-cell.is-today time { display: inline-grid; place-items: center; width: 26px; height: 26px; margin: -3px 0 0 -4px; border-radius: 50%;
  background: var(--accent); color: var(--on-accent); }
.cal-cell.is-selected { box-shadow: inset 0 0 0 2px var(--accent); }
.cal-line { overflow: hidden; color: var(--ink); font-size: var(--text-label); line-height: 1.4; text-overflow: ellipsis; white-space: nowrap; }
.cal-line.is-event { padding-left: 6px; border-left: 2px solid var(--accent); }
.cal-line b { font-weight: 400; color: var(--muted); }
.cal-more, .cal-done { color: var(--muted); font-size: var(--text-label); }
.cal-dots { display: none; }
.cal-day-head h3 { margin: 0 0 8px; font-size: 18px; font-weight: 500; color: var(--ink); }
.cal-day-head span { color: var(--muted); font-size: var(--text-small); font-weight: 400; margin-left: 4px; }
.cal-section h4 { margin: 16px 0 4px; color: var(--muted); font-size: var(--text-label); font-weight: 400; letter-spacing: .08em; }
.cal-list { margin: 0; padding: 0; list-style: none; }
.cal-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 44px; border-top: 1px solid var(--line); font-size: var(--text-body); }
.cal-item:first-child { border-top: 0; }
.cal-item.is-done .cal-item-title { color: var(--muted); text-decoration: line-through; }
.cal-item.is-done .tk-time { background: transparent; color: var(--muted); }
#calendarSync { padding: 24px; }
#calendarSync h2 { font-family: var(--font-ui); font-size: 18px; font-weight: 500; }
#calendarSync .calendar-sync-name { font-size: var(--text-body); font-weight: 500; }
#calendarSync .calendar-sync-copy, #calendarSync .planner-status { color: var(--muted); font-size: var(--text-small); }
#calendarSync .calendar-security { color: var(--muted); font-size: var(--text-label); }
#calendarSync .calendar-sync-item { border-color: var(--line); background: var(--sunken); }
#calendarSync .calendar-subscribe { font-size: var(--text-small); }
#calendarSync .button { min-height: 44px; padding: 0 20px; border-radius: 10px; background: var(--accent); color: var(--on-accent); font-size: var(--text-small); }
@media (max-width: 1023px) {
  .cal-page { gap: 12px; }
}
@media (max-width: 767px) {
  .cal-page > .card { padding: 16px; }
  .cal-cell { min-height: 52px; align-items: center; padding: 6px 2px; }
  .cal-line, .cal-more, .cal-done { display: none; }
  .cal-dots { display: flex; gap: 3px; margin-top: auto; }
  .cal-dots i { width: 5px; height: 5px; border-radius: 50%; background: var(--ink); }
  .cal-dots i.is-event { background: var(--accent); }
  .cal-dots i.is-done { background: var(--muted); }
  .cal-cell.is-today time { margin: 0; }
  #calendarSync { padding: 16px; }
}
#calendarSync { margin-top: 0 !important; }
#calendarSync .pill { align-self: flex-start; justify-self: start; width: auto; }

/* ---- 学习 page (VISUAL_SPEC §7.8) ---------------------------------------------------------- */
body.workspace-routed[data-active-view="learning"] .connection-card { display: none !important; }
.lr-page { display: grid; gap: 24px; margin-bottom: 24px; }
.lr-projects { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.lr-project { display: grid; align-content: start; gap: 6px; min-height: 104px; padding: 20px; border: 1px solid var(--line); border-radius: 14px;
  background: var(--paper); color: var(--ink); font: inherit; text-align: left; cursor: pointer; }
.lr-project:hover { border-color: var(--accent); }
.lr-project.is-active { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.lr-project-name { font-size: 18px; font-weight: 500; }
.lr-project-latest { overflow: hidden; color: var(--ink); font-size: var(--text-small); text-overflow: ellipsis; white-space: nowrap; }
.lr-project-week { color: var(--muted); font-size: var(--text-label); }
.lr-recent { margin: 0 !important; padding: 20px 24px; }
.lr-head { display: flex; align-items: center; gap: 12px; }
.lr-head h3 { margin: 0; font-size: 18px; font-weight: 500; color: var(--ink); }
.lr-clear { min-height: 32px; padding: 0 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--accent-soft); color: var(--ink); font: inherit; font-size: var(--text-small); cursor: pointer; }
.lr-group h4 { margin: 16px 0 4px; color: var(--muted); font-size: var(--text-label); font-weight: 400; letter-spacing: .08em; }
.lr-list { margin: 0; padding: 0; list-style: none; }
.lr-row { display: grid; grid-template-columns: 48px minmax(0, 1fr) auto; align-items: center; gap: 12px; min-height: 48px; border-top: 1px solid var(--line); }
.lr-row:first-child { border-top: 0; }
.lr-date { color: var(--muted); font-size: var(--text-small); }
.lr-subject { min-width: 0; overflow-wrap: anywhere; font-size: var(--text-body); color: var(--ink); }
.lr-subject small { margin-left: 8px; color: var(--muted); font-size: var(--text-label); }
.lr-minutes { color: var(--muted); font-size: var(--text-small); white-space: nowrap; }
#frenchLearning { padding: 24px; }
#frenchLearning .card-head h2 { font-family: var(--font-ui); font-size: 18px; font-weight: 500; }
#frenchLearning .bonjour { font-family: var(--font-display); font-style: italic; font-size: 24px; color: var(--muted); }
#frenchLearning .tutor-entry { border-color: var(--line); background: var(--sunken); }
#frenchLearning .tutor-entry-title { font-size: var(--text-body); font-weight: 500; }
#frenchLearning .tutor-prompt { font-family: var(--font-mono); font-size: var(--text-small); background: var(--paper); border-color: var(--line); }
#frenchLearning :is(.empty, .french-stat, .stat-label, .stat-value) { font-size: var(--text-small); }
@media (max-width: 767px) {
  .lr-page { gap: 12px; }
  .lr-projects { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .lr-project { min-height: 88px; padding: 16px; }
  .lr-recent, #frenchLearning { padding: 16px; }
}
#learningHub { margin-bottom: 24px !important; }
#learningHub .lr-page { margin-bottom: 0; }
body.workspace-routed[data-active-view="learning"] #todayDashboard > .stack:has(#frenchLearning) { max-width: none !important; grid-template-columns: minmax(0, 1fr) !important; }
body.workspace-routed[data-active-view="learning"] #frenchLearning { max-width: none; margin: 0 0 24px; }
@media (max-width: 767px) { #learningHub { margin-bottom: 12px !important; } }

/* ---- v0.2 §3 roles: labels in warm brown; hover and press use the deep accent ------------------- */
html:not([data-theme="chat"]):not([data-theme="ipod"]) :is(.home-label, .home-stack dt, .tk-date, .cal-section h4, .lr-group h4, .lr-project-week, .rcpt-section, .cal-weekday, .field label, .compact-field span) { color: var(--label, var(--muted)); }
:is(.tk-add button, .home-cta, #health .save-row .button):hover { background: var(--accent-deep, var(--accent)); }

/* ---- 首页 v2 (VISUAL_SPEC v0.2 §6) ----------------------------------------------------------- */
.home-v2 { grid-template-columns: minmax(0, 1fr); gap: 16px; margin: 0 0 48px; }
.home-v2 .home-date { margin: 0; color: var(--ink); font-size: var(--text-small); }
.home-label { color: var(--label, var(--muted)); font-size: var(--text-label); font-weight: 400; letter-spacing: .08em; }
.home-talk { display: grid; gap: 8px; }
.home-talk-entry { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 64px; padding: 10px 12px 10px 16px; border: 1px solid var(--line);
  border-radius: 16px; background: var(--paper); color: var(--ink); font: inherit; text-align: left; cursor: text; }
.home-talk-entry:hover { border-color: var(--accent); }
.home-talk-entry:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.home-paw { display: inline-grid; place-items: center; width: 28px; height: 28px; color: var(--ink); }
.home-paw svg { width: 26px; height: 26px; fill: currentColor; }
.home-paw:empty { display: none; }
.home-talk-name { font-weight: 500; }
.home-talk-field { flex: 1; min-height: 44px; display: flex; align-items: center; padding: 0 16px; border-radius: 12px; background: var(--sunken); color: var(--muted); }
.home-current { margin: 0 0 0 4px; font-size: var(--text-small); }
.home-current a { color: var(--ink); text-decoration: none; }
.home-current a:hover { color: var(--accent); }
.home-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.home-stats[data-count="3"] { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.home-stats[data-count="2"] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.home-stats[data-count="1"] { grid-template-columns: minmax(0, 1fr); }
.home-stat { display: flex; flex-direction: column; gap: 8px; min-width: 0; min-height: 132px; padding: 20px; border: 1px solid var(--line); border-radius: 14px;
  background: var(--paper); color: var(--ink); text-decoration: none; }
.home-stat:hover { border-color: var(--accent); }
.home-big { margin-top: auto; font-size: 40px; font-weight: 600; line-height: 1; letter-spacing: -.02em; }
.home-big small { font-size: var(--text-small); font-weight: 400; color: var(--muted); letter-spacing: 0; }
.home-stat.is-accent { border-color: var(--accent); background: var(--accent); color: var(--on-accent); }
.home-stat.is-accent .home-label { color: var(--on-accent); opacity: .8; }
.home-stat.is-accent:hover { background: var(--accent-deep, var(--accent)); }
.home-next-title { margin-top: auto; overflow: hidden; font-size: 22px; font-weight: 600; line-height: 1.3; text-overflow: ellipsis; white-space: nowrap; }
.home-next-time { font-size: var(--text-body); opacity: .85; }
.home-bar { display: block; height: 6px; border-radius: 999px; background: var(--sunken); overflow: hidden; }
.home-bar i { display: block; height: 100%; border-radius: inherit; background: var(--accent); }
.home-main { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: 16px; align-items: start; }
.home-main > .card { margin: 0 !important; padding: 20px 24px; }
.home-card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.home-card-head h2 { margin: 0; font-family: var(--font-ui); font-size: 18px; font-weight: 500; }
.home-more { color: var(--muted); font-size: var(--text-small); text-decoration: none; }
.home-more:hover { color: var(--accent); }
.home-list { display: grid; margin: 0; padding: 0; list-style: none; }
.home-row { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; align-items: center; gap: 12px; min-height: 44px; border-top: 1px solid var(--line); }
.home-row:first-child { border-top: 0; }
.home-row.is-plain { grid-template-columns: minmax(0, 1fr) auto; }
.home-check { display: inline-grid; place-items: center; width: 28px; height: 28px; padding: 0; border: 0; background: none; cursor: pointer; }
span.home-check { cursor: default; }
.home-row-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.home-row.is-done .home-row-title { color: var(--muted); text-decoration: line-through; }
.home-row.is-done .tk-time { background: transparent; color: var(--muted); }
.home-progress-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 12px; margin-top: 12px; font-size: var(--text-small); }
.home-day + .home-day { margin-top: 8px; }
.home-day h3 { margin: 8px 0 0; }
.home-foot { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: center; padding: 16px 20px; border: 1px solid var(--line); border-radius: 14px; background: var(--paper); }
.home-week { margin: 0; color: var(--ink); }
.home-week a { margin-left: 8px; color: var(--muted); text-decoration: none; font-size: var(--text-small); }
.home-week a:hover { color: var(--accent); }
.home-dots-panel { display: grid; gap: 6px; }
.time-row { display: grid; grid-template-columns: 36px minmax(0, 1fr) 40px; align-items: center; gap: 10px; }
.time-row .num { color: var(--muted); font-size: var(--text-label); text-align: right; }
.time-dots { display: flex; flex-wrap: wrap; gap: 3px; }
.time-dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--line); }
.time-dots i.is-past { background: var(--ink); }
.time-dots i.is-now { background: var(--accent); }
@media (max-width: 1023px) {
  .home-main { grid-template-columns: minmax(0, 1fr); }
  .home-foot { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 767px) {
  .home-v2 { gap: 12px; margin-bottom: 32px; }
  .home-stats, .home-stats[data-count="3"] { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .home-stat { min-height: 112px; padding: 16px; }
  .home-big { font-size: 32px; }
  .home-next-title { font-size: 18px; }
  .home-main { gap: 12px; }
  .home-main > .card { padding: 16px; }
  .home-talk-entry { min-height: 56px; }
  .home-talk-name { display: none; }
}
/* Text on the page background is ink, not muted (v0.2 §3). */
.desktop-sidebar :is(.sidebar-link, .sidebar-link span) { color: var(--ink); }
.desktop-sidebar :is(.sidebar-link[aria-current], .sidebar-link[aria-current] span) { color: var(--accent); }
.home-bar i.w0 { width: 0%; }
.home-bar i.w5 { width: 5%; }
.home-bar i.w10 { width: 10%; }
.home-bar i.w15 { width: 15%; }
.home-bar i.w20 { width: 20%; }
.home-bar i.w25 { width: 25%; }
.home-bar i.w30 { width: 30%; }
.home-bar i.w35 { width: 35%; }
.home-bar i.w40 { width: 40%; }
.home-bar i.w45 { width: 45%; }
.home-bar i.w50 { width: 50%; }
.home-bar i.w55 { width: 55%; }
.home-bar i.w60 { width: 60%; }
.home-bar i.w65 { width: 65%; }
.home-bar i.w70 { width: 70%; }
.home-bar i.w75 { width: 75%; }
.home-bar i.w80 { width: 80%; }
.home-bar i.w85 { width: 85%; }
.home-bar i.w90 { width: 90%; }
.home-bar i.w95 { width: 95%; }
.home-bar i.w100 { width: 100%; }
.rcpt-check { display: inline-grid; place-items: center; }
html .home-stat.is-accent .home-label { color: var(--on-accent) !important; opacity: .85; }
.time-dots { display: grid; grid-template-columns: repeat(var(--n, 24), minmax(0, 8px)); gap: 3px; }
.time-dots i { width: 100%; height: auto; aspect-ratio: 1; }
@media (max-width: 767px) { .time-dots { grid-template-columns: repeat(var(--n, 24), minmax(0, 1fr)); gap: 2px; } }
.time-dots.n7 { --n: 7; }
.time-dots.n24 { --n: 24; }
.time-dots.n28 { --n: 28; }
.time-dots.n29 { --n: 29; }
.time-dots.n30 { --n: 30; }
.time-dots.n31 { --n: 31; }
@media (max-width: 767px) { .time-dots { grid-template-columns: repeat(var(--n, 24), minmax(0, 8px)); } }

/* ---- Momo: black solid paw, no backdrop (v0.2 §4; Phosphor paw-print fill, MIT) ------------- */
.paw { display: block; fill: var(--ink); }
.brand-mark-paw { display: grid; place-items: center; width: 40px; height: 40px; border: 0; background: none; box-shadow: none; }
.brand-mark-paw .paw { width: 30px; height: 30px; }
.momo-paw { display: grid; place-items: center; width: 36px; height: 36px; }
.momo-paw .paw { width: 28px; height: 28px; }
.home-paw .paw { width: 26px; height: 26px; }
.mobile-top .brand-mark-paw, .topbar .brand-mark-paw { width: 36px; height: 36px; }
.home-check { width: auto; min-width: 32px; color: var(--accent); font-family: var(--font-mono); font-size: var(--text-body); }
.home-row { grid-template-columns: 36px minmax(0, 1fr) auto; }

/* ---- 任务 page v0.2 (VISUAL_SPEC v0.2 §8) ------------------------------------------------- */
.tk-page { display: grid; grid-template-columns: minmax(0, 1fr); grid-template-areas: "today" "pending" "later"; gap: 16px; align-items: start; }
.tk-page > .tk-today { grid-area: today; }
.tk-page > #pendingTasks { grid-area: pending; }
.tk-page > .tk-later { grid-area: later; }
@media (min-width: 1200px) {
  .tk-page { grid-template-columns: minmax(0, 640px) minmax(0, 1fr); grid-template-areas: "today pending" "today later"; gap: 16px 24px; }
}
.tk-page > .card { padding: 20px 24px; }
/* 待定 and 以后 are secondary by place and title size only; same --paper card as 今天 (v0.2.2 §3). */
.tk-page > #pendingTasks, .tk-page > .tk-later { padding: 16px 20px; }
.tk-head h2 { font-size: 18px; }
#pendingTasks .ia-pending-group > summary h2, .tk-later .tk-head h2 { font-size: 16px; font-weight: 500; }
.tk-fold > summary { list-style: none; cursor: pointer; }
.tk-fold > summary::-webkit-details-marker { display: none; }
.tk-fold-count, #pendingTasks .ia-pending-count { color: var(--muted); font-size: var(--text-small); }
.tk-fold > summary::after, #pendingTasks .ia-pending-group > summary::after { content: "›"; margin-left: auto; color: var(--muted); font-size: 18px; transform: rotate(90deg); transition: transform 200ms cubic-bezier(.2,.9,.22,1); }
.tk-fold:not([open]) > summary::after, #pendingTasks .ia-pending-group:not([open]) > summary::after { content: "›"; transform: rotate(0deg); }

/* Rows: tick · time (one aligned column) · name · minutes */
.tk-row { grid-template-columns: 28px 76px minmax(0, 1fr) auto; gap: 10px; min-height: 48px; }
.tk-when { display: flex; align-items: center; min-width: 0; }
.tk-time { padding: 0; background: none; color: var(--accent); font-family: var(--font-mono); font-size: var(--text-small); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.tk-time.is-note { color: var(--muted); font-family: inherit; }
.tk-est { color: var(--muted); font-size: var(--text-label); }
.tk-check.is-plain { width: 22px; height: 22px; border: 1.5px solid var(--line); border-radius: 50%; }
.tk-row.is-later { min-height: 40px; font-size: var(--text-small); }
.tk-row.is-later .tk-title { font-size: var(--text-small); }
.tk-bar { flex: 0 1 160px; }
.tk-progress { display: none; }

/* 「＋ 添加任务」 — component 01, circle to field: width 44→470, radius 999→16, cubic-bezier(.2,.9,.22,1) 360ms */
.tk-add { display: grid; gap: 10px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.tk-add-shell { position: relative; display: flex; align-items: center; width: 44px; height: 44px; border: 1px solid var(--line); border-radius: 999px;
  background: var(--paper); overflow: visible;
  transition: width 360ms cubic-bezier(.2,.9,.22,1), border-radius 360ms cubic-bezier(.2,.9,.22,1), background-color 360ms cubic-bezier(.2,.9,.22,1); }
.tk-add-icon { flex: none; width: 42px; height: 42px; padding: 0; border: 0; border-radius: inherit; background: none; color: var(--accent); font: inherit; font-size: 20px; cursor: pointer; }
.tk-add-label { position: absolute; left: 56px; white-space: nowrap; color: var(--ink); pointer-events: none; transition: opacity 120ms linear; }
.tk-add-shell input { flex: 1; min-width: 0; height: 100%; padding: 0 12px 0 0; border: 0; outline: none; background: transparent; color: var(--ink); font: inherit;
  opacity: 0; transition: opacity 160ms linear; }
.tk-add-more { display: none; flex-wrap: wrap; gap: 8px; align-items: center; }
.tk-add-more button { min-height: 36px; padding: 0 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--paper); color: var(--ink); font: inherit; font-size: var(--text-small); cursor: pointer; }
.tk-add-more button[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); }
.tk-add-more .tk-add-submit { margin-left: auto; border-color: var(--accent); background: var(--accent); color: var(--on-accent); }
.tk-add-more .tk-add-submit:hover { background: var(--accent-deep, var(--accent)); }
.tk-add.is-open .tk-add-shell { width: min(470px, 100%); border-radius: 16px; background: var(--sunken); }
.tk-add.is-open .tk-add-icon { transform: rotate(45deg); transition: transform 360ms cubic-bezier(.2,.9,.22,1); }
.tk-add.is-open .tk-add-label { opacity: 0; }
.tk-add.is-open .tk-add-shell input { opacity: 1; transition-delay: 360ms; }
.tk-add.is-open .tk-add-more { display: flex; animation: tk-fade 200ms linear 280ms both; }
@keyframes tk-fade { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  .tk-add-shell, .tk-add-shell input, .tk-add-icon, .tk-add-label { transition: none !important; }
  .tk-add.is-open .tk-add-more { animation: none; }
}

/* 待定: same round tick; actions behind 「⋯」 */
#pendingTasks .ia-pending-item { position: relative; grid-template-columns: 28px minmax(0, 1fr) auto; gap: 10px; min-height: 44px; padding: 6px 0; }
#pendingTasks .ia-pending-name { font-size: var(--text-small); }
#pendingTasks .ia-pending-date { grid-column: 2 / -1; }
.ia-pending-more { position: relative; }
.ia-pending-menu-toggle { width: 32px; height: 32px; padding: 0; border: 0; border-radius: 8px; background: none; color: var(--muted); font-size: 18px; cursor: pointer; }
.ia-pending-menu-toggle:hover, .ia-pending-item.is-menu-open .ia-pending-menu-toggle { background: var(--sunken); color: var(--ink); }
@media (hover: hover) {
  .ia-pending-menu-toggle { opacity: 0; }
  .ia-pending-item:hover .ia-pending-menu-toggle, .ia-pending-item:focus-within .ia-pending-menu-toggle, .ia-pending-item.is-menu-open .ia-pending-menu-toggle { opacity: 1; }
}
.ia-pending-menu { position: absolute; right: 0; top: calc(100% + 4px); z-index: 5; display: grid; min-width: 128px; padding: 4px; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); }
.ia-pending-menu[hidden] { display: none; }
.ia-pending-menu button { min-height: 40px; padding: 0 12px; border: 0; border-radius: 8px; background: none; color: var(--ink); font: inherit; font-size: var(--text-small); text-align: left; cursor: pointer; }
.ia-pending-menu button:hover { background: var(--sunken); }
#pendingTasks .ia-pending-actions { display: none; }

@media (max-width: 767px) {
  .tk-row { grid-template-columns: 28px 64px minmax(0, 1fr); }
  .tk-row .tk-est { display: none; }
  .tk-page > .card { padding: 16px; }
  .tk-page > #pendingTasks, .tk-page > .tk-later { padding: 14px 16px; }
}
.tk-add { grid-template-columns: minmax(0, 1fr); }
.tk-add .tk-add-icon { min-height: 0; width: 42px; height: 42px; padding: 0; border: 0; border-radius: 50%; background: none; color: var(--accent); transform: none !important; }
.tk-add .tk-add-icon:hover { background: var(--accent-soft); }
.tk-add .tk-add-shell input { min-height: 0; border: 0; background: transparent; padding: 0 12px 0 0; }
.tk-add .tk-add-shell input:focus { outline: none; }

/* v0.2.1: the top bar already names the page, and every page is one tap from 首页 in the nav. */
.view-back-button { display: none !important; }
/* The iPod picture credit belongs to the iPod theme only. */
.footer .ipod-credit { display: none; }
html[data-theme="ipod"] .footer .ipod-credit { display: inline; }
/* 「打开 TimeDock ›」 sits at the end of the 「＋ 添加任务」 line; hidden while the field is open. */
.tk-add-row { display: flex; align-items: center; gap: 12px; min-width: 0; }
.tk-add-row .tk-add-shell { flex: none; max-width: 100%; }
.tk-add-row .tk-timedock { display: inline-flex; align-items: center; align-self: center; min-height: 44px; margin: 0 0 0 auto; padding: 0; line-height: 1; white-space: nowrap; }
.tk-add.is-open .tk-add-row .tk-timedock { display: none; }

/* ---- 健康 page v0.2 (VISUAL_SPEC v0.2 §9): show first, edit on tap; one card, no boxes inside --------- */
#health.hp-on .health-grid { display: none; }
#health.hp-on .save-row { margin-top: 0; min-height: 0; }
#health.hp-on .save-row .button { display: none; }
#health .health-week-picker { padding: 0; border: 0; background: none; }
#health .health-week-day { border-color: transparent; background: none; }
#health .health-week-day.is-today:not(.is-selected) { box-shadow: none; color: var(--accent); }
#health .health-week-day.is-today:not(.is-selected) strong { color: var(--accent); }

.hp { display: grid; grid-template-columns: minmax(0, 1fr); grid-template-areas: "facts" "sleep" "move" "food" "checks"; margin-top: 16px; }
@media (min-width: 1024px) {
  .hp { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-areas: "facts facts" "sleep food" "move checks"; column-gap: 40px; }
}
.hp-facts { grid-area: facts; }
section.hp-sleep { grid-area: sleep; }
.hp-move { grid-area: move; }
.hp-food { grid-area: food; }
.hp-checks { grid-area: checks; }
.hp-block { padding: 18px 0; border-top: 1px solid var(--line); min-width: 0; }
.hp-head { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.hp-head h3 { margin: 0; color: var(--ink); font-family: var(--font-ui); font-size: 16px; font-weight: 500; }
.hp-sum { color: var(--ink); font-size: var(--text-small); }
.hp-head .hp-quiet, .hp-head .hp-chips { margin-left: auto; }
.hp-head .hp-sum + .hp-chips { margin-left: 0; }
.hp-head .hp-sum { margin-left: auto; }
.hp-label { color: var(--muted); font-size: var(--text-small); }
.hp-note { color: var(--muted); font-size: var(--text-label); }
.hp-value { min-height: 40px; padding: 0 10px; margin-left: -10px; border: 0; border-radius: 8px; background: none; color: var(--ink); font: inherit; text-align: left; cursor: pointer; }
.hp-value:hover, .hp-row:hover { background: var(--sunken); }
.hp-quiet { min-height: 32px; padding: 0 8px; border: 0; border-radius: 8px; background: none; color: var(--muted); font: inherit; font-size: var(--text-small); cursor: pointer; }
.hp-quiet:hover { color: var(--accent); }
.hp-add { min-height: 40px; padding: 0 14px; border: 1px dashed var(--line); border-radius: 999px; background: none; color: var(--accent); font: inherit; font-size: var(--text-small); cursor: pointer; }
.hp-input { min-height: 40px; padding: 0 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--sunken); color: var(--ink); font: inherit; }
.hp-input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.hp-unit { color: var(--muted); font-size: var(--text-small); }
.hp-inline { display: inline-flex; align-items: center; gap: 8px; }
.hp-inline .hp-input { width: 96px; }

/* 体重 · 状态 on one line, label right beside its value. */
.hp-facts { padding-top: 6px; border-top: 0; }
.hp-facts > .hp-body { display: flex; flex-wrap: wrap; gap: 8px 40px; }
.hp-fact { display: flex; align-items: center; gap: 12px; min-height: 44px; }
.hp-chips { display: inline-flex; flex-wrap: wrap; gap: 6px; }
.hp-chips button { min-height: 36px; padding: 0 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--paper); color: var(--ink); font: inherit; font-size: var(--text-small); cursor: pointer; }
.hp-chips button[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.hp-chips button.is-quiet { border-color: transparent; color: var(--muted); }
.hp-chips.is-small button { min-height: 30px; padding: 0 10px; font-size: var(--text-label); }

/* 睡眠: the timeline is the control; drag either end. */
.hp-sleep-axis { padding: 26px 0 4px; touch-action: none; }
.hp-sleep-track { position: relative; height: 12px; border-radius: 999px; background: var(--sunken); }
.hp-sleep-bar { position: absolute; top: 0; bottom: 0; left: var(--l, 0%); width: var(--w, 0%); border-radius: 999px; background: var(--accent); }
.hp-handle { position: absolute; top: 50%; left: var(--p, 0%); width: 22px; height: 22px; padding: 0; transform: translate(-50%, -50%); border: 2px solid var(--accent); border-radius: 50%;
  background: var(--paper); cursor: grab; touch-action: none; }
.hp-handle::before { content: ""; position: absolute; inset: -11px; }
.hp-handle span { position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%); color: var(--accent); font-size: var(--text-small); white-space: nowrap; pointer-events: none; }
.hp-handle.is-end span { color: var(--ink); }
.hp-handle.is-dragging { cursor: grabbing; transform: translate(-50%, -50%) scale(1.15); }
.hp-handle:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.hp-sleep-scale { display: flex; justify-content: space-between; margin-top: 8px; color: var(--muted); font-size: var(--text-label); }
.hp-lines { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 28px; margin-top: 10px; }
.hp-line { display: flex; align-items: center; gap: 10px; min-height: 44px; }
.hp-lines .hp-quiet { margin-left: auto; }
.hp-momo .sleep-momo-feedback { margin-top: 8px; }

/* Lists: name · numbers right next to each other; the row opens in place (component 07). */
.hp-list { margin: 0; padding: 0; list-style: none; }
.hp-item { border-top: 1px solid var(--line); }
.hp-item:first-child { border-top: 0; }
.hp-row { display: flex; align-items: baseline; gap: 12px; width: 100%; min-height: 48px; padding: 12px 8px; margin: 0 -8px; width: calc(100% + 16px); border: 0; border-radius: 8px;
  background: none; color: var(--ink); font: inherit; text-align: left; cursor: pointer; }
.hp-row-label { flex: none; width: 72px; color: var(--muted); font-size: var(--text-small); }
.hp-row-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hp-row-name.is-empty { color: var(--muted); }
.hp-row-meta { flex: none; color: var(--muted); font-size: var(--text-small); white-space: nowrap; }
.hp-food .hp-row-meta { margin-left: auto; }
.hp-detail { display: grid; gap: 10px; padding: 0 0 14px; }
.hp-food .hp-detail { padding-left: 84px; }
.hp-detail-line { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.hp-detail > * { animation: hp-layer 240ms cubic-bezier(.2,.9,.22,1) both; }
.hp-detail > :nth-child(2) { animation-delay: 70ms; }
.hp-detail > :nth-child(3) { animation-delay: 140ms; }
@keyframes hp-layer { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.hp-tag { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 0 10px; border: 1px solid var(--line); border-radius: 999px; background: var(--paper); color: var(--ink);
  font: inherit; font-size: var(--text-small); cursor: pointer; }
.hp-tag i { color: var(--muted); font-style: normal; }
.hp-tag:hover i { color: var(--accent); }
.hp-food .hp-input { flex: 1 1 160px; min-width: 120px; }
.hp-bar { margin: 2px 0 6px; }

/* Stepper (component 06): a round ＋ that springs open to − value ＋; back to a circle at zero. */
.hp-stepper { display: inline-flex; align-items: center; gap: 4px; width: 172px; height: 44px; padding: 0 4px; border: 1px solid var(--line); border-radius: 999px; background: var(--paper);
  overflow: hidden; transition: width 360ms cubic-bezier(.34,1.36,.5,1); }
.hp-stepper button { flex: none; width: 34px; height: 34px; padding: 0; border: 0; border-radius: 50%; background: none; color: var(--accent); font: inherit; font-size: 18px; cursor: pointer; }
.hp-stepper button:hover { background: var(--accent-soft); }
.hp-step-value { flex: 1; width: 0; min-width: 0; height: 32px; padding: 0; border: 0; background: none; color: var(--ink); text-align: right; font-size: var(--text-body); outline: none; }
.hp-step-unit { flex: none; color: var(--muted); font-size: var(--text-label); }
.hp-step-minus, .hp-step-value, .hp-step-unit { transition: opacity 200ms linear; }
.hp-stepper.is-zero { width: 44px; padding: 0 4px; }
.hp-stepper.is-zero :is(.hp-step-minus, .hp-step-value, .hp-step-unit) { opacity: 0; width: 0; flex: 0 0 0; pointer-events: none; }
.hp-step-value.roll-up { animation: hp-roll-up 200ms ease-out; }
.hp-step-value.roll-down { animation: hp-roll-down 200ms ease-out; }
@keyframes hp-roll-up { from { transform: translateY(40%); opacity: .2; } to { transform: none; opacity: 1; } }
@keyframes hp-roll-down { from { transform: translateY(-40%); opacity: .2; } to { transform: none; opacity: 1; } }

/* 护肝药: ○ 早 ○ 中 ○ 晚, the tick draws itself (component 03). */
.hp-doses { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin-bottom: 16px; }
.hp-dose-set { display: inline-flex; gap: 6px; }
.hp-dose { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 10px 0 6px; border: 0; border-radius: 999px; background: none; color: var(--ink); font: inherit; cursor: pointer; }
.hp-dose:hover { background: var(--sunken); }
.hp-dose svg { width: 22px; height: 22px; }
.hp-dose circle { fill: none; stroke: var(--line); stroke-width: 1.6; transition: fill 200ms linear, stroke 200ms linear; }
.hp-dose path { fill: none; stroke: var(--on-accent); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 16; stroke-dashoffset: 16; transition: stroke-dashoffset 300ms cubic-bezier(.2,.9,.22,1) 80ms; }
.hp-dose[aria-pressed="true"] circle { fill: var(--accent); stroke: var(--accent); }
.hp-dose[aria-pressed="true"] path { stroke-dashoffset: 0; }

/* 补剂: weekdays once on top (Monday first), today's column marked; filled dot = taken. */
.hp-week { display: grid; gap: 2px; }
.hp-week-row { display: grid; grid-template-columns: minmax(0, 1fr) repeat(7, 32px); align-items: center; min-height: 40px; }
.hp-week-row.is-head { min-height: 24px; color: var(--muted); font-size: var(--text-label); text-align: center; }
.hp-week-row > span[role="cell"], .hp-week-row.is-head > span { display: grid; place-items: center; height: 100%; }
.hp-week-row > span.is-today { background: var(--accent-soft); }
.hp-week-row.is-head > span.is-today { border-radius: 8px 8px 0 0; color: var(--accent); }
.hp-week-row:last-child > span.is-today { border-radius: 0 0 8px 8px; }
.hp-sup-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hp-sup-name small { margin-left: 8px; color: var(--muted); font-size: var(--text-label); }
.hp-dot { display: block; width: 12px; height: 12px; padding: 0; border: 1.5px solid var(--line); border-radius: 50%; background: none; }
.hp-dot.is-on { border-color: var(--accent); background: var(--accent); }
.hp-dot.is-future { opacity: .4; }
button.hp-dot { position: relative; width: 16px; height: 16px; border-color: var(--accent); cursor: pointer; transition: background-color 160ms linear, transform 200ms cubic-bezier(.34,1.36,.5,1); }
button.hp-dot::before { content: ""; position: absolute; inset: -12px; }
button.hp-dot.is-on { transform: scale(1.06); }
.hp-sup-edit { display: grid; gap: 8px; margin: 0 0 12px; padding: 0; list-style: none; }
.hp-sup-edit li { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 8px; }
.hp-sup-edit .hp-input[readonly] { border-color: transparent; background: none; }
.hp-sup-gap { width: 44px; }

@media (max-width: 767px) {
  .hp-food .hp-detail { padding-left: 0; }
  .hp-row-label { width: 64px; }
  .hp-week-row { grid-template-columns: minmax(0, 1fr) repeat(7, 28px); }
  .hp-sup-edit li { grid-template-columns: minmax(0, 1fr) auto; }
  .hp-sup-edit li .hp-chips { grid-column: 1 / -1; grid-row: 2; }
  .hp-facts > .hp-body { gap: 0 28px; }
}
@media (prefers-reduced-motion: reduce) {
  .hp-detail > *, .hp-step-value { animation: none !important; }
  .hp-stepper, .hp-dose circle, .hp-dose path, button.hp-dot { transition: none !important; }
}
.hp-momo #sleepMomoFeedback[data-tone="quiet"] { display: none; }
/* Older #health button rules set a minimum height; the round controls keep their exact size. */
#health .hp :is(.hp-handle, button.hp-dot) { min-width: 0; min-height: 0; box-sizing: border-box; }
#health .hp .hp-handle { width: 22px; height: 22px; }
#health .hp button.hp-dot { width: 16px; height: 16px; }
.hp-row-label { width: auto; min-width: 72px; white-space: nowrap; }

/* ---- 健康 revision (Kain 10/20): one --paper card per part, straight on the page ------------------ */
#health.card.hp-on { padding: 0 !important; border: 0 !important; background: none !important; box-shadow: none !important; }
#healthHub .ia-health-summary-grid { display: none !important; }
.hp { grid-template-areas: "top" "sleep" "food" "move" "checks"; gap: 16px; margin-top: 0; }
@media (min-width: 1024px) {
  .hp { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-areas: "top top" "sleep food" "move checks"; gap: 16px; align-items: start; }
}
.hp-top { grid-area: top; }
.hp-card { padding: 20px 24px !important; }
.hp-top > .hp-body { display: flex; flex-wrap: wrap; gap: 8px 40px; margin-top: 12px; }
.hp-card .hp-head { min-height: 32px; }

/* 日期周条: the chosen day is a light tint with accent text, not a solid block. */
#health .health-week-day.is-selected { border-color: transparent; background: var(--accent-soft); color: var(--accent); box-shadow: none; }
#health .health-week-day.is-selected :is(strong, small, span) { color: var(--accent); }

/* 睡眠: 「睡眠 22:30 – 07:00 · 8.5 小时」, a thin track, small round ends; 清除 lives in 「⋯」. */
.hp-sleep-sum { color: var(--ink); font-size: var(--text-small); }
.hp-more { position: relative; margin-left: auto; }
#health .hp .hp-more-toggle { width: 32px; height: 32px; min-height: 0; padding: 0; border: 0; border-radius: 8px; background: none; color: var(--muted); font-size: 18px; cursor: pointer; }
#health .hp .hp-more-toggle:hover, #health .hp .hp-more-toggle[aria-expanded="true"] { background: var(--sunken); color: var(--ink); }
.hp-menu { position: absolute; right: 0; top: calc(100% + 4px); z-index: 5; display: grid; min-width: 128px; padding: 4px; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); }
#health .hp .hp-menu button { min-height: 40px; padding: 0 12px; border: 0; border-radius: 8px; background: none; color: var(--ink); font: inherit; font-size: var(--text-small); text-align: left; cursor: pointer; }
#health .hp .hp-menu button:hover { background: var(--sunken); }
.hp-sleep-axis { padding: 14px 0 0; }
.hp-sleep-track { height: 4px; background: var(--line); }
#health .hp .hp-handle { width: 12px; height: 12px; border: 0; background: var(--accent); box-shadow: 0 0 0 2px var(--paper); }
.hp-handle::before { inset: -16px; }
.hp-handle.is-dragging { transform: translate(-50%, -50%) scale(1.3); }
.hp-sleep-scale { margin-top: 10px; color: var(--muted); opacity: .7; font-size: 13px; }
.hp-sleep .hp-line { margin-top: 8px; }

/* 活动来源 now sits at the foot of the 运动 card. */
.hp-sources .ia-activity-sources { margin-top: 8px; padding-top: 4px; }
.hp-sources .ia-activity-sources summary { font-size: var(--text-small); }

/* 设置 → 每日热量目标 */
.settings-list .settings-row { display: flex; align-items: center; justify-content: space-between; gap: 18px; border-bottom: 1px solid var(--line); padding: 15px 5px; }

@media (max-width: 767px) {
  .hp-card { padding: 16px !important; }
  .hp-top > .hp-body { gap: 0 28px; }
}

/* ---- 健康 (Kain 10/20, second pass): cards in a row share a height; 本周 sleep tracks ----------- */
@media (min-width: 1024px) { .hp { align-items: stretch; } }
.hp-card { display: flex; flex-direction: column; }
/* The main axis and the week rows share one grid, so every track spans the same 18:00 → 12:00. */
.hp-axis-grid { display: grid; grid-template-columns: 20px minmax(0, 1fr) 48px; column-gap: 12px; align-items: center; }
.hp-sleep-axis > * { grid-column: 2; }
.hp-wk { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.hp-wk-title { margin: 0 0 6px; color: var(--muted); font-family: var(--font-ui); font-size: var(--text-small); font-weight: 400; }
.hp-wk-row { min-height: 22px; }
.hp-wk-day { color: var(--muted); font-size: var(--text-label); }
.hp-wk-row.is-today .hp-wk-day { color: var(--accent); }
.hp-wk-track { position: relative; height: 4px; border-radius: 999px; background: var(--sunken); }
.hp-wk-track i { position: absolute; top: 0; bottom: 0; left: var(--l, 0%); width: var(--w, 0%); border-radius: 999px; background: color-mix(in srgb, var(--accent) 38%, var(--paper)); }
.hp-wk-row.is-today .hp-wk-track i { background: var(--accent); }
.hp-wk-dur { color: var(--muted); font-size: var(--text-label); text-align: right; }
.hp-wk-row.is-today .hp-wk-dur { color: var(--ink); }
.hp-wk-avg { margin: 10px 0 0; color: var(--ink); font-size: var(--text-small); }
.hp-empty { margin: 0; color: var(--muted); }
.hp-move .hp-sources { margin-top: auto; }

/* ---- 日历 page v0.2 (VISUAL_SPEC v0.2 §10) ------------------------------------------------------- */
@media (min-width: 1024px) {
  .cal-page { grid-template-columns: minmax(0, 8fr) minmax(280px, 4fr); align-items: stretch; }
}
/* Right column = the chosen day + 接下来几天, together as tall as the month. */
.cal-side { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.cal-side > .card { margin: 0 !important; padding: 20px 24px; }
.cal-side > .cal-day { flex: 1 1 auto; }
.cal-side > .cal-next[hidden] { display: none; }
.cal-next-day h4 { margin: 14px 0 2px; color: var(--muted); font-size: var(--text-label); font-weight: 400; }
.cal-next-day h4 span { margin-left: 4px; }
.cal-empty { margin: 8px 0 0; color: var(--muted); }

/* Grid lines at half strength. */
.cal-grid { --cal-line: color-mix(in srgb, var(--line) 50%, transparent); border-top-color: var(--cal-line); border-left-color: var(--cal-line); }
.cal-weekday, .cal-cell { border-right-color: var(--cal-line) !important; border-bottom-color: var(--cal-line) !important; }
.cal-weekday { background: none; }
.cal-cell.is-outside { background: none; }

/* Date small at the top left, regular weight; today is a small solid circle. */
.cal-cell { gap: 3px; padding: 6px; }
.cal-cell .cal-date { align-self: flex-start; font-size: var(--text-label); font-weight: 400; color: var(--muted); line-height: 20px; }
.cal-cell.is-today .cal-date { display: inline-grid; place-items: center; width: 20px; height: 20px; margin: 0; border-radius: 50%; background: var(--accent); color: var(--on-accent); }
.cal-cell.is-selected { box-shadow: inset 0 0 0 1px var(--accent); }
.cal-cell:hover:not(.is-outside) { background: color-mix(in srgb, var(--accent-soft) 50%, transparent); }

/* Chips: one line each, a size below the date. */
.cal-chips { display: grid; gap: 2px; min-width: 0; }
.cal-chip { overflow: hidden; padding: 1px 6px; border-radius: 4px; color: var(--ink); font-size: 13px; line-height: 1.5; text-align: left; text-overflow: ellipsis; white-space: nowrap; }
.cal-chip.is-event { background: var(--accent-soft); }
.cal-chip.is-task { padding-left: 5px; border-left: 2px solid var(--accent); border-radius: 0 4px 4px 0; background: var(--sunken); }
.cal-chip.is-done { color: var(--muted); text-decoration: line-through; }
.cal-more { padding-left: 6px; color: var(--muted); font-size: 13px; text-align: left; }

@media (max-width: 767px) {
  .cal-chips { display: none; }
  .cal-cell .cal-date { align-self: center; }
  .cal-side > .card { padding: 16px; }
}

/* ---- v0.2 step 5: 学习 / 回顾 / 资料库 / 趋势 under §1–§5 ----------------------------------------- */
/* Names, states, actions and results only: page subtitles that explain go (§1.3). */
:is(#dailyReviewView, #weeklyReviewView, #monthlyReviewView) .v2-page-heading p,
#healthInsights .insights-head p,
:is(#dailyReviewView, #weeklyReviewView) .review-period-head small,
:is(#dailyAutoSummary, #weeklyAutoSummary, #monthlyAutoSummary) { display: none !important; }
.lf-native { position: absolute !important; width: 1px !important; height: 1px !important; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0 !important; padding: 0 !important; }
.month-picker > span, .review-month-picker > span { display: none; }

/* ‹ 2026年10月 › */
.lf-month { display: inline-flex; align-items: center; gap: 4px; }
.lf-month button { width: 36px; height: 36px; min-height: 0; padding: 0; border: 1px solid var(--line); border-radius: 50%; background: var(--paper); color: var(--ink); font: inherit; cursor: pointer; }
.lf-month button:hover { border-color: var(--accent); color: var(--accent); }
.lf-month span { min-width: 7.5em; text-align: center; color: var(--ink); font-size: var(--text-small); }
.month-picker, .review-month-picker { display: flex; align-items: center; min-height: 0; padding: 0; border: 0; background: none; box-shadow: none; }

/* 回顾 hub: four equal entries, title on top. */
.ia-review-grid { grid-template-columns: repeat(4, minmax(0, 1fr)) !important; grid-auto-rows: auto !important; }
.ia-review-grid > button { grid-row: auto !important; grid-column: auto !important; min-height: 112px !important; justify-content: flex-start !important; align-content: start !important; }
@media (max-width: 767px) { .ia-review-grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; } }

/* Two layers only (§5): tiles and day cells inside a card lose their own boxes. */
.review-metrics { gap: 0 !important; }
.review-metric { padding: 12px 0 !important; border: 0 !important; border-top: 1px solid var(--line) !important; border-radius: 0 !important; background: none !important; box-shadow: none !important; }
.review-metrics .review-metric:nth-child(-n+2) { border-top: 0 !important; }
:is(.review-calendar-day, .month-detail-cell) { border: 0 !important; border-radius: 8px !important; background: none !important; box-shadow: none !important; }
:is(.review-calendar-day, .month-detail-cell).has-record { background: var(--sunken) !important; }
.review-calendar-day.is-today { box-shadow: inset 0 0 0 1px var(--accent) !important; }
:is(.review-calendar-day, .month-detail-cell).filler { visibility: hidden; }
.heat-cell { border: 0 !important; }
.tutor-entry { padding: 16px 0 0 !important; border: 0 !important; border-top: 1px solid var(--line) !important; border-radius: 0 !important; background: none !important; }

/* Review notes: shown as text, edited in place, saved as you type (§5). */
.review-form textarea, .review-form input { field-sizing: content; min-height: 44px; border-color: transparent !important; background: none !important; resize: none; }
.review-form textarea:hover, .review-form input:hover { background: var(--sunken) !important; }
.review-form textarea:focus, .review-form input:focus { border-color: var(--line) !important; background: var(--sunken) !important; }
.review-form textarea::placeholder, .review-form input::placeholder { color: var(--muted); }
.review-form .v2-form-actions .button { display: none; }
.review-form .v2-form-status { color: var(--accent); font-size: var(--text-small); }

/* 资料库: the list first; adding and import / export on demand. */
.lf-library .card-head { align-items: center; }
.lf-actions { display: inline-flex; align-items: center; gap: 6px; margin-left: 12px; }
.lf-add { min-height: 36px; padding: 0 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--paper); color: var(--accent); font: inherit; font-size: var(--text-small); cursor: pointer; }
.lf-add[aria-expanded="true"] { border-color: var(--accent); background: var(--accent-soft); }
.lf-actions .hp-menu { min-width: 168px; }
.lf-actions .hp-menu button { min-height: 40px; padding: 0 12px; border: 0; border-radius: 8px; background: none; color: var(--ink); font: inherit; font-size: var(--text-small); text-align: left; cursor: pointer; }
.lf-actions .hp-menu button:hover { background: var(--sunken); }
.lf-actions .hp-more-toggle { width: 32px; height: 32px; min-height: 0; padding: 0; border: 0; border-radius: 8px; background: none; color: var(--muted); font-size: 18px; cursor: pointer; }
.lf-library #resourceForm { display: none; }
.lf-library #resourceForm.is-open { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; max-width: 640px; }
.lf-library #resourceForm.is-open #resourceTitle, .lf-library #resourceForm.is-open #resourceUrl { flex: 1 1 240px; }
.lf-library #resourceDuration { width: 8ch; flex: none; }
.lf-library .lf-tools > :not(.resource-count) { display: none !important; }
.lf-library .lf-tools { min-height: 0; margin: 4px 0 0; }
.lf-library .resource-filters { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; max-width: none; }
.lf-library #resourceSearch { flex: 1 1 240px; max-width: 360px; }
.lf-library .planner-status:empty { display: none; }
.hp-menu[hidden] { display: none !important; }
/* Step 5 fixes: the 「查看月份」 caption hides, the ‹ › control stays; empty days show no placeholder. */
.month-picker > span.lf-month, .review-month-picker > span.lf-month { display: inline-flex; }
.month-detail-cell:not(.has-record) :is(.month-detail-chips, .month-detail-head span),
.review-calendar-day:not(.has-record) .review-calendar-chips { visibility: hidden; }
.v2-page-heading h2 { white-space: nowrap; }
#monthlyReviewView .v2-page-heading, #healthInsights .insights-head { flex-wrap: wrap; gap: 12px; }
@media (max-width: 767px) { #monthlyReviewView .v2-page-heading, #healthInsights .insights-head { flex-direction: row; align-items: center; justify-content: space-between; } }
/* ---- Base components in place (UI_COMPONENT_DECISIONS step 1): older page rules step aside --------------- */
#healthHub .ia-section-links.ui-seg { display: inline-flex; flex-wrap: nowrap; gap: 2px; padding: 4px; }
#healthHub .ia-section-links.ui-seg .ui-seg-tab { min-height: 32px; padding: 0 14px; border: 0 !important; background: none !important; color: var(--ink) !important; box-shadow: none !important; }
#healthHub .ia-section-links.ui-seg .ui-seg-tab[aria-selected="true"] { color: var(--seg-on, var(--accent)) !important; }
.lf-library .resource-filters .ui-search { flex: 1 1 240px; }
.resource-filters .ui-search input { min-height: 40px; padding: 0 4px 0 16px; border: 0 !important; background: transparent !important; box-shadow: none !important; outline: none; }
.ia-pending-item:has([aria-expanded="true"]) .ia-pending-menu-toggle { opacity: 1; }
.tk-tick.is-static { cursor: default; }
.tk-tick.is-static::before { display: none; }
.top-actions .ui-btn { min-height: 36px; padding: 0 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--paper); color: var(--ink); font-size: var(--text-small); box-shadow: none; }
.top-actions .ui-btn:hover { background: var(--sunken); }
.hp-dose { padding: 0 10px 0 2px; }

/* ---- 首页 components step 2: desk calendar + weather + Momo across the top; P62 beside the time dots ---- */
.home-top { display: flex; gap: 16px; align-items: stretch; }
.home-top > .home-desk, .home-top > .home-weather { flex: none; }
.home-top > .home-talk { flex: 1 1 auto; }
.home-top > .home-weather { display: flex; }
.home-top > .home-weather[hidden] { display: none; }
.home-top > .home-talk { display: flex; flex-direction: column; justify-content: center; gap: 8px; min-width: 0; }
.home-foot { align-items: stretch; padding: 0; border: 0; background: none; }
.home-foot > .home-dots-panel { align-content: center; padding: 16px 20px; border: 1px solid var(--line); border-radius: 14px; background: var(--paper); }
.home-week { display: grid; }
.home-stats .ui-stat { min-height: 132px; }
@media (max-width: 767px) {
  .home-top { flex-direction: column; gap: 10px; }
  .home-desk .ui-desk { display: none; }
  .home-desk .ui-desk-line { display: block; }
  .home-top > .home-weather .ui-weather { width: 100%; }
  .home-stats .ui-stat { min-height: 0; }
  .home-stats .ui-stat-value { font-size: 30px; }
}

/* ---- 10/21 fixes ------------------------------------------------------------------------------------- */
/* Empty review notes: no 「—」; a faint ground shows where to write. */
.review-form :is(textarea, input):placeholder-shown:not(:focus) { background: color-mix(in srgb, var(--sunken) 70%, transparent) !important; }
/* Moon: body text one weight lighter than paper; headings keep their weight and brighter colour. */
html[data-theme="moon"] body { font-weight: 300; }
html[data-theme="moon"] :is(h1, h2, h3, h4, .v2-page-heading h2, .workspace-context strong) { color: var(--ink-strong, var(--ink)); }
/* Moon: the supplement grid's not-yet days and weekday labels are readable. */
html[data-theme="moon"] .hp-dot { border-color: color-mix(in srgb, var(--muted) 75%, transparent); }
html[data-theme="moon"] .hp-dot.is-future { opacity: .7; }
html[data-theme="moon"] .hp-week-row.is-head { color: color-mix(in srgb, var(--ink) 75%, transparent); }

/* Weather credit (Open-Meteo data, CC BY 4.0): shown with the home page's weather only. */
.footer .weather-credit { color: var(--muted); }
body:not([data-active-view="overview"]) .footer .weather-credit { display: none; }

/* ---- 首页 10/21: aligned top row, 今天 card, slim time strip ---------------------------------------------- */
.home-top { padding-top: 16px; align-items: stretch; }
.home-top > .home-desk { display: flex; }
.home-top > .home-desk .ui-desk { display: flex; flex-direction: column; margin-top: 0; }
.home-top > .home-desk .ui-desk-body { flex: 1; display: flex; flex-direction: column; justify-content: space-between; }
.home-top > .home-weather .ui-weather { height: 100%; }
.home-top > .home-talk { justify-content: stretch; }
.home-top > .home-talk > .home-talk-entry { flex: 1; }
.home-foot { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-areas: "week today" "time time"; align-items: stretch; }
.home-foot > .home-week { grid-area: week; }
.home-foot > .home-today-card { grid-area: today; display: grid; }
.home-foot > .home-dots-panel { grid-area: time; display: flex; flex-wrap: wrap; gap: 4px 28px; padding: 8px 16px; }
.home-foot > .home-dots-panel .time-row { flex: 1 1 280px; min-width: 0; }
@media (max-width: 767px) {
  .home-top { padding-top: 0; }
  .home-foot { grid-template-columns: minmax(0, 1fr); grid-template-areas: "week" "today" "time"; }
  .home-foot > .home-dots-panel { padding: 8px 12px; gap: 2px; }
}
/* Phones keep the one-line date; the round check-ins and the mood capsule keep their own size. */
@media (max-width: 767px) { .home-top > .home-desk .ui-desk { display: none; } }
#homeEntries .ui-tick { width: 28px; height: 28px; min-width: 0; min-height: 0; padding: 0; border: 0; background: none; }
.ui-today-row .ui-mood { justify-self: start; }
/* Desktop: 「正在做」 sits inside the Momo card, so the card keeps the row's bottom edge. */
@media (min-width: 768px) {
  .home-top > .home-talk { position: relative; }
  .home-top > .home-talk > .home-current { position: absolute; left: 18px; right: 18px; bottom: 12px; margin: 0; }
  .home-top > .home-talk:has(.home-current:not([hidden])) > .home-talk-entry { padding-bottom: 28px; }
}

/* ---- Components step 4: 任务页 (P8 add, P22 pin, P65 steps) ------------------------------------------- */
.tk-row { grid-template-columns: 28px 76px minmax(0, 1fr) auto 28px; }
.tk-row .tk-pin { grid-column: 5; }
.tk-row.is-pinned .tk-title { font-weight: 500; }
@media (hover: hover) {
  .tk-row .tk-pin:not([aria-pressed="true"]) { opacity: 0; transition: opacity 150ms linear; }
  .tk-row:hover .tk-pin, .tk-row:focus-within .tk-pin { opacity: 1; }
}
.tk-steps { grid-column: 3 / -1; padding: 2px 0 6px; }
.tk-row.has-steps { padding-bottom: 6px; }
/* The add button is the P8 ring itself: no shell border while closed, the field outline appears once it opens. */
.tk-add-shell { border-color: transparent; }
.tk-add.is-open .tk-add-shell { border-color: var(--line); }
.tk-add .tk-add-icon.ui-add { width: 42px; height: 42px; color: var(--accent); }
.tk-add .tk-add-icon.ui-add:hover { background: none; }
.tk-add .tk-add-icon.ui-add svg { width: 34px; height: 34px; }
.tk-add.is-open .tk-add-icon.ui-add svg { transform: rotate(45deg); }
.tk-add.is-open .tk-add-icon.ui-add svg .ring { fill: transparent; stroke: transparent; }
@media (max-width: 767px) {
  .tk-row { grid-template-columns: 28px 64px minmax(0, 1fr) 28px; }
  .tk-row .tk-pin { grid-column: 4; }
  .tk-steps { grid-column: 2 / -1; }
}
@media (prefers-reduced-motion: reduce) { .tk-row .tk-pin { transition: none; } }
/* Step 4 fixes: older #tasksPage button rules stretched the step circles; 小票 takes the full row when the card beside it is hidden. */
#tasksPage .ui-step-circle { min-width: 0; min-height: 0; width: 24px; height: 24px; padding: 0; border-radius: 50%; }
#tasksPage .ui-pin { min-width: 0; min-height: 0; width: 28px; height: 28px; padding: 0; background: none; }
.home-main:has(> .home-next[hidden]) { grid-template-columns: minmax(0, 1fr); }

/* ---- 首页 10/21 (IA-18, IA-19, IA-20, RC-15) ------------------------------------------------------------ */
/* Top row: desk, weather and time dots, one height. */
#homeEntries .home-top { display: flex; gap: 16px; align-items: stretch; }
#homeEntries .home-top > .home-dots-panel { flex: 1 1 auto; min-width: 0; display: grid; align-content: space-evenly; gap: 10px; padding: 18px 22px;
  border: 1px solid var(--line); border-radius: 14px; background: var(--paper); }
/* Three rows of the same length; the dots never wrap: each row is a grid of equal cells, and the dot size follows
   the row width (2.2cqw ≈ 70% of a cell in a 31-day month), so every row fits on one line at any width. */
#homeEntries .home-dots-panel .time-row { display: grid; grid-template-columns: 36px minmax(0, 1fr) 40px; align-items: center; gap: 12px; }
#homeEntries .time-dots { container-type: inline-size; display: grid; grid-template-columns: repeat(var(--n, 24), minmax(0, 1fr)); gap: 0; align-items: center; }
#homeEntries .time-dots i { justify-self: center; width: min(10px, 2.2cqw); height: auto; aspect-ratio: 1; border-radius: 50%; }

/* Below: two columns, each keeps its own height. */
#homeEntries .home-cols { display: grid; grid-template-columns: minmax(300px, 380px) minmax(0, 1fr); gap: 16px; align-items: start; }
#homeEntries .home-col { display: grid; gap: 16px; align-content: start; min-width: 0; }
#homeEntries .home-col .home-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
#homeEntries .home-col .home-stats[data-count="1"] { grid-template-columns: minmax(0, 1fr); }
#homeEntries .home-col .home-stats[data-count="3"] > :last-child { grid-column: 1 / -1; }
#homeEntries .home-col .home-today-card { display: grid; }

/* 今日小票 strip: narrow paper, torn edges top and bottom (RC-02), monospace, fixed type size. */
#homeEntries .home-strip { position: relative; margin: 10px 0; padding: 22px 22px 20px; background: var(--paper); color: var(--ink);
  font-family: var(--font-mono); font-size: 15px; line-height: 1.5; }
html:not([data-theme="moon"]) #homeEntries .home-strip {
  background: repeating-linear-gradient(90deg, transparent 0 11px, color-mix(in srgb, var(--ink) 2%, transparent) 11px 12px), var(--paper);
}
#homeEntries .home-strip::before, #homeEntries .home-strip::after { content: ""; position: absolute; left: 0; right: 0; height: 10px; background: var(--paper); }
#homeEntries .home-strip::before { top: -10px;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='10' viewBox='0 0 14 10'%3E%3Cpath d='M0 10H14V9L7 0L0 9Z' fill='%23000'/%3E%3C/svg%3E") left bottom / 14px 10px repeat-x;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='10' viewBox='0 0 14 10'%3E%3Cpath d='M0 10H14V9L7 0L0 9Z' fill='%23000'/%3E%3C/svg%3E") left bottom / 14px 10px repeat-x; }
#homeEntries .home-strip::after { bottom: -10px;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='10' viewBox='0 0 14 10'%3E%3Cpath d='M0 0H14V1L7 10L0 1Z' fill='%23000'/%3E%3C/svg%3E") left top / 14px 10px repeat-x;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='10' viewBox='0 0 14 10'%3E%3Cpath d='M0 0H14V1L7 10L0 1Z' fill='%23000'/%3E%3C/svg%3E") left top / 14px 10px repeat-x; }
.home-strip-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.home-strip-head h2 { margin: 0; font-family: inherit; font-size: 15px; font-weight: 600; letter-spacing: .12em; }
.home-strip-head .num { color: var(--muted); font-size: 13px; }
.home-strip-rule { margin: 14px 0; border-top: 1px dashed var(--muted); opacity: .6; }
.home-strip-list { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.home-strip-row { display: grid; grid-template-columns: 32px minmax(0, 1fr) auto; align-items: baseline; gap: 8px; }
#homeEntries .home-strip .home-check { min-width: 0; min-height: 0; margin: 0; padding: 0; border: 0; background: none; color: var(--accent); font: inherit; text-align: left; cursor: pointer; }
#homeEntries .home-strip button.home-check:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px; }
.home-strip-title { overflow-wrap: anywhere; }
.home-strip-row.is-done .home-strip-title { color: var(--muted); text-decoration: line-through; }
.home-strip-time { color: var(--muted); font-size: 13px; white-space: nowrap; }
.home-strip-total { display: grid; gap: 2px; margin: 0; }
.home-strip-total > div { display: flex; justify-content: space-between; gap: 12px; }
.home-strip-total dt { color: var(--muted); }
.home-strip-total dd { margin: 0; }
.home-strip-more { display: block; margin-top: 14px; color: var(--muted); font-size: 13px; text-align: center; text-decoration: none; }
.home-strip-more:hover { color: var(--accent); }

/* Momo: floating paw (IA-19). */
.momo-fab { position: fixed; right: 28px; bottom: 28px; z-index: 30; display: grid; place-items: center; width: 60px; height: 60px; padding: 0;
  border: 1px solid var(--line); border-radius: 50%; background: var(--paper); color: var(--ink); cursor: pointer;
  box-shadow: 0 6px 18px color-mix(in srgb, var(--ink) 12%, transparent); transition: color 150ms ease, border-color 150ms ease; }
.momo-fab:hover { border-color: var(--accent); color: var(--accent); }
.momo-fab:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.momo-fab .home-paw { position: relative; color: inherit; }
.momo-fab .home-paw svg { width: 28px; height: 28px; }
.momo-fab-dot { position: absolute; top: 9px; right: 10px; width: 11px; height: 11px; border: 2px solid var(--paper); border-radius: 50%; background: #D2544B; }
.momo-fab-dot[hidden] { display: none; }
body[data-momo-open] .momo-fab { visibility: hidden; }

@media (max-width: 999px) {
  #homeEntries .home-cols { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  #homeEntries .home-col { display: contents; }
  #homeEntries .home-col .home-stats { order: 1; }
  #homeEntries .home-col.is-left > .home-strip { order: 2; }
  #homeEntries .home-col .home-today-card { order: 3; }
  #homeEntries .home-col .home-week { order: 4; }
}
@media (max-width: 767px) {
  #homeEntries .home-top { flex-direction: column; gap: 10px; }
  #homeEntries .home-top > .home-dots-panel { padding: 12px 14px; gap: 6px; }
  #homeEntries .home-dots-panel .time-row { grid-template-columns: 32px minmax(0, 1fr) 36px; gap: 8px; }
  #homeEntries .home-col .home-stats { gap: 12px; }
  #homeEntries .home-strip { padding: 20px 18px 18px; }
  .momo-fab { right: 16px; bottom: calc(92px + env(safe-area-inset-bottom, 0px)); width: 52px; height: 52px; }
  .momo-fab .home-paw svg { width: 24px; height: 24px; }
  .momo-fab-dot { top: 7px; right: 8px; }
}

/* ---- 小票页 (RC-16): history stubs · today's paper · next days, on wide screens ---------------------------- */
.rcpt-layout.is-wide { display: grid; grid-template-columns: 220px minmax(0, 520px) 260px; justify-content: center; align-items: start; gap: 28px; }
.rcpt-layout.is-wide .rcpt-paper { width: 100%; }
.rcpt-side { display: grid; gap: 14px; padding-top: 8px; }
.rcpt-side-title { margin: 0; color: var(--muted); font-size: var(--text-small); font-weight: 500; letter-spacing: .2em; }
.rcpt-side-empty { margin: 0; color: var(--muted); }
.rcpt-stubs { display: grid; gap: 20px; margin: 0; padding: 0; list-style: none; }
.rcpt-stub { position: relative; display: grid; gap: 6px; width: 100%; min-height: 0; padding: 12px 14px 12px; border: 1px solid var(--line); border-bottom: 0;
  border-radius: 3px 3px 0 0; background: var(--paper); color: var(--ink); font: inherit; text-align: left; cursor: pointer; }
.rcpt-stub::after { content: ""; position: absolute; left: -1px; right: -1px; bottom: -8px; height: 8px; background: var(--paper);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M0 0H12V1L6 8L0 1Z' fill='%23000'/%3E%3C/svg%3E") left top / 12px 8px repeat-x;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M0 0H12V1L6 8L0 1Z' fill='%23000'/%3E%3C/svg%3E") left top / 12px 8px repeat-x; }
.rcpt-stub:hover { border-color: var(--accent); }
.rcpt-stub:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.rcpt-stub[aria-current="true"] { background: var(--accent-soft); }
.rcpt-stub[aria-current="true"]::after { background: var(--accent-soft); }
.rcpt-stub-date, .rcpt-stub-count { font-family: var(--font-mono); font-size: 13px; }
.rcpt-stub-date { color: var(--muted); }
.rcpt-stub-count b { color: var(--accent); font-weight: 600; }
.rcpt-stub-lines { display: grid; gap: 2px; color: var(--muted); font-size: 13px; }
.rcpt-stub-lines span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rcpt-stub-lines .is-done { text-decoration: line-through; }
.rcpt-upcoming-day { padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); }
.rcpt-upcoming-day h3 { margin: 0 0 8px; color: var(--accent); font-family: var(--font-mono); font-size: 13px; font-weight: 500; }
.rcpt-upcoming-day ul { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; font-size: var(--text-small); }
.rcpt-upcoming-day li { display: flex; justify-content: space-between; gap: 10px; }
.rcpt-upcoming-day li > span:first-child { min-width: 0; overflow-wrap: anywhere; }

/* ---- 设置: P47 entry rows ---------------------------------------------------------------------------------- */
.ia-settings-links { display: grid; gap: 0; padding: 6px; }
.ia-settings-links button.ui-entry { min-height: 48px; padding: 0 44px 0 14px; border: 0; border-radius: 10px; background: var(--paper); color: var(--ink); }
.ia-settings-links button.ui-entry:hover { background: var(--sunken); }
.ia-settings-links .ui-entry + .ui-entry::before { content: ""; position: absolute; left: 14px; right: 14px; top: 0; border-top: 1px solid var(--line); }
@media (prefers-reduced-motion: reduce) { .momo-fab { transition: none; } }
/* Room under the last card so the floating paw never covers it. */
#homeEntries { padding-bottom: 72px; }

/* ---- Fonts 10/21: receipt headings in Special Elite; titles differ by size, weight and colour only ---------- */
.rcpt-display { font-family: var(--font-receipt); font-style: normal; letter-spacing: .02em; }
.home-display, #frenchLearning .bonjour { font-style: normal; }
/* Older stylesheets name their own faces; everything follows the one stack. */
body, button, input, select, textarea, .card, .footer { font-family: var(--font-ui); }
/* 朱雀 has one weight: no synthetic bold on Chinese headings (it blurs the strokes); weight stays for Courier Prime. */
html { font-synthesis-weight: none; }
.font-credits { display: grid; gap: 4px; margin: 0; color: var(--muted); font-size: var(--text-small); }
.font-credits a { color: inherit; }

/* =====================================================================================================
   首页网格 (VISUAL_SPEC §6.1, Kain 10/21). One 12-column grid, one gap; every card sits on the grid edges.
   Row 1 (one height): 台历 3 · 天气 3 · 正在做 / 下一项 6.  Row 2: time progress, full width.
   Below: 今日小票 5 columns over two rows · 今天 7 · 本周 7 — the receipt's bottom edge meets the week card's.
   ===================================================================================================== */
#homeEntries .home-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 16px; padding-top: 16px; align-items: stretch;
  grid-template-areas:
    "desk desk desk weather weather weather focus focus focus focus focus focus"
    "time time time time time time time time time time time time"
    "strip strip strip strip strip today today today today today today today"
    "strip strip strip strip strip week week week week week week week"; }
#homeEntries .home-grid:has(> .home-weather[hidden]) { grid-template-areas:
    "desk desk desk focus focus focus focus focus focus focus focus focus"
    "time time time time time time time time time time time time"
    "strip strip strip strip strip today today today today today today today"
    "strip strip strip strip strip week week week week week week week"; }
#homeEntries .home-grid > * { min-width: 0; margin: 0; }
#homeEntries .home-grid > .home-desk { grid-area: desk; display: flex; }
#homeEntries .home-grid > .home-desk .ui-desk { width: 100%; margin-top: 0; }
#homeEntries .home-grid > .home-desk .ui-desk-line { display: none; }
#homeEntries .home-grid > .home-weather { grid-area: weather; display: flex; }
#homeEntries .home-grid > .home-weather[hidden] { display: none; }
#homeEntries .home-grid > .home-weather .ui-weather { width: 100%; height: 100%; }
#homeEntries .home-grid > .home-focus { grid-area: focus; display: flex; }
#homeEntries .home-grid > .home-time { grid-area: time; }
#homeEntries .home-grid > .home-strip { grid-area: strip; }
#homeEntries .home-grid > .home-today-card { grid-area: today; display: flex; }
#homeEntries .home-grid > .home-week { grid-area: week; display: flex; }
#homeEntries .home-grid > .home-today-card > *, #homeEntries .home-grid > .home-week > * { flex: 1; min-width: 0; }

/* 正在做 / 下一项: the main card. */
.home-focus-card { display: flex; flex: 1; flex-direction: column; justify-content: center; gap: 8px; min-width: 0; padding: 22px 28px;
  border: 1px solid var(--line); border-radius: 14px; background: var(--paper); color: var(--ink); text-decoration: none; }
.home-focus-card:hover { border-color: var(--accent); }
.home-focus-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.home-focus-head { color: var(--muted); font-size: var(--text-small); }
.home-focus-head .is-on { color: var(--accent); }
.home-focus-title { margin: 0; color: var(--accent); font-size: 30px; line-height: 1.3; overflow-wrap: anywhere; }
.home-focus-title.is-empty { color: var(--muted); font-size: 22px; }
.home-focus-meta { margin: 0; color: var(--ink); font-size: var(--text-body); }

/* Time progress: one thin strip, three equal parts, each a P91 bar and its percentage. */
#homeEntries .home-time { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 32px; padding: 10px 20px;
  border: 1px solid var(--line); border-radius: 14px; background: var(--paper); }
.home-time-part { display: grid; grid-template-columns: auto minmax(0, 1fr) 44px; align-items: center; gap: 12px; }
.home-time-label { color: var(--muted); font-size: var(--text-small); }
.home-time-part .num { color: var(--muted); font-size: var(--text-small); text-align: right; }

/* 今日小票: the torn edges are part of the box (mask), so its top and bottom sit exactly on the grid lines.
   At most 8 rows; the footer (小计 · 进度 · 记录员) stays at the bottom of the paper. */
#homeEntries .home-strip { display: flex; flex-direction: column; margin: 0; padding: 30px 24px 28px;
  --tooth-top: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='10' viewBox='0 0 14 10'%3E%3Cpath d='M0 10H14V9L7 0L0 9Z' fill='%23000'/%3E%3C/svg%3E");
  --tooth-bottom: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='10' viewBox='0 0 14 10'%3E%3Cpath d='M0 0H14V1L7 10L0 1Z' fill='%23000'/%3E%3C/svg%3E");
  -webkit-mask: var(--tooth-top) left top / 14px 10px repeat-x, linear-gradient(#000 0 0) left 10px / 100% calc(100% - 20px) no-repeat, var(--tooth-bottom) left bottom / 14px 10px repeat-x;
  mask: var(--tooth-top) left top / 14px 10px repeat-x, linear-gradient(#000 0 0) left 10px / 100% calc(100% - 20px) no-repeat, var(--tooth-bottom) left bottom / 14px 10px repeat-x; }
#homeEntries .home-strip::before, #homeEntries .home-strip::after { content: none; }
.home-strip-foot { margin-top: auto; }
.home-strip-more.is-rest { margin-top: 10px; text-align: left; }
.home-strip-total .is-bar dd { display: flex; align-items: center; gap: 10px; }
.home-strip-total .is-bar .ui-progress { width: 120px; }

@media (max-width: 899px) {
  /* Phone order: 正在做 / 下一项 → 今日小票 → 今天 → 台历与天气 → 本周 → 时间进度. */
  #homeEntries .home-grid, #homeEntries .home-grid:has(> .home-weather[hidden]) { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; padding-top: 0;
    grid-template-areas: "focus focus" "strip strip" "today today" "desk weather" "week week" "time time"; }
  #homeEntries .home-grid:has(> .home-weather[hidden]) { grid-template-areas: "focus focus" "strip strip" "today today" "desk desk" "week week" "time time"; }
  #homeEntries .home-grid > .home-desk, #homeEntries .home-grid > .home-weather { padding-top: 16px; }
  #homeEntries .home-grid > .home-desk .ui-desk { display: flex !important; }
  #homeEntries .home-grid > .home-desk .ui-desk-line { display: none !important; }
  .home-focus-card { padding: 18px 20px; }
  .home-focus-title { font-size: 26px; }
  #homeEntries .home-time { grid-template-columns: minmax(0, 1fr); gap: 6px; padding: 12px 16px; }
  #homeEntries .home-strip { padding: 28px 18px 26px; }
}

/* 小票页 (RC-16, Kain 10/21): both side titles share one line; the paper and the first stub start on the same
   line just below it. Titles have a fixed line box, and the middle column is pushed down by exactly that much. */
.rcpt-layout.is-wide { --rcpt-title-h: 28px; --rcpt-title-gap: 14px; }
.rcpt-layout.is-wide .rcpt-side { gap: var(--rcpt-title-gap); padding-top: 0; }
.rcpt-layout.is-wide .rcpt-side-title { height: var(--rcpt-title-h); margin: 0; line-height: var(--rcpt-title-h); }
.rcpt-layout.is-wide .rcpt-stage { padding-top: calc(var(--rcpt-title-h) + var(--rcpt-title-gap)); }
.ui-today-nums { align-self: end; }

/* =====================================================================================================
   字体分层 (VISUAL_SPEC §4, Kain 10/21 晚)
   - 界面文字：霞鹜文楷 LXGW WenKai — 侧栏、按钮、分段切换、表单标签、小字说明、正文段落。
   - 朱雀仿宋：页面和卡片标题、今日小票正文、摘句、Momo 的回复；≥ 18px（小票正文 ≥ 16px）。
   - Courier Prime：数字、时间、日期、英文标签；不用于中文句子。
   - Special Elite：只用于小票抬头。中文不加字距；只有英文全大写小标签保留少量字距。
   ===================================================================================================== */
html:root, html[data-cn-font] {
  --font-ui: "LXGW WenKai", "Kaiti SC", "STKaiti", "KaiTi", "Songti SC", serif;
  --font-title: "Zhuque Fangsong", "LXGW WenKai", "Songti SC", "STSong", "SimSun", serif;
  --font-mono: "Courier Prime", "LXGW WenKai", "Kaiti SC", serif;
  --font-display: var(--font-title);
  --font-receipt: "Special Elite", "Courier Prime", serif;
  --font-cn: var(--font-ui);
  --font-latin: var(--font-mono);
}
body, button, input, select, textarea, .card, .footer { font-family: var(--font-ui); }
html { font-synthesis-weight: auto; }

/* Numbers, times, dates and English labels. */
time, .live-clock, .num, [data-num], :where([lang="en"]) { font-family: var(--font-mono); }

/* Titles: 朱雀仿宋, never below 18px. */
:is(h1, h2, h3), .v2-page-heading h2, .workspace-context strong, .home-focus-title, .rcpt-title-cn, .rcpt-side-title {
  font-family: var(--font-title); font-weight: 400; }
.ui-today h3, .home-strip-head h2, .home-card-head h2, .card-head h2, .tk-head h2, .ui-week-title, .rcpt-side-title { font-size: 18px; }
.rcpt-title-cn { font-size: 18px; color: var(--muted); }

/* 今日小票 body (page and 首页 strip): 朱雀仿宋 16px; marks, times and figures stay Courier Prime. */
.rcpt-paper, #homeEntries .home-strip { font-family: var(--font-title); font-size: 16px; }
.rcpt-paper :is(.rcpt-row, .rcpt-title, .rcpt-meta, .rcpt-edit), #homeEntries .home-strip :is(.home-strip-row, .home-strip-title, .home-strip-total) { font-size: 16px; }
.rcpt-paper :is(.rcpt-check, .rcpt-time, .rcpt-meta b, .rcpt-progress b, .rcpt-day-nav span),
#homeEntries .home-strip :is(.home-check, .home-strip-time, .num, dd) { font-family: var(--font-mono); }
.rcpt-paper .rcpt-links, .rcpt-paper .rcpt-links button, #homeEntries .home-strip .home-strip-more { font-family: var(--font-ui); }
.rcpt-display { font-family: var(--font-receipt); }

/* 摘句 and Momo's replies. */
blockquote, .quote, .excerpt { font-family: var(--font-title); font-size: max(18px, 1em); }
.momo-chat-message[data-role="assistant"] > p { font-family: var(--font-title); font-size: 18px; line-height: 1.7; }

/* No extra spacing between Chinese characters; English all-caps labels keep a little. */
body *, body *::before, body *::after { letter-spacing: 0 !important; }
body [lang="en"], body .workspace-context span, body .rcpt-section [lang="en"] { letter-spacing: .08em !important; }
body .rcpt-display[lang="en"] { letter-spacing: .02em !important; }

/* ---- 登录页 (P102 structure; P4 fields, P9 tick, P84 key button, P43 bars; Kain 10/21) ------------------------- */
.login-page[open] { position: fixed; inset: 0; display: grid; place-items: center; width: 100vw; max-width: none; height: 100dvh; max-height: none;
  margin: 0; padding: 16px; border: 0; background: var(--bg); color: var(--ink); overflow: auto; }
.login-page::backdrop { background: var(--bg); }
.login-card { position: relative; z-index: 1; display: grid; justify-items: stretch; gap: 14px; width: min(380px, 100%); padding: 36px 28px 22px;
  border: 1px solid var(--line); border-radius: 16px; background: var(--paper); }
.login-card .ui-field { max-width: none; }
.login-close { position: absolute; top: 10px; right: 10px; width: 36px; height: 36px; padding: 0; border: 0; border-radius: 10px; background: none; color: var(--muted); font-size: 20px; cursor: pointer; }
.login-close:hover { background: var(--sunken); color: var(--ink); }
.login-brand { display: grid; justify-items: center; gap: 8px; margin-bottom: 6px; text-align: center; }
.login-mark svg { width: 40px; height: 40px; fill: var(--ink); }
.login-brand h2 { margin: 0; font-size: 22px; }
.login-pass .ui-input { padding-right: 46px; }
.login-reveal { position: absolute; right: 6px; display: grid; place-items: center; width: 36px; height: 36px; padding: 0; border: 0; border-radius: 8px; background: none; color: var(--muted); cursor: pointer; }
.login-reveal svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.login-reveal:hover { color: var(--ink); }
.login-keep { display: flex; align-items: center; gap: 8px; color: var(--ink); font-size: var(--text-small); }
.login-keep [data-auth-keep-label] { cursor: pointer; user-select: none; }
.login-submit { justify-self: stretch; width: 100%; min-height: 46px; margin-top: 4px; font-size: var(--text-body); }
.login-forgot { justify-self: center; min-height: 36px; padding: 0 8px; border: 0; background: none; color: var(--muted); font: inherit; font-size: var(--text-small); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.login-forgot:hover { color: var(--accent); }
.login-card :is(.login-close, .login-reveal, .login-forgot):focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ui-alert.is-error { border-left-color: var(--accent); background: var(--accent-soft); }
.ui-alert.is-error svg { color: var(--accent); }
.ui-alert[hidden] { display: none; }
/* P41 night sky for Moon: three layers of small stars drifting up very slowly; the paper theme keeps a plain ground. */
.login-sky { position: fixed; inset: 0; display: none; overflow: hidden; pointer-events: none; }
html[data-theme="moon"] .login-sky { display: block; }
.login-sky i { position: absolute; left: 0; right: 0; top: 0; height: 200%; opacity: .32;
  background-image: radial-gradient(circle at 13px 27px, #fff 0 1px, transparent 1.4px), radial-gradient(circle at 97px 151px, #fff 0 1px, transparent 1.4px),
    radial-gradient(circle at 171px 63px, #fff 0 .8px, transparent 1.2px), radial-gradient(circle at 53px 199px, #fff 0 .8px, transparent 1.2px);
  background-size: 220px 220px; }
.login-sky i:nth-child(2) { opacity: .22; background-size: 340px 340px; background-position: 60px 90px; }
.login-sky i:nth-child(3) { opacity: .14; background-size: 520px 520px; background-position: 140px 30px; }
@media (prefers-reduced-motion: no-preference) {
  .login-sky i { animation: login-stars 240s linear infinite; }
  .login-sky i:nth-child(2) { animation-duration: 360s; }
  .login-sky i:nth-child(3) { animation-duration: 520s; }
}
@keyframes login-stars { to { transform: translateY(-50%); } }
@media (max-width: 480px) { .login-card { padding: 32px 20px 18px; } }
.login-card .ui-btn.login-submit { width: 100%; justify-self: stretch; }

/* ---- Cat illustrations (A version; Free Cat Illustration by Astha Mishra, CC BY 4.0) -------------------------- */
.cat-figure { display: inline-grid; place-items: center; flex: none; }
.cat-figure img { display: block; width: 100%; height: 100%; object-fit: contain; }
/* 「Momo 在想」 (P14): an 18px spinner and one line of text, the same height as a one-line message. */
.momo-chat-message.is-thinking > p.momo-thinking { display: inline-flex; align-items: center; gap: 8px; margin: 0; color: var(--muted); line-height: inherit; }
.momo-thinking .ui-spinner { width: 18px; height: 18px; }
.momo-thinking .ui-spinner i { background: var(--muted); }
html[data-theme="moon"] .momo-thinking .ui-spinner i { background: #C7D2E0; }
.momo-thinking.is-slow .ui-spinner i { animation: none; opacity: .45; }
@media (prefers-reduced-motion: reduce) { .momo-thinking .ui-spinner i { animation: none; opacity: .45; } }
.cat-figure.is-empty { width: 120px; height: 96px; margin: 4px auto 8px; }
.momo-chat-empty { display: grid; justify-items: center; gap: 6px; }
.hp-empty-cat.cat-figure { display: grid; width: 96px; height: 72px; margin: 8px auto 0; }
/* 资料库 is drawn by the frozen legacy script: its empty message gets the cat in the box from CSS. */
#resourceList > .empty::before { content: ""; display: block; width: 130px; height: 100px; margin: 0 auto 10px;
  background: url("/assets/illustrations/cats/a/cat-box.svg?v=4") center / contain no-repeat; }
/* Moon: black cats need a light plate. */
/* Moon: the cats keep their own colours (containers filled explicitly in the files); only a slight dim. No frame, no plate. */
html[data-theme="moon"] .cat-figure img { filter: brightness(.9) drop-shadow(0 0 1px rgba(248, 246, 238, .5)); }
html[data-theme="moon"] #resourceList > .empty::before { filter: brightness(.9) drop-shadow(0 0 1px rgba(248, 246, 238, .5)); }

/* =====================================================================================================
   蓝粉配色 (Kain 10/21; confirmed 10/22 for every page of the paper theme).
   Palette: 海军蓝 #2F4157 · 浅粉 #FFE1E6 · 杜鹃粉 #F7C9D4 · 天空蓝 #C8D9E6 · 米白 #F5EFEB · page #FFFFFF.
   Colour marks the module; text on each block is a deeper shade of that block's own colour.
   Bodoni Moda: big numbers and English titles. Corner tags: Courier Prime Bold, wide tracking.
   ===================================================================================================== */
@font-face { font-family: "Bodoni Moda"; font-style: normal; font-weight: 400 900; font-display: swap;
  src: local("Bodoni Moda"), url("/assets/fonts/BodoniModa-Variable.ttf") format("truetype"); }

html[data-theme="paper"] body {
  --bg: #FFFFFF; --paper: #F5EFEB; --sunken: #EFE7E2; --line: #E3DAD4;
  --ink: #2F4157; --muted: #56647A; --label: #56647A;
  --accent: #2F4157; --accent-deep: #22303F; --accent-soft: #C8D9E6; --on-accent: #FFFFFF;
  --font-big: "Bodoni Moda", "Didot", "Bodoni 72", serif;
  background: #FFFFFF;
}
html[data-theme="paper"] body :is(.main, main.shell, .workspace) { background: #FFFFFF; }

/* Corner tags: TODAY, VANCOUVER, RECEIPT, NOW · NEXT. */
html[data-theme="paper"] :is(#homeEntries, .cs-page) .corner-tag { font-family: "Courier Prime", monospace; font-size: 12px; font-weight: 700; letter-spacing: .2em !important; text-transform: uppercase; opacity: .85; }

/* Selected state: navy with white text. */
html[data-theme="paper"] :is(#homeEntries, .cs-page) .ui-seg-glider { background: #2F4157; }
html[data-theme="paper"] :is(#homeEntries, .cs-page) .ui-seg-tab[aria-selected="true"] { color: #FFFFFF; }

/* 正在做 / 下一项: navy, off-white text, time in azalea pink. */
html[data-theme="paper"] #homeEntries .home-focus-card { --ink: #F2EEEA; --muted: #C9CFD8; border-color: #2F4157; background: #2F4157; color: #F2EEEA; }
html[data-theme="paper"] #homeEntries .home-focus-card:hover { border-color: #F7C9D4; }
html[data-theme="paper"] #homeEntries .home-focus-head, html[data-theme="paper"] #homeEntries .home-focus-head .is-on { color: #C9CFD8; }
html[data-theme="paper"] #homeEntries .home-focus-head .is-on { color: #F2EEEA; }
html[data-theme="paper"] #homeEntries .home-focus-title { color: #F2EEEA; }
html[data-theme="paper"] #homeEntries .home-focus-meta, html[data-theme="paper"] #homeEntries .home-focus-meta .num { color: #F7C9D4; font-family: var(--font-big); font-size: 30px; font-weight: 500; }
html[data-theme="paper"] #homeEntries .home-focus-card .corner-tag { color: #F7C9D4; }

/* 台历 (and 日历 later): azalea pink, deep rose text. */
html[data-theme="paper"] :is(#homeEntries, .cs-page) .ui-desk { --paper: #F7C9D4; --ink: #8E3F57; --muted: #8E3F57; --accent: #8E3F57; --line: #E7AFBE; border-color: #EDB5C4; background: #F7C9D4; color: #8E3F57; }
html[data-theme="paper"] :is(#homeEntries, .cs-page) .ui-desk * { border-color: #E7AFBE; }
html[data-theme="paper"] :is(#homeEntries, .cs-page) .ui-desk-date { color: #8E3F57; font-family: var(--font-big); font-weight: 600; letter-spacing: 0; }

/* 天气 / 今天 / 健康: sky blue, deep blue text, big numbers navy. (The P16 scene keeps its own colours.) */
html[data-theme="paper"] :is(#homeEntries, .cs-page) .ui-weather.is-scene { border-color: #B5CADA; background: #C8D9E6; color: #2F5470; }
html[data-theme="paper"] :is(#homeEntries, .cs-page) .ui-weather.is-scene :is(.ui-weather-city, .ui-weather-desc, .ui-weather-range, .ui-weather-range .num) { color: #2F5470; }
html[data-theme="paper"] :is(#homeEntries, .cs-page) .ui-weather.is-scene .ui-weather-city { font-family: "Courier Prime", monospace; font-size: 12px; letter-spacing: .2em !important; text-transform: uppercase; }
html[data-theme="paper"] :is(#homeEntries, .cs-page) .ui-weather.is-scene .ui-weather-temp { color: #2F4157; font-family: var(--font-big); font-size: 40px; font-weight: 500; }
html[data-theme="paper"] :is(#homeEntries, .cs-page) .ui-today { --paper: #C8D9E6; --sunken: #B7CCDC; --ink: #2F5470; --muted: #3F607B; --line: #A9C0D3; --accent: #2F4157; --accent-soft: #B7CCDC;
  border-color: #B5CADA; background: #C8D9E6; color: #2F5470; }
html[data-theme="paper"] :is(#homeEntries, .cs-page) .ui-today .ui-today-num b { color: #2F4157; font-family: var(--font-big); font-size: 32px; font-weight: 600; }
html[data-theme="paper"] :is(#homeEntries, .cs-page) .ui-today .ui-mood button[aria-pressed="true"] { background: #2F4157; color: #FFFFFF; }

/* 本周 / 回顾: light pink, rose text. */
html[data-theme="paper"] :is(#homeEntries, .cs-page) .ui-week { --paper: #FFE1E6; --sunken: #F9D0D8; --ink: #9A4E62; --muted: #9A4E62; --line: #F2C3CD; --accent: #9A4E62; --accent-soft: #F7C9D4;
  border-color: #F6CDD5; background: #FFE1E6; color: #9A4E62; }
html[data-theme="paper"] :is(#homeEntries, .cs-page) .ui-week-nums b { color: #9A4E62; font-family: var(--font-big); font-size: 28px; font-weight: 600; }

/* 今日小票 and other paper objects: off-white, navy text. */
html[data-theme="paper"] #homeEntries .home-strip { --ink: #2F4157; --muted: #56647A; background: #F5EFEB; color: #2F4157; }
html:not([data-theme="moon"]) #homeEntries .home-strip { background: repeating-linear-gradient(90deg, transparent 0 11px, rgba(47, 65, 87, .025) 11px 12px), #F5EFEB; }
html[data-theme="paper"] #homeEntries .home-strip .home-check { color: #2F4157; }

/* Time progress: white strip, navy bars. */
html[data-theme="paper"] #homeEntries .home-time { border-color: #E3DAD4; background: #FFFFFF; }
html[data-theme="paper"] #homeEntries .home-time .ui-progress i { background: #2F4157; }

/* P50 stat cards on the sheet follow the same modules: food / sleep sky blue, next item navy. */
html[data-theme="paper"] .cs-page .ui-stat { --paper: #C8D9E6; --ink: #2F5470; --muted: #3F607B; border-color: #B5CADA; background: #C8D9E6; color: #2F5470; }
html[data-theme="paper"] .cs-page .ui-stat.is-accent { --ink: #F2EEEA; --muted: #C9CFD8; border-color: #2F4157; background: #2F4157; color: #F2EEEA; }
html[data-theme="paper"] .cs-page .ui-stat-value { color: #2F4157; font-family: var(--font-big); font-weight: 600; }
html[data-theme="paper"] .cs-page .ui-stat.is-accent .ui-stat-text { color: #F2EEEA; }
html[data-theme="paper"] .cs-page .ui-stat.is-accent .ui-stat-sub { color: #F7C9D4; }

.ui-today-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.ui-today-head h3 { margin: 0; }
.home-strip-tag { display: block; margin-bottom: 6px; }
.corner-tag { display: none; }
html[data-theme="paper"] :is(#homeEntries, .cs-page) .corner-tag { display: inline; }
html[data-theme="paper"] :is(#homeEntries, .cs-page) .home-strip-tag { display: block; }

/* =====================================================================================================
   Moon theme: 月升 (Kain 10/21). A real full moon (NASA SVS CGI Moon Kit, public domain, projected to a disc and
   saved as WebP) rises from the top of the page, only its lower half showing, tinted warm gold with a soft halo and
   fading into the night and a thin mist. Night gradient + three slow P41 star layers behind; all fixed.
   Cards are frosted glass so the moonlight shows through. Stars stand still with reduced motion.
   ===================================================================================================== */
.moon-sky { display: none; }
html[data-theme="moon"] {
  --bg: #0B1230;
  --paper: rgba(20, 26, 52, .58);
  --sunken: rgba(255, 255, 255, .06);
  --line: rgba(255, 255, 255, .10);
  --sidebar: rgba(6, 10, 28, .55);
}
html[data-theme="moon"] body {
  background: linear-gradient(180deg, #060A1C 0%, #0E1A3F 38%, #252A5C 72%, #4B3A6B 90%, #6E4C6E 100%) fixed;
  background-color: #0B1230;
}
html[data-theme="moon"] .moon-sky { position: fixed; inset: 0; z-index: 0; display: block; overflow: hidden; pointer-events: none; }
html[data-theme="moon"] .shell { position: relative; z-index: 1; }
html[data-theme="moon"] .mobile-bottom-nav { z-index: 20; }

/* The moon: centred over the content column, only the lower half above the fold. */
.moon-sky .moon-rise { --moon-w: min(980px, calc((100vw - 220px) * .7)); position: absolute; top: calc(var(--moon-w) * -.5); left: calc(220px + (100vw - 220px) / 2);
  width: var(--moon-w); aspect-ratio: 1; transform: translateX(-50%); border-radius: 50%;
  box-shadow: 0 0 90px 30px rgba(255, 196, 120, .16), 0 0 220px 90px rgba(255, 170, 110, .08); }
.moon-sky .moon-disc { position: absolute; inset: 0; border-radius: 50%;
  background: url("/assets/illustrations/moon/moon-full.webp") center / cover no-repeat;
  filter: sepia(.55) saturate(1.35) hue-rotate(-10deg) brightness(1.04) contrast(.96);
  -webkit-mask-image: linear-gradient(180deg, #000 0%, #000 62%, rgba(0, 0, 0, .55) 80%, transparent 100%);
  mask-image: linear-gradient(180deg, #000 0%, #000 62%, rgba(0, 0, 0, .55) 80%, transparent 100%); }
/* A warm wash on the face, and the mist the lower rim sinks into. */
.moon-sky .moon-disc::after { content: ""; position: absolute; inset: 0; border-radius: 50%;
  background: radial-gradient(circle at 50% 35%, rgba(255, 214, 150, .18), rgba(255, 170, 90, .12) 60%, rgba(120, 60, 40, .10)); mix-blend-mode: soft-light; }
.moon-sky .moon-mist { position: absolute; left: 0; right: 0; top: calc(var(--mist-top, 34vw) - 120px); height: 260px;
  background: radial-gradient(60% 50% at calc(220px + (100vw - 220px) / 2) 40%, rgba(214, 190, 230, .16), transparent 70%); filter: blur(10px); }

/* P41: three faint star layers (white / ivory / pale gold), drifting up very slowly. */
.moon-sky .moon-stars { position: absolute; left: 0; right: 0; top: 0; height: 200%;
  background-image: radial-gradient(circle at 13px 27px, #FFFFFF 0 1px, transparent 1.4px), radial-gradient(circle at 97px 151px, #FFFFFF 0 1px, transparent 1.4px),
    radial-gradient(circle at 171px 63px, #FFFFFF 0 .8px, transparent 1.2px), radial-gradient(circle at 53px 199px, #FFFFFF 0 .8px, transparent 1.2px);
  background-size: 230px 230px; opacity: .30; }
.moon-sky .moon-stars.is-ivory { background-image: radial-gradient(circle at 41px 88px, #F4EBDD 0 1.1px, transparent 1.5px), radial-gradient(circle at 160px 20px, #F4EBDD 0 .9px, transparent 1.3px), radial-gradient(circle at 230px 210px, #F4EBDD 0 .9px, transparent 1.3px);
  background-size: 330px 330px; opacity: .22; }
.moon-sky .moon-stars.is-gold { background-image: radial-gradient(circle at 70px 140px, #F2D9A0 0 1.2px, transparent 1.7px), radial-gradient(circle at 300px 40px, #F2D9A0 0 1px, transparent 1.5px);
  background-size: 480px 480px; opacity: .18; }
@media (prefers-reduced-motion: no-preference) {
  .moon-sky .moon-stars { animation: moon-stars-up 260s linear infinite; }
  .moon-sky .moon-stars.is-ivory { animation-duration: 380s; }
  .moon-sky .moon-stars.is-gold { animation-duration: 540s; }
}
@keyframes moon-stars-up { to { transform: translateY(-50%); } }

/* Frosted glass cards: the moonlight shows through. */
html[data-theme="moon"] :is(.card, .ui-desk, .ui-weather, .ui-today, .ui-week, .ui-stat, .home-focus-card, .home-time, .rcpt-paper, .rcpt-stub, .rcpt-upcoming-day, .login-card) {
  background-color: rgba(20, 26, 52, .55); -webkit-backdrop-filter: blur(14px) saturate(1.1); backdrop-filter: blur(14px) saturate(1.1); border-color: rgba(255, 255, 255, .10); }
html[data-theme="moon"] #homeEntries .home-strip { background: rgba(20, 26, 52, .62); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); }
html[data-theme="moon"] :is(.desktop-sidebar, .mobile-bottom-nav) { -webkit-backdrop-filter: blur(16px) !important; backdrop-filter: blur(16px) !important; }

@media (max-width: 767px) {
  /* Phones: a smaller moon, less of it above the fold. */
  .moon-sky .moon-rise { --moon-w: 92vw; top: calc(var(--moon-w) * -.66); left: 50%; }
  .moon-sky .moon-mist { top: calc(32vw - 120px); background: radial-gradient(70% 50% at 50% 40%, rgba(214, 190, 230, .14), transparent 70%); }
}

/* ---- 首页配色收敛 (Kain 10/21): white / off-white over large areas, at most two coloured blocks ----------- */
html[data-theme="paper"] body { --accent-soft: #E6EFF6; --sidebar: #F5EFEB; }
/* 台历: white paper; binding strip, date and today's dot in azalea / deep rose. */
html[data-theme="paper"] :is(#homeEntries, .cs-page) .ui-desk { --paper: #FFFFFF; --ink: #2F4157; --muted: #56647A; --accent: #8E3F57; --line: #EBDDE1; border-color: #EBDDE1; background: #FFFFFF; color: #2F4157; }
html[data-theme="paper"] :is(#homeEntries, .cs-page) .ui-desk * { border-color: #EBDDE1; }
html[data-theme="paper"] :is(#homeEntries, .cs-page) .ui-desk-head { background: #F7C9D4; color: #8E3F57; }
html[data-theme="paper"] :is(#homeEntries, .cs-page) .ui-desk-hook { background: linear-gradient(0deg, #EBB3C2 0%, #F7C9D4 100%); }
html[data-theme="paper"] :is(#homeEntries, .cs-page) .ui-desk::after { background: #F7C9D4; }
html[data-theme="paper"] :is(#homeEntries, .cs-page) .ui-desk-pin { background: #FFFFFF; border-color: #E3A9B8; }
html[data-theme="paper"] :is(#homeEntries, .cs-page) .ui-desk-date { color: #8E3F57; }
html[data-theme="paper"] :is(#homeEntries, .cs-page) .ui-desk-mini th { color: #8E3F57; }
html[data-theme="paper"] :is(#homeEntries, .cs-page) .ui-desk-mini td.is-now { background: #8E3F57; color: #FFFFFF; }
/* 天气: the picture as drawn; white below it, navy text. */
html[data-theme="paper"] :is(#homeEntries, .cs-page) .ui-weather.is-scene { border-color: #E3DAD4; background: #FFFFFF; color: #2F4157; }
html[data-theme="paper"] :is(#homeEntries, .cs-page) .ui-weather.is-scene :is(.ui-weather-city, .ui-weather-desc, .ui-weather-range, .ui-weather-range .num, .ui-weather-temp) { color: #2F4157; }
/* 今天: a very light sky blue — one of the two coloured blocks. */
html[data-theme="paper"] :is(#homeEntries, .cs-page) .ui-today { --paper: #E6EFF6; --sunken: #D8E5EF; --line: #CCDBE7; border-color: #D3E1EC; background: #E6EFF6; }
/* 本周: white; bars in azalea pink (today deep rose); title and figures deep rose. */
html[data-theme="paper"] :is(#homeEntries, .cs-page) .ui-week { --paper: #FFFFFF; --sunken: #F6EEF0; --ink: #8E3F57; --muted: #7A5A64; --line: #EBDDE1; --accent: #8E3F57; --accent-soft: #FBE4EA;
  border-color: #E3DAD4; background: #FFFFFF; color: #8E3F57; }
html[data-theme="paper"] :is(#homeEntries, .cs-page) .ui-week-bar { background: #FBE4EA; }
html[data-theme="paper"] :is(#homeEntries, .cs-page) .ui-week-bar > i { background: #F7C9D4; }
html[data-theme="paper"] :is(#homeEntries, .cs-page) .ui-week-bar.is-today > i { background: #8E3F57; }
html[data-theme="paper"] :is(#homeEntries, .cs-page) .ui-week-nums b { color: #8E3F57; }
/* Sample-sheet stat cards: white, except the navy 下一项. */
html[data-theme="paper"] .cs-page .ui-stat { --paper: #FFFFFF; --ink: #2F4157; --muted: #56647A; border-color: #E3DAD4; background: #FFFFFF; color: #2F4157; }
/* Sidebar and top buttons: off-white, navy text, the current item navy with white text. */
html[data-theme="paper"] body .desktop-sidebar { background: #F5EFEB !important; }
html[data-theme="paper"] body .desktop-sidebar :is(.sidebar-link, .sidebar-link span, .brand-name, .brand-note) { color: #2F4157; }
html[data-theme="paper"] body .desktop-sidebar :is(.sidebar-link[aria-current], .sidebar-link[aria-current] span) { background: #2F4157; color: #FFFFFF; }
html[data-theme="paper"] body .mobile-bottom-nav { background: #F5EFEB !important; }
html[data-theme="paper"] body .mobile-bottom-nav button[aria-current] { background: #2F4157; }
html[data-theme="paper"] body .mobile-bottom-nav button[aria-current] :is(span, small, svg) { color: #FFFFFF; }
html[data-theme="paper"] body .top-actions :is(.ui-btn, button) { border-color: #D6DCE4; background: #FFFFFF; color: #2F4157; }
html[data-theme="paper"] body .top-actions :is(.ui-btn, button):hover { border-color: #2F4157; }

/* Moon: the corner tags show too, in a pale blue-grey (Kain 10/22). */
html[data-theme="moon"] :is(#homeEntries, .cs-page) .corner-tag { display: inline; color: #C7D2E0; font-family: "Courier Prime", monospace; font-size: 12px; font-weight: 700; letter-spacing: .2em !important; text-transform: uppercase; }
html[data-theme="moon"] :is(#homeEntries, .cs-page) .home-strip-tag { display: block; }

/* =====================================================================================================
   Moon: Celestial Night (Kain 10/22). Moon-rise background and frosted cards stay; the cards get three layers,
   and gold marks what is done, chosen or now. Palette: 深空蓝 #0A1026 · 午夜蓝 #142B52 · 星座蓝 #254A7A ·
   月光蓝 #5D7EA8 · 星光金 #D4B06A · 柔金 #F0D79A · 象牙白 #F8F6EE · 浅蓝灰 #C7D2E0.
   ===================================================================================================== */
html[data-theme="moon"] body {
  --ink: #F8F6EE; --ink-strong: #F8F6EE; --muted: #C7D2E0; --label: #C7D2E0;
  --accent: #D4B06A; --accent-deep: #C29C55; --accent-soft: rgba(212, 176, 106, .16); --on-accent: #0A1026;
  --paper: rgba(20, 43, 82, .52); --sunken: rgba(255, 255, 255, .06); --line: rgba(255, 255, 255, .10);
  --font-big: "Bodoni Moda", "Didot", "Bodoni 72", serif;
  --gold-glow: 0 0 8px rgba(240, 215, 154, .35);
  color: #F8F6EE;
}
/* Card layers: 午夜蓝 glass for most cards, 星座蓝 for 正在做 / 下一项, a pale 月光蓝 for 今天; 1px faint white edge, no shadow. */
html[data-theme="moon"] :is(.card, .ui-desk, .ui-weather, .ui-today, .ui-week, .ui-stat, .home-focus-card, .home-time, .rcpt-paper, .rcpt-stub, .rcpt-upcoming-day, .login-card) {
  background-color: rgba(20, 43, 82, .5); border-color: rgba(255, 255, 255, .10); box-shadow: none; }
html[data-theme="moon"] #homeEntries .home-focus-card { border-color: rgba(255, 255, 255, .14); background-color: rgba(37, 74, 122, .86); }
html[data-theme="moon"] :is(#homeEntries, .cs-page) .ui-today { --paper: rgba(93, 126, 168, .28); border-color: rgba(255, 255, 255, .12); background-color: rgba(93, 126, 168, .28); }
html[data-theme="moon"] #homeEntries .home-strip { background: rgba(20, 43, 82, .6); }

/* Gold: the desk date, ticks and checks, progress, chosen segments and moods, today's bar, the Current's time. */
html[data-theme="moon"] :is(#homeEntries, .cs-page) .ui-desk-date { color: #D4B06A; font-family: var(--font-big); font-weight: 600; letter-spacing: 0; text-shadow: var(--gold-glow); }
html[data-theme="moon"] :is(#homeEntries, .cs-page) .ui-desk-mini td.is-now { background: #D4B06A; color: #0A1026; }
html[data-theme="moon"] :is(.home-check, .rcpt-check) { color: #D4B06A; }
html[data-theme="moon"] :is(.ui-progress > i, .home-bar i, .rcpt-progress-track i.on) { background: #D4B06A; box-shadow: var(--gold-glow); }
html[data-theme="moon"] .ui-seg-glider { background: #D4B06A; box-shadow: var(--gold-glow); }
html[data-theme="moon"] .ui-seg-tab[aria-selected="true"], html[data-theme="moon"] .ui-seg-tab[aria-selected="true"] .ui-seg-count { color: #0A1026; }
html[data-theme="moon"] .ui-mood button[aria-pressed="true"] { background: #D4B06A; color: #0A1026; box-shadow: var(--gold-glow); }
html[data-theme="moon"] :is(#homeEntries, .cs-page) .ui-week-bar { background: rgba(93, 126, 168, .22); }
html[data-theme="moon"] :is(#homeEntries, .cs-page) .ui-week-bar > i { background: #5D7EA8; }
html[data-theme="moon"] :is(#homeEntries, .cs-page) .ui-week-bar.is-today > i { background: #F0D79A; box-shadow: var(--gold-glow); }
html[data-theme="moon"] #homeEntries .home-focus-meta, html[data-theme="moon"] #homeEntries .home-focus-meta .num { color: #F0D79A; font-family: var(--font-big); font-size: 30px; font-weight: 500; text-shadow: var(--gold-glow); }
html[data-theme="moon"] #homeEntries :is(.home-focus-title, .home-focus-head .is-on) { color: #F8F6EE; }
html[data-theme="moon"] #homeEntries .home-focus-head { color: #C7D2E0; }

/* Big numbers in Bodoni Moda, as on paper. */
html[data-theme="moon"] :is(#homeEntries, .cs-page) .ui-weather.is-scene .ui-weather-temp { font-family: var(--font-big); font-size: 40px; font-weight: 500; }
html[data-theme="moon"] :is(#homeEntries, .cs-page) .ui-today .ui-today-num b { color: #F8F6EE; font-family: var(--font-big); font-size: 32px; font-weight: 600; }
html[data-theme="moon"] :is(#homeEntries, .cs-page) .ui-week-nums b { color: #F8F6EE; font-family: var(--font-big); font-size: 28px; font-weight: 600; }
html[data-theme="moon"] :is(#homeEntries, .cs-page) .ui-weather.is-scene .ui-weather-city { font-family: "Courier Prime", monospace; font-size: 12px; letter-spacing: .2em !important; text-transform: uppercase; color: #C7D2E0; }

/* Background touches in the gold family, kept faint: the large stars, the late-night z's, the night-scene moon. */
.moon-sky .moon-stars.is-gold { background-image: radial-gradient(circle at 70px 140px, #F0D79A 0 1.4px, transparent 2px), radial-gradient(circle at 300px 40px, #D4B06A 0 1.2px, transparent 1.8px); opacity: .28; }
html[data-theme="moon"] .ui-zzz i { color: #F0D79A; opacity: .8; }
html[data-theme="moon"] body .ui-weather.is-scene, html[data-theme="moon"] body .ui-weather.is-scene:is(.is-overcast, .is-rain, .is-snow) { --sun: #F0D79A; --glint: #D4B06A; }
/* Older page rules (e.g. 健康's section links) colour the chosen tab by ID; on gold it must be dark. */
html[data-theme="moon"] .ui-seg .ui-seg-tab[aria-selected="true"] { color: #0A1026 !important; }

/* The chosen segment sits on a solid gold glider in Moon: its text is 深空蓝 everywhere, whatever page rule colours it. */
html[data-theme="moon"] body { --seg-on: #0A1026; }

/* Reading overlays are near-opaque (Kain 10/26): the Momo panel, dialogs and pop-up menus never let the page show through.
   Cards may stay frosted glass. Paper already uses solid surfaces here. */
html[data-theme="moon"] :is(.momo-chat-sheet, dialog[open]:not(.login-page), .ui-menu-list, .hp-menu, .ia-pending-menu) {
  background: rgba(14, 22, 48, .92) !important; -webkit-backdrop-filter: blur(24px) saturate(1.1); backdrop-filter: blur(24px) saturate(1.1); }
/* 还没有对话: the jar cat above the line, the picture kept inside its box. */
.momo-chat-empty .cat-figure.is-empty { width: 100px; height: 124px; margin: 0 auto 4px; }
.momo-chat-empty .cat-figure.is-empty img { width: 100% !important; height: 100% !important; max-width: none; object-fit: contain; }

/* ---- 工作台名称与图标 (Kain 10/26) ---------------------------------------------------------------------- */
.brand-name.is-custom { font-family: "Courier Prime", monospace; font-weight: 700; letter-spacing: .02em !important;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
/* One line in the desktop sidebar: 16 Courier characters need about 130px of the 132 there (closeout #5). */
.desktop-sidebar .brand-name.is-custom { font-size: 13.5px; letter-spacing: 0 !important; }
.brand-mark.is-custom { display: inline-grid; place-items: center; }
.brand-mark.is-custom .brand-emoji { font-size: 26px; line-height: 1; }
.brand-mark.is-custom .brand-image, .brand-preview .brand-image { width: 32px; height: 32px; border-radius: 8px; object-fit: cover; }
.brand-form { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 16px; }
.brand-preview { display: grid; place-items: center; width: 56px; height: 56px; border: 1px solid var(--line); border-radius: 14px; background: var(--paper); }
.brand-preview .brand-emoji { font-size: 30px; line-height: 1; }
.brand-fields { display: grid; gap: 8px; flex: 1 1 320px; min-width: 0; }
.brand-fields .ui-field { max-width: 360px; }
.brand-icon-row, .brand-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.brand-emoji-field { width: 96px; }
.brand-upload { position: relative; overflow: hidden; cursor: pointer; }
.brand-upload input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.brand-upload:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.brand-note { color: var(--muted); font-size: var(--text-small); }

/* ---- 小票印章: Momo's paw, slightly tilted, in the accent (gold in Moon) ------------------------------------- */
.rcpt-stamp { display: flex; justify-content: flex-end; margin: -6px 4px 10px; }
.rcpt-stamp-ring { display: inline-grid; justify-items: center; align-content: center; gap: 1px; width: 64px; height: 64px; border: 2px solid var(--accent);
  border-radius: 50%; color: var(--accent); opacity: .82; transform: rotate(-12deg); box-shadow: inset 0 0 0 3px var(--paper), inset 0 0 0 4px var(--accent); }
.rcpt-stamp-ring svg { width: 24px; height: 24px; fill: currentColor; }
.rcpt-stamp-word { font-family: "Courier Prime", monospace; font-size: 10px; font-weight: 700; letter-spacing: .18em !important; text-transform: uppercase; }
html[data-theme="moon"] .rcpt-stamp-ring { border-color: #D4B06A; color: #D4B06A; box-shadow: inset 0 0 0 3px rgba(20, 43, 82, .9), inset 0 0 0 4px #D4B06A; }

/* ---- 收尾清单 7–9（Kain 11/23）--------------------------------------------------------------------------- */
/* Settings toggles use the P9 tick instead of the browser's blue checkbox. */
.settings-list .ui-check input { width: 100%; height: 100%; }
/* 重置本地工作台数据: a plain button; the confirm step says what it does, not the colour (spec §4). */
.danger-button { border-color: var(--line); color: var(--ink); background: transparent; }
/* Apple 日历订阅 takes the full row so its two subscriptions sit side by side with room. */
#calendarSync { grid-column: 1 / -1; }
.authority-migration-card :is(.authority-migration-block, .authority-export-form) { display: grid; gap: 10px; }
.authority-migration-card h3 { margin: 0; font-size: var(--text-body); font-weight: 500; }
.authority-migration-status:empty { display: none; }
/* 收尾清单 11: on Moon the receipt page's side columns sit on the moon; give the empty line a dark backing and the titles a shadow. */
html[data-theme="moon"] .rcpt-side-title { color: var(--ink-strong); text-shadow: 0 1px 8px rgba(5, 8, 20, .9); }
html[data-theme="moon"] .rcpt-side-empty { padding: 12px 14px; border-radius: 6px; color: var(--ink); background: rgba(14, 22, 48, .92); }
/* 收尾清单 13: the library's 仅本机 tag and count are read at the small-text size, not 10px. */
#workoutLibrary .card-head .pill, #workoutLibrary .resource-count { font-size: var(--text-small); }
