/* =================================================================
 * Lookout — Theme A: Stripe-flavored developer console
 * Light-default · #635bff accent · Inter · sidebar nav
 * =================================================================*/

:root {
  /* Surfaces */
  --bg:           #f6f9fc;
  --bg-elev:      #ffffff;
  --bg-subtle:    #f7fafc;
  --bg-strong:    #eef2f7;

  /* Borders */
  --border:       #e3e8ee;
  --border-strong:#d6dde5;

  /* Text */
  --text:         #1a1f36;
  --text-dim:     #4f566b;
  --text-faint:   #8898aa;

  /* Synapto Vision brand palette (§11) */
  --brand-navy:   #1B2A5E;
  --brand-blue:   #3FA9DC;
  --brand-cyan:   #7FD4F0;
  --brand-cream:  #F7F5EF;
  /* Accent maps to the brand blue; text-on-soft / ink to the brand navy. */
  --accent:       #3FA9DC;
  --accent-hover: #2f93c4;
  --accent-soft:  #eaf6fc;
  --accent-text:  #1B2A5E;

  /* Status */
  --success:      #0e9f6e;
  --success-soft: #def7ec;
  --warning:      #c2410c;
  --warning-soft: #fef0d6;
  --danger:       #c2185b;
  --danger-soft:  #fdecf2;
  --critical:     #b91c1c;
  --critical-soft:#fee2e2;

  /* Effects */
  --shadow-1:     0 1px 2px rgba(15, 23, 42, 0.04), 0 0 0 1px rgba(15, 23, 42, 0.04);
  --shadow-2:     0 4px 16px rgba(15, 23, 42, 0.06), 0 0 0 1px rgba(15, 23, 42, 0.04);
  --shadow-focus: 0 0 0 3px rgba(99, 91, 255, 0.15);
  --radius-sm:    4px;
  --radius:       6px;
  --radius-lg:    10px;
}

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  font-size: 14px; line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "cv11", "ss01";
}
body { min-height: 100vh; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

::selection { background: var(--accent-soft); color: var(--accent-text); }

/* =================================================================
 * Layout — sidebar + main
 * =================================================================*/
.app-shell {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
}
@media (max-width: 880px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { display: none; }
}

.sidebar {
  background: var(--bg-elev);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  padding: 20px 14px;
  position: sticky; top: 0;
  height: 100vh;
}
.sidebar .brand {
  display: flex; align-items: center; gap: 10px;
  padding: 4px 8px 16px;
  font-weight: 600; font-size: 15px; color: var(--text);
}
.brand-logo {
  width: 30px; height: 30px; border-radius: 7px;
  display: inline-block; object-fit: contain; vertical-align: middle;
}

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: var(--radius);
  color: var(--text-dim);
  font-size: 13px; font-weight: 500;
  text-decoration: none;
}
.nav a:hover { background: var(--bg-strong); color: var(--text); }
.nav a.active {
  background: var(--accent-soft); color: var(--accent-text);
  font-weight: 600;
}
.nav a.active svg { color: var(--accent); }
.nav a svg {
  width: 16px; height: 16px; flex-shrink: 0;
  color: var(--text-faint);
}
.nav a:hover svg { color: var(--text-dim); }

.sidebar-divider { height: 1px; background: var(--border); margin: 14px 0; }
.sidebar-section-label {
  font-size: 10px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--text-faint); padding: 4px 10px 6px;
}

.sidebar-footer {
  margin-top: auto; padding-top: 14px;
}
.sidebar-user {
  background: var(--bg-subtle); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 10px 12px;
  font-size: 12px;
}
.sidebar-user .user-name { font-weight: 600; color: var(--text); }
.sidebar-user .user-org  { color: var(--text-faint); margin-top: 2px; font-size: 11px; }
.sidebar-user form { margin-top: 8px; }
.sidebar-user .btn-link {
  background: none; border: none; padding: 0; cursor: pointer;
  color: var(--text-dim); font-size: 11px; font-family: inherit;
}
.sidebar-user .btn-link:hover { color: var(--accent); text-decoration: underline; }

/* =================================================================
 * Main content
 * =================================================================*/
