/* Rental Systems — design system
   Dark-first, one accent (#6366f1), hairline borders, 56px header.
   No build step. Mobile-first. */

/* ---------------------------------------------------------------- tokens */
:root {
  --bg: #0b0e14;
  --surface: #11151d;
  --surface-2: #161b25;
  --surface-3: #1c2230;
  --border: rgba(255, 255, 255, .09);
  --border-strong: rgba(255, 255, 255, .16);
  --text: #e7eaf0;
  --text-strong: #ffffff;
  --muted: #8b93a7;
  --faint: #626b7e;
  --accent: #6366f1;
  --accent-hover: #7376f5;
  --accent-soft: rgba(99, 102, 241, .14);
  --green: #34d399;
  --amber: #fbbf24;
  --red: #f87171;
  --green-soft: rgba(52, 211, 153, .13);
  --amber-soft: rgba(251, 191, 36, .13);
  --red-soft: rgba(248, 113, 113, .13);
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 12px 32px rgba(0, 0, 0, .28);
  --radius: 12px;
  --radius-sm: 10px;
  --radius-xs: 8px;
  --ring: 0 0 0 2px var(--bg), 0 0 0 4px var(--accent);
  --t: 160ms ease;
  --header-h: 56px;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: dark;
}

/* manual light override wins over everything */
:root[data-theme="light"] {
  --bg: #f5f6f9;
  --surface: #ffffff;
  --surface-2: #f1f3f7;
  --surface-3: #e8ebf1;
  --border: rgba(15, 23, 42, .12);
  --border-strong: rgba(15, 23, 42, .22);
  --text: #1b2333;
  --text-strong: #0b1220;
  --muted: #5a6378;
  --faint: #7b8497;
  --accent: #4f46e5;
  --accent-hover: #4338ca;
  --accent-soft: rgba(79, 70, 229, .1);
  --green: #047857;
  --amber: #b45309;
  --red: #b91c1c;
  --green-soft: rgba(4, 120, 87, .1);
  --amber-soft: rgba(180, 83, 9, .12);
  --red-soft: rgba(185, 28, 28, .1);
  --shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 10px 24px rgba(15, 23, 42, .07);
  --ring: 0 0 0 2px var(--surface), 0 0 0 4px var(--accent);
  color-scheme: light;
}

/* OS-level light fallback when the user has not chosen a theme */
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f5f6f9;
    --surface: #ffffff;
    --surface-2: #f1f3f7;
    --surface-3: #e8ebf1;
    --border: rgba(15, 23, 42, .12);
    --border-strong: rgba(15, 23, 42, .22);
    --text: #1b2333;
    --text-strong: #0b1220;
    --muted: #5a6378;
    --faint: #7b8497;
    --accent: #4f46e5;
    --accent-hover: #4338ca;
    --accent-soft: rgba(79, 70, 229, .1);
    --green: #047857;
    --amber: #b45309;
    --red: #b91c1c;
    --green-soft: rgba(4, 120, 87, .1);
    --amber-soft: rgba(180, 83, 9, .12);
    --red-soft: rgba(185, 28, 28, .1);
    --shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 10px 24px rgba(15, 23, 42, .07);
    --ring: 0 0 0 2px var(--surface), 0 0 0 4px var(--accent);
    color-scheme: light;
  }
}

/* ----------------------------------------------------------------- reset */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14.5px/1.55 var(--sans);
  font-size: 14.5px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img, svg { max-width: 100%; }
h1, h2, h3, h4 { margin: 0; color: var(--text-strong); font-weight: 620; letter-spacing: -.01em; line-height: 1.25; }
h1 { font-size: 24px; }
h2 { font-size: 17px; }
h3 { font-size: 15px; }
p { margin: 0 0 12px; }
p:last-child { margin-bottom: 0; }
a { color: var(--accent); text-decoration: none; transition: color var(--t); }
a:hover { color: var(--accent-hover); text-decoration: underline; text-underline-offset: 2px; }
code, kbd, pre, .mono { font-family: var(--mono); font-size: .92em; }
code { background: var(--surface-2); border: 1px solid var(--border); border-radius: 6px; padding: 1px 5px; }
hr { border: 0; border-top: 1px solid var(--border); margin: 20px 0; }
::selection { background: var(--accent-soft); }

