/* 豐譽內部 UI 設計系統 — 行動版適配
   teal 主色 + 暖棕點綴 + 綠/紅語意色，藥丸按鈕，柔和陰影，全自訂元件 */

:root {
  /* 主色 teal */
  --brand-900: #003B42;
  --brand-800: #00555E;
  --brand-500: #007A87;
  --brand-200: #B5E1E5;
  --brand-50:  #E6F2F3;
  /* 次色 暖棕 clay */
  --clay-800: #765530;
  --clay-500: #BE8B55;
  --clay-200: #E0C8AE;
  --clay-50:  #F6EFE7;
  /* 語意色 */
  --ok-800: #198754;
  --ok-500: #28A745;
  --ok-200: #91EFA6;
  --bad-900: #8C1915;
  --bad-500: #AE1914;
  --bad-400: #E23B3B;
  --bad-200: #EBCDCC;
  /* info sky */
  --sky-800: #6B8FC4;
  --sky-500: #8FAADC;
  --sky-200: #DAE3F3;
  /* 中性 */
  --grey-100: #F5F5F5;
  --grey-200: #E0E0E0;
  --grey-400: #BDBDBD;
  --grey-600: #9E9E9E;
  --grey-800: #757575;
  --grey-900: #424242;
  --text-100: #000000;
  --text-80: rgba(0,0,0,.8);
  --text-60: rgba(0,0,0,.6);
  --text-40: rgba(0,0,0,.4);
  --text-30: rgba(0,0,0,.3);
  --white: #FFFFFF;
  /* 形狀 */
  --r-sm: 8px;
  --r-input: 12px;
  --r-modal: 14px;
  --r-card: 16px;
  --r-pill: 100px;
  /* 陰影 */
  --sh-card: 0 2px 4px 2px rgba(0,0,0,.12);
  --sh-pop: 0 12px 28px -8px rgba(0,0,0,.22);
  --sh-modal: 0 25px 50px -12px rgba(0,0,0,.25);
  /* 字體：內網無 CDN，全部靠系統字型；PingFang TC 是 iOS 內建 */
  --font-sans: "Noto Sans TC","PingFang TC","PingFang SC","Microsoft JhengHei","微軟正黑體","思源黑體",system-ui,-apple-system,sans-serif;
  --font-mono: ui-monospace,"SF Mono",Menlo,monospace;
  /* 版面 */
  --header-h: 56px;
  --tabbar-h: 56px;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0; padding: 0;
  height: 100%;
  overscroll-behavior: none;
}

body {
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  color: var(--grey-900);
  background: var(--grey-100);
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}

button, input, textarea { font-family: inherit; font-size: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; padding: 0; }
input { -webkit-appearance: none; appearance: none; }

:focus { outline: none; }
:focus-visible { outline: 2px solid var(--brand-500); outline-offset: 2px; }
/* 輸入框自己有 focus 樣式（teal 邊 + 淺 teal 環），不需要再疊一圈系統外框 */
.input:focus-visible, .bignum input:focus-visible { outline: none; }

/* 自訂捲軸 */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-thumb { background: var(--grey-400); border-radius: var(--r-sm); }
::-webkit-scrollbar-track { background: transparent; }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* ── App 骨架 ─────────────────────────────── */

#app { display: flex; flex-direction: column; height: 100dvh; }

/* 在電腦上開時把版面收成手機寬度置中，不然卡片會被拉成全寬 */
@media (min-width: 560px) {
  body { background: var(--grey-200); }
  #app {
    max-width: 440px; margin: 0 auto;
    background: var(--grey-100);
    box-shadow: 0 0 0 1px rgba(0,0,0,.06);
  }
  #toasts { max-width: 440px; margin: 0 auto; }
}

