:root {
  --bg: #f5f6f8; --card: #fff; --text: #1f2328; --muted: #656d76; --line: #d8dee4;
  --brand: #1f6feb; --red: #cf222e; --red-bg: #ffebe9; --yellow: #9a6700; --yellow-bg: #fff8c5;
  --green: #1a7f37; --green-bg: #dafbe1; --gray: #6e7781; --gray-bg: #eaeef2;
}
* { box-sizing: border-box; }
body { margin: 0; font: 15px/1.55 -apple-system, "Segoe UI", "Microsoft JhengHei", "PingFang TC", sans-serif; background: var(--bg); color: var(--text); }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
header.top { background: #24292f; color: #fff; padding: 0 16px; display: flex; align-items: center; gap: 16px; flex-wrap: wrap; min-height: 52px; }
header.top .brand { font-weight: 700; font-size: 16px; color: #fff; white-space: nowrap; }
header.top nav { display: flex; gap: 4px; flex-wrap: wrap; flex: 1; }
header.top nav a { color: #d0d7de; padding: 6px 10px; border-radius: 6px; }
header.top nav a.on, header.top nav a:hover { background: #3d444d; color: #fff; text-decoration: none; }
header.top .me { color: #d0d7de; font-size: 13px; display: flex; gap: 8px; align-items: center; }
header.top .me button { background: none; border: 1px solid #57606a; color: #d0d7de; border-radius: 6px; padding: 3px 8px; cursor: pointer; }
main { max-width: 1280px; margin: 0 auto; padding: 16px; }
h1 { font-size: 22px; margin: 4px 0 12px; }
h2 { font-size: 17px; margin: 20px 0 8px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; margin-bottom: 14px; }
.muted { color: var(--muted); font-size: 13px; }
.flash { background: #ddf4ff; border: 1px solid #54aeff; border-radius: 8px; padding: 8px 12px; margin-bottom: 12px; }
.error { background: var(--red-bg); border: 1px solid #ff8182; border-radius: 8px; padding: 8px 12px; margin-bottom: 12px; color: var(--red); }
.warn { background: var(--yellow-bg); border: 1px solid #d4a72c; border-radius: 8px; padding: 8px 12px; margin-bottom: 12px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.spacer { flex: 1; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; margin-bottom: 14px; }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; }
.tile .n { font-size: 26px; font-weight: 700; }
.tile .l { color: var(--muted); font-size: 13px; }
.tile.red .n { color: var(--red); } .tile.yellow .n { color: var(--yellow); } .tile.green .n { color: var(--green); } .tile.gray .n { color: var(--gray); }
.scroll { overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: 10px; }
table { border-collapse: collapse; width: 100%; }
th, td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; white-space: nowrap; }
th { background: #f6f8fa; font-weight: 600; font-size: 13px; color: var(--muted); }
tr:last-child td { border-bottom: none; }
td.wrap { white-space: normal; min-width: 180px; }
td.num, th.num { text-align: right; }
.pill { display: inline-block; padding: 1px 9px; border-radius: 999px; font-size: 13px; font-weight: 600; }
.pill.red { background: var(--red-bg); color: var(--red); }
.pill.yellow { background: var(--yellow-bg); color: var(--yellow); }
.pill.green { background: var(--green-bg); color: var(--green); }
.pill.gray { background: var(--gray-bg); color: var(--gray); }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }
.dot.red { background: var(--red); } .dot.yellow { background: #d4a72c; } .dot.green { background: var(--green); } .dot.gray { background: #afb8c1; }
.bar { height: 6px; background: var(--gray-bg); border-radius: 3px; margin-top: 3px; min-width: 90px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--brand); }
.bar.hi > i { background: #d4a72c; } .bar.over > i { background: var(--red); }
.bad { color: var(--red); font-weight: 600; } .ok { color: var(--green); }
button, .btn { display: inline-block; background: var(--brand); color: #fff; border: none; border-radius: 8px; padding: 8px 14px; font-size: 14px; cursor: pointer; font-family: inherit; }
.btn:hover { text-decoration: none; filter: brightness(1.08); }
button.light, .btn.light { background: #f6f8fa; color: var(--text); border: 1px solid var(--line); }
button.danger { background: var(--red); }
form.inline { display: inline; }
label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 3px; }
input[type=text], input[type=password], input[type=number], input[type=date], input[type=email], select, textarea {
  width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; font: inherit; background: #fff;
}
textarea { min-height: 70px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px 16px; }
.grid .full { grid-column: 1 / -1; }
.check { display: flex; gap: 8px; align-items: center; color: var(--text); font-size: 14px; }
.check input { width: auto; }
dl.kv { display: grid; grid-template-columns: max-content 1fr; gap: 4px 16px; margin: 0; }
dl.kv dt { color: var(--muted); } dl.kv dd { margin: 0; }
.login { max-width: 360px; margin: 10vh auto; }
.login h1 { text-align: center; }
.login .field { margin-bottom: 12px; }
.login button { width: 100%; padding: 10px; }
footer { text-align: center; color: var(--muted); font-size: 12px; padding: 24px 0; }
@media (max-width: 640px) {
  main { padding: 12px; }
  header.top { padding: 8px 12px; }
  h1 { font-size: 19px; }
  th, td { padding: 7px 8px; }
  .hide-sm { display: none; }
}