:focus-visible {
  outline: none;
  box-shadow: var(--ring);
  border-radius: 6px;
}
.skip-link {
  position: absolute; left: -999px; top: 0; z-index: 100;
  background: var(--accent); color: #fff; padding: 8px 14px; border-radius: 0 0 8px 0;
}
.skip-link:focus { left: 0; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------------------------------------------------------------- layout */
.shell { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 16px; }
.main { padding: 22px 16px 56px; min-height: 60vh; }
.stack > * + * { margin-top: 16px; }
.stack-sm > * + * { margin-top: 8px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row-between { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.spacer { flex: 1 1 auto; }
.grid { display: grid; gap: 14px; }
.grid-2 { grid-template-columns: 1fr; }
.grid-3 { grid-template-columns: 1fr; }
.grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 720px) {
  .grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 12.8px; }
.nowrap { white-space: nowrap; }
.center { text-align: center; }
.right { text-align: right; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------------------------------------------------------------- header */
.site-header {
  position: sticky; top: 0; z-index: 40;
  height: var(--header-h);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
@supports not (background: color-mix(in srgb, red 50%, blue)) {
  .site-header { background: var(--bg); }
}
.header-inner { height: var(--header-h); display: flex; align-items: center; gap: 14px; }
.brand { display: inline-flex; align-items: center; gap: 9px; color: var(--text-strong); font-weight: 640; font-size: 15px; text-decoration: none; }
.brand:hover { color: var(--text-strong); text-decoration: none; }
.brand-mark {
  width: 18px; height: 18px; border-radius: 5px; flex: none;
  background: linear-gradient(145deg, var(--accent), #22d3ee);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .18);
}
.site-nav { display: none; gap: 2px; margin-left: 8px; }
.site-nav a {
  color: var(--muted); padding: 7px 10px; border-radius: var(--radius-xs);
  font-size: 13.5px; font-weight: 500; text-decoration: none; transition: background var(--t), color var(--t);
}
.site-nav a:hover { color: var(--text-strong); background: var(--surface-2); text-decoration: none; }
.site-nav a[aria-current="page"] { color: var(--text-strong); background: var(--surface-2); }
.header-tools { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.nav-toggle { display: inline-flex; }
.theme-toggle {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--surface); border: 1px solid var(--border); color: var(--muted);
  height: 32px; padding: 0 10px; border-radius: 999px; cursor: pointer;
  font: inherit; font-size: 12.5px; transition: background var(--t), color var(--t), border-color var(--t);
}
.theme-toggle:hover { color: var(--text-strong); border-color: var(--border-strong); }
.tt-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
:root[data-theme="light"] .tt-dot { background: var(--amber); box-shadow: 0 0 0 3px var(--amber-soft); }
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) .tt-dot { background: var(--amber); box-shadow: 0 0 0 3px var(--amber-soft); }
}
.tt-label { display: none; }
@media (min-width: 520px) { .tt-label { display: inline; } }
.user-menu { position: relative; }
.user-summary {
  list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 7px;
  height: 32px; padding: 0 9px 0 4px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  font-size: 13px; transition: border-color var(--t), background var(--t);
}
.user-summary::-webkit-details-marker { display: none; }
.user-summary:hover { border-color: var(--border-strong); }
.avatar {
  width: 24px; height: 24px; border-radius: 50%; display: inline-grid; place-items: center;
  background: var(--accent-soft); color: var(--accent); font-size: 11.5px; font-weight: 700;
}
.user-name { max-width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-panel {
  position: absolute; right: 0; top: calc(100% + 8px); min-width: 216px; z-index: 50;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 6px; display: grid; gap: 2px;
}
.menu-panel a, .menu-panel .menu-head {
  display: block; padding: 8px 10px; border-radius: var(--radius-xs); color: var(--text);
  font-size: 13.5px; text-decoration: none;
}
.menu-panel a:hover { background: var(--surface-2); text-decoration: none; }
.menu-head { color: var(--muted) !important; font-size: 12px !important; border-bottom: 1px solid var(--border); border-radius: 0; margin-bottom: 4px; }
.menu-panel form { margin: 0; }

@media (max-width: 719px) {
  .nav-toggle { order: 3; }
  .site-nav {
    display: none;
    position: absolute; left: 0; right: 0; top: var(--header-h);
    background: var(--surface); border-bottom: 1px solid var(--border);
    padding: 8px 12px 12px; box-shadow: var(--shadow);
    flex-direction: column; margin: 0; z-index: 45;
  }
  .site-nav.open { display: flex; animation: slide-down 180ms ease both; }
  .site-nav a { padding: 11px 10px; font-size: 15px; }
}
@media (min-width: 720px) {
  .site-nav { display: flex; }
  .nav-toggle { display: none; }
}
@keyframes slide-down { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

/* ----------------------------------------------------------------- cards */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: 0 1px 0 rgba(255, 255, 255, .02) inset;
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.card-head h2, .card-head h3 { display: flex; align-items: center; gap: 8px; }
.card-sub { color: var(--muted); font-size: 12.8px; margin-top: 3px; }
.card.pad-0 { padding: 0; overflow: hidden; }
.card-divide > * + * { border-top: 1px solid var(--border); margin-top: 14px; padding-top: 14px; }
.section-title { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--faint); font-weight: 620; margin: 26px 0 10px; }

/* -------------------------------------------------------------- stat tile */
.stat-tile {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px; display: flex; flex-direction: column; gap: 3px; min-width: 0;
}
.stat-tile .st-label { color: var(--muted); font-size: 12.2px; font-weight: 550; letter-spacing: .01em; }
.stat-tile .st-value { font-size: 22px; font-weight: 660; color: var(--text-strong); line-height: 1.15; letter-spacing: -.02em; }
.stat-tile .st-value.mono { font-family: var(--mono); font-size: 19px; }
.stat-tile .st-foot { color: var(--faint); font-size: 12px; }
.stat-tile.accent { border-color: color-mix(in srgb, var(--accent) 34%, var(--border)); }
.stat-tile .st-bar { height: 4px; border-radius: 999px; background: var(--surface-3); overflow: hidden; margin-top: 6px; }
.stat-tile .st-bar > span { display: block; height: 100%; background: var(--accent); }

/* ------------------------------------------------------- capacity bar */
.capacity-card .cap-row + .cap-row { margin-top: 14px; }
.cap-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.cap-name { font-size: 12.6px; font-weight: 600; color: var(--text); letter-spacing: .01em; }
.cap-figures { display: flex; align-items: baseline; gap: 8px; font-size: 12.4px; color: var(--muted); font-family: var(--mono); }
.cap-pct { color: var(--text-strong); font-weight: 600; }
.capacity-bar {
  display: flex; width: 100%; height: 10px; border-radius: 999px; overflow: hidden;
  background: var(--surface-3); border: 1px solid var(--border);
}
.capacity-bar .seg { display: block; height: 100%; transition: width 420ms ease; }
.capacity-bar .seg-used { background: var(--accent); }
.capacity-bar .seg-reserved { background: repeating-linear-gradient(45deg, var(--faint) 0 4px, transparent 4px 8px); background-color: var(--surface-3); }
.capacity-bar .seg-free { background: var(--green); opacity: .55; }
.capacity-bar[data-pressure="tight"] .seg-used { background: var(--amber); }
.capacity-bar[data-pressure="full"] .seg-used { background: var(--red); }
.capacity-bar[data-live="stale"] { opacity: .55; }
.legend { list-style: none; display: flex; flex-wrap: wrap; gap: 12px; margin: 12px 0 0; padding: 0; font-size: 12.2px; color: var(--muted); }
.legend li { display: inline-flex; align-items: center; gap: 6px; }
.sw { width: 10px; height: 10px; border-radius: 3px; display: inline-block; flex: none; }
.sw-used { background: var(--accent); }
.sw-reserved { background: var(--faint); }
.sw-free { background: var(--green); opacity: .6; }
.cap-meta { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 14px; margin: 14px 0 0; padding: 12px 0 0; border-top: 1px solid var(--border); font-size: 12.6px; }
.cap-meta dt { color: var(--muted); }
.cap-meta dd { margin: 0; color: var(--text-strong); font-weight: 600; font-family: var(--mono); }
@media (min-width: 640px) { .cap-meta { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

/* ------------------------------------------------------------ status pill */
.status-pill {
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
  height: 22px; padding: 0 9px; border-radius: 999px;
  font-size: 12px; font-weight: 600; letter-spacing: .01em;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--muted);
}
.status-pill .sp-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: none; }
.st-running { color: var(--green); background: var(--green-soft); border-color: color-mix(in srgb, var(--green) 30%, transparent); }
.st-stopped { color: var(--muted); background: var(--surface-2); }
.st-pending { color: var(--amber); background: var(--amber-soft); border-color: color-mix(in srgb, var(--amber) 30%, transparent); }
.st-expired { color: var(--faint); background: var(--surface-2); text-decoration: line-through; text-decoration-color: var(--faint); }
.st-error { color: var(--red); background: var(--red-soft); border-color: color-mix(in srgb, var(--red) 30%, transparent); }
.st-running .sp-dot { animation: pulse 2.2s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .45; } }

.tag, .pill {
  display: inline-flex; align-items: center; gap: 5px; height: 21px; padding: 0 8px;
  border-radius: 999px; border: 1px solid var(--border); background: var(--surface-2);
  color: var(--muted); font-size: 11.6px; font-weight: 600; white-space: nowrap;
}
.pill.pressure-ok { color: var(--green); background: var(--green-soft); }
.pill.pressure-tight { color: var(--amber); background: var(--amber-soft); }
.pill.pressure-full { color: var(--red); background: var(--red-soft); }
.tag.accent { color: var(--accent); background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 30%, transparent); }

/* ---------------------------------------------------------------- buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 36px; padding: 0 14px; border-radius: var(--radius-sm);
  font: inherit; font-size: 13.5px; font-weight: 580; letter-spacing: .01em;
  border: 1px solid transparent; cursor: pointer; white-space: nowrap;
  text-decoration: none; transition: background var(--t), color var(--t), border-color var(--t), transform var(--t);
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .48; cursor: not-allowed; transform: none; }
.btn.primary { background: var(--accent); color: #fff; box-shadow: 0 1px 0 rgba(255, 255, 255, .12) inset; }
.btn.primary:hover { background: var(--accent-hover); color: #fff; }
.btn.ghost { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn.ghost:hover { background: var(--surface-2); border-color: var(--border-strong); color: var(--text-strong); }
.btn.danger { background: var(--red-soft); color: var(--red); border-color: color-mix(in srgb, var(--red) 34%, transparent); }
.btn.danger:hover { background: color-mix(in srgb, var(--red) 22%, transparent); color: var(--red); }
.btn.solid-danger { background: var(--red); color: #fff; }
.btn.sm { height: 30px; padding: 0 11px; font-size: 12.8px; border-radius: var(--radius-xs); }
.btn.lg { height: 42px; padding: 0 18px; font-size: 14.5px; }
.btn.block { width: 100%; }
.btn.icon { padding: 0 9px; min-width: 32px; }
.btn-link { background: none; border: 0; color: var(--accent); font: inherit; font-size: 13px; cursor: pointer; padding: 0; }
.btn-link:hover { text-decoration: underline; }
.btn-group { display: inline-flex; gap: 8px; flex-wrap: wrap; }
.copy-btn { position: relative; }
.copy-btn[data-copied="1"] { color: var(--green); border-color: color-mix(in srgb, var(--green) 40%, transparent); }

/* ---------------------------------------------------------------- forms */
form { margin: 0; }
.field { display: block; margin-bottom: 14px; }
.field > .label, .field > label, label.label {
  display: block; font-size: 12.8px; font-weight: 600; color: var(--text);
  margin-bottom: 6px; letter-spacing: .01em;
}
.field .hint { display: block; color: var(--muted); font-size: 12.2px; margin-top: 5px; }
.field .req { color: var(--red); }
input[type="text"], input[type="email"], input[type="password"], input[type="number"],
input[type="search"], input[type="url"], select, textarea {
  width: 100%; background: var(--surface-2); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 9px 11px; font: inherit; font-size: 14px; min-height: 38px;
  transition: border-color var(--t), background var(--t), box-shadow var(--t);
  appearance: none;
}
textarea { min-height: 92px; resize: vertical; font-size: 13.5px; line-height: 1.5; }
select {
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 17px) 16px, calc(100% - 12px) 16px;
  background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; padding-right: 32px;
}
input::placeholder, textarea::placeholder { color: var(--faint); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input[aria-invalid="true"], textarea[aria-invalid="true"], select[aria-invalid="true"] { border-color: var(--red); }
input[type="checkbox"] { accent-color: var(--accent); width: 16px; height: 16px; min-height: 0; }
.check { display: flex; align-items: flex-start; gap: 9px; font-size: 13.5px; margin-bottom: 14px; }
.check input { margin-top: 3px; flex: none; }
.check label { color: var(--text); }
.field-row { display: grid; gap: 0 12px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .field-row.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 640px) { .field-row.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.fieldset { border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; margin: 0 0 16px; }
.fieldset > legend { padding: 0 6px; font-size: 12.4px; font-weight: 620; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.form-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 18px; }
.inline-form { display: inline-flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.inline-form input[type="number"] { width: 96px; }

/* errors + notices */
.errors { list-style: none; margin: 0 0 16px; padding: 12px 14px; border-radius: var(--radius-sm);
  background: var(--red-soft); border: 1px solid color-mix(in srgb, var(--red) 34%, transparent); color: var(--text); font-size: 13.2px; }
.errors li + li { margin-top: 5px; }
.errors li::before { content: "•"; color: var(--red); margin-right: 8px; }
.notice {
  border-radius: var(--radius-sm); padding: 11px 13px; font-size: 13.2px;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text);
}
.notice.warn { background: var(--amber-soft); border-color: color-mix(in srgb, var(--amber) 34%, transparent); }
.notice.ok { background: var(--green-soft); border-color: color-mix(in srgb, var(--green) 34%, transparent); }
.notice.bad { background: var(--red-soft); border-color: color-mix(in srgb, var(--red) 34%, transparent); }
.notice-title { font-weight: 640; color: var(--text-strong); display: block; margin-bottom: 3px; }

/* ------------------------------------------------------------- ssh panels */
.ssh-row { display: flex; gap: 8px; align-items: stretch; }
.ssh-cmd {
  flex: 1 1 auto; min-width: 0; margin: 0; padding: 10px 12px; border-radius: var(--radius-sm);
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text);
  font-family: var(--mono); font-size: 12.8px; overflow-x: auto; white-space: pre; line-height: 1.5;
}
.ssh-key {
  display: block; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--surface-2);
  border: 1px dashed var(--border-strong); color: var(--text); font-family: var(--mono); font-size: 12.6px;
  overflow-wrap: anywhere; word-break: break-all; margin: 0;
}
.onetime {
  border: 1px solid color-mix(in srgb, var(--amber) 45%, transparent); background: var(--amber-soft);
  border-radius: var(--radius); padding: 14px;
}
.onetime .ot-pw {
  font-family: var(--mono); font-size: 17px; font-weight: 600; color: var(--text-strong);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-xs);
  padding: 9px 12px; display: inline-block; overflow-wrap: anywhere; word-break: break-all; margin: 8px 0;
}
.dismissible { position: relative; }
.dismissible > .dismiss { position: absolute; top: 8px; right: 8px; background: none; border: 0; color: var(--muted); cursor: pointer; font: inherit; font-size: 15px; line-height: 1; padding: 6px; border-radius: 8px; }
.dismissible > .dismiss:hover { color: var(--text-strong); background: var(--surface-2); }

