:root {
  --bg: #e2e8f0;
  --surface: rgba(255, 255, 255, 0.78);
  --surface-solid: #ffffff;
  --surface-2: rgba(226, 232, 240, 0.95);
  --border: rgba(100, 116, 139, 0.28);
  --border-light: rgba(100, 116, 139, 0.4);
  --text: #0f172a;
  --text-secondary: #475569;
  --text-tertiary: #64748b;
  --accent: #3f68b0;
  --accent-hover: #345899;
  --accent-soft: rgba(63, 104, 176, 0.16);
  --accent-fg: #ffffff;
  --accent-glow: rgba(63, 104, 176, 0.28);
  --input-bg: rgba(255, 255, 255, 0.9);
  --ok: #2f7d62;
  --warn: #b07d2e;
  --bad: #b04848;
  --radius: 12px;
  --radius-lg: 18px;
  --radius-xl: 22px;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.05), 0 8px 24px rgba(15, 23, 42, 0.08);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Helvetica Neue", Inter, sans-serif;
  --sidebar-w: 260px;
  --transition: 0.2s cubic-bezier(0.25, 0.1, 0.25, 1);
  --blur: blur(18px) saturate(150%);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font);
  background:
    radial-gradient(1100px 520px at 8% -8%, rgba(63, 104, 176, 0.2), transparent 55%),
    radial-gradient(900px 480px at 100% 0%, rgba(80, 120, 180, 0.14), transparent 50%),
    radial-gradient(700px 400px at 70% 100%, rgba(100, 130, 175, 0.1), transparent 45%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font-size: 15px;
  line-height: 1.47;
  letter-spacing: -0.01em;
}

a { color: inherit; text-decoration: none; }

h1, h2, h3 {
  margin: 0;
  font-weight: 600;
  letter-spacing: -0.025em;
}

h1 { font-size: 2rem; line-height: 1.1; }
h2 { font-size: 1.125rem; font-weight: 600; }
h3 { font-size: 1rem; font-weight: 600; }

p { margin: 0; line-height: 1.5; }

/* ── Gate (login/register) ── */
.gate {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 2rem 1.25rem;
  background:
    radial-gradient(900px 480px at 20% 0%, rgba(63, 104, 176, 0.18), transparent 55%),
    radial-gradient(700px 420px at 90% 100%, rgba(80, 120, 180, 0.12), transparent 50%),
    var(--bg);
}

.gate-card {
  width: min(400px, 100%);
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: var(--radius-xl);
  padding: 2.5rem 2rem 2rem;
  box-shadow: var(--shadow);
}

.gate-logo {
  width: 48px;
  height: 48px;
  background: linear-gradient(145deg, rgba(63, 104, 176, 0.95), rgba(52, 88, 153, 0.85));
  border-radius: 12px;
  display: grid;
  place-items: center;
  margin-bottom: 1.25rem;
  box-shadow: 0 6px 16px var(--accent-glow);
}

.gate-logo svg, .gate-logo img { color: var(--accent-fg); filter: brightness(0) invert(1); }

.gate-card .mark {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.04em;
  margin-bottom: 0.35rem;
}

.gate-card .sub {
  color: var(--text-secondary);
  margin: 0 0 1.75rem;
  font-size: 0.9375rem;
}

.hint {
  margin-top: 1.25rem;
  color: var(--text-secondary);
  font-size: 0.8125rem;
}

.hint a { text-decoration: underline; text-underline-offset: 2px; }

/* ── Layout ── */
.layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}

.side {
  background: rgba(255, 255, 255, 0.68);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  border-right: 1px solid var(--border);
  padding: 1.25rem 0.875rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0.625rem 1.25rem;
}

.brand-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(145deg, rgba(63, 104, 176, 0.95), rgba(52, 88, 153, 0.85));
  border-radius: 9px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  box-shadow: 0 4px 12px var(--accent-glow);
}

.brand-icon svg, .brand-icon img { color: var(--accent-fg); filter: brightness(0) invert(1); width: 18px; height: 18px; }

