/* 投資推廣雷達 — layout rules
   1. One column, max 1080px, 20px side gutter (16px on phones). Every block shares that width.
   2. Spacing steps: 4 / 8 / 12 / 16 / 24 / 40px only.
   3. One accent colour (ink blue). Review priority uses ink weight, never red: a flag is a pointer
      for review, not an accusation. Amber marks "data missing / not collected" only.
   4. Stat cells are an equal-width grid (4 across, 2 across under 640px).
   5. Controls share one height: 36px. */
:root {
  --bg: #f6f7f9; --card: #fff; --ink: #17212b; --muted: #5d6b7a; --line: #dfe4ea; --soft: #eef1f5;
  --accent: #17324d; --accent-soft: #e4ebf2; --mark: #fff1b8; --warn: #8a5a00; --warn-soft: #fdf3dc; --ok: #1d6b47;
  --radius: 10px; --font: -apple-system, "PingFang HK", "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", system-ui, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #10151b; --card: #182029; --ink: #e6ebf0; --muted: #94a3b3; --line: #2a3541; --soft: #1f2933;
    --accent: #a9c7e4; --accent-soft: #223346; --mark: #5b4a12; --warn: #e6b85a; --warn-soft: #3a2f14; --ok: #6fcf9f; }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.6 var(--font); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 20px; }
.login-wrap { max-width: 480px; margin: 8vh auto; padding: 0 20px; }
.login-card { margin: 24px 0; padding: 28px; }
.login-card h1 { margin: 8px 0; font-size: 26px; }
.eyebrow { color: var(--accent); font-size: 13px; letter-spacing: .1em; }
.login-card label, .account-form label { display: block; margin: 16px 0 6px; }
.login-card input, .account-form input { width: 100%; min-height: 44px; }
.login-card button { width: 100%; margin-top: 24px; min-height: 44px; }
.session-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 16px; padding-top: 12px; font-size: 13px; }
.account-form { max-width: 480px; }
.account-form button { margin-top: 16px; }
.credential { overflow-wrap: anywhere; user-select: all; }
.muted { color: var(--muted); }
.pad { padding: 40px 0; }
.small { font-size: 13px; }
.nowrap { white-space: nowrap; }

.top { position: sticky; top: 0; z-index: 5; background: var(--card); border-bottom: 1px solid var(--line); }
.bar { display: flex; align-items: center; gap: 24px; height: 52px; }
.brand { font-weight: 700; font-size: 16px; color: var(--ink); white-space: nowrap; }
#nav { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
#nav::-webkit-scrollbar { display: none; }
#nav a { padding: 6px 10px; border-radius: 8px; color: var(--muted); white-space: nowrap; font-size: 14px; }
#nav a:hover { text-decoration: none; background: var(--soft); }
#nav a.on { color: var(--accent); background: var(--accent-soft); font-weight: 600; }
.count { margin-left: 6px; padding: 0 6px; border-radius: 9px; background: var(--accent); color: var(--card); font-size: 12px; font-weight: 600; }

main { padding-top: 24px; padding-bottom: 40px; outline: none; }
h1 { font-size: 22px; margin: 0 0 4px; line-height: 1.35; }
h2 { font-size: 16px; margin: 40px 0 12px; }
h3 { font-size: 14px; margin: 0 0 8px; }
.sub { color: var(--muted); margin: 0 0 16px; }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.stat b { display: block; font-size: 26px; line-height: 1.2; font-variant-numeric: tabular-nums; }
.stat span { color: var(--muted); font-size: 13px; }
.stat a { color: inherit; }

.note { margin: 16px 0 0; padding: 12px 16px; border-radius: var(--radius); background: var(--warn-soft); color: var(--warn); font-size: 14px; }
.note a { color: inherit; text-decoration: underline; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.box { padding: 16px; }

.list { display: grid; }
.row { display: grid; grid-template-columns: 64px 1fr auto; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--line); color: inherit; align-items: start; }
.row:first-child { border-top: 0; }
a.row:hover { text-decoration: none; background: var(--soft); }
.row .t { font-weight: 600; overflow-wrap: anywhere; }
.row .m { color: var(--muted); font-size: 13px; }
.row .s { font-size: 14px; margin-top: 4px; overflow-wrap: anywhere; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }
.chip { font-size: 12px; padding: 1px 8px; border-radius: 10px; background: var(--soft); color: var(--ink); white-space: nowrap; }
.chip.rule { background: none; border: 1px dashed var(--line); color: var(--muted); }

