/* =============================================================================
   Sanctuary Pro — design tokens
   A premium "control booth" system: deep navy glass, one confident blue
   accent, and a warm serif reserved only for the thing the room is actually
   looking at — the slide itself.
   ============================================================================= */

:root {
  --bg: #0B1220;
  --bg-soft: #0d1424;
  --bg-elevated: #111827;
  --surface: #111827;
  --surface-2: #162032;
  --surface-3: #1c273b;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.14);

  --text: #F8FAFC;
  --text-dim: #cbd5e1;
  --muted: #94A3B8;
  --muted-2: #64748b;

  --accent: #2563EB;
  --accent-hover: #3B82F6;
  --accent-dim: #2563eb22;
  --accent-glow: #2563eb55;
  --success: #22C55E;
  --warning: #F59E0B;
  --danger: #EF4444;

  /* legacy aliases kept for any inline references */
  --red: var(--danger);
  --blue2: var(--accent-hover);

  --radius-sm: 9px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 26px;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 10px 30px -12px rgba(0, 0, 0, 0.55);
  --shadow-glow: 0 0 0 1px var(--accent-dim), 0 16px 36px -16px var(--accent-glow);

  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --dur: 180ms;

  color-scheme: dark;
}

/* Light "contrast" chrome mode — toggled on the control-room shell only.
   The presenter output is never affected by this; it always follows the
   per-deck theme colors chosen in the Inspector. */
[data-chrome="light"] {
  --bg: #f4f6fb;
  --bg-soft: #eef1f8;
  --bg-elevated: #ffffff;
  --surface: #ffffff;
  --surface-2: #f2f4f9;
  --surface-3: #e7eaf3;
  --border: rgba(15, 23, 42, 0.09);
  --border-strong: rgba(15, 23, 42, 0.16);
  --text: #0f172a;
  --text-dim: #334155;
  --muted: #64748b;
  --muted-2: #94a3b8;
  --shadow-md: 0 10px 30px -14px rgba(15, 23, 42, 0.25);
  color-scheme: light;
}

* { box-sizing: border-box; }

html, body { background: var(--bg); }

body {
  font-family: "Inter", ui-sans-serif, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}

::selection { background: var(--accent); color: #f8fafc; }

* { scrollbar-width: thin; scrollbar-color: var(--surface-3) transparent; }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 8px; }
*::-webkit-scrollbar-track { background: transparent; }

.hidden { display: none !important; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); border: 0; white-space: nowrap;
}

:focus-visible {
  outline: 2px solid var(--accent-hover);
  outline-offset: 2px;
  border-radius: 6px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

button, .btn { font-family: inherit; }
h1, h2, h3, .font-display { font-family: "Manrope", ui-sans-serif, sans-serif; }

/* =============================================================================
   Presenter (fullscreen output) view
   ============================================================================= */

.presenter {
  height: 100vh;
  width: 100vw;
  background: #000;
  display: grid;
  place-items: center;
  cursor: none;
  -webkit-user-select: none;
  user-select: none;
  position: relative;
  overflow: hidden;
}

.presenterText {
  max-width: 88vw;
  white-space: pre-wrap;
  text-align: center;
  line-height: 1.2;
  font-weight: 600;
  overflow-wrap: anywhere;
  font-family: "Merriweather", ui-serif, serif;
  transition: opacity 260ms var(--ease), filter 260ms var(--ease);
}

.presenter.is-transitioning .presenterText { opacity: 0; filter: blur(6px); }

.presenter-clock {
  position: fixed;
  top: 20px;
  left: 24px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 13px;
  letter-spacing: 0.06em;
  color: #ffffff55;
}

.presenter-next {
  position: fixed;
  bottom: 20px;
  left: 24px;
  right: 24px;
  max-width: 560px;
  font-family: "Inter", sans-serif;
  font-size: 12px;
  color: #ffffff45;
  border-top: 1px solid #ffffff1a;
  padding-top: 8px;
}

.presenter-next b {
  display: block;
  color: #ffffff70;
  font-family: "IBM Plex Mono", monospace;
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-bottom: 3px;
}

.watermark {
  position: fixed;
  right: 20px;
  bottom: 14px;
  color: #ffffff20;
  font-size: 11px;
  font-family: "IBM Plex Mono", monospace;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

/* =============================================================================
   Top bar
   ============================================================================= */

.topbar {
  background: color-mix(in srgb, var(--bg-soft) 92%, transparent);
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  border-bottom: 1px solid var(--border);
  position: relative;
  z-index: 30;
}

.brand-mark {
  font-family: "Manrope", ui-sans-serif, sans-serif;
  font-weight: 800;
  font-size: 17px;
  letter-spacing: -0.01em;
  color: var(--text);
}

.brand-badge {
  font-family: "IBM Plex Mono", monospace;
  font-size: 10px;
  letter-spacing: 0.14em;
  color: #eef2ff;
  background: linear-gradient(135deg, var(--accent), var(--accent-hover));
  padding: 2px 7px;
  border-radius: 5px;
  font-weight: 700;
  transform: translateY(1px);
}

.status-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 3px #22c55e22, 0 0 12px #22c55e88;
  flex-shrink: 0;
}
.status-dot.off {
  background: var(--muted-2);
  box-shadow: none;
}

.eyebrow {
  font-family: "IBM Plex Mono", monospace;
  font-size: 10.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--muted);
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 5px 10px 5px 8px;
  border-radius: 999px;
  white-space: nowrap;
}
.pill svg { width: 13px; height: 13px; flex-shrink: 0; }

