:root {
  --bg-base:        #0b0c10;
  --bg-elev-1:      #14161c;
  --bg-elev-2:      #1c1f27;
  --bg-input:       #181a21;
  --border:         rgba(255, 255, 255, 0.07);
  --border-strong:  rgba(255, 255, 255, 0.14);
  --text:           #e8e9ec;
  --text-muted:     rgba(232, 233, 236, 0.62);
  --text-faint:     rgba(232, 233, 236, 0.36);

  /* Synapse accent palette — matches /syntex/runtime/css/syntex.css */
  --color-red:      rgb(225, 50, 0);
  --color-orange:   rgb(255, 165, 0);
  --color-pumpkin:  rgb(243, 112, 118);
  --color-sky:      rgb(61, 148, 226);
  --color-purple:   rgb(153, 42, 246);
  --color-pink:     rgb(235, 44, 187);
  --color-yellow:   rgb(255, 225, 100);
  --color-green:    rgb(100, 200, 50);
  --color-levander: rgb(150, 150, 255);

  --grad-sky:       linear-gradient(141deg, #c8d4cf 0%, #1fc8db 51%, #2cb5e8 75%);
  --grad-purple:    linear-gradient(141deg, rgb(198, 169, 221) 0%, rgb(153, 42, 246) 51%, rgb(128, 42, 199) 75%);
  --grad-pink:      linear-gradient(141deg, rgb(231, 131, 206) 0%, rgb(235, 44, 187) 51%, rgb(175, 32, 139) 85%);
  --grad-red:       linear-gradient(141deg, rgb(255, 120, 70) 0%, rgb(225, 50, 0) 51%, rgb(225, 15, 0) 85%);
  --grad-green:     linear-gradient(141deg, rgb(185, 255, 85) 0%, rgb(100, 200, 50) 51%, rgb(75, 175, 20) 85%);
  --grad-pumpkin:   linear-gradient(141deg, rgb(255, 162, 165) 0%, rgb(243, 112, 118) 51%, rgb(223, 92, 88) 85%);
  --grad-levander:  linear-gradient(141deg, rgb(220, 220, 255) 0%, rgb(150, 150, 255) 51%, rgb(125, 125, 220) 85%);
  --grad-orange:    linear-gradient(141deg, rgb(255, 210, 0) 0%, rgb(255, 165, 0) 51%, rgb(225, 135, 0) 85%);
  --grad-yellow:    linear-gradient(141deg, rgb(255, 255, 215) 15%, rgb(255, 255, 0) 51%, rgb(255, 200, 0) 75%);

  /* Semantic — repointed to syntex tokens */
  --primary:        var(--color-sky);
  --primary-hover:  rgb(91, 178, 246);
  --primary-soft:   rgba(61, 148, 226, 0.15);
  --primary-glow:   rgba(61, 148, 226, 0.35);

  --success:        var(--color-green);
  --success-soft:   rgba(100, 200, 50, 0.13);
  --warn:           var(--color-yellow);
  --warn-soft:      rgba(255, 225, 100, 0.13);
  --danger:         var(--color-red);
  --danger-soft:    rgba(225, 50, 0, 0.15);
  --pink:           var(--color-pink);
  --cyan:           var(--color-sky);

  --shadow-sm: 0 1px 2px rgba(0,0,0,0.4);
  --shadow-md: 0 8px 24px rgba(0,0,0,0.4);
  --shadow-lg: 0 24px 48px rgba(0,0,0,0.55);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;

  --transition: 160ms cubic-bezier(0.2, 0.8, 0.2, 1);

  --sidebar-w: 240px;
  --topbar-h: 60px;

  --mono: 'JetBrains Mono', 'SF Mono', Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0; height: 100%;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  font-size: 14px;
  background: var(--bg-base);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: 'cv02', 'cv03', 'cv04', 'cv11', 'ss01';
}

body {
  display: flex;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background:
    radial-gradient(1200px 600px at 0% 0%, rgba(61, 148, 226, 0.06), transparent 60%),
    radial-gradient(900px 500px at 100% 100%, rgba(235, 44, 187, 0.05), transparent 60%),
    var(--bg-base);
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; }
input { font-family: inherit; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.06); border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.12); }

