/* ==================================================================
   GLP-1 个人体验记录 · 样式表
   移动优先：基础样式面向手机，>=720px 与 >=1080px 逐级增强到桌面。

   三条硬约束：
   1. 正文与可点击文字对比度 >= 4.5:1（旧版的 --muted 只有 2.65:1）；
   2. 输入控件 font-size >= 16px，否则 iOS Safari 聚焦时会自动放大页面；
   3. 主要操作触摸目标 >= 46px，次要操作 >= 38px。
   ================================================================== */

:root {
  /* 文字 */
  --ink: #18323d;
  --ink-soft: #445d64;
  --muted: #5c6c6a;

  /* 面 */
  --paper: #f5f2ea;
  --paper-deep: #ebe8df;
  --card: #fffdf8;
  --sunken: #faf9f4;
  --line: #e0dcd1;
  --line-soft: #ece8dd;

  /* 强调色（都按 4.5:1 调深过） */
  --terracotta: #ad4f28;
  --terracotta-soft: #f7e4d9;
  /* 放在 --terracotta-soft 上的文字要用这一档：--terracotta 在浅底上只有 4.34:1，
     差一点点不达标。这一档在同样的浅底上是 5.98:1。 */
  --terracotta-deep: #8f3d1c;
  --blue: #3f7378;
  --blue-soft: #ddeae9;
  --green: #3f7a52;
  --yellow: #d8af48;
  --yellow-soft: #f6edce;
  --yellow-ink: #6b5b36;

  --shadow: 0 10px 30px rgba(25, 47, 55, .07);
  --radius: 20px;
  --radius-sm: 14px;
  --tap: 46px;
  --tap-sm: 38px;
  --tabbar-h: 62px;

  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Noto Sans SC', 'Microsoft YaHei', 'Source Han Sans SC', sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, 'Courier New', monospace;

  font-family: var(--font-sans);
  color: var(--ink);
  background: var(--paper);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* { box-sizing: border-box; }

html {
  min-width: 300px;
  background: var(--paper);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-width: 300px;
  min-height: 100vh;
  background: var(--paper);
  font-size: 15px;
  line-height: 1.55;
  overscroll-behavior-y: none;
}

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }

/* 焦点环必须是实色。
   rgba(173,79,40,.4) 叠加在页面底色上只有 1.76:1，远低于 WCAG 2.2 焦点外观要求的
   3:1 —— 键盘用户实际上看不见焦点在哪。实色 --terracotta 是 4.78:1（对白卡片 5.35:1）。
   2px 的 offset 让环和按钮自身之间留出底色空隙，所以在同色按钮上也能分辨。 */
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible,
a:focus-visible {
  outline: 3px solid var(--terracotta);
  outline-offset: 2px;
}

/* ---------------------------------------------------------------- *
   启动 / 致命错误
 * ---------------------------------------------------------------- */

.boot-screen, .fatal-screen {
  min-height: 100vh;
  display: grid;
  place-content: center;
  gap: 14px;
  padding: 24px;
  text-align: center;
  color: var(--ink-soft);
}

.brand-mark {
  font-family: var(--font-mono);
  font-size: 26px;
  font-weight: 500;
  letter-spacing: -.16em;
  color: var(--ink);
}
.brand-mark span { color: var(--terracotta); }
.boot-screen p { margin: 0; font-size: 14px; }
.fatal-screen h1 { margin: 6px 0 0; font-size: 24px; color: var(--ink); }
.fatal-screen p { max-width: 430px; margin: 0; font-size: 15px; line-height: 1.7; }
.noscript { position: fixed; inset: 20px; z-index: 99; padding: 20px; border-radius: 14px; background: #fff; color: var(--ink); box-shadow: var(--shadow); }

/* ---------------------------------------------------------------- *
   外壳
 * ---------------------------------------------------------------- */

.app-shell { min-height: 100vh; }

.sidebar { display: none; }

.workspace { min-width: 0; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: calc(env(safe-area-inset-top, 0px) + 12px) 16px 12px;
  background: rgba(245, 242, 234, .93);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line-soft);
}

.topbar-heading { display: flex; align-items: center; gap: 10px; min-width: 0; }
.topbar-brand { font-size: 22px; }
.topbar-titles { min-width: 0; }
.topbar-heading h1 {
  margin: 3px 0 0;
  font-size: 20px;
  letter-spacing: -.035em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.eyebrow {
  display: inline-block;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: .1em;
  text-transform: uppercase;
}
.eyebrow.accent { color: var(--terracotta); }
.eyebrow.light { color: rgba(255, 255, 255, .7); }

.topbar-actions { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.online-status { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12px; }
.online-status #connection-label { display: none; }
.status-dot, .privacy-dot {
  display: inline-block;
  flex: 0 0 8px;
  width: 8px;
  height: 8px;
  border-radius: 100%;
  background: #4f8a5c;
  box-shadow: 0 0 0 3px rgba(79, 138, 92, .16);
}

.back-button {
  display: grid;
  place-content: center;
  width: var(--tap);
  height: var(--tap);
  margin-left: -8px;
  border: 0;
  border-radius: 14px;
  background: transparent;
  color: var(--ink);
  font-size: 20px;
}
.back-button:hover { background: rgba(24, 50, 61, .06); }

/* 底部导航（手机） */
.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  align-items: center;
  padding: 6px 6px calc(6px + env(safe-area-inset-bottom, 0px));
  background: rgba(245, 242, 234, .96);
  backdrop-filter: blur(16px);
  border-top: 1px solid var(--line);
}

.tab-item {
  display: grid;
  justify-items: center;
  gap: 3px;
  min-height: 50px;
  padding: 5px 2px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}
.tab-item.active { color: var(--terracotta); }
.tab-glyph { font-size: 17px; line-height: 1; }
.tab-primary .tab-glyph {
  display: grid;
  place-content: center;
  width: 44px;
  height: 44px;
  margin-top: -16px;
  border-radius: 15px;
  background: var(--terracotta);
  color: #fffdf8;
  font-size: 22px;
  box-shadow: 0 8px 18px rgba(173, 79, 40, .32);
}
.tab-primary .tab-label { color: var(--terracotta); }

/* 表单底部操作条（手机上替代 tabbar） */
.action-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  display: flex;
  gap: 10px;
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom, 0px));
  background: rgba(245, 242, 234, .96);
  backdrop-filter: blur(16px);
  border-top: 1px solid var(--line);
}
.action-bar .button { flex: 1; }
.action-bar .button-quiet { flex: 0 0 30%; }

