:root {
  --bg: #0F1316; --surface: #161B1F; --surface-2: #1E2529; --surface-3: #283136;
  --line: #242C31; --text: #E6EDEF; --muted: #8C9AA1; --faint: #5A676E;
  --accent: #00CDDB; --accent-text: #00191C; --accent-soft: #0D3236;
  --good: #5FD38E; --good-soft: #16352A; --warn: #E8B451; --warn-soft: #3A321F;
  --bad: #F06B6B; --bad-soft: #3C2327;
  --radius-card: 12px; --radius-control: 7px;
  --font: "Segoe UI Variable Text", "Segoe UI", system-ui, sans-serif;
  --mono: "Cascadia Mono", Consolas, ui-monospace, monospace;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font: 14px/1.5 var(--font); min-height: 100vh; display: flex; flex-direction: column; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; font-weight: 600; margin: 0 0 4px; }
h2 { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--faint); margin: 28px 0 10px; }
h3 { font-size: 15px; font-weight: 600; margin: 0; }
p { margin: 0; }
pre { white-space: pre-wrap; word-break: break-all; font: 12px/1.5 var(--mono); background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-control); padding: 10px 12px; margin: 8px 0 0; color: #C3CDD1; }
.mono { font-family: var(--mono); font-size: 13px; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 12px; }
.center { text-align: center; }
.bad { color: var(--bad); }

/* header */
header.top { display: flex; align-items: center; gap: 24px; padding: 10px 24px; background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 600; font-size: 16px; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand.big { font-size: 26px; justify-content: center; margin-bottom: 18px; }
.logo { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; color: #00191C; background: linear-gradient(135deg, #3DE7F1, #009FB2); }
.brand.big .logo { width: 40px; height: 40px; border-radius: 11px; }
.logo svg { width: 70%; height: 70%; }
nav { display: flex; gap: 4px; flex: 1; }
nav a, .me > a { color: var(--muted); padding: 6px 10px; border-radius: var(--radius-control); }
nav a:hover, .me > a:hover { color: var(--text); background: rgba(255,255,255,.05); text-decoration: none; }
nav a.on, .me > a.on { color: var(--text); background: var(--surface-3); }
.me { display: flex; align-items: center; gap: 8px; }
.me form { margin: 0; }
.ip { color: var(--faint); font-size: 12px; margin-right: 6px; }
.ip b { color: var(--muted); font-weight: 400; }

main { width: 100%; max-width: 1180px; margin: 0 auto; padding: 28px 24px 40px; flex: 1; }
main.narrow { max-width: 420px; padding-top: 12vh; }
footer { text-align: center; color: var(--faint); font-size: 12px; padding: 16px; }

.head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.row { display: flex; gap: 8px; }
.row form { margin: 0; }

/* cards */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-card); padding: 18px; margin-bottom: 14px; overflow-x: auto; }
.card > table { margin: -6px -2px; }
.accentcard { border-color: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }
.narrowcard { max-width: 460px; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.empty { color: var(--muted); text-align: center; padding: 14px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-card); padding: 14px 18px; display: flex; flex-direction: column; }
.tile .label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--faint); }
.tile b { font-size: 28px; font-weight: 600; line-height: 1.3; }
.tile .faint { font-size: 12px; }

/* tables */
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--faint); padding: 6px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: rgba(255,255,255,.03); }
tr.off td { opacity: .55; }
td.actions { text-align: right; white-space: nowrap; }
td.actions form { display: inline; margin: 0; }
td a b { color: var(--text); }

/* pills & dots */
.pill { display: inline-block; font-size: 11px; padding: 1px 8px; border-radius: 6px; background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); vertical-align: 1px; }
.pill.accent { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.pill.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.pill.bad { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--faint); margin-right: 7px; vertical-align: 1px; }
.dot.good { background: var(--good); }
.dot.bad { background: var(--bad); }

/* callouts */
.callout { border-radius: var(--radius-control); padding: 10px 14px; margin-bottom: 14px; border: 1px solid transparent; }
.callout.good { background: var(--good-soft); color: var(--good); }
.callout.bad { background: var(--bad-soft); color: var(--bad); }
.callout.warn { background: var(--warn-soft); color: var(--warn); }

