:root {
  --bg: #f4f5f7; --panel: #ffffff; --line: #dfe2e8; --text: #1c2330; --muted: #667085;
  --accent: #2459d6; --accent-text: #ffffff; --ok: #1a7f4b; --warn: #b26a00; --bad: #c0362c;
  --ok-bg: #e4f4ea; --warn-bg: #fcf0d9; --bad-bg: #fbe6e3; --side: #172033; --side-text: #c9d2e3;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #11151c; --panel: #1a202b; --line: #2c3442; --text: #e6e9ef; --muted: #98a2b3;
    --accent: #6b93f5; --accent-text: #0d1117; --ok: #5fd08f; --warn: #f0b860; --bad: #f2867b;
    --ok-bg: #173324; --warn-bg: #3a2c12; --bad-bg: #3d1c19; --side: #0c1017; --side-text: #aeb8cb;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text); font: 15px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif; }
h1 { font-size: 1.45rem; margin: 0 0 1rem; }
h2 { font-size: 1.05rem; margin: 0 0 .75rem; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code, pre { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .86rem; }

.layout { display: flex; min-height: 100vh; }
.side { background: var(--side); color: var(--side-text); width: 220px; flex: none; padding: 1rem .75rem; display: flex; flex-direction: column; }
.brand { color: #fff; font-weight: 650; font-size: 1.1rem; padding: .25rem .6rem 1rem; }
.side a { color: inherit; display: block; padding: .5rem .6rem; border-radius: 6px; }
.side a:hover { background: rgba(255, 255, 255, .08); text-decoration: none; }
.side a.active { background: var(--accent); color: var(--accent-text); }
.side .who { margin-top: auto; padding: .75rem .6rem 0; border-top: 1px solid rgba(255, 255, 255, .12); font-size: .88rem; }
.side .who strong { color: #fff; display: block; }
.main { flex: 1; min-width: 0; padding: 1.5rem 1.75rem 3rem; max-width: 1200px; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 1.1rem 1.2rem; margin-bottom: 1.1rem; }
.head { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; margin-bottom: 1rem; }
.head h1, .head h2 { margin: 0; flex: 1; }
.muted { color: var(--muted); }
.small { font-size: .86rem; }
.row { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: .9rem 1.1rem; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: .9rem; margin-bottom: 1.1rem; }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: .9rem 1rem; }
.tile b { display: block; font-size: 1.5rem; font-weight: 600; }

.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; }
th, td { text-align: left; padding: .55rem .6rem; border-bottom: 1px solid var(--line); vertical-align: middle; white-space: nowrap; }
th { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.actions { text-align: right; }

button, .btn { font: inherit; border: 1px solid var(--line); background: var(--panel); color: var(--text); padding: .42rem .8rem; border-radius: 7px; cursor: pointer; }
button:hover { border-color: var(--accent); }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); font-weight: 600; }
button.danger { color: var(--bad); }
button.mini { padding: .2rem .55rem; font-size: .85rem; }
button:disabled { opacity: .55; cursor: wait; }

label { display: block; font-size: .86rem; color: var(--muted); }
label.check { display: flex; align-items: center; gap: .5rem; color: var(--text); font-size: .95rem; }
input[type=text], input[type=password], input[type=email], input[type=number], select {
  font: inherit; width: 100%; margin-top: .25rem; padding: .45rem .6rem; border: 1px solid var(--line);
  border-radius: 7px; background: var(--bg); color: var(--text);
}
input:focus, select:focus, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

.badge { display: inline-block; padding: .1rem .55rem; border-radius: 999px; font-size: .8rem; font-weight: 600; }
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.bad { background: var(--bad-bg); color: var(--bad); }
.bar { width: 110px; height: 7px; background: var(--line); border-radius: 4px; overflow: hidden; display: inline-block; vertical-align: middle; margin-right: .5rem; }
.bar i { display: block; height: 100%; background: var(--accent); }

.steps { list-style: none; padding: 0; margin: 0 0 1rem; }
.steps li { padding: .45rem 0; border-bottom: 1px solid var(--line); display: flex; gap: .6rem; align-items: baseline; }
.secret { background: var(--warn-bg); border-radius: 8px; padding: .7rem .9rem; margin-bottom: 1rem; }
.secret code { font-size: 1rem; user-select: all; }
pre.logs { background: #0c1017; color: #d5dbe6; padding: .9rem; border-radius: 8px; max-height: 420px; overflow: auto; white-space: pre-wrap; word-break: break-all; margin: 0; }
dl.facts { display: grid; grid-template-columns: max-content 1fr; gap: .35rem 1.2rem; margin: 0; }
dl.facts dt { color: var(--muted); }
dl.facts dd { margin: 0; }

.login { max-width: 360px; margin: 12vh auto; }
.login .card { padding: 1.6rem; }
.login label { margin-bottom: .8rem; }
.login button { width: 100%; margin-top: .4rem; }
.error { color: var(--bad); min-height: 1.4em; margin: .4rem 0 0; }

dialog { border: 1px solid var(--line); border-radius: 12px; background: var(--panel); color: var(--text); padding: 1.3rem; width: min(520px, 92vw); }
dialog::backdrop { background: rgba(0, 0, 0, .45); }
dialog form > label { margin-bottom: .8rem; }
dialog .row.end { justify-content: flex-end; margin-top: 1rem; }

#toasts { position: fixed; right: 1rem; bottom: 1rem; display: flex; flex-direction: column; gap: .5rem; z-index: 50; }
.toast { background: var(--side); color: #fff; padding: .65rem .95rem; border-radius: 8px; max-width: 380px; box-shadow: 0 4px 14px rgba(0, 0, 0, .25); }
.toast.bad { background: var(--bad); color: #fff; }

@media (max-width: 760px) {
  .layout { flex-direction: column; }
  .side { width: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: .15rem; padding: .5rem; }
  .brand { padding: .25rem .6rem; }
  .side .who { margin: 0 0 0 auto; border: 0; padding: 0 .4rem; }
  .side .who strong { display: inline; }
  .main { padding: 1rem; }
}