/* ------------------------------------------------------------------ kv */
.kv { display: grid; grid-template-columns: minmax(110px, 40%) 1fr; gap: 7px 14px; margin: 0; font-size: 13.2px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; color: var(--text-strong); overflow-wrap: anywhere; }
.kv dd.mono { font-family: var(--mono); font-size: 12.6px; }

/* ---------------------------------------------------------------- tables */
.table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.table { width: 100%; border-collapse: collapse; font-size: 13.2px; }
table.table th, table.table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.table th { color: var(--muted); font-weight: 600; font-size: 12.2px; text-transform: uppercase; letter-spacing: .05em; white-space: nowrap; }
table.table tbody tr:last-child td { border-bottom: 0; }
table.table tbody tr { transition: background var(--t); }
table.table tbody tr:hover { background: var(--surface-2); }
table.table td.num, table.table th.num { text-align: right; font-family: var(--mono); }
@media (max-width: 639px) {
  table.table.stack-mobile thead { display: none; }
  table.table.stack-mobile, table.table.stack-mobile tbody, table.table.stack-mobile tr, table.table.stack-mobile td { display: block; width: 100%; }
  table.table.stack-mobile tr { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px 10px; margin-bottom: 10px; background: var(--surface-2); }
  table.table.stack-mobile td { border: 0; padding: 4px 0; display: flex; gap: 10px; justify-content: space-between; }
  table.table.stack-mobile td::before { content: attr(data-label); color: var(--muted); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
  table.table.stack-mobile td[data-label=""]::before { content: none; }
}

/* ------------------------------------------------------------- lists */
.list { list-style: none; margin: 0; padding: 0; }
.list > li { padding: 13px 0; border-bottom: 1px solid var(--border); }
.list > li:first-child { padding-top: 0; }
.list > li:last-child { border-bottom: 0; padding-bottom: 0; }
.list-item-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: space-between; }
.list-title { font-weight: 620; color: var(--text-strong); font-size: 14px; }
.meta-line { color: var(--muted); font-size: 12.4px; display: flex; flex-wrap: wrap; gap: 4px 10px; margin-top: 4px; }
.meta-line .sep { color: var(--border-strong); }