.view-container {
  max-width: 1180px;
  margin: 0 auto;
  padding: 16px 16px calc(var(--tabbar-h) + 46px + env(safe-area-inset-bottom, 0px));
}

/* ---------------------------------------------------------------- *
   通用元件
 * ---------------------------------------------------------------- */

.button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  min-height: var(--tap);
  padding: 12px 18px;
  border: 1px solid transparent;
  border-radius: 13px;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: .01em;
  text-align: center;
  transition: .16s ease;
}
.button span { font-size: 17px; line-height: .7; }
.button-primary { background: var(--terracotta); color: #fffdf8; box-shadow: 0 7px 15px rgba(173, 79, 40, .22); }
.button-primary:hover { background: #93401f; }
.button-light { background: #fffdf8; color: var(--ink); box-shadow: 0 8px 18px rgba(0, 0, 0, .09); }
.button-quiet { border-color: var(--line); background: var(--card); color: var(--ink-soft); font-weight: 700; }
.button-quiet:hover { background: var(--paper-deep); }
.button-small { min-height: var(--tap-sm); padding: 9px 14px; font-size: 14px; }
.button-wide { width: 100%; }
.button-wide-mobile { width: 100%; }

.text-button {
  min-height: var(--tap-sm);
  padding: 8px 4px;
  border: 0;
  background: transparent;
  color: var(--terracotta);
  font-size: 14px;
  font-weight: 800;
}
.text-button span { margin-left: 4px; font-size: 16px; }
.text-button.centered { display: block; width: 100%; margin-top: 10px; color: var(--muted); }

.chip-button {
  min-height: var(--tap-sm);
  padding: 7px 14px;
  border: 1px solid var(--line);
  border-radius: 99px;
  background: var(--card);
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}
.chip-button:hover { border-color: var(--muted); color: var(--ink); }
.chip-button.danger { border-color: #e6c9bf; color: var(--terracotta); }
.chip-button.danger:hover { background: var(--terracotta-soft); }

.inline-link {
  border: 0;
  background: transparent;
  padding: 0 2px;
  color: var(--terracotta);
  font-size: inherit;
  font-weight: 800;
  text-decoration: underline;
}

.icon-button { border: 0; background: transparent; color: var(--muted); padding: 8px; font-size: 16px; }

.view-container > * + * { margin-top: 16px; }

/* ---------------------------------------------------------------- *
   卡片
 * ---------------------------------------------------------------- */

.latest-card, .rail-card, .timeline-page-card, .comparison-card,
.form-card, .install-card, .notice-card, .hero-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
}

.form-card { padding: 20px 18px; }
.latest-card { padding: 20px 18px; }
.rail-card { padding: 20px 18px; }
.comparison-card { padding: 20px 18px; margin-top: 16px; }
.timeline-page-card { padding: 4px 16px; }

.card-heading, .form-card-heading, .comparison-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
}
.card-heading h3, .form-card-heading h3, .comparison-heading h3 {
  margin: 6px 0 0;
  font-size: 17px;
  letter-spacing: -.03em;
}

.page-intro { margin-bottom: 18px; }
.page-intro h2 { margin: 8px 0 6px; font-size: 25px; letter-spacing: -.05em; }
.page-intro p { margin: 0; color: var(--ink-soft); font-size: 15px; line-height: 1.6; }
.intro-aside { display: flex; align-items: center; gap: 8px; margin-top: 14px; color: var(--muted); font-size: 12px; }

.section-heading h2 { margin: 6px 0 0; font-size: 20px; letter-spacing: -.04em; }
.row-between { display: flex; justify-content: space-between; align-items: end; gap: 12px; }

.helper-copy { margin: -4px 0 16px; color: var(--ink-soft); font-size: 13px; line-height: 1.65; }

/* ---------------------------------------------------------------- *
   今天
 * ---------------------------------------------------------------- */

.dashboard-main, .dashboard-rail { display: grid; align-content: start; gap: 18px; min-width: 0; }
.dashboard-grid > .dashboard-rail { margin-top: 20px; }

.hero-card {
  position: relative;
  overflow: hidden;
  border: 0;
  background: var(--ink);
  color: #fffdf8;
  box-shadow: var(--shadow);
}
.hero-content { position: relative; z-index: 2; padding: 30px 24px 32px; }
.hero-content h2 { margin: 10px 0 8px; font-size: 32px; line-height: 1.12; letter-spacing: -.05em; }
.hero-content h2 em { color: #f0b092; font-style: normal; }
.hero-content p { max-width: 320px; margin: 0 0 22px; color: rgba(255, 255, 255, .78); font-size: 14px; line-height: 1.7; }
.hero-decoration { position: absolute; right: 20px; top: 16px; z-index: 1; color: rgba(255, 255, 255, .1); font-family: serif; font-size: 170px; line-height: .8; }
.hero-wave { position: absolute; right: -30%; bottom: -55%; width: 90%; aspect-ratio: 1; border: 1px solid rgba(255, 255, 255, .09); border-radius: 50%; box-shadow: 0 0 0 26px rgba(255, 255, 255, .03), 0 0 0 56px rgba(255, 255, 255, .022); }

.stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stat-card { position: relative; min-height: 108px; overflow: hidden; padding: 14px 12px; border: 1px solid var(--line); border-radius: 16px; background: var(--card); }
.stat-label { display: block; color: var(--muted); font-size: 12px; }
.stat-card strong { display: block; margin-top: 6px; font-family: var(--font-mono); font-size: 26px; font-weight: 500; letter-spacing: -.06em; }
.stat-card small { color: var(--ink-soft); font-size: 11px; line-height: 1.35; display: block; }
.stat-mark { position: absolute; right: 8px; bottom: 4px; font-family: serif; font-size: 30px; opacity: .18; }
.stat-mark.terracotta { color: var(--terracotta); }
.stat-mark.blue { color: var(--blue); }
.stat-mark.yellow { color: #a8842c; }

.install-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  padding: 16px;
  margin-top: 16px;
  background: var(--blue-soft);
  border-color: #c6dcdb;
}
.install-icon { display: grid; place-content: center; width: 36px; height: 36px; border-radius: 12px; background: var(--blue); color: #fff; font-size: 17px; }
.install-card strong { display: block; font-size: 14px; color: #2b5459; }
.install-card p { margin: 5px 0 0; color: #2b5459; font-size: 13px; line-height: 1.6; }
.install-card em { font-style: normal; font-weight: 800; }
.install-card .chip-button { grid-column: 2; justify-self: start; background: rgba(255, 255, 255, .75); border-color: #b9d3d2; color: #2b5459; }

.empty-state { display: grid; justify-items: center; padding: 28px 16px 24px; text-align: center; }
.empty-orbit { display: grid; place-content: center; width: 52px; height: 52px; margin-bottom: 12px; border-radius: 50%; background: var(--terracotta-soft); color: var(--terracotta); font-size: 28px; }
.empty-state h3 { margin: 0; font-size: 16px; }
.empty-state p { max-width: 320px; margin: 8px 0 16px; color: var(--muted); font-size: 13px; line-height: 1.65; }

.snapshot-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-top: 16px; }
.snapshot-metric { padding: 12px; border-radius: 12px; background: var(--sunken); }
.snapshot-metric span { display: block; color: var(--muted); font-size: 12px; }
.snapshot-metric strong { display: block; margin-top: 4px; font-size: 14px; }
.snapshot-note { margin: 14px 0 0; padding: 12px 14px; border-left: 3px solid var(--yellow); background: #faf7ec; color: var(--ink-soft); font-size: 14px; line-height: 1.7; }
.snapshot-footer { display: flex; justify-content: space-between; align-items: center; margin-top: 14px; color: var(--muted); font-size: 12px; }
.empty-inline { grid-column: 1 / -1; padding: 14px 0 4px; color: var(--muted); font-size: 13px; }

.profile-card { background: #f2eee4; border-color: transparent; }
.profile-medication { display: flex; align-items: center; gap: 14px; margin: 18px 0 16px; }
.medication-orb { display: grid; place-content: center; width: 50px; height: 50px; border-radius: 16px; background: var(--ink); color: #fffdf8; font-family: var(--font-mono); font-size: 11px; line-height: .8; text-align: center; letter-spacing: -.1em; flex: 0 0 50px; }
/* 这个 span 是「GLP·1」里的「·1」，落在深色球体上，必须是浅色。
   选择器刻意带上 .profile-medication 提高权重：下面的
   `.profile-medication span` 与本规则同权重且写在后面，会把它盖掉 ——
   那条规则本来只想管副标题，结果让这里的浅色从来没生效过，
   实测对比度只有 1.91:1，等于看不见。axe 扫描发现。 */
.profile-medication .medication-orb span { color: #f0b092; }
.profile-medication strong { display: block; max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 15px; }
.profile-medication span { display: block; margin-top: 3px; color: var(--ink-soft); font-size: 12px; }
.profile-line, .last-dose { display: flex; justify-content: space-between; gap: 12px; padding-top: 12px; border-top: 1px solid rgba(24, 50, 61, .1); color: var(--ink-soft); font-size: 13px; }
.profile-line strong, .last-dose strong { color: var(--ink); font-size: 13px; }
.last-dose { display: block; margin-top: 12px; }
.last-dose strong { display: block; margin-top: 4px; }
.last-dose.muted { color: var(--muted); }
.last-dose.muted strong { color: var(--ink-soft); }

.timeline-rail h3 { font-size: 16px; }
.mini-event { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line-soft); }
.mini-event:last-child { border-bottom: 0; }
.mini-event-icon { display: grid; place-content: center; width: 32px; height: 32px; flex: 0 0 32px; border-radius: 10px; background: var(--terracotta-soft); color: var(--terracotta); font-size: 14px; }
.mini-event-icon.med { background: var(--blue-soft); color: var(--blue); }
.mini-event strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.mini-event span { display: block; margin-top: 2px; color: var(--muted); font-size: 12px; }
.rail-empty { padding: 22px 0 8px; color: var(--muted); font-size: 13px; }

.safety-note, .analysis-caveat, .settings-footer-note, .notice-card {
  display: flex;
  gap: 12px;
  padding: 15px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid #ecdfb4;
  background: var(--yellow-soft);
  color: var(--yellow-ink);
}
.safety-icon { display: grid; place-content: center; flex: 0 0 20px; width: 20px; height: 20px; margin-top: 1px; border: 1px solid currentColor; border-radius: 50%; font-size: 12px; font-weight: 700; }
.safety-note strong, .analysis-caveat strong, .settings-footer-note strong, .notice-card strong { display: block; font-size: 13px; }
.safety-note p, .analysis-caveat p, .settings-footer-note p, .notice-card p { margin: 6px 0 0; font-size: 13px; line-height: 1.65; }
.analysis-caveat { margin-top: 16px; }
.settings-footer-note { margin-top: 20px; }
.warn-note { margin-bottom: 16px; border-color: #e8c9bc; background: #fbeee8; color: #7a3a1c; }

/* ---------------------------------------------------------------- *
   记录表单
 * ---------------------------------------------------------------- */

.record-type-switch { display: flex; gap: 6px; padding: 5px; margin-bottom: 16px; border-radius: 15px; background: #e8e7de; }
.type-tab { flex: 1; min-height: 52px; padding: 8px 10px; border: 0; border-radius: 11px; background: transparent; color: var(--ink-soft); font-size: 14px; font-weight: 700; text-align: left; }
.type-tab small { display: block; margin-top: 2px; font-size: 11px; font-weight: 400; }
.type-tab.active { background: var(--card); color: var(--ink); box-shadow: 0 3px 8px rgba(25, 47, 55, .08); }

.section-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 2px; }

.form-section { padding: 0; overflow: hidden; }
.section-summary {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 64px;
  padding: 14px 16px;
  cursor: pointer;
  list-style: none;
}
.section-summary::-webkit-details-marker { display: none; }
.section-index { flex: 0 0 auto; color: var(--terracotta); font-family: var(--font-mono); font-size: 13px; }
.section-titles { flex: 1; min-width: 0; }
.section-titles strong { display: block; font-size: 16px; letter-spacing: -.02em; }
.section-titles small { display: block; margin-top: 2px; color: var(--muted); font-size: 12px; line-height: 1.4; }
.section-badge { flex: 0 0 auto; padding: 4px 9px; border-radius: 99px; background: var(--terracotta-soft); color: var(--terracotta); font-size: 11px; font-weight: 800; white-space: nowrap; }
.section-chevron { flex: 0 0 auto; color: var(--muted); font-size: 18px; transition: transform .2s ease; }
.form-section[open] .section-chevron { transform: rotate(180deg); }
.section-body { padding: 0 16px 18px; }
.section-body > * + * { margin-top: 16px; }

.form-row { display: grid; gap: 14px; }
.form-row > * + * { margin-top: 0; }

.field-label { display: grid; gap: 7px; color: var(--ink-soft); font-size: 13px; font-weight: 700; }
.field-label input,
.field-label select,
.field-label textarea,
.select-field select {
  width: 100%;
  min-height: var(--tap);
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  outline: 0;
  background: var(--sunken);
  color: var(--ink);
  /* 16px 是 iOS Safari 不自动放大页面的下限 */
  font-size: 16px;
  font-weight: 500;
  transition: border-color .16s ease, background .16s ease;
}
.field-label input:focus, .field-label select:focus, .field-label textarea:focus { border-color: var(--terracotta); background: #fff; }
.field-label textarea { resize: vertical; line-height: 1.6; padding-top: 12px; }
.compact-label { margin-top: 14px; }
.form-row > .field-label + .field-label { margin-top: 0; }
.input-with-unit { display: grid; grid-template-columns: minmax(0, 1fr) 88px; gap: 8px; }

/* 分段式量表 */
.choice-list { display: grid; gap: 18px; }
.choice-field { margin: 0; padding: 0; border: 0; }
.choice-legend { display: block; margin: 0 0 9px; padding: 0; }
.choice-title { display: block; color: var(--ink); font-size: 14px; font-weight: 700; }
.choice-legend small { display: block; margin-top: 2px; color: var(--muted); font-size: 12px; font-weight: 500; }
.sensitive-badge { display: inline-block; margin-left: 6px; padding: 2px 7px; border-radius: 99px; background: var(--yellow-soft); color: var(--yellow-ink); font-size: 10px; font-weight: 800; vertical-align: 1px; }

.choice-row { display: grid; gap: 7px; }
.choice-row.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.choice-row.cols-5 { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.choice-chip {
  position: relative;
  display: grid;
  place-items: center;
  min-height: var(--tap);
  padding: 7px 5px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--sunken);
  cursor: pointer;
  text-align: center;
  transition: .14s ease;
}
.choice-chip input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}
.choice-chip span { color: var(--ink-soft); font-size: 13px; font-weight: 600; line-height: 1.25; }
.choice-chip:has(input:checked) { border-color: var(--terracotta); background: var(--terracotta-soft); }
.choice-chip:has(input:checked) span { color: var(--terracotta); font-weight: 800; }
.choice-chip:has(input:focus-visible) { outline: 3px solid var(--terracotta); outline-offset: 2px; }

.choice-meta { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 7px; }
.choice-meta small { color: var(--muted); font-size: 11px; }
.choice-clear { min-height: 34px; padding: 5px 12px; border: 1px solid var(--line); border-radius: 99px; background: transparent; color: var(--muted); font-size: 12px; font-weight: 700; }
.choice-clear[hidden] { display: none; }

.record-side-column { display: none; }
.privacy-note-small { display: none; }

.sticky-save-card { padding: 24px 22px 20px; border-radius: var(--radius); background: var(--ink); color: #fffdf8; }
.sticky-save-card.warm { background: #7d4a37; }
.save-orbit { display: grid; place-content: center; width: 44px; height: 44px; margin-bottom: 18px; border-radius: 50%; background: rgba(255, 255, 255, .12); color: #f0b092; font-family: serif; font-size: 22px; }
.sticky-save-card h3 { margin: 0; font-size: 19px; letter-spacing: -.04em; }
.sticky-save-card p { margin: 9px 0 20px; color: rgba(255, 255, 255, .78); font-size: 14px; line-height: 1.7; }

/* ---------------------------------------------------------------- *
   时间线
 * ---------------------------------------------------------------- */

.filter-bar { display: flex; gap: 8px; margin-bottom: 14px; overflow-x: auto; padding-bottom: 2px; -webkit-overflow-scrolling: touch; }
.filter-pill { flex: 0 0 auto; min-height: 40px; padding: 8px 14px; border: 1px solid var(--line); border-radius: 99px; background: var(--card); color: var(--ink-soft); font-size: 13px; font-weight: 700; }
.filter-pill small { margin-left: 4px; color: var(--muted); font-family: var(--font-mono); font-size: 12px; }
.filter-pill.active { border-color: var(--ink); background: var(--ink); color: #fffdf8; }
.filter-pill.active small { color: rgba(255, 255, 255, .72); }

.timeline-list { display: grid; }
.timeline-event { display: grid; grid-template-columns: 52px 26px minmax(0, 1fr); gap: 8px; padding: 20px 0; border-bottom: 1px solid var(--line-soft); }
.timeline-event:last-child { border-bottom: 0; }
.timeline-date { padding-top: 3px; text-align: right; }
.timeline-date strong { display: block; font-size: 12px; }
.timeline-date span { display: block; margin-top: 3px; color: var(--muted); font-family: var(--font-mono); font-size: 11px; }
.timeline-connector { position: relative; display: flex; justify-content: center; }
.timeline-connector::after { content: ''; position: absolute; top: 32px; bottom: -32px; width: 1px; background: var(--line); }
.timeline-event:last-child .timeline-connector::after { display: none; }
.timeline-node { position: relative; z-index: 1; display: grid; place-content: center; width: 28px; height: 28px; border-radius: 10px; background: var(--terracotta-soft); color: var(--terracotta); font-size: 13px; }
.timeline-node.med-node { background: var(--blue-soft); color: var(--blue); }
.event-kind { color: var(--terracotta); font-family: var(--font-mono); font-size: 11px; letter-spacing: .08em; }
.event-topline h3 { margin: 4px 0 0; font-size: 16px; letter-spacing: -.03em; }
.event-details { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 10px; }
.event-details span, .metric-chip, .muted-chip { display: inline-block; padding: 5px 9px; border-radius: 8px; background: #f2f1e9; color: var(--ink-soft); font-size: 12px; }
.event-note { margin: 10px 0 0; color: var(--ink-soft); font-size: 14px; line-height: 1.65; }
.timeline-metrics { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 11px; }
.metric-chip { display: flex; gap: 6px; align-items: center; }
.metric-chip strong { color: var(--muted); font-weight: 500; }
.tag-line { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 9px; color: var(--muted); font-size: 12px; }
.tag-line span { margin-right: 2px; }
.tag-line em { padding: 4px 8px; border-radius: 7px; background: var(--terracotta-soft); color: var(--terracotta); font-style: normal; }
.event-actions { display: flex; gap: 8px; margin-top: 13px; }

/* ---------------------------------------------------------------- *
   阶段比较
 * ---------------------------------------------------------------- */

.compare-legend { display: flex; align-items: center; gap: 7px; margin-top: 12px; color: var(--ink-soft); font-size: 13px; }
.legend-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; }
.legend-dot.first { background: var(--terracotta); }
.legend-dot.second { background: var(--blue); }
.compare-legend .legend-dot.second { margin-left: 8px; }

.compare-controls { display: grid; gap: 16px; }
.compare-period { min-width: 0; display: grid; gap: 12px; }
.period-label { display: flex; align-items: center; gap: 8px; }
.period-label strong { font-size: 15px; }
.period-label small { margin-left: auto; color: var(--muted); font-size: 12px; }
.compare-arrow { display: none; }
.compare-message { display: flex; gap: 9px; margin: 0; padding: 11px 13px; border-radius: 12px; font-size: 13px; line-height: 1.6; }
.compare-message.error { background: #fbeee8; border: 1px solid #e8c9bc; color: #7a3a1c; }
.compare-message.warn { background: var(--yellow-soft); border: 1px solid #ecdfb4; color: var(--yellow-ink); }
.compare-message + .compare-message { margin-top: 8px; }
.compare-blocked { text-align: center; }
.compare-blocked h3 { margin: 6px 0; font-size: 16px; }
.compare-blocked p { margin: 0; color: var(--muted); font-size: 13px; }

.comparison-note { color: var(--muted); font-family: var(--font-mono); font-size: 11px; }
.comparison-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 56px;
  grid-template-areas:
    "name name"
    "bars values"
    "delta delta";
  align-items: center;
  gap: 10px 12px;
  padding: 15px 0;
  border-top: 1px solid var(--line-soft);
}
.comparison-row:first-of-type { margin-top: 16px; }
.comparison-name { grid-area: name; }
.comparison-name strong { display: block; font-size: 14px; }
.comparison-name small { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; }
.comparison-bars { grid-area: bars; display: grid; gap: 7px; }
.comparison-values { grid-area: values; display: grid; gap: 7px; font-family: var(--font-mono); font-size: 12px; text-align: right; }
.comparison-values strong:first-child { color: var(--terracotta); }
.comparison-values strong:last-child { color: var(--blue); }
.bar-track { height: 8px; border-radius: 99px; background: #f0efe7; overflow: hidden; }
.bar-fill { display: block; height: 100%; border-radius: 99px; }
.bar-fill.first { background: var(--terracotta); }
.bar-fill.second { background: var(--blue); }
.delta-label { grid-area: delta; color: var(--green); font-size: 12px; }

.frequency-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-areas:
    "name name"
    "va vb";
  align-items: center;
  gap: 10px;
  padding: 14px 0;
  border-top: 1px solid var(--line-soft);
}
.frequency-row:first-of-type { margin-top: 16px; }
.frequency-name { grid-area: name; }
.frequency-name strong { display: block; font-size: 14px; }
.frequency-name small { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; }
.frequency-bars { display: none; }
.frequency-value { display: grid; gap: 3px; padding: 9px; border-radius: 11px; text-align: center; }
.frequency-value small { font-size: 11px; font-weight: 700; }
.frequency-value strong { font-family: var(--font-mono); font-size: 15px; }
.frequency-value.first { grid-area: va; background: var(--terracotta-soft); color: var(--terracotta-deep); }
.frequency-value.second { grid-area: vb; background: var(--blue-soft); color: var(--blue); }

/* ---------------------------------------------------------------- *
   设置
 * ---------------------------------------------------------------- */

.settings-grid { display: grid; gap: 16px; }
.tracking-picker { margin: 20px 0; padding: 0; border: 0; }
.tracking-picker legend { margin-bottom: 11px; padding: 0; color: var(--ink-soft); font-size: 13px; font-weight: 700; }
.tracking-grid { display: grid; gap: 8px; }
.tracking-choice {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 11px;
  min-height: var(--tap);
  padding: 13px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--sunken);
  cursor: pointer;
}
.tracking-choice input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.checkmark { position: relative; flex: 0 0 20px; width: 20px; height: 20px; margin-top: 1px; border: 1px solid #b9c2bc; border-radius: 6px; background: #fff; }
.tracking-choice:has(input:checked) .checkmark { border-color: var(--terracotta); background: var(--terracotta); }
.tracking-choice:has(input:checked) .checkmark::after { content: '✓'; position: absolute; inset: 0; color: #fff; font-size: 13px; font-weight: 700; line-height: 19px; text-align: center; }
.tracking-choice:has(input:focus-visible) { outline: 3px solid var(--terracotta); outline-offset: 2px; }
.tracking-choice strong { display: block; font-size: 14px; }
.tracking-choice small { display: block; margin-top: 3px; color: var(--muted); font-size: 12px; line-height: 1.5; }
.tracking-choice > span:last-child { min-width: 0; }
.standalone-choice { margin-top: 4px; }

.data-actions-card > p { margin: -4px 0 16px; color: var(--ink-soft); font-size: 13px; line-height: 1.65; }
.action-list { border-top: 1px solid var(--line-soft); }
.action-row {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) 18px;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 62px;
  padding: 13px 0;
  border: 0;
  border-bottom: 1px solid var(--line-soft);
  background: transparent;
  color: var(--ink);
  text-align: left;
}
.action-row:hover { color: var(--terracotta); }
.action-row strong { display: block; font-size: 14px; }
.action-row small { display: block; margin-top: 3px; color: var(--muted); font-size: 12px; line-height: 1.45; }
.action-icon { display: grid; place-content: center; width: 32px; height: 32px; border-radius: 10px; background: var(--blue-soft); color: var(--blue); font-size: 14px; }
.action-row.danger { color: var(--terracotta); }
.action-row.danger .action-icon { background: #f8e2d9; color: var(--terracotta); }
.deletion-hint { margin: 14px 0 0; padding: 12px 13px; border-radius: 12px; background: var(--sunken); color: var(--ink-soft); font-size: 12px; line-height: 1.6; }
.version-line { margin-top: 14px; color: var(--muted); font-family: var(--font-mono); font-size: 11px; }

/* ---------------------------------------------------------------- *
   隐私与数据说明
 * ---------------------------------------------------------------- */

.privacy-grid { display: grid; gap: 16px; }
.plain-list { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.plain-list li { display: flex; gap: 9px; font-size: 14px; line-height: 1.6; }
.plain-list li span { flex: 0 0 auto; font-weight: 800; }
.plain-list li.yes { color: var(--ink-soft); }
.plain-list li.yes span { color: var(--green); }
.plain-list li.no { color: var(--ink-soft); }
.plain-list li.no span { color: var(--terracotta); }

.fact-list { display: grid; gap: 14px; }
.fact-list.compact { gap: 0; margin-top: 6px; border-top: 1px solid var(--line-soft); }
.fact strong { display: block; font-size: 14px; }
.fact p { margin: 5px 0 0; color: var(--ink-soft); font-size: 13px; line-height: 1.65; }
.fact-line { display: flex; justify-content: space-between; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line-soft); font-size: 13px; }
.fact-line span { color: var(--muted); }
.fact-line strong { text-align: right; font-weight: 700; }

.inventory { display: grid; gap: 14px; }
.inventory-group { padding: 13px; border-radius: var(--radius-sm); background: var(--sunken); }
.inventory-head strong { display: block; font-size: 14px; }
.inventory-head small { display: block; margin-top: 3px; color: var(--muted); font-size: 12px; }
.inventory-fields { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.inventory-chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 9px; border-radius: 8px; background: var(--card); border: 1px solid var(--line); color: var(--ink-soft); font-size: 12px; }
.inventory-chip.sensitive { border-color: #ecdfb4; background: var(--yellow-soft); color: var(--yellow-ink); }
/* 不要在这里加 opacity：半透明会把 5.64:1 拉到 3.69:1，直接不达标。 */
.inventory-chip em { font-style: normal; font-size: 10px; font-weight: 800; }

.scope-block + .scope-block { margin-top: 16px; }
.scope-block > strong { display: block; margin-bottom: 9px; font-size: 14px; }

/* ---------------------------------------------------------------- *
   首次引导
 * ---------------------------------------------------------------- */

.onboarding-page { position: relative; min-height: 100vh; display: grid; place-items: center; overflow: hidden; padding: 24px 16px calc(24px + env(safe-area-inset-bottom, 0px)); background: #e9ece6; }
.onboarding-card {
  position: relative;
  z-index: 1;
  width: min(660px, 100%);
  padding: 26px 20px 22px;
  border: 1px solid rgba(24, 50, 61, .06);
  border-radius: 26px;
  background: rgba(255, 253, 248, .94);
  box-shadow: 0 20px 60px rgba(24, 50, 61, .12);
}
.onboarding-brand { display: flex; align-items: center; gap: 10px; color: var(--ink-soft); font-size: 14px; font-weight: 800; }
.onboarding-copy { margin-top: 34px; }
.onboarding-copy h1 { margin: 10px 0 12px; font-size: 38px; line-height: 1; letter-spacing: -.06em; }
.onboarding-copy h1 em { color: var(--terracotta); font-style: normal; }
.onboarding-copy p { max-width: 500px; margin: 0; color: var(--ink-soft); font-size: 14px; line-height: 1.7; }
.onboarding-points { display: grid; gap: 10px; margin: 26px 0; padding: 16px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.onboarding-points div { display: flex; gap: 9px; color: var(--ink-soft); font-size: 13px; line-height: 1.5; }
.point-number { color: var(--terracotta); font-family: var(--font-mono); font-size: 12px; }
.onboarding-form { display: grid; gap: 14px; }
.form-section-heading { display: flex; justify-content: space-between; align-items: center; }
.form-section-heading span { font-size: 15px; font-weight: 800; }
.form-section-heading small { color: var(--muted); font-size: 12px; }
.local-note { display: flex; gap: 9px; align-items: flex-start; padding: 12px 13px; border-radius: 11px; background: #eaf1ea; color: #3d603f; font-size: 12px; line-height: 1.6; }
.local-note > span:first-child { color: var(--green); font-size: 16px; line-height: 1; }
.local-note strong { color: #2f5232; }
.onboarding-disclaimer { margin: 16px 0 0; color: var(--muted); font-size: 12px; line-height: 1.6; text-align: center; }
.onboarding-glow { position: absolute; border-radius: 50%; opacity: .5; }
.glow-one { top: -22%; right: -12%; width: 420px; height: 420px; background: #d6e3dd; }
.glow-two { left: -16%; bottom: -24%; width: 340px; height: 340px; background: #f1d8c7; }

/* ---------------------------------------------------------------- *
   提示条（含撤销）
 * ---------------------------------------------------------------- */

.toast {
  position: fixed;
  z-index: 40;
  left: 16px;
  right: 16px;
  bottom: calc(var(--tabbar-h) + 16px + env(safe-area-inset-bottom, 0px));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 16px;
  border-radius: 14px;
  background: var(--ink);
  color: #fff;
  box-shadow: var(--shadow);
  font-size: 14px;
  animation: toast-in .18s ease-out;
}
.toast-action {
  flex: 0 0 auto;
  min-height: 34px;
  padding: 5px 13px;
  border: 1px solid rgba(255, 255, 255, .4);
  border-radius: 99px;
  background: transparent;
  color: #ffd9c6;
  font-size: 13px;
  font-weight: 800;
}
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* ---------------------------------------------------------------- *
   版本更新提示（见 ADR-0005：由用户决定何时刷新）
 * ---------------------------------------------------------------- */

.update-banner {
  position: fixed;
  z-index: 35;
  left: 16px;
  right: 16px;
  bottom: calc(var(--tabbar-h) + 12px + env(safe-area-inset-bottom, 0px));
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px 10px 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card);
  box-shadow: var(--shadow);
  font-size: 13px;
}
.update-banner-text { flex: 1; min-width: 0; font-weight: 700; }
.update-banner-action {
  flex: 0 0 auto;
  min-height: var(--tap-sm);
  padding: 6px 14px;
  border: 0;
  border-radius: 99px;
  background: var(--terracotta);
  color: #fffdf8;
  font-size: 13px;
  font-weight: 700;
}
.update-banner-dismiss {
  flex: 0 0 auto;
  display: grid;
  place-content: center;
  width: var(--tap-sm);
  height: var(--tap-sm);
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
}
.update-banner-dismiss:hover { background: rgba(24, 50, 61, .06); }

/* 提示条和撤销条会占同一条底部位置，两者同时出现时把撤销条顶上去 */
body:has(.update-banner) .toast { bottom: calc(var(--tabbar-h) + 82px + env(safe-area-inset-bottom, 0px)); }

.warn-text { color: #7a3a1c; }

.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }

/* ---------------------------------------------------------------- *
   平板（>= 600px）
 * ---------------------------------------------------------------- */

@media (min-width: 600px) {
  .view-container { padding: 20px 24px calc(var(--tabbar-h) + 50px + env(safe-area-inset-bottom, 0px)); }
  .topbar { padding-left: 24px; padding-right: 24px; }
  .form-card, .latest-card, .rail-card, .comparison-card { padding: 22px 22px; }
  .timeline-page-card { padding: 6px 22px; }
  .onboarding-card { padding: 34px 32px 28px; }
  .onboarding-copy h1 { font-size: 46px; }
  .snapshot-grid { grid-template-columns: repeat(4, 1fr); }
  .choice-row.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .choice-row.cols-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .choice-chip span { font-size: 14px; }
  .button-wide-mobile { width: auto; }
  .compare-controls { grid-template-columns: 1fr; gap: 14px; }
}

/* ---------------------------------------------------------------- *
   桌面（>= 1000px）
 * ---------------------------------------------------------------- */

@media (min-width: 1000px) {
  body { font-size: 15px; }

  .tabbar, .action-bar { display: none; }
  .app-shell { display: flex; }
  .sidebar {
    position: sticky;
    top: 0;
    display: flex;
    flex: 0 0 232px;
    flex-direction: column;
    width: 232px;
    height: 100vh;
    padding: 30px 18px 20px;
    background: #eff0e9;
    border-right: 1px solid rgba(24, 50, 61, .05);
  }
  .brand-block { display: flex; align-items: center; gap: 12px; padding: 0 12px 34px; }
  .brand-title { font-size: 15px; font-weight: 800; letter-spacing: .03em; }
  .brand-caption { margin-top: 3px; color: var(--muted); font-family: var(--font-mono); font-size: 10px; white-space: nowrap; }
  .main-nav { display: grid; gap: 6px; }
  .nav-item { display: flex; align-items: center; gap: 13px; min-height: var(--tap); padding: 11px 13px; border: 0; border-radius: 13px; background: transparent; color: var(--ink-soft); font-size: 14px; font-weight: 600; text-align: left; transition: .18s ease; }
  .nav-item:hover { background: rgba(255, 255, 255, .6); color: var(--ink); }
  .nav-item.active { background: var(--ink); color: #fffdf8; box-shadow: 0 8px 18px rgba(24, 50, 61, .14); }
  .nav-icon { width: 20px; text-align: center; font-size: 16px; }
  .sidebar-bottom { margin-top: auto; }
  .privacy-card { display: flex; gap: 10px; align-items: flex-start; padding: 13px 12px; border-radius: 14px; background: rgba(255, 255, 255, .62); }
  .privacy-card strong { display: block; font-size: 12px; }
  .privacy-card span { display: block; margin-top: 4px; color: var(--muted); font-size: 11px; line-height: 1.45; }
  .sidebar-footer { padding: 18px 12px 0; color: var(--muted); font-family: var(--font-mono); font-size: 10px; }

  .workspace { flex: 1; min-width: 0; }
  .topbar { position: static; padding: 28px 40px 16px; background: transparent; backdrop-filter: none; border-bottom: 0; }
  .topbar-brand { display: none; }
  .topbar-heading h1 { font-size: 26px; }
  .online-status #connection-label { display: inline; }
  .back-button { display: none; }
  .view-container { max-width: 1180px; padding: 8px 40px 60px; }

  .hero-content { padding: 36px 38px; }
  .hero-content h2 { font-size: 40px; }
  .hero-decoration { font-size: 220px; right: 30px; top: 24px; }

  .dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(280px, .85fr); gap: 22px; }
  .dashboard-grid > .dashboard-rail { margin-top: 0; }
  .dashboard-rail { display: grid; align-content: start; gap: 18px; }
  .stats-grid { gap: 12px; }
  .stat-card { min-height: 120px; padding: 18px; }
  .stat-card strong { font-size: 28px; }
  .stat-label { font-size: 13px; }
  .stat-card small { font-size: 12px; }

  .record-layout { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(240px, .62fr); align-items: start; gap: 22px; }
  .record-main-column { display: grid; gap: 14px; }
  .record-side-column { display: block; }
  .privacy-note-small { display: flex; gap: 9px; margin-top: 12px; padding: 13px 14px; border: 1px solid var(--line); border-radius: 14px; color: var(--muted); }
  .privacy-note-small span { color: var(--terracotta); font-size: 15px; }
  .privacy-note-small p { margin: 0; font-size: 12px; line-height: 1.6; }
  .sticky-save-card { position: sticky; top: 20px; }
  .section-body > * + * { margin-top: 18px; }

  .form-row.two-columns { grid-template-columns: 1fr 1fr; }
  .form-row.two-columns > * + * { margin-top: 0; }
  .choice-row.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

  .compare-controls { grid-template-columns: 1fr 32px 1fr; align-items: center; gap: 20px; }
  .compare-controls #compare-message { grid-column: 1 / -1; }
  .compare-arrow { display: block; color: var(--muted); text-align: center; font-size: 18px; }

  .comparison-row {
    grid-template-columns: 118px minmax(140px, 1fr) 66px 78px;
    grid-template-areas: "name bars values delta";
    gap: 16px;
  }
  .comparison-values { text-align: right; }
  .delta-label { text-align: right; }

  .frequency-row {
    grid-template-columns: minmax(150px, 1fr) minmax(120px, 1.3fr) 84px 84px;
    grid-template-areas: "name bars va vb";
    gap: 14px;
  }
  .frequency-bars { display: grid; gap: 7px; }
  .frequency-value { padding: 8px; }

  .settings-grid { grid-template-columns: minmax(0, 1fr) minmax(320px, .9fr); gap: 20px; }
  .privacy-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .privacy-grid > .form-card:first-child { grid-column: 1 / -1; }
  .toast { left: auto; right: 24px; bottom: 24px; max-width: 460px; }
  /* 桌面端底部居中，不与右下角的撤销条抢位置 */
  .update-banner { left: 50%; right: auto; transform: translateX(-50%); bottom: 24px; width: min(520px, calc(100vw - 48px)); }
  body:has(.update-banner) .toast { bottom: 96px; }
}

/* ---------------------------------------------------------------- *
   打印 / 导出 PDF
 * ---------------------------------------------------------------- */

@media print {
  body, html { background: #fff; }
  .sidebar, .tabbar, .action-bar, .topbar-actions, .filter-bar,
  .record-side-column, .settings-footer-note, .event-actions,
  .chip-button, .text-button, .back-button, .install-card, .section-toolbar {
    display: none !important;
  }
  .topbar { position: static; padding: 16px 0; background: none; border: 0; }
  .view-container { max-width: none; padding: 0; }
  .app-shell { display: block; }
  .workspace { width: 100%; }
  .section-body { padding: 0 !important; }
  .form-section, .latest-card, .rail-card, .timeline-page-card, .comparison-card, .form-card {
    box-shadow: none;
    break-inside: avoid;
  }
  .dashboard-grid, .settings-grid, .privacy-grid { display: block; }
  .dashboard-rail { margin-top: 16px; }
  .hero-card { print-color-adjust: exact; -webkit-print-color-adjust: exact; }
}

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