.main {
  padding: 28px 32px 48px;
  max-width: 1320px;
  width: 100%;
}
.main-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  margin-bottom: 20px; flex-wrap: wrap; gap: 12px;
}
.main-head h1 {
  margin: 0; font-size: 22px; font-weight: 600;
  letter-spacing: -0.01em; color: var(--text);
}
.main-head .subtitle {
  margin: 4px 0 0; color: var(--text-faint); font-size: 13px;
}

/* =================================================================
 * Typography helpers
 * =================================================================*/
h1, h2, h3, h4 { color: var(--text); letter-spacing: -0.005em; }
h2 { margin: 0 0 8px; font-size: 15px; font-weight: 600; }
h3 { margin: 0 0 6px; font-size: 13px; font-weight: 600; }
.section-label {
  font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--text-faint);
}
.subtle  { color: var(--text-faint); font-size: 12px; }
.muted   { color: var(--text-dim);   font-size: 12px; }
.mono    { font-family: ui-monospace, "JetBrains Mono", "Cascadia Mono", Menlo, monospace; }
.tabnum  { font-variant-numeric: tabular-nums; }

/* =================================================================
 * Cards
 * =================================================================*/
.card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  margin-bottom: 16px;
}
.card-tight { padding: 14px 16px; }
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px;
}
.card-head h2 { font-size: 14px; }
.card-head .actions { display: flex; gap: 6px; }

/* =================================================================
 * Forms
 * =================================================================*/
label {
  display: block;
  font-size: 12px; font-weight: 500;
  color: var(--text-dim); margin-bottom: 5px;
}
input[type=text], input[type=password], input[type=email], input[type=number],
input[type=date],
input[type=url], select, textarea {
  width: 100%;
  background: var(--bg-elev); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 8px 11px; font-size: 13px; font-family: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
input[type=text]:focus, input[type=password]:focus, input[type=email]:focus,
input[type=number]:focus, input[type=date]:focus,
input[type=url]:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--shadow-focus);
}
input:disabled, select:disabled, textarea:disabled { background: var(--bg-strong); cursor: not-allowed; }
textarea { resize: vertical; min-height: 64px; line-height: 1.45; }

.field { margin-bottom: 12px; }
.field-row { display: flex; gap: 10px; }
.field-row > * { flex: 1; }

/* =================================================================
 * Buttons
 * =================================================================*/
button, .btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 13px;
  background: var(--bg-elev); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius);
  font-size: 13px; font-weight: 500; font-family: inherit;
  cursor: pointer; transition: background 0.15s ease, border-color 0.15s ease, transform 0.05s ease;
  text-decoration: none;
}
button:hover, .btn:hover { background: var(--bg-subtle); border-color: var(--border-strong); }
button:active, .btn:active { transform: translateY(0.5px); }
button:disabled { opacity: 0.5; cursor: not-allowed; }

.btn.primary, button.primary {
  background: var(--accent); color: white; border-color: var(--accent);
}
.btn.primary:hover, button.primary:hover {
  background: var(--accent-hover); border-color: var(--accent-hover);
}

.btn.danger, button.danger {
  background: var(--bg-elev); color: var(--critical);
  border-color: var(--critical-soft);
}
.btn.danger:hover, button.danger:hover { background: var(--critical-soft); }

.btn.subtle { background: var(--bg-subtle); }
.btn.sm { padding: 5px 9px; font-size: 12px; }

.btn-link {
  background: none; border: none; padding: 0;
  color: var(--accent); cursor: pointer;
  font-size: 13px; font-family: inherit;
}
.btn-link:hover { text-decoration: underline; }

/* =================================================================
 * Tables
 * =================================================================*/
.table {
  width: 100%; border-collapse: collapse; font-size: 13px;
}
.table th, .table td {
  padding: 10px 12px; text-align: left;
  border-bottom: 1px solid var(--border);
}
.table th {
  color: var(--text-faint); font-weight: 600;
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em;
  background: var(--bg-subtle);
  position: sticky; top: 0;
}
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: var(--bg-subtle); }

/* =================================================================
 * Banners
 * =================================================================*/
