/* ==========================================================================
   Bauer Weather Service — clean light theme on the Bauer Media Audio palette.
   Purple type, mint waveforms, lavender surfaces. No Tailwind.
   Brand palette per the Bauer guidelines: primary / light / dark shades of
   Mint, Lavender, Peach, Lemon, Aqua, Taffy; purple as the standard font
   colour, black for longer texts, white on dark backgrounds.
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Poppins:ital,wght@0,400;0,500;0,600;0,700;1,400;1,600&family=Instrument+Sans:ital,wght@0,400..700;1,400..700&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
  /* ----- Bauer brand palette (verbatim from the brand sheet) ----- */
  --mint:           #1FD1BD;
  --mint-light:     #BEFAEB;
  --mint-dark:      #009392;
  --lavender:       #A096FF;
  --lavender-light: #E1DCFF;
  --lavender-dark:  #7D78E8;
  --peach:          #FF7D6A;
  --peach-light:    #FFD2D2;
  --peach-dark:     #D05C5D;
  --lemon:          #FFF050;
  --lemon-light:    #FFFFC8;
  --lemon-dark:     #F0A800;
  --aqua:           #5AF0FF;
  --aqua-light:     #C8FAFF;
  --aqua-dark:      #349CDC;
  --taffy:          #FF78C8;
  --taffy-light:    #FFD2EB;
  --taffy-dark:     #D54380;
  /* Bauer purple — sampled from the logo wordmark; adjust here if the
     official hex differs. Standard font colour per the guidelines. */
  --bauer-purple:       #4B14BE;
  --bauer-purple-deep:  #380E93;

  /* ----- Semantic tokens (names kept from the old theme) ----- */
  /* Canvas: white page, lavender-tinted surfaces */
  --bg-0: #ffffff;
  --bg-1: #faf9ff;
  --bg-2: #f3f1fd;
  --bg-3: #eae6fb;
  --surface-glass: rgba(255, 255, 255, 0.72);

  --border: #e5e1f5;
  --border-bright: #d4cdf0;
  --border-glow: #a096ff;

  --text: #17151f;          /* black-ish for longer texts */
  --text-muted: #5f5a75;
  --text-dim: #8b86a3;
  --text-ghost: #c6c1dc;

  /* Signature accent: Bauer purple — buttons, active states, highlights */
  --accent: var(--bauer-purple);
  --accent-bright: var(--lavender-dark);
  --accent-dim: #b9aaf0;
  --accent-glow: rgba(160, 150, 255, 0.22);

  /* Live-broadcast red — dark peach reads as on-air without leaving brand.
     --on-air-text is the AA-safe ink used for the live label/dot on the
     peach-light chip (peach-dark alone is only ~2.9:1 there). */
  --on-air: var(--peach-dark);
  --on-air-text: #A03030;
  --on-air-glow: rgba(255, 125, 106, 0.45);

  /* State colors legible on white. Brand lemon-dark (#F0A800) is a FILL
     shade (2:1 as text) — warning TEXT uses this darker gold instead. */
  --signal: var(--mint-dark);
  --signal-dim: #7bd6cb;
  --alert: #8a6200;
  --warn: #8a6200;
  --danger: var(--peach-dark);

  /* Aliases the Scheduler/Recipe/Ops sections reference */
  --bg: var(--bg-1);
  --muted: var(--text-muted);
  --muted-2: var(--text-dim);

  /* Typography — Poppins headings (geometric, close to the Bauer wordmark),
     Instrument Sans workhorse, mono reserved for tabular data */
  --font-display: 'Poppins', 'Avenir Next', system-ui, sans-serif;
  --font-ui: 'Instrument Sans', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', 'Menlo', monospace;

  /* Radii — rounded, friendly, matches the logo's soft bars */
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 16px;

  /* Motion */
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-snap: cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===== Reset & base ================================================= */

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg-0);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  overflow-x: hidden;
}

body {
  background:
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(160, 150, 255, 0.10), transparent 60%),
    radial-gradient(ellipse 60% 40% at 90% 100%, rgba(31, 209, 189, 0.07), transparent 70%),
    var(--bg-0);
  position: relative;
}

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

button { cursor: pointer; background: none; border: none; padding: 0; }
button:disabled { opacity: 0.35; cursor: not-allowed; }

/* Keyboard focus must be visible on the white canvas — the soft lavender
   halo alone (--accent-glow) is too faint. Mouse focus stays subtle. */
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.hidden { display: none !important; }

/* Feature flag: WEATHER_ONLY (ui/app.js) adds .weather-only to <body>.
   Anything marked .full-suite-only stays in the markup but disappears until
   the full traffic/surf/horoscope suite is switched back on. */
body.weather-only .full-suite-only { display: none !important; }

/* ===== Grain overlay: retired with the dark theme — kept as a no-op so
   the markup can stay while WEATHER_ONLY/full-suite flags flip around ==== */

.grain-overlay { display: none; }

/* ===== Header / console top ========================================= */

.console-header {
  position: relative;
  z-index: 10;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 18px 28px;
  padding: 18px 40px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-0);
}

.brand-mark { white-space: nowrap; }

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-logo {
  height: 40px;
  width: auto;
  flex: none;
}

.brand-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.brand-mark {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 21px;
  line-height: 1.15;
  letter-spacing: -0.01em;
  color: var(--bauer-purple);
}

.brand-mark em {
  font-style: normal;
  color: var(--mint-dark);
  font-weight: 600;
}

.brand-meta {
  font-family: var(--font-ui);
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

/* ON-AIR indicator */
.on-air {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px 6px 10px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.18em;
  color: var(--text-dim);
  transition: all 240ms var(--ease);
}

.on-air-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-ghost);
  transition: all 240ms var(--ease);
}

.on-air.live {
  border-color: var(--on-air);
  color: var(--on-air-text);
  background: var(--peach-light);
}

.on-air.live .on-air-dot {
  background: var(--on-air-text);
  box-shadow: 0 0 0 0 var(--on-air-glow);
  animation: onAirPulse 1.4s ease-in-out infinite;
}

@keyframes onAirPulse {
  0%, 100% { box-shadow: 0 0 0 0 var(--on-air-glow); }
  50%      { box-shadow: 0 0 0 7px transparent; }
}

/* ===== Buttons ======================================================= */

.btn-primary,
.btn-secondary,
.btn-ghost,
.btn-approve,
.btn-danger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-ui);
  font-weight: 500;
  font-size: 13px;
  letter-spacing: 0.01em;
  padding: 9px 16px;
  border-radius: var(--r-md);
  border: 1px solid transparent;
  transition: all 140ms var(--ease-snap);
  white-space: nowrap;
  line-height: 1;
}

/* Primary — Bauer purple, the signature action */
.btn-primary {
  background: var(--accent);
  color: #ffffff;
  font-weight: 600;
  box-shadow: 0 8px 20px -10px rgba(75, 20, 190, 0.45);
}
.btn-primary:hover:not(:disabled) {
  background: var(--bauer-purple-deep);
  transform: translateY(-1px);
  box-shadow: 0 12px 24px -10px rgba(75, 20, 190, 0.55);
}
.btn-primary:active { transform: translateY(0); }

/* Approve — the "send it to air" gesture, in brand mint */
.btn-approve {
  background: transparent;
  color: var(--mint-dark);
  border: 1px solid var(--signal-dim);
  font-weight: 600;
}
.btn-approve:hover:not(:disabled) {
  background: var(--mint-light);
  border-color: var(--mint-dark);
  color: var(--mint-dark);
}

/* Secondary — quiet, for retries and saves */
.btn-secondary {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border-bright);
}
.btn-secondary:hover:not(:disabled) {
  background: var(--bg-2);
  color: var(--text);
  border-color: var(--border-glow);
}

/* Ghost — text-only, for destructive/cancel */
.btn-ghost {
  color: var(--text-dim);
  padding: 9px 10px;
}
.btn-ghost:hover:not(:disabled) { color: var(--danger); }

