:root {
  --bg: #f6f7f5;
  --surface: #ffffff;
  --surface-2: #f0f2ef;
  --text: #1c2320;
  --muted: #5f6b66;
  --border: #dde2de;
  --accent: #1f6f5c;
  --accent-text: #ffffff;
  --online: #1d8a4e;
  --offline: #9aa3a0;
  --danger: #b3261e;
  --warn-bg: #fff4d6;
  --warn-text: #6b4e00;
  --code-bg: #eef1ee;
  --radius: 10px;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111513;
    --surface: #181d1b;
    --surface-2: #1f2522;
    --text: #e3e8e5;
    --muted: #97a39e;
    --border: #2c3431;
    --accent: #4fb495;
    --accent-text: #0c1411;
    --online: #43c47f;
    --offline: #66706c;
    --danger: #ff8a80;
    --warn-bg: #3a3014;
    --warn-text: #f3d27a;
    --code-bg: #202724;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, sans-serif;
}
[hidden] { display: none !important; }
a { color: var(--accent); }
code, pre, .mono { font-family: var(--mono); font-size: 0.9em; }
code { background: var(--code-bg); padding: 1px 5px; border-radius: 4px; }
pre {
  background: var(--code-bg);
  padding: 12px 14px;
  border-radius: 8px;
  overflow-x: auto;
  white-space: pre;
}
pre code { background: none; padding: 0; }
h1, h2, h3 { line-height: 1.25; }
h2 { font-size: 1.25rem; margin: 0 0 12px; }
h3 { font-size: 1.05rem; margin: 22px 0 8px; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }

/* top bar */
.topbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 20px; flex-wrap: wrap;
  padding: 10px 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 650; color: var(--text); text-decoration: none; }
nav { display: flex; gap: 4px; flex-wrap: wrap; }
nav a {
  padding: 6px 12px; border-radius: 8px;
  color: var(--muted); text-decoration: none; font-weight: 500;
}
nav a:hover { background: var(--surface-2); color: var(--text); }
nav a.active { background: var(--surface-2); color: var(--text); }
.who { margin-left: auto; display: flex; gap: 12px; align-items: center; color: var(--muted); font-size: 0.9rem; }

main { max-width: 1120px; margin: 0 auto; padding: 24px 16px 64px; }

/* buttons & inputs */
button, .button {
  font: inherit; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  padding: 7px 14px; border-radius: 8px;
}
button:hover { background: var(--surface-2); }
button.primary { background: var(--accent); color: var(--accent-text); border-color: var(--accent); font-weight: 600; }
button.primary:hover { filter: brightness(1.08); }
button.danger { color: var(--danger); }
button.link { border: none; background: none; padding: 0; color: var(--accent); }
button:disabled { opacity: 0.55; cursor: default; }
input, select {
  font: inherit; color: var(--text); background: var(--surface);
  border: 1px solid var(--border); border-radius: 8px; padding: 7px 10px;
}
label { display: grid; gap: 4px; font-size: 0.9rem; color: var(--muted); }

/* sign-in */
.signin { max-width: 380px; margin: 12vh auto; text-align: center; }
.signin h1 { margin: 12px 0 4px; }

/* cards */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin-bottom: 20px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; }
.card .label { color: var(--muted); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em; }
.card .value { font-size: 1.35rem; font-weight: 650; margin-top: 2px; overflow-wrap: anywhere; }
.card .value.small-value { font-size: 1rem; font-family: var(--mono); }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; margin-bottom: 20px; }
.banner { background: var(--warn-bg); color: var(--warn-text); border-radius: 8px; padding: 10px 14px; margin-bottom: 16px; }
.error-text { color: var(--danger); }

/* tables */
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
th, td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); font-weight: 600; background: var(--surface-2); }
tr:last-child td { border-bottom: none; }
td .sub { display: block; color: var(--muted); font-size: 0.82rem; }
.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }

.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 8px; background: var(--offline); vertical-align: 1px; }
.dot.on { background: var(--online); box-shadow: 0 0 0 3px color-mix(in srgb, var(--online) 22%, transparent); }
.pill { display: inline-block; font-size: 0.75rem; padding: 1px 8px; border-radius: 99px; background: var(--surface-2); color: var(--muted); margin-left: 6px; }

/* forms */
.form-row { display: flex; gap: 12px; flex-wrap: wrap; align-items: end; }
.form-row input[name=name] { min-width: 200px; }
.steps li { margin-bottom: 8px; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; margin: 12px 0; }

/* guide */
.guide { max-width: 820px; }
.guide section { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 6px 22px 16px; margin-bottom: 16px; }
.guide h2 { margin-top: 16px; }
.guide table { font-size: 0.88rem; }
.guide .toc { columns: 2; padding-left: 18px; }

@media (max-width: 640px) {
  .topbar { padding: 10px 12px; gap: 10px; }
  .who { margin-left: 0; width: 100%; justify-content: space-between; }
  .guide .toc { columns: 1; }
  th, td { padding: 8px 10px; }
}

.view-head { margin-bottom: 14px; }
.view-head h2 { margin: 0; flex: 1; }