.brand .mark {
  font-size: 1.125rem;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.brand .sub {
  color: var(--text-secondary);
  font-size: 0.75rem;
  margin-top: 0.1rem;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}

.nav a, .nav button.navlink {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.5rem 0.75rem;
  border-radius: 10px;
  color: var(--text-secondary);
  background: none;
  border: 0;
  font: inherit;
  font-size: 0.9375rem;
  cursor: pointer;
  width: 100%;
  text-align: left;
  transition: background var(--transition), color var(--transition);
}

.nav a .icon, .nav button .icon {
  width: 20px;
  height: 20px;
  opacity: 0.7;
  flex-shrink: 0;
}

.nav a:hover { background: var(--accent-soft); color: var(--accent); }
.nav a.active { background: var(--accent-soft); color: var(--accent); font-weight: 550; }
.nav a.active .icon { opacity: 1; }

.nav-spacer { flex: 1; }

.badge {
  margin-left: auto;
  font-size: 0.6875rem;
  font-weight: 600;
  background: var(--surface-2);
  color: var(--text-secondary);
  border-radius: 99px;
  padding: 0.15rem 0.5rem;
  min-width: 1.25rem;
  text-align: center;
}

.badge.warn {
  background: var(--accent);
  color: var(--accent-fg);
}

.alert-banner {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0 0.625rem 0.5rem;
  padding: 0.5rem 0.75rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

.who {
  margin-top: auto;
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  padding: 0.75rem 0.625rem;
  border-top: 1px solid var(--border);
  margin-left: -0.125rem;
  margin-right: -0.125rem;
}

.who-meta {
  flex: 1;
  min-width: 0;
}

.logout-form {
  margin-top: 0.5rem;
}

.logout-btn {
  width: 100%;
  justify-content: center;
  min-height: 36px;
  border-radius: 10px;
}

.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: 0.75rem;
  font-weight: 600;
  flex-shrink: 0;
}

.who-name {
  font-size: 0.875rem;
  font-weight: 500;
}

.who small {
  display: block;
  color: var(--text-secondary);
  font-size: 0.75rem;
}

.who .navlink {
  padding: 0;
  margin-top: 0.15rem;
  font-size: 0.75rem;
  color: var(--text-secondary);
  width: auto;
}

.who .navlink:hover { color: var(--text); background: none; }

/* removed — logout uses .logout-btn */

/* ── Main content ── */
.main {
  padding: 2rem 2.5rem 3rem;
  max-width: 1200px;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.page-header-meta {
  color: var(--text-secondary);
  font-size: 0.8125rem;
  text-align: right;
  max-width: 280px;
  line-height: 1.4;
}

.kicker {
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.6875rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
}

/* ── Stats ── */
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
  margin-bottom: 1.75rem;
}

.stat {
  background: rgba(255, 255, 255, 0.62);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: var(--radius-lg);
  padding: 1.125rem 1.25rem;
  box-shadow: var(--shadow);
  transition: border-color var(--transition), transform var(--transition);
}

.stat:hover {
  border-color: rgba(63, 104, 176, 0.4);
  transform: translateY(-1px);
}

.stat b {
  display: block;
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1;
  margin-bottom: 0.35rem;
}

.stat span {
  color: var(--text-secondary);
  font-size: 0.8125rem;
}

/* ── Grid & Cards ── */
.grid-2 {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 0.75rem;
}

.card {
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow);
}

.card.glass {
  background: rgba(255, 255, 255, 0.62);
}

.card h2 { margin-bottom: 1rem; }

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

/* ── List rows ── */
.list-row {
  display: grid;
  grid-template-columns: 1.4fr 0.8fr 0.8fr 0.6fr;
  gap: 0.75rem;
  padding: 0.875rem 0;
  border-bottom: 1px solid var(--border);
  align-items: center;
  transition: opacity var(--transition);
}

.list-row:last-child { border-bottom: 0; }
.list-row:hover { opacity: 0.85; }

