:root {
  --bg: #f3f4f6; --surface: #fff; --ink: #111827; --sub: #4b5563; --line: #e5e7eb;
  --accent: #1d4ed8; --accent-soft: #eff6ff; --accent-ink: #1e3a8a;
  --warn-bg: #fffbeb; --warn-line: #fcd34d; --warn-ink: #92400e;
  --ok-bg: #ecfdf5; --ok-ink: #166534; --soon-line: #9ca3af; --soon-bg: #f9fafb;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.6 'Noto Sans TC', system-ui, sans-serif; }
a { color: var(--accent); }
h1 { margin: 0; font-size: 26px; }
h2 { margin: 0; font-size: 16px; }
h3 { margin: 0; font-size: 14px; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }

.shell { display: flex; flex-wrap: wrap; min-height: 100vh; }
.nav { flex: 1 1 200px; max-width: 100%; background: #111827; color: #f9fafb; padding: 22px 14px; display: flex; flex-direction: column; gap: 4px; }
.brand { padding: 0 10px 18px; font-size: 17px; font-weight: 700; }
.nav a { display: flex; align-items: center; min-height: 44px; padding: 0 12px; border-radius: 8px; color: #f9fafb; text-decoration: none; }
.nav a[aria-current="page"] { background: var(--accent); font-weight: 500; }
.nav-label { margin: 18px 10px 6px; font-size: 12px; color: #9ca3af; letter-spacing: .08em; }
.soon { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 44px; padding: 0 12px; border: 1px dashed #4b5563; border-radius: 8px; color: #d1d5db; }
.phase { font-size: 12px; padding: 2px 8px; border-radius: 999px; background: #374151; color: #e5e7eb; white-space: nowrap; }
.nav-foot { margin-top: auto; padding: 16px 10px 0; font-size: 12px; color: #9ca3af; }
.view { flex: 999 1 560px; min-width: 0; padding: 22px 26px 56px; display: flex; flex-direction: column; gap: 16px; outline: none; }

.head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.muted { color: var(--sub); }
.small { font-size: 13px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.card.focus { border: 2px solid var(--accent); }
.dashed { border: 2px dashed var(--soon-line); background: var(--soon-bg); border-radius: 12px; padding: 12px 14px; color: #374151; }
.cols { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-start; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.grow { flex: 1 1 auto; min-width: 0; }
.btn { min-height: 44px; padding: 0 18px; border-radius: 10px; border: 1px solid var(--accent); background: #fff; color: var(--accent); font-weight: 500; }
.btn.primary { background: var(--accent); color: #fff; font-weight: 700; }
.btn.plain { border-color: #d1d5db; color: var(--ink); }
.btn:disabled { border-color: #9ca3af; background: #e5e7eb; color: #4b5563; cursor: not-allowed; }
.chip { display: inline-block; padding: 3px 12px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-ink); }
.chip.warn { background: var(--warn-bg); border: 1px solid var(--warn-line); color: var(--warn-ink); }
.chip.gray { background: #f3f4f6; color: #374151; }
.chip.on { background: #111827; color: #fff; }
.tag { font-size: 12px; padding: 2px 10px; border-radius: 999px; background: #f3f4f6; color: #374151; white-space: nowrap; }
.tag.warn { background: var(--warn-bg); color: var(--warn-ink); border: 1px solid var(--warn-line); }
.field { min-height: 44px; padding: 0 14px; border-radius: 10px; border: 1px solid #9ca3af; background: #fff; width: 100%; }
textarea.field { padding: 10px 12px; min-height: 96px; resize: vertical; }
label { font-size: 13px; color: var(--sub); }
.notice { padding: 8px 12px; border-radius: 10px; background: var(--accent-soft); color: var(--accent-ink); }
.notice.warn { background: var(--warn-bg); color: var(--warn-ink); border: 1px solid var(--warn-line); }

/* 報價頁 */
.case-list { flex: 1 1 210px; }
.case-item { display: flex; flex-direction: column; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--line); background: #fff; color: var(--ink); text-align: left; width: 100%; }
.case-item[aria-current="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
.group-label { margin: 8px 4px 0; font-size: 12px; color: var(--sub); letter-spacing: .06em; }
.talk { flex: 1.2 1 280px; }
.reply { flex: 2 1 440px; }
.bubble { align-self: flex-start; max-width: 96%; padding: 10px 14px; border-radius: 12px; background: #f3f4f6; white-space: pre-wrap; overflow-wrap: anywhere; }
.bubble.action { align-self: flex-end; background: #fff; border: 1px dashed #9ca3af; color: #374151; }
.bubble .meta { display: block; font-size: 12px; color: var(--sub); }
.paste { border: 1px solid var(--accent); background: var(--accent-soft); border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; }

/* 結果卡片 */
.result { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.result .title { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px; }
.lines { display: flex; flex-direction: column; border-top: 1px solid var(--line); }
.line { display: flex; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.line .what { flex: 1 1 auto; min-width: 0; }
.line .num { flex: 0 0 auto; text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.pre { white-space: pre-wrap; overflow-wrap: anywhere; }
.quote-text { background: #f9fafb; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }

/* 儀表板 */
.kpis { display: flex; flex-wrap: wrap; gap: 16px; }
.kpi { flex: 1 1 200px; background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 16px 20px; }
.kpi .n { font-size: 34px; font-weight: 700; line-height: 1.2; font-variant-numeric: tabular-nums; }
.kpi.warn { background: var(--warn-bg); border-color: var(--warn-line); color: var(--warn-ink); }
.bar-row { display: flex; align-items: center; gap: 12px; }
.bar-row .name { flex: 0 0 112px; color: #374151; font-size: 14px; }
.bar-row .track { flex: 1 1 auto; min-width: 0; height: 18px; background: var(--accent-soft); border-radius: 6px; }
.bar-row .fill { height: 18px; border-radius: 6px; background: var(--accent); }
.bar-row .val { flex: 0 0 auto; min-width: 44px; text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.bar-row .extra { flex: 0 0 64px; text-align: right; font-variant-numeric: tabular-nums; color: var(--sub); }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th { text-align: left; font-size: 13px; font-weight: 400; color: var(--sub); padding: 6px 8px 6px 0; }
td { padding: 8px 8px 8px 0; border-top: 1px solid var(--line); }
th.r, td.r { text-align: right; padding-right: 0; }
.scroll-x { overflow-x: auto; }

/* 登入與帳號 */
[hidden] { display: none !important; }
body[data-auth="out"] .nav { display: none; }
body[data-auth="out"] .view { align-items: center; justify-content: center; }
.auth { width: 100%; max-width: 400px; padding: 26px 26px 28px; }
.auth h1 { font-size: 22px; }
.nav-foot { display: flex; flex-direction: column; gap: 8px; }
.nav-foot a { display: inline; min-height: 0; padding: 0; color: #d1d5db; text-decoration: underline; }
.nav-foot #who { color: #f9fafb; font-size: 13px; }
.linklike { border: 0; background: none; padding: 0; color: inherit; text-decoration: underline; font-size: inherit; }
.view .linklike { color: var(--accent); }
.secret { font: 600 16px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace; padding: 2px 8px; border-radius: 6px; background: #fff; border: 1px solid var(--line); user-select: all; }
.stack { display: flex; flex-direction: column; gap: 6px; }
.warn-text { color: var(--warn-ink); }
.btn.small { min-height: 32px; padding: 0 12px; border-radius: 8px; font-size: 13px; }
a.btn { display: inline-flex; align-items: center; text-decoration: none; }

/* AI 整理 */
.notice.ok { background: var(--ok-bg); color: var(--ok-ink); }
.notice .btn.small { margin-left: 10px; }
.tag.ok { background: var(--ok-bg); color: var(--ok-ink); }
.steps { margin: 6px 0; padding-left: 22px; }
.plain { margin: 2px 0 0; padding-left: 20px; }
.copy-row { display: flex; align-items: flex-start; gap: 10px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px; }
.est { border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: 10px; padding: 10px 14px; display: flex; flex-direction: column; gap: 4px; }
.est .title { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px; }
.est .price { font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; }
.est .qty { font-weight: 400; }
.chip.link { border: 0; cursor: pointer; text-decoration: underline; font-size: 13px; }
.paste-label { font-weight: 700; color: var(--accent-ink); }
.reply h3 { margin-top: 8px; }
details > summary { cursor: pointer; color: var(--accent); padding: 6px 0; }
details .stack { gap: 12px; margin-top: 8px; }
:focus-visible { outline: 3px solid #93c5fd; outline-offset: 2px; }
.view:focus-visible { outline: none; }
.btn.small { white-space: nowrap; flex: 0 0 auto; }