.btn-danger {
  background: transparent;
  color: var(--danger);
  border: 1px solid rgba(208, 92, 93, 0.4);
}
.btn-danger:hover:not(:disabled) {
  background: var(--peach-light);
  border-color: var(--danger);
}

.btn-primary svg,
.btn-approve svg,
.btn-secondary svg { width: 14px; height: 14px; }

/* ===== Main layout =================================================== */

.console-grid {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 0;
  min-height: calc(100vh - 72px);
}

/* ===== Rundown (history panel) ======================================= */

.rundown {
  border-right: 1px solid var(--border);
  padding: 28px 24px 40px;
  background: var(--bg-1);
}

.rundown-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 1px dashed var(--border);
}

.rundown-title {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent);
}


.rundown-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.rundown-item {
  position: relative;
  display: block;
  width: 100%;
  text-align: left;
  padding: 14px 16px 14px 20px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--bg-1);
  transition: all 180ms var(--ease);
  cursor: pointer;
  opacity: 0;
  animation: rundownIn 420ms var(--ease) forwards;
}

@keyframes rundownIn {
  from { opacity: 0; transform: translateX(-8px); }
  to   { opacity: 1; transform: translateX(0); }
}

.rundown-item:hover {
  border-color: var(--border-glow);
  background: var(--bg-2);
}

.rundown-item.is-selected {
  border-color: var(--accent-dim);
  background: linear-gradient(90deg, rgba(160, 150, 255, 0.14), transparent 60%);
}

.rundown-item.is-selected::before {
  content: "";
  position: absolute;
  left: 0;
  top: 10%;
  bottom: 10%;
  width: 3px;
  border-radius: 2px;
  background: var(--accent);
}

.rundown-item-top {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.kind-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  stroke: var(--text-muted);
  stroke-width: 1.5;
  fill: none;
}

.kind-label {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.state-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-ghost);
  flex-shrink: 0;
}
.state-dot.is-pending { background: var(--accent); animation: dotPulse 1.2s ease-in-out infinite; }
.state-dot.is-review  { background: var(--alert); }
.state-dot.is-done    { background: var(--signal); }
.state-dot.is-fail    { background: var(--danger); }
.state-dot.is-cancel  { background: var(--text-dim); }

@keyframes dotPulse {
  0%, 100% { opacity: 0.4; transform: scale(0.9); }
  50%      { opacity: 1;   transform: scale(1.2); }
}

.state-label {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.rundown-item-time {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
  color: var(--text-dim);
}

.rundown-item-title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 14px;
  color: var(--text);
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-bottom: 4px;
}

.rundown-item-excerpt {
  font-size: 11px;
  color: var(--text-dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-style: italic;
}

.rundown-empty {
  font-size: 12px;
  color: var(--text-dim);
  font-style: italic;
  text-align: center;
  padding: 40px 20px;
  border: 1px dashed var(--border);
  border-radius: var(--r-md);
  line-height: 1.7;
}

/* ===== Console (detail panel) ======================================== */

.console {
  padding: 40px 56px 80px;
  min-width: 0;
}

/* Empty state: hero treatment */
.console-empty {
  padding-top: 80px;
  max-width: 640px;
  margin: 0 auto;
  text-align: center;
}

.console-empty-kicker {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.3em;
  color: var(--accent);
  margin-bottom: 24px;
}

.console-empty-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 54px;
  line-height: 1.05;
  letter-spacing: -0.025em;
  margin: 0 0 20px;
  color: var(--bauer-purple);
}

.console-empty-title em {
  font-style: normal;
  color: var(--mint-dark);
  font-weight: 600;
}

.console-empty-desc {
  font-size: 15px;
  color: var(--text-muted);
  line-height: 1.65;
  max-width: 480px;
  margin: 0 auto 48px;
}

.pipeline-diagram {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  margin: 48px 0 0;
}

.pipeline-diagram-step {
  padding: 14px 28px;
  border: 1px solid var(--border-bright);
  border-radius: var(--r-md);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.2em;
  color: var(--text-muted);
  background: var(--bg-1);
}

.pipeline-diagram-arrow {
  width: 42px;
  height: 1px;
  background: linear-gradient(90deg, var(--border-bright), var(--accent-dim), var(--border-bright));
  position: relative;
}

.pipeline-diagram-arrow::after {
  content: "";
  position: absolute;
  right: -4px;
  top: -3px;
  width: 7px;
  height: 7px;
  border-right: 1px solid var(--accent-dim);
  border-top: 1px solid var(--accent-dim);
  transform: rotate(45deg);
}

/* ===== Detail — bulletin view ======================================== */

.detail-head {
  display: flex;
  align-items: center;
  gap: 14px;
  padding-bottom: 20px;
  margin-bottom: 0;
  border-bottom: 1px solid var(--border);
}

.detail-kind {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border: 1px solid var(--border-bright);
  border-radius: var(--r-sm);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text);
}

.detail-kind .kind-icon {
  stroke: var(--accent);
  width: 14px;
  height: 14px;
}

.detail-state {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.detail-meta {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.06em;
}

.detail-summary {
  margin-top: 14px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0.04em;
}

.detail-error {
  margin-top: 12px;
  padding: 10px 14px;
  border: 1px solid rgba(208, 92, 93, 0.35);
  background: rgba(208, 92, 93, 0.06);
  border-radius: var(--r-md);
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--danger);
  letter-spacing: 0.02em;
}

/* ===== Data-source attribution ======================================= */

/* Under the country selector: "Data source · IPMA" */
.data-source-row {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--bg-2);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  align-self: flex-start;
}
.data-source-row.hidden { display: none; }
.data-source-label { color: var(--text-dim); }
.data-source-value { color: var(--accent); }

/* Under the detail header: one chip per unique source in the response. */
.detail-sources {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}
.detail-sources.hidden { display: none; }
.detail-sources-label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
  align-self: center;
  margin-right: 4px;
}
.detail-source-chip {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border: 1px solid var(--border-bright);
  border-radius: 999px;
  background: var(--bg-2);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  color: var(--accent);
}
/* Data-provenance warning state: stale / cached / fallback sources. */
.detail-source-chip.is-warn {
  color: var(--danger);
  border-color: var(--danger);
}

/* ===== Pipeline with rail ============================================ */

.pipeline {
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: 0;
  padding-top: 32px;
}

.rail {
  position: relative;
  padding-top: 16px;
}

.rail-line {
  position: absolute;
  left: 50%;
  top: 16px;
  bottom: 16px;
  width: 1px;
  background: linear-gradient(180deg, var(--border), var(--border-bright) 20%, var(--border-bright) 80%, var(--border));
  transform: translateX(-50%);
}

.rail-node {
  position: relative;
  width: 14px;
  height: 14px;
  margin: 0 auto;
  border-radius: 50%;
  background: var(--bg-0);
  border: 1px solid var(--border-bright);
  transition: all 240ms var(--ease);
}

.rail-node[data-step="text"]      { margin-top: 28px; }
.rail-node[data-step="voice"]     { margin-top: calc(50vh * 0 + 280px); }
.rail-node[data-step="published"] { margin-top: 280px; }

.rail-node.is-done {
  background: var(--signal);
  border-color: var(--signal);
  box-shadow: 0 0 12px rgba(31, 209, 189, 0.4);
}

.rail-node.is-active {
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-glow), 0 0 16px rgba(75, 20, 190, 0.35);
  animation: nodeActive 1.8s ease-in-out infinite;
}

@keyframes nodeActive {
  0%, 100% { box-shadow: 0 0 0 4px var(--accent-glow), 0 0 16px rgba(75, 20, 190, 0.35); }
  50%      { box-shadow: 0 0 0 8px transparent, 0 0 20px rgba(75, 20, 190, 0.45); }
}

