/* ============================================================
   Operator console — layout & the BUILD / SHOW mode split.
   Loaded after style.css (shared tokens + component styles).

   BUILD (status ready, not armed): agenda editor front and center.
   SHOW (armed or running/paused/complete): body.show-mode —
   giant clock + cue list, editing surfaces stowed in the dock.
   ============================================================ */

/* author display values (flex etc.) must never beat the hidden attribute */
[hidden] { display: none !important; }

#control-panel { max-width: 1280px; }

/* ---------- header ---------- */
.cp-ident { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.cp-ident h1 { font-size: 18px; color: var(--text-dim); }
.hdr-session {
  font-size: 16px; font-weight: 600;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 320px;
}
.cp-status { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.hdr-chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px; font-variant-numeric: tabular-nums;
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: 999px; padding: 4px 12px; white-space: nowrap;
}
.hdr-chip:empty { display: none; }
.hdr-chip.urgent { color: var(--amber); border-color: var(--amber); }
.hdr-status { color: var(--text-dim); }
body.show-mode .hdr-status.live { color: var(--green); border-color: var(--green); }
.hdr-status.paused { color: var(--amber); border-color: var(--amber); }

/* sync indicator */
.sync-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--text-dim); flex: none; }
.sync-indicator.ok .sync-dot { background: var(--green); }
.sync-indicator.bad .sync-dot { background: var(--red); animation: pulse 1.2s ease-in-out infinite; }
.sync-indicator.bad { color: var(--red); border-color: var(--red); font-weight: 700; }

/* ---------- menu ---------- */
.menu-wrap { position: relative; }
.menu-dropdown {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 200;
  min-width: 250px;
  background: var(--bg-surface); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: 0 12px 40px rgba(0,0,0,.5);
  padding: 6px; display: flex; flex-direction: column;
}
.menu-dropdown hr { border: none; border-top: 1px solid var(--border); margin: 6px 4px; }
.menu-item {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  border: none; background: none; color: var(--text);
  text-align: left; font-size: 14px; padding: 9px 12px; border-radius: 6px; cursor: pointer;
}
.menu-item:hover { background: var(--bg-hover); }
.menu-item.danger { color: var(--red); }
.menu-item.danger:hover { background: rgba(239,68,68,.1); }
.menu-item.confirming { background: var(--red); color: #fff; font-weight: 700; }
.menu-item kbd {
  font-size: 11px; background: var(--bg); border: 1px solid var(--border);
  border-radius: 4px; padding: 1px 6px; color: var(--text-dim);
}

/* ---------- mode switching ---------- */
#show-panel { display: none; }
body.show-mode #show-panel { display: block; }
body.show-mode #build-panel { display: none; }
body.show-mode #total-time-indicator { display: none; }
#tab-agenda[hidden] { display: none; }

/* ---------- BUILD mode ---------- */
.save-indicator { font-size: 12px; color: var(--green); min-width: 64px; }
.golive-bar {
  position: sticky; bottom: 0; z-index: 90;
  display: flex; justify-content: flex-end; align-items: center; gap: 16px;
  padding: 12px 0;
  background: linear-gradient(transparent, var(--bg) 35%);
}
.btn-golive { font-size: 17px; font-weight: 700; padding: 14px 32px; }

/* ---------- SHOW mode layout ---------- */
.show-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(300px, 1fr);
  gap: 16px;
  margin-top: 16px;
  align-items: start;
}

/* NOW column */
.now-col {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px 24px;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  text-align: center;
}
.now-section { font-size: 14px; text-transform: uppercase; letter-spacing: 1px; color: var(--text-dim); }
.now-speaker { font-size: 26px; font-weight: 700; line-height: 1.2; }
.now-timer {
  font-size: clamp(64px, 11vw, 128px);
  font-weight: 700; line-height: 1;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  margin: 6px 0 0;
  color: var(--green);
}
.now-timer.neutral { color: var(--text); }
.now-timer.amber { color: var(--amber); }
.now-timer.red { color: var(--red); }
.now-timer.overtime { color: var(--red); animation: pulse 1s ease-in-out infinite; }
.now-pace { font-size: 15px; color: var(--text-dim); min-height: 1.5em; }
.now-pace.ahead { color: var(--green); }
.now-pace.behind { color: var(--amber); font-weight: 600; }

.now-adjust { display: flex; align-items: center; gap: 8px; margin: 8px 0 4px; flex-wrap: wrap; justify-content: center; }

