/* ============================================================
   StreamVault — Control Center (manager.css)
   Design System v6.0.0 — Full rewrite
   ============================================================ */

/* ── Tokens ──────────────────────────────────────────────── */
:root {
  --bg-root:         #09090b;
  --bg-panel:        #111113;
  --bg-panel-alt:    #18181b;
  --bg-border:       #27272a;
  --bg-input:        #1c1c1f;
  --bg-hover:        rgba(255,255,255,0.03);

  --text-primary:    #fafafa;
  --text-secondary:  #a1a1aa;
  --text-muted:      #52525b;

  --accent-emerald:  #10b981;
  --accent-emerald-dim: rgba(16,185,129,0.1);
  --accent-emerald-border: rgba(16,185,129,0.22);
  --accent-amber:    #f59e0b;
  --accent-amber-dim: rgba(245,158,11,0.08);
  --accent-amber-border: rgba(245,158,11,0.2);
  --accent-rose:     #f43f5e;
  --accent-rose-dim: rgba(244,63,94,0.08);
  --accent-rose-border: rgba(244,63,94,0.2);
  --accent-blue:     #3b82f6;
  --accent-blue-dim: rgba(59,130,246,0.08);
  --accent-blue-border: rgba(59,130,246,0.2);
  --accent-violet:   #a855f7;
  --accent-violet-dim: rgba(168,85,247,0.08);
  --accent-violet-border: rgba(168,85,247,0.2);

  --radius:    6px;
  --radius-sm: 4px;
  --radius-lg: 10px;

  --font-base: 'Geist', system-ui, -apple-system, sans-serif;
  --font-mono: 'Geist Mono', 'JetBrains Mono', 'Fira Code', monospace;

  --sidebar-width: 230px;
  --header-height: 0px;
  --transition: 0.15s ease;
}

/* ── Reset / Base ────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  overflow: hidden;
}

body.manager-body {
  background: var(--bg-root);
  color: var(--text-primary);
  font-family: var(--font-base);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ── Layout Shell ────────────────────────────────────────── */
.manager-container {
  display: flex;
  height: 100vh;
  width: 100%;
  overflow: hidden;
}

/* ── Sidebar ─────────────────────────────────────────────── */
.manager-sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg-panel);
  border-right: 1px solid var(--bg-border);
  overflow-y: auto;
  overflow-x: hidden;
  position: relative;
  z-index: 10;
}

.sidebar-branding {
  padding: 20px 18px 16px;
  border-bottom: 1px solid var(--bg-border);
  flex-shrink: 0;
}

.sidebar-brand-name {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text-primary);
  display: block;
  line-height: 1.2;
}

.sidebar-brand-sub {
  font-size: 10.5px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  display: block;
  margin-top: 2px;
}

/* Nav Groups */
.sidebar-nav {
  flex: 1;
  padding: 10px 0;
  overflow-y: auto;
}

.nav-group {
  margin-bottom: 4px;
}

.nav-group-label {
  display: block;
  padding: 10px 18px 4px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  font-family: var(--font-mono);
  user-select: none;
}

.nav-item {
  display: block;
  width: 100%;
  list-style: none;
}

.nav-btn {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 7px 18px;
  background: none;
  border: none;
  border-left: 2px solid transparent;
  color: var(--text-secondary);
  font-family: var(--font-base);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: color var(--transition), background var(--transition), border-color var(--transition);
  position: relative;
}

.nav-btn:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.nav-btn.active {
  color: var(--accent-emerald);
  background: rgba(16,185,129,0.06);
  border-left-color: var(--accent-emerald);
}

.nav-btn svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  opacity: 0.7;
}

.nav-btn.active svg { opacity: 1; }

/* Sidebar Footer */
.sidebar-footer {
  padding: 12px 14px 16px;
  border-top: 1px solid var(--bg-border);
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex-shrink: 0;
}

.sidebar-footer-link {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 6px 10px;
  border-radius: var(--radius);
  color: var(--text-secondary);
  font-size: 12.5px;
  font-weight: 500;
  text-decoration: none;
  transition: color var(--transition), background var(--transition);
  border: 1px solid transparent;
}

.sidebar-footer-link:hover {
  color: var(--text-primary);
  background: var(--bg-panel-alt);
  border-color: var(--bg-border);
}

.sidebar-footer-link svg {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
}

/* ── Main Content ────────────────────────────────────────── */
.manager-content {
  flex: 1;
  min-width: 0;
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  background: var(--bg-root);
}

/* ── Tab Panels ──────────────────────────────────────────── */
.tab-panel {
  display: none;
  padding: 28px 32px 40px;
  animation: tabFadeIn 0.18s ease-out;
}

.tab-panel.active {
  display: block;
}

@keyframes tabFadeIn {
  from { opacity: 0; transform: translateY(7px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Page Headers ────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--bg-border);
  flex-wrap: wrap;
}

.page-header-text h1 {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--text-primary);
  line-height: 1.2;
}

.page-header-text p {
  font-size: 13.5px;
  color: var(--text-secondary);
  margin-top: 4px;
  line-height: 1.5;
}

.page-header-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-shrink: 0;
}

/* ── Panels / Cards ──────────────────────────────────────── */
.cc-panel {
  background: var(--bg-panel);
  border: 1px solid var(--bg-border);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin-bottom: 20px;
}

.cc-panel-title {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  font-family: var(--font-mono);
  margin-bottom: 16px;
}

/* ── Status Cards (Command Center) ──────────────────────── */
.status-cards-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 20px;
}

.status-card {
  background: var(--bg-panel);
  border: 1px solid var(--bg-border);
  border-radius: var(--radius);
  padding: 16px 20px;
  position: relative;
}

.status-card-label {
  font-size: 11.5px;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.status-card-value {
  font-size: 22px;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--text-primary);
  letter-spacing: -0.02em;
  line-height: 1.1;
  margin-bottom: 6px;
}

.status-card-meta {
  font-size: 11.5px;
  color: var(--text-muted);
}

.status-card-badge {
  position: absolute;
  top: 14px;
  right: 14px;
}

