/* ---------- fonts ---------- */
@font-face {
  font-family: "Inter"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url(fonts/inter-latin.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Inter"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url(fonts/inter-cyrillic.woff2) format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "JetBrains Mono"; font-style: normal; font-weight: 100 800; font-display: swap;
  src: url(fonts/jbmono-latin.woff2) format("woff2");
}

/* ---------- tokens ---------- */
:root {
  --bg: #f4f5f9;
  --bg-glow: rgba(124, 108, 255, .10);
  --surface: #ffffff;
  --surface-2: #f7f8fb;
  --surface-hover: #f0f1f6;
  --border: #e4e6ee;
  --border-strong: #d3d6e2;
  --text: #171a24;
  --text-2: #444b5e;
  --muted: #7a8196;
  --accent: #6c5cff;
  --accent-2: #3fa9f5;
  --accent-soft: rgba(108, 92, 255, .10);
  --accent-text: #ffffff;
  --ok: #12a26b;
  --ok-soft: rgba(18, 162, 107, .12);
  --warn: #c7860a;
  --warn-soft: rgba(199, 134, 10, .13);
  --danger: #e04848;
  --danger-soft: rgba(224, 72, 72, .11);
  --shadow: 0 1px 2px rgba(20, 24, 40, .05), 0 4px 16px rgba(20, 24, 40, .05);
  --shadow-lg: 0 12px 40px rgba(20, 24, 40, .16);
  --ring: 0 0 0 3px rgba(108, 92, 255, .28);
  --radius: 14px;
  --radius-sm: 9px;
  --sidebar: 252px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b0d13;
    --bg-glow: rgba(124, 108, 255, .14);
    --surface: #12151d;
    --surface-2: #161a23;
    --surface-hover: #1b2030;
    --border: rgba(255, 255, 255, .07);
    --border-strong: rgba(255, 255, 255, .13);
    --text: #e9ebf2;
    --text-2: #b9bfcf;
    --muted: #7f879b;
    --accent: #8b7dff;
    --accent-2: #4cc3ff;
    --accent-soft: rgba(139, 125, 255, .14);
    --accent-text: #0c0b1a;
    --ok: #3ddc97;
    --ok-soft: rgba(61, 220, 151, .12);
    --warn: #f5b942;
    --warn-soft: rgba(245, 185, 66, .13);
    --danger: #ff6b6b;
    --danger-soft: rgba(255, 107, 107, .12);
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 24px rgba(0, 0, 0, .25);
    --shadow-lg: 0 20px 60px rgba(0, 0, 0, .55);
    --ring: 0 0 0 3px rgba(139, 125, 255, .35);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0b0d13;
  --bg-glow: rgba(124, 108, 255, .14);
  --surface: #12151d;
  --surface-2: #161a23;
  --surface-hover: #1b2030;
  --border: rgba(255, 255, 255, .07);
  --border-strong: rgba(255, 255, 255, .13);
  --text: #e9ebf2;
  --text-2: #b9bfcf;
  --muted: #7f879b;
  --accent: #8b7dff;
  --accent-2: #4cc3ff;
  --accent-soft: rgba(139, 125, 255, .14);
  --accent-text: #0c0b1a;
  --ok: #3ddc97;
  --ok-soft: rgba(61, 220, 151, .12);
  --warn: #f5b942;
  --warn-soft: rgba(245, 185, 66, .13);
  --danger: #ff6b6b;
  --danger-soft: rgba(255, 107, 107, .12);
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 24px rgba(0, 0, 0, .25);
  --shadow-lg: 0 20px 60px rgba(0, 0, 0, .55);
  --ring: 0 0 0 3px rgba(139, 125, 255, .35);
  color-scheme: dark;
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh;
  background: var(--bg); color: var(--text);
  font: 14.5px/1.55 "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
h1, h2, h3 { margin: 0; letter-spacing: -.015em; }
h1 { font-size: 1.6rem; font-weight: 700; }
h2 { font-size: 1.05rem; font-weight: 650; }
h3 { font-size: .95rem; font-weight: 600; }
p { margin: 0 0 .75rem; }
code, .mono { font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .84em; }
code { padding: .1em .4em; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2); }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.nowrap { white-space: nowrap; }
::selection { background: var(--accent-soft); }

.i { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vertical-align: -3px; }
.i-lg { width: 22px; height: 22px; }

/* ---------- shell ---------- */
.app { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; gap: 2px;
  padding: 18px 14px; background: var(--surface); border-right: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; color: var(--text); font-weight: 700; font-size: 1.05rem; letter-spacing: -.01em; }
.brand:hover { text-decoration: none; }
.brand-mark {
  display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff;
  box-shadow: 0 6px 18px -6px var(--accent);
}
.brand-mark .i { width: 20px; height: 20px; }
.brand small { display: block; font-weight: 500; font-size: .72rem; color: var(--muted); letter-spacing: .02em; }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-label { padding: 16px 10px 6px; font-size: .7rem; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.nav a {
  position: relative; display: flex; align-items: center; gap: 11px;
  padding: 8px 10px; border-radius: var(--radius-sm); color: var(--text-2); font-weight: 500;
  transition: background .15s, color .15s;
}
.nav a:hover { background: var(--surface-hover); color: var(--text); text-decoration: none; }
.nav a.active { background: var(--accent-soft); color: var(--accent); }
.nav a.active::before {
  content: ""; position: absolute; left: -14px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0;
  background: var(--accent);
}

.me {
  margin-top: auto; display: flex; align-items: center; gap: 10px;
  padding: 10px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2);
}
.me-info { min-width: 0; flex: 1; line-height: 1.25; }
.me-info a { display: block; color: var(--text); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-info span { font-size: .75rem; color: var(--muted); }
.me form { margin: 0; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 12px;
  height: 60px; padding: 0 28px;
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: saturate(160%) blur(12px); -webkit-backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid var(--border);
}
.topbar .crumbs { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: .9rem; min-width: 0; }
.topbar .crumbs a { color: var(--muted); }
.topbar .crumbs a:hover { color: var(--text); text-decoration: none; }
.topbar .crumbs .i { width: 14px; height: 14px; vertical-align: 0; opacity: .6; }
.topbar .crumbs b { color: var(--text); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .spacer { flex: 1; }
.menu-btn { display: none; }

.content { padding: 28px; max-width: 1180px; width: 100%; animation: rise .35s ease both; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head p { margin: 4px 0 0; color: var(--muted); }
.back { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-size: .88rem; margin-bottom: 10px; }
.back:hover { color: var(--text); text-decoration: none; }

/* ---------- surfaces ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 20px; margin-bottom: 18px;
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card-head p { margin: 2px 0 0; color: var(--muted); font-size: .86rem; }
.card.flush { padding: 0; overflow: hidden; }
.card.flush .card-head { padding: 18px 20px 0; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); gap: 18px; }
.grid > .card { margin: 0; }
.grid.wide { grid-template-columns: repeat(auto-fill, minmax(min(100%, 430px), 1fr)); }
.stack { display: grid; gap: 18px; }
.two-col { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.two-col > .card { margin: 0; }

.tile {
  position: relative; display: flex; flex-direction: column; gap: 14px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px; color: var(--text); box-shadow: var(--shadow);
  transition: transform .18s, border-color .18s, box-shadow .18s;
  overflow: hidden;
}
.tile::after {
  content: ""; position: absolute; inset: auto -40% -60% auto; width: 180px; height: 180px; border-radius: 50%;
  background: radial-gradient(closest-side, var(--accent-soft), transparent); opacity: 0; transition: opacity .25s;
}
.tile:hover { transform: translateY(-2px); border-color: var(--border-strong); text-decoration: none; box-shadow: var(--shadow-lg); }
.tile:hover::after { opacity: 1; }
.tile p { margin: 0; color: var(--muted); font-size: .88rem; }
.tile .go { margin-top: auto; display: inline-flex; align-items: center; gap: 4px; color: var(--accent); font-weight: 600; font-size: .86rem; }
.icon-badge {
  display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px;
  background: var(--accent-soft); color: var(--accent);
}
.icon-badge.ok { background: var(--ok-soft); color: var(--ok); }
.icon-badge.danger { background: var(--danger-soft); color: var(--danger); }

.hero {
  position: relative; overflow: hidden; margin-bottom: 22px; padding: 26px 28px;
  border-radius: calc(var(--radius) + 4px); border: 1px solid var(--border);
  background:
    radial-gradient(600px 200px at 0% 0%, var(--bg-glow), transparent 70%),
    radial-gradient(500px 220px at 100% 100%, color-mix(in srgb, var(--accent-2) 14%, transparent), transparent 70%),
    var(--surface);
}
.hero h1 { font-size: 1.75rem; }
.hero p { margin: 6px 0 0; color: var(--text-2); }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 12px 20px; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { font-size: .72rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; background: var(--surface-2); }
tr:last-child td { border-bottom: none; }
tbody tr { transition: background .12s; }
tbody tr:hover { background: var(--surface-hover); }
tr.clickable { cursor: pointer; }
.cell-user { display: flex; align-items: center; gap: 12px; }
.cell-user a { color: var(--text); font-weight: 600; }
.empty { padding: 36px 20px; text-align: center; color: var(--muted); }
.empty .i { width: 28px; height: 28px; margin-bottom: 8px; opacity: .6; }

/* ---------- avatar, chips ---------- */
.avatar {
  --h: 250;
  display: grid; place-items: center; flex: none; width: 34px; height: 34px; border-radius: 10px;
  background: linear-gradient(135deg, hsl(var(--h) 75% 62%), hsl(calc(var(--h) + 40) 75% 55%));
  color: #fff; font-weight: 700; font-size: .78rem; letter-spacing: .02em;
}
.avatar.lg { width: 52px; height: 52px; border-radius: 14px; font-size: 1.05rem; }

.chip {
  display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 9px;
  border-radius: 999px; font-size: .76rem; font-weight: 600; white-space: nowrap;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2);
}
.chip .i { width: 13px; height: 13px; vertical-align: 0; }
.chip.accent { background: var(--accent-soft); border-color: transparent; color: var(--accent); }
.chip.ok { background: var(--ok-soft); border-color: transparent; color: var(--ok); }
.chip.warn { background: var(--warn-soft); border-color: transparent; color: var(--warn); }
.chip.danger { background: var(--danger-soft); border-color: transparent; color: var(--danger); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }

.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); flex: none; }
.dot.ok { background: var(--ok); box-shadow: 0 0 0 0 var(--ok); animation: pulse 2.2s infinite; }
.dot.danger { background: var(--danger); }
.dot.warn { background: var(--warn); }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--ok) 55%, transparent); }
  70% { box-shadow: 0 0 0 7px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}