/* The one huge button */
.big-action {
  width: 100%;
  min-height: 76px;
  margin-top: 10px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  font-size: 19px; font-weight: 700;
  background: #166534; border: 1px solid var(--green); color: #dcfce7;
  border-radius: 12px;
}
.big-action:hover:not(:disabled) { background: #15803d; }
.big-action:disabled { opacity: .35; }
.big-action .next-kicker { font-size: 11px; letter-spacing: 2px; color: var(--green); }
.big-action .next-title { font-size: 19px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.big-action.overtime { border-color: var(--red); background: #7f1d1d; color: #fecaca; animation: pulse 1.2s ease-in-out infinite; }
.big-action.overtime .next-kicker { color: var(--red); }
.big-action.finish .next-kicker { color: var(--amber); }

.transport-secondary { display: flex; gap: 8px; width: 100%; margin-top: 8px; }
.transport-secondary .btn { flex: 1; min-height: 46px; font-size: 15px; font-weight: 600; }

.now-col .current-notes-panel { width: 100%; margin: 12px 0 0; }

/* CUE LIST column */
.cue-col {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  max-height: calc(100vh - 140px);
  display: flex; flex-direction: column;
  position: sticky; top: 12px;
}
.cue-head {
  font-size: 11px; text-transform: uppercase; letter-spacing: 1px;
  color: var(--text-dim); padding: 2px 8px 8px;
}
.cue-list { overflow-y: auto; flex: 1; }
.cue-section {
  font-size: 11px; text-transform: uppercase; letter-spacing: .5px;
  color: var(--text-dim); padding: 10px 8px 4px;
}
.cue-row {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr) auto auto;
  align-items: center; gap: 8px;
  padding: 7px 8px;
  border-radius: 8px;
  border-left: 3px solid transparent;
}
.cue-row:hover { background: var(--bg-hover); }
.cue-idx { font-size: 12px; color: var(--text-dim); font-variant-numeric: tabular-nums; }
.cue-main { min-width: 0; }
.cue-speaker { display: block; font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cue-note { display: block; font-size: 11px; color: var(--text-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cue-time { font-size: 13px; color: var(--text-dim); font-variant-numeric: tabular-nums; white-space: nowrap; }
.cue-row.done { opacity: .5; }
.cue-row.done .cue-time.over { color: var(--red); }
.cue-row.done .cue-time.under { color: var(--green); }
.cue-row.live {
  background: rgba(34,197,94,.08);
  border-left-color: var(--green);
  padding-top: 12px; padding-bottom: 12px;
}
.cue-row.live .cue-speaker { color: var(--green); font-size: 15px; }
.cue-row.live .cue-time { color: var(--text); font-weight: 700; }
.cue-go {
  border: 1px solid var(--green); background: transparent; color: var(--green);
  font-size: 12px; font-weight: 700; letter-spacing: 1px;
  border-radius: 6px; padding: 5px 10px; cursor: pointer;
  opacity: 0; transition: opacity .12s;
}
.cue-row:hover .cue-go, .cue-go:focus-visible { opacity: 1; }
.cue-go:hover { background: #166534; color: #dcfce7; }
@media (pointer: coarse) { .cue-go { opacity: 1; } }

/* ---------- dock ---------- */
.dock { margin-top: 20px; }
.dock-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); }
.dock-tab {
  border: none; background: none; color: var(--text-dim);
  font-size: 14px; font-weight: 600; padding: 10px 16px; cursor: pointer;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
  display: inline-flex; align-items: center; gap: 8px;
}
.dock-tab:hover { color: var(--text); }
.dock-tab.active { color: var(--text); border-bottom-color: var(--accent); }
.dock-tab.warn { color: var(--amber); animation: pulse 1.5s ease-in-out infinite; }
.dock-pane {
  display: none;
  background: var(--bg-surface); border: 1px solid var(--border); border-top: none;
  border-radius: 0 0 12px 12px; padding: 14px 16px;
}
.dock-pane.active { display: block; }
.dock-pane .questions-header { margin-bottom: 10px; }
.dock-pane .questions-header h2 { font-size: 15px; }
.banner-state { font-size: 13px; color: var(--text-dim); margin: 6px 0 12px; }
.banner-state.on { color: var(--amber); font-weight: 600; }
.banner-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--amber); display: inline-block; }
.audience-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }

/* agenda editor inside the dock (show mode) */
.agenda-unlock-label {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; font-weight: 600; color: var(--amber);
  margin-bottom: 10px; cursor: pointer;
}
.agenda-dock-slot.locked { pointer-events: none; opacity: .55; }
.agenda-dock-slot.unlocked { border: 1px solid var(--amber); border-radius: 8px; padding: 8px; }

/* two-step confirm state on ordinary buttons */
.btn.confirming { background: var(--red); border-color: var(--red); color: #fff; font-weight: 700; }

/* keyboard overlay */
.kbd-list div { display: flex; gap: 12px; padding: 6px 0; border-bottom: 1px solid var(--border); }
.kbd-list dt {
  font-family: ui-monospace, Menlo, monospace; font-size: 12px;
  background: var(--bg); border: 1px solid var(--border); border-radius: 5px;
  padding: 2px 8px; white-space: nowrap; align-self: center;
}
.kbd-list dd { font-size: 13.5px; color: var(--text-dim); align-self: center; }

@keyframes pulse { 50% { opacity: .45; } }

/* ---------- responsive ---------- */
@media (max-width: 920px) {
  .show-grid { grid-template-columns: 1fr; }
  .cue-col { position: static; max-height: 40vh; }
  .now-timer { font-size: clamp(56px, 18vw, 96px); }
  .hdr-session { max-width: 160px; }
}