/* === Sidebar === */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--bg-elev-1);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  position: relative;
  z-index: 30;
  transition: transform var(--transition);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 16px;
  border-bottom: 1px solid var(--border);
}
.brand-mark {
  width: 34px; height: 34px;
  object-fit: contain;
  flex-shrink: 0;
  filter: drop-shadow(0 4px 10px rgba(235, 44, 187, 0.35));
}
.brand-name {
  font-weight: 600;
  font-size: 15px;
  letter-spacing: -0.01em;
  line-height: 1.1;
}
.brand-sub {
  font-size: 11px;
  color: var(--text-faint);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.nav {
  flex: 1;
  overflow-y: auto;
  padding: 12px 10px;
}

.nav-group { margin-bottom: 18px; }
.nav-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-faint);
  padding: 6px 12px;
  margin-bottom: 2px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  margin: 1px 0;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
  user-select: none;
  position: relative;
}
.nav-icon {
  width: 18px;
  display: inline-flex;
  justify-content: center;
  font-size: 13px;
  opacity: 0.7;
}
.nav-item[href] { text-decoration: none; }
.nav-ext {
  margin-left: auto;
  font-size: 9px;
  opacity: 0.35;
}
i.nav-icon { font-size: 14px; }
.nav-item:hover { color: var(--text); background: rgba(255,255,255,0.04); }
.nav-item.active {
  color: var(--text);
  background: var(--primary-soft);
}
.nav-item.active .nav-icon { color: var(--primary); opacity: 1; }
.nav-item.active::before {
  content: '';
  position: absolute;
  left: -10px;
  top: 8px; bottom: 8px;
  width: 3px;
  background: var(--primary);
  border-radius: 0 2px 2px 0;
}

.user-card {
  margin: 10px;
  padding: 10px 12px;
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  gap: 10px;
}
.avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--user-grad, linear-gradient(135deg, var(--color-sky), var(--color-pink)));
  background-size: cover;
  background-position: center;
  flex-shrink: 0;
  display: grid; place-items: center;
  color: white;
  font-weight: 600;
  font-size: 13px;
}
.user-meta { flex: 1; min-width: 0; }
.user-name {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: -0.01em;
}
.user-role {
  font-size: 11px;
  color: var(--text-faint);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-action {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  padding: 5px 10px;
  font-size: 11.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
}
.user-action:hover {
  color: var(--text);
  border-color: var(--border-strong);
  background: rgba(255,255,255,0.03);
}

.sidebar-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  z-index: 25;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition);
}
.sidebar-backdrop.open { opacity: 1; pointer-events: auto; }

/* === Main === */
.main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

.topbar {
  height: var(--topbar-h);
  border-bottom: 1px solid var(--border);
  padding: 0 28px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-shrink: 0;
  background: rgba(20, 22, 28, 0.5);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.page-title {
  font-size: 17px;
  font-weight: 600;
  margin: 0;
  letter-spacing: -0.01em;
  flex: 1;
  display: flex;
  align-items: baseline;
  gap: 10px;
  min-width: 0;
}
.page-title .meta {
  font-size: 12.5px;
  font-weight: 400;
  color: var(--text-faint);
  white-space: nowrap;
}

.page-tools {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.tool-input {
  flex: 0 1 160px;
  min-width: 0;
}

.page-body {
  flex: 1;
  overflow: auto;
  padding: 24px 28px;
  display: flex;
  flex-direction: column;
}

/* === Buttons === */
.btn {
  font-size: 13px;
  font-weight: 500;
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  letter-spacing: -0.005em;
}
.btn:active { transform: translateY(0.5px); }
.btn.primary {
  background: var(--primary);
  color: white;
  box-shadow: 0 1px 0 rgba(255,255,255,0.18) inset, 0 4px 12px var(--primary-glow);
}
.btn.primary:hover { background: var(--primary-hover); }
.btn.ghost {
  background: transparent;
  color: var(--text-muted);
  border-color: var(--border);
}
.btn.ghost:hover {
  color: var(--text);
  border-color: var(--border-strong);
  background: rgba(255,255,255,0.03);
}
.btn.danger {
  background: var(--danger);
  color: white;
  box-shadow: 0 1px 0 rgba(255,255,255,0.18) inset, 0 4px 12px rgba(248,113,113,0.3);
}
.btn.danger:hover { filter: brightness(1.08); }
.btn.sm {
  padding: 4px 10px;
  font-size: 11.5px;
}

/* === Inputs === */
.input {
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: inherit;
  transition: border var(--transition), box-shadow var(--transition);
  min-width: 0;
}
.input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}
.input::placeholder { color: var(--text-faint); }

select.input {
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23999' stroke-width='2'><polyline points='6 9 12 15 18 9'/></svg>");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 28px;
}

/* === Stats grid === */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 14px;
}
.stat-card {
  background: linear-gradient(180deg, var(--bg-elev-1), color-mix(in srgb, var(--bg-elev-1) 92%, transparent));
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  position: relative;
  overflow: hidden;
  transition: border var(--transition), transform var(--transition), box-shadow var(--transition);
}
.stat-card:hover {
  border-color: var(--border-strong);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}