.rail-node.is-fail {
  background: var(--danger);
  border-color: var(--danger);
}

/* The "signal" dot that runs down the rail */
.rail-signal {
  position: absolute;
  left: 50%;
  width: 4px;
  height: 4px;
  margin-left: -2px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent), 0 0 16px var(--accent-dim);
  opacity: 0;
  pointer-events: none;
  animation: signalTravel 2.2s var(--ease) infinite;
}

.pipeline.has-active-signal .rail-signal {
  opacity: 1;
}

@keyframes signalTravel {
  0%   { top: 16px; opacity: 0; }
  15%  { opacity: 1; }
  85%  { opacity: 1; }
  100% { top: calc(100% - 16px); opacity: 0; }
}

.pipeline-steps {
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding-left: 24px;
}

/* ===== Step cards ==================================================== */

.step {
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--bg-1);
  overflow: hidden;
  transition: border-color 240ms var(--ease);
}

.step.is-active {
  border-color: var(--accent-dim);
  box-shadow: 0 0 0 1px rgba(160, 150, 255, 0.15), 0 20px 60px -30px rgba(75, 20, 190, 0.18);
}

.step-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 22px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, var(--bg-2), transparent);
}

.step-title {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent);
}

.step-title-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border: 1px solid var(--accent-dim);
  border-radius: 50%;
  font-size: 9px;
  color: var(--accent);
  background: rgba(160, 150, 255, 0.12);
}

.step-meta {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-dim);
  letter-spacing: 0.08em;
  font-variant-numeric: tabular-nums;
}

.step-body {
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.step-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.step-actions .spacer { flex: 1; }

/* ===== Text editor (the draft) ======================================= */

.draft-editor {
  width: 100%;
  min-height: 240px;
  padding: 24px 28px;
  background: var(--bg-0);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  font-family: var(--font-ui);
  font-weight: 400;
  font-size: 15.5px;
  line-height: 1.7;
  color: var(--text);
  resize: vertical;
  outline: none;
  transition: border-color 140ms var(--ease);
}

.draft-editor:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.draft-editor::selection {
  background: var(--accent);
  color: var(--bg-0);
}

.draft-editor[readonly] {
  color: var(--text-muted);
  cursor: default;
  background: var(--bg-1);
}

.draft-editor[readonly]:focus {
  border-color: var(--border);
  box-shadow: none;
}

/* ===== AI disclaimer toggle ========================================= */

.disclaimer-toggle {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 10px;
  padding: 8px 12px;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
}
.disclaimer-toggle.hidden { display: none; }
.disclaimer-missing-hint {
  font-family: var(--font-ui);
  font-size: 11px;
  color: var(--warn);
  line-height: 1.35;
  flex: 1 1 auto;
  min-width: 0;
}
.disclaimer-missing-hint.hidden { display: none; }
.disclaimer-missing-hint code {
  font-family: var(--font-mono, monospace);
  font-size: 10.5px;
  background: rgba(23, 15, 60, 0.05);
  padding: 1px 4px;
  border-radius: 3px;
}
.disclaimer-toggle-label {
  font-family: var(--font-ui);
  font-size: 12px;
  letter-spacing: 0.05em;
  color: var(--text-dim);
}
.disclaimer-toggle-group {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  overflow: hidden;
}
.disclaimer-opt {
  appearance: none;
  background: transparent;
  border: 0;
  color: var(--text-dim);
  padding: 6px 14px;
  font-family: var(--font-ui);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}
.disclaimer-opt + .disclaimer-opt { border-left: 1px solid var(--border); }
.disclaimer-opt:hover { color: var(--text); }
.disclaimer-opt[aria-pressed="true"] {
  background: var(--accent-dim);
  color: var(--text);
}

/* ===== Audio post-processing tweaks (speed + silence trim) ========== */

.audio-tweaks {
  margin-top: 14px;
  padding: 14px 16px 12px;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.audio-tweaks.hidden { display: none; }
.audio-tweaks-row {
  display: grid;
  grid-template-columns: 130px 1fr;
  align-items: center;
  gap: 16px;
}
.audio-tweaks-label {
  font-family: var(--font-ui);
  font-size: 12px;
  letter-spacing: 0.05em;
  color: var(--text-dim);
}
.audio-tweaks-slider {
  padding: 10px 12px 8px;
}
.audio-tweaks.is-busy { opacity: 0.55; pointer-events: none; }
.audio-tweaks-caption {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-dim);
  text-align: right;
}

/* ===== Refine prompt panel ========================================== */

.refine-panel {
  margin-top: 14px;
  padding: 16px 18px;
  background: var(--bg-1);
  border: 1px solid var(--accent-dim);
  border-radius: var(--r-md);
  box-shadow: 0 0 0 3px var(--accent-glow) inset;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.refine-label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.refine-editor {
  width: 100%;
  min-height: 72px;
  padding: 12px 14px;
  background: var(--bg-0);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
  resize: vertical;
  outline: none;
  transition: border-color 140ms var(--ease);
}

.refine-editor:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.refine-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.refine-actions .spacer { flex: 1; }

/* Locked state: greys the step chrome, shows "LOCKED" chip in the header */
.step.is-locked .step-title { color: var(--text-dim); }
.step.is-locked .step-title-num {
  border-color: var(--border-bright);
  color: var(--text-dim);
  background: var(--bg-2);
}

.step.is-locked .step-head::after {
  content: "LOCKED";
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  margin-left: 14px;
  border: 1px solid var(--border-bright);
  border-radius: var(--r-sm);
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.22em;
  color: var(--text-muted);
  background: var(--bg-2);
}

/* When generating: show scanning bars instead of editor */
.draft-loading {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 28px;
  background: var(--bg-0);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  min-height: 240px;
  justify-content: center;
}

.draft-loading-bar {
  height: 14px;
  background: linear-gradient(90deg, var(--bg-2) 0%, var(--bg-3) 50%, var(--bg-2) 100%);
  background-size: 200% 100%;
  border-radius: 2px;
  animation: shimmer 1.4s linear infinite;
}

.draft-loading-bar:nth-child(1) { width: 94%; }
.draft-loading-bar:nth-child(2) { width: 88%; animation-delay: 0.15s; }
.draft-loading-bar:nth-child(3) { width: 96%; animation-delay: 0.3s; }
.draft-loading-bar:nth-child(4) { width: 72%; animation-delay: 0.45s; }
.draft-loading-bar:nth-child(5) { width: 84%; animation-delay: 0.6s; }

@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ===== Custom audio player (the hero) ================================ */

.player {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 22px;
  padding: 22px 24px;
  background: var(--bg-0);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  align-items: center;
}

.player-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border: none;
  background: var(--accent);
  border-radius: 50%;
  color: #ffffff;
  box-shadow: 0 8px 20px -10px rgba(75, 20, 190, 0.5);
  transition: all 140ms var(--ease-snap);
  position: relative;
}

.player-btn::before {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 1px solid transparent;
  transition: border-color 240ms var(--ease);
}

.player-btn:hover {
  background: var(--bauer-purple-deep);
  color: #ffffff;
}
.player-btn:hover::before { border-color: var(--accent-dim); }

.player-btn svg { width: 20px; height: 20px; fill: currentColor; }

.player-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}

.waveform {
  position: relative;
  height: 76px;
  width: 100%;
  cursor: pointer;
  display: flex;
  align-items: center;
  padding: 0 2px;
}

.waveform canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.waveform-times {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.08em;
}

.waveform-times .elapsed { color: var(--accent); }

/* Synthesis loading: oscilloscope-style sine */
.player.is-loading .waveform {
  overflow: hidden;
}
.player.is-loading .waveform::after {
  content: "SYNTHESISING";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.3em;
  color: var(--accent);
  animation: flicker 2s ease-in-out infinite;
}

@keyframes flicker {
  0%, 100% { opacity: 0.4; }
  50%      { opacity: 1; }
}