/* ---------------------------------------------------------------- empty */
.empty {
  text-align: center; padding: 34px 18px; border: 1px dashed var(--border-strong);
  border-radius: var(--radius); background: var(--surface); color: var(--muted);
}
.empty .empty-title { color: var(--text-strong); font-weight: 620; font-size: 14.5px; margin-bottom: 4px; }
.empty .btn { margin-top: 12px; }
.empty-mark { width: 34px; height: 34px; border-radius: 9px; border: 1px solid var(--border); background: var(--surface-2); display: inline-block; margin-bottom: 10px; }

/* ---------------------------------------------------------------- toasts */
.toasts {
  position: fixed; z-index: 80; left: 12px; right: 12px; bottom: 12px;
  display: grid; gap: 8px; pointer-events: none;
}
@media (min-width: 720px) { .toasts { left: auto; right: 18px; top: calc(var(--header-h) + 12px); bottom: auto; width: 360px; } }
.toast {
  pointer-events: auto; display: flex; align-items: flex-start; gap: 10px;
  background: var(--surface); border: 1px solid var(--border); border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm); padding: 11px 12px; box-shadow: var(--shadow);
  font-size: 13.2px; animation: toast-in 180ms ease both;
}
.toast-ok { border-left-color: var(--green); }
.toast-error { border-left-color: var(--red); }
.toast-info { border-left-color: var(--accent); }
.toast-dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 6px; flex: none; background: var(--accent); }
.toast-ok .toast-dot { background: var(--green); }
.toast-error .toast-dot { background: var(--red); }
.toast-msg { flex: 1 1 auto; }
.toast-close { background: none; border: 0; color: var(--muted); cursor: pointer; font: inherit; font-size: 14px; line-height: 1; padding: 4px 6px; border-radius: 6px; }
.toast-close:hover { color: var(--text-strong); background: var(--surface-2); }
.toast[hidden] { display: none; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* -------------------------------------------------------------- details */
details.disclosure {
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); overflow: hidden;
}
details.disclosure > summary {
  cursor: pointer; padding: 12px 14px; font-size: 13.5px; font-weight: 600; color: var(--text);
  list-style: none; display: flex; align-items: center; gap: 8px;
}
details.disclosure > summary::-webkit-details-marker { display: none; }
details.disclosure > summary::after { content: "+"; margin-left: auto; color: var(--muted); font-weight: 500; }
details.disclosure[open] > summary::after { content: "\2212"; }
details.disclosure > summary:hover { background: var(--surface-2); }
details.disclosure > .disclosure-body { padding: 0 14px 16px; border-top: 1px solid var(--border); }
details.disclosure > .disclosure-body > :first-child { margin-top: 14px; }
details.reveal > summary { cursor: pointer; color: var(--muted); font-size: 12.8px; }
details.danger-zone { border-color: color-mix(in srgb, var(--red) 32%, var(--border)); }
details.danger-zone > summary { color: var(--red); }

