/* wk-life：只給週末哥一個人看的身體與錢。固定淺色（他手機開深色模式也不准變黑底）
   設計判讀與放掉 taste 的哪幾條寫在 .qa/taste.md */
:root {
  color-scheme: light;
  --accent: #F5C518;
  --accent-deep: #7A5E00;
  --accent-soft: #FFF6D1;
  --ink: #1C1C21;
  --ink-2: #4A4A51;
  --ink-3: #6B6B72;
  --bg: #F6F6F4;
  --surface: #FFFFFF;
  --line: #E3E3DE;
  --ok: #1E7A4C;
  --danger: #B42318;
  --danger-soft: #FDECEA;
  --r-card: 16px;
  --r-input: 10px;
  --shadow: 0 1px 2px rgba(60, 50, 10, .05), 0 6px 20px rgba(60, 50, 10, .05);
  --font: 'Geist', 'Noto Sans TC', system-ui, sans-serif;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { background: var(--bg); -webkit-text-size-adjust: 100%; }
body {
  background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 16px; line-height: 1.7;
  line-break: strict; text-wrap: pretty; -webkit-font-smoothing: antialiased;
  padding-bottom: calc(84px + env(safe-area-inset-bottom));
}
h1, h2, h3, b, strong { font-weight: 600; }
button { font: inherit; color: inherit; }
a { color: inherit; }
.wrap { max-width: 720px; margin: 0 auto; padding: 0 16px; }
.num { font-family: 'Geist', var(--font); font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.mute { color: var(--ink-3); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
svg.i { width: 20px; height: 20px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }

/* 頂欄 */
.top { display: flex; align-items: center; justify-content: space-between; height: 56px; margin-top: 12px; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 17px; text-decoration: none; }
.brand i { width: 26px; height: 26px; border-radius: 8px; background: var(--accent); display: grid; place-items: center; font-style: normal; font-size: 13px; }
.iconbtn { width: 40px; height: 40px; border-radius: 999px; border: 0; background: transparent; display: grid; place-items: center; color: var(--ink-2); text-decoration: none; }
.iconbtn:active { background: var(--line); }

/* 底部分頁：拇指按得到 */
.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; background: rgba(255,255,255,.96); backdrop-filter: blur(10px);
  border-top: 1px solid var(--line); padding-bottom: max(8px, env(safe-area-inset-bottom)); }
.tabs .wrap { display: grid; grid-template-columns: repeat(3, 1fr); }
.tabs a { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 9px 0 8px; font-size: 12px; text-decoration: none; color: var(--ink-3); }
.tabs a[aria-current="page"] { color: var(--ink); font-weight: 600; }
.tabs a[aria-current="page"] svg.i { stroke: var(--accent-deep); }

/* 通用 */
.view { display: none; padding: 8px 0 32px; }
.view.on { display: block; }
.h1 { font-size: 28px; line-height: 1.25; letter-spacing: -.01em; }
.sub { color: var(--ink-3); font-size: 14px; margin-top: 4px; }
.card { background: var(--surface); border-radius: var(--r-card); box-shadow: var(--shadow); padding: 20px; }
.stack > * + * { margin-top: 16px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 20px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); font-weight: 600; font-size: 15px; text-decoration: none; cursor: pointer; white-space: nowrap; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--ink); }
.btn:active { transform: scale(.98); }
.btn[disabled] { opacity: .6; cursor: default; }
.btn[aria-busy="true"]::before { content: ''; width: 16px; height: 16px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite; }
.row { display: flex; gap: 8px; flex-wrap: wrap; }
.more { display: inline-flex; align-items: center; gap: 4px; margin-top: 14px; font-weight: 600; font-size: 15px; text-decoration: none; color: var(--accent-deep); }
.err { background: var(--danger-soft); color: var(--danger); border-radius: var(--r-input); padding: 12px 14px; font-size: 14px; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shimmer { to { background-position: -200% 0; } }
.skel { border-radius: var(--r-card); background: linear-gradient(90deg, #ECECE8 25%, #F4F4F1 50%, #ECECE8 75%); background-size: 200% 100%; animation: shimmer 1.2s linear infinite; }

/* 總覽 */
.today { font-size: 14px; color: var(--ink-3); }
.home-card h2 { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--ink-3); font-weight: 500; }
.home-card .big { font-size: 22px; line-height: 1.4; margin-top: 8px; }
.home-card .focus { margin-top: 12px; padding-left: 12px; border-left: 3px solid var(--accent); color: var(--ink); font-size: 15px; text-wrap: balance; }
.home-card .focus span { display: block; font-size: 13px; color: var(--ink-3); }
.home-grid { display: grid; gap: 16px; align-items: start; }
.money-big { font-size: 34px; line-height: 1.2; margin-top: 6px; }
.delta { font-size: 14px; margin-top: 4px; color: var(--ink-3); }
.delta b.up { color: var(--danger); }
.delta b.down { color: var(--ok); }

/* 分類長條：沒有底色軌道，長度就是答案 */
.bars { margin-top: 16px; display: grid; gap: 10px; }
.bar { display: grid; grid-template-columns: 4.5em 1fr auto; align-items: center; gap: 10px; font-size: 14px; }
.bar span:first-child { color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar i { display: block; height: 10px; border-radius: 999px; background: var(--accent); min-width: 4px; }
.bar.rest i { background: #E8DFA8; }

/* 六個月直條 */
.cols { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; align-items: end; height: 150px; margin-top: 16px; }
.col { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 6px; font-size: 12px; color: var(--ink-3); }
.col i { width: 100%; max-width: 40px; border-radius: 8px 8px 3px 3px; background: #E8DFA8; min-height: 3px; }
.col.on i { background: var(--accent); }
.col.on { color: var(--ink); font-weight: 600; }
.col em { font-style: normal; font-size: 11px; color: var(--ink-3); white-space: nowrap; }

.month-nav { display: flex; align-items: center; justify-content: space-between; }
.month-nav b { font-size: 18px; }
.biglist { margin-top: 8px; }
.biglist li { list-style: none; display: grid; grid-template-columns: 1fr auto; gap: 12px; padding: 12px 0; }
.biglist li + li { border-top: 1px solid var(--line); }
.biglist small { display: block; color: var(--ink-3); font-size: 13px; }

/* 體質病歷 */
.vbar { display: flex; align-items: center; gap: 10px; background: var(--accent-soft); border-radius: var(--r-input); padding: 10px 14px; font-size: 14px; }
.vbar a { font-weight: 600; color: var(--accent-deep); margin-left: auto; white-space: nowrap; }

/* 流程圖：一步一格，往下接 */
.flow { margin-top: 16px; display: grid; gap: 0; }
.step { position: relative; display: grid; grid-template-columns: 28px 1fr; gap: 12px; padding-bottom: 18px; }
.step::before { content: ''; position: absolute; left: 13px; top: 28px; bottom: 0; width: 2px; background: var(--line); }
.step:last-child { padding-bottom: 0; }
.step:last-child::before { display: none; }
.step .dot { width: 28px; height: 28px; border-radius: 50%; background: var(--bg); border: 2px solid var(--line); display: grid; place-items: center; font-size: 13px; font-weight: 600; color: var(--ink-2); position: relative; }
.step b { display: block; font-size: 16px; line-height: 1.5; padding-top: 2px; }
.step small { display: block; color: var(--ink-3); font-size: 14px; margin-top: 2px; }
.step.goal .dot { background: var(--accent); border-color: var(--accent); color: var(--ink); }
.step.goal b { color: var(--ink); }
.step.dry .dot { border-color: #E5A39B; color: var(--danger); }

.sec h2 { font-size: 20px; line-height: 1.35; }
.sec h3 { font-size: 16px; margin-top: 18px; }
.sec p { margin-top: 10px; color: var(--ink-2); }
.terms { margin-top: 6px; }
.term { padding: 12px 0; }
.term + .term { border-top: 1px solid var(--line); }
.term dt { font-weight: 600; font-size: 15px; }
.term dd { color: var(--ink-2); margin-top: 2px; }

/* 日常調養：一天的時間軸 */
.day { margin-top: 12px; display: grid; }
.slot { display: grid; grid-template-columns: 76px 1fr; gap: 14px; padding: 12px 0; position: relative; }
.slot + .slot { border-top: 1px dashed var(--line); }
.slot .when { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; font-weight: 600; font-size: 14px; }
.slot .when svg.i { color: var(--accent-deep); }
.slot p { margin: 0; color: var(--ink-2); font-size: 15px; }

/* 禁忌：一眼看到的地雷 */
.mines { margin-top: 12px; display: grid; gap: 10px; }
.mine { background: var(--danger-soft); border-radius: 12px; padding: 14px 16px; }
.mine b { display: flex; align-items: center; gap: 8px; color: var(--danger); font-size: 15px; }
.mine p { margin-top: 4px; color: var(--ink-2); font-size: 15px; }

/* 歷史與差異 */
.vlist li { list-style: none; }
.vlist a { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; padding: 14px 0; text-decoration: none; }
.vlist li + li a { border-top: 1px solid var(--line); }
.vlist small { color: var(--ink-3); font-size: 13px; }
.diff { margin-top: 12px; font-size: 14px; display: grid; gap: 4px; }
.diff div { padding: 6px 10px; border-radius: 8px; }
.diff .add { background: #E6F4EC; }
.diff .del { background: var(--danger-soft); text-decoration: line-through; color: var(--ink-3); }

/* 改寫表單 */
label.f { display: block; font-weight: 600; font-size: 15px; }
label.f small { display: block; font-weight: 400; color: var(--ink-3); font-size: 13px; margin-top: 2px; }
label.f textarea, label.f input { display: block; width: 100%; margin-top: 8px; border: 1px solid #CFCFC8; border-radius: var(--r-input); background: var(--surface);
  padding: 12px; font: inherit; font-weight: 400; font-size: 16px; line-height: 1.6; color: var(--ink); }
label.f textarea:focus, label.f input:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent-deep); }

/* 登入 */
.login { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; }
.login .card { width: 100%; max-width: 380px; padding: 32px 24px; }
.login h1 { font-size: 26px; margin-top: 16px; }
.login p { color: var(--ink-2); margin-top: 6px; }
.login .btn { width: 100%; margin-top: 24px; }

@media (min-width: 760px) {
  .h1 { font-size: 32px; }
  .home-grid { grid-template-columns: 1fr 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  .skel { animation: none; }
  .btn:active { transform: none; }
}