.hdr {
  flex: 0 0 auto;
  padding-top: var(--safe-t);
  background: var(--brand-50);
  border-bottom: 1px solid var(--brand-200);
  box-shadow: 0 1px 2px rgba(0,0,0,.04);
}
.hdr-in {
  height: var(--header-h);
  display: flex; align-items: center; gap: 10px;
  padding: 0 16px;
}
.hdr-title { font-size: 18px; font-weight: 700; color: var(--brand-800); flex: 1; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.avatar {
  width: 32px; height: 32px; border-radius: var(--r-pill);
  background: var(--brand-500); color: var(--white);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; flex: 0 0 auto;
}
.hdr-user { display: flex; align-items: center; gap: 4px; padding: 4px; border-radius: var(--r-input); color: var(--brand-800); }
.hdr-user:active { background: var(--brand-200); }
.hdr-user svg { width: 16px; height: 16px; }

main {
  flex: 1 1 auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 16px 16px 24px;
}

.tabbar {
  flex: 0 0 auto;
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: var(--white);
  border-top: 1px solid var(--grey-200);
  padding-bottom: var(--safe-b);
}
.tab {
  height: var(--tabbar-h);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  color: var(--grey-800); font-size: 11px;
  transition: color .15s ease;
}
.tab svg { width: 22px; height: 22px; }
.tab[aria-selected="true"] { color: var(--brand-500); font-weight: 700; }

/* ── 卡片 ─────────────────────────────────── */

.card {
  background: var(--white);
  border: 1px solid rgba(224,224,224,.7);
  border-radius: var(--r-card);
  box-shadow: var(--sh-card);
  padding: 16px;
  margin-bottom: 12px;
}
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.card-title { font-size: 14px; font-weight: 700; color: var(--text-80); }
.card-note { font-size: 12px; color: var(--text-60); margin-top: 8px; line-height: 1.5; }

.sec-head {
  display: flex; align-items: center; gap: 8px;
  margin: 20px 0 10px;
}
.sec-head:first-child { margin-top: 0; }
.sec-title { font-size: 14px; font-weight: 700; color: var(--text-80); }
.sec-count {
  background: var(--grey-100); color: var(--grey-800);
  font-size: 12px; font-weight: 700; padding: 1px 10px; border-radius: var(--r-pill);
}
.sec-rule { flex: 1; height: 1px; background: var(--grey-200); }

/* ── 按鈕 ─────────────────────────────────── */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 40px; padding: 0 20px;
  border-radius: var(--r-pill);
  font-size: 15px; font-weight: 700;
  transition: background .15s ease, color .15s ease, box-shadow .15s ease;
  user-select: none; -webkit-user-select: none;
}
.btn svg { width: 18px; height: 18px; }
.btn-sm { height: 32px; padding: 0 14px; font-size: 13px; }
.btn-sm svg { width: 16px; height: 16px; }
.btn-lg { height: 48px; font-size: 16px; }
.btn-block { display: flex; width: 100%; }

.btn-primary { background: var(--brand-500); color: var(--white); }
.btn-primary:active { background: var(--brand-800); }
.btn-secondary { background: var(--clay-500); color: var(--white); }
.btn-secondary:active { background: var(--clay-800); }
.btn-accent { background: var(--ok-500); color: var(--white); }
.btn-accent:active { background: var(--ok-800); }
.btn-alert { background: var(--bad-500); color: var(--white); }
.btn-alert:active { background: var(--bad-900); }
.btn-tertiary { background: var(--white); color: var(--brand-500); box-shadow: inset 0 0 0 2px var(--brand-500); }
.btn-tertiary:active { background: var(--brand-50); }
.btn-ghost { background: transparent; color: var(--grey-800); }
.btn-ghost:active { background: var(--grey-100); }
.btn[disabled] { opacity: .3; pointer-events: none; }
.btn-tertiary[disabled] { opacity: .4; }

/* ── 徽章 ─────────────────────────────────── */

.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 10px; border-radius: var(--r-pill);
  font-size: 12px; font-weight: 700; line-height: 1.6;
}
.badge svg { width: 13px; height: 13px; }
.badge-ok   { background: var(--ok-200);   color: var(--ok-800); }
.badge-warn { background: var(--clay-200); color: var(--clay-800); }
.badge-bad  { background: var(--bad-200);  color: var(--bad-900); }
.badge-info { background: var(--brand-200);color: var(--brand-800); }
.badge-mut  { background: var(--grey-200); color: var(--grey-800); }

