/* 行動優先；沿用報告配色 navy #1F4E79 / gold #C9A227 */
:root {
  --navy: #1F4E79;
  --blue: #2E75B6;
  --gold: #C9A227;
  --red: #C00000;
  --green: #548235;
  --bg: #F4F6F8;
  --card: #FFFFFF;
  --line: #DCE3EA;
  --text: #23272B;
  --muted: #6B7680;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14181C; --card: #1D2329; --line: #2E3740;
    --text: #E8ECEF; --muted: #98A3AD;
  }
}

* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: "Microsoft JhengHei", "PingFang TC", "Noto Sans TC", system-ui, sans-serif;
  font-size: 16px; line-height: 1.55;
  -webkit-text-size-adjust: 100%;
}

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--navy); color: #fff; padding: 12px 16px;
  padding-top: max(12px, env(safe-area-inset-top));
}
.topbar .brand { color: #fff; font-weight: 700; text-decoration: none; font-size: 17px; }
.topbar nav a { color: #cfe0f0; text-decoration: none; margin-left: 14px; font-size: 14px; }

main { max-width: 680px; margin: 0 auto; padding: 16px; }
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: 12px; padding: 20px 18px;
}
.card.narrow { max-width: 420px; margin: 40px auto; }

h1 { font-size: 20px; margin: 0 0 6px; color: var(--navy); }
h2 {
  font-size: 15px; margin: 22px 0 10px; color: var(--navy);
  border-bottom: 2px solid var(--navy); padding-bottom: 5px;
}
@media (prefers-color-scheme: dark) {
  h1, h2 { color: #7FB3E3; border-color: #7FB3E3; }
}
.muted { color: var(--muted); font-size: 14px; margin: 4px 0 12px; }
.hint { color: var(--muted); font-size: 12.5px; margin: 4px 0 14px; }
.hint.center { text-align: center; }
.req { color: var(--red); font-size: 11px; font-weight: 700; }

label { display: block; font-weight: 600; font-size: 14px; margin: 12px 0 4px; }
label.check { font-weight: 400; display: flex; align-items: center; gap: 8px; }
label.check input { width: auto; margin: 0; }
input, select {
  width: 100%; padding: 11px 12px; font-size: 16px;  /* 16px 防 iOS 自動縮放 */
  border: 1px solid var(--line); border-radius: 8px;
  background: var(--card); color: var(--text);
}
input:focus, select:focus { outline: 2px solid var(--blue); border-color: var(--blue); }
.row { display: flex; gap: 12px; }
.row > div { flex: 1; min-width: 0; }

button, .btn {
  display: inline-block; width: 100%; text-align: center;
  padding: 13px 16px; margin-top: 16px; font-size: 16px; font-weight: 600;
  border: 1px solid var(--line); border-radius: 8px;
  background: var(--card); color: var(--text); text-decoration: none; cursor: pointer;
}
button.primary, .btn.primary {
  background: var(--navy); border-color: var(--navy); color: #fff;
}

.alert { padding: 11px 13px; border-radius: 8px; margin: 12px 0; font-size: 14px; }
.alert.error { background: #FDECEA; border-left: 4px solid var(--red); color: #7A1B14; }
.alert.warn { background: #FFF6E0; border-left: 4px solid var(--gold); color: #6B4E00; }

.spinner {
  width: 34px; height: 34px; margin: 18px auto;
  border: 3px solid var(--line); border-top-color: var(--navy);
  border-radius: 50%; animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.step { text-align: center; font-weight: 600; color: var(--blue); }

.kpi {
  background: var(--navy); color: #fff; border-radius: 10px;
  padding: 18px; text-align: center; margin: 14px 0;
}
.kpi-label { display: block; font-size: 13px; opacity: .85; }
.kpi-value { display: block; font-size: 30px; font-weight: 700; color: var(--gold); }
.kpi-sub { font-size: 13px; opacity: .9; margin-top: 6px; }

table.mini { width: 100%; border-collapse: collapse; margin: 12px 0; font-size: 14px; }
table.mini th, table.mini td {
  text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line);
}
table.mini th { width: 38%; color: var(--muted); font-weight: 600; }

.tiers { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; }
.tier {
  font-size: 12px; padding: 4px 9px; border-radius: 999px;
  border: 1px solid var(--line); color: var(--muted);
}
.tier.on { border-color: var(--blue); color: var(--blue); font-weight: 600; }

.actions { display: flex; flex-direction: column; gap: 0; }
.pdfbox { margin-top: 18px; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.pdfbox object { width: 100%; height: 78vh; display: block; }
@media (max-width: 600px) { .pdfbox object { height: 62vh; } }

ul.history { list-style: none; padding: 0; margin: 8px 0; }
ul.history li { border-bottom: 1px solid var(--line); }
ul.history a { display: block; padding: 12px 2px; text-decoration: none; color: var(--text); }
.h-addr { display: block; font-weight: 600; font-size: 15px; }
.h-meta { display: block; font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.bad { color: var(--red); }

footer {
  max-width: 680px; margin: 8px auto 32px; padding: 0 18px;
  color: var(--muted); font-size: 11.5px; text-align: center; line-height: 1.6;
  padding-bottom: max(8px, env(safe-area-inset-bottom));
}
