:root {
  --bg: oklch(96.2% 0.01 85);
  --sidebar: oklch(94% 0.014 78);
  --surface: oklch(99.2% 0.004 85);
  --ink: oklch(24% 0.02 65);
  --muted: oklch(46% 0.02 65);
  --faint: oklch(60% 0.015 70);
  --line: oklch(88% 0.012 78);
  --accent: oklch(49% 0.1 52);
  --accent-ink: oklch(38% 0.08 52);
  --accent-soft: oklch(49% 0.1 52 / 0.1);
  --success: oklch(48% 0.1 155);
  --warning: oklch(58% 0.11 75);
  --danger: oklch(50% 0.14 28);
  --sans: "Segoe UI", "PingFang SC", "Noto Sans SC", "Microsoft YaHei", sans-serif;
  --mono: "IBM Plex Mono", "Cascadia Mono", "Sarasa Mono SC", ui-monospace, monospace;
  --shadow: 0 1px 1px oklch(30% 0.02 70 / 0.05), 0 12px 28px oklch(30% 0.02 70 / 0.06);
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.45;
  color: var(--ink);
  background: var(--bg);
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
.mono, .num { font-family: var(--mono); font-variant-numeric: tabular-nums slashed-zero; }
.num { text-align: right; }

.shell { display: grid; grid-template-columns: 220px 1fr; min-height: 100%; }
.sidebar {
  background: var(--sidebar);
  border-right: 1px solid var(--line);
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.brand { display: flex; gap: 8px; align-items: center; padding: 4px 8px 8px; }
.brand strong { display: block; font-size: 16px; letter-spacing: -0.03em; font-weight: 600; }
.brand span { color: var(--muted); font-size: 12px; }
.mark {
  width: 28px; height: 28px; flex: none;
  border: 1.5px solid var(--accent);
  border-radius: 8px;
  position: relative;
}
.mark::before, .mark::after {
  content: "";
  position: absolute;
  left: 6px; right: 6px;
  height: 2px;
  background: var(--accent);
  border-radius: 1px;
}
.mark::before { top: 9px; }
.mark::after { top: 16px; opacity: 0.45; }
nav { display: flex; flex-direction: column; gap: 2px; }
nav button {
  text-align: left;
  background: transparent;
  border: 0;
  border-radius: 6px;
  padding: 8px 12px;
  color: var(--muted);
}
nav button[aria-current="page"] {
  background: var(--accent-soft);
  color: var(--accent-ink);
  box-shadow: inset 2px 0 0 var(--accent);
}
nav button:hover { background: oklch(92% 0.01 80); }
.aside-foot { margin-top: auto; padding: 8px; display: flex; flex-direction: column; gap: 8px; }
.aside-foot p { margin: 0; color: var(--faint); font-size: 12px; }
.aside-foot .endpoint { color: var(--muted); }
.linkish, .ghost, .primary, .danger {
  border-radius: 6px;
  height: 36px;
  padding: 0 12px;
  border: 1px solid transparent;
}
.ghost { background: transparent; border-color: var(--line); }
.ghost:hover { background: oklch(100% 0 0 / 0.6); }
.primary { background: var(--accent); color: oklch(98% 0.01 85); border-color: var(--accent); }
.primary:hover { background: var(--accent-ink); }
.danger { background: transparent; color: var(--danger); border-color: oklch(50% 0.14 28 / 0.35); }
.linkish { background: transparent; border: 0; color: var(--muted); height: auto; padding: 0; text-align: left; }
kbd {
  font-family: var(--mono);
  font-size: 11px;
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 4px;
  padding: 0 4px;
  background: var(--surface);
}

.main { padding: 16px 20px 32px; min-width: 0; }
.top {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-end;
  margin-bottom: 12px;
}
h1 { font-size: 20px; letter-spacing: -0.03em; margin: 0; font-weight: 600; }
.sub { margin: 2px 0 0; color: var(--faint); font-size: 12px; }
.toolbar { display: flex; gap: 8px; align-items: center; }
.toolbar input, .field input {
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  padding: 0 12px;
  min-width: 220px;
}
.toolbar input:focus, .field input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.banner {
  background: oklch(58% 0.11 75 / 0.15);
  border: 1px solid oklch(58% 0.11 75 / 0.4);
  color: oklch(35% 0.06 70);
  border-radius: 6px;
  padding: 8px 12px;
  margin-bottom: 12px;
  font-size: 13px;
}
.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 8px;
}
.split .card h2 { margin: 0 0 8px; font-size: 13px; font-weight: 500; color: var(--muted); }
.section-title { font-size: 14px; font-weight: 500; margin: 16px 0 8px; color: var(--muted); }
.rank { list-style: none; margin: 0; padding: 0; }
.rank li {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}
.rank li:last-child { border-bottom: 0; }
.faint { color: var(--faint); }
.select {
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  padding: 0 8px;
  min-width: 140px;
}
.metrics {
  display: grid;
  grid-template-columns: 1.35fr 1fr 1fr 0.8fr;
  gap: 8px;
  margin-bottom: 8px;
}
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 16px;
}
.card.primary { background: var(--accent-soft); border-color: oklch(49% 0.1 52 / 0.22); }
.card .label { color: var(--muted); font-size: 12px; font-weight: 500; }
.card .value { font-size: 28px; font-weight: 600; letter-spacing: -0.03em; margin-top: 4px; }
.card.primary .value { color: var(--accent-ink); font-size: 34px; }
.card .hint { color: var(--faint); font-size: 12px; margin-top: 4px; }
.chart-card { margin-bottom: 8px; }
.chart-card h2 { margin: 0 0 8px; font-size: 13px; font-weight: 500; color: var(--muted); }
.chart { width: 100%; height: 96px; display: block; }
.note-line { color: var(--faint); font-size: 12px; margin: 0 0 8px; }