.clock-pill { font-family: "IBM Plex Mono", monospace; color: var(--text-dim); }

.search-shell {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 7px 10px;
  min-width: 200px;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.search-shell:focus-within { border-color: var(--accent-hover); box-shadow: 0 0 0 3px var(--accent-dim); }
.search-shell svg { width: 14px; height: 14px; color: var(--muted); flex-shrink: 0; }
.search-shell input { background: transparent; border: none; outline: none; color: var(--text); font-size: 13px; width: 100%; }
.search-shell input::placeholder { color: var(--muted-2); }
.search-shell kbd {
  font-family: "IBM Plex Mono", monospace;
  font-size: 10px;
  color: var(--muted-2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 5px;
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 34px; height: 34px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--muted);
  cursor: pointer;
  transition: all var(--dur) var(--ease);
  flex-shrink: 0;
}
.icon-btn svg { width: 16px; height: 16px; }
.icon-btn:hover { color: var(--text); border-color: var(--border-strong); background: var(--surface-3); }
.icon-btn:active { transform: translateY(1px) scale(0.97); }

.avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--accent), #7c5cff);
  color: #fff;
  font-family: "Manrope", sans-serif;
  font-weight: 700;
  font-size: 12.5px;
  flex-shrink: 0;
  border: 1px solid var(--border-strong);
  cursor: pointer;
}

/* Buttons ------------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  font-weight: 600;
  padding: 9px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-dim);
  transition: border-color var(--dur) var(--ease), color var(--dur) var(--ease),
    background var(--dur) var(--ease), transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
  cursor: pointer;
  white-space: nowrap;
}
.btn svg { width: 15px; height: 15px; flex-shrink: 0; }
.btn:hover { border-color: var(--border-strong); color: var(--text); background: var(--surface-3); }
.btn:active { transform: translateY(1px); }

.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-hover));
  border-color: var(--accent);
  color: #fff;
  box-shadow: var(--shadow-glow);
}
.btn-primary:hover { filter: brightness(1.08); color: #fff; border-color: var(--accent-hover); }

.btn-danger-outline { color: #fca5a5; }
.btn-danger-outline:hover { border-color: var(--danger); color: #fecaca; background: #ef444414; }

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

.btn-sm { padding: 6px 10px; font-size: 12px; border-radius: 8px; }

/* =============================================================================
   Sidebar
   ============================================================================= */

.sidebar { background: var(--bg); }

.section-label {
  font-family: "IBM Plex Mono", monospace;
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted-2);
  font-weight: 700;
}