.stat-card::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(80% 60% at 100% 0%, var(--accent, transparent), transparent 70%);
  opacity: 0.18;
  pointer-events: none;
}
.stat-card .label {
  font-size: 11.5px;
  color: var(--text-faint);
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.stat-card .value {
  font-size: 30px;
  font-weight: 700;
  margin-top: 6px;
  letter-spacing: -0.025em;
  font-feature-settings: 'tnum';
}
.stat-card[data-tone="success"] { --accent: var(--success); }
.stat-card[data-tone="success"] .value { color: var(--success); }
.stat-card[data-tone="warn"]    { --accent: var(--warn); }
.stat-card[data-tone="warn"]    .value { color: var(--warn); }
.stat-card[data-tone="danger"]  { --accent: var(--danger); }
.stat-card[data-tone="danger"]  .value { color: var(--danger); }
.stat-card[data-tone="pink"]    { --accent: var(--pink); }
.stat-card[data-tone="pink"]    .value { color: var(--pink); }
.stat-card[data-tone="cyan"]    { --accent: var(--cyan); }
.stat-card[data-tone="cyan"]    .value { color: var(--cyan); }

/* === Table === */
.tbl-wrap {
  background: var(--bg-elev-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: auto;
  flex: 1;
  min-height: 0;
  max-width: 100%;
}
.tbl {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
}
.tbl thead th {
  position: sticky; top: 0;
  background: var(--bg-elev-1);
  border-bottom: 1px solid var(--border);
  text-align: left;
  font-weight: 500;
  color: var(--text-faint);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 11px 14px;
  white-space: nowrap;
  z-index: 1;
}
.tbl tbody td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 320px;
  color: var(--text);
}
.tbl tbody tr {
  transition: background var(--transition);
}
.tbl tbody tr:hover {
  background: rgba(255,255,255,0.025);
}
.tbl tbody tr:last-child td { border-bottom: none; }
.tbl tbody tr.tr-main td { border-bottom: none; }
.tbl tbody tr.tr-foot td {
  padding: 0;
  white-space: normal;
  max-width: none;
  border-bottom: 1px solid var(--border);
}
.tbl tbody tr.tr-foot:hover { background: transparent; }
.tbl tbody tr.tr-foot .svc-actions {
  max-height: 0;
  overflow: hidden;
  padding: 0 14px;
  transition: max-height 0.18s ease, padding 0.18s ease, opacity 0.18s ease;
  opacity: 0;
}
.tbl tbody tr.tr-main:hover + tr.tr-foot .svc-actions,
.tbl tbody tr.tr-foot:hover .svc-actions,
.tbl tbody tr.tr-foot:focus-within .svc-actions {
  max-height: 80px;
  padding: 0 14px 10px;
  opacity: 1;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 2px 9px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.01em;
}
.chip + .chip { margin-left: 4px; }
.chip.success { color: var(--success); border-color: rgba(52,211,153,0.25); background: var(--success-soft); }
.chip.warn    { color: var(--warn);    border-color: rgba(251,191,36,0.25); background: var(--warn-soft); }
.chip.danger  { color: var(--danger);  border-color: rgba(248,113,113,0.25); background: var(--danger-soft); }
.chip.primary { color: var(--primary); border-color: rgba(129,140,248,0.25); background: var(--primary-soft); }

/* === Panel (used by reg tokens, lockdown toggle) === */
.panel {
  background: var(--bg-elev-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  margin-bottom: 16px;
}
.panel-title {
  font-size: 14px;
  font-weight: 600;
  margin: 0 0 12px 0;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}
.panel-row {
  display: flex;
  gap: 16px;
  align-items: stretch;
  flex-wrap: wrap;
}
.panel-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 6px;
  display: block;
}

/* === Avatar grid === */
.avatar-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(64px, 1fr));
  gap: 8px;
  max-height: 260px;
  overflow-y: auto;
  padding: 4px;
  background: var(--bg-input);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}