/* Disk mini progress bar */
.disk-bar-wrap {
  margin-top: 8px;
  height: 3px;
  background: var(--bg-border);
  border-radius: 99px;
  overflow: hidden;
}

.disk-bar-fill {
  height: 100%;
  border-radius: 99px;
  background: var(--accent-emerald);
  transition: width 0.4s ease;
}

/* ── Status Pills ────────────────────────────────────────── */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 9px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 600;
  font-family: var(--font-mono);
  white-space: nowrap;
}

.pill-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.pill-emerald { background: var(--accent-emerald-dim); border: 1px solid var(--accent-emerald-border); color: var(--accent-emerald); }
.pill-emerald .pill-dot { background: var(--accent-emerald); }

.pill-amber { background: var(--accent-amber-dim); border: 1px solid var(--accent-amber-border); color: var(--accent-amber); }
.pill-amber .pill-dot { background: var(--accent-amber); }

.pill-rose { background: var(--accent-rose-dim); border: 1px solid var(--accent-rose-border); color: var(--accent-rose); }
.pill-rose .pill-dot { background: var(--accent-rose); }

.pill-blue { background: var(--accent-blue-dim); border: 1px solid var(--accent-blue-border); color: var(--accent-blue); }
.pill-blue .pill-dot { background: var(--accent-blue); }

.pill-violet { background: var(--accent-violet-dim); border: 1px solid var(--accent-violet-border); color: var(--accent-violet); }
.pill-violet .pill-dot { background: var(--accent-violet); }

.pill-muted { background: rgba(255,255,255,0.04); border: 1px solid var(--bg-border); color: var(--text-muted); }
.pill-muted .pill-dot { background: var(--text-muted); }

/* Pulsing dot for "active" states */
@keyframes dot-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.75); }
}
.pill-dot.pulsing { animation: dot-pulse 2s ease-in-out infinite; }

/* ── Quick Action Cards ──────────────────────────────────── */
.action-cards-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 14px;
  margin-bottom: 20px;
}

.action-card {
  background: var(--bg-panel);
  border: 1px solid var(--bg-border);
  border-radius: var(--radius);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: border-color var(--transition);
}

.action-card:hover { border-color: #3f3f46; }

.action-card.maintenance-active {
  border-color: var(--accent-amber-border);
  background: rgba(245,158,11,0.04);
}

/* Color-coded command cards styling */
.action-card.card-maintenance {
  border-color: rgba(245, 158, 11, 0.2);
}
.action-card.card-maintenance:hover {
  border-color: rgba(245, 158, 11, 0.5);
  box-shadow: 0 4px 20px -2px rgba(245, 158, 11, 0.05);
}
.action-card.card-maintenance .action-card-icon {
  background: rgba(245, 158, 11, 0.08);
  border-color: rgba(245, 158, 11, 0.25);
}
.action-card.card-maintenance .action-card-icon svg {
  color: #f59e0b;
}
.action-card.card-maintenance button {
  border-color: rgba(245, 158, 11, 0.3) !important;
  color: #f59e0b !important;
}
.action-card.card-maintenance button:hover {
  background: rgba(245, 158, 11, 0.1) !important;
  border-color: #f59e0b !important;
}

.action-card.card-web {
  border-color: rgba(59, 130, 246, 0.2);
}
.action-card.card-web:hover {
  border-color: rgba(59, 130, 246, 0.5);
  box-shadow: 0 4px 20px -2px rgba(59, 130, 246, 0.05);
}
.action-card.card-web .action-card-icon {
  background: rgba(59, 130, 246, 0.08);
  border-color: rgba(59, 130, 246, 0.25);
}
.action-card.card-web .action-card-icon svg {
  color: #3b82f6;
}
.action-card.card-web button {
  border-color: rgba(59, 130, 246, 0.3) !important;
  color: #3b82f6 !important;
}
.action-card.card-web button:hover {
  background: rgba(59, 130, 246, 0.1) !important;
  border-color: #3b82f6 !important;
}

.action-card.card-worker {
  border-color: rgba(139, 92, 246, 0.2);
}
.action-card.card-worker:hover {
  border-color: rgba(139, 92, 246, 0.5);
  box-shadow: 0 4px 20px -2px rgba(139, 92, 246, 0.05);
}
.action-card.card-worker .action-card-icon {
  background: rgba(139, 92, 246, 0.08);
  border-color: rgba(139, 92, 246, 0.25);
}
.action-card.card-worker .action-card-icon svg {
  color: #8b5cf6;
}
.action-card.card-worker button {
  border-color: rgba(139, 92, 246, 0.3) !important;
  color: #8b5cf6 !important;
}
.action-card.card-worker button:hover {
  background: rgba(139, 92, 246, 0.1) !important;
  border-color: #8b5cf6 !important;
}

.action-card.card-cache {
  border-color: rgba(244, 63, 94, 0.2);
}
.action-card.card-cache:hover {
  border-color: rgba(244, 63, 94, 0.5);
  box-shadow: 0 4px 20px -2px rgba(244, 63, 94, 0.05);
}
.action-card.card-cache .action-card-icon {
  background: rgba(244, 63, 94, 0.08);
  border-color: rgba(244, 63, 94, 0.25);
}
.action-card.card-cache .action-card-icon svg {
  color: #f43f5e;
}
.action-card.card-cache button {
  border-color: rgba(244, 63, 94, 0.3) !important;
  color: #f43f5e !important;
}
.action-card.card-cache button:hover {
  background: rgba(244, 63, 94, 0.1) !important;
  border-color: #f43f5e !important;
}

.action-card.card-backup {
  border-color: rgba(16, 185, 129, 0.2);
}
.action-card.card-backup:hover {
  border-color: rgba(16, 185, 129, 0.5);
  box-shadow: 0 4px 20px -2px rgba(16, 185, 129, 0.05);
}
.action-card.card-backup .action-card-icon {
  background: rgba(16, 185, 129, 0.08);
  border-color: rgba(16, 185, 129, 0.25);
}
.action-card.card-backup .action-card-icon svg {
  color: #10b981;
}
.action-card.card-backup button {
  border-color: rgba(16, 185, 129, 0.3) !important;
  color: #10b981 !important;
}
.action-card.card-backup button:hover {
  background: rgba(16, 185, 129, 0.1) !important;
  border-color: #10b981 !important;
}

.action-card-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius);
  background: var(--bg-panel-alt);
  border: 1px solid var(--bg-border);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.action-card-icon svg {
  width: 15px;
  height: 15px;
  color: var(--text-secondary);
}

