/* 私人財富指揮中心 — 私人銀行等級深色主題（原創視覺） */
:root {
  --bg: #06080d;
  --bg2: #0a0d14;
  --panel: rgba(20, 24, 35, 0.62);
  --panel-hi: rgba(28, 33, 47, 0.75);
  --line: rgba(255, 255, 255, 0.065);
  --line2: rgba(217, 184, 124, 0.24);
  --ink: #ece6da;
  --ink2: #b7b0a2;
  --muted: #7e8494;
  --faint: #3a4050;
  --gold: #d9b87c;
  --gold2: #b8925a;
  --gold3: #f4e2bc;
  --up: #f0606a;      /* 台股：漲紅 */
  --down: #35c28e;    /* 台股：跌綠 */
  --base: #8f9aae;
  --blue: #8fb3e0;
  --radius: 20px;
  --radius-sm: 12px;
  --shadow: 0 30px 80px -40px rgba(0, 0, 0, 0.9), 0 1px 0 rgba(255, 255, 255, 0.03) inset;
  --serif: "Playfair Display", "Noto Serif TC", Georgia, serif;
  --sans: "Inter", "Noto Sans TC", system-ui, -apple-system, "Segoe UI", sans-serif;
  --tc-serif: "Noto Serif TC", "Playfair Display", serif;
  --ease: cubic-bezier(0.22, 0.8, 0.24, 1);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--bg); }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.6;
  letter-spacing: 0.01em;
  overflow-x: hidden;
  overflow-x: clip;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: 0.02em; }
p { margin: 0; overflow-wrap: anywhere; }
button, input { font: inherit; color: inherit; }
code { font-family: ui-monospace, "SFMono-Regular", Consolas, monospace; font-size: 0.86em; color: var(--gold3); background: rgba(217, 184, 124, 0.08); padding: 1px 6px; border-radius: 6px; word-break: break-all; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; line-height: 1.55; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; border-radius: 8px; }