.band { display: inline-block; min-width: 52px; text-align: center; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 6px; border: 1px solid var(--accent); color: var(--accent); white-space: nowrap; }
.band.high { background: var(--accent); color: var(--card); }
.band.low { border-color: var(--line); color: var(--muted); }
.band.none { border-color: transparent; color: var(--muted); font-weight: 400; }
.band.unassessed { border: 1px dashed var(--warn); color: var(--warn); }
.state { font-size: 12px; color: var(--muted); white-space: nowrap; }

.filters { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0 12px; align-items: center; }
select, input[type=search], input[type=text], input[type=url], input[type=date], textarea, button {
  font: inherit; color: var(--ink); background: var(--card); border: 1px solid var(--line); border-radius: 8px; }
select, input[type=search], input[type=text], input[type=url], input[type=date], button { height: 36px; padding: 0 10px; }
textarea { width: 100%; padding: 8px 10px; min-height: 96px; resize: vertical; }
input[type=search] { min-width: 180px; flex: 1; max-width: 320px; }
button { cursor: pointer; }
button.primary { background: var(--accent); color: var(--card); border-color: var(--accent); font-weight: 600; }
button:disabled { opacity: .5; cursor: default; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--card); }
.seg button { border: 0; border-radius: 0; border-left: 1px solid var(--line); background: none; color: var(--muted); }
.seg button:first-child { border-left: 0; }
.seg button.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.more { display: block; width: 100%; margin-top: 12px; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-weight: 600; color: var(--muted); font-size: 12px; padding: 8px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 10px 12px; border-top: 1px solid var(--line); vertical-align: top; overflow-wrap: anywhere; }
tr:first-child td { border-top: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.scroll { overflow-x: auto; }
.tag { display: inline-block; font-size: 12px; padding: 1px 8px; border-radius: 10px; white-space: nowrap; border: 1px solid var(--line); color: var(--muted); }
.tag.live { border-color: var(--ok); color: var(--ok); }
.tag.off { border-color: var(--warn); color: var(--warn); }
.dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--line); margin-right: 4px; vertical-align: 1px; }
.dot.ok { background: var(--ok); } .dot.failed { background: var(--warn); }

.bars { display: grid; gap: 6px; }
.barrow { display: grid; grid-template-columns: 200px 1fr 32px; gap: 12px; align-items: center; font-size: 13px; color: inherit; }
.barrow i { display: block; height: 8px; border-radius: 4px; background: var(--accent); opacity: .75; }
.barrow span:last-child { text-align: right; font-variant-numeric: tabular-nums; }

.crumb { font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.kv { display: grid; grid-template-columns: 120px 1fr; gap: 6px 16px; font-size: 14px; margin: 0; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; overflow-wrap: anywhere; }
.finding { padding: 16px; border-top: 1px solid var(--line); }
.finding:first-child { border-top: 0; }
.finding h3 { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
blockquote { margin: 8px 0; padding: 8px 12px; border-left: 3px solid var(--accent); background: var(--soft); border-radius: 0 6px 6px 0; overflow-wrap: anywhere; }
.verify { font-size: 12px; } .verify.ok { color: var(--ok); } .verify.bad { color: var(--warn); }
.fgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 24px; margin-top: 12px; font-size: 14px; }
.fgrid h4 { margin: 0 0 2px; font-size: 12px; color: var(--muted); font-weight: 600; }
.fgrid ul { margin: 0; padding-left: 18px; } .fgrid p { margin: 0; }
.source { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14px; max-height: 420px; overflow-y: auto; padding: 16px; }
mark { background: var(--mark); color: inherit; padding: 0 1px; border-radius: 2px; }
code, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; overflow-wrap: anywhere; }
.review { display: grid; gap: 12px; }
.review .seg { justify-self: start; }
.formgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.formgrid label { display: grid; gap: 4px; font-size: 13px; color: var(--muted); }
.formgrid .full { grid-column: 1 / -1; }
.formgrid input, .formgrid select { width: 100%; }
.msg { font-size: 14px; }
.m0 { margin: 0; } .mt8 { margin-top: 8px; } .mt12 { margin-top: 12px; } .mt24 { margin-top: 24px; } .mb8 { margin-bottom: 8px; } .mb12 { margin-bottom: 12px; }
.warn { color: var(--warn); }
textarea.tall { min-height: 200px; }
ul.plain { margin: 0; padding-left: 18px; }
ul.plain.mb12 { margin-bottom: 12px; }
ul.plain li { margin: 4px 0; }

@media (max-width: 640px) {
  .wrap { padding: 0 16px; }
  .bar { gap: 12px; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .row { grid-template-columns: 1fr; gap: 6px; }
  .fgrid, .formgrid { grid-template-columns: 1fr; }
  .kv { grid-template-columns: 96px 1fr; }
  .barrow { grid-template-columns: 130px 1fr 28px; }
}