/* ===== Published step ================================================ */

.step.is-published {
  border-color: var(--signal-dim);
  background: linear-gradient(180deg, rgba(31, 209, 189, 0.07), var(--bg-1));
}

.step.is-published .step-head {
  border-bottom-color: var(--signal-dim);
}

.step.is-published .step-title {
  color: var(--signal);
}

.step.is-published .step-title-num {
  border-color: var(--signal-dim);
  color: var(--signal);
  background: rgba(31, 209, 189, 0.10);
}

.published-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.published-row {
  display: grid;
  grid-template-columns: 90px 1fr;
  gap: 16px;
  align-items: baseline;
  padding: 10px 0;
  border-bottom: 1px dashed var(--border);
}
.published-row:last-child { border-bottom: none; }

.published-label {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.published-value {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text);
  word-break: break-all;
  letter-spacing: 0.02em;
}

.published-audio {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.published-audio .published-value { flex: 1 1 auto; min-width: 0; }
.published-download { flex: 0 0 auto; }

.published-seal {
  position: absolute;
  top: 14px;
  right: 22px;
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: 10px;
  letter-spacing: 0.18em;
  color: var(--mint-dark);
  text-transform: uppercase;
  padding: 4px 12px;
  background: var(--mint-light);
  border: 1px solid var(--signal-dim);
  border-radius: 999px;
}

.step.is-published .step-head { position: relative; }

/* ===== Status line =================================================== */

.status-line {
  margin-top: 24px;
  padding: 12px 16px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  color: var(--text-dim);
  text-transform: uppercase;
  border-top: 1px dashed var(--border);
  min-height: 2em;
}

.status-line::before { content: "› "; color: var(--accent); }
.status-line.is-error { color: var(--danger); }
.status-line.is-error::before { color: var(--danger); }

/* ===== Modal ========================================================= */

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(23, 17, 47, 0.45);
  backdrop-filter: blur(10px);
  animation: fadeIn 200ms var(--ease);
}

.modal-wrap {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 80px 24px 320px;   /* extra bottom space so the voice dropdown
                                  (opens downward) can scroll into view */
  overflow-y: auto;
}

.modal {
  width: 100%;
  max-width: 560px;
  background: var(--bg-1);
  border: 1px solid var(--border-bright);
  border-radius: var(--r-lg);
  box-shadow: 0 30px 80px rgba(23, 15, 60, 0.25), 0 0 0 1px rgba(160, 150, 255, 0.12);
  animation: modalIn 260ms var(--ease);
  /* NOTE: no overflow:hidden — otherwise the absolutely-positioned flag
     dropdown menus get clipped at the modal boundary. Children that need
     to honour the rounded corners carry their own border-radius. */
  position: relative;
}

.modal::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes modalIn {
  from { opacity: 0; transform: translateY(-12px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 26px;
  border-bottom: 1px solid var(--border);
}

.modal-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 19px;
  letter-spacing: -0.01em;
  margin: 0;
  color: var(--bauer-purple);
}

.modal-title em { font-style: normal; color: var(--mint-dark); }

.modal-close {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
  font-size: 22px;
  line-height: 1;
  border-radius: var(--r-sm);
  transition: all 140ms var(--ease);
}
.modal-close:hover { color: var(--text); background: var(--bg-2); }

.modal-body {
  padding: 26px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.modal-foot {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 26px;
  border-top: 1px solid var(--border);
  background: var(--bg-0);
  border-radius: 0 0 var(--r-lg) var(--r-lg);
}

.modal-head {
  border-radius: var(--r-lg) var(--r-lg) 0 0;
}

/* The amber hairline that used to sit at top:0 of .modal must follow the
   rounded corner now that the modal no longer clips overflow. */
.modal::before { border-radius: var(--r-lg) var(--r-lg) 0 0; }

.modal-foot .spacer { flex: 1; }

/* ===== Form ========================================================== */

.form-label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.form-label-hint {
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.01em;
  text-transform: none;
  color: var(--text-ghost);
  margin-left: 6px;
  font-style: italic;
}

.form-check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  background: var(--bg-0);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  cursor: pointer;
  transition: border-color 0.15s, background-color 0.15s;
}
.form-check:hover {
  border-color: var(--accent);
}
.form-check input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.form-check-dot {
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  border: 1.5px solid var(--border);
  border-radius: 4px;
  background: transparent;
  position: relative;
  margin-top: 2px;
  transition: border-color 0.15s, background-color 0.15s;
}
.form-check input:checked + .form-check-dot {
  border-color: var(--accent);
  background: var(--accent);
}
.form-check input:checked + .form-check-dot::after {
  content: "";
  position: absolute;
  left: 4px;
  top: 1px;
  width: 4px;
  height: 8px;
  border: solid var(--bg-0);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.form-check-label {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  font-family: var(--font-ui);
  font-size: 12px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text);
}
.form-check-icon {
  width: 14px;
  height: 14px;
  fill: currentColor;
}

.form-input,
.form-select {
  padding: 11px 14px;
  background: var(--bg-0);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.01em;
  transition: all 140ms var(--ease);
  outline: none;
  width: 100%;
}

.form-input:focus,
.form-select:focus {
  border-color: var(--accent-dim);
  box-shadow: 0 0 0 3px var(--accent-glow);
  background: var(--bg-1);
}

.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path d='M1 1l5 5 5-5' stroke='%235f5a75' stroke-width='1.5' fill='none' stroke-linecap='round'/></svg>");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

/* Flag dropdown (custom, so we can render inline SVG flags) */
.select-flag {
  position: relative;
  width: 100%;
}

.select-flag-trigger {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-0);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text);
  text-align: left;
  transition: all 140ms var(--ease);
}

.select-flag-trigger:hover { border-color: var(--border-glow); }

.select-flag.is-open .select-flag-trigger {
  border-color: var(--accent-dim);
  box-shadow: 0 0 0 3px var(--accent-glow);
  background: var(--bg-1);
}

.select-flag-current {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.select-flag-current .flag {
  width: 22px;
  height: 15px;
  border-radius: 2px;
  flex-shrink: 0;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.12);
}

/* Song row: preview play button on the right of each option.
   The outer option stays clickable; the play button stops propagation so
   sampling doesn't also select the song. */
.song-select .select-flag-current .song-icon,
.select-flag-option .song-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  flex-shrink: 0;
  background: rgba(160, 150, 255, 0.15);
  border: 1px solid var(--border-bright);
  color: var(--accent);
}
.song-icon svg { width: 11px; height: 11px; }