/* ── 表單 ─────────────────────────────────── */

.field { margin-bottom: 16px; }
.field:last-child { margin-bottom: 0; }
.label { display: block; font-size: 14px; font-weight: 700; color: var(--text-80); margin-bottom: 6px; }
.label .req { color: var(--bad-500); margin-left: 2px; }
.hint { font-size: 12px; color: var(--text-60); margin-top: 6px; display: flex; align-items: center; gap: 4px; }
.hint svg { width: 13px; height: 13px; flex: 0 0 auto; }
.err { font-size: 12px; color: var(--bad-500); margin-top: 6px; }

.input {
  width: 100%; height: 44px;
  padding: 0 14px;
  border: 2px solid var(--grey-600);
  border-radius: var(--r-input);
  background: var(--white);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.input::placeholder { color: var(--text-30); }
.input:focus { border-color: var(--brand-500); box-shadow: 0 0 0 2px var(--brand-200); }
.input.is-err { border-color: var(--bad-500); }
textarea.input { height: auto; min-height: 64px; padding: 10px 14px; line-height: 1.6; resize: none; }

/* 大數字輸入 */
.bignum { display: flex; align-items: baseline; gap: 8px; }
.bignum input {
  flex: 1; min-width: 0;
  height: 50px; padding: 0 4px;
  border: none; border-bottom: 2px solid var(--grey-600);
  border-radius: 0; background: transparent;
  font-size: 32px; font-weight: 700; line-height: 1.2;
  color: var(--brand-800);
  transition: border-color .15s ease;
}
.bignum input:focus { border-bottom-color: var(--brand-500); }
.bignum input::placeholder { color: var(--grey-400); font-weight: 400; }
.bignum input.is-err { border-bottom-color: var(--bad-500); }
.bignum .unit { font-size: 14px; font-weight: 700; color: var(--text-60); flex: 0 0 auto; }
.bignum.sm input { height: 42px; font-size: 24px; }

.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.row3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }

/* 逐欄控制項 trigger */
.ctl {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  width: 100%; height: 36px; padding: 0 12px;
  border: 1px solid var(--grey-200); border-radius: var(--r-sm);
  background: var(--white); font-size: 14px;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.ctl:active, .ctl.is-open { border-color: var(--brand-500); }
.ctl.is-open { box-shadow: 0 0 0 2px var(--brand-200); }
.ctl svg { width: 16px; height: 16px; color: var(--grey-800); flex: 0 0 auto; transition: transform .15s ease; }
.ctl.is-open svg.chev { transform: rotate(180deg); }
.ctl-val { flex: 1; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 膠囊 chips */
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 7px 14px; border-radius: var(--r-pill);
  border: 1px solid var(--grey-200); background: var(--white);
  font-size: 14px; color: var(--text-60);
  transition: all .15s ease;
}
.chip svg { width: 16px; height: 16px; }
.chip:active { border-color: var(--brand-500); }
.chip[aria-pressed="true"] {
  border-color: var(--brand-500); background: var(--brand-50);
  color: var(--brand-800); font-weight: 700;
}
.chips-sm .chip { padding: 4px 12px; font-size: 13px; }

/* 快速記錄：5 等分，拇指可及的大目標 */
.quick-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.quick {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  min-height: 62px; padding: 8px 2px;
  border-radius: var(--r-input); border: 1px solid var(--grey-200);
  background: var(--white); color: var(--brand-800); font-size: 12px; font-weight: 700;
  transition: all .15s ease;
}
.quick svg { width: 22px; height: 22px; color: var(--brand-500); }
.quick:active { border-color: var(--brand-500); background: var(--brand-50); }

/* 分段控制 */
.seg {
  display: grid; gap: 2px;
  background: var(--grey-100); border-radius: var(--r-input); padding: 3px;
  margin-bottom: 16px;
}
.seg button {
  padding: 8px 4px; border-radius: var(--r-sm);
  font-size: 14px; color: var(--text-60);
  transition: all .15s ease;
}
.seg button[aria-selected="true"] {
  background: var(--white); color: var(--brand-800); font-weight: 700;
  box-shadow: 0 1px 2px rgba(0,0,0,.08);
}

/* 自訂 switch */
.switch {
  position: relative; width: 40px; height: 24px; flex: 0 0 auto;
  border-radius: var(--r-pill); background: var(--grey-400);
  transition: background .15s ease;
}
.switch::after {
  content: ""; position: absolute; top: 3px; left: 3px;
  width: 18px; height: 18px; border-radius: var(--r-pill);
  background: var(--white); box-shadow: 0 1px 2px rgba(0,0,0,.2);
  transition: transform .15s ease;
}
.switch[aria-checked="true"] { background: var(--brand-500); }
.switch[aria-checked="true"]::after { transform: translateX(16px); }

/* 列表列 */
.lrow {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 0;
  border-bottom: 1px solid var(--grey-200);
}
.lrow:last-child { border-bottom: none; padding-bottom: 0; }
.lrow:first-child { padding-top: 0; }
.lrow-ico {
  width: 40px; height: 40px; border-radius: var(--r-input);
  display: flex; align-items: center; justify-content: center;
  flex: 0 0 auto; color: var(--white);
  background: linear-gradient(135deg, var(--brand-500), var(--brand-800));
}
.lrow-ico svg { width: 20px; height: 20px; }
.lrow-ico.clay { background: linear-gradient(135deg, var(--clay-500), var(--clay-800)); }
.lrow-ico.sky  { background: linear-gradient(135deg, var(--sky-500), var(--sky-800)); }
.lrow-route {
  width: 44px; height: 44px; flex: 0 0 auto;
  border-radius: var(--r-input); background: var(--brand-50);
  border: 1px solid var(--brand-200); overflow: hidden;
}
.lrow-route svg { display: block; width: 100%; height: 100%; }
.route { width: 100%; display: block; }
.lrow-body { flex: 1; min-width: 0; }
.lrow-t { font-size: 15px; font-weight: 700; color: var(--text-80); }
.lrow-s { font-size: 12px; color: var(--text-60); }
.lrow-act { flex: 0 0 auto; display: flex; gap: 2px; }
.icon-btn {
  width: 34px; height: 34px; border-radius: var(--r-sm);
  display: flex; align-items: center; justify-content: center;
  color: var(--grey-800); transition: all .15s ease;
}
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn:active { background: var(--grey-100); }
.icon-btn.danger:active { background: var(--bad-200); color: var(--bad-900); }

/* 統計數字 */
.kpi { display: flex; align-items: baseline; gap: 6px; }
.kpi-v { font-size: 30px; font-weight: 700; color: var(--brand-800); line-height: 1.15; }
.kpi-u { font-size: 13px; color: var(--text-60); }
.kpi-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.kpi-box { background: var(--grey-100); border-radius: var(--r-input); padding: 10px 12px; }
.kpi-box .l { font-size: 12px; color: var(--text-60); }
.kpi-box .v { font-size: 20px; font-weight: 700; color: var(--brand-800); line-height: 1.3; }
.kpi-box .v small { font-size: 12px; font-weight: 400; color: var(--text-60); }

.bar { height: 6px; border-radius: var(--r-pill); background: var(--grey-200); overflow: hidden; margin-top: 8px; }
.bar > i { display: block; height: 100%; border-radius: var(--r-pill); background: var(--brand-500); transition: width .3s ease; }
.bar > i.done { background: var(--ok-500); }

/* 通知列：無底色無邊框，圖示與文字同行 */
.notice { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--clay-800); padding: 5px 0; }
.notice svg { width: 16px; height: 16px; color: var(--clay-500); flex: 0 0 auto; }
.notice button { color: var(--clay-800); font-weight: 700; text-decoration: underline; font-size: 13px; }