.banner {
  padding: 12px 14px; border-radius: var(--radius);
  font-size: 13px; margin-bottom: 14px;
  border: 1px solid;
}
.banner.info    { background: var(--accent-soft);   border-color: #ddd6fe; color: var(--accent-text); }
.banner.success { background: var(--success-soft);  border-color: #a7f3d0; color: var(--success); }
.banner.warning { background: var(--warning-soft);  border-color: #fdba74; color: var(--warning); }
.banner.error   { background: var(--critical-soft); border-color: #fecaca; color: var(--critical); }

/* =================================================================
 * Badges / chips
 * =================================================================*/
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; font-weight: 600;
  padding: 2px 7px; border-radius: 99px;
  text-transform: uppercase; letter-spacing: 0.03em;
  border: 1px solid;
}
.badge.low      { color: var(--text-dim);  background: var(--bg-strong);     border-color: var(--border); }
.badge.medium   { color: var(--warning);   background: var(--warning-soft);  border-color: #fde68a; }
.badge.high     { color: var(--danger);    background: var(--danger-soft);   border-color: #fbcfe8; }
.badge.critical { color: white;            background: var(--critical);      border-color: var(--critical); }
.badge.ok       { color: var(--success);   background: var(--success-soft);  border-color: #bbf7d0; }
.badge.revoked, .badge.muted-badge {
                  color: var(--text-faint); background: var(--bg-strong);     border-color: var(--border); }

.kbd {
  font-family: ui-monospace, "JetBrains Mono", "Cascadia Mono", Menlo, monospace;
  font-size: 11px; background: var(--bg-strong);
  padding: 1px 5px; border-radius: 3px; border: 1px solid var(--border);
  color: var(--text);
}

/* Code block — Stripe-style sample */
.cb {
  background: #0f172a;
  color: #e2e8f0;
  border-radius: var(--radius);
  padding: 14px 16px;
  font-family: ui-monospace, "JetBrains Mono", "Cascadia Mono", Menlo, monospace;
  font-size: 12px; line-height: 1.55;
  overflow-x: auto;
  position: relative;
}
.cb .tok-keyword { color: #c4b5fd; }
.cb .tok-string  { color: #86efac; }
.cb .tok-key     { color: #fcd34d; }
.cb .tok-comment { color: #94a3b8; }
.cb .copy-btn {
  position: absolute; top: 8px; right: 8px;
  background: rgba(255,255,255,0.08); color: #cbd5e1;
  border: 1px solid rgba(255,255,255,0.1);
  font-size: 11px; padding: 3px 8px; border-radius: var(--radius-sm);
  cursor: pointer;
}
.cb .copy-btn:hover { background: rgba(255,255,255,0.16); color: white; }

/* =================================================================
 * Auth pages (login / signup) — single centered card
 * =================================================================*/
.auth-shell {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.auth-card {
  width: 100%; max-width: 380px;
  background: var(--bg-elev); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 28px 28px 24px;
  box-shadow: var(--shadow-2);
}
.auth-card .brand-row {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 2px;
  font-size: 18px; font-weight: 600; color: var(--text);
}
.auth-card .brand-tagline {
  margin: 0 0 18px 40px;
  color: var(--brand-blue); font-size: 12.5px; font-weight: 500; letter-spacing: 0.2px;
}
.auth-card .auth-logo { display: block; width: 210px; max-width: 78%; margin: 2px auto 22px; }
.auth-card .lead {
  color: var(--text-faint); font-size: 13px; margin: 0 0 18px;
}
.auth-card .foot-link {
  text-align: center; margin-top: 18px;
  color: var(--text-faint); font-size: 12px;
}

/* =================================================================
 * Dashboard — hero stats
 * =================================================================*/
.hero-stats {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px;
  margin-bottom: 16px;
}
@media (max-width: 768px) { .hero-stats { grid-template-columns: repeat(2, 1fr); } }
.hero-stat {
  background: var(--bg-elev); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 14px 16px;
}
.hero-stat .lbl {
  font-size: 11px; font-weight: 500; color: var(--text-faint);
  text-transform: uppercase; letter-spacing: 0.04em;
}
.hero-stat .val {
  font-size: 24px; font-weight: 600; margin-top: 6px;
  font-variant-numeric: tabular-nums; letter-spacing: -0.01em;
}
.hero-stat .sub {
  font-size: 11px; color: var(--text-faint); margin-top: 2px;
}

/* =================================================================
 * Camera grid — Stripe-styled tile cards
 * =================================================================*/
.dash-layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 16px;
}
@media (max-width: 1100px) { .dash-layout { grid-template-columns: 1fr; } }

.section-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 10px;
}
.section-head h2 {
  margin: 0; font-size: 11px; font-weight: 600;
  color: var(--text-faint);
  text-transform: uppercase; letter-spacing: 0.05em;
}

.cam-grid {
  display: grid; gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}
.cam-grid[data-count="1"] { grid-template-columns: 1fr; }
.cam-grid[data-count="2"] { grid-template-columns: 1fr 1fr; }
.cam-grid[data-count="3"], .cam-grid[data-count="4"] {
  grid-template-columns: 1fr 1fr;
}
.cam-grid[data-count="5"], .cam-grid[data-count="6"],
.cam-grid[data-count="7"], .cam-grid[data-count="8"], .cam-grid[data-count="9"] {
  grid-template-columns: 1fr 1fr 1fr;
}

.cam-tile {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex; flex-direction: column;
  transition: box-shadow 0.18s ease, border-color 0.18s ease;
  cursor: pointer;
}
.cam-tile:hover {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(99, 91, 255, 0.08);
}
.cam-tile.offline { opacity: 0.65; }

.cam-feed {
  aspect-ratio: 16 / 9; background: #0f172a; position: relative;
  display: flex; align-items: center; justify-content: center;
}
.cam-feed img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cam-feed .placeholder {
  color: #94a3b8; font-size: 12px; padding: 12px;
}
.cam-feed .live-dot, .cam-feed .offline-dot {
  position: absolute; top: 8px; right: 8px;
  font-size: 10px; font-weight: 700;
  padding: 3px 8px; border-radius: 99px;
  text-transform: uppercase; letter-spacing: 0.05em;
  backdrop-filter: blur(8px);
}
.cam-feed .live-dot {
  background: rgba(220, 38, 38, 0.95); color: white;
  display: flex; align-items: center; gap: 5px;
}
.cam-feed .live-dot::before {
  content: ""; width: 5px; height: 5px;
  background: white; border-radius: 50%;
  animation: liveBlink 1.2s infinite;
}
@keyframes liveBlink { 50% { opacity: 0.3; } }
.cam-feed .offline-dot { background: rgba(15, 23, 42, 0.7); color: #cbd5e1; }

.cam-meta {
  padding: 10px 14px; display: flex; align-items: center; gap: 8px;
}
.cam-meta .name {
  flex: 1; font-size: 13px; font-weight: 600; color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.cam-meta .kind {
  font-size: 10px; font-weight: 600;
  color: var(--text-faint);
  text-transform: uppercase; letter-spacing: 0.04em;
}

/* Tile controls: small FPS selector + pause button overlaid on the feed */
.cam-controls {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 14px; border-top: 1px solid var(--border);
  background: var(--bg-subtle);
  font-size: 11px; color: var(--text-faint);
}
.cam-controls label {
  margin: 0; font-size: 10px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--text-faint);
}
.cam-controls .fps-select {
  background: var(--bg-elev); border: 1px solid var(--border);
  border-radius: 4px; padding: 2px 6px; font-size: 11px;
  color: var(--text); font-family: inherit;
  width: auto;
}
.cam-controls .fps-select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px rgba(99,91,255,0.15); }
.cam-controls .pause-btn {
  margin-left: auto; padding: 2px 8px; font-size: 11px;
  background: var(--bg-elev); color: var(--text-dim);
  border-radius: 4px;
}
.cam-controls .pause-btn.paused { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }

.cam-controls .overlay-toggle {
  padding: 3px 7px; font-size: 11px; line-height: 1;
  background: var(--bg-elev); color: var(--text-dim);
  border: 1px solid var(--border); border-radius: 4px;
  display: inline-flex; align-items: center; gap: 4px;
  cursor: pointer;
}
.cam-controls .overlay-toggle:hover { background: var(--bg-strong); color: var(--text); }
.cam-controls .overlay-toggle.active {
  background: var(--accent-soft); color: var(--accent-text);
  border-color: var(--accent);
}
.cam-controls .overlay-toggle svg { width: 13px; height: 13px; }

.cam-controls .start-stop-btn {
  margin-left: auto; padding: 3px 10px; font-size: 11px; font-weight: 600;
  border-radius: 4px;
  background: var(--success); color: white; border-color: var(--success);
}
.cam-controls .start-stop-btn:hover { filter: brightness(1.08); }
.cam-controls .start-stop-btn.running {
  background: var(--bg-elev); color: var(--critical);
  border-color: var(--critical-soft);
}
.cam-controls .start-stop-btn.running:hover { background: var(--critical-soft); }

.cam-controls .cam-status {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 10px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.04em;
}
.cam-controls .cam-status::before {
  content: ""; width: 7px; height: 7px; border-radius: 50%;
  background: var(--text-faint);
}
.cam-controls .cam-status.running { color: var(--success); }
.cam-controls .cam-status.running::before {
  background: var(--success);
  box-shadow: 0 0 0 0 rgba(16,185,129,0.5);
  animation: statusPulse 2s infinite;
}
.cam-controls .cam-status.stopped { color: var(--text-faint); }
.cam-controls .cam-status.error { color: var(--critical); }
.cam-controls .cam-status.error::before { background: var(--critical); }

/* Mini tier pulse on live tile when cascade is firing */
.cam-feed .tier-pulse {
  position: absolute; bottom: 8px; left: 8px;
  display: flex; gap: 4px;
  pointer-events: none;
}
.cam-feed .tier-pulse .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: rgba(255,255,255,0.2);
  transition: background 0.3s ease, box-shadow 0.3s ease;
}
.cam-feed .tier-pulse .dot.active {
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(99,91,255,0.3);
}
.cam-feed .tier-pulse .dot.passed { background: var(--success); }

/* WebSocket connection status — small dot in the dashboard header area */
.ws-status {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px; color: var(--text-faint);
}
.ws-status::before {
  content: ""; width: 7px; height: 7px; border-radius: 50%;
  background: var(--text-faint);
}
.ws-status.connected::before {
  background: var(--success);
  box-shadow: 0 0 0 0 rgba(16,185,129,0.5);
  animation: statusPulse 2s infinite;
}
.ws-status.connected { color: var(--success); }
.ws-status.disconnected::before { background: var(--critical); }
.ws-status.disconnected { color: var(--critical); }
@keyframes statusPulse {
  0%   { box-shadow: 0 0 0 0 rgba(16,185,129,0.5); }
  70%  { box-shadow: 0 0 0 6px rgba(16,185,129,0); }
  100% { box-shadow: 0 0 0 0 rgba(16,185,129,0); }
}

/* "Add camera" empty/placeholder tile */
.cam-add-tile {
  background: var(--bg-elev);
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 24px; min-height: 200px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  color: var(--text-faint); text-decoration: none; cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}
.cam-add-tile:hover {
  border-color: var(--accent); color: var(--accent);
  background: var(--accent-soft); text-decoration: none;
}
.cam-add-tile .plus {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--bg-strong);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 22px; line-height: 1; margin-bottom: 10px;
  color: var(--text-dim);
}
.cam-add-tile:hover .plus { background: white; color: var(--accent); }

/* Empty state */
.empty-state {
  background: var(--bg-elev); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 48px 24px;
  text-align: center;
}
.empty-state h3 {
  margin: 0 0 8px; font-size: 16px; color: var(--text);
  text-transform: none; letter-spacing: 0; font-weight: 600;
}
.empty-state p {
  margin: 0 0 18px; color: var(--text-faint); font-size: 13px;
  max-width: 380px; margin-left: auto; margin-right: auto;
}

/* =================================================================
 * Alerts feed (dashboard right rail + alerts page)
 * =================================================================*/
.alerts-feed {
  display: flex; flex-direction: column; gap: 8px;
  max-height: 640px; overflow-y: auto;
}
.alert-row {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-left: 3px solid var(--text-faint);
  border-radius: var(--radius);
  padding: 10px 12px;
  /* Rows are anchors to the alert-detail page — keep the card look, not a link look. */
  display: block;
  color: inherit;
  text-decoration: none;
}
/* Background only — must not touch border-left-color, which carries severity. */
a.alert-row:hover { background: var(--bg-strong); }
.alert-row.critical { border-left-color: var(--critical); }
.alert-row.high     { border-left-color: var(--danger); }
.alert-row.medium   { border-left-color: var(--warning); }
.alert-row.low      { border-left-color: var(--text-faint); }
.alert-row .head {
  display: flex; gap: 8px; align-items: center;
  font-size: 11px; color: var(--text-faint);
  margin-bottom: 4px;
}
.alert-row .when { margin-left: auto; }
.alert-row .body {
  font-size: 13px; color: var(--text); font-weight: 500;
}
.alert-row .reason {
  font-size: 11px; color: var(--text-dim); margin-top: 3px;
  line-height: 1.4;
}

/* =================================================================
 * Modal
 * =================================================================*/
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(15, 23, 42, 0.4);
  display: none; align-items: center; justify-content: center;
  z-index: 100;
  backdrop-filter: blur(4px);
}
.modal-backdrop.open { display: flex; }
.modal {
  background: var(--bg-elev); border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px;
  width: 100%; max-width: 480px;
  box-shadow: var(--shadow-2);
}
.modal h2 { margin: 0 0 14px; font-size: 15px; }
.modal .close {
  background: none; border: none; padding: 0;
  color: var(--text-faint); font-size: 22px; cursor: pointer;
  width: 28px; height: 28px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm);
}
.modal .close:hover { background: var(--bg-strong); color: var(--text); }
.modal-actions {
  display: flex; justify-content: flex-end; gap: 8px;
  margin-top: 14px;
}

/* =================================================================
 * Misc helpers
 * =================================================================*/
.row { display: flex; gap: 10px; align-items: center; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.right { margin-left: auto; }
.text-dim { color: var(--text-dim); }
.text-faint { color: var(--text-faint); }
.text-success { color: var(--success); }
.text-danger { color: var(--critical); }
.fw-500 { font-weight: 500; }
.fw-600 { font-weight: 600; }
.mb-0 { margin-bottom: 0; }
.mt-0 { margin-top: 0; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; }

/* =================================================================
 * Toasts — bottom-right ephemeral notifications
 *
 * Usage from JS:   toast.show({ title: "Copied", type: "success" })
 * Types:           "success" | "info" | "warning" | "error"
 * =================================================================*/
.toast-host {
  position: fixed; bottom: 20px; right: 20px;
  display: flex; flex-direction: column-reverse; gap: 8px;
  z-index: 200; pointer-events: none;
  max-width: calc(100vw - 40px);
}
.toast {
  pointer-events: auto;
  display: flex; align-items: flex-start; gap: 10px;
  min-width: 280px; max-width: 380px;
  padding: 11px 14px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 24px rgba(15,23,42,0.12), 0 0 0 1px rgba(15,23,42,0.04);
  font-size: 13px; color: var(--text);
  animation: toastIn 0.22s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
.toast.exit { animation: toastOut 0.18s ease forwards; }
@keyframes toastIn {
  from { transform: translateY(14px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}
@keyframes toastOut {
  to   { transform: translateY(14px); opacity: 0; }
}
.toast .toast-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; border-radius: 50%; flex-shrink: 0;
  font-size: 13px; font-weight: 700;
  margin-top: -1px;
}
.toast.success .toast-icon { background: var(--success-soft);  color: var(--success); }
.toast.info    .toast-icon { background: var(--accent-soft);   color: var(--accent-text); }
.toast.warning .toast-icon { background: var(--warning-soft);  color: var(--warning); }
.toast.error   .toast-icon { background: var(--critical-soft); color: var(--critical); }

.toast .toast-body { flex: 1; min-width: 0; }
.toast .toast-title { font-weight: 600; color: var(--text); line-height: 1.3; }
.toast .toast-msg   { color: var(--text-dim); font-size: 12px; margin-top: 2px; }

.toast .toast-close {
  background: none; border: none; padding: 0;
  cursor: pointer; color: var(--text-faint);
  font-size: 16px; line-height: 1;
  width: 22px; height: 22px; border-radius: var(--radius-sm);
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.toast .toast-close:hover { background: var(--bg-strong); color: var(--text); }

/* Quick-start tabbed card (Stripe-style language switcher) */
.tabs {
  display: flex; gap: 2px;
  border-bottom: 1px solid var(--border); margin-bottom: 12px;
}
.tab {
  padding: 6px 12px; font-size: 12px; font-weight: 500;
  color: var(--text-faint); cursor: pointer;
  background: none; border: none; border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.tab:hover { color: var(--text); background: none; }
.tab.active {
  color: var(--accent); border-bottom-color: var(--accent);
}
.tab-panel { display: none; }
.tab-panel.active { display: block; }