.nav {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
  padding: 9px 11px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--dur) var(--ease);
  position: relative;
}
.nav svg { width: 16px; height: 16px; flex-shrink: 0; opacity: 0.85; }
.nav .count { margin-left: auto; font-family: "IBM Plex Mono", monospace; font-size: 10.5px; color: var(--muted-2); }
.nav:hover { color: var(--text); background: var(--surface-2); }
.nav.active { color: #bfd2ff !important; background: var(--accent-dim) !important; border-color: #2563eb3d !important; }
.nav.active::before {
  content: "";
  position: absolute;
  left: -1px; top: 22%; bottom: 22%;
  width: 3px;
  border-radius: 3px;
  background: var(--accent);
}

/* Quick add / flow cards — class name "item" is emitted by main.js, keep it */

.item {
  border: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: var(--radius-md);
  padding: 11px 12px;
  cursor: pointer;
  transition: border-color var(--dur) var(--ease), transform var(--dur) var(--ease),
    background var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
  display: flex;
  align-items: flex-start;
  gap: 9px;
}
.item:hover { border-color: var(--accent-hover); background: var(--surface-3); transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.item .item-body { min-width: 0; flex: 1; }
.item .fav-btn { flex-shrink: 0; color: var(--muted-2); padding: 2px; border-radius: 6px; transition: color var(--dur) var(--ease), transform var(--dur) var(--ease); }
.item .fav-btn:hover { color: var(--warning); transform: scale(1.12); }
.item .fav-btn.active { color: var(--warning); }
.item .fav-btn svg { width: 14px; height: 14px; }

.item b { display: block; font-size: 13px; font-weight: 700; color: var(--text); }
.item span {
  display: block; margin-top: 2px; font-size: 11.5px; line-height: 1.4; color: var(--muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.empty-note {
  font-size: 12px; color: var(--muted-2);
  border: 1px dashed var(--border);
  border-radius: var(--radius-md);
  padding: 14px;
  text-align: center;
  line-height: 1.5;
}

/* =============================================================================
   Editor
   ============================================================================= */

.editor-shell { background: var(--bg); }

.editor-frame {
  position: relative;
  display: flex;
  min-height: 0;
  flex: 1;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface);
  overflow: hidden;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.editor-frame:focus-within { border-color: var(--accent-hover); box-shadow: 0 0 0 3px var(--accent-dim); }

.editor-gutter {
  width: 46px;
  flex-shrink: 0;
  background: var(--surface-2);
  border-right: 1px solid var(--border);
  overflow: hidden;
  font-family: "IBM Plex Mono", monospace;
  font-size: 12.5px;
  line-height: 1.7;
  color: var(--muted-2);
  text-align: right;
  padding: 16px 10px 16px 0;
  -webkit-user-select: none;
  user-select: none;
}
.editor-gutter div.slide-marker { color: var(--accent-hover); font-weight: 700; }

#editor {
  font-family: "IBM Plex Mono", monospace;
  line-height: 1.7;
  border: none;
  background: transparent;
  color: var(--text);
  resize: none;
  padding: 16px;
}
#editor:focus { outline: none; }
#editor::placeholder { color: var(--muted-2); }

.editor-statline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 10px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  color: var(--muted-2);
}
.editor-statline .stat-group { display: flex; gap: 14px; }
.editor-statline .zoom-group { display: flex; align-items: center; gap: 6px; }

/* =============================================================================
   Slide sequence
   ============================================================================= */

.seq-panel { background: var(--bg-soft); }
.seqList { background: var(--bg-soft); }

.slide {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 12px;
  cursor: grab;
  transition: border-color var(--dur) var(--ease), transform var(--dur) var(--ease),
    box-shadow var(--dur) var(--ease), opacity var(--dur) var(--ease);
  position: relative;
}
.slide:hover { border-color: var(--accent-hover); transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.slide.active { border-color: var(--accent); box-shadow: var(--shadow-glow); }
.slide.dragging { opacity: 0.4; }
.slide.drag-over { border-color: var(--warning); }

.slide-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.slide-head .slide-num { font-family: "IBM Plex Mono", monospace; font-size: 11px; font-weight: 700; color: var(--text); display: flex; align-items: center; gap: 6px; }
.slide-head .grip { color: var(--muted-2); width: 13px; height: 13px; }

.slide-actions { display: flex; align-items: center; gap: 2px; opacity: 0; transition: opacity var(--dur) var(--ease); }
.slide:hover .slide-actions, .slide.active .slide-actions { opacity: 1; }
.slide-actions button { width: 22px; height: 22px; display: grid; place-items: center; border-radius: 6px; color: var(--muted); transition: all var(--dur) var(--ease); }
.slide-actions button:hover { background: var(--surface-3); color: var(--text); }
.slide-actions button.danger:hover { color: #fca5a5; background: #ef444422; }
.slide-actions button.fav.active { color: var(--warning); }
.slide-actions svg { width: 13px; height: 13px; }

.slide .preview-card {
  font-family: "Merriweather", ui-serif, serif;
  color: var(--text);
  background: var(--surface-3);
  border-radius: var(--radius-md);
  padding: 12px;
  min-height: 96px;
  max-height: 130px;
  overflow: hidden;
  font-size: 13px;
  line-height: 1.55;
}

.slide-meta {
  margin-top: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: "IBM Plex Mono", monospace;
  font-size: 10.5px;
  color: var(--muted-2);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* =============================================================================
   Inspector
   ============================================================================= */

.inspector { background: var(--bg); }

.stage-preview {
  position: relative;
  border-radius: var(--radius-xl);
  border: 1px solid var(--border-strong);
  background: #000;
  overflow: hidden;
  box-shadow: var(--shadow-md);
}

.stage-frame-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 12px;
  background: #060708;
  border-bottom: 1px solid #ffffff12;
}

.live-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: #fff;
  background: var(--danger);
  padding: 3px 8px 3px 6px;
  border-radius: 5px;
}
.live-badge .dot { width: 5px; height: 5px; border-radius: 50%; background: #fff; animation: pulse-dot 1.6s ease-in-out infinite; }
.live-badge.idle { background: var(--surface-3); color: var(--muted); }
.live-badge.idle .dot { background: var(--muted-2); animation: none; }

@keyframes pulse-dot { 0%, 100% { opacity: 1; } 50% { opacity: 0.25; } }

.stage-res { font-family: "IBM Plex Mono", monospace; font-size: 10px; color: #6b7280; letter-spacing: 0.06em; }

.stage-preview .spotlight {
  position: absolute;
  inset: -20%;
  background: radial-gradient(closest-side, #2563eb22, transparent 70%);
  pointer-events: none;
  animation: spotlight-breathe 6s ease-in-out infinite;
}
@keyframes spotlight-breathe {
  0%, 100% { opacity: 0.6; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.05); }
}
@media (prefers-reduced-motion: reduce) { .stage-preview .spotlight { animation: none; } }

#miniStage {
  position: relative;
  min-height: 132px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  transition: background var(--dur) var(--ease);
}
#miniText {
  position: relative;
  z-index: 1;
  font-family: "Merriweather", ui-serif, serif;
  font-weight: 600;
  white-space: pre-wrap;
  text-align: center;
  line-height: 1.28;
  transition: color var(--dur) var(--ease);
}

.field-row { display: grid; gap: 6px; }
.field-label { font-size: 12px; color: var(--muted); font-weight: 600; }

input[type="color"] {
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-2);
  padding: 3px;
  cursor: pointer;
}

.select-field {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 12.5px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  cursor: pointer;
  transition: border-color var(--dur) var(--ease);
}
.select-field:hover { border-color: var(--border-strong); }
.select-field:focus { outline: none; border-color: var(--accent-hover); box-shadow: 0 0 0 3px var(--accent-dim); }
input.select-field { cursor: text; }

/* Quick Add: manual item entry form */
.text-field {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 12.5px;
  font-weight: 500;
  font-family: inherit;
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  cursor: text;
  transition: border-color var(--dur) var(--ease);
}
.text-field:hover { border-color: var(--border-strong); }
.text-field:focus { outline: none; border-color: var(--accent-hover); box-shadow: 0 0 0 3px var(--accent-dim); }
textarea.text-field { resize: vertical; min-height: 60px; line-height: 1.4; }
.library-add-form { display: grid; gap: 8px; margin-top: 12px; padding: 10px; border: 1px dashed var(--border); border-radius: var(--radius-md); background: var(--bg); }
.item-actions { display: flex; align-items: center; gap: 2px; flex-shrink: 0; }

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  border-radius: 4px;
  background: var(--surface-3);
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 15px; height: 15px; border-radius: 50%;
  background: var(--accent-hover);
  border: 2px solid #0b1220;
  box-shadow: 0 0 0 3px var(--accent-dim);
  cursor: pointer; margin-top: -5.5px;
}
input[type="range"]::-moz-range-thumb {
  width: 15px; height: 15px; border-radius: 50%;
  background: var(--accent-hover); border: 2px solid #0b1220;
  box-shadow: 0 0 0 3px var(--accent-dim); cursor: pointer;
}

.toggle-row { display: flex; align-items: center; justify-content: space-between; padding: 9px 2px; }
.switch {
  width: 34px; height: 20px; border-radius: 999px;
  background: var(--surface-3); border: 1px solid var(--border);
  position: relative; cursor: pointer; flex-shrink: 0;
  transition: background var(--dur) var(--ease);
}
.switch::after {
  content: ""; position: absolute; top: 2px; left: 2px;
  width: 14px; height: 14px; border-radius: 50%; background: var(--muted);
  transition: transform var(--dur) var(--ease), background var(--dur) var(--ease);
}
.switch.on { background: var(--accent-dim); border-color: #2563eb55; }
.switch.on::after { transform: translateX(14px); background: var(--accent-hover); }

.align-group {
  border: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: var(--radius-md);
  padding: 4px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2px;
}
.align-btn {
  background: transparent; color: var(--muted); border: none;
  border-radius: 10px; padding: 8px 6px; font-size: 12px; font-weight: 600;
  cursor: pointer; transition: all var(--dur) var(--ease);
  display: flex; align-items: center; justify-content: center; gap: 5px;
}
.align-btn svg { width: 13px; height: 13px; }
.align-btn:hover { color: var(--text); background: var(--surface-3); }
.align-btn.active { background: var(--accent); color: #fff; }

.kbd-list { font-size: 12px; color: var(--muted); line-height: 1.9; }
.kbd-list .kbd-row { display: flex; align-items: center; justify-content: space-between; }
.kbd-list .kbd-keys { display: flex; gap: 4px; }
kbd {
  font-family: "IBM Plex Mono", monospace;
  font-size: 10.5px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 5px;
  padding: 1.5px 6px;
  color: var(--text-dim);
}

.tab-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 4px;
}
.tab-strip button { padding: 7px 8px; border-radius: 9px; font-size: 11.5px; font-weight: 700; color: var(--muted); transition: all var(--dur) var(--ease); }
.tab-strip button:hover { color: var(--text); }
.tab-strip button.active { background: var(--accent); color: #fff; }

/* =============================================================================
   Footer / transport
   ============================================================================= */

.footer-bar {
  background: color-mix(in srgb, var(--bg-soft) 92%, transparent);
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  border-top: 1px solid var(--border);
}

#liveBtn { min-width: 108px; font-family: "IBM Plex Mono", monospace; letter-spacing: 0.05em; }

#blackBtn.active { background: var(--danger) !important; border-color: var(--danger) !important; color: #fff !important; }
#clearBtn.active { background: var(--surface-3) !important; border-color: var(--muted-2) !important; color: var(--text) !important; }

#statusText { font-family: "IBM Plex Mono", monospace; font-weight: 700; letter-spacing: 0.05em; }

.status-strip { display: flex; align-items: center; gap: 16px; }
.status-strip .stat { display: flex; flex-direction: column; align-items: flex-end; gap: 1px; }
.status-strip .stat .v { font-size: 12.5px; font-weight: 700; color: var(--text); font-family: "IBM Plex Mono", monospace; }
.status-strip .stat .l { font-size: 9.5px; color: var(--muted-2); text-transform: uppercase; letter-spacing: 0.1em; }

/* =============================================================================
   Menus / toasts
   ============================================================================= */

.menu-popover {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 220px;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  padding: 6px;
  z-index: 50;
  opacity: 0;
  transform: translateY(-6px) scale(0.98);
  pointer-events: none;
  transition: opacity var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.menu-popover.open { opacity: 1; transform: translateY(0) scale(1); pointer-events: auto; }
.menu-popover .menu-item {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 10px; border-radius: 8px; font-size: 12.5px; font-weight: 600;
  color: var(--text-dim); cursor: pointer; transition: background var(--dur) var(--ease);
}
.menu-popover .menu-item:hover { background: var(--surface-3); color: var(--text); }
.menu-popover .menu-item svg { width: 14px; height: 14px; color: var(--muted); }
.menu-popover .menu-sep { height: 1px; background: var(--border); margin: 5px 4px; }
.menu-popover .menu-heading { font-family: "IBM Plex Mono", monospace; font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted-2); padding: 6px 10px 4px; }
.menu-popover .menu-empty { padding: 10px; font-size: 12px; color: var(--muted-2); text-align: center; }

.toast-stack { position: fixed; bottom: 100px; right: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 80; }
.toast {
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  color: var(--text);
  font-size: 12.5px;
  font-weight: 600;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  display: flex; align-items: center; gap: 8px;
  animation: toast-in 220ms var(--ease);
}
.toast svg { width: 14px; height: 14px; color: var(--success); flex-shrink: 0; }
@keyframes toast-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

@keyframes rise-in { from { opacity: 0; transform: translateY(6px) scale(0.98); } to { opacity: 1; transform: translateY(0) scale(1); } }
.rise-in { animation: rise-in 220ms var(--ease) both; }

/* =============================================================================
   Responsive
   ============================================================================= */

@media (max-width: 1180px) {
  .work-grid { grid-template-columns: 216px minmax(320px, 1fr) 0px 0px !important; }
  .seq-panel, .inspector { display: none; }
}

@media (max-width: 760px) {
  .work-grid { grid-template-columns: 1fr !important; grid-auto-rows: auto; overflow: auto; }
  .sidebar { display: none; }
  .brand-mark { font-size: 15px; }
  .search-shell { display: none; }
}