/* ---------------------------------------------------------------- dialog */
dialog.confirm-dialog {
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  border-radius: var(--radius); padding: 18px; width: min(440px, calc(100vw - 32px));
  box-shadow: var(--shadow);
}
dialog.confirm-dialog::backdrop { background: rgba(3, 6, 12, .62); backdrop-filter: blur(2px); }
.cd-title { font-size: 16px; margin-bottom: 8px; }
.cd-msg { color: var(--muted); font-size: 13.4px; }
.cd-input-wrap { margin-top: 14px; }
.cd-input-wrap[hidden] { display: none; }
.cd-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }

/* ------------------------------------------------------------ pagination */
.pagination { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 18px; flex-wrap: wrap; }
.pagination .page-info { color: var(--muted); font-size: 12.8px; }

/* ------------------------------------------------------------ animations */
.load-in { animation: fade-up 320ms ease both; }
.load-in:nth-child(2) { animation-delay: 40ms; }
.load-in:nth-child(3) { animation-delay: 80ms; }
.load-in:nth-child(4) { animation-delay: 120ms; }
@keyframes fade-up { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
  .load-in { opacity: 1; transform: none; }
}

/* ---------------------------------------------------------------- footer */
.site-footer { border-top: 1px solid var(--border); padding: 20px 0 30px; margin-top: 40px; color: var(--muted); font-size: 12.6px; }
.footer-inner { display: flex; flex-wrap: wrap; gap: 10px 18px; align-items: center; justify-content: space-between; }
.footer-links { display: flex; gap: 14px; flex-wrap: wrap; }