/* ---------- forms ---------- */
.field { display: block; margin-bottom: 14px; }
.field > span { display: block; margin-bottom: 6px; font-size: .82rem; font-weight: 600; color: var(--text-2); }
.field > small { display: block; margin-top: 5px; color: var(--muted); font-size: .8rem; }
.input, input[type=text], input[type=password], input[type=search], textarea, select {
  width: 100%; height: 40px; padding: 0 12px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface-2); color: var(--text); font: inherit;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
textarea { height: auto; min-height: 90px; padding: 10px 12px; }
input:hover, textarea:hover, select:hover { border-color: color-mix(in srgb, var(--accent) 35%, var(--border-strong)); }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); background: var(--surface); }
.input-icon { position: relative; }
.input-icon .i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.input-icon input { padding-left: 38px; }
.row { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.row > .field { flex: 1; min-width: 180px; margin-bottom: 0; }
.form-foot { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 18px; }

/* toggle switch built from a checkbox */
.switch-row {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 12px 0; border-bottom: 1px solid var(--border); cursor: pointer;
}
.switch-row:last-child { border-bottom: none; }
.switch-row .label { min-width: 0; }
.switch-row .label b { display: block; font-weight: 600; }
.switch-row .label small { display: block; color: var(--muted); font-size: .82rem; }
.switch-row .label code { margin-left: 6px; font-size: .72rem; }
.switch {
  appearance: none; -webkit-appearance: none; position: relative; flex: none;
  width: 40px; height: 23px; margin: 0; border-radius: 999px; cursor: pointer;
  background: var(--border-strong); transition: background .2s;
}
.switch::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 17px; height: 17px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .3); transition: transform .2s cubic-bezier(.3, .7, .4, 1.3);
}
.switch:checked { background: var(--accent); }
.switch:checked::after { transform: translateX(17px); }
.switch:focus-visible { outline: none; box-shadow: var(--ring); }
.switch:disabled { opacity: .45; cursor: not-allowed; }

