:root {
  --bg: #f6f7f9; --panel: #ffffff; --ink: #111827; --muted: #6b7280; --line: #e5e7eb;
  --side: #0f172a; --side-ink: #cbd5e1; --side-active: #1e293b; --accent: #2563eb; --accent-ink: #fff;
  --ok: #15803d; --ok-bg: #dcfce7; --warn: #b45309; --warn-bg: #fef3c7; --bad: #b91c1c; --bad-bg: #fee2e2;
  --chip: #eef2ff; --chip-ink: #3730a3; --radius: 10px;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1120; --panel: #111827; --ink: #e5e7eb; --muted: #9ca3af; --line: #1f2937;
    --side: #020617; --side-ink: #94a3b8; --side-active: #111827; --accent: #3b82f6;
    --ok: #4ade80; --ok-bg: #052e16; --warn: #fbbf24; --warn-bg: #2a1d05; --bad: #f87171; --bad-bg: #2a0b0b;
    --chip: #1e1b4b; --chip-ink: #c7d2fe;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink);
  font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; margin: 0 0 4px; letter-spacing: -.01em; }
h2 { font-size: 16px; margin: 0 0 12px; }
h3 { font-size: 14px; margin: 16px 0 8px; }
p { margin: 0 0 10px; }
.muted { color: var(--muted); }
.mono, code, pre { font-family: var(--mono); font-size: 12.5px; }

.layout { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.side { background: var(--side); color: var(--side-ink); padding: 18px 12px; position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; gap: 2px; }
.brand { color: #fff; font-weight: 700; font-size: 15px; padding: 4px 10px 16px; display: flex; gap: 8px; align-items: center; }
.brand-dot { width: 10px; height: 10px; border-radius: 3px; background: linear-gradient(135deg, #60a5fa, #a78bfa); }
.side a { color: var(--side-ink); padding: 8px 10px; border-radius: 8px; display: flex; gap: 10px; align-items: center; }
.side a:hover { background: var(--side-active); color: #fff; text-decoration: none; }
.side a.active { background: var(--side-active); color: #fff; }
.side .sep { margin: 14px 10px 6px; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: #64748b; }
.side .grow { flex: 1; }
.side .who { font-size: 12px; padding: 8px 10px; color: #94a3b8; border-top: 1px solid #1e293b; margin-top: 8px; }
.side form button { background: none; border: 0; color: var(--side-ink); padding: 0; cursor: pointer; font: inherit; }
.side form button:hover { color: #fff; text-decoration: underline; }

main { padding: 28px 32px 60px; max-width: 1240px; width: 100%; }
.head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.head .actions { display: flex; gap: 8px; flex-wrap: wrap; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 16px; }
.grid { display: grid; gap: 16px; }
.grid.c2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.c3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.c4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stat .label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .05em; }
.stat .value { font-size: 24px; font-weight: 650; margin-top: 2px; }
.stat .sub { color: var(--muted); font-size: 12.5px; }

table.t { width: 100%; border-collapse: collapse; }
table.t th, table.t td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.t th { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
table.t tr:hover td { background: color-mix(in srgb, var(--accent) 4%, transparent); }
table.t td.num, table.t th.num { text-align: right; font-variant-numeric: tabular-nums; }
.scroll { overflow-x: auto; }

.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--panel);
  color: var(--ink); padding: 7px 12px; border-radius: 8px; cursor: pointer; font: inherit; font-weight: 550; }
.btn:hover { border-color: var(--muted); text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.danger { color: var(--bad); }
.btn.small { padding: 4px 9px; font-size: 12.5px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
form.inline { display: inline; }

.pill { display: inline-block; padding: 1px 8px; border-radius: 99px; font-size: 12px; font-weight: 600; }
.pill.ok { background: var(--ok-bg); color: var(--ok); }
.pill.warn { background: var(--warn-bg); color: var(--warn); }
.pill.bad { background: var(--bad-bg); color: var(--bad); }
.pill.info { background: var(--chip); color: var(--chip-ink); }
.pill.off { background: var(--line); color: var(--muted); }

.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 16px; }
.flash.ok { background: var(--ok-bg); color: var(--ok); }
.flash.bad { background: var(--bad-bg); color: var(--bad); }

label { display: block; font-weight: 600; margin: 12px 0 4px; font-size: 13px; }
label .hint, .hint { font-weight: 400; color: var(--muted); font-size: 12.5px; }
input[type=text], input[type=password], input[type=number], input[type=search], select, textarea {
  width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel);
  color: var(--ink); font: inherit; }
input:focus, select:focus { outline: 2px solid color-mix(in srgb, var(--accent) 40%, transparent); border-color: var(--accent); }
.check { display: flex; gap: 8px; align-items: center; font-weight: 500; margin: 8px 0; }
.row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
.row3 { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 0 16px; }

.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 12px; flex-wrap: wrap; }
.toolbar input[type=search] { max-width: 280px; }
.toolbar select { max-width: 220px; }
.sticky-save { position: sticky; bottom: 0; background: var(--panel); border-top: 1px solid var(--line);
  padding: 12px 0 0; margin-top: 12px; display: flex; gap: 10px; align-items: center; }
.cols { columns: 3 220px; column-gap: 24px; }
.cols .check { break-inside: avoid; margin: 4px 0; font-family: var(--mono); font-size: 12.5px; }
pre.log { background: #0b1020; color: #d1d5db; padding: 14px; border-radius: 8px; overflow: auto; max-height: 70vh;
  white-space: pre-wrap; word-break: break-word; }
.types { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; margin-top: 6px; }
.types label { margin: 0; border: 1px solid var(--line); border-radius: 8px; padding: 10px; cursor: pointer; font-weight: 600; }
.types input { margin-right: 6px; }
.types label:has(input:checked) { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, transparent); }
details summary { cursor: pointer; font-weight: 600; }
.qr svg { width: 200px; height: 200px; background: #fff; border-radius: 8px; }

.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login { width: 100%; max-width: 380px; }
.login .brand { color: var(--ink); padding: 0 0 14px; font-size: 18px; }

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; }
  .side .sep, .side .grow { display: none; }
  main { padding: 18px 16px; }
  .grid.c2, .grid.c3, .grid.c4, .row, .row3, .types { grid-template-columns: 1fr; }
}