.empty { text-align: center; padding: 26px 16px; color: var(--text-40); font-size: 14px; }
.empty svg { width: 34px; height: 34px; margin-bottom: 8px; color: var(--grey-400); }

/* ── 浮層 / 對話框 ──────────────────────────── */

.pop {
  position: fixed; z-index: 60;
  background: var(--white); border: 1px solid var(--grey-200);
  border-radius: var(--r-input); box-shadow: var(--sh-pop);
  padding: 6px; max-height: 62vh; overflow-y: auto;
}
.pop-item {
  display: flex; align-items: center; gap: 8px;
  width: 100%; padding: 10px 12px; border-radius: var(--r-sm);
  font-size: 15px; text-align: left; color: var(--text-80);
}
.pop-item svg { width: 17px; height: 17px; flex: 0 0 auto; }
.pop-item:active { background: var(--brand-50); color: var(--brand-800); }
.pop-item[aria-selected="true"] { background: var(--brand-50); color: var(--brand-800); font-weight: 700; }
.pop-item.danger { color: var(--bad-500); }
.pop-item.danger:active { background: var(--bad-200); color: var(--bad-900); }
.pop-head { padding: 8px 12px; border-bottom: 1px solid var(--grey-200); margin-bottom: 4px; }
.pop-head .n { font-size: 14px; font-weight: 700; color: var(--text-80); }
.pop-head .s { font-size: 12px; color: var(--text-60); }

.scrim {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(0,0,0,.5);
  display: flex; align-items: center; justify-content: center;
  padding: 20px calc(20px + env(safe-area-inset-right, 0px)) calc(20px + var(--safe-b)) calc(20px + env(safe-area-inset-left, 0px));
  padding-top: calc(20px + var(--safe-t));
}
.scrim.light { background: rgba(0,0,0,.3); }
.modal {
  width: 100%; max-width: 420px; max-height: 100%;
  background: var(--white); border-radius: var(--r-modal);
  box-shadow: var(--sh-modal); padding: 24px;
  overflow-y: auto;
}
.modal-head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 16px; }
.modal-title { flex: 1; font-size: 17px; font-weight: 700; color: var(--text-100); }
.modal-x {
  width: 32px; height: 32px; border-radius: var(--r-sm);
  background: var(--grey-100); color: var(--grey-900);
  display: flex; align-items: center; justify-content: center; flex: 0 0 auto;
}
.modal-x svg { width: 18px; height: 18px; }
.modal-x:active { background: var(--grey-200); }
.modal-foot { display: flex; gap: 8px; justify-content: flex-end; margin-top: 20px; }
.modal-sec { display: flex; align-items: center; gap: 8px; margin: 18px 0 10px; }
.modal-sec i { display: block; width: 4px; height: 14px; border-radius: 2px; background: var(--brand-500); }
.modal-sec span { font-size: 14px; font-weight: 700; color: var(--brand-500); }

/* 危險確認 */
.confirm { width: 100%; max-width: 384px; background: var(--white); border-radius: var(--r-modal);
  overflow: hidden; box-shadow: var(--sh-modal); padding: 24px; }
.confirm-body { display: flex; gap: 14px; }
.confirm-ico {
  width: 44px; height: 44px; border-radius: var(--r-pill); flex: 0 0 auto;
  background: var(--bad-200); color: var(--bad-900);
  display: flex; align-items: center; justify-content: center;
}
.confirm-ico svg { width: 22px; height: 22px; }
.confirm-t { font-size: 16px; font-weight: 700; color: var(--bad-900); margin-bottom: 4px; }
.confirm-d { font-size: 14px; color: var(--text-60); line-height: 1.6; }
.confirm-d b { color: var(--text-100); font-weight: 700; }