.perm-group { padding: 4px 20px; border-top: 1px solid var(--border); }
.perm-group-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 0 4px; }
.perm-group-head h3 { display: flex; align-items: center; gap: 8px; }

/* ---------- buttons ---------- */
.btn, button {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 38px; padding: 0 15px; border: 1px solid transparent; border-radius: var(--radius-sm);
  background: var(--accent); color: var(--accent-text); font: inherit; font-weight: 600; font-size: .9rem;
  cursor: pointer; white-space: nowrap; text-decoration: none;
  transition: filter .15s, background .15s, border-color .15s, transform .08s, box-shadow .15s;
}
.btn:hover, button:hover { filter: brightness(1.08); text-decoration: none; }
.btn:active, button:active { transform: translateY(1px); }
.btn:focus-visible, button:focus-visible { outline: none; box-shadow: var(--ring); }
.btn.primary, button.primary {
  background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 60%, var(--accent-2)));
  color: #fff; box-shadow: 0 6px 18px -8px var(--accent);
}
.btn.ghost, button.ghost { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
.btn.ghost:hover, button.ghost:hover { background: var(--surface-hover); filter: none; }
.btn.danger, button.danger { background: var(--danger-soft); color: var(--danger); }
.btn.danger:hover, button.danger:hover { background: var(--danger); color: #fff; filter: none; }
.btn.danger-solid, button.danger-solid { background: var(--danger); color: #fff; }
.btn.sm, button.sm { height: 32px; padding: 0 11px; font-size: .84rem; }
.btn.icon, button.icon { width: 36px; height: 36px; padding: 0; background: transparent; color: var(--muted); border-color: transparent; }
.btn.icon:hover, button.icon:hover { background: var(--surface-hover); color: var(--text); filter: none; }
.btn.icon.sm, button.icon.sm { width: 30px; height: 30px; }
button.link { height: auto; padding: 0; background: none; color: var(--accent); font-weight: 500; }
button[disabled], .btn[aria-disabled=true] { opacity: .55; cursor: progress; }
.htmx-request .spin, .spin.htmx-request { animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- servers ---------- */
.host-head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.host-head h2 { flex: 1; display: flex; align-items: center; gap: 9px; }
.host-head .meta { color: var(--muted); font-size: .82rem; display: flex; align-items: center; gap: 5px; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 16px; }
.stat { padding: 12px; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--border); min-width: 0; }
.stat .label { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: .75rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.stat .label .i { width: 14px; height: 14px; vertical-align: 0; }
.stat .value { margin: 6px 0 2px; font-size: 1.25rem; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat .value small { font-size: .8rem; font-weight: 500; color: var(--muted); letter-spacing: 0; }
.stat .sub { color: var(--muted); font-size: .76rem; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar { height: 6px; margin-top: 8px; border-radius: 99px; background: var(--border); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width .6s ease; }
.bar.warn > i { background: linear-gradient(90deg, var(--warn), color-mix(in srgb, var(--warn) 60%, var(--danger))); }
.bar.hot > i { background: linear-gradient(90deg, color-mix(in srgb, var(--danger) 70%, var(--warn)), var(--danger)); }

.containers { border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.containers-head { padding: 9px 12px; background: var(--surface-2); color: var(--muted); font-size: .72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; border-bottom: 1px solid var(--border); }
.container-row { display: flex; align-items: center; gap: 10px; padding: 9px 8px 9px 12px; border-bottom: 1px solid var(--border); }
.container-row:last-child { border-bottom: none; }
.container-row .name { flex: 1; min-width: 0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.offline { display: flex; gap: 12px; align-items: flex-start; padding: 14px; border-radius: var(--radius-sm); background: var(--danger-soft); color: var(--danger); font-size: .86rem; }
.offline p { margin: 2px 0 0; color: var(--text-2); word-break: break-word; }

/* ---------- profile ---------- */
.profile { display: flex; align-items: center; gap: 16px; }
.profile h2 { font-size: 1.2rem; }
.perm-list { list-style: none; margin: 0; padding: 0; }
.perm-list li { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--border); }
.perm-list li:last-child { border-bottom: none; }
.perm-list .i { color: var(--ok); }

/* ---------- toasts & dialog ---------- */
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 100; display: flex; flex-direction: column; gap: 10px; max-width: min(380px, calc(100vw - 32px)); }
.toast {
  display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); animation: toast-in .3s cubic-bezier(.2, .9, .3, 1.2) both;
}
.toast.ok .i { color: var(--ok); }
.toast.err .i { color: var(--danger); }
.toast .msg { flex: 1; }
.toast.hide { animation: toast-out .25s ease forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px) scale(.97); } }
@keyframes toast-out { to { opacity: 0; transform: translateX(24px); } }

.inline-alert { display: flex; align-items: center; gap: 10px; padding: 11px 14px; margin-bottom: 16px; border-radius: var(--radius-sm); font-size: .9rem; }
.inline-alert.err { background: var(--danger-soft); color: var(--danger); }
.inline-alert.ok { background: var(--ok-soft); color: var(--ok); }

dialog.confirm {
  width: min(420px, calc(100vw - 32px)); padding: 0; border: 1px solid var(--border-strong); border-radius: calc(var(--radius) + 2px);
  background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg);
}
dialog.confirm[open] { animation: pop .22s cubic-bezier(.2, .9, .3, 1.2); }
dialog.confirm::backdrop { background: rgba(5, 7, 12, .55); backdrop-filter: blur(3px); }
dialog.confirm .body { display: flex; gap: 14px; padding: 22px 22px 8px; }
dialog.confirm .body p { margin: 4px 0 0; color: var(--text-2); }
dialog.confirm .actions { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 22px 20px; }
@keyframes pop { from { opacity: 0; transform: scale(.95); } }

/* ---------- login ---------- */
.auth {
  min-height: 100vh; display: grid; place-items: center; padding: 24px 16px;
  background:
    radial-gradient(700px 400px at 15% 10%, var(--bg-glow), transparent 70%),
    radial-gradient(600px 400px at 90% 90%, color-mix(in srgb, var(--accent-2) 12%, transparent), transparent 70%),
    var(--bg);
}
.auth-card { width: 100%; max-width: 380px; animation: rise .4s ease both; }
.auth-card .brand { justify-content: center; padding: 0 0 22px; font-size: 1.2rem; }
.auth-card .brand-mark { width: 42px; height: 42px; border-radius: 12px; }
.auth-card .card { padding: 26px; }
.auth-card h1 { font-size: 1.3rem; margin-bottom: 4px; }
.auth-card .card > p { color: var(--muted); margin-bottom: 20px; }
.auth-card button { width: 100%; height: 42px; margin-top: 6px; }
.auth-foot { text-align: center; margin-top: 16px; color: var(--muted); font-size: .82rem; }

/* ---------- misc ---------- */
.theme-toggle .moon { display: none; }
:root[data-theme="dark"] .theme-toggle .sun { display: none; }
:root[data-theme="dark"] .theme-toggle .moon { display: inline; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) .theme-toggle .sun { display: none; }
  :root:not([data-theme]) .theme-toggle .moon { display: inline; }
}
.scrim { display: none; }
.show-sm { display: none !important; }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .two-col { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; z-index: 50; left: 0; top: 0; bottom: 0; width: min(280px, 84vw);
    transform: translateX(-102%); transition: transform .25s cubic-bezier(.3, .7, .3, 1); box-shadow: var(--shadow-lg);
  }
  .nav-open .sidebar { transform: none; }
  .nav-open .scrim { display: block; position: fixed; inset: 0; z-index: 40; background: rgba(5, 7, 12, .5); }
  .menu-btn { display: inline-flex; }
  .topbar { padding: 0 12px 0 8px; }
  .content { padding: 20px 16px; }
  .hero { padding: 20px; }
  th, td { padding: 11px 14px; }
  .hide-sm { display: none; }
  .show-sm { display: inline-block !important; }
}
@media (max-width: 420px) {
  .stats { grid-template-columns: 1fr 1fr; }
  .stats .stat:first-child { grid-column: span 2; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