/* --------------------------------------------------------------- admin */
.admin-tabs {
  display: flex; gap: 4px; overflow-x: auto; margin: 0 0 18px; padding: 4px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
  -webkit-overflow-scrolling: touch;
}
.admin-tabs a {
  color: var(--muted); font-size: 13.2px; font-weight: 570; padding: 8px 12px; border-radius: var(--radius-xs);
  white-space: nowrap; text-decoration: none;
}
.admin-tabs a:hover { color: var(--text-strong); background: var(--surface-2); text-decoration: none; }
.admin-tabs a[aria-current="page"] { color: #fff; background: var(--accent); }
:root[data-theme="light"] .admin-tabs a[aria-current="page"] { color: #fff; }
.admin-badge { font-size: 11.6px; font-weight: 640; color: var(--accent); background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent); border-radius: 999px; padding: 2px 8px; }

/* -------------------------------------------------------------- sparkline */
.spark { display: flex; align-items: flex-end; gap: 2px; height: 46px; padding: 6px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-xs); }
.spark span { flex: 1 1 0; min-width: 2px; background: var(--accent); border-radius: 2px 2px 0 0; opacity: .85; }
.spark span.hi { background: var(--amber); }
.spark span.max { background: var(--red); }
.logs {
  margin: 0; padding: 12px; border-radius: var(--radius-sm); background: var(--surface-2);
  border: 1px solid var(--border); color: var(--text); font-family: var(--mono); font-size: 12.2px;
  white-space: pre-wrap; overflow-wrap: anywhere; max-height: 320px; overflow-y: auto;
}