.song-preview {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid var(--border-bright);
  color: var(--text-muted);
  background: var(--bg-1);
  transition: all 140ms var(--ease);
  flex-shrink: 0;
}
.song-preview:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(160, 150, 255, 0.18);
}
.song-preview.is-playing {
  border-color: var(--accent);
  color: var(--bg-0);
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.song-preview svg { width: 11px; height: 11px; fill: currentColor; }

.song-preview.is-pending {
  border-color: var(--accent-dim);
  color: var(--accent);
  background: transparent;
}
.song-preview.is-pending svg { display: none; }
.song-preview.is-pending::after {
  content: "";
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 1.5px solid var(--accent-dim);
  border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Voice dropdown: language tag sits between the name and the preview button */
.voice-lang,
.voice-lang-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px 3px 6px;
  margin-left: auto;
  border: 1px solid var(--border-bright);
  background: var(--bg-0);
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.voice-lang .flag,
.voice-lang-tag .flag {
  width: 14px;
  height: 10px;
  border-radius: 1px;
  flex-shrink: 0;
}

.select-flag-option.is-voice {
  gap: 10px;
}

.select-flag-option.is-voice .song-name {
  flex: 0 1 auto;
  max-width: 120px;
}

.select-flag-option.is-voice .voice-lang-tag {
  margin-left: 0;
}

.select-flag-option.is-voice .song-preview {
  margin-left: auto;
}

/* Current-value area keeps the lang tag compact on the trigger */
.select-flag-current .voice-lang {
  margin-left: auto;
}

/* Song option: name on the left, preview button on the right */
.select-flag-option.is-song {
  gap: 10px;
}
.select-flag-option.is-song .song-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Gender badge — a small circular chip with the male/female glyph.
   Uses amber for male and a soft rose for female, scaled to the palette. */
.gender-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  flex-shrink: 0;
  border: 1px solid transparent;
}

.gender-badge svg { width: 13px; height: 13px; }

.gender-badge.is-male {
  background: var(--aqua-light);
  border-color: rgba(52, 156, 220, 0.45);
  color: var(--aqua-dark);
}

.gender-badge.is-female {
  background: var(--taffy-light);
  border-color: rgba(213, 67, 128, 0.35);
  color: var(--taffy-dark);
}

.select-flag-chev {
  width: 12px;
  height: 8px;
  color: var(--text-dim);
  flex-shrink: 0;
  transition: transform 180ms var(--ease);
}

.select-flag.is-open .select-flag-chev { transform: rotate(180deg); }

.select-flag-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 60;
  background: var(--bg-2);
  border: 1px solid var(--border-bright);
  border-radius: var(--r-md);
  box-shadow: 0 20px 48px -16px rgba(23, 15, 60, 0.22);
  padding: 4px;
  display: none;
  animation: modalIn 160ms var(--ease);
}

.select-flag.is-open .select-flag-menu { display: block; }

.select-flag-option {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 9px 10px;
  border-radius: var(--r-sm);
  background: transparent;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text);
  text-align: left;
  transition: background 120ms var(--ease);
}

.select-flag-option:hover { background: var(--bg-3); }

.select-flag-option.is-selected {
  background: rgba(160, 150, 255, 0.15);
  color: var(--accent);
}

.select-flag-option .flag {
  width: 22px;
  height: 15px;
  border-radius: 2px;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.12);
}

.select-flag-option-sub {
  margin-left: auto;
  font-size: 10px;
  color: var(--text-dim);
  letter-spacing: 0.1em;
}

/* Slider — horizontal range input with amber fill and tick labels */
.slider {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 14px 10px;
  background: var(--bg-0);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
}

.slider-input {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 24px;
  background: transparent;
  outline: none;
  cursor: pointer;
  margin: 0;
}

/* WebKit track + thumb */
.slider-input::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 2px;
  background: linear-gradient(
    to right,
    var(--accent) 0%,
    var(--accent) var(--slider-pct, 20%),
    var(--bg-3) var(--slider-pct, 20%),
    var(--bg-3) 100%
  );
}
.slider-input::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  margin-top: -7px;
  border-radius: 50%;
  background: var(--accent);
  border: 3px solid var(--bg-0);
  box-shadow: 0 0 0 1px var(--accent-dim), 0 4px 10px -2px rgba(75, 20, 190, 0.35);
  cursor: grab;
  transition: transform 120ms var(--ease);
}
.slider-input:active::-webkit-slider-thumb { transform: scale(1.15); }

/* Firefox */
.slider-input::-moz-range-track {
  height: 4px;
  border-radius: 2px;
  background: var(--bg-3);
}
.slider-input::-moz-range-progress {
  height: 4px;
  border-radius: 2px;
  background: var(--accent);
}
.slider-input::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  border: 3px solid var(--bg-0);
  box-shadow: 0 0 0 1px var(--accent-dim), 0 4px 10px -2px rgba(75, 20, 190, 0.35);
  cursor: grab;
}

.slider-input:focus::-webkit-slider-thumb { box-shadow: 0 0 0 3px var(--accent-glow), 0 0 0 1px var(--accent-dim); }
.slider-input:focus::-moz-range-thumb     { box-shadow: 0 0 0 3px var(--accent-glow), 0 0 0 1px var(--accent-dim); }

.slider-ticks {
  position: relative;
  height: 12px;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-dim);
}
.slider-ticks > span {
  position: absolute;
  top: 0;
  transform: translateX(-50%);
  white-space: nowrap;
}
.slider-ticks > .tick-first { left: 0; transform: none; }
.slider-ticks > .tick-last  { right: 0; left: auto; transform: none; }

/* Region chips: multi-select pills */
.chip-select {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px;
  background: var(--bg-0);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  min-height: 44px;
  align-content: flex-start;
}

/* Geo block in the Traffic modal greyed-out when curated events are on. */
.field-geo.is-locked {
  opacity: 0.45;
  pointer-events: none;
  filter: grayscale(0.6);
  position: relative;
}
.field-geo.is-locked::after {
  content: "Overridden by curated events";
  position: absolute;
  right: 6px;
  top: 6px;
  padding: 3px 8px;
  border-radius: 10px;
  background: var(--accent-glow);
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  pointer-events: none;
}

.chip {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  border: 1px solid var(--border-bright);
  border-radius: 999px;
  background: var(--bg-1);
  color: var(--text-muted);
  font-family: var(--font-ui);
  font-size: 12px;
  letter-spacing: 0.01em;
  transition: all 140ms var(--ease);
  cursor: pointer;
}

.chip:hover {
  border-color: var(--border-glow);
  color: var(--text);
}

.chip.is-selected {
  border-color: var(--accent-dim);
  background: rgba(160, 150, 255, 0.18);
  color: var(--accent);
}

.chip.is-selected::before {
  content: "✓";
  margin-right: 6px;
  font-size: 10px;
}

/* Option cards: vertically-stacked radio group with label + description,
   used by the weather format controls (Temperature detail / Order). */
.option-card-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 6px;
  background: var(--bg-0);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
}

.option-card {
  display: grid;
  grid-template-columns: 16px 1fr;
  gap: 10px;
  align-items: start;
  padding: 10px 12px;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--r-sm, 6px);
  color: var(--text-muted);
  font-family: var(--font-ui);
  cursor: pointer;
  transition: all 140ms var(--ease);
  text-align: left;
}

.option-card:hover {
  border-color: var(--border-glow);
  color: var(--text);
}

.option-card.is-selected {
  border-color: var(--accent-dim);
  background: rgba(160, 150, 255, 0.15);
  color: var(--text);
}

.option-card-radio {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid var(--border-bright);
  margin-top: 3px;
  background: var(--bg-0);
  transition: all 140ms var(--ease);
}

.option-card.is-selected .option-card-radio {
  border-color: var(--accent);
  background: radial-gradient(circle at center, var(--accent) 0 40%, var(--bg-0) 45%);
  box-shadow: 0 0 0 2px var(--accent-glow);
}

.option-card-body {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.option-card-title {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: inherit;
}

.option-card.is-selected .option-card-title {
  color: var(--accent);
}

.option-card-desc {
  font-size: 11px;
  line-height: 1.4;
  color: var(--text-dim);
}

/* Kind selector — tabs */
.kind-tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  padding: 4px;
  background: var(--bg-0);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
}

.kind-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 14px 8px;
  border-radius: var(--r-sm);
  transition: all 160ms var(--ease);
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.kind-tab svg {
  width: 18px;
  height: 18px;
  stroke: var(--text-dim);
  stroke-width: 1.5;
  fill: none;
  transition: all 160ms var(--ease);
}

.kind-tab:hover {
  color: var(--text);
  background: var(--bg-2);
}
.kind-tab:hover svg { stroke: var(--text); }

.kind-tab.is-active {
  background: rgba(160, 150, 255, 0.18);
  color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent-dim);
}

.kind-tab.is-active svg { stroke: var(--accent); }

.kind-tab.is-disabled,
.kind-tab:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  pointer-events: none;
}
.kind-tab.is-disabled::after,
.kind-tab:disabled::after {
  content: "soon";
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  margin-left: 6px;
  opacity: 0.7;
}

