:root {
  --ink: #0B0C0F;
  --panel: #151619;
  --panel2: #1C1E22;
  --steel: #8B93A1;
  --silver: #D6DAE0;
  --white: #F4F5F7;
  --gold: #C6A15B;
  --gold-bright: #E4C687;
  --line: rgba(255,255,255,.09);
  --line-strong: rgba(255,255,255,.16);
  --red: #E5786D;
  --orange: #E3A55A;
  --green: #7CC49A;
  --blue: #7FA8D9;
  --radius: 10px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--ink); color: var(--silver);
  font: 15px/1.6 "IBM Plex Sans", "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", sans-serif;
}
a { color: var(--gold-bright); }
.mono, .num { font-family: "IBM Plex Mono", ui-monospace, monospace; font-variant-numeric: tabular-nums; }
.brand { display: flex; align-items: center; gap: 10px; font-family: Oswald, sans-serif; letter-spacing: .08em; color: var(--white); font-size: 18px; }
.brand small { color: var(--gold); font-family: "IBM Plex Sans", sans-serif; letter-spacing: .1em; font-size: 13px; }
header.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 20px; border-bottom: 1px solid var(--line); background: var(--panel); position: sticky; top: 0; z-index: 5; }
main { max-width: 1180px; margin: 0 auto; padding: 20px 16px 60px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 16px; }
.card h2 { margin: 0 0 14px; font-size: 16px; color: var(--white); font-weight: 600; }
h1 { color: var(--white); font-weight: 600; }
.muted { color: var(--steel); }
.hidden { display: none !important; }

label { display: block; font-size: 13px; color: var(--steel); margin-bottom: 4px; }
input, select, textarea {
  width: 100%; padding: 10px 12px; font: inherit; color: var(--white);
  background: var(--panel2); border: 1px solid var(--line-strong); border-radius: 8px; outline: none;
}
input:focus, select:focus { border-color: var(--gold); }
input[type=checkbox] { width: auto; accent-color: var(--gold); }
.field { margin-bottom: 12px; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.row > .field { flex: 1 1 140px; margin-bottom: 0; }

button, .btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 16px; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none;
  color: var(--ink); background: var(--gold); border: 1px solid var(--gold); border-radius: 8px; white-space: nowrap;
}
button:hover, .btn:hover { background: var(--gold-bright); }
button:disabled { opacity: .5; cursor: not-allowed; }
button.ghost, .btn.ghost { background: transparent; color: var(--silver); border-color: var(--line-strong); }
button.ghost:hover, .btn.ghost:hover { border-color: var(--gold); color: var(--white); }
button.danger { background: transparent; color: var(--red); border-color: rgba(229,120,109,.4); }
button.small { padding: 4px 10px; font-size: 13px; font-weight: 500; }

.msg { margin-top: 10px; font-size: 14px; min-height: 1.4em; }
.msg.err { color: var(--red); }
.msg.ok { color: var(--green); }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { color: var(--steel); font-weight: 500; font-size: 13px; position: sticky; top: 0; background: var(--panel); }
td.num, th.num { text-align: right; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: var(--panel2); }
tr.off td { color: var(--steel); background: rgba(255,255,255,.015); }
.table-wrap { overflow-x: auto; }

.tag { display: inline-block; padding: 1px 8px; margin: 1px 4px 1px 0; border-radius: 99px; font-size: 12px; border: 1px solid currentColor; white-space: nowrap; }
.tag.red { color: var(--red); } .tag.orange { color: var(--orange); }
.tag.green { color: var(--green); } .tag.blue { color: var(--blue); } .tag.gray { color: var(--steel); }

.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
.stat { background: var(--panel2); border-radius: 8px; padding: 10px 12px; }
.stat .k { font-size: 12px; color: var(--steel); }
.stat .v { font-size: 22px; color: var(--white); font-family: "IBM Plex Mono", monospace; }
.stat .v small { font-size: 13px; color: var(--steel); margin-left: 3px; }
.stat.warn .v { color: var(--orange); } .stat.bad .v { color: var(--red); }

.tabs { display: flex; gap: 4px; overflow-x: auto; border-bottom: 1px solid var(--line); margin-bottom: 18px; }
.tabs button { background: none; border: none; border-bottom: 2px solid transparent; border-radius: 0; color: var(--steel); padding: 10px 14px; }
.tabs button.active { color: var(--white); border-bottom-color: var(--gold); }

dialog { background: var(--panel); color: var(--silver); border: 1px solid var(--line-strong); border-radius: var(--radius); padding: 20px; width: min(440px, calc(100vw - 32px)); }
dialog::backdrop { background: rgba(0,0,0,.6); }
dialog h3 { margin: 0 0 14px; color: var(--white); }
.actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 14px; flex-wrap: wrap; }

@media print {
  :root { --ink:#fff; --panel:#fff; --panel2:#f3f3f3; --silver:#111; --white:#000; --steel:#555; --line:#ccc; --line-strong:#999; }
  header.top, .tabs, .no-print, button { display: none !important; }
  .card { border: none; padding: 0; }
  th { position: static; }
}