/* Toast */
#toasts {
  position: fixed; left: 0; right: 0; z-index: 90;
  bottom: calc(var(--tabbar-h) + var(--safe-b) + 12px);
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  pointer-events: none; padding: 0 16px;
}
.toast {
  display: flex; align-items: center; gap: 10px;
  width: 100%; max-width: 300px;
  background: var(--white); border: 1px solid rgba(224,224,224,.7);
  border-radius: var(--r-card); box-shadow: 0 12px 28px -8px rgba(0,0,0,.2);
  padding: 10px 14px 10px 10px;
  animation: toastIn .2s ease;
}
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } }
.toast-ico {
  width: 32px; height: 32px; border-radius: var(--r-sm); flex: 0 0 auto;
  display: flex; align-items: center; justify-content: center; color: var(--white);
  background: linear-gradient(135deg, var(--brand-500), var(--brand-800));
}
.toast-ico svg { width: 17px; height: 17px; }
.toast.ok .toast-ico  { background: linear-gradient(135deg, var(--ok-500), var(--ok-800)); }
.toast.bad .toast-ico { background: linear-gradient(135deg, var(--bad-400), var(--bad-900)); }
.toast-msg { font-size: 14px; color: var(--text-80); line-height: 1.4; }

/* ── 日曆 ─────────────────────────────────── */

.cal { width: 268px; padding: 12px; }
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.cal-title { font-size: 15px; font-weight: 700; color: var(--brand-800); padding: 4px 10px; border-radius: var(--r-sm); }
.cal-title:active { background: var(--brand-50); }
.cal-nav { width: 30px; height: 30px; border-radius: var(--r-sm); display: flex; align-items: center; justify-content: center; color: var(--grey-800); }
.cal-nav:active { background: var(--grey-100); }
.cal-nav svg { width: 18px; height: 18px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.cal-dow { font-size: 11px; color: var(--text-40); text-align: center; padding: 4px 0; }
.cal-d {
  aspect-ratio: 1; display: flex; align-items: center; justify-content: center;
  border-radius: var(--r-sm); font-size: 14px; color: var(--text-80);
}
.cal-d:active { background: var(--brand-50); }
.cal-d.mute { color: var(--text-30); }
.cal-d.today { box-shadow: inset 0 0 0 1px var(--brand-200); font-weight: 700; }
.cal-d.sel { background: var(--brand-500); color: var(--white); font-weight: 700; }
.cal-d[disabled] { color: var(--grey-400); pointer-events: none; }
.cal-mg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.cal-mg button { padding: 11px 0; border-radius: var(--r-sm); font-size: 14px; color: var(--text-80); }
.cal-mg button:active { background: var(--brand-50); }
.cal-mg button.sel { background: var(--brand-500); color: var(--white); font-weight: 700; }

/* ── 圖表 ─────────────────────────────────── */

.chart { width: 100%; display: block; touch-action: pan-y; }
.chart-legend { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 8px; }
.chart-legend span { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--text-60); }
.chart-legend i { width: 14px; height: 3px; border-radius: 2px; display: block; }
.chart-legend i.dot { width: 7px; height: 7px; border-radius: 50%; }

/* 計時器 */
.timer-live {
  display: flex; align-items: center; gap: 12px;
  background: linear-gradient(135deg, #0B333A, #123F48);
  border-radius: var(--r-card); padding: 14px 16px;
  color: var(--white); box-shadow: 0 10px 30px -8px rgba(0,40,45,.45);
  margin-bottom: 12px;
}
.timer-live .t { font-size: 27px; font-weight: 700; font-family: var(--font-mono); letter-spacing: -.5px; line-height: 1.15; }
.timer-live .l { font-size: 12px; opacity: .75; display: flex; align-items: center; gap: 4px; }
.timer-live .l svg { width: 13px; height: 13px; }
.timer-live .grow { flex: 1; min-width: 0; }
.timer-btn {
  height: 36px; padding: 0 16px; border-radius: var(--r-pill);
  background: rgba(255,255,255,.16); color: var(--white);
  font-size: 14px; font-weight: 700;
  display: inline-flex; align-items: center; gap: 5px; flex: 0 0 auto;
}
.timer-btn svg { width: 16px; height: 16px; }
.timer-btn.stop { background: var(--white); color: var(--brand-800); }

.dim { color: var(--text-40); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