/* ===== Scrollbar ===================================================== */

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--border-bright);
  border: 2px solid var(--bg-0);
  border-radius: 6px;
}
::-webkit-scrollbar-thumb:hover { background: var(--border-glow); }

/* ===== Top-nav (Studio / Curation) ==================================== */

.top-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-1);
}

.top-nav-tab {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 18px;
  border-radius: 999px;
  font-family: var(--font-ui);
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--text-muted);
  transition: color 140ms var(--ease), background 140ms var(--ease);
}
.top-nav-tab:hover { color: var(--bauer-purple); }
.top-nav-tab.is-active {
  color: #ffffff;
  background: var(--accent);
}

.top-nav-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--accent);
  color: #ffffff;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0;
}
.top-nav-badge[hidden] { display: none; }

/* ===== Curation view ================================================== */

.curation-view {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 0;
  min-height: calc(100vh - 72px);
}

.curation-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr);
  gap: 40px;
  align-items: end;
  padding: 44px 40px 28px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(23, 15, 60, 0.04), transparent 70%);
}

.curation-kicker {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 12px;
}

.curation-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 44px;
  line-height: 1.08;
  margin: 0 0 12px;
  color: var(--bauer-purple);
  letter-spacing: -0.02em;
}
.curation-title em {
  font-style: normal;
  color: var(--mint-dark);
  font-weight: 600;
}

.curation-desc {
  margin: 0;
  color: var(--text-muted);
  font-size: 15px;
  max-width: 56ch;
}

.curation-head-controls {
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.curation-head-actions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 16px;
}
.curation-auto { margin: 0; }
.curation-auto.is-live .form-check-dot {
  animation: cur-pulse 1.4s var(--ease) infinite;
}
@keyframes cur-pulse {
  0%, 100% { box-shadow: 0 0 0 0 var(--accent-glow); }
  50% { box-shadow: 0 0 0 6px transparent; }
}

.curation-body {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 0;
  min-height: 0;
}

.curation-sidebar {
  padding: 28px 24px 40px;
  border-right: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(23, 15, 60, 0.03), transparent 240px);
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.curation-meta {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 18px 16px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface-glass);
}
.curation-meta-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  font-family: var(--font-mono);
  font-size: 11px;
}
.curation-meta-label {
  color: var(--text-muted);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-size: 9px;
}
.curation-meta-value {
  color: var(--text);
  text-align: right;
}

.curation-saved {
  border: 1px dashed var(--border);
  border-radius: var(--r-md);
  padding: 16px;
  background: rgba(23, 15, 60, 0.03);
}
.curation-saved-head {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 10px;
}
.curation-saved-body {
  font-size: 12.5px;
  color: var(--text-muted);
  line-height: 1.5;
}
.curation-saved-empty { margin: 0; color: var(--text-dim); font-style: italic; }
.curation-saved-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.curation-saved-item {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text);
}
.curation-saved-item-road { color: var(--accent); }

.curation-main {
  padding: 28px 40px 60px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-width: 0;
}

.curation-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 14px;
  border-bottom: 1px dashed var(--border);
  gap: 20px;
}
.curation-toolbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
}
.curation-selected-count {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0.08em;
}
.curation-selected-count.has-selection { color: var(--accent); }

.curation-empty {
  margin: 60px 0;
  text-align: center;
  color: var(--text-dim);
  font-size: 14px;
  font-style: italic;
}

.curation-timeline {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.curation-day-header {
  position: sticky;
  top: 0;
  z-index: 3;
  padding: 14px 0 10px;
  margin: 24px 0 10px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, var(--bg-0) 60%, transparent);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--accent);
}
.curation-day-header:first-child { margin-top: 0; }

.curation-event {
  position: relative;
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 18px;
  padding: 16px 18px;
  margin-bottom: 10px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface-glass);
  transition: border-color 140ms var(--ease), background 140ms var(--ease);
}
.curation-event:hover { border-color: var(--border-bright); }
.curation-event.is-selected {
  border-color: var(--accent-dim);
  background: linear-gradient(180deg, var(--accent-glow), transparent 120%);
  box-shadow: inset 0 0 0 1px var(--accent-dim);
}
.curation-event::before {
  content: "";
  position: absolute;
  left: -1px;
  top: 20px;
  bottom: 20px;
  width: 3px;
  border-radius: 2px;
  background: var(--border);
}
.curation-event.sev-1::before { background: var(--signal-dim); }
.curation-event.sev-2::before { background: var(--alert); }
.curation-event.sev-3::before { background: var(--on-air); box-shadow: 0 0 8px var(--on-air-glow); }

.curation-event-rail {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding-top: 4px;
}
.curation-event-time {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.04em;
  text-align: center;
}
.curation-event-time-rel {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--text-dim);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-top: -4px;
}

.curation-check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border: 1.5px solid var(--border-bright);
  border-radius: 4px;
  background: var(--bg-1);
  cursor: pointer;
  transition: all 140ms var(--ease);
}
.curation-event.is-selected .curation-check {
  border-color: var(--accent);
  background: var(--accent);
}
.curation-event.is-selected .curation-check::after {
  content: "";
  width: 10px;
  height: 5px;
  border-left: 2px solid #ffffff;
  border-bottom: 2px solid #ffffff;
  transform: translate(0, -2px) rotate(-45deg);
}

.curation-event-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}

.curation-event-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}

/* Drag handle in the card head. Cursor changes so the affordance is obvious. */
.curation-drag-handle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  color: var(--text-dim);
  cursor: grab;
  border-radius: 3px;
  transition: color 140ms var(--ease), background 140ms var(--ease);
  align-self: center;
  flex-shrink: 0;
  user-select: none;
}
.curation-drag-handle:hover { color: var(--accent); background: var(--accent-glow); }
.curation-drag-handle:active { cursor: grabbing; }

/* Make the card header non-selectable so a click-and-hold starts a drag
   instead of a text selection (Chrome/macOS eats the dragstart otherwise).
   Signal rows keep text-selection on so editors can copy headlines. */
.curation-event {
  user-select: none;
  -webkit-user-drag: element;
}
.curation-signals, .curation-event-body .wa-msg {
  user-select: text;
  -webkit-user-drag: none;
}

/* Dragging state — the grabbed card fades slightly; the body dims other UI. */
.curation-event.is-dragging { opacity: 0.55; }
body.is-cur-dragging .curation-event:not(.is-dragging) {
  transition: border-color 140ms var(--ease);
}
/* Drop target highlight — amber ring + faint glow. Only applies when some
   other card is mid-drag (the `is-cur-dragging` gate on body ensures we
   don't paint a ring when the user just mouses over normally). */
body.is-cur-dragging .curation-event.is-drop-target {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-glow), 0 12px 28px -10px rgba(75, 20, 190, 0.25);
}

/* Merged-event badge in the card head. */
.curation-event-merged-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 10px;
  background: var(--accent-glow);
  color: var(--accent);
  border: 1px solid var(--accent-dim);
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: help;
}
.curation-event.is-merged {
  /* Tint merged cards so editors can spot them at a glance. */
  background: linear-gradient(180deg, rgba(160, 150, 255, 0.12), var(--surface-glass));
}
.curation-event-road {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.05em;
}
.curation-event-headline {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 400;
  color: var(--text);
  line-height: 1.25;
}
.curation-event-location {
  font-size: 12.5px;
  color: var(--text-muted);
}

.curation-source-badges {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.curation-source-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 10px;
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  border: 1px solid var(--border-bright);
  color: var(--text-muted);
  background: var(--bg-2);
}
.curation-source-badge[data-source="inrix"] {
  color: var(--lavender-dark);
  border-color: rgba(160, 150, 255, 0.5);
  background: var(--lavender-light);
}
.curation-source-badge[data-source="pt-traffic"] {
  color: var(--warn);
  border-color: rgba(240, 168, 0, 0.4);
  background: var(--lemon-light);
}
.curation-source-badge[data-source="whatsapp"] {
  color: var(--mint-dark);
  border-color: var(--signal-dim);
  background: var(--mint-light);
}
.curation-source-badge[data-source="tomtom"] {
  color: var(--aqua-dark);
  border-color: rgba(52, 156, 220, 0.4);
  background: var(--aqua-light);
}

