:root {
  --bg: #f6f7f9;
  --surface: #fff;
  --text: #1d2330;
  --muted: #6b7280;
  --border: #e3e6eb;
  --accent: #5b4bdb;
  --accent-text: #fff;
  --danger: #c0362c;
  --ok-bg: #e8f6ee;
  --ok-text: #17663a;
  --err-bg: #fdecea;
  --err-text: #8f1d14;
  --secret-bg: #fff7e0;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14161b;
    --surface: #1d2027;
    --text: #e6e8ec;
    --muted: #9aa1ad;
    --border: #2e323b;
    --accent: #8b7ff0;
    --accent-text: #111;
    --danger: #f07167;
    --ok-bg: #173324;
    --ok-text: #8fe0b0;
    --err-bg: #3a1a17;
    --err-text: #ffb4ab;
    --secret-bg: #3a3014;
  }
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font: 14px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 12px 24px; background: var(--surface); border-bottom: 1px solid var(--border);
}
.brand { font-weight: 700; color: var(--text); }
.brand span { color: var(--accent); font-weight: 500; }
nav { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
main { max-width: 1100px; margin: 0 auto; padding: 24px 16px 64px; }
h1 { font-size: 22px; margin: 0 0 16px; }
h2 { font-size: 16px; margin: 0 0 12px; }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  padding: 20px; margin-bottom: 20px;
}
.muted { color: var(--muted); }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.row > label { flex: 1 1 160px; }
label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
input, select {
  font: inherit; color: var(--text); background: var(--bg);
  border: 1px solid var(--border); border-radius: 6px; padding: 7px 9px; min-width: 0;
}
button {
  font: inherit; border: 1px solid var(--accent); background: var(--accent); color: var(--accent-text);
  border-radius: 6px; padding: 7px 14px; cursor: pointer; white-space: nowrap;
}
button.secondary { background: transparent; color: var(--accent); }
button.danger { background: transparent; color: var(--danger); border-color: var(--danger); }
button.link { background: none; border: none; color: var(--accent); padding: 0; }
button:disabled { opacity: .5; cursor: not-allowed; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { font-size: 12px; color: var(--muted); font-weight: 600; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td .actions { display: flex; gap: 6px; flex-wrap: wrap; }
code { font: 13px ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--bg); padding: 2px 6px; border-radius: 4px; }
.badge { display: inline-block; font-size: 12px; padding: 1px 8px; border-radius: 99px; background: var(--bg); border: 1px solid var(--border); }
.badge.off { color: var(--danger); border-color: var(--danger); }
.flash { max-width: 1100px; margin: 16px auto 0; padding: 10px 14px; border-radius: 8px; }
.flash.ok { background: var(--ok-bg); color: var(--ok-text); }
.flash.err { background: var(--err-bg); color: var(--err-text); }
.secret { background: var(--secret-bg); border-radius: 8px; padding: 14px; margin-bottom: 20px; }
.secret code { font-size: 15px; }
.login { max-width: 360px; margin: 64px auto; }
.login form { display: flex; flex-direction: column; gap: 12px; }
@media (max-width: 640px) {
  .topbar { padding: 12px 16px; flex-direction: column; align-items: flex-start; }
}

[hidden] { display: none !important; }