.action-card-label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
}

.action-card-desc {
  font-size: 11.5px;
  color: var(--text-muted);
  line-height: 1.45;
  flex: 1;
}

/* Maintenance toggle switch */
.toggle-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
}

.toggle-switch {
  position: relative;
  width: 36px;
  height: 20px;
  flex-shrink: 0;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--bg-border);
  border-radius: 99px;
  cursor: pointer;
  transition: background 0.2s ease;
}

.toggle-slider::before {
  content: '';
  position: absolute;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--text-muted);
  top: 3px;
  left: 3px;
  transition: transform 0.2s ease, background 0.2s ease;
}

.toggle-switch input:checked + .toggle-slider { background: rgba(245,158,11,0.3); }
.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(16px);
  background: var(--accent-amber);
}

.toggle-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
}

/* ── Audit Feed ──────────────────────────────────────────── */
.audit-feed {
  display: flex;
  flex-direction: column;
  gap: 0;
  max-height: 480px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.audit-entry {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--bg-border);
}

.audit-entry:last-child { border-bottom: none; }

.audit-dot-col {
  display: flex;
  align-items: center;
  padding-top: 2px;
  flex-shrink: 0;
}

.audit-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.audit-dot.cat-auth    { background: var(--accent-blue); }
.audit-dot.cat-system  { background: var(--accent-emerald); }
.audit-dot.cat-ai      { background: var(--accent-violet); }
.audit-dot.cat-backup  { background: var(--accent-amber); }
.audit-dot.cat-error   { background: var(--accent-rose); }

.audit-body { flex: 1; min-width: 0; }

.audit-action {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.audit-meta {
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  margin-top: 1px;
}

/* ── Tables ──────────────────────────────────────────────── */
.table-wrapper, .data-table-wrapper {
  overflow-x: auto;
  overflow-y: auto;
  border-radius: var(--radius);
  border: 1px solid var(--bg-border);
  -webkit-overflow-scrolling: touch;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.data-table thead {
  position: sticky;
  top: 0;
  z-index: 2;
}

.data-table th {
  padding: 10px 14px;
  background: var(--bg-panel-alt);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  text-align: left;
  white-space: nowrap;
  border-bottom: 1px solid var(--bg-border);
  user-select: none;
}

.data-table th.sortable {
  cursor: pointer;
}

.data-table th.sortable:hover { color: var(--text-secondary); }
.data-table th.sort-active { color: var(--accent-emerald); }

.data-table th .sort-icon {
  display: inline-block;
  margin-left: 4px;
  opacity: 0.5;
  font-size: 10px;
}

.data-table th.sort-active .sort-icon { opacity: 1; }

.data-table td {
  padding: 10px 14px;
  border-bottom: 1px solid rgba(39,39,42,0.6);
  color: var(--text-secondary);
  vertical-align: middle;
}

.data-table td.mono {
  font-family: var(--font-mono);
  font-size: 12px;
}

.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:nth-child(odd) { background: var(--bg-panel); }
.data-table tbody tr:nth-child(even) { background: var(--bg-panel-alt); }

.data-table tbody tr:hover { background: rgba(255,255,255,0.025); }
.data-table tbody tr.row-selected { background: rgba(16,185,129,0.06) !important; }

td .copy-cell-btn {
  display: none;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0 0 0 6px;
  vertical-align: middle;
  font-size: 11px;
}

td:hover .copy-cell-btn { display: inline; }
td .copy-cell-btn:hover { color: var(--text-secondary); }

/* Table empty state */
.table-empty {
  text-align: center;
  padding: 36px 20px;
  color: var(--text-muted);
}

.table-empty-icon {
  width: 36px;
  height: 36px;
  margin: 0 auto 10px;
  opacity: 0.35;
}

.table-empty-text {
  font-size: 13px;
}

/* ── Skeleton Loaders ────────────────────────────────────── */
@keyframes shimmer {
  0%   { background-position: -400px 0; }
  100% { background-position:  400px 0; }
}

.skeleton {
  background: linear-gradient(90deg, var(--bg-panel) 25%, var(--bg-border) 50%, var(--bg-panel) 75%);
  background-size: 800px 100%;
  animation: shimmer 1.4s infinite linear;
  border-radius: var(--radius-sm);
}

.skeleton-row {
  height: 38px;
  margin-bottom: 1px;
}

.skeleton-card {
  height: 80px;
  border-radius: var(--radius);
}

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: var(--radius);
  font-family: var(--font-base);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--transition), opacity var(--transition), transform 0.1s;
  white-space: nowrap;
  text-decoration: none;
  border: 1px solid transparent;
  line-height: 1;
}

.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; pointer-events: none; }

.btn svg { width: 14px; height: 14px; flex-shrink: 0; }

.btn-primary {
  background: var(--accent-emerald);
  color: #0a1a14;
  font-weight: 600;
  border-color: var(--accent-emerald);
}
.btn-primary:hover { background: #0ea572; border-color: #0ea572; }

.btn-secondary {
  background: transparent;
  color: var(--text-secondary);
  border-color: var(--bg-border);
}
.btn-secondary:hover { background: var(--bg-panel-alt); color: var(--text-primary); }

.btn-danger {
  background: var(--accent-rose);
  color: #fff;
  font-weight: 600;
  border-color: var(--accent-rose);
}
.btn-danger:hover { background: #e11d48; }

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: transparent;
}
.btn-ghost:hover { color: var(--text-primary); background: var(--bg-hover); }

.btn-sm {
  padding: 5px 10px;
  font-size: 12px;
}

.btn-amber {
  background: rgba(245,158,11,0.12);
  color: var(--accent-amber);
  border-color: var(--accent-amber-border);
}
.btn-amber:hover { background: rgba(245,158,11,0.2); }

/* ── Inputs / Forms ──────────────────────────────────────── */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
}