/* -------------------------------------------------------------- helpers */
.hero { padding: 34px 0 6px; }
.hero h1 { font-size: 30px; line-height: 1.16; letter-spacing: -.025em; }
.hero .lede { color: var(--muted); font-size: 15px; max-width: 620px; margin-top: 12px; }
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 20px; }
.step-num { width: 24px; height: 24px; border-radius: 7px; background: var(--accent-soft); color: var(--accent); display: inline-grid; place-items: center; font-size: 12.5px; font-weight: 700; flex: none; }
.auth-wrap { max-width: 420px; margin: 26px auto 40px; }
.auth-wrap .card { padding: 20px; }
.auth-foot { text-align: center; color: var(--muted); font-size: 13px; margin-top: 16px; }
.error-page { text-align: center; padding: 60px 0; }
.error-code { font-size: 54px; font-weight: 700; letter-spacing: -.04em; color: var(--text-strong); line-height: 1; }
.price-note { font-family: var(--mono); font-size: 12.6px; color: var(--muted); }

/* ------------------------------------------------------------------ nav fix
   The mobile menu button must never show while the inline nav is present.
   Cause: the generic `.btn` rule lives at the bottom of this file, AFTER the
   `@media (min-width: 720px) { .nav-toggle { display: none } }` block above.
   Same specificity, later wins, so `.btn`'s display beat it and "Menu" stayed
   visible on desktop.  Restating it here, last, settles the order for good.     */