/* buttons */
button, .btn { font: inherit; font-weight: 600; border-radius: var(--radius-control); padding: 7px 14px; cursor: pointer; border: 1px solid transparent; display: inline-flex; align-items: center; gap: 6px; line-height: 1.3; }
.btn:hover { text-decoration: none; }
.primary { background: var(--accent); color: var(--accent-text); }
.primary:hover { filter: brightness(1.08); }
.secondary { background: var(--surface-2); color: var(--text); border-color: var(--line); }
.secondary:hover { border-color: var(--surface-3); background: var(--surface-3); }
.ghost { background: transparent; color: var(--muted); font-weight: 400; }
.ghost:hover { color: var(--text); background: rgba(255,255,255,.05); }
.ghost.danger:hover { color: var(--bad); background: var(--bad-soft); }
.wide { width: 100%; justify-content: center; }
button:focus-visible, .btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

/* forms */
label { display: flex; flex-direction: column; gap: 6px; color: var(--muted); font-size: 13px; }
.field { display: flex; flex-direction: column; gap: 8px; }
.lbl { color: var(--muted); font-size: 13px; }
input, select, textarea { font: inherit; color: var(--text); background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-control); padding: 7px 10px; width: 100%; }
input:hover, select:hover, textarea:hover { border-color: var(--surface-3); }
input:focus, select:focus, textarea:focus { border-color: var(--accent); outline: none; }
input::placeholder, textarea::placeholder { color: var(--faint); }
textarea { font-family: var(--mono); font-size: 13px; resize: vertical; }
.hint { color: var(--faint); font-size: 12px; }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: start; }
.grid2 .card { margin: 0; }
.formbar { grid-column: 1 / -1; display: flex; justify-content: flex-end; gap: 8px; }
form.inline { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin: 0; }
form.inline input:not([type=checkbox]) { width: auto; flex: 1; min-width: 160px; }
form.inline.tight input:not([type=checkbox]) { flex: 0 1 160px; min-width: 120px; }
form.rename { margin: 0; }
form.rename input { background: transparent; border-color: transparent; font-weight: 600; padding: 4px 6px; margin-left: -6px; width: 100%; max-width: 220px; }
form.rename input:hover { border-color: var(--line); }

/* checkbox */
label.check { flex-direction: row; align-items: center; gap: 8px; color: var(--text); cursor: pointer; font-size: 14px; }
label.check input { position: absolute; opacity: 0; width: 1px; height: 1px; }
label.check span:first-of-type { width: 18px; height: 18px; border-radius: 5px; border: 1.5px solid var(--faint); display: inline-grid; place-items: center; flex: none; }
label.check input:checked + span { background: var(--accent); border-color: var(--accent); }
label.check input:checked + span::after { content: ""; width: 9px; height: 5px; border: 2px solid var(--accent-text); border-top: 0; border-right: 0; transform: rotate(-45deg) translate(1px, -1px); }
label.check input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.userlist { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 6px 12px; padding: 4px 0 0 2px; }

/* segmented */
.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-control); padding: 3px; gap: 2px; align-self: flex-start; }
.seg label { flex-direction: row; cursor: pointer; }
.seg input { position: absolute; opacity: 0; width: 1px; }
.seg span { padding: 4px 14px; border-radius: 5px; color: var(--muted); }
.seg input:checked + span { background: var(--surface-3); color: var(--text); }
.seg input:focus-visible + span { outline: 2px solid var(--accent); }

/* choice cards */
.choices { display: flex; flex-direction: column; gap: 8px; }
.choice { flex-direction: row; align-items: flex-start; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-control); background: var(--surface-2); cursor: pointer; color: var(--text); }
.choice:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.choice input { width: auto; margin-top: 3px; accent-color: var(--accent); }

.codebox { display: flex; gap: 8px; align-items: stretch; }
.codebox code { flex: 1; font: 12px/1.5 var(--mono); background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-control); padding: 8px 10px; word-break: break-all; color: var(--text); }
details summary { cursor: pointer; color: var(--muted); }
.copy { cursor: pointer; }
span.copy:hover { color: var(--accent); }
.copied { color: var(--good) !important; }

.login .card { padding: 22px; }
.login .hint { margin-top: 14px; }
.quick { max-width: 460px; margin: 8vh auto 0; }

@media (max-width: 860px) {
  header.top { flex-wrap: wrap; gap: 10px; padding: 10px 14px; }
  nav { order: 3; flex-basis: 100%; overflow-x: auto; }
  .ip { display: none; }
  main { padding: 20px 14px; }
  .grid2, .pair { grid-template-columns: 1fr; }
}