/* ---------- 背景光暈 ---------- */
.aura {
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(900px 600px at 8% -10%, rgba(217, 184, 124, 0.13), transparent 60%),
    radial-gradient(700px 520px at 100% 0%, rgba(110, 140, 200, 0.10), transparent 60%),
    radial-gradient(900px 700px at 60% 120%, rgba(53, 194, 142, 0.05), transparent 60%),
    linear-gradient(180deg, #070910 0%, #06080d 100%);
}
.aura::after {
  content: ""; position: absolute; inset: 0; opacity: 0.35;
  background-image: linear-gradient(rgba(255, 255, 255, 0.018) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, 0.018) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(ellipse at 50% 0%, #000 20%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse at 50% 0%, #000 20%, transparent 75%);
}

/* ---------- 共用元件 ---------- */
.panel {
  position: relative;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.012)), var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px) saturate(120%);
  -webkit-backdrop-filter: blur(16px) saturate(120%);
  padding: 22px;
  min-width: 0;
}
.panel::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: linear-gradient(135deg, rgba(244, 226, 188, 0.07), transparent 38%);
}
.p-title { font-size: 15px; color: var(--ink); margin-bottom: 12px; display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.p-title small, .sec-title small { color: var(--muted); font-weight: 400; font-size: 12px; letter-spacing: 0.02em; }
.sec-title { font-size: 16px; margin: 0 0 12px; display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.tag {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px;
  font-size: 11.5px; letter-spacing: 0.06em; color: var(--gold3);
  border: 1px solid var(--line2); background: rgba(217, 184, 124, 0.07); white-space: nowrap;
}
.chips { display: flex; flex-wrap: wrap; gap: 6px; min-width: 0; }
.chip {
  display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px; font-size: 11.5px;
  border: 1px solid var(--line); color: var(--ink2); background: rgba(255, 255, 255, 0.03); white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.chip i { font-style: normal; font-size: 10px; }
.chip.ok { color: var(--gold3); border-color: var(--line2); background: rgba(217, 184, 124, 0.09); }
.chip.no { color: #c9a7ad; border-color: rgba(240, 96, 106, 0.22); background: rgba(240, 96, 106, 0.06); }
.chip.wait { color: var(--muted); }
.chip.hot { color: var(--gold3); border-color: rgba(217, 184, 124, 0.4); background: rgba(217, 184, 124, 0.14); }
.chip.calm { color: var(--ink2); }
.chip.ev i { width: 7px; height: 7px; border-radius: 50%; background: var(--c); display: inline-block; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 8px 16px;
  border-radius: 12px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.04); color: var(--ink);
  cursor: pointer; font-weight: 500; font-size: 14px; transition: transform 0.2s var(--ease), background 0.2s, border-color 0.2s, box-shadow 0.2s;
}
.btn:hover { border-color: var(--line2); background: rgba(255, 255, 255, 0.07); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn.gold {
  color: #1a1408; border-color: transparent;
  background: linear-gradient(135deg, #f4e2bc 0%, #d9b87c 45%, #b8925a 100%);
  box-shadow: 0 10px 30px -12px rgba(217, 184, 124, 0.55), 0 1px 0 rgba(255, 255, 255, 0.5) inset;
}
.btn.gold:hover { box-shadow: 0 14px 36px -12px rgba(217, 184, 124, 0.75), 0 1px 0 rgba(255, 255, 255, 0.5) inset; }
.btn.ghost { background: transparent; }
.btn.danger { border-color: rgba(240, 96, 106, 0.35); color: #f3b3b8; background: rgba(240, 96, 106, 0.06); }
.btn.wide { width: 100%; }
.btn.sm { min-height: 32px; padding: 4px 12px; font-size: 13px; }
.btn.is-busy span::after { content: ""; display: inline-block; width: 12px; height: 12px; margin-left: 8px; border: 2px solid rgba(26, 20, 8, 0.35); border-top-color: #1a1408; border-radius: 50%; animation: spin 0.8s linear infinite; vertical-align: -2px; }
.link { background: none; border: 0; padding: 0; color: var(--gold); cursor: pointer; font-size: 13px; text-decoration: underline; text-underline-offset: 3px; }
.icon-btn { background: none; border: 0; color: var(--muted); cursor: pointer; padding: 6px; display: inline-flex; border-radius: 8px; }
.icon-btn svg { width: 20px; height: 20px; }
.icon-btn[aria-pressed="true"] { color: var(--gold); }
.glyph { display: inline-flex; width: 38px; height: 38px; flex: 0 0 auto; align-items: center; justify-content: center; border-radius: 12px; color: var(--gold); background: radial-gradient(circle at 30% 20%, rgba(244, 226, 188, 0.16), rgba(217, 184, 124, 0.04)); border: 1px solid var(--line2); }
.glyph svg { width: 20px; height: 20px; }
.glyph.big { width: 64px; height: 64px; border-radius: 18px; }
.glyph.big svg { width: 34px; height: 34px; }

.banner { border-radius: 14px; padding: 12px 14px; font-size: 13px; line-height: 1.6; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.03); border-left: 3px solid var(--gold); }
.banner b { margin-right: 8px; color: var(--gold3); }
.banner.lev { border-left-color: #f0a27a; background: rgba(240, 162, 122, 0.06); }
.banner.us { border-left-color: var(--blue); background: rgba(143, 179, 224, 0.05); }
.banner.sell { border-left-color: var(--up); background: rgba(240, 96, 106, 0.06); color: #f1c9cc; margin-top: 12px; }
.banner.info { border-left-color: var(--gold); margin-top: 10px; }
.banner.mock { margin: 12px auto 0; max-width: 1440px; border-left-color: var(--up); background: rgba(240, 96, 106, 0.12); color: #ffd6d9; font-weight: 600; }
.warn-text { color: #f1c9cc; }

.err { border-radius: 14px; border: 1px solid rgba(240, 96, 106, 0.28); border-left: 3px solid var(--up); background: rgba(240, 96, 106, 0.06); padding: 14px 16px; font-size: 13.5px; }
.err-title { font-weight: 600; color: #ffd6d9; }
.err-hint { margin-top: 6px; color: var(--ink); }
.err-steps { margin-top: 8px; color: var(--gold3); font-weight: 600; }
.err-details { margin: 4px 0 0; padding-left: 20px; color: var(--ink2); }
.err-details li { margin: 3px 0; overflow-wrap: anywhere; }
.err-details b { color: var(--gold3); }
.err-foot { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 12px; color: var(--muted); font-size: 12px; align-items: center; }

@keyframes spin { to { transform: rotate(360deg); } }
/* 進場動畫只動位置、不動透明度：就算動畫被暫停（背景分頁、截圖工具），內容也一定看得到 */
@keyframes rise { from { transform: translateY(6px); } to { transform: none; } }

/* ---------- 開機畫面 ---------- */
.splash { position: fixed; inset: 0; display: flex; flex-direction: column; gap: 14px; align-items: center; justify-content: center; color: var(--muted); letter-spacing: 0.2em; font-size: 13px; }
.splash .crest { width: 54px; height: 54px; color: var(--gold); animation: breathe 1.8s ease-in-out infinite; }
@keyframes breathe { 50% { opacity: 0.45; transform: scale(0.96); } }

/* ---------- 金鑰頁 ---------- */
.gate { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 40px 16px 24px; gap: 28px; }
.gate-card {
  width: 100%; max-width: 540px; text-align: center; padding: 44px 40px 32px; border-radius: 28px; position: relative;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.015)), rgba(14, 17, 26, 0.8);
  border: 1px solid var(--line2);
  box-shadow: 0 50px 120px -50px rgba(0, 0, 0, 1), 0 0 0 1px rgba(255, 255, 255, 0.02) inset, 0 0 80px -40px rgba(217, 184, 124, 0.45);
  animation: rise 0.7s var(--ease) both;
}
.crest { display: inline-flex; width: 64px; height: 64px; color: var(--gold); filter: drop-shadow(0 6px 18px rgba(217, 184, 124, 0.35)); }
.crest svg { width: 100%; height: 100%; }
.crest.sm { width: 30px; height: 30px; filter: none; }
.eyebrow { margin-top: 18px; font-size: 11px; letter-spacing: 0.42em; color: var(--gold); }
.gate h1 { font-family: var(--tc-serif); font-size: clamp(28px, 7vw, 38px); margin-top: 8px; font-weight: 700; letter-spacing: 0.08em; background: linear-gradient(180deg, #fbf1dc, #d9b87c); -webkit-background-clip: text; background-clip: text; color: transparent; }
.gate-sub { color: var(--ink2); margin-top: 10px; font-size: 14.5px; }
.gate-form { margin-top: 28px; text-align: left; display: grid; gap: 12px; }
.gate-label { font-size: 12.5px; color: var(--muted); letter-spacing: 0.08em; }
.key-field { display: flex; align-items: center; gap: 8px; padding: 6px 8px 6px 14px; border-radius: 14px; border: 1px solid var(--line); background: rgba(0, 0, 0, 0.35); min-width: 0; transition: border-color 0.2s, box-shadow 0.2s; }
.key-field:focus-within { border-color: var(--line2); box-shadow: 0 0 0 4px rgba(217, 184, 124, 0.08); }
.key-ico { color: var(--gold); display: inline-flex; }
.key-ico svg { width: 18px; height: 18px; }
.key-field input { flex: 1 1 auto; min-width: 0; border: 0; background: transparent; outline: none; padding: 10px 0; font-family: ui-monospace, Consolas, monospace; font-size: 14px; letter-spacing: 0.03em; }
.key-field input::placeholder { color: var(--faint); }
.gate-help { font-size: 12.5px; color: var(--muted); }
.gate-help strong { color: var(--ink2); font-weight: 600; }
.gate-msg:empty { display: none; }
.gate-points { list-style: none; margin: 26px 0 0; padding: 18px 0 0; border-top: 1px solid var(--line); display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; text-align: left; }
.gate-points li { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.gate-points b { color: var(--gold3); font-size: 13px; font-weight: 600; }
.gate-points span { color: var(--muted); font-size: 12px; line-height: 1.5; }
.gate-api { margin-top: 18px; font-size: 11.5px; color: var(--faint); overflow-wrap: anywhere; }
.gate-legal { max-width: 640px; text-align: center; font-size: 12px; color: var(--ink2); display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 10px; line-height: 1.7; }

/* ---------- 頂列 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 12px 20px; flex-wrap: wrap;
  padding: 12px max(16px, calc((100vw - 1440px) / 2 + 24px));
  background: linear-gradient(180deg, rgba(6, 8, 13, 0.92), rgba(6, 8, 13, 0.72));
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.brand-text b { font-family: var(--tc-serif); font-size: 17px; letter-spacing: 0.08em; color: var(--gold3); white-space: nowrap; }
.brand-text small { font-size: 10px; letter-spacing: 0.3em; color: var(--muted); text-transform: uppercase; white-space: nowrap; }
.tabs { display: flex; gap: 4px; padding: 4px; border-radius: 14px; background: rgba(255, 255, 255, 0.03); border: 1px solid var(--line); }
.tabs button { border: 0; background: transparent; padding: 7px 16px; border-radius: 10px; cursor: pointer; color: var(--ink2); font-size: 14px; white-space: nowrap; }
.tabs button[aria-selected="true"] { background: rgba(217, 184, 124, 0.14); color: var(--gold3); box-shadow: 0 0 0 1px var(--line2) inset; }
.top-meta { margin-left: auto; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; min-width: 0; }
.asof { font-size: 12.5px; color: var(--ink2); white-space: nowrap; }
.env { font-size: 11px; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.env.local { color: #9fd9c2; border-color: rgba(53, 194, 142, 0.35); }
.env.prod { color: var(--gold3); border-color: var(--line2); }
.key-btn { border: 1px solid var(--line); background: rgba(255, 255, 255, 0.03); border-radius: 999px; padding: 4px 12px; font-size: 12.5px; color: var(--ink2); cursor: pointer; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.key-btn:hover { border-color: var(--line2); color: var(--gold3); }
.progress { position: sticky; top: 0; height: 2px; z-index: 31; overflow: hidden; pointer-events: none; }
.progress i { position: absolute; inset: 0; background: linear-gradient(90deg, transparent, var(--gold), var(--gold3), transparent); transform: translateX(-100%); opacity: 0; }
.is-busy .progress i { opacity: 1; animation: sweep 1.1s var(--ease) infinite; }
@keyframes sweep { to { transform: translateX(100%); } }

/* ---------- 版面 ---------- */
.view { padding: 22px max(16px, calc((100vw - 1440px) / 2 + 24px)) 12px; }
.layout { display: grid; grid-template-columns: 372px minmax(0, 1fr); gap: 24px; align-items: start; }
.side { display: grid; gap: 18px; position: sticky; top: 78px; max-height: calc(100vh - 92px); overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: var(--faint) transparent; padding-right: 2px; }
.main { display: grid; gap: 20px; min-width: 0; }

/* ---------- 屬性卡 ---------- */
.cards-panel { padding: 20px; }
.panel-head h2 { font-size: 15px; letter-spacing: 0.12em; color: var(--gold3); }
.gate-rule { font-size: 12px; color: var(--ink2); margin-top: 6px; line-height: 1.6; }
.gate-rule b { color: var(--gold3); }
.gate-status { margin-top: 6px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.cards { display: grid; gap: 10px; margin-top: 14px; }
.card {
  position: relative; text-align: left; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px 12px; align-items: center;
  padding: 14px; border-radius: 16px; cursor: pointer; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.02);
  transition: transform 0.25s var(--ease), border-color 0.25s, background 0.25s, box-shadow 0.25s; animation: rise 0.5s var(--ease) both;
  min-width: 0;
}
.card:hover { transform: translateY(-2px); border-color: rgba(217, 184, 124, 0.18); background: rgba(255, 255, 255, 0.035); }
.card.active { border-color: rgba(217, 184, 124, 0.55); background: linear-gradient(135deg, rgba(217, 184, 124, 0.12), rgba(217, 184, 124, 0.02) 60%); box-shadow: 0 18px 40px -24px rgba(217, 184, 124, 0.55), 0 0 0 1px rgba(217, 184, 124, 0.18) inset; }
.card .glyph { grid-row: span 2; }
.card-name { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; min-width: 0; }
.card-name b { font-size: 16px; font-family: var(--tc-serif); letter-spacing: 0.06em; }
.card-name small { font-size: 10.5px; color: var(--muted); letter-spacing: 0.14em; text-transform: uppercase; }
.card-tag { font-size: 12.5px; color: var(--ink2); line-height: 1.55; min-width: 0; }
.card-foot { grid-column: 1 / -1; display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 6px; min-width: 0; }
.status-dot { position: absolute; top: 12px; right: 12px; width: 7px; height: 7px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 10px var(--gold); }
.status-dot.wait { background: var(--muted); box-shadow: none; animation: breathe 1.4s infinite; }
.card.levered .card-name b::after { content: "槓桿"; font-family: var(--sans); font-size: 10px; letter-spacing: 0.1em; margin-left: 6px; padding: 1px 6px; border-radius: 6px; color: #f0c2a6; border: 1px solid rgba(240, 162, 122, 0.35); vertical-align: 2px; }
.risk { display: inline-flex; align-items: center; gap: 3px; font-size: 11px; color: var(--muted); }
.risk i { width: 6px; height: 6px; border-radius: 50%; background: var(--faint); display: inline-block; }
.risk i.on { background: var(--gold); }
.risk i:first-of-type { margin-left: 4px; }
.unlisted { margin-top: 14px; border-top: 1px dashed var(--line); padding-top: 12px; }
.unlisted summary { cursor: pointer; color: var(--muted); font-size: 13px; list-style: none; display: flex; align-items: center; gap: 8px; }
.unlisted summary::before { content: "▸"; color: var(--gold2); transition: transform 0.2s; }
.unlisted[open] summary::before { transform: rotate(90deg); }
.unl-item { margin-top: 12px; padding: 12px; border-radius: 14px; background: rgba(0, 0, 0, 0.2); border: 1px solid var(--line); opacity: 0.85; }
.unl-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; min-width: 0; }
.unl-head .glyph { width: 30px; height: 30px; border-radius: 9px; filter: grayscale(0.7); }
.unl-head .glyph svg { width: 16px; height: 16px; }
.unl-head .muted { font-size: 12px; flex: 1 1 160px; min-width: 0; }
.unl-item .chips { margin-top: 8px; }
.unl-why { margin-top: 8px; font-size: 12.5px; color: var(--ink2); }

/* ---------- 控制台 ---------- */
.controls { padding: 20px; }
.sheet-handle { display: none; }
.ctl-head { display: flex; align-items: center; gap: 12px; min-width: 0; }
.ctl-head h2 { font-family: var(--tc-serif); font-size: 20px; letter-spacing: 0.08em; }
.ctl-head small { color: var(--muted); font-size: 10.5px; letter-spacing: 0.2em; text-transform: uppercase; }
.ctl-head > div { min-width: 0; flex: 1 1 auto; }
.applied { font-size: 11px; color: var(--gold3); border: 1px solid var(--line2); border-radius: 999px; padding: 2px 8px; white-space: nowrap; }
.applied::before { content: "✓ "; }
.ctl-row { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: center; justify-content: space-between; margin-top: 16px; }
.seg { display: inline-flex; padding: 3px; border-radius: 12px; background: rgba(0, 0, 0, 0.3); border: 1px solid var(--line); flex-wrap: wrap; max-width: 100%; }
.seg button { border: 0; background: transparent; padding: 6px 12px; border-radius: 9px; cursor: pointer; color: var(--ink2); font-size: 13px; white-space: nowrap; }
.seg button[aria-pressed="true"] { background: linear-gradient(135deg, rgba(244, 226, 188, 0.22), rgba(217, 184, 124, 0.12)); color: var(--gold3); box-shadow: 0 0 0 1px var(--line2) inset; }
.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13px; color: var(--ink2); user-select: none; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch i { width: 36px; height: 20px; border-radius: 999px; background: rgba(255, 255, 255, 0.08); border: 1px solid var(--line); position: relative; transition: background 0.2s; flex: 0 0 auto; }
.switch i::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: var(--ink2); transition: transform 0.25s var(--ease), background 0.2s; }
.switch input:checked + i { background: rgba(217, 184, 124, 0.3); border-color: var(--line2); }
.switch input:checked + i::after { transform: translateX(16px); background: var(--gold3); }
.switch input:focus-visible + i { outline: 2px solid var(--gold); outline-offset: 2px; }
.sliders { display: grid; gap: 16px; margin-top: 18px; }
.slider { display: grid; gap: 6px; min-width: 0; }
.sl-top { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.sl-top label { font-size: 13px; color: var(--ink2); }
.sl-val { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--gold3); font-size: 14px; }
.sl-ticks { display: flex; justify-content: space-between; font-size: 10.5px; color: var(--faint); gap: 8px; }
.sl-note { font-size: 12px; color: var(--muted); }
input[type="range"] { -webkit-appearance: none; appearance: none; width: 100%; height: 26px; background: transparent; cursor: pointer; --fill: 50%; margin: 0; }
input[type="range"]::-webkit-slider-runnable-track { height: 4px; border-radius: 4px; background: linear-gradient(90deg, var(--gold2), var(--gold3) var(--fill), rgba(255, 255, 255, 0.1) var(--fill)); }
input[type="range"]::-moz-range-track { height: 4px; border-radius: 4px; background: rgba(255, 255, 255, 0.1); }
input[type="range"]::-moz-range-progress { height: 4px; border-radius: 4px; background: linear-gradient(90deg, var(--gold2), var(--gold3)); }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 20px; height: 20px; margin-top: -8px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff6e2, var(--gold) 55%, var(--gold2)); border: 2px solid #1a1408; box-shadow: 0 0 0 4px rgba(217, 184, 124, 0.16), 0 6px 14px rgba(0, 0, 0, 0.6); transition: box-shadow 0.2s; }
input[type="range"]::-moz-range-thumb { width: 18px; height: 18px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff6e2, var(--gold) 55%, var(--gold2)); border: 2px solid #1a1408; box-shadow: 0 0 0 4px rgba(217, 184, 124, 0.16); }
input[type="range"]:active::-webkit-slider-thumb { box-shadow: 0 0 0 7px rgba(217, 184, 124, 0.22), 0 6px 14px rgba(0, 0, 0, 0.6); }
.live-check { margin-top: 18px; padding: 12px; border-radius: 14px; background: rgba(0, 0, 0, 0.22); border: 1px solid var(--line); display: grid; gap: 8px; }
.lc-title { font-size: 12px; color: var(--muted); letter-spacing: 0.06em; }
.lc-verdict { font-size: 12.5px; }
.lc-verdict.ok { color: var(--gold3); }
.lc-verdict.no { color: #f1c9cc; }
.ctl-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 16px; }
.latency { font-variant-numeric: tabular-nums; }

/* ---------- 第一屏 ---------- */
.hero { padding: 24px 24px 18px; }
.hero::after { content: ""; position: absolute; top: -1px; left: 24px; right: 24px; height: 1px; background: linear-gradient(90deg, transparent, rgba(244, 226, 188, 0.6), transparent); }
.hero-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.win { font-size: 12.5px; color: var(--ink2); font-variant-numeric: tabular-nums; }
.kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-top: 16px; }
.kpi { position: relative; padding: 16px 18px; border-radius: 16px; background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.01)); border: 1px solid var(--line); overflow: hidden; min-width: 0; }
.kpi::after { content: ""; position: absolute; inset: 0; background: linear-gradient(105deg, transparent 35%, rgba(244, 226, 188, 0.14) 50%, transparent 65%); transform: translateX(-120%); pointer-events: none; }
.kpi.flash::after { animation: sheen 1.1s var(--ease) 1; }
@keyframes sheen { to { transform: translateX(120%); } }
.kpi-label { font-size: 12px; color: var(--muted); letter-spacing: 0.1em; }
.kpi-value { display: flex; align-items: baseline; gap: 6px; margin-top: 6px; min-width: 0; flex-wrap: wrap; }
.kpi-value .v { font-family: var(--serif); font-size: clamp(30px, 3.4vw, 46px); line-height: 1.05; font-weight: 600; font-variant-numeric: lining-nums tabular-nums; letter-spacing: 0; color: var(--ink); overflow-wrap: anywhere; }
#kpi-final .kpi-value .v { background: linear-gradient(180deg, #fbf1dc 10%, #d9b87c 95%); -webkit-background-clip: text; background-clip: text; color: transparent; }
.kpi-value .cur, .kpi-value .unit { font-size: 13px; color: var(--muted); }
#kpi-gap[data-tone="up"] .v { color: var(--up); }
#kpi-gap[data-tone="down"] .v { color: var(--down); }
#kpi-dd .v { color: var(--down); }
.kpi-sub { margin-top: 6px; font-size: 12.5px; color: var(--ink2); font-variant-numeric: tabular-nums; }
.kpi-cmp { margin-top: 4px; font-size: 12px; color: var(--muted); }
.kpi-cmp.better { color: var(--gold3); }
.kpi-cmp.better::before { content: "◆ "; font-size: 9px; vertical-align: 1px; }
.kpi-cmp.worse { color: #c9b3b6; }
.kpi-cmp.worse::before { content: "◇ "; font-size: 9px; vertical-align: 1px; }
.is-busy .kpi-value .v { opacity: 0.78; transition: opacity 0.2s; }
.zero-note { margin-top: 12px; font-size: 13px; color: var(--gold3); background: rgba(217, 184, 124, 0.07); border: 1px solid var(--line2); border-radius: 12px; padding: 10px 12px; }
.chart { width: 100%; min-width: 0; }
.nav-chart { height: 400px; margin-top: 14px; }
.chart-note { margin-top: 6px; }
.risk-banners { display: grid; gap: 10px; }
.risk-banners:empty { display: none; }

/* ---------- 洞察 ---------- */
.insights { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.insight { padding: 18px; opacity: 1; animation: rise 0.6s var(--ease); animation-delay: var(--d); animation-fill-mode: backwards; }
.insight::after { content: ""; position: absolute; left: 0; top: 18px; bottom: 18px; width: 2px; border-radius: 2px; background: var(--faint); }
.insight.tone-good::after { background: linear-gradient(180deg, var(--gold3), var(--gold2)); }
.insight.tone-bad::after { background: #6c7488; }
.ins-title { font-size: 12.5px; color: var(--muted); letter-spacing: 0.08em; }
.ins-big { font-family: var(--serif); font-size: 28px; margin-top: 4px; font-weight: 600; color: var(--ink); font-variant-numeric: lining-nums tabular-nums; }
.tone-good .ins-big { color: var(--gold3); }
.ins-text { margin-top: 8px; font-size: 13px; color: var(--ink2); line-height: 1.7; }
.ins-foot { margin-top: 8px; font-size: 11.5px; color: var(--muted); }

/* ---------- 第二屏 ---------- */
.second { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 16px; align-items: stretch; }
.risk-panel { grid-column: 1 / -1; order: 3; }
.risk-grid { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.rg-a { display: grid; gap: 10px; min-width: 0; }
.rg-b, .rg-c { min-width: 0; }
.donut { height: 250px; }
.radar { height: 260px; }
.legend-list { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 6px; }
.legend-list li { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; gap: 8px; align-items: center; font-size: 12.5px; color: var(--ink2); }
.legend-list i { width: 9px; height: 9px; border-radius: 3px; display: inline-block; }
.legend-list .lg-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.legend-list .lg-val { color: var(--muted); font-variant-numeric: tabular-nums; }
.legend-list .lg-plain { grid-column: 2 / -1; font-size: 11.5px; color: var(--muted); line-height: 1.55; margin-top: -2px; }
.legend-list .lg-cat { color: var(--gold2); margin-right: 6px; }
.legend-list b { font-variant-numeric: tabular-nums; color: var(--ink); font-weight: 600; }
.legend-list.inline { display: flex; flex-wrap: wrap; gap: 6px 16px; }
.legend-list.inline li { display: flex; gap: 6px; }
.tbl-wrap { overflow-x: auto; max-width: 100%; }
.mini-table, .gate-table, .rb-table { width: 100%; border-collapse: collapse; font-size: 12.5px; font-variant-numeric: tabular-nums; }
.mini-table th, .mini-table td, .gate-table th, .gate-table td, .rb-table th, .rb-table td { padding: 6px 8px; border-bottom: 1px solid var(--line); text-align: right; }
.mini-table th:first-child, .mini-table td:first-child, .gate-table th:first-child, .gate-table td:first-child, .rb-table th:first-child, .rb-table td:first-child { text-align: left; }
.mini-table th, .gate-table th, .rb-table th { color: var(--muted); font-weight: 500; font-size: 11.5px; }
.mini-table td:nth-child(2) { color: var(--gold3); }
.t-up { color: var(--up); }
.t-down { color: var(--down); }
.pass { color: var(--gold3); }
.fail { color: #c9a7ad; }
.timeline-panel { display: flex; flex-direction: column; }
.ev-summary { margin-bottom: 12px; }
.timeline { display: flex; flex-wrap: wrap; gap: 8px; align-content: flex-start; max-height: 340px; overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--faint) transparent; }
.capsule { display: inline-flex; align-items: center; gap: 8px; padding: 5px 12px 5px 8px; border-radius: 999px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.025); cursor: pointer; font-size: 12.5px; color: var(--ink2); max-width: 100%; text-align: left; flex-wrap: wrap; transition: border-color 0.2s, background 0.2s; }
.capsule::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--c); box-shadow: 0 0 10px var(--c); flex: 0 0 auto; }
.capsule:hover { border-color: var(--line2); }
.cap-m { font-variant-numeric: tabular-nums; color: var(--muted); }
.cap-t { color: var(--ink); font-weight: 600; }
.cap-l { color: var(--ink2); }
.cap-d { display: none; width: 100%; font-size: 12px; color: var(--ink2); line-height: 1.6; }
.capsule.open { border-radius: 14px; background: rgba(255, 255, 255, 0.05); border-color: var(--line2); }
.capsule.open .cap-d { display: block; }

/* ---------- 卡片規則 ---------- */
.card-detail { display: grid; gap: 14px; }
.cd-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.cd-head h3 { font-family: var(--tc-serif); font-size: 18px; letter-spacing: 0.06em; flex: 1 1 auto; }
.cd-rule { font-size: 14px; color: var(--ink); }
.cd-lose { padding: 14px 16px; border-radius: 14px; background: rgba(0, 0, 0, 0.22); border: 1px solid var(--line); }
.cd-lose h4 { font-size: 13px; color: var(--gold3); margin-bottom: 6px; letter-spacing: 0.06em; }
.cd-lose p { font-size: 13.5px; color: var(--ink2); line-height: 1.75; }
.cd-tune { font-size: 12.5px; color: var(--ink2); border-left: 2px solid var(--gold2); padding-left: 10px; }

/* ---------- 進階 ---------- */
.advanced { border-radius: var(--radius); border: 1px solid var(--line); background: rgba(255, 255, 255, 0.015); }
.advanced > summary { cursor: pointer; list-style: none; padding: 18px 22px; display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 14px; border-radius: var(--radius); }
.advanced > summary::-webkit-details-marker { display: none; }
.advanced > summary span { font-size: 16px; font-weight: 600; color: var(--gold3); letter-spacing: 0.08em; }
.advanced > summary span::before { content: "＋"; margin-right: 10px; color: var(--gold); display: inline-block; transition: transform 0.25s var(--ease); }
.advanced[open] > summary span::before { content: "－"; }
.advanced > summary small { color: var(--muted); font-size: 12px; }
.adv-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; padding: 0 16px 16px; align-items: start;
  grid-template-areas: "sig band" "sig score" "heat heat" "stress stress" "goal rebal"; }
.adv-grid .wide { grid-column: 1 / -1; }
#adv-signal { grid-area: sig; } #adv-band { grid-area: band; } #adv-score { grid-area: score; } #adv-heat { grid-area: heat; } #adv-stress { grid-area: stress; } #adv-goal { grid-area: goal; } #adv-rebal { grid-area: rebal; }
.signal { padding: 12px; border-radius: 14px; background: rgba(0, 0, 0, 0.22); border: 1px solid var(--line); margin-bottom: 10px; }
.sig-top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.sig-m { font-family: var(--serif); font-size: 20px; color: var(--gold3); font-variant-numeric: lining-nums; }
.sig-act { margin-top: 8px; font-size: 13px; color: var(--ink); line-height: 1.7; }
.band { display: flex; gap: 1px; height: 30px; border-radius: 8px; overflow: hidden; }
.band-cell { flex: 1 1 0; min-width: 0; opacity: 0.92; transition: opacity 0.2s; }
.band-cell:hover { opacity: 1; filter: brightness(1.25); }
#band-legend { margin-top: 12px; }
.gauge { height: 210px; }
.hits { list-style: none; padding: 0; margin: 8px 0; display: grid; gap: 6px; }
.hits li { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; font-size: 13px; }
.pts { font-variant-numeric: tabular-nums; font-weight: 700; min-width: 30px; }
.pts.cold { color: var(--down); }
.pts.hot { color: var(--up); }
.heat { height: 400px; }
.stress-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.stress { height: 340px; }
.st-name { font-size: 13.5px; margin-top: 6px; }
.warn-mini { margin: 8px 0 0; padding-left: 18px; font-size: 12px; color: var(--muted); }
.goal-form { display: grid; gap: 10px; }
.goal-form label, .fld { display: grid; gap: 4px; font-size: 12.5px; color: var(--muted); }
.goal-form input, .fld input, .hold-row input {
  width: 100%; min-width: 0; padding: 9px 12px; border-radius: 10px; border: 1px solid var(--line); background: rgba(0, 0, 0, 0.3);
  color: var(--ink); font-variant-numeric: tabular-nums; outline: none; font-size: 14px;
}
.goal-form input:focus, .fld input:focus, .hold-row input:focus { border-color: var(--line2); }
.field-msg { color: #f1c9cc; font-size: 11.5px; min-height: 0; }
.goal-bar { margin-top: 16px; height: 8px; border-radius: 999px; background: rgba(255, 255, 255, 0.06); overflow: hidden; }
.goal-bar span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--gold2), var(--gold3)); box-shadow: 0 0 14px rgba(217, 184, 124, 0.6); transition: width 0.8s var(--ease); }
.goal-row { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin-top: 6px; }
.goal-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; margin: 12px 0; }
.goal-kpis > div { padding: 10px 12px; border-radius: 12px; background: rgba(0, 0, 0, 0.22); border: 1px solid var(--line); display: grid; gap: 2px; min-width: 0; }
.goal-kpis small { font-size: 11.5px; color: var(--muted); }
.goal-kpis b { font-size: 15px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
#adv-goal p { margin-top: 6px; }
.warnings ul { margin: 0; padding-left: 20px; display: grid; gap: 6px; font-size: 13px; color: var(--ink2); }
.annot { display: block; color: var(--gold); font-size: 12px; margin-top: 2px; }

/* ---------- 我的投組 ---------- */
.pf-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.pf-head h2 { font-family: var(--tc-serif); font-size: 24px; letter-spacing: 0.08em; color: var(--gold3); }
.pf-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 420px), 1fr)); gap: 16px; }
.pf-item { display: grid; gap: 10px; align-content: start; }
.pf-top { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; align-items: flex-start; }
.pf-top h3 { font-size: 17px; overflow-wrap: anywhere; min-width: 0; }
.pf-meta { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.pf-note { font-size: 13px; color: var(--ink2); white-space: pre-line; }
.pf-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.pf-out:empty { display: none; }
.empty { text-align: center; display: grid; gap: 12px; justify-items: center; padding: 40px 20px; color: var(--ink2); grid-column: 1 / -1; }

/* ---------- 頁尾（每個畫面都顯示免責聲明與資料來源） ---------- */
.legal { margin: 28px auto 0; padding: 22px max(16px, calc((100vw - 1440px) / 2 + 24px)) 40px; border-top: 1px solid var(--line); display: grid; gap: 8px; font-size: 12.5px; color: var(--ink2); }
.legal-badges { display: flex; gap: 8px; flex-wrap: wrap; }
.legal-disc { color: var(--ink); font-size: 13px; }
.legal-attr { margin: 0; padding-left: 18px; color: var(--muted); }

/* ---------- 提示、對話框 ---------- */
.toast {
  position: fixed; left: 50%; bottom: 24px; z-index: 60; transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  max-width: min(560px, calc(100vw - 32px)); padding: 12px 16px; border-radius: 14px; font-size: 13.5px; line-height: 1.6;
  background: rgba(16, 19, 28, 0.96); border: 1px solid var(--line2); box-shadow: 0 20px 50px -16px rgba(0, 0, 0, 0.9);
  transition: opacity 0.25s, transform 0.35s var(--ease);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.warn { border-color: rgba(240, 162, 122, 0.45); }
.toast.error { border-color: rgba(240, 96, 106, 0.5); }
.toast.ok { border-color: var(--line2); }
.dlg { width: min(520px, calc(100vw - 32px)); max-height: calc(100vh - 40px); overflow-y: auto; border-radius: 22px; border: 1px solid var(--line2); background: #0f121b; color: var(--ink); padding: 24px; box-shadow: 0 40px 100px -30px rgba(0, 0, 0, 1); }
.dlg.sm { width: min(420px, calc(100vw - 32px)); }
.dlg::backdrop { background: rgba(3, 4, 8, 0.66); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.dlg h3 { font-family: var(--tc-serif); font-size: 20px; color: var(--gold3); letter-spacing: 0.06em; }
.dlg form { display: grid; gap: 14px; }
.dlg fieldset { border: 1px solid var(--line); border-radius: 14px; padding: 12px; margin: 0; }
.dlg legend { padding: 0 6px; font-size: 12.5px; color: var(--muted); }
.holdings { display: grid; gap: 8px; }
.hold-row { display: grid; grid-template-columns: 92px minmax(0, 1fr); gap: 10px; align-items: center; font-size: 13px; color: var(--ink2); margin-top: 8px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; color: var(--ink2); }
.dlg-actions { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; margin-top: 6px; }
#confirm-text { font-size: 14.5px; line-height: 1.7; }
.spin { width: 14px; height: 14px; border-radius: 50%; border: 2px solid rgba(217, 184, 124, 0.25); border-top-color: var(--gold); animation: spin 0.8s linear infinite; display: inline-block; flex: 0 0 auto; }

/* ---------- 響應式 ---------- */
@media (max-width: 1360px) {
  .risk-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .rg-c { grid-column: 1 / -1; }
}
@media (max-width: 1120px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .side { position: static; max-height: none; overflow: visible; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; }
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .side { grid-template-columns: minmax(0, 1fr); }
  .kpis { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .insights { grid-template-columns: minmax(0, 1fr); }
  .adv-grid { grid-template-columns: minmax(0, 1fr); padding: 0 10px 10px; grid-template-areas: "sig" "band" "score" "heat" "stress" "goal" "rebal"; }
}
@media (max-width: 760px) {
  body { font-size: 14.5px; }
  .view { padding: 14px 16px 8px; }
  body:not(.on-portfolios):not(.is-gate) { padding-bottom: 84px; }
  .topbar { padding: 10px 16px; gap: 8px 10px; }
  .brand-text small { display: none; }
  .tabs { order: 3; width: 100%; }
  .tabs button { flex: 1 1 0; padding: 7px 8px; }
  .top-meta { gap: 6px; }
  .asof { font-size: 11.5px; }
  .key-btn { max-width: 120px; padding: 3px 10px; font-size: 11.5px; }
  .panel { padding: 16px; border-radius: 18px; }
  .cards-panel { padding: 14px; }
  .gate-rule { display: none; }
  .cards { grid-template-columns: repeat(auto-fit, minmax(70px, 1fr)); gap: 8px; margin-top: 10px; }
  .card { grid-template-columns: minmax(0, 1fr); padding: 10px 4px; justify-items: center; text-align: center; gap: 4px; }
  .card .glyph { grid-row: auto; width: 30px; height: 30px; border-radius: 9px; }
  .card .glyph svg { width: 16px; height: 16px; }
  .card-name { justify-content: center; }
  .card-name b { font-size: 13px; letter-spacing: 0; white-space: nowrap; }
  .card-name small, .card-tag, .card-foot { display: none; }
  .card.levered .card-name b::after { display: none; }
  .status-dot { top: 8px; right: 8px; }
  .controls {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 45; padding: 0; border-radius: 22px 22px 0 0;
    background: rgba(13, 16, 24, 0.97); border: 1px solid var(--line2); border-bottom: 0;
    transform: translateY(calc(100% - 64px)); transition: transform 0.4s var(--ease);
    max-height: 82vh; display: flex; flex-direction: column; box-shadow: 0 -24px 60px -20px rgba(0, 0, 0, 0.9);
  }
  .on-portfolios .controls { display: none; }
  .controls.open { transform: translateY(0); }
  .controls:not(.open) .controls-body { visibility: hidden; }
  .sheet-handle { display: grid; gap: 6px; width: 100%; border: 0; background: transparent; padding: 10px 16px 12px; cursor: pointer; text-align: left; flex: 0 0 auto; }
  .sheet-handle .grip { width: 40px; height: 4px; border-radius: 4px; background: rgba(255, 255, 255, 0.2); justify-self: center; }
  .sh-row { display: flex; align-items: center; gap: 10px; min-width: 0; }
  .sh-row b { color: var(--gold3); font-size: 14px; white-space: nowrap; }
  .sh-sum { font-size: 12px; color: var(--ink2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; flex: 1 1 auto; }
  .sheet-handle.pulse .grip { animation: grip 0.9s var(--ease) 2; }
  .controls-body { overflow-y: auto; padding: 0 16px 20px; overscroll-behavior: contain; }
  .hero { padding: 16px 16px 12px; }
  .kpi { padding: 12px 14px; }
  .kpi-value .v { font-size: clamp(28px, 9vw, 38px); }
  .nav-chart { height: 320px; }
  .second { grid-template-columns: minmax(0, 1fr); }
  .risk-grid { grid-template-columns: minmax(0, 1fr); }
  .heat { height: 380px; }
  .gate-card { padding: 34px 20px 24px; border-radius: 24px; }
  .gate-points { grid-template-columns: minmax(0, 1fr); }
  .toast { bottom: 84px; }
  .gate-table th:nth-child(4), .gate-table td:nth-child(4) { display: none; }
  .advanced > summary { padding: 16px; }
}
@keyframes grip { 50% { background: var(--gold); transform: scaleX(1.5); } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

/* ---------- 首次載入骨架 ---------- */
.chart:empty {
  border-radius: 14px;
  background: linear-gradient(100deg, rgba(255, 255, 255, 0.02) 30%, rgba(244, 226, 188, 0.06) 50%, rgba(255, 255, 255, 0.02) 70%) 0 0 / 220% 100%;
  animation: shimmer 1.6s linear infinite;
}
@keyframes shimmer { to { background-position: -220% 0; } }

/* ================= 第二輪（API v1.1） ================= */
.stale-chip { font-size: 11px; padding: 2px 9px; border-radius: 999px; color: #f3cfa9; border: 1px solid rgba(240, 162, 122, 0.4); background: rgba(240, 162, 122, 0.08); white-space: nowrap; cursor: help; }
.plain { margin-top: 14px; padding: 14px 16px 14px 20px; border-radius: 14px; background: linear-gradient(90deg, rgba(217, 184, 124, 0.09), rgba(217, 184, 124, 0.02)); border: 1px solid var(--line2); position: relative; }
.plain::before { content: ""; position: absolute; left: 0; top: 12px; bottom: 12px; width: 3px; border-radius: 3px; background: linear-gradient(180deg, var(--gold3), var(--gold2)); }
.plain-label, .tn-label { font-size: 11px; letter-spacing: 0.16em; color: var(--gold); display: block; margin-bottom: 4px; }
#plain-text { font-family: var(--tc-serif); font-size: 15px; line-height: 1.75; color: var(--ink); letter-spacing: 0.02em; }
.timing-note { margin-top: 10px; padding: 12px 16px; border-radius: 14px; border: 1px dashed rgba(143, 179, 224, 0.45); background: rgba(143, 179, 224, 0.06); }
.timing-note .tn-label { color: var(--blue); }
#timing-note-text { font-size: 13.5px; color: var(--ink); line-height: 1.7; }
.kpi-cmp.same { color: var(--blue); }
.kpi-cmp.same::before { content: "＝ "; }
.timing { display: grid; gap: 8px; padding: 12px 14px; margin-bottom: 6px; border-radius: 14px; background: rgba(0, 0, 0, 0.24); border: 1px solid var(--line); }
.tm-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.tm-head b { color: var(--gold3); font-size: 13.5px; letter-spacing: 0.06em; }
.tm-head small { color: var(--muted); font-size: 11.5px; }
.tm-row { display: grid; grid-template-columns: 64px minmax(0, 1fr) 58px; gap: 10px; align-items: center; font-size: 12.5px; }
.tm-lab { color: var(--ink2); white-space: nowrap; }
.tm-row b { text-align: right; font-variant-numeric: tabular-nums; }
.tm-bar { height: 10px; border-radius: 999px; background: rgba(255, 255, 255, 0.06); overflow: hidden; min-width: 0; }
.tm-bar i { display: block; height: 100%; border-radius: inherit; transition: width 0.7s var(--ease); }
.tm-row.me .tm-bar i { background: linear-gradient(90deg, var(--gold2), var(--gold3)); box-shadow: 0 0 12px rgba(217, 184, 124, 0.45); }
.tm-row.base .tm-bar i { background: rgba(143, 154, 174, 0.75); }
.tm-bar i.neg { background: rgba(53, 194, 142, 0.7) !important; box-shadow: none !important; }
.tm-verdict { font-size: 12.5px; line-height: 1.65; }
.tm-verdict.good { color: var(--gold3); }
.tm-verdict.bad { color: #c9b3b6; }
.tm-verdict.flat { color: var(--blue); }
.radar-note { font-size: 12px; color: var(--blue); line-height: 1.65; margin-top: 4px; padding: 8px 10px; border-radius: 10px; background: rgba(143, 179, 224, 0.06); }
.mini-table tr.hl td { color: var(--gold3); font-weight: 600; background: rgba(217, 184, 124, 0.06); }
.gate-line { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 10px 12px; border-radius: 12px; background: rgba(0, 0, 0, 0.2); border: 1px solid var(--line); }
.gl-title { font-size: 12px; color: var(--muted); letter-spacing: 0.04em; }
.gl-why { flex: 1 1 220px; min-width: 0; }
.report-wrap { display: grid; gap: 8px; }
.rp-title { font-size: 13.5px; color: var(--gold3); letter-spacing: 0.06em; display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; }
.rp-title small { color: var(--muted); font-weight: 400; font-size: 11.5px; letter-spacing: 0; }
.report { display: grid; gap: 0; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.rp-row { display: grid; grid-template-columns: minmax(0, 1.4fr) repeat(3, minmax(0, 1fr)); gap: 10px; align-items: center; padding: 10px 14px; border-top: 1px solid var(--line); font-variant-numeric: tabular-nums; font-size: 13px; }
.rp-row:first-child { border-top: 0; }
.rp-head { font-size: 11.5px; color: var(--muted); background: rgba(255, 255, 255, 0.02); }
.rp-head span:not(:first-child) { text-align: right; }
.rp-row.rp-stress { background: rgba(53, 194, 142, 0.035); }
.rp-name { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.rp-name b { font-weight: 600; color: var(--ink); }
.rp-name small { color: var(--muted); font-size: 11px; }
.rp-cell { text-align: right; display: flex; justify-content: flex-end; align-items: baseline; gap: 4px; flex-wrap: wrap; min-width: 0; }
.rp-cell small { color: var(--muted); font-size: 11.5px; }
b.better { color: var(--gold3); }
b.worse { color: #d9a7ad; }
.stale-box { margin-top: 10px; padding: 12px; border-radius: 14px; border: 1px solid rgba(240, 162, 122, 0.3); background: rgba(240, 162, 122, 0.05); display: grid; gap: 8px; }
.stale-box b { color: #f3cfa9; font-size: 13px; }
.chip.stale { color: #f3cfa9; border-color: rgba(240, 162, 122, 0.35); background: rgba(240, 162, 122, 0.06); white-space: normal; }
.st-plain { font-size: 13px; color: var(--ink); line-height: 1.7; margin-top: 8px; }
.drill { margin-top: 10px; padding: 10px 12px; border-radius: 12px; border: 1px dashed var(--line); display: grid; gap: 4px; font-size: 12.5px; color: var(--ink2); }
.drill b { color: var(--ink); font-size: 12.5px; }
.err-tech { margin-top: 4px; font-size: 12px; color: var(--muted); }
.gl-disc { color: var(--ink); width: 100%; }
.gl-attr { list-style: none; margin: 0; padding: 0; color: var(--muted); width: 100%; display: grid; gap: 2px; }
.rb-seg { margin-bottom: 10px; }
@media (max-width: 760px) {
  .rp-head { display: none; }
  .rp-row { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px 10px; padding: 12px; }
  .rp-name { grid-column: 1 / -1; flex-direction: row; align-items: baseline; gap: 8px; }
  .rp-cell { flex-direction: column; align-items: flex-start; text-align: left; gap: 0; }
  .rp-cell::before { content: attr(data-l); font-size: 10.5px; color: var(--muted); }
  .tm-row { grid-template-columns: 56px minmax(0, 1fr) 52px; }
  #plain-text { font-size: 14px; }
}

/* ================= 第三輪（API v1.2） ================= */
.bench-row { margin-top: 10px; justify-content: flex-start; gap: 8px 12px; }
.bench-lab { font-size: 12px; color: var(--muted); letter-spacing: 0.06em; }
.bench-line { margin-top: 10px; padding: 10px 14px; border-radius: 12px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.02); font-size: 13px; color: var(--ink2); line-height: 1.7; display: grid; gap: 2px; }
.bench-line .bl-label { font-size: 11px; letter-spacing: 0.14em; color: var(--gold); }
.bench-line small { font-size: 11.5px; }
.rb-catch { font-size: 13px; color: var(--ink); margin: 8px 0 4px; }
.rb-catch b { color: var(--gold3); }
.stale-inline { font-size: 12px; color: #f3cfa9; margin: 8px 0 4px; }
.stale-inline b { margin-right: 2px; }
.sugg { color: var(--gold3); font-size: 12px; }

/* ================= 第四輪（依互審） ================= */
.mode-plain .pro-only { display: none !important; }
.check-rule { font-size: 12px; color: var(--ink2); margin-top: 6px; line-height: 1.65; }
.check-rule b { color: var(--gold3); font-weight: 500; }
.chip.neutral { color: var(--ink2); border-color: rgba(255, 255, 255, 0.12); background: rgba(255, 255, 255, 0.04); }
.card-lev { grid-column: 1 / -1; font-size: 11px; color: #f0c2a6; border: 1px dashed rgba(240, 162, 122, 0.35); border-radius: 8px; padding: 3px 8px; margin-top: 4px; }
.seg.mini button { padding: 4px 10px; font-size: 12px; }
.budget { display: grid; gap: 6px; margin-top: 16px; padding: 12px; border-radius: 14px; border: 1px solid var(--line); background: rgba(0, 0, 0, 0.22); }
.budget .sl-top label { font-size: 13px; color: var(--ink2); }
.budget-input { display: inline-flex; align-items: baseline; gap: 6px; }
.budget-input input { width: 9.5ch; min-width: 0; text-align: right; font: inherit; font-size: 18px; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--gold3); background: transparent; border: 0; border-bottom: 1px dashed var(--line2); padding: 2px 0; outline: none; }
.budget-input input:focus { border-bottom-color: var(--gold); }
.budget .sl-ticks span:nth-child(2) { color: var(--muted); }
.budget-msg:empty { display: none; }
.budget-msg { display: grid; gap: 6px; font-size: 12.5px; color: #f3cfa9; }
.chip.fix { cursor: pointer; color: var(--gold3); border-color: var(--line2); background: rgba(217, 184, 124, 0.1); min-height: 32px; }
.chip.fix:hover { background: rgba(217, 184, 124, 0.18); }
.chart-bar { display: flex; justify-content: flex-end; margin-top: 12px; margin-bottom: -6px; }
details.src { margin-top: 8px; font-size: 11.5px; color: var(--muted); }
details.src > summary { cursor: pointer; list-style: none; display: inline-flex; gap: 6px; align-items: center; color: var(--muted); }
details.src > summary::-webkit-details-marker { display: none; }
details.src > summary::before { content: "源"; display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 5px; border: 1px solid var(--line2); color: var(--gold); font-size: 10.5px; }
details.src p { margin-top: 4px; overflow-wrap: anywhere; font-family: ui-monospace, Consolas, monospace; font-size: 11px; }
.rule-box { display: grid; gap: 12px; }
details.sec { border-radius: var(--radius); }
details.sec > summary { cursor: pointer; list-style: none; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; padding: 4px 2px 12px; }
details.sec > summary::-webkit-details-marker { display: none; }
details.sec > summary .sec-name { font-size: 16px; font-weight: 600; letter-spacing: 0.04em; }
details.sec > summary .sec-name::before { content: "▸"; color: var(--gold); margin-right: 8px; display: inline-block; transition: transform 0.2s var(--ease); }
details.sec[open] > summary .sec-name::before { transform: rotate(90deg); }
details.sec > summary small { color: var(--muted); font-size: 12px; }
.alloc-line { font-size: 14px; color: var(--ink); padding: 14px; border-radius: 12px; background: rgba(0, 0, 0, 0.22); border: 1px solid var(--line); }
.radar-axis { margin-top: 2px; }
.glossary { margin-top: 10px; font-size: 12.5px; }
.glossary summary { cursor: pointer; color: var(--gold); }
.glossary dl { margin: 8px 0 0; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 6px 12px; }
.glossary dt { color: var(--ink); font-weight: 600; white-space: nowrap; }
.glossary dd { margin: 0; color: var(--ink2); }
.check-panel { display: grid; gap: 14px; }
.check-intro { font-size: 13.5px; color: var(--ink2); line-height: 1.7; }
.check-grid { display: grid; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.cg-row { display: grid; grid-template-columns: minmax(0, 0.8fr) repeat(3, minmax(0, 1fr)); gap: 10px; padding: 10px 14px; border-top: 1px solid var(--line); align-items: center; font-size: 13px; font-variant-numeric: tabular-nums; }
.cg-row:first-child { border-top: 0; }
.cg-head { font-size: 11.5px; color: var(--muted); background: rgba(255, 255, 255, 0.02); }
.cg-name { font-weight: 600; }
.cg-cell i { font-style: normal; font-size: 11px; padding: 1px 6px; border-radius: 6px; border: 1px solid var(--line); margin-right: 4px; }
.cg-cell.ok i { color: var(--gold3); border-color: var(--line2); background: rgba(217, 184, 124, 0.08); }
.cg-cell.no i { color: #c3c8d4; border-color: rgba(143, 154, 174, 0.35); background: rgba(143, 154, 174, 0.08); }
.bias { padding: 12px 14px; border-radius: 14px; border: 1px solid rgba(143, 179, 224, 0.3); background: rgba(143, 179, 224, 0.05); font-size: 12.5px; color: var(--ink2); }
.bias b { color: var(--blue); }
.bias ul { margin: 6px 0 0; padding-left: 18px; display: grid; gap: 3px; }
.robust { display: grid; gap: 8px; }
.robust-sum { font-size: 13px; color: var(--ink); line-height: 1.7; }
.strip { display: grid; grid-template-columns: 76px minmax(0, 1fr); gap: 10px; align-items: center; font-size: 12px; color: var(--ink2); }
.dots { display: flex; flex-wrap: wrap; gap: 5px; }
.dots i { width: 14px; height: 14px; border-radius: 50%; display: inline-block; background: rgba(143, 154, 174, 0.45); border: 1px solid rgba(255, 255, 255, 0.08); }
.dots i.ok { background: linear-gradient(135deg, var(--gold3), var(--gold2)); }
.dots i.na { background: transparent; border-style: dashed; }
.export-row { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 8px; }
.warnings .tech { margin-top: 10px; font-size: 12px; }
.warnings .tech summary { cursor: pointer; color: var(--muted); }
.warnings .tech ul { margin: 6px 0 0; padding-left: 18px; color: var(--muted); display: grid; gap: 4px; overflow-wrap: anywhere; }
.link.more { min-height: 32px; }

/* A4 摘要（亮色、可列印） */
.report-dlg { width: min(860px, calc(100vw - 24px)); max-height: calc(100vh - 24px); padding: 0; background: #f4f1ea; color: #1d1d1f; border-color: #d9cdb4; }
.report-actions { position: sticky; top: 0; z-index: 2; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 12px 16px; background: #10131c; color: var(--ink); border-bottom: 1px solid var(--line2); }
.report-actions .grow { flex: 1 1 auto; }
.a4 { padding: 28px 34px 34px; font-family: "Noto Sans TC", Inter, sans-serif; font-size: 13px; line-height: 1.7; color: #1d1d1f; background: #fff; }
.r-wm { text-align: center; font-size: 12px; letter-spacing: 0.18em; color: #8a6a2f; border: 1px solid #d9cdb4; border-radius: 6px; padding: 6px; background: #fbf7ee; }
.r-wm.foot { margin-top: 18px; }
.r-head { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin: 16px 0 6px; padding-bottom: 12px; border-bottom: 2px solid #1d1d1f; }
.r-head h1 { font-family: "Noto Serif TC", serif; font-size: 24px; letter-spacing: 0.06em; }
.r-head p { color: #555; }
.r-meta { display: grid; grid-template-columns: auto auto; gap: 2px 12px; margin: 0; font-size: 12px; }
.r-meta dt { color: #777; }
.r-meta dd { margin: 0; font-variant-numeric: tabular-nums; }
.r-sec { margin-top: 14px; break-inside: avoid; }
.r-sec h2 { font-size: 14px; letter-spacing: 0.06em; border-left: 3px solid #9a7438; padding-left: 8px; margin-bottom: 6px; }
.r-tbl { width: 100%; border-collapse: collapse; font-size: 12.5px; font-variant-numeric: tabular-nums; }
.r-tbl th, .r-tbl td { border-bottom: 1px solid #e4dfd3; padding: 5px 8px; text-align: right; }
.r-tbl th:first-child, .r-tbl td:first-child { text-align: left; }
.r-tbl th { color: #666; font-weight: 500; background: #faf8f3; }
.r-muted { color: #666; font-size: 12px; }
.r-chart { border: 1px solid #e4dfd3; border-radius: 6px; padding: 6px; background: #fff; }
.r-src { font-family: ui-monospace, Consolas, monospace; font-size: 11px; overflow-wrap: anywhere; }
.a4 ul { padding-left: 18px; margin: 4px 0; }

@media print {
  @page { size: A4; margin: 12mm; }
  body { background: #fff !important; }
  body > *:not(#dlg-report), .aura, .no-print, .toast { display: none !important; }
  #dlg-report { position: static !important; display: block !important; width: auto !important; max-height: none !important; overflow: visible !important; border: 0 !important; box-shadow: none !important; background: #fff !important; }
  #dlg-report::backdrop { display: none !important; }
  .a4 { padding: 0; }
}

@media (max-width: 760px) {
  .topbar { position: static; padding: 10px 16px; gap: 6px 10px; }
  .brand-text b { font-size: 15px; }
  .tabs { order: 0; width: auto; margin-left: auto; }
  .tabs button { flex: 0 0 auto; padding: 8px 12px; min-height: 40px; }
  .top-meta { order: 3; width: 100%; margin-left: 0; gap: 6px; }
  #mode-seg button { min-height: 36px; }
  .check-rule { display: block; font-size: 11.5px; }
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .card { grid-template-columns: auto minmax(0, 1fr); justify-items: start; text-align: left; padding: 10px; gap: 2px 8px; align-items: center; min-height: 56px; }
  .card .glyph { grid-row: span 2; }
  .card-name { justify-content: flex-start; }
  .card-name b { white-space: normal; font-size: 13px; line-height: 1.3; }
  .card-foot { display: flex; grid-column: 2; margin-top: 2px; }
  .card-foot .risk { display: none; }
  .card-foot .chip { font-size: 10.5px; padding: 1px 6px; }
  .card-lev { display: none; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #kpi-final { grid-column: 1 / -1; }
  #kpi-gap .kpi-value .v, #kpi-dd .kpi-value .v { font-size: clamp(24px, 7.4vw, 30px); }
  #kpi-gap .kpi-cmp, #kpi-dd .kpi-sub { font-size: 11.5px; }
  #kpi-gap .unit { font-size: 11px; }
  .nav-chart { height: 280px; }
  .cg-head { display: none; }
  .cg-row { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px 10px; }
  .cg-name { grid-column: 1 / -1; }
  .cg-cell { display: flex; flex-direction: column; gap: 2px; }
  .cg-cell::before { content: attr(data-l); font-size: 10.5px; color: var(--muted); }
  .seg button, .btn, .capsule, .switch, .chip.fix, .link { min-height: 40px; }
  .link { display: inline-flex; align-items: center; }
  .a4 { padding: 18px 16px 22px; }
  #env-badge { display: none; }
  .check-rule .long, .export-note .long { display: none; }
  .nav-chart { height: 250px; }
  .mode-plain .rg-a { grid-template-columns: minmax(0, 1fr); }
  .export-row .btn { flex: 1 1 100%; }
  .strip { grid-template-columns: minmax(0, 1fr); }
}

.export-note .short { display: none; }
@media (max-width: 760px) { .export-note .short { display: inline; } }
.mode-plain .risk-grid { grid-template-columns: minmax(0, 1fr); }
.mode-plain .rg-a { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
@media (max-width: 760px) { .mode-plain .rg-a { grid-template-columns: minmax(0, 1fr); } }

@media (max-width: 760px) {
  #nav-note { display: none; }
  .gs-long { display: none; }
  .has-timing-note .tm-verdict { display: none; }
  .gate-status { margin-top: 2px; }
}

/* 手機觸控目標 ≥ 40px（第四步共同規範 11） */
@media (max-width: 760px) {
  #mode-seg button, .key-btn, .link.more { min-height: 40px; }
  .key-btn { display: inline-flex; align-items: center; }
  input[type="range"] { height: 40px; }
  details > summary { min-height: 40px; display: flex; align-items: center; }
  details.sec > summary { align-items: center; }
  .a4 .r-tbl { font-size: 11.5px; }
  .a4 .r-tbl th, .a4 .r-tbl td { padding: 5px 4px; }
  .a4 .r-head { flex-direction: column; }
}

@media (max-width: 760px) { .toast { bottom: auto; top: 12px; } }

/* ================= 第六步（互評重評 P1／P2） ================= */
/* 首屏「你每月投入多少？」 */
.hero-budget { margin-top: 14px; padding: 12px 14px; border-radius: 14px; border: 1px solid var(--line2); background: linear-gradient(180deg, rgba(217, 184, 124, 0.08), rgba(217, 184, 124, 0.02)); display: grid; gap: 6px; min-width: 0; }
.hero-budget.first { box-shadow: 0 0 0 1px rgba(244, 226, 188, 0.45), 0 0 24px rgba(217, 184, 124, 0.18); }
.hb-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; min-width: 0; }
.hb-label { font-size: 15px; font-weight: 600; color: var(--gold3); letter-spacing: 0.04em; }
.hb-input input { width: 8.5ch; font-size: 22px; }
.hb-unit { font-size: 12.5px; }
.hb-chips { display: flex; flex-wrap: wrap; gap: 6px; min-width: 0; margin-left: auto; }
.hb-chip { cursor: pointer; min-height: 32px; padding: 4px 12px; font-size: 12.5px; }
.hb-chip:hover { border-color: var(--line2); color: var(--gold3); }
.hb-chip[aria-pressed="true"] { color: var(--gold3); border-color: var(--gold2); background: rgba(217, 184, 124, 0.14); }
.hb-hint { line-height: 1.5; }
/* 規則與限制：交易成本 */
.cd-cost { font-size: 12.5px; color: var(--ink2); line-height: 1.6; padding: 8px 12px; border-radius: 10px; border: 1px dashed var(--line); }
.cd-cost b { color: var(--gold3); font-weight: 500; margin-right: 8px; }
.r-cost { font-size: 12px; color: #444; }
/* 參數鄰域 3×3 */
.nbh { display: grid; gap: 10px; }
.nbh-sum { font-size: 13px; line-height: 1.65; color: var(--ink2); }
.nbh-sum b { color: var(--gold3); font-weight: 600; }
.nbh-grid { display: grid; grid-template-columns: minmax(64px, auto) repeat(3, minmax(0, 1fr)); gap: 6px; max-width: 520px; font-variant-numeric: tabular-nums; }
.nbh-corner { font-size: 10.5px; color: var(--muted); align-self: end; line-height: 1.3; }
.nbh-h { font-size: 11.5px; color: var(--ink2); text-align: center; align-self: end; min-width: 0; overflow-wrap: anywhere; }
.nbh-h.row { text-align: left; align-self: center; }
.nbh-c { display: grid; gap: 2px; place-items: center; padding: 8px 4px; border-radius: 10px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.03); min-width: 0; text-align: center; }
.nbh-c b { font-size: 14px; font-weight: 600; }
.nbh-c small { font-size: 10.5px; color: var(--muted); }
.nbh-c.ok { border-color: var(--line2); background: rgba(217, 184, 124, 0.12); }
.nbh-c.ok b { color: var(--gold3); }
.nbh-c.no b { color: var(--ink2); }
.nbh-c.na { opacity: 0.55; }
.nbh-c.cur { outline: 2px solid var(--gold); outline-offset: 1px; }
.lc-nbh { font-size: 12px; color: var(--gold3); margin-top: 4px; }
/* 配置卡膠囊：不超出卡框 */
.card-foot .chip { max-width: 100%; white-space: normal; line-height: 1.35; }

@media (max-width: 760px) {
  .hero-budget { padding: 10px 12px; margin-top: 10px; gap: 4px; }
  .hb-row { gap: 6px 10px; }
  .hb-label { font-size: 14px; flex: 1 1 auto; }
  .hb-input input { font-size: 20px; width: 7.5ch; }
  .hb-chips { margin-left: 0; width: 100%; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .hb-chip { min-height: 40px; justify-content: center; padding: 4px 6px; }
  .hb-hint { display: none; }
  .card-foot .ck-pre, .card-foot .ck-post { display: none; }
  .nbh-grid { grid-template-columns: minmax(52px, auto) repeat(3, minmax(0, 1fr)); gap: 4px; }
  .nbh-c { padding: 6px 2px; }
  .nbh-c b { font-size: 13px; }
}
.cd-cost .short { display: none; }
@media (max-width: 760px) {
  .cd-cost .long { display: none; }
  .cd-cost .short { display: inline; }
  .hero-top { display: block; }
  .hero-top .tag { float: right; margin: 0 0 4px 8px; }
  .nav-chart { height: 230px; }
  .export-row .btn { flex: 1 1 calc(50% - 5px); }
  .hb-input input, .budget-input input { min-height: 40px; }
}
@media (max-width: 760px) { #data-asof { display: none; } }
.kpis.kpis-stale { opacity: 0.42; filter: saturate(0.5); transition: opacity 0.2s; }
.rp-row .rp-na { grid-column: 2 / -1; font-size: 12px; }
@media (max-width: 760px) { .rp-row .rp-na { grid-column: 1 / -1; } }