.form-input,
.form-select,
.form-textarea {
  background: var(--bg-input);
  border: 1px solid var(--bg-border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-family: var(--font-base);
  font-size: 13.5px;
  padding: 8px 12px;
  width: 100%;
  outline: none;
  transition: border-color var(--transition);
  -webkit-appearance: none;
}

.form-input::placeholder,
.form-textarea::placeholder { color: var(--text-muted); }

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: rgba(16,185,129,0.4);
  box-shadow: 0 0 0 3px rgba(16,185,129,0.07);
}

.form-textarea {
  resize: vertical;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.55;
  min-height: 80px;
}

.form-textarea.sql-input {
  min-height: 96px;
  background: #0d0d10;
  color: #e2e8f0;
}

/* ── Grids ───────────────────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }

/* ── Stat Cards (Costs) ──────────────────────────────────── */
.stat-cards-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 20px;
}

.stat-card {
  background: var(--bg-panel);
  border: 1px solid var(--bg-border);
  border-radius: var(--radius);
  padding: 18px 20px;
}

.stat-card-label {
  font-size: 11.5px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
}

.stat-card-value {
  font-size: 26px;
  font-weight: 700;
  font-family: var(--font-mono);
  letter-spacing: -0.02em;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.stat-card-sub {
  font-size: 12px;
  color: var(--text-muted);
}

.stat-card-value.emerald { color: var(--accent-emerald); }
.stat-card-value.amber   { color: var(--accent-amber); }
.stat-card-value.blue    { color: var(--accent-blue); }

/* ── Sparkline ───────────────────────────────────────────── */
.sparkline-wrap {
  margin-top: 12px;
}

.sparkline-wrap svg {
  display: block;
  overflow: visible;
}

/* ── DB Browser ──────────────────────────────────────────── */
.db-browser-layout {
  display: flex;
  gap: 16px;
  align-items: flex-start;
}

.db-browser-main {
  flex: 1;
  min-width: 0;
}

.db-schema-panel {
  width: 260px;
  flex-shrink: 0;
  display: none;
}

.db-schema-panel.open { display: block; }

.db-toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.db-toolbar-right {
  margin-left: auto;
  display: flex;
  gap: 8px;
}

.db-table-select {
  min-width: 200px;
  background: var(--bg-input);
  border: 1px solid var(--bg-border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-family: var(--font-base);
  font-size: 13px;
  padding: 6px 10px;
  outline: none;
  cursor: pointer;
}

.db-search-input {
  flex: 1;
  min-width: 160px;
  background: var(--bg-input);
  border: 1px solid var(--bg-border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-family: var(--font-base);
  font-size: 13px;
  padding: 6px 10px;
  outline: none;
}

.db-search-input::placeholder { color: var(--text-muted); }

.db-pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 12px;
  font-size: 12.5px;
  color: var(--text-muted);
}

.db-pagination-label { font-family: var(--font-mono); }

/* Schema tree */
.schema-tree-item {
  border-bottom: 1px solid var(--bg-border);
}

.schema-tree-table-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 8px 12px;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 12.5px;
  cursor: pointer;
  text-align: left;
  transition: background var(--transition), color var(--transition);
}

.schema-tree-table-btn:hover { background: var(--bg-hover); color: var(--text-primary); }

.schema-tree-table-btn .schema-row-count {
  font-size: 11px;
  color: var(--text-muted);
}

.schema-cols {
  display: none;
  padding: 4px 0 8px 12px;
}

.schema-cols.open { display: block; }

.schema-col-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 3px 0;
  font-size: 11.5px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.schema-col-name { color: var(--text-secondary); }
.schema-col-type { font-size: 10.5px; }
.schema-col-pk { color: var(--accent-amber); font-size: 10px; font-weight: 600; }

.schema-copy-btn {
  display: block;
  width: 100%;
  padding: 6px 12px;
  text-align: center;
  background: none;
  border: none;
  border-top: 1px solid var(--bg-border);
  color: var(--text-muted);
  font-size: 11.5px;
  cursor: pointer;
  transition: color var(--transition);
}

.schema-copy-btn:hover { color: var(--text-secondary); }

/* SQL Query history chips */
.sql-history-chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.sql-history-chip {
  display: inline-block;
  padding: 3px 9px;
  background: var(--bg-panel-alt);
  border: 1px solid var(--bg-border);
  border-radius: 99px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  cursor: pointer;
  max-width: 200px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color var(--transition), border-color var(--transition);
}

.sql-history-chip:hover { color: var(--text-secondary); border-color: #3f3f46; }

/* ── File Explorer ───────────────────────────────────────── */
.file-explorer-layout {
  display: flex;
  gap: 16px;
  min-height: 400px;
}

.file-tree-panel {
  width: 220px;
  flex-shrink: 0;
  background: var(--bg-panel);
  border: 1px solid var(--bg-border);
  border-radius: var(--radius);
  overflow-y: auto;
  max-height: 520px;
}

.file-tree-item {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 12px;
  cursor: pointer;
  font-size: 12.5px;
  color: var(--text-secondary);
  border-bottom: 1px solid rgba(39,39,42,0.4);
  transition: background var(--transition), color var(--transition);
  user-select: none;
}

.file-tree-item:hover { background: var(--bg-hover); color: var(--text-primary); }
.file-tree-item.active { background: rgba(16,185,129,0.06); color: var(--accent-emerald); }

.file-tree-item svg { width: 13px; height: 13px; flex-shrink: 0; }

.file-list-panel {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.file-list-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.file-breadcrumbs {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--text-muted);
  margin-left: auto;
  background: rgba(0,0,0,0.2);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
}

/* Drag-drop zone */
.file-drop-zone {
  flex: 1;
  border: 1px solid var(--bg-border);
  border-radius: var(--radius);
  overflow: hidden;
  position: relative;
  transition: border-color 0.15s;
}

.file-drop-zone.dragover {
  border-color: var(--accent-emerald);
  box-shadow: inset 0 0 0 1px rgba(16,185,129,0.15);
}

.file-drop-overlay {
  display: none;
  position: absolute;
  inset: 0;
  background: rgba(16,185,129,0.06);
  z-index: 10;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 600;
  color: var(--accent-emerald);
  pointer-events: none;
}

.file-drop-zone.dragover .file-drop-overlay { display: flex; }

/* File row thumbnail */
td .file-thumb {
  width: 28px;
  height: 28px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  vertical-align: middle;
  margin-right: 6px;
  border: 1px solid var(--bg-border);
}

/* Multi-select bulk bar */
.bulk-action-bar {
  display: none;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  background: rgba(16,185,129,0.05);
  border: 1px solid var(--accent-emerald-border);
  border-radius: var(--radius);
  margin-bottom: 10px;
  font-size: 13px;
  color: var(--accent-emerald);
}

.bulk-action-bar.visible { display: flex; }
.bulk-action-bar-label { font-weight: 500; flex: 1; }

/* ── Backup Card Rows ─────────────────────────────────────── */
.backup-card-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 13px 18px;
  border-bottom: 1px solid rgba(39,39,42,0.5);
  transition: background var(--transition);
}

.backup-card-row:last-child { border-bottom: none; }
.backup-card-row:hover { background: var(--bg-hover); }

.backup-card-icon {
  width: 34px;
  height: 34px;
  border-radius: var(--radius);
  background: var(--bg-panel-alt);
  border: 1px solid var(--bg-border);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.backup-card-icon svg { width: 16px; height: 16px; color: var(--text-muted); }

.backup-card-body { flex: 1; min-width: 0; }

.backup-filename {
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.backup-meta {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 2px;
}

.backup-reason {
  font-size: 11.5px;
  color: var(--text-secondary);
  font-style: italic;
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.backup-card-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.backup-slot-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  font-size: 12.5px;
  color: var(--text-muted);
}

.backup-slot-progress {
  flex: 1;
  height: 4px;
  background: var(--bg-border);
  border-radius: 99px;
  overflow: hidden;
}

.backup-slot-fill {
  height: 100%;
  border-radius: 99px;
  background: var(--accent-emerald);
  transition: width 0.4s ease;
}

/* ── Credentials / Webhooks ──────────────────────────────── */
.credentials-info-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: var(--accent-blue-dim);
  border: 1px solid var(--accent-blue-border);
  border-radius: var(--radius);
  margin-bottom: 20px;
  font-size: 13px;
  color: var(--text-secondary);
}

.credentials-info-banner svg {
  width: 16px;
  height: 16px;
  color: var(--accent-blue);
  flex-shrink: 0;
}

.cred-cards-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.cred-card {
  background: var(--bg-panel);
  border: 1px solid var(--bg-border);
  border-radius: var(--radius);
  padding: 14px 18px;
}

.cred-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.cred-card-name {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-primary);
}

.cred-card-masked {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 10px;
  letter-spacing: 0.03em;
}

.cred-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.cred-last-tested {
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

/* ── Changelog ───────────────────────────────────────────── */
.changelog-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
}

.changelog-search {
  flex: 1;
  background: var(--bg-input);
  border: 1px solid var(--bg-border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-family: var(--font-base);
  font-size: 13px;
  padding: 7px 12px;
  outline: none;
}

.changelog-search::placeholder { color: var(--text-muted); }
.changelog-search:focus { border-color: rgba(16,185,129,0.35); }

.changelog-entry {
  border: 1px solid var(--bg-border);
  border-radius: var(--radius);
  margin-bottom: 10px;
  overflow: hidden;
  transition: border-color var(--transition);
}

.changelog-entry:hover { border-color: #3f3f46; }

.changelog-entry-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 16px;
  cursor: pointer;
  user-select: none;
  background: var(--bg-panel);
  transition: background var(--transition);
}

.changelog-entry-header:hover { background: var(--bg-hover); }

.changelog-version-badge {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  background: rgba(16,185,129,0.1);
  border: 1px solid rgba(16,185,129,0.2);
  color: var(--accent-emerald);
  white-space: nowrap;
}

.changelog-date {
  font-size: 12px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.changelog-chevron {
  margin-left: auto;
  color: var(--text-muted);
  transition: transform 0.2s ease;
  flex-shrink: 0;
}

.changelog-entry.open .changelog-chevron { transform: rotate(180deg); }

.changelog-body {
  display: none;
  padding: 12px 16px 16px;
  background: var(--bg-panel-alt);
  border-top: 1px solid var(--bg-border);
}

.changelog-entry.open .changelog-body { display: block; }

.changelog-type-section { margin-bottom: 12px; }
.changelog-type-section:last-child { margin-bottom: 0; }

.changelog-type-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.changelog-type-label::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.type-Added   .changelog-type-label { color: var(--accent-emerald); }
.type-Added   .changelog-type-label::before { background: var(--accent-emerald); }
.type-Fixed   .changelog-type-label { color: var(--accent-rose); }
.type-Fixed   .changelog-type-label::before { background: var(--accent-rose); }
.type-Changed .changelog-type-label { color: var(--accent-amber); }
.type-Changed .changelog-type-label::before { background: var(--accent-amber); }
.type-Improved .changelog-type-label { color: var(--accent-blue); }
.type-Improved .changelog-type-label::before { background: var(--accent-blue); }
.type-Removed .changelog-type-label { color: var(--text-muted); }
.type-Removed .changelog-type-label::before { background: var(--text-muted); }

.changelog-items {
  list-style: none;
  padding: 0;
}

.changelog-items li {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.55;
  padding: 2px 0 2px 14px;
  position: relative;
}

.changelog-items li::before {
  content: '–';
  position: absolute;
  left: 0;
  color: var(--text-muted);
}

/* Changelog append form */
.changelog-form {
  background: var(--bg-panel);
  border: 1px solid var(--bg-border);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 20px;
}

.changelog-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr;
  gap: 12px;
  margin-bottom: 12px;
}

/* ── Docs Tab ─────────────────────────────────────────────── */
.docs-tab-switcher {
  display: flex;
  gap: 6px;
  margin-bottom: 18px;
}

.docs-tab-btn {
  padding: 6px 14px;
  border-radius: var(--radius);
  background: transparent;
  border: 1px solid var(--bg-border);
  color: var(--text-secondary);
  font-family: var(--font-base);
  font-size: 13px;
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
}

.docs-tab-btn.active {
  background: rgba(16,185,129,0.08);
  border-color: var(--accent-emerald-border);
  color: var(--accent-emerald);
}

.docs-tab-btn:hover:not(.active) { background: var(--bg-panel-alt); color: var(--text-primary); }

.docs-search {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--bg-border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-family: var(--font-base);
  font-size: 13px;
  padding: 7px 12px;
  outline: none;
  margin-bottom: 16px;
}

.docs-search::placeholder { color: var(--text-muted); }

.docs-render-area {
  color: var(--text-primary);
  line-height: 1.7;
  font-size: 14px;
  max-height: 68vh;
  overflow-y: auto;
  padding-right: 6px;
}

.docs-render-area h1 { font-size: 22px; margin-bottom: 12px; font-weight: 700; letter-spacing: -0.02em; }
.docs-render-area h2 { font-size: 17px; margin: 24px 0 10px; font-weight: 700; padding-bottom: 8px; border-bottom: 1px solid var(--bg-border); }
.docs-render-area h3 { font-size: 14.5px; margin: 18px 0 8px; font-weight: 600; }
.docs-render-area h4 { font-size: 13px; margin: 14px 0 6px; font-weight: 600; color: var(--text-secondary); }
.docs-render-area p  { margin-bottom: 10px; color: var(--text-secondary); }
.docs-render-area ul, .docs-render-area ol { padding-left: 20px; margin-bottom: 10px; color: var(--text-secondary); }
.docs-render-area li { margin-bottom: 4px; }
.docs-render-area code { background: var(--bg-panel-alt); border: 1px solid var(--bg-border); border-radius: 3px; padding: 1px 5px; font-family: var(--font-mono); font-size: 12px; color: var(--accent-emerald); }
.docs-render-area pre { background: #0d0d10; border: 1px solid var(--bg-border); border-radius: var(--radius); padding: 14px 16px; overflow-x: auto; margin-bottom: 14px; }
.docs-render-area pre code { background: none; border: none; padding: 0; color: #e2e8f0; font-size: 13px; }
.docs-render-area a { color: var(--accent-emerald); text-decoration: none; }
.docs-render-area a:hover { text-decoration: underline; }
.docs-render-area strong { color: var(--text-primary); font-weight: 600; }
.docs-render-area blockquote { border-left: 3px solid var(--bg-border); padding-left: 14px; color: var(--text-muted); margin: 10px 0; }

/* GFM Callout Boxes */
.docs-callout { display: flex; gap: 10px; padding: 12px 14px; border-radius: var(--radius); margin: 14px 0; border: 1px solid; }
.docs-callout-icon { font-size: 15px; flex-shrink: 0; margin-top: 1px; }
.docs-callout-body { font-size: 13px; color: var(--text-secondary); line-height: 1.55; }
.docs-callout.note    { background: var(--accent-blue-dim); border-color: var(--accent-blue-border); }
.docs-callout.tip     { background: var(--accent-emerald-dim); border-color: var(--accent-emerald-border); }
.docs-callout.warning { background: var(--accent-amber-dim); border-color: var(--accent-amber-border); }
.docs-callout.caution { background: var(--accent-rose-dim); border-color: var(--accent-rose-border); }
.docs-callout.important { background: var(--accent-violet-dim); border-color: var(--accent-violet-border); }

mark.search-highlight {
  background: rgba(245,158,11,0.3);
  color: inherit;
  border-radius: 2px;
  padding: 0 1px;
}

/* ── Modals ──────────────────────────────────────────────── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.65);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(2px);
  padding: 20px;
}

.modal-overlay.active, .modal-overlay.open {
  display: flex !important;
  opacity: 1 !important;
  pointer-events: auto !important;
}

.modal-box, .modal-container {
  background: var(--bg-panel);
  border: 1px solid var(--bg-border);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
  box-sizing: border-box;
}

.modal-box.wide, .modal-container.wide { max-width: 860px; }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px 16px;
  border-bottom: 1px solid var(--bg-border);
  flex-shrink: 0;
}

.modal-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 20px;
  cursor: pointer;
  line-height: 1;
  padding: 2px;
  transition: color var(--transition);
}

.modal-close:hover { color: var(--text-primary); }

.modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px 22px;
}

.modal-footer {
  padding: 14px 22px 16px;
  border-top: 1px solid var(--bg-border);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-shrink: 0;
}

/* ── Toast Notifications ─────────────────────────────────── */
#cc-toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.cc-toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 16px;
  background: var(--bg-panel);
  border: 1px solid var(--bg-border);
  border-radius: var(--radius);
  font-size: 13px;
  color: var(--text-primary);
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
  animation: toastIn 0.2s ease-out, toastOut 0.2s ease-in 2.8s forwards;
  pointer-events: auto;
  min-width: 240px;
  max-width: 380px;
}

@keyframes toastIn  { from { opacity:0; transform:translateX(20px); } to { opacity:1; transform:none; } }
@keyframes toastOut { from { opacity:1; transform:none; } to { opacity:0; transform:translateX(20px); } }

.cc-toast.toast-success { border-color: var(--accent-emerald-border); }
.cc-toast.toast-error   { border-color: var(--accent-rose-border); }
.cc-toast.toast-info    { border-color: var(--accent-blue-border); }
.cc-toast.toast-warning { border-color: var(--accent-amber-border); }

.cc-toast-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.toast-success .cc-toast-dot { background: var(--accent-emerald); }
.toast-error   .cc-toast-dot { background: var(--accent-rose); }
.toast-info    .cc-toast-dot { background: var(--accent-blue); }
.toast-warning .cc-toast-dot { background: var(--accent-amber); }

/* ── Audio Player Modal ──────────────────────────────────── */
.audio-player-modal audio {
  width: 100%;
  border-radius: var(--radius);
  background: var(--bg-panel-alt);
  accent-color: var(--accent-emerald);
}

/* ── JSON Viewer ─────────────────────────────────────────── */
.json-tree { font-family: var(--font-mono); font-size: 12px; line-height: 1.6; }
.json-tree-key { color: var(--accent-blue); }
.json-tree-string { color: var(--accent-emerald); }
.json-tree-number { color: var(--accent-amber); }
.json-tree-bool { color: var(--accent-violet); }
.json-tree-null { color: var(--text-muted); }
.json-tree-toggle { cursor: pointer; color: var(--text-muted); }
.json-tree-children { padding-left: 18px; border-left: 1px solid var(--bg-border); margin-left: 8px; }

/* ── Diag Badge ──────────────────────────────────────────── */
.diag-count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 18px;
  padding: 0 6px;
  border-radius: 99px;
  font-size: 10.5px;
  font-weight: 700;
  font-family: var(--font-mono);
  background: var(--accent-amber-dim);
  border: 1px solid var(--accent-amber-border);
  color: var(--accent-amber);
  margin-left: 7px;
}

/* ── Responsive Layout Grid Classes ─────────────────────── */
.sidebar-mobile-actions {
  display: none;
}

.grid-vitals {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}
@media (max-width: 768px) {
  .grid-vitals {
    grid-template-columns: 1fr;
    gap: 12px;
  }
}

.grid-overview-actions {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 16px;
  margin-bottom: 20px;
}
@media (max-width: 860px) {
  .grid-overview-actions {
    grid-template-columns: 1fr;
    gap: 14px;
  }
}

.grid-restart-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
@media (max-width: 480px) {
  .grid-restart-actions {
    grid-template-columns: 1fr;
    gap: 8px;
  }
}

.diag-stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}
@media (max-width: 992px) {
  .diag-stat-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
}
@media (max-width: 480px) {
  .diag-stat-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }
}

