/* EUP status page — 米白經典版設計系統（v4 mock 抽出，T9-T12 共用）。
   雙主題：預設跟隨 prefers-color-scheme，:root[data-theme="light"|"dark"] 可強制覆蓋。 */
:root {
  --bg: #f4eee4;
  --card: #fffdf8;
  --card2: #efe7d8;
  --line: #e2d7c2;
  --line2: #ece2d1;
  --ink: #39301f;
  --sub: #6a5a40;
  --dim: #8a795c;
  --gold: #bd7e12;
  --teal: #1f9c87;
  --rose: #cf5870;
  --green: #3f9560;
  --op: #3f9560;
  --op-bg: #e4efe6;
  --dg: #bd7e12;
  --dg-bg: #f5e8d3;
  --ou: #cf5870;
  --ou-bg: #f6e2e5;
  --shadow: 0 10px 30px rgba(57, 48, 31, .14);
  --radius: 12px;
}
@media (prefers-color-scheme:dark) {
  :root {
    --bg: #211c15; --card: #2c2619; --card2: #352d1e; --line: #463c28; --line2: #3d3423;
    --ink: #f1e8d6; --sub: #c9b89a; --dim: #9c8b6c;
    --gold: #e3a94a; --teal: #3fc0aa; --rose: #e07d92; --green: #5cb47e;
    --op: #5cb47e; --op-bg: #26382c; --dg: #e3a94a; --dg-bg: #3d3320; --ou: #e07d92; --ou-bg: #3d2830;
    --shadow: 0 10px 30px rgba(0, 0, 0, .4);
  }
}
:root[data-theme="light"] {
  --bg: #f4eee4; --card: #fffdf8; --card2: #efe7d8; --line: #e2d7c2; --line2: #ece2d1;
  --ink: #39301f; --sub: #6a5a40; --dim: #8a795c;
  --gold: #bd7e12; --teal: #1f9c87; --rose: #cf5870; --green: #3f9560;
  --op: #3f9560; --op-bg: #e4efe6; --dg: #bd7e12; --dg-bg: #f5e8d3; --ou: #cf5870; --ou-bg: #f6e2e5;
  --shadow: 0 10px 30px rgba(57, 48, 31, .14);
}
:root[data-theme="dark"] {
  --bg: #211c15; --card: #2c2619; --card2: #352d1e; --line: #463c28; --line2: #3d3423;
  --ink: #f1e8d6; --sub: #c9b89a; --dim: #9c8b6c;
  --gold: #e3a94a; --teal: #3fc0aa; --rose: #e07d92; --green: #5cb47e;
  --op: #5cb47e; --op-bg: #26382c; --dg: #e3a94a; --dg-bg: #3d3320; --ou: #e07d92; --ou-bg: #3d2830;
  --shadow: 0 10px 30px rgba(0, 0, 0, .4);
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body {
  font-family: 'Noto Sans TC', 'PingFang TC', 'Microsoft JhengHei', -apple-system, 'Segoe UI', sans-serif;
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
}
.wrap { max-width: 1140px; margin: 0 auto; padding: 30px 26px 90px; }

/* shared top nav (T15, EPB-56145) — 服務總覽/事件紀錄/每日AI健檢報告/主機資料庫 */
.topnav { display: flex; gap: 4px; flex-wrap: wrap; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 6px; margin-bottom: 16px; }
.topnav-link { font-size: 13px; font-weight: 600; color: var(--sub); text-decoration: none; padding: 8px 14px; border-radius: 8px; transition: .15s; }
.topnav-link:hover { background: var(--card2); color: var(--ink); }
.topnav-link.on { background: var(--ink); color: var(--bg); }

.top { display: flex; align-items: baseline; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 16px; }
h1 { font-size: 24px; font-weight: 800; margin: 0; }
.stamp { font-size: 12px; color: var(--dim); }
.c-op { color: var(--op); } .c-dg { color: var(--dg); } .c-ou { color: var(--ou); } .c-dim { color: var(--dim); }

.themebtn {
  font: inherit; font-size: 12.5px; font-weight: 600; color: var(--sub);
  background: var(--card); border: 1px solid var(--line); border-radius: 9px;
  padding: 7px 13px; cursor: pointer;
}
.themebtn:hover { background: var(--card2); }

.dot { width: 9px; height: 9px; border-radius: 50%; flex: none; position: relative; display: inline-block; }
.dot.op { background: var(--op); } .dot.dg { background: var(--dg); } .dot.ou { background: var(--ou); } .dot.nd { background: var(--dim); }
.dot.lg { width: 13px; height: 13px; }

.chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 20px; font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.chip.op { background: var(--op-bg); color: var(--op); }
.chip.dg { background: var(--dg-bg); color: var(--dg); }
.chip.ou { background: var(--ou-bg); color: var(--ou); }
.chip.nd { background: var(--card2); color: var(--dim); }
.chip.sm { padding: 3px 8px; font-size: 11px; }

.health { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 13px 18px; margin-bottom: 16px; }
.health .lead { font-size: 12.5px; color: var(--sub); font-weight: 600; }
.health .cnt { font-size: 12.5px; font-weight: 700; }
.health .sep { color: var(--line); }
.health .spacer { flex: 1; }

/* B list — generous spacing */
.list { display: flex; flex-direction: column; gap: 12px; }
.lrow { display: grid; grid-template-columns: 190px 120px 1fr 92px; gap: 24px; align-items: center; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px 26px; cursor: pointer; transition: .15s; }
.lrow:hover { border-color: var(--teal); box-shadow: var(--shadow); }
.lrow .cn { font-size: 21px; font-weight: 800; }
.lrow .lbl { font-size: 12px; color: var(--dim); margin-top: 3px; font-family: ui-monospace, 'SF Mono', Menlo, monospace; }
.lrow .note { font-size: 11.5px; color: var(--sub); margin-top: 5px; }
.lrow .up { font-size: 19px; font-weight: 700; text-align: right; }
.lrow .upl { font-size: 10.5px; color: var(--dim); text-align: right; margin-top: 2px; }
.bar90 { display: flex; gap: 2px; height: 42px; align-items: stretch; }
.bar90 i { flex: 1; min-width: 0; border-radius: 1.5px; background: var(--op); cursor: pointer; transition: transform .1s; }
.bar90 i.dg { background: var(--dg); } .bar90 i.ou { background: var(--ou); } .bar90 i.nd { background: var(--line); }
/* T15 round 2 (EPB-56145): every bar is a fixed 90-cell grid now — days
   before a service existed (or before 90 days of history accumulated) are
   neutral "no history yet" cells, visually distinct from .nd (a day that
   *was* monitored but came back no_data). */
.bar90 i.empty { background: var(--card2); }
.bar90 i:hover { transform: scaleY(1.12); }
.barhead { display: flex; justify-content: space-between; font-size: 10.5px; color: var(--dim); margin-bottom: 5px; }

/* tooltip (claude-status style) */
.tip { position: fixed; z-index: 60; background: var(--ink); color: var(--bg); border-radius: 8px; padding: 9px 12px; font-size: 11.5px; line-height: 1.5; max-width: 260px; pointer-events: none; opacity: 0; transform: translateY(4px); transition: opacity .12s, transform .12s; box-shadow: var(--shadow); }
.tip.show { opacity: 1; transform: none; }
.tip .td { font-weight: 700; margin-bottom: 2px; }
.tip .ts { display: inline-flex; align-items: center; gap: 5px; }
.tip .ta { margin-top: 3px; color: var(--dim); }
.hint { font-size: 12px; color: var(--dim); margin: 16px 2px 0; text-align: center; }

/* centered modal */
.mscrim { position: fixed; inset: 0; background: rgba(57, 48, 31, .34); opacity: 0; pointer-events: none; transition: .2s; z-index: 50; display: flex; align-items: center; justify-content: center; padding: 24px; }
.mscrim.open { opacity: 1; pointer-events: auto; }
.modal { background: var(--bg); border: 1px solid var(--line); border-radius: 16px; width: 640px; max-width: 100%; max-height: 86vh; overflow-y: auto; box-shadow: var(--shadow); transform: scale(.96); transition: transform .22s cubic-bezier(.33, 1, .68, 1); }
.mscrim.open .modal { transform: none; }
.mpad { padding: 24px 26px 30px; }
.mhead { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 6px; }
.mhead h3 { font-size: 20px; font-weight: 800; margin: 0; display: flex; align-items: center; gap: 11px; }
.msub { font-size: 12.5px; color: var(--dim); margin-bottom: 18px; }
.x { font-size: 24px; line-height: 1; color: var(--dim); background: none; border: none; cursor: pointer; padding: 2px 6px; }
.x:hover { color: var(--ink); }
.sect { margin-top: 18px; }
.sect h4 { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; color: var(--sub); margin: 0 0 10px; }
.svc { background: var(--card); border: 1px solid var(--line); border-radius: 9px; padding: 13px 16px; }
.svc + .svc { margin-top: 8px; }
.svc-top { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; }
.svc .n { font-size: 14px; font-weight: 600; display: flex; align-items: center; gap: 9px; font-family: ui-monospace, 'SF Mono', Menlo, monospace; }
.svc .i { font-size: 11.5px; color: var(--dim); margin-top: 3px; font-family: inherit; }
.svc .val { font-size: 15px; font-weight: 700; text-align: right; }
/* AC2 (T15, EPB-56145): per-service 90-day bar inside the country modal —
   same .bar90/.barhead component as the B-list (renderListHTML), just
   shorter so ~4 service cards still fit the modal's max-height. */
.svc-b90 { margin-top: 10px; }
.svc-b90 .bar90 { height: 24px; }

.foot { margin-top: 26px; font-size: 11.5px; color: var(--dim); text-align: center; line-height: 1.7; }

/* generic card wrapper (used by T11 daily-report list items) */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; }