.row-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 500;
}

.muted { color: var(--text-secondary); }
.small { font-size: 0.8125rem; }

/* ── Status dots ── */
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.status-dot.fresh { background: var(--ok); }
.status-dot.stale, .status-dot.missing { background: var(--text-secondary); box-shadow: none; }
.status-dot.empty { background: var(--text-tertiary); }

.status-label {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.2rem 0.55rem;
  border-radius: 99px;
  border: 1px solid var(--border);
  color: var(--text-secondary);
}

.status-pill.fresh { border-color: #a7f3d0; color: var(--ok); background: #ecfdf5; }
.status-pill.stale, .status-pill.missing { border-color: var(--border-light); }

/* ── Forms ── */
input, textarea, select {
  width: 100%;
  font: inherit;
  font-size: 0.9375rem;
  color: var(--text);
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.625rem 0.875rem;
  transition: border-color var(--transition);
  outline: none;
}

input:focus, textarea:focus, select:focus {
  border-color: rgba(63, 104, 176, 0.55);
  box-shadow: 0 0 0 3px rgba(63, 104, 176, 0.16);
}

label {
  display: block;
  margin: 0 0 1rem;
  color: var(--text-secondary);
  font-size: 0.8125rem;
  font-weight: 500;
}

label input, label textarea, label select { margin-top: 0.375rem; }
label input[type="checkbox"] { width: auto; margin: 0; }

form p { margin: 0 0 0.75rem; }
form p label { margin-bottom: 0; }

/* ── Structured form fields ── */
.field { margin-bottom: 1rem; }
.field-label {
  display: block;
  margin-bottom: 0.375rem;
  color: var(--text);
  font-size: 0.8125rem;
  font-weight: 600;
}
.field-hint {
  margin: 0.35rem 0 0;
  color: var(--text-tertiary);
  font-size: 0.75rem;
  line-height: 1.4;
}
.field-check { margin-bottom: 0.75rem; }
.checkbox-field {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  margin: 0;
  cursor: pointer;
  color: var(--text);
  font-size: 0.9375rem;
  font-weight: 500;
}
.checkbox-field input[type="checkbox"] {
  width: 1.0625rem;
  height: 1.0625rem;
  margin: 0;
  padding: 0;
  flex-shrink: 0;
  accent-color: var(--accent);
  cursor: pointer;
}
.checkbox-label { flex: 1; }
.field .errorlist { margin: 0.35rem 0 0; }

.danger-zone {
  margin-top: 1.25rem;
  border-color: var(--border-light);
}

.btn-danger {
  border-color: var(--text);
  color: var(--text);
}

.btn-danger:hover {
  background: var(--text);
  color: var(--accent-fg);
}

/* ── Buttons ── */
button, .btn {
  font: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  border-radius: 980px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  padding: 0.5rem 1.125rem;
  transition: background var(--transition), border-color var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
}

button:hover, .btn:hover {
  background: var(--surface-2);
  border-color: var(--border-light);
}

.btn-primary, button[type="submit"]:not(.ghost):not(.navlink) {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-fg);
}

.btn-primary:hover, button[type="submit"]:not(.ghost):not(.navlink):hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.btn-ghost {
  color: var(--text-secondary);
  border-color: transparent;
  padding-left: 0.75rem;
  padding-right: 0.75rem;
}

.btn-ghost:hover { color: var(--text); background: var(--surface-2); }

.btn-sm {
  font-size: 0.8125rem;
  padding: 0.375rem 0.875rem;
}

.btn-row {
  display: flex;
  gap: 0.375rem;
  flex-wrap: wrap;
  align-items: center;
}

.btn-row form { display: inline; margin: 0; }

.btn .icon { width: 14px; height: 14px; }

/* ── Messages ── */
.messages {
  list-style: none;
  padding: 0;
  margin: 0 0 1.25rem;
}

.messages li {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  margin-bottom: 0.5rem;
  font-size: 0.875rem;
}

