:root {
  --bg: #0f1419;
  --panel: #171e27;
  --line: #2a3441;
  --text: #e8eef4;
  --muted: #93a1b1;
  --accent: #3d8bfd;
  --warn: #d97706;
  --bad: #dc4c64;
  --ok: #3aa776;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Noto Sans TC", "Microsoft JhengHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex;
  min-height: 100vh;
}
.sidebar {
  width: 220px;
  background: var(--panel);
  border-right: 1px solid var(--line);
  padding: 20px 16px;
  position: sticky;
  top: 0;
  height: 100vh;
}
.brand { font-weight: 700; margin-bottom: 20px; letter-spacing: 0.04em; }
nav { display: flex; flex-direction: column; gap: 4px; }
nav a {
  color: var(--muted);
  text-decoration: none;
  padding: 8px 10px;
  border-radius: 6px;
}
nav a.active, nav a:hover { background: #222b36; color: var(--text); }
.search { margin-top: 24px; }
.search label, .asof, .footnote, .muted { color: var(--muted); font-size: 12px; }
.search input, select, input[type=text], input[type=password], input[type=number] {
  width: 100%;
  margin-top: 4px;
  padding: 8px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--text);
  border-radius: 4px;
}
.asof { margin-top: 16px; }
.running { color: var(--warn); font-size: 12px; }
main { flex: 1; padding: 28px 32px 48px; overflow-x: auto; }
h1 { font-size: 22px; margin: 0 0 8px; }
h2 { font-size: 16px; margin: 24px 0 8px; font-weight: 600; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px 16px;
}
.card .k { color: var(--muted); font-size: 12px; }
.card .v { font-size: 20px; margin-top: 6px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-weight: 600; }
a { color: var(--accent); }
.filters { display: flex; gap: 12px; flex-wrap: wrap; align-items: end; margin: 16px 0; }
.filters label { font-size: 12px; color: var(--muted); display: block; }
button, .btn {
  background: var(--accent);
  color: #fff;
  border: 0;
  padding: 8px 14px;
  border-radius: 4px;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}
button.secondary { background: #334155; }
.msg { background: #1e293b; padding: 10px 12px; border-radius: 6px; margin-bottom: 12px; }
.log {
  background: #0b0f14;
  border: 1px solid var(--line);
  padding: 12px;
  white-space: pre-wrap;
  max-height: 360px;
  overflow: auto;
  font-size: 12px;
  font-family: ui-monospace, Consolas, monospace;
}
.footnote { margin-top: 32px; }
.badge { font-size: 11px; padding: 2px 6px; border-radius: 4px; background: #334155; }
.badge.warn { background: #7c2d12; }
.empty { color: var(--muted); padding: 24px 0; }
body.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
}
.login-card {
  width: min(420px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 28px 24px 24px;
}
.login-card h1 { margin-bottom: 8px; }
.login-card form { display: flex; flex-direction: column; gap: 6px; margin-top: 16px; }
.login-card label { font-size: 12px; color: var(--muted); margin-top: 8px; }
.login-card button { margin-top: 16px; }
.captcha-row { display: flex; gap: 10px; align-items: center; }
.captcha-row input { flex: 1; margin-top: 0; }
.captcha-box {
  flex: 0 0 168px;
  height: 52px;
  background: #f8fafc;
  border-radius: 6px;
  overflow: hidden;
  cursor: pointer;
  border: 1px solid var(--line);
}
.captcha-box svg { display: block; width: 168px; height: 52px; }
.captcha-hint { margin: 6px 0 0; }
.password-form { display: flex; flex-direction: column; gap: 10px; max-width: 360px; margin: 12px 0 24px; }
.password-form label { font-size: 12px; color: var(--muted); }
.password-form button { align-self: flex-start; }
.col-help {
  display: grid;
  gap: 6px 20px;
  margin: 12px 0 4px;
  padding: 12px 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 12px;
  color: var(--muted);
}
@media (min-width: 720px) {
  .col-help { grid-template-columns: 1fr 1fr; }
}
.col-help div {
  display: grid;
  grid-template-columns: 5.5rem 1fr;
  gap: 8px;
  align-items: start;
}
.col-help.wide div { grid-template-columns: 6.5rem 1fr; }
.col-help dt { margin: 0; font-weight: 600; color: var(--text); }
.col-help dd { margin: 0; }
th[title] { cursor: help; }
@media (max-width: 720px) {
  body { display: block; }
  .sidebar { width: auto; height: auto; position: static; }
  .captcha-row { flex-direction: column; align-items: stretch; }
  .captcha-box { flex: none; width: 100%; max-width: 168px; }
}