.curation-signals {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-top: 8px;
  border-top: 1px dashed var(--border);
}
.curation-signal {
  display: grid;
  grid-template-columns: 100px 90px 1fr;
  gap: 14px;
  padding: 8px 10px 8px 12px;
  border-left: 2px solid var(--border-bright);
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
  background: rgba(23, 15, 60, 0.03);
  font-size: 12.5px;
  align-items: baseline;
}
.curation-signal[data-source="inrix"]    { border-left-color: var(--lavender); }
.curation-signal[data-source="pt-traffic"] { border-left-color: var(--lemon-dark); }
.curation-signal[data-source="whatsapp"] { border-left-color: var(--signal); }
.curation-signal[data-source="tomtom"]   { border-left-color: var(--aqua-dark); }

.curation-signal-source {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  align-self: start;
  padding-top: 1px;
}
.curation-signal-time {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--text-dim);
  align-self: start;
  padding-top: 1px;
}
/* Two-line text block: structured headline on top, full provider narrative
   below when it adds info. The body wraps and uses a slightly smaller,
   muted typeface so the eye still anchors on the headline. */
.curation-signal-text {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}
.curation-signal-headline {
  color: var(--text);
  line-height: 1.4;
}
.curation-signal-body {
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.45;
  /* Preserve line breaks the provider put in, but don't run wild vertically */
  white-space: pre-wrap;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.curation-event-footer {
  display: flex;
  gap: 12px;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-dim);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.curation-event-toggle {
  color: var(--text-muted);
  cursor: pointer;
  text-decoration: underline;
  text-decoration-color: var(--border-bright);
  text-underline-offset: 3px;
}
.curation-event-toggle:hover { color: var(--accent); }

.curation-event.is-collapsed .curation-signals { display: none; }

/* Grouped WhatsApp row: replaces the N individual listener signals with one
   row that says "WhatsApp · N messages" and opens a popup when clicked. */
.curation-signal-group {
  display: grid;
  grid-template-columns: 100px 90px 1fr auto;
  gap: 14px;
  padding: 8px 10px 8px 12px;
  border-left: 2px solid var(--signal);
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
  background: rgba(31, 209, 189, 0.12);
  font-size: 12.5px;
  align-items: center;
}
.curation-signal-group-source {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--signal);
}
.curation-signal-group-count {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--text-dim);
}
.curation-signal-group-preview {
  color: var(--text-muted);
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-style: italic;
}
.curation-signal-group-open {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  padding: 4px 8px;
  border: 1px solid var(--accent-dim);
  border-radius: var(--r-sm);
  background: transparent;
}
.curation-signal-group-open:hover {
  background: var(--accent-glow);
  color: var(--accent);
}

/* ===== WhatsApp popup =============================================== */

.wa-modal { max-width: 560px; }
.wa-modal-count {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  font-style: normal;
  color: var(--text-muted);
  letter-spacing: 0.08em;
  margin-left: 8px;
}
.wa-modal-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 60vh;
  overflow-y: auto;
  padding-right: 4px;
}
.wa-msg {
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-left: 3px solid var(--signal);
  border-radius: var(--r-sm);
  background: rgba(23, 15, 60, 0.04);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.wa-msg-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.wa-msg-author { color: var(--signal); font-weight: 600; }
.wa-msg-time { color: var(--text-dim); }
.wa-msg-body {
  font-size: 14px;
  color: var(--text);
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}
.wa-msg-road {
  display: inline-block;
  margin-top: 2px;
  padding: 2px 6px;
  border-radius: 3px;
  background: var(--accent-glow);
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
  width: fit-content;
}

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

@media (max-width: 900px) {
  .console-grid { grid-template-columns: 1fr; }
  .rundown { border-right: none; border-bottom: 1px solid var(--border); }
  .console { padding: 32px 24px 60px; }
  .console-empty-title { font-size: 48px; }
  .pipeline { grid-template-columns: 32px 1fr; }
  .pipeline-steps { padding-left: 16px; }
  .curation-head { grid-template-columns: 1fr; gap: 24px; padding: 28px 20px; }
  .curation-title { font-size: 40px; }
  .curation-body { grid-template-columns: 1fr; }
  .curation-sidebar { border-right: none; border-bottom: 1px solid var(--border); }
  .curation-main { padding: 20px; }
  .curation-event { grid-template-columns: 58px 1fr; gap: 12px; }
  .curation-signal { grid-template-columns: 80px 1fr; gap: 10px; }
  .curation-signal-time { display: none; }
}

/* ------------------------------------------------------------------ */
/* Scheduler view — simple list of WEATHER/TRAFFIC slots                */
/* ------------------------------------------------------------------ */
.scheduler-view {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--bg);
  padding: 24px 32px 60px;
  gap: 20px;
  overflow-y: auto;
}