.errorlist {
  color: var(--text-secondary);
  padding-left: 1rem;
  font-size: 0.8125rem;
}

/* ── Table ── */
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.table th {
  text-align: left;
  padding: 0.5rem 0.25rem 0.75rem;
  color: var(--text-secondary);
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border);
}

.table td {
  text-align: left;
  padding: 0.875rem 0.25rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.table tr:last-child td { border-bottom: 0; }

/* ── People ── */
.people {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 0.75rem;
}

.person {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
}

.person .avatar { width: 44px; height: 44px; font-size: 0.875rem; }

/* ── Activity log ── */
.log-list { display: flex; flex-direction: column; }

.log-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.75rem 1rem;
  padding: 0.875rem 0;
  border-bottom: 1px solid var(--border);
  align-items: start;
  font-size: 0.875rem;
}

.log-item:last-child { border-bottom: 0; }

.log-action {
  font-weight: 500;
  font-family: ui-monospace, "SF Mono", monospace;
  font-size: 0.8125rem;
  color: var(--text-secondary);
  white-space: nowrap;
}

.log-detail { color: var(--text-secondary); font-size: 0.8125rem; }

.log-time {
  color: var(--text-tertiary);
  font-size: 0.75rem;
  white-space: nowrap;
}

/* ── Search ── */
.search-bar {
  position: relative;
  margin-bottom: 1rem;
}

.search-bar .icon {
  position: absolute;
  left: 0.875rem;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--text-tertiary);
  pointer-events: none;
}

.search-bar input {
  padding-left: 2.5rem;
  background: var(--input-bg);
}

/* ── Health check ── */
.health-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.875rem 1rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 1rem;
  font-size: 0.875rem;
}

.health-row.ok { border-color: var(--border-light); }
.health-row.fail { border-color: var(--border); }

.health-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-secondary);
  flex-shrink: 0;
}

.health-row.ok .health-dot { background: var(--accent); }
.health-row.fail .health-dot { background: var(--text-tertiary); }

/* ── Empty state ── */
.empty {
  text-align: center;
  padding: 2.5rem 1rem;
  color: var(--text-secondary);
  font-size: 0.9375rem;
}

.empty-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto 1rem;
  opacity: 0.4;
}

/* ── Vault info bar ── */
.vault-bar {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
  padding: 0.875rem 1.125rem;
  background: rgba(255, 255, 255, 0.58);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: var(--radius-lg);
  margin-bottom: 1.75rem;
  font-size: 0.8125rem;
  box-shadow: var(--shadow);
}

.vault-bar dt {
  color: var(--text-tertiary);
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
  margin-bottom: 0.15rem;
}

.vault-bar dd {
  margin: 0;
  color: var(--text-secondary);
  font-weight: 500;
}

/* ── Host stats ── */
.host-stats {
  margin-bottom: 1.75rem;
}

.host-stats .card-header {
  margin-bottom: 1.25rem;
}

.host-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
  align-items: start;
}

.host-metric {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.45rem;
}

.gauge {
  --p: 0;
  --used: #3f68b0;
  --free: #c5d0e0;
  position: relative;
  width: 8rem;
  height: 8rem;
}

.gauge-disk {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: conic-gradient(
    from -90deg,
    var(--used) 0 calc(var(--p) * 1%),
    var(--free) 0 100%
  );
  box-shadow:
    inset 0 0 0 1px rgba(15, 23, 42, 0.06),
    0 4px 14px rgba(15, 23, 42, 0.08);
}

/* вырезаем центр — получается кольцо с двумя цветами занятости */
.gauge-disk::after {
  content: "";
  position: absolute;
  inset: 18%;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.04);
}

.gauge[data-tone="cool"] {
  --used: #3f68b0;
  --free: #c8d3e4;
}
.gauge[data-tone="warm"] {
  --used: #b07d2e;
  --free: #e6d7b8;
}
.gauge[data-tone="hot"] {
  --used: #b04848;
  --free: #e5c4c4;
}