.chips { display: flex; gap: 8px; margin: 8px 0; }
.chips button { height: 28px; }
.chips button[aria-pressed="true"] {
  background: var(--accent-soft);
  color: var(--accent-ink);
  border-color: transparent;
}

.table-wrap {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: auto;
  scrollbar-gutter: stable;
}
table { width: 100%; border-collapse: collapse; min-width: 860px; }
th, td { padding: 8px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th {
  position: sticky; top: 0;
  background: oklch(98% 0.006 85);
  font-weight: 500;
  font-size: 12px;
  color: var(--muted);
  text-align: left;
}
th.num, td.num { text-align: right; }
tbody tr { cursor: pointer; }
tbody tr:hover { background: oklch(96% 0.008 80); }
tbody tr[aria-selected="true"] { background: var(--accent-soft); box-shadow: inset 2px 0 0 var(--accent); }
.who { display: flex; flex-direction: column; }
.who b { font-weight: 500; }
.who small { color: var(--faint); font-family: var(--mono); font-size: 12px; }
.octet {
  display: inline-block;
  min-width: 32px;
  text-align: center;
  font-family: var(--mono);
  font-variant-numeric: tabular-nums slashed-zero;
  font-size: 12px;
  color: var(--accent-ink);
  background: var(--accent-soft);
  border-radius: 4px;
  padding: 2px 0;
}
.status { display: inline-flex; align-items: center; gap: 6px; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--faint); }
.dot.on { background: var(--success); }
.dot.off { background: var(--warning); }
.bar {
  height: 4px;
  margin-top: 4px;
  background: oklch(92% 0.008 80);
  border-radius: 2px;
  overflow: hidden;
}
.bar span { display: block; height: 100%; background: var(--accent); opacity: 0.75; }
.row-btn, a.row-btn {
  height: 28px;
  padding: 0 8px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: inherit;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}
.empty { padding: 24px 12px; color: var(--muted); }

.drawer-backdrop, .modal-backdrop {
  position: fixed; inset: 0;
  background: oklch(24% 0.02 65 / 0.18);
  display: flex;
  justify-content: flex-end;
}
.modal-backdrop { align-items: center; justify-content: center; }
.drawer, .modal {
  background: var(--surface);
  box-shadow: var(--shadow);
}
.drawer {
  width: min(400px, 100%);
  height: 100%;
  padding: 16px 20px 24px;
  overflow: auto;
  border-left: 1px solid var(--line);
}
.modal { width: min(420px, calc(100% - 32px)); border-radius: 14px; padding: 16px 20px 20px; }
.drawer h2, .modal h2 { margin: 0; font-size: 18px; letter-spacing: -0.02em; }
.drawer header, .modal header { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.meta { color: var(--muted); font-size: 13px; margin: 8px 0 16px; }
.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.field span { font-size: 12px; color: var(--muted); }
.field input { min-width: 0; width: 100%; }
.hint { color: var(--faint); font-size: 12px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0 16px; }
.qr {
  width: 180px; height: 180px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px;
}
.qr img { width: 100%; height: 100%; }
.danger-zone { margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--line); }
.error { color: var(--danger); font-size: 13px; min-height: 1.2em; }

.login {
  min-height: 100%;
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(280px, 420px);
}
.login-copy {
  padding: 48px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 12px;
  background:
    linear-gradient(180deg, transparent 0 72px, oklch(49% 0.1 52 / 0.18) 72px 74px, transparent 74px),
    var(--sidebar);
  border-right: 1px solid var(--line);
}
.login-copy h1 { font-size: 40px; letter-spacing: -0.04em; }
.login-copy p { margin: 0; max-width: 36ch; color: var(--muted); }
.login form {
  align-self: center;
  padding: 48px 40px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.login form h2 { margin: 0 0 8px; font-size: 16px; font-weight: 500; }
.login label { font-size: 12px; color: var(--muted); }
.login input {
  height: 40px;
  border-radius: 6px;
  border: 1px solid var(--line);
  padding: 0 12px;
  background: var(--surface);
}
.login input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.login button { margin-top: 8px; }

.shortcuts {
  position: fixed; right: 16px; bottom: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 16px;
  box-shadow: var(--shadow);
}
.shortcuts p { margin: 4px 0; font-size: 13px; }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { border-right: 0; border-bottom: 1px solid var(--line); }
  nav { flex-direction: row; }
  .aside-foot { margin-top: 0; }
  .metrics { grid-template-columns: 1fr 1fr; }
  .top { flex-direction: column; align-items: stretch; }
  .login { grid-template-columns: 1fr; }
  .login-copy { min-height: 220px; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