.diag-details-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
@media (max-width: 768px) {
  .diag-details-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
}

.db-vitals-grid {
  margin-top: 24px;
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 16px;
}
@media (max-width: 860px) {
  .db-vitals-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
}

.dual-engine-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
  gap: 16px;
  margin-bottom: 16px;
}

.credentials-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
  gap: 16px;
}

.changelog-form-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 14px;
}
@media (max-width: 680px) {
  .changelog-form-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }
}

.maintenance-bento-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr));
  gap: 20px;
  margin-bottom: 24px;
}

.docs-viewer-container {
  display: flex;
  gap: 0;
  min-height: 520px;
  max-height: 68vh;
  overflow: hidden;
}

/* ── Responsive: Mobile Sidebar Collapse & Pristine Outlines ── */
@media (max-width: 992px) {
  html {
    height: auto !important;
    min-height: 100% !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
  }

  body.manager-body {
    height: auto !important;
    min-height: 100% !important;
    overflow: visible !important;
    touch-action: pan-y pinch-zoom !important;
    width: 100% !important;
    max-width: 100vw !important;
  }

  .manager-container {
    display: flex !important;
    flex-direction: column !important;
    height: auto !important;
    min-height: 100% !important;
    width: 100% !important;
    max-width: 100vw !important;
    overflow: visible !important;
  }

  /* Compact Sticky Mobile Header & Tab Strip */
  .manager-sidebar {
    width: 100% !important;
    height: auto !important;
    border-right: none !important;
    border-bottom: 1px solid var(--bg-border) !important;
    flex-direction: column !important;
    overflow: visible !important;
    padding: 0 !important;
    background: var(--bg-panel) !important;
    position: sticky !important;
    top: 0 !important;
    z-index: 100 !important;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4) !important;
  }

  .sidebar-branding {
    padding: 8px 14px !important;
    padding-top: max(8px, env(safe-area-inset-top)) !important;
    border-bottom: 1px solid var(--bg-border) !important;
    border-right: none !important;
    flex-shrink: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    width: 100% !important;
    box-sizing: border-box !important;
    height: auto !important;
  }

  .sidebar-brand-name {
    font-size: 13.5px !important;
    font-weight: 700 !important;
    display: flex !important;
    align-items: center !important;
  }

  .sidebar-brand-sub {
    display: none !important;
  }

  /* Mobile Quick Actions in Brand Bar */
  .sidebar-mobile-actions {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
  }

  .mobile-action-btn {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 32px !important;
    height: 32px !important;
    border-radius: var(--radius-sm) !important;
    background: var(--bg-panel-alt) !important;
    border: 1px solid var(--bg-border) !important;
    color: var(--text-secondary) !important;
    text-decoration: none !important;
    transition: all 0.15s ease !important;
  }
  .mobile-action-btn:hover {
    color: var(--text-primary) !important;
    background: var(--bg-hover) !important;
  }
  .mobile-action-btn svg {
    width: 15px !important;
    height: 15px !important;
  }

  /* Hide vertical sidebar footer on mobile to keep sticky header compact */
  .sidebar-footer {
    display: none !important;
  }

  /* Smooth Horizontal Scrollable Nav Strip with Uniform Chip Outlines */
  .sidebar-nav {
    display: flex !important;
    flex-direction: row !important;
    padding: 6px 10px !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    -webkit-overflow-scrolling: touch !important;
    touch-action: pan-x !important;
    scrollbar-width: none !important;
    align-items: center !important;
    flex: none !important;
    width: 100% !important;
    box-sizing: border-box !important;
    gap: 6px !important;
    background: var(--bg-panel) !important;
  }
  .sidebar-nav::-webkit-scrollbar {
    display: none;
  }

  .nav-group {
    display: flex !important;
    align-items: center !important;
    flex-shrink: 0 !important;
  }
  .nav-group-label {
    display: none !important;
  }
  .nav-item {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    list-style: none !important;
    padding: 0 !important;
    margin: 0 !important;
    gap: 6px !important;
    width: auto !important;
    flex-shrink: 0 !important;
  }
  .nav-item li {
    display: inline-flex !important;
    list-style: none !important;
    flex-shrink: 0 !important;
  }

  .nav-btn {
    border: 1px solid var(--bg-border) !important;
    border-radius: var(--radius) !important;
    padding: 6px 11px !important;
    font-size: 11.5px !important;
    white-space: nowrap !important;
    height: 32px !important;
    background: var(--bg-panel-alt) !important;
    color: var(--text-secondary) !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 6px !important;
    flex-shrink: 0 !important;
    transition: all 0.15s ease !important;
  }

  .nav-btn:hover {
    background: var(--bg-hover) !important;
    color: var(--text-primary) !important;
  }

  .nav-btn.active {
    border-color: var(--accent-emerald-border) !important;
    background: rgba(16, 185, 129, 0.12) !important;
    color: var(--accent-emerald) !important;
  }

  /* Content Containers & Outlines */
  .manager-content {
    height: auto !important;
    min-height: calc(100vh - 100px) !important;
    overflow-x: hidden !important;
    overflow-y: visible !important;
    width: 100% !important;
    max-width: 100vw !important;
    box-sizing: border-box !important;
  }

  .tab-panel {
    padding: 14px 12px max(36px, env(safe-area-inset-bottom)) !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    overflow-x: hidden !important;
  }

  .page-header {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 10px !important;
    margin-bottom: 14px !important;
    padding-bottom: 12px !important;
    border-bottom: 1px solid var(--bg-border) !important;
  }

  .page-header-text h1 {
    font-size: 18px !important;
    line-height: 1.3 !important;
  }
  .page-header-text p {
    font-size: 12px !important;
  }

  .page-header-actions {
    width: 100% !important;
    flex-wrap: wrap !important;
    gap: 8px !important;
  }
  .page-header-actions .btn {
    flex: 1 1 auto !important;
    justify-content: center !important;
    font-size: 12px !important;
  }

  /* Grids: Responsive 2-Col Stat Metrics & Single-Col Actions */
  .status-cards-grid {
    grid-template-columns: 1fr 1fr !important;
    gap: 8px !important;
    margin-bottom: 14px !important;
  }
  .status-card {
    padding: 12px 14px !important;
    border: 1px solid var(--bg-border) !important;
    border-radius: var(--radius) !important;
    box-sizing: border-box !important;
  }
  .status-card-value {
    font-size: 18px !important;
  }

  .action-cards-grid {
    grid-template-columns: 1fr !important;
    gap: 10px !important;
  }
  .action-card {
    padding: 14px 16px !important;
    border: 1px solid var(--bg-border) !important;
    border-radius: var(--radius) !important;
    box-sizing: border-box !important;
  }

  .cc-panel {
    padding: 14px 14px !important;
    border-radius: var(--radius) !important;
    margin-bottom: 14px !important;
    border: 1px solid var(--bg-border) !important;
    overflow-x: hidden !important;
    box-sizing: border-box !important;
  }

  /* Pristine Table Outlines with Protected Boundaries */
  .table-wrapper, .data-table-wrapper {
    border: 1px solid var(--bg-border) !important;
    border-radius: var(--radius) !important;
    max-width: 100% !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    box-sizing: border-box !important;
  }
  .data-table td, .data-table th {
    padding: 8px 10px !important;
    font-size: 12px !important;
  }
  .data-table td {
    word-break: break-word !important;
  }

  .stat-cards-row    { grid-template-columns: 1fr !important; gap: 10px !important; }
  .cred-cards-grid   { grid-template-columns: 1fr !important; gap: 10px !important; }
  .grid-2            { grid-template-columns: 1fr !important; gap: 10px !important; }
  .grid-3            { grid-template-columns: 1fr !important; gap: 10px !important; }

  /* Toolbars and Filtering Overrides */
  .db-browser-layout { flex-direction: column !important; }
  .db-schema-panel   { width: 100% !important; max-height: 200px !important; }
  .db-toolbar        { flex-direction: column !important; align-items: stretch !important; gap: 8px !important; }
  .db-table-select, .db-search-input { width: 100% !important; min-width: 0 !important; }
  .db-toolbar-right  { margin-left: 0 !important; width: 100% !important; justify-content: flex-end !important; }

  .file-explorer-layout { flex-direction: column !important; }
  .file-tree-panel   { width: 100% !important; max-height: 180px !important; }
  .file-list-toolbar { flex-direction: column !important; align-items: stretch !important; gap: 8px !important; }
  .file-breadcrumbs  { margin-left: 0 !important; }

  /* Docs Viewer Responsive Stack */
  .docs-viewer-container {
    display: flex !important;
    flex-direction: column !important;
    min-height: 0 !important;
    height: auto !important;
    max-height: 75vh !important;
    overflow: hidden !important;
  }
  #docs-toc-panel {
    width: 100% !important;
    max-height: 120px !important;
    border-right: none !important;
    border-bottom: 1px solid var(--bg-border) !important;
    padding: 10px 14px !important;
    box-sizing: border-box !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
  }
  #docs-render-area {
    width: 100% !important;
    flex: 1 1 auto !important;
    min-height: 280px !important;
    max-height: calc(75vh - 120px) !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    padding: 16px 14px !important;
    box-sizing: border-box !important;
  }

  .changelog-toolbar { flex-direction: column !important; align-items: stretch !important; gap: 8px !important; }
  .changelog-form-grid { grid-template-columns: 1fr !important; }

  .modal-box, .modal-container {
    max-width: calc(100vw - 20px) !important;
    margin: 10px auto !important;
    border-radius: var(--radius) !important;
    box-sizing: border-box !important;
  }
}

@media (max-width: 480px) {
  .status-cards-grid {
    grid-template-columns: 1fr !important;
  }
  .diag-stat-grid {
    grid-template-columns: 1fr !important;
  }
  .grid-restart-actions {
    grid-template-columns: 1fr !important;
  }
}