.gauge-center {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.12rem;
  pointer-events: none;
}

.gauge-center strong {
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1;
  color: var(--text);
}

.gauge-center span {
  font-size: 0.6875rem;
  font-weight: 650;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.gauge-legend {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  margin-top: 0.15rem;
}

.leg {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.6875rem;
  color: var(--text-secondary);
}

.leg::before {
  content: "";
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 2px;
}

.leg.used::before { background: var(--accent); }
.leg.free::before { background: #c8d3e4; }

.host-metric:has([data-tone="warm"]) .leg.used::before { background: #b07d2e; }
.host-metric:has([data-tone="warm"]) .leg.free::before { background: #e6d7b8; }
.host-metric:has([data-tone="hot"]) .leg.used::before { background: #b04848; }
.host-metric:has([data-tone="hot"]) .leg.free::before { background: #e5c4c4; }

.host-caption {
  margin: 0;
  font-size: 0.75rem;
  color: var(--text-secondary);
  line-height: 1.35;
  max-width: 12rem;
}

.host-path {
  margin: 0;
  font-size: 0.6875rem;
}

/* legacy meter */
.meter {
  height: 6px;
  background: rgba(148, 163, 184, 0.25);
  border-radius: 99px;
  overflow: hidden;
}

.meter-fill {
  display: block;
  height: 100%;
  width: 0;
  max-width: 100%;
  background: rgba(63, 104, 176, 0.75);
  border-radius: 99px;
}

/* ── Responsive ── */
.topbar {
  display: none;
}

.nav-close {
  display: none;
}

.side-backdrop {
  display: none;
}

body.nav-lock {
  overflow: hidden;
}

@media (max-width: 960px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .topbar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    position: sticky;
    top: 0;
    z-index: 30;
    min-height: 52px;
    padding: 0.5rem 0.875rem;
    padding-top: max(0.5rem, env(safe-area-inset-top));
    padding-left: max(0.875rem, env(safe-area-inset-left));
    padding-right: max(0.875rem, env(safe-area-inset-right));
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: saturate(180%) blur(16px);
    -webkit-backdrop-filter: saturate(180%) blur(16px);
    border-bottom: 1px solid var(--border);
  }

  .topbar-brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
    min-width: 0;
  }

  .topbar-brand .brand-icon {
    width: 28px;
    height: 28px;
    border-radius: 7px;
  }

  .topbar-brand .brand-icon img {
    width: 14px;
    height: 14px;
  }

  .topbar-brand .mark {
    font-size: 1.0625rem;
    font-weight: 700;
    letter-spacing: -0.03em;
  }

  .topbar-stale {
    flex-shrink: 0;
  }

  .nav-toggle {
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--surface);
    display: inline-flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    flex-shrink: 0;
  }

  .nav-toggle-bar {
    display: block;
    width: 16px;
    height: 2px;
    border-radius: 2px;
    background: var(--text);
  }

  .side-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 35;
    background: rgba(0, 0, 0, 0.35);
  }

  .side-backdrop[hidden] {
    display: none;
  }

  .side {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 40;
    width: min(300px, 86vw);
    height: 100dvh;
    padding: 1rem 0.875rem;
    padding-top: max(1rem, env(safe-area-inset-top));
    padding-bottom: max(1rem, env(safe-area-inset-bottom));
    border-right: 1px solid var(--border);
    border-bottom: 0;
    flex-direction: column;
    flex-wrap: nowrap;
    transform: translateX(-105%);
    transition: transform 0.22s cubic-bezier(0.25, 0.1, 0.25, 1);
    box-shadow: none;
  }

  .layout.nav-open .side {
    transform: translateX(0);
    box-shadow: 8px 0 32px rgba(0, 0, 0, 0.12);
  }

  .side .brand {
    padding-right: 2.5rem;
    position: relative;
  }

  .nav-close {
    display: grid;
    place-items: center;
    position: absolute;
    right: 0.25rem;
    top: 0.35rem;
    width: 36px;
    height: 36px;
    padding: 0;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--text-secondary);
    font-size: 1.5rem;
    line-height: 1;
  }

  .nav {
    flex-direction: column;
    flex-wrap: nowrap;
    flex: 1;
    width: auto;
    overflow-y: auto;
  }

  .nav a {
    min-height: 44px;
  }

  .who {
    margin-top: auto;
    border-top: 1px solid var(--border);
    width: auto;
  }

  .main {
    padding: 1.25rem 1rem 2.5rem;
    padding-left: max(1rem, env(safe-area-inset-left));
    padding-right: max(1rem, env(safe-area-inset-right));
    padding-bottom: max(2.5rem, env(safe-area-inset-bottom));
    max-width: none;
  }

  h1 { font-size: 1.625rem; }

  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
  }

  .page-header-meta {
    text-align: left;
    max-width: none;
  }

  .stats {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.625rem;
    margin-bottom: 1.25rem;
  }

  .stat {
    padding: 0.875rem 1rem;
  }

  .stat b {
    font-size: 1.375rem;
  }

  .vault-bar {
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
  }

  .host-stats {
    margin-bottom: 1.25rem;
  }

  .host-stats .card-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.35rem;
  }

  .host-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
  }

  .gauge {
    width: 6.5rem;
    height: 6.5rem;
  }

  .gauge-center strong {
    font-size: 1rem;
  }

  .gauge-legend {
    gap: 0.5rem;
  }

  .grid-2 {
    grid-template-columns: 1fr;
  }

  .list-row {
    grid-template-columns: 1fr auto;
    gap: 0.35rem 0.75rem;
    padding: 0.875rem 0;
  }

  .list-row .row-title {
    grid-column: 1 / -1;
  }

  .list-row .muted.small:nth-child(2) {
    grid-column: 1;
  }

  .card {
    padding: 1rem;
  }

  .card-header {
    gap: 0.75rem;
  }

  .log-item {
    grid-template-columns: 1fr;
    gap: 0.25rem;
  }

  .log-action {
    white-space: normal;
    word-break: break-word;
  }

  .log-time {
    justify-self: start;
  }

  .health-row {
    flex-wrap: wrap;
  }

  .health-row form {
    width: 100%;
  }

  .health-row button {
    width: 100%;
    justify-content: center;
    min-height: 44px;
  }

  .btn-row {
    width: 100%;
  }

  .btn-row .btn,
  .btn-row button {
    flex: 1 1 auto;
    justify-content: center;
    min-height: 44px;
  }

  button[type="submit"].btn-primary,
  .btn-primary {
    width: 100%;
    justify-content: center;
    min-height: 44px;
  }

  .people {
    grid-template-columns: 1fr;
  }

  /* Dump table → stacked cards */
  .table thead {
    display: none;
  }

  .table,
  .table tbody,
  .table tr,
  .table td {
    display: block;
    width: 100%;
  }

  .table tr {
    padding: 0.875rem 0;
    border-bottom: 1px solid var(--border);
  }

  .table tr:last-child {
    border-bottom: 0;
  }

  .table td {
    border: 0;
    padding: 0.2rem 0;
  }

  .table td:first-child {
    margin-bottom: 0.25rem;
  }

  .table td.btn-row {
    margin-top: 0.625rem;
  }

  .gate {
    padding: 1.25rem 1rem;
    padding-bottom: max(1.25rem, env(safe-area-inset-bottom));
  }

  .gate-card {
    padding: 1.75rem 1.25rem 1.5rem;
  }
}

@media (max-width: 480px) {
  .stats {
    grid-template-columns: 1fr 1fr;
  }

  .stat b {
    font-size: 1.25rem;
  }

  .vault-bar {
    font-size: 0.75rem;
  }

  .host-grid {
    grid-template-columns: 1fr;
  }

  .gauge {
    width: 7.25rem;
    height: 7.25rem;
  }

  .page-header-meta {
    font-size: 0.75rem;
  }
}