/* incident history (T10, claude-status style) */
.inc { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; }
.inc + .inc { margin-top: 12px; }
.inc.ongoing { border-left: 3px solid var(--ou); }
.inc .ih { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.inc .it { font-size: 15px; font-weight: 700; display: flex; align-items: center; gap: 9px; }
.inc .im { font-size: 12px; color: var(--dim); margin-top: 4px; }
.inc .dur { font-size: 12px; font-weight: 700; white-space: nowrap; text-align: right; }
.inc .dur .dl { font-size: 10.5px; color: var(--dim); font-weight: 400; }
.tline { margin-top: 14px; padding-left: 4px; }
.tev { display: grid; grid-template-columns: 74px 12px 1fr; gap: 10px; align-items: start; font-size: 12.5px; }
.tev + .tev { margin-top: 2px; }
.tev .tt { color: var(--dim); text-align: right; padding-top: 1px; }
.tev .tm { position: relative; }
.tev .tm::before { content: ""; position: absolute; left: 4px; top: 5px; width: 5px; height: 5px; border-radius: 50%; background: var(--sub); }
.tev .tm.res::before { background: var(--op); } .tev .tm.idn::before { background: var(--dg); } .tev .tm.inv::before { background: var(--ou); }
.tev:not(:last-child) .tm::after { content: ""; position: absolute; left: 6px; top: 9px; bottom: -6px; width: 1px; background: var(--line); }
.tev .tstage { font-weight: 700; }
.tev .tbody { color: var(--sub); }

.view { display: none; } .view.on { display: block; }

@media (max-width: 640px) {
  .wrap { padding: 18px 12px 60px; }
  .lrow { grid-template-columns: 1fr auto; gap: 10px; }
  .lrow .b90wrap { grid-column: 1 / -1; order: 5; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
