:root {
  --ink: #1f2329; --muted: #646a73; --line: #e4e6ea; --bg: #f5f6f8; --card: #fff;
  --accent: #3370ff; --danger: #d83931; --ok: #2ea121; --warn: #d97706;
  color-scheme: light;
}
* { box-sizing: border-box; }
body { margin: 0; font: 14px/1.5 system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif; color: var(--ink); background: var(--bg); }
h2 { font-size: 16px; margin: 0; }
button { font: inherit; border: 1px solid var(--line); background: #fff; color: var(--ink); border-radius: 8px; padding: 6px 12px; cursor: pointer; }
button:hover:not(:disabled) { border-color: #c9cdd4; background: #fafafa; }
button:disabled { opacity: .45; cursor: default; }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.primary:hover:not(:disabled) { background: #245bdb; }
button.danger { color: var(--danger); }
button.link { border: 0; background: none; color: var(--accent); padding: 0; }
button.icon { border: 0; background: none; font-size: 20px; line-height: 1; padding: 2px 6px; color: var(--muted); }
button.wide { width: 100%; padding: 10px; }
input, select { font: inherit; width: 100%; padding: 8px 10px; border: 1px solid #d0d3d6; border-radius: 8px; background: #fff; color: var(--ink); }
input:focus, select:focus { outline: 2px solid #3370ff40; border-color: var(--accent); }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; }
.brand { font-weight: 700; font-size: 16px; letter-spacing: .3px; }
.brand.big { font-size: 26px; }
.center { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login { width: min(380px, 100%); display: grid; gap: 12px; }
.field { display: grid; gap: 4px; }
.field > span { font-weight: 600; font-size: 13px; }
.field small { color: var(--muted); font-size: 12px; }
.status { min-height: 1.4em; margin: 0; color: var(--danger); font-size: 13px; }
.top { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 24px; background: #fffffff2; border-bottom: 1px solid var(--line); }
.who { display: flex; align-items: center; gap: 8px; color: var(--muted); }
.page { max-width: 1160px; margin: 0 auto; padding: 20px 24px 48px; display: grid; gap: 16px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.stat { display: grid; gap: 4px; }
.stat strong { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.big-number { font-size: 32px; font-weight: 700; margin: 8px 0 0; }
.toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.toolbar h2 { margin-right: auto; }
.toolbar input { width: 200px; }
.table-wrap { overflow-x: auto; }
.table-wrap.tall { max-height: 60vh; overflow-y: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; white-space: nowrap; }
th { font-size: 12px; font-weight: 600; color: var(--muted); background: #fafbfc; position: sticky; top: 0; }
tr.disabled td { color: var(--muted); }
td.num { font-variant-numeric: tabular-nums; }
td.low, td.minus { color: var(--danger); }
td.plus { color: var(--ok); }
td.empty { text-align: center; color: var(--muted); padding: 28px; white-space: normal; }
.name { font-weight: 600; }
.actions { display: flex; gap: 6px; flex-wrap: wrap; }
.actions button { padding: 4px 10px; font-size: 13px; }
.tag { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; background: #f0f1f3; color: var(--muted); margin-right: 4px; }
.tag.on { background: #e8f7ec; color: var(--ok); }
.tag.off { background: #fdecec; color: var(--danger); }
.tag.warn { background: #fff4e5; color: var(--warn); }
.backdrop { position: fixed; inset: 0; z-index: 10; display: grid; place-items: center; padding: 20px; background: #0f172a66; }
.modal { width: min(440px, 100%); max-height: calc(100vh - 40px); overflow: auto; background: #fff; border-radius: 14px; padding: 18px 20px; box-shadow: 0 20px 50px #0003; }
.modal.wide { width: min(760px, 100%); }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.form { display: grid; gap: 12px; }
.form p { margin: 0; }
.buttons { display: flex; justify-content: flex-end; gap: 8px; }
.notice { padding: 10px 12px; border-radius: 8px; background: #fff4e5; color: #92400e; }
.secret { font-family: ui-monospace, Consolas, monospace; font-size: 16px; letter-spacing: .5px; }
.toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); z-index: 20; padding: 10px 16px; border-radius: 10px; background: #1f2329; color: #fff; box-shadow: 0 8px 24px #0003; max-width: calc(100vw - 40px); }
.toast.error { background: var(--danger); }
@media (max-width: 720px) { .top, .page { padding-left: 12px; padding-right: 12px; } .toolbar input { width: 100%; } }