.sched-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 16px;
}
.sched-title {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0;
  color: var(--bauer-purple);
}
.sched-sub {
  margin: 4px 0 0;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.sched-list {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.sched-day-title {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 8px;
}

.sched-day-rows {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
}

.sched-row {
  display: grid;
  grid-template-columns: 80px 96px 1fr 110px 84px 28px;
  gap: 14px;
  align-items: center;
  padding: 10px 16px;
  border: 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  text-align: left;
  width: 100%;
  transition: background-color 120ms ease;
}
.sched-row-del {
  width: 22px;
  height: 22px;
  padding: 0;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted-2);
  font-size: 14px;
  line-height: 1;
  border-radius: 3px;
  cursor: pointer;
  justify-self: end;
  transition: border-color 120ms ease, color 120ms ease;
}
.sched-row-del:hover { border-color: var(--danger); color: var(--danger); }
.sched-row-del-spacer { display: block; }

.sched-row:last-child { border-bottom: none; }
.sched-row:hover:not([disabled]) { background: rgba(160, 150, 255, 0.12); }
.sched-row.is-disabled, .sched-row[disabled] { opacity: 0.4; cursor: not-allowed; }
.sched-row.is-targeted { background: rgba(160, 150, 255, 0.10); border-left: 3px solid var(--accent); padding-left: 13px; }
.sched-row.is-targeted:hover:not([disabled]) { background: rgba(160, 150, 255, 0.2); }
.sched-row.is-context .sched-row-show,
.sched-row.is-context .sched-row-length { color: var(--muted); }

/* Past blocks stay clickable (so demos can rehearse into them) but render
   dimmed so the editor's eye lands on upcoming ones first. */
.sched-row.is-past { opacity: 0.55; }
.sched-row.is-past.is-targeted { opacity: 0.7; }
.sched-row.is-past:hover { opacity: 1; }
.sched-row-status.is-past { color: var(--muted-2); }

.sched-row-time {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  color: var(--muted);
}
.sched-row-show {
  color: var(--text);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sched-row-length {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.08em;
}
.sched-row-status {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.sched-row-status.is-played   { color: var(--muted-2); }
.sched-row-status.is-expired  { color: var(--muted-2); }
.sched-row-status.is-empty    { color: var(--alert); }
.sched-row-status.is-scheduled { color: var(--signal); }
.sched-row-status.is-partial  { color: var(--alert); }

/* Rows are themselves buttons — no separate Send column. */

.sched-tag {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 3px;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.2em;
  font-weight: 700;
  text-align: center;
}
.sched-tag.is-weather { background: var(--mint-light); color: var(--mint-dark); border: 1px solid rgba(0, 147, 146, 0.35); }
.sched-tag.is-traffic { background: var(--peach-light); color: var(--peach-dark); border: 1px solid rgba(208, 92, 93, 0.35); }
.sched-tag.is-mixed   { background: var(--lavender-light); color: var(--bauer-purple); border: 1px solid rgba(160, 150, 255, 0.5); }
.sched-tag.is-context { background: rgba(23, 15, 60, 0.03); color: var(--muted); border: 1px solid var(--border); font-weight: 500; }

.sched-empty {
  color: var(--muted);
  text-align: center;
  padding: 40px 20px;
  border: 1px dashed var(--border);
  border-radius: 6px;
  font-size: 14px;
}

/* Modal (picker) — kept from the previous version, minor polish. */
.sched-modal { width: min(560px, 94vw); }
.sched-modal-meta {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 6px 14px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: rgba(23, 15, 60, 0.03);
  margin-bottom: 20px;
  font-size: 13px;
}
.sched-modal-meta dt {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  align-self: center;
}
.sched-modal-meta dd { margin: 0; color: var(--text); }

.sched-modal-section-title {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 10px;
}

.sched-modal-picks {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 260px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px;
}

.sched-pick {
  display: block;
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: 5px;
  cursor: pointer;
  background: rgba(23, 15, 60, 0.02);
  transition: border-color 120ms ease, background-color 120ms ease;
  color: var(--text);
}
.sched-pick:hover { border-color: var(--accent-dim); background: rgba(160, 150, 255, 0.12); }
.sched-pick.is-selected { border-color: var(--accent); background: rgba(160, 150, 255, 0.18); }
.sched-pick-title { font-weight: 600; font-size: 13px; color: var(--text); }
.sched-pick-meta {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  color: var(--muted);
  text-transform: uppercase;
  margin-top: 2px;
}

.sched-modal-empty {
  padding: 14px;
  border: 1px dashed var(--border);
  border-radius: 6px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.sched-modal-status {
  margin-top: 14px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  color: var(--muted);
  min-height: 18px;
}
.sched-modal-status.is-error { color: var(--danger); }
.sched-modal-status.is-success { color: var(--signal); }

@media (max-width: 720px) {
  .sched-row {
    grid-template-columns: 60px 72px 1fr;
    grid-template-rows: auto auto;
    row-gap: 6px;
  }
  .sched-row-length, .sched-row-status { grid-column: 2 / span 2; font-size: 10px; }
  .sched-row-send { grid-column: 1 / -1; justify-self: stretch; }
}

/* ============================== Manager view ============================== */
/* One row per bulletin: a status line with six stops, the bulletin card
   parked at its current stage. left/transform transition = the card visibly
   "wanders" right when a step is approved. */

.manager-board { margin-top: 18px; }

.manager-legend {
  position: relative;
  height: 16px;
  margin: 0 8px 6px;
}
.manager-legend-label {
  position: absolute;
  top: 0;
  transform: translateX(-50%);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-dim);
  white-space: nowrap;
}

.manager-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.manager-row {
  background: var(--bg-0);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  animation: rundownIn 0.35s var(--ease) both;
}

.manager-track {
  position: relative;
  /* Tall enough for the worst legal card (error line + wrapped approval
     chips) — cards are bottom-anchored and grow upward. */
  height: 190px;
  margin: 0 8px;
}
.manager-track-line {
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 20px;
  height: 2px;
  border-radius: 2px;
  background: var(--border-bright);
}
.manager-track-fill {
  position: absolute;
  left: 8px;
  bottom: 20px;
  height: 2px;
  border-radius: 2px;
  background: var(--signal);
  max-width: calc(100% - 16px);
  transition: width 0.7s var(--ease);
}
.manager-track-fill.is-fail { background: var(--danger); }
.manager-track-fill.is-cancel { background: var(--text-dim); }

.manager-node {
  position: absolute;
  bottom: 15px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--bg-0);
  border: 2px solid var(--border-bright);
  transform: translateX(-50%);
  transition: background 0.4s var(--ease), border-color 0.4s var(--ease);
}
.manager-node.is-done    { background: var(--signal);  border-color: var(--signal); }
.manager-node.is-current { background: var(--accent);  border-color: var(--accent); animation: managerNodePulse 1.6s ease-in-out infinite; }
.manager-node.is-fail    { background: var(--danger);  border-color: var(--danger); }
.manager-node.is-cancel  { background: var(--text-dim); border-color: var(--text-dim); }

/* dotPulse animates transform (would clobber translateX) — pulse a halo instead. */
@keyframes managerNodePulse {
  0%, 100% { box-shadow: 0 0 0 0 var(--accent-glow); }
  50%      { box-shadow: 0 0 0 6px var(--accent-glow); }
}

.manager-card {
  position: absolute;
  bottom: 34px;
  width: min(340px, 64%);
  text-align: left;
  font: inherit;
  color: inherit;
  background: var(--bg-1);
  border: 1px solid var(--border-bright);
  border-radius: var(--r-md);
  padding: 10px 12px;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(75, 20, 190, 0.06);
  transition: left 0.7s var(--ease), transform 0.7s var(--ease),
              box-shadow 0.2s var(--ease), border-color 0.2s var(--ease);
}
.manager-card:hover {
  border-color: var(--border-glow);
  box-shadow: 0 6px 18px var(--accent-glow);
}
.manager-card.is-done   { border-color: var(--signal-dim); }
.manager-card.is-fail   { border-color: var(--danger); }
.manager-card.is-cancel { opacity: 0.65; }

.manager-card-top {
  display: flex;
  align-items: center;
  gap: 8px;
}
.manager-kind {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}
.manager-kind .kind-icon { width: 12px; height: 12px; }
.manager-trigger {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
}
.manager-state {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.manager-card-title {
  margin-top: 6px;
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.manager-card-params {
  margin-top: 2px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.manager-card-approvals {
  margin-top: 7px;
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.manager-approval {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 2px 8px;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
  background: var(--bg-2);
  /* Long editor names must not grow the card past the track — the full
     name lives in the chip's title attribute. */
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.manager-approval.is-approved {
  color: var(--mint-dark);
  border-color: var(--signal-dim);
  background: var(--mint-light);
}
.manager-card-error {
  margin-top: 6px;
  font-size: 11px;
  color: var(--danger);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.manager-card-foot {
  margin-top: 6px;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
}

@media (max-width: 720px) {
  .manager-legend { display: none; }
  .manager-card { width: 82%; }
  .manager-track { height: 210px; }
}

/* ---------- Profiles view (Radio TTS voice-profile editor) ---------- */
.profile-glyph {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--bauer-purple) 14%, transparent);
  color: var(--accent);
  flex: none;
}
.profile-glyph svg { width: 13px; height: 13px; }

.profile-desc {
  display: block;
  font-size: 10.5px;
  color: var(--text-dim);
  line-height: 1.3;
  max-width: 260px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.profile-item {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 10px 12px;
  text-align: left;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  color: inherit;
  font: inherit;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.profile-item:hover { border-color: var(--accent-dim); }
.profile-item.is-selected {
  border-color: var(--accent);
  background: var(--bg-2);
}
.profile-item-name {
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.04em;
}
.profile-item-desc {
  font-size: 11.5px;
  color: var(--text-dim);
}
.profile-item-meta {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-dim);
  letter-spacing: 0.03em;
}

.profile-sliders {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
  align-items: end;
}

.profile-dict {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 12px;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: 10px;
  max-height: 160px;
  overflow: auto;
}
.profile-dict-row {
  display: flex;
  gap: 8px;
  align-items: baseline;
  font-family: var(--font-mono);
  font-size: 12px;
}
.profile-dict-arrow { color: var(--text-dim); }

.profile-advanced summary { cursor: pointer; list-style: none; }
.profile-advanced summary::before { content: "▸ "; color: var(--text-dim); }
.profile-advanced[open] summary::before { content: "▾ "; }

.profile-default-row {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
}
.profile-default-lang {
  font-size: 11px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