.avatar-tile {
  position: relative;
  aspect-ratio: 1;
  border-radius: var(--radius-sm);
  overflow: hidden;
  cursor: pointer;
  border: 2px solid transparent;
  background: var(--bg-base);
  transition: border var(--transition), transform var(--transition);
}
.avatar-tile img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}
.avatar-tile:hover { transform: scale(1.05); border-color: var(--border-strong); }
.avatar-tile.selected {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-soft), 0 4px 12px var(--primary-glow);
  transform: scale(1.05);
}
.avatar-tile.used {
  opacity: 0.32;
  cursor: not-allowed;
  pointer-events: none;
}
.avatar-tile.used::after {
  content: '\f00c';
  font-family: 'Font Awesome 6 Free';
  font-weight: 900;
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(0,0,0,0.55);
  color: var(--success);
  font-size: 18px;
}
.avatar-name {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  background: linear-gradient(180deg, transparent, rgba(0,0,0,0.75));
  color: white;
  font-size: 9px;
  padding: 8px 4px 3px;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
  letter-spacing: 0.02em;
}

.avatar-tile.current {
  border-color: var(--color-yellow, #f0b400);
  box-shadow: 0 0 0 2px rgba(240, 180, 0, 0.25);
}
.avatar-tile.current::before {
  content: '\f005';
  font-family: 'Font Awesome 6 Free';
  font-weight: 900;
  position: absolute;
  top: 3px; right: 3px;
  z-index: 1;
  color: var(--color-yellow, #f0b400);
  font-size: 11px;
  text-shadow: 0 1px 2px rgba(0,0,0,0.55);
}

.user-edit-row {
  display: flex;
  gap: 16px;
  align-items: stretch;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.user-edit-col {
  flex: 1 1 200px;
  max-width: 260px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.accent-preview {
  padding: 10px;
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  text-align: center;
  font-size: 13px;
  border: 1px solid var(--border);
}
.accent-preview .dot {
  width: 14px;
  height: 14px;
  margin-right: 8px;
}

.pw-token-row {
  display: flex;
  gap: 8px;
  margin: 12px 0;
}
.pw-token-row input {
  flex: 1;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text);
}

.svc-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
}
.svc-actions .btn[disabled],
.svc-actions .btn[aria-disabled="true"] {
  opacity: 0.32;
  cursor: not-allowed;
  pointer-events: none;
}

/* === JFS stats modal === */
.jfs-body {
  overflow-y: auto;
  min-height: 0;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.jfs-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 12px;
  flex-wrap: wrap;
}
.jfs-meta code { word-break: break-all; color: var(--text-muted); }
.jfs-health-head {
  display: flex;
  justify-content: space-between;
  font-size: 12.5px;
  margin-bottom: 6px;
}
.jfs-health-pct { font-family: var(--mono); font-weight: 600; }
.jfs-health-pct[data-tone="ok"]     { color: var(--color-green, #50fa7b); }
.jfs-health-pct[data-tone="warn"]   { color: var(--color-yellow, #f1fa8c); }
.jfs-health-pct[data-tone="danger"] { color: var(--color-red, #ff5f56); }
.jfs-health-hint { font-size: 11.5px; color: var(--text-faint); margin-top: 6px; }
.jfs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px;
}
.jfs-stat {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}
.jfs-stat-label {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-faint);
}
.jfs-stat-value {
  font-size: 16px;
  font-weight: 600;
  margin-top: 3px;
  font-family: var(--mono);
}
.jfs-stat-sub { font-size: 10.5px; color: var(--text-muted); margin-top: 2px; }
.jfs-top-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-faint);
  font-weight: 500;
}

/* === Storage browser === */
.stg-roots {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}
.stg-root {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font: inherit;
  font-size: 12px;
  padding: 5px 11px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.stg-root:hover { color: var(--text); border-color: var(--border-strong); }
.stg-root.active {
  color: var(--text);
  border-color: var(--primary, var(--color-sky, #6ec1ff));
  background: var(--primary-soft, rgba(110,193,255,0.12));
}
.stg-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--bg-elev-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.stg-crumbs {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-wrap: wrap;
  font-family: var(--mono);
  font-size: 12.5px;
  min-width: 0;
}
.stg-crumb {
  background: none;
  border: none;
  color: var(--color-sky, #6ec1ff);
  font: inherit;
  padding: 2px 4px;
  cursor: pointer;
  border-radius: 4px;
}
.stg-crumb:hover { background: rgba(255,255,255,0.06); }
.stg-crumb.current { color: var(--text); cursor: default; }
.stg-sep { color: var(--text-faint); opacity: 0.5; }
.stg-total {
  font-family: var(--mono);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
}

.stg-list {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--bg-elev-1);
}
.stg-row {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 14px;
  border-bottom: 1px solid var(--border);
  overflow: hidden;
}
.stg-row:last-child { border-bottom: none; }
.stg-row.dir, .stg-row.jfs { cursor: pointer; }
.stg-row.dir:hover, .stg-row.jfs:hover { background: rgba(255,255,255,0.03); }
.stg-row.jfs .stg-icon { color: var(--color-purple, #a87bff); }
.stg-row-bar {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  background: linear-gradient(90deg, rgba(110,193,255,0.16), rgba(168,123,255,0.10));
  z-index: 0;
  pointer-events: none;
}
.stg-row.dir .stg-row-bar {
  background: linear-gradient(90deg, rgba(110,193,255,0.22), rgba(168,123,255,0.13));
}
.stg-row-main, .stg-row-size {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}
.stg-row-main { overflow: hidden; }
.stg-icon { color: var(--text-faint); width: 14px; text-align: center; flex-shrink: 0; }
.stg-row.dir .stg-icon { color: var(--color-yellow, #f1fa8c); }
.stg-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}
.stg-chev { color: var(--text-faint); font-size: 10px; opacity: 0.5; flex-shrink: 0; }
.stg-row-size { flex-shrink: 0; gap: 10px; }
.stg-bytes { font-family: var(--mono); font-size: 12px; font-weight: 600; }
.stg-pct {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-muted);
  min-width: 46px;
  text-align: right;
}

/* === Node tabs === */
.node-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0;
}
.node-tab {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  padding: 8px 14px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: color 0.15s, border-color 0.15s;
}
.node-tab:hover { color: var(--text); }
.node-tab.active {
  color: var(--text);
  border-bottom-color: var(--primary, var(--color-sky, #6ec1ff));
}
.node-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #5e6677;
  flex-shrink: 0;
}
.node-dot[data-tone="live"]  { background: var(--color-green, #50fa7b); box-shadow: 0 0 6px var(--color-green, #50fa7b); }
.node-dot[data-tone="stale"] { background: var(--color-yellow, #f1fa8c); }
.node-dot[data-tone="error"] { background: var(--color-red, #ff5f56); }

/* === Resource cards (CPU / RAM / Swap) === */
.res-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
}
.res-card {
  background: var(--bg-elev-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.res-card-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}
.res-card-head i { margin-right: 6px; opacity: 0.7; }
.res-card-meta {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
}
.res-card-detail {
  display: flex;
  justify-content: space-between;
  font-size: 11.5px;
  color: var(--text-muted);
}

/* === Disk usage bars === */
.disk-bar {
  position: relative;
  height: 18px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
  min-width: 120px;
}
.disk-bar-fill {
  position: absolute;
  inset: 0 auto 0 0;
  height: 100%;
  border-radius: inherit;
  transition: width 200ms ease;
}
.disk-bar[data-state="ok"]     .disk-bar-fill { background: linear-gradient(90deg, var(--color-green, #50fa7b), #6ec1ff); }
.disk-bar[data-state="warn"]   .disk-bar-fill { background: linear-gradient(90deg, var(--color-yellow, #f1fa8c), var(--color-orange, #ffb86c)); }
.disk-bar[data-state="danger"] .disk-bar-fill { background: linear-gradient(90deg, var(--color-orange, #ffb86c), var(--color-red, #ff5f56)); }
.disk-bar-text {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--text);
  text-shadow: 0 1px 2px rgba(0,0,0,0.6);
  letter-spacing: 0.02em;
}

/* === SMDB admin === */
.smdb-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.smdb-status-row {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: stretch;
}
.smdb-status-main {
  flex: 2 1 360px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.smdb-stats {
  flex: 3 1 480px;
  min-width: 0;
}
.smdb-status-label {
  font-size: 13px;
  line-height: 1.6;
}
.smdb-progress-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.smdb-progress-bar {
  height: 12px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
}
.smdb-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--color-sky), var(--color-purple));
  transition: width 200ms ease;
}
.smdb-progress-meta {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--text-muted);
}

/* === Lockdown banner / toggle === */
.lockdown-banner {
  background: var(--danger-soft);
  border: 1px solid rgba(248, 113, 113, 0.3);
  color: var(--danger);
  padding: 10px 14px;
  border-radius: var(--radius-md);
  margin-bottom: 16px;
  font-size: 13px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
}
.toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  user-select: none;
}
.toggle input { display: none; }
.toggle .slider {
  width: 38px; height: 22px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 999px;
  position: relative;
  transition: background var(--transition), border-color var(--transition);
  flex-shrink: 0;
}
.toggle .slider::before {
  content: '';
  position: absolute;
  top: 2px; left: 2px;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--text-muted);
  transition: transform var(--transition), background var(--transition);
}
.toggle input:checked + .slider {
  background: var(--primary-soft);
  border-color: rgba(61, 148, 226, 0.45);
}
.toggle input:checked + .slider::before {
  transform: translateX(16px);
  background: var(--primary);
}
.toggle.danger input:checked + .slider {
  background: rgba(248, 113, 113, 0.18);
  border-color: rgba(248, 113, 113, 0.45);
}
.toggle.danger input:checked + .slider::before {
  background: var(--danger);
}
.toggle .label {
  margin-left: 10px;
  font-size: 13px;
  font-weight: 500;
}

code, .mono {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-muted);
  background: rgba(255,255,255,0.045);
  padding: 1px 6px;
  border-radius: 4px;
}

.dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  margin-right: 8px;
  vertical-align: middle;
  border: 1px solid rgba(0,0,0,0.3);
}

.empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  text-align: center;
  color: var(--text-muted);
  gap: 8px;
}
.empty .icon {
  font-size: 28px;
  opacity: 0.45;
}
.empty .hint { color: var(--text-faint); font-size: 13px; }

/* === Debugger === */
.debugger {
  display: flex;
  flex-direction: column;
  gap: 14px;
  flex: 1;
  min-height: 0;
}
.dbg-controls {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}
.dbg-body {
  flex: 1;
  display: flex;
  min-height: 320px;
}
.dbg-pane {
  display: flex;
  flex-direction: column;
  flex: 1 1 0;
  min-width: 0;
  min-height: 0;
}
.dbg-pane-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}
.dbg-pane-label {
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-faint);
}
.dbg-tabs {
  display: inline-flex;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 2px;
}
.dbg-tab {
  padding: 4px 10px;
  font-size: 11.5px;
  font-weight: 500;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: inherit;
  transition: background var(--transition), color var(--transition);
}
.dbg-tab:hover { color: var(--text); }
.dbg-tab.active {
  background: var(--bg-elev-1);
  color: var(--text);
  box-shadow: 0 1px 0 rgba(255,255,255,0.05) inset, 0 1px 2px rgba(0,0,0,0.25);
}
.dbg-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
}
.dbg-tab-pane { display: none; min-width: 0; }
.dbg-tab-pane.active { display: block; flex: 1; min-height: 0; }
.dbg-tab-pane.params-pane.active {
  overflow-y: auto;
  background: var(--bg-elev-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
}
.dbg-tab-pane.params-pane > .panel {
  background: transparent;
  border: none;
  padding: 0;
  margin: 0;
}
.dbg-splitter {
  flex: 0 0 14px;
  cursor: col-resize;
  position: relative;
  background: transparent;
  margin: 0 0;
  transition: background var(--transition);
}
.dbg-splitter::before {
  content: '';
  position: absolute;
  left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  width: 2px; height: 36px;
  background: var(--border);
  border-radius: 1px;
  transition: background var(--transition), height var(--transition), width var(--transition);
}
.dbg-splitter:hover::before,
.dbg-splitter.dragging::before {
  background: var(--primary);
  height: 56px;
}
.dbg-splitter.dragging { background: var(--primary-soft); }
.dbg-textarea {
  flex: 1;
  background: var(--bg-elev-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--text);
  resize: none;
  width: 100%;
  box-sizing: border-box;
  transition: border var(--transition), box-shadow var(--transition);
  min-height: 0;
}
pre.dbg-textarea {
  margin: 0;
  overflow: auto;
  white-space: pre;
  tab-size: 4;
}
pre.dbg-textarea code {
  font: inherit;
  background: transparent;
  padding: 0;
  display: block;
}
.jk { color: var(--color-sky); }
.js { color: var(--color-green); }
.jn { color: var(--color-yellow); }
.jb { color: var(--color-pumpkin); font-weight: 500; }
.jp { color: var(--text-faint); }
.dbg-textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}
.dbg-status {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  gap: 16px;
  font-family: var(--mono);
  flex-wrap: wrap;
  min-height: 18px;
}
.dbg-status .ok  { color: var(--success); font-weight: 600; }
.dbg-status .err { color: var(--danger);  font-weight: 600; }
.dbg-status .sep { opacity: 0.4; }

/* === Debugger params form === */
.param-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.param-row:last-child { margin-bottom: 0; }
.param-label {
  flex: 0 0 160px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 13px;
  font-weight: 500;
}
.param-type {
  font-size: 10px;
  font-weight: 400;
  color: var(--text-faint);
  font-family: var(--mono);
  letter-spacing: 0.02em;
}
.param-row > .input,
.param-row > textarea.input {
  flex: 1 1 220px;
  min-width: 0;
}
.param-row .toggle { flex: 0 0 auto; }
.param-row textarea.input {
  font-family: var(--mono);
  font-size: 12px;
  resize: vertical;
  min-height: 56px;
  padding: 8px 12px;
  line-height: 1.5;
}
@media (max-width: 600px) {
  .param-label { flex: 1 1 100%; }
}

/* === Modal === */
.modal {
  position: fixed; inset: 0;
  display: grid; place-items: center;
  z-index: 100;
}
.modal[hidden] { display: none; }
.modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.modal-card {
  position: relative;
  background: var(--bg-elev-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  width: min(420px, calc(100% - 32px));
  max-width: calc(100vw - 32px);
  min-width: 0;
  box-sizing: border-box;
  box-shadow: var(--shadow-lg);
  animation: modal-in 220ms cubic-bezier(0.2, 0.8, 0.2, 1);
}
.modal-card.lg { width: min(900px, calc(100% - 32px)); padding: 20px; }
.modal-card.flex-col {
  display: flex;
  flex-direction: column;
  max-height: calc(100dvh - 32px);
  overflow: hidden;
}
.modal-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}
.modal-header-row h2 { margin: 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.logs-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.logs-controls .checkbox-row {
  font-size: 12px;
  color: var(--text-muted);
  gap: 6px;
}
.logs-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.logs-svc-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.logs-source-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-faint);
}
.input.sm {
  padding: 4px 8px;
  font-size: 12px;
  max-width: 280px;
}
.logs-pane {
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-family: var(--mono);
  font-size: 11.5px;
  line-height: 1.55;
  color: var(--text);
  white-space: pre;
  overflow: auto;
  flex: 1 1 auto;
  min-height: 0;
  max-height: 65dvh;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  margin: 0;
  tab-size: 4;
  overscroll-behavior: contain;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 14px;
}
.form-grid label.full { grid-column: 1 / -1; }
.form-grid label > span {
  display: block;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 5px;
  letter-spacing: 0.01em;
}
.form-grid label > input[type="text"],
.form-grid label > input[type="number"],
.form-grid label > input[type="password"] {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: inherit;
  transition: border var(--transition), box-shadow var(--transition);
  box-sizing: border-box;
}
.form-grid label > input[readonly] {
  opacity: 0.6;
  cursor: not-allowed;
}
.form-grid label > input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}
.form-grid .form-checks {
  grid-column: 1 / -1;
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  margin-top: 4px;
}
.form-grid .checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.form-grid .checkbox-row > span {
  margin: 0;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  text-transform: none;
  letter-spacing: 0;
}
.form-grid .checkbox-row > input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--primary);
  cursor: pointer;
}
@media (max-width: 600px) {
  .form-grid { grid-template-columns: 1fr; }
}
@keyframes modal-in {
  from { transform: translateY(8px) scale(0.97); opacity: 0; }
  to   { transform: translateY(0) scale(1); opacity: 1; }
}
.modal-card h2 {
  margin: 0 0 6px 0;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.015em;
}
.modal-text {
  margin: 0 0 18px 0;
  color: var(--text-muted);
  font-size: 13.5px;
  line-height: 1.55;
  white-space: pre-line;
}
.modal-card label {
  display: block;
  margin-bottom: 14px;
}
.modal-card label > span {
  display: block;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 5px;
  letter-spacing: 0.01em;
}
.modal-card label > input {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  transition: border var(--transition), box-shadow var(--transition);
}
.modal-card label > input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}
.modal-error {
  font-size: 12.5px;
  color: var(--danger);
  min-height: 16px;
  margin-bottom: 12px;
}
.modal-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

/* === Toast === */
.totp-qr {
  display: flex;
  justify-content: center;
  padding: 14px;
  background: #fff;
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
  min-height: 60px;
  align-items: center;
}
.totp-qr img, .totp-qr canvas { display: block; }
.totp-secret {
  margin-bottom: 14px;
}
.totp-secret code {
  display: block;
  margin-top: 4px;
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: 0.08em;
  word-break: break-all;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  color: var(--text);
  user-select: all;
}

.pending-logins {
  position: fixed;
  top: 18px; right: 18px;
  z-index: 250;
  width: min(340px, calc(100vw - 36px));
  background: var(--bg-elev-2);
  border: 1px solid var(--primary, var(--color-sky, #6ec1ff));
  border-radius: var(--radius-md);
  box-shadow: 0 10px 40px rgba(0,0,0,0.5), 0 0 0 1px var(--primary-soft, rgba(110,193,255,0.15));
  overflow: hidden;
  animation: toast-in 220ms cubic-bezier(0.2, 0.8, 0.2, 1);
}
.pending-logins[hidden] { display: none; }
.pl-head {
  padding: 10px 14px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  background: var(--primary-soft, rgba(110,193,255,0.12));
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
}
.pl-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
}
.pl-item:last-child { border-bottom: none; }
.pl-info { min-width: 0; }
.pl-user { font-weight: 600; font-size: 13px; }
.pl-meta { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.pl-meta code { font-size: 10.5px; }
.pl-count { color: var(--color-yellow, #f1fa8c); font-family: var(--mono); }
.pl-actions { display: flex; gap: 6px; flex-shrink: 0; }

.toast {
  position: fixed;
  bottom: 24px; right: 24px;
  background: var(--bg-elev-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-md);
  z-index: 200;
  animation: toast-in 220ms cubic-bezier(0.2, 0.8, 0.2, 1);
  max-width: 360px;
}
.toast[hidden] { display: none; }
.toast.error  { border-color: rgba(248,113,113,0.4); color: var(--danger); }
.toast.success { border-color: rgba(52,211,153,0.4); color: var(--success); }
@keyframes toast-in {
  from { transform: translateY(20px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}

/* === Mobile menu button === */
.menu-btn {
  display: none;
  position: fixed;
  top: 12px; left: 12px;
  z-index: 50;
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  color: var(--text);
  width: 38px; height: 38px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-sm);
}
.menu-btn:hover { border-color: var(--border-strong); }

/* === Responsive === */
@media (max-width: 900px) {
  .dbg-body {
    flex-direction: column;
    min-height: 560px;
  }
  .dbg-pane { flex: 1 1 0; }
  .dbg-splitter {
    flex: 0 0 14px;
    width: 100%;
    cursor: row-resize;
  }
  .dbg-splitter::before {
    width: 36px; height: 2px;
  }
  .dbg-splitter:hover::before,
  .dbg-splitter.dragging::before {
    width: 56px; height: 2px;
  }
}

@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    top: 0; left: 0;
    height: 100vh;
    height: 100dvh;
    transform: translateX(-100%);
    box-shadow: var(--shadow-lg);
  }
  .sidebar.open { transform: translateX(0); }
  .menu-btn { display: inline-flex; }
  .topbar {
    height: auto;
    min-height: var(--topbar-h);
    flex-direction: column;
    align-items: stretch;
    padding: 12px 16px 12px 64px;
    gap: 8px;
  }
  .page-title { font-size: 16px; }
  .page-tools {
    justify-content: flex-start;
    width: 100%;
  }
  .tool-input { flex: 1 1 120px; }
  .page-body { padding: 16px; }
  .modal-card { padding: 20px; }
  .stats-grid { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
  .stat-card { padding: 14px 16px; }
  .stat-card .value { font-size: 24px; }
  .toast { left: 12px; right: 12px; bottom: 12px; max-width: none; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .topbar { padding-left: 60px; }
  .page-title { font-size: 15px; }
}