@media (min-width: 720px) {
  .nav-toggle { display: none !important; }
}

/* --------------------------------------------------- account-number flow
   Generator, reveal, sign-in and the dashboard/acct cards. Reuses the tokens
   above — no second palette. 48px touch targets, mobile-first. */
.btn.tap { min-height: 48px; }

.acct-num {
  display: block; margin: 10px 0;
  font-family: var(--mono); font-size: 19px; font-weight: 620; letter-spacing: .09em;
  color: var(--text-strong); background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 12px 14px; line-height: 1.35;
  overflow-wrap: anywhere; word-break: break-all;
  -webkit-user-select: all; user-select: all;
}
@media (min-width: 520px) { .acct-num { font-size: 23px; letter-spacing: .1em; } }

input.acct-input {
  font-family: var(--mono); font-size: 17px; letter-spacing: .08em;
  min-height: 48px; padding: 11px 12px;
}
@media (min-width: 520px) { input.acct-input { font-size: 19px; } }

/* ------------------------------------------------------------------------- *
 * Box plans: pick one and the numbers fill themselves (apply page).
 * State is carried by both :has() and a JS-set .is-picked class, so the card
 * highlights on browsers without :has() too.
 * ------------------------------------------------------------------------- */
.plan-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 10px;
  margin: 12px 0 6px;
}
.plan-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 12px 13px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  cursor: pointer;
  transition: border-color var(--t), background var(--t), transform var(--t);
}
.plan-card:hover { border-color: var(--border-strong); transform: translateY(-1px); }
.plan-card input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  pointer-events: none;
}
.plan-card.is-picked,
.plan-card:has(input[type="radio"]:checked) {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.plan-card input[type="radio"]:focus-visible ~ .pc-label { box-shadow: var(--ring); border-radius: 4px; }
.plan-card .pc-label { font-weight: 600; color: var(--text-strong); }
.plan-card .pc-specs { font-size: 12.5px; color: var(--muted); }
.plan-card .pc-note { font-size: 12px; color: var(--faint); }
@media (max-width: 560px) {
  .plan-grid { grid-template-columns: 1fr; }
}
