/* UPHE / NBCU design tokens + layout. Light + dark, system default with a manual toggle. */
:root {
  --uphe-purple: #400095;
  --uphe-purple-light: #6E54DC;
  --uphe-purple-dark: #2D0066;
  --nbcu-yellow: #FCB711;
  --nbcu-red: #CC004C;
  --nbcu-green: #0DB14B;
  --st-green: #C6EFCE;
  --st-yellow: #FFEB9C;
  --st-red: #FFC7CE;

  --bg: #ffffff;
  --bg-2: #f6f5fb;
  --bg-3: #ecebf6;
  --text: #1a1a2e;
  --muted: #5b5b73;
  --border: #e3e1f0;
  --accent: var(--uphe-purple);
  --plate: #2D0066; /* dark plate behind the light-on-dark logo */

  --font: Calibri, "Segoe UI", system-ui, -apple-system, sans-serif;
  --radius: 10px;
  --nav-w: 290px;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0d0d1a;
  --bg-2: #15152a;
  --bg-3: #1f1f3a;
  --text: #ececf5;
  --muted: #a3a3c4;
  --border: #2a2a48;
  --accent: var(--uphe-purple-light);
  --plate: #1a1a2e;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
/* Paint the root canvas itself (not just <body>) so no un-painted region—e.g. a
   classic scrollbar's track/corner on Windows—can fall through to the UA-default
   light surface in dark mode. Token-driven: #ffffff in light, #0d0d1a in dark. */
html { background: var(--bg); }
body { font-family: var(--font); background: var(--bg); color: var(--text); }
.hidden { display: none !important; }
a { color: var(--accent); }

/* ---------- Login ---------- */
.login { display: flex; align-items: center; justify-content: center; height: 100vh; background: var(--bg-2); }
.login-card {
  width: 360px; padding: 32px; border-radius: 14px; background: var(--bg);
  border: 1px solid var(--border); box-shadow: 0 12px 40px rgba(64,0,149,.12);
  display: flex; flex-direction: column; gap: 14px; text-align: center;
}
.login-card .plate { background: var(--plate); border-radius: 10px; padding: 16px; }
.login-card .plate img { width: 100%; height: auto; display: block; }
.login-card h1 { font-size: 1.15rem; margin: 4px 0 8px; color: var(--accent); }
.error { color: var(--nbcu-red); font-size: .85rem; min-height: 1rem; }

/* ---------- Shell ---------- */
.shell { display: flex; height: 100vh; }
.nav {
  width: var(--nav-w); flex: 0 0 var(--nav-w); background: var(--bg-2);
  border-right: 1px solid var(--border); display: flex; flex-direction: column; padding: 14px;
  /* The nav is a fixed-height column: header (logo + tool select) and the user
     footer stay put while the middle list (#nav-compare / .nav-docs) scrolls.
     overflow:hidden keeps anything from spilling past the column on short screens. */
  overflow: hidden;
}
/* Drag the divider between the nav and the workspace to resize the sidebar. */
.nav-resizer {
  flex: 0 0 6px; align-self: stretch; cursor: col-resize; background: transparent;
  margin-left: -3px; z-index: 5; transition: background .12s;
}
.nav-resizer:hover, .nav-resizer.dragging { background: var(--uphe-purple-light); }
.nav .plate { background: var(--plate); border-radius: 10px; padding: 12px 14px; margin-bottom: 14px; flex-shrink: 0; }
.nav .plate img { width: 100%; height: auto; display: block; }
.nav-actions { display: flex; gap: 8px; align-items: center; margin-bottom: 12px; }
.nav-actions .grow { flex: 1; }
/* Booking Parser email-intake address (click to copy), shown under the New Bookings button. */
.bk-intake { display: flex; flex-direction: column; align-items: stretch; gap: 2px; width: 100%;
  height: fit-content; margin: -2px 0 12px; padding: 7px 10px; border: 1px dashed var(--border);
  border-radius: 8px; background: transparent; color: var(--muted); font-size: .78rem;
  text-align: left; cursor: pointer; line-height: 1.3; box-sizing: border-box; }
.bk-intake:hover { border-color: var(--uphe-purple-light); color: var(--text); }
.bk-intake .bk-intake-email { min-width: 0; max-width: 100%; font-weight: 600;
  color: var(--uphe-purple-light); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bk-intake.copied { border-style: solid; border-color: var(--uphe-purple-light); color: var(--text); }

.job-list { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1; display: flex; flex-direction: column; gap: 4px; }
.job-item {
  display: flex; align-items: center; gap: 6px; padding: 8px 9px; border-radius: 8px;
  cursor: pointer; color: var(--text); border: 1px solid transparent; font-size: .84rem;
}
.job-item:hover { background: var(--bg-3); }
.job-item.active { background: var(--bg-3); border-color: var(--uphe-purple-light); }
.job-item .name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .84rem; }
.job-item .date { color: var(--muted); font-variant-numeric: tabular-nums; font-size: .74rem; flex: none; }
.job-item .icons { display: none; gap: 2px; }
.job-item:hover .icons { display: flex; }
.icon-btn { border: 0; background: transparent; color: var(--muted); cursor: pointer; padding: 4px; border-radius: 6px; }
.icon-btn:hover { color: var(--accent); background: var(--bg); }

.signout { margin-top: 10px; padding: 10px; text-align: center; cursor: pointer; color: var(--muted);
  border-top: 1px solid var(--border); text-decoration: none; }
.signout:hover { color: var(--accent); }

/* ---------- Main ---------- */
.main { flex: 1; overflow-y: auto; padding: 28px 36px; background: var(--bg);
  scrollbar-color: var(--bg-3) var(--bg); overscroll-behavior: contain; }
.empty { color: var(--muted); margin-top: 80px; text-align: center; font-size: 1rem; }
.field { margin-bottom: 18px; display: flex; flex-direction: column; gap: 6px; }
/* explicit color so the WebAwesome base stylesheet can't force labels dark in dark mode */
.field label { font-weight: 600; font-size: .9rem; color: var(--text); }
.field .hint { color: var(--muted); font-size: .8rem; }
.title-row h2, .modal h3 { color: var(--accent); }
input.native, textarea.native, select.native {
  font-family: var(--font); font-size: .95rem; color: var(--text); background: var(--bg);
  border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; width: 100%;
}
textarea.native { min-height: 120px; resize: vertical; }
input.native:focus, textarea.native:focus, select.native:focus { outline: 2px solid var(--uphe-purple-light); border-color: transparent; }

.row { display: flex; gap: 16px; }
.row > * { flex: 1; }

.drop {
  border: 2px dashed var(--border); border-radius: var(--radius); padding: 22px; text-align: center;
  color: var(--muted); cursor: pointer; transition: .15s; background: var(--bg);
}
.drop:hover, .drop.drag { border-color: var(--uphe-purple-light); color: var(--accent); background: var(--bg-2); }
.drop.set { border-style: solid; border-color: var(--nbcu-green); color: var(--text); }
.drop .big { font-size: 1.6rem; margin-bottom: 6px; }
.drop .fname { font-weight: 600; word-break: break-all; }

.run-bar { display: flex; align-items: center; gap: 14px; margin: 8px 0 18px; }
.title-row { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.title-row h2 { margin: 0; color: var(--accent); font-size: 1.3rem; }
.status-chip { font-size: .75rem; padding: 2px 10px; border-radius: 20px; background: var(--bg-3); color: var(--muted); }
.status-chip.running { background: var(--nbcu-yellow); color: #3a2a00; }
.status-chip.succeeded { background: var(--st-green); color: #14431f; }
.status-chip.failed { background: var(--st-red); color: #7a0020; }
.status-chip i { display: inline-block; }
.status-chip .spin { margin-right: 3px; }
.spin { animation: chip-spin .9s linear infinite; }  /* busy indicator: chips, buttons */
@keyframes chip-spin { to { transform: rotate(360deg); } }
/* typewriter caret on the line currently being streamed in */
.console .line.typing .tx::after {
  content: "▏"; margin-left: 1px; color: var(--uphe-purple-light);
  animation: tw-caret .7s step-end infinite;
}
@keyframes tw-caret { 50% { opacity: 0; } }
.saved { color: var(--nbcu-green); font-size: .8rem; opacity: 0; transition: opacity .3s; }
.saved.show { opacity: 1; }

.console {
  background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 16px; font-size: .88rem; max-height: 320px; overflow-y: auto; margin-top: 8px;
}
.console .line { padding: 2px 0; color: var(--text); }
.console .line.llm { color: var(--muted); font-style: italic; }
.console .line .ic { color: var(--uphe-purple-light); margin-right: 8px; }
.metrics { display: flex; flex-wrap: wrap; gap: 10px; margin: 14px 0; }
.metric { background: var(--bg-2); border: 1px solid var(--border); border-radius: 8px; padding: 10px 14px; min-width: 120px; }
.metric .n { font-size: 1.3rem; font-weight: 700; color: var(--accent); }
.metric .l { font-size: .75rem; color: var(--muted); }
.disabled-mask { opacity: .55; pointer-events: none; }
/* ...except the run bar. Cancel lives inside the container that setXRunning() masks, so the
   same call that reveals the button made it unclickable — on a stalled run it is the only
   control on screen and a click never reached the handler. */
.disabled-mask .run-bar { pointer-events: auto; opacity: 1; }

/* ---------- Buttons (WebAwesome enhances; these are the fallback look) ---------- */
.btn {
  font-family: var(--font); font-size: .92rem; font-weight: 600; cursor: pointer;
  border: 1px solid var(--border); background: var(--bg); color: var(--text);
  border-radius: 8px; padding: 9px 16px; display: inline-flex; align-items: center; gap: 8px;
}
.btn:hover { background: var(--bg-2); }
.btn.brand { background: var(--uphe-purple); border-color: var(--uphe-purple); color: #fff; }
.btn.brand:hover { background: var(--uphe-purple-light); }
.btn.brand:disabled { background: var(--muted); border-color: var(--muted); cursor: not-allowed; opacity: .6; }
.btn.danger { background: var(--nbcu-red); border-color: var(--nbcu-red); color: #fff; }
.btn.ghost { background: transparent; }

/* ---------- Modal (custom — confirmations never use native alert/confirm) ---------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(10,8,26,.55); display: flex;
  align-items: center; justify-content: center; z-index: 1000;
}
.modal {
  background: var(--bg); color: var(--text); border-radius: 14px; border: 1px solid var(--border);
  box-shadow: 0 20px 60px rgba(0,0,0,.35); width: 440px; max-width: 92vw; padding: 24px;
  /* never grow past the viewport — the body scrolls, the title + buttons stay put */
  max-height: calc(100vh - 40px); display: flex; flex-direction: column;
}
.modal h3 { margin: 0 0 10px; color: var(--accent); flex: 0 0 auto; }
.modal p { color: var(--muted); margin: 0 0 18px; line-height: 1.5; }
/* scrollable content region between the pinned title and the pinned actions */
.modal-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; }
.modal .actions { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap;
  flex: 0 0 auto; padding-top: 16px; }
.modal .field { text-align: left; }
.modal-opts { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.modal-opt { text-align: left; padding: 12px 14px; border: 1px solid var(--border); border-radius: 8px; cursor: pointer; }
.modal-opt:hover { border-color: var(--uphe-purple-light); background: var(--bg-2); }
.modal-opt .ot { font-weight: 600; }
.modal-opt .od { font-size: .82rem; color: var(--muted); }

/* ---------- Per-slot file list (multi-file upload) ---------- */
.filelist { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.filelist li {
  display: flex; align-items: center; gap: 8px; font-size: .82rem; background: var(--bg-2);
  border: 1px solid var(--border); border-radius: 7px; padding: 6px 10px;
}
.filelist li .fn { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.filelist li .fx { color: var(--muted); cursor: pointer; border: 0; background: transparent; padding: 2px; }
.filelist li .fx:hover { color: var(--nbcu-red); }
.filelist li .fi { color: var(--nbcu-green); }

/* ---------- Tool switcher + Documentation placeholder ---------- */
.tool-field { margin-bottom: 14px; flex-shrink: 0; }
.tool-field select { font-weight: 600; }
/* The docs nav scrolls on its own (like #nav-compare's job list) so the user
   footer below it stays pinned instead of being pushed off a short screen. */
.nav-docs { flex: 1; min-height: 0; overflow-y: auto; }
.nav-note { color: var(--muted); font-size: .82rem; padding: 8px 4px; }
.docs-view h2 { color: var(--accent); margin-top: 8px; }
.docs-placeholder { color: var(--muted); max-width: 620px; line-height: 1.6; }

/* ---------- New run states ---------- */
.status-chip.awaiting_review { background: var(--st-yellow); color: #5b4500; }
.status-chip.cancelled, .status-chip.paused { background: var(--bg-3); color: var(--muted); }

/* ---------- Stored inputs note ---------- */
.stored-info {
  font-size: .82rem; color: var(--muted); background: var(--bg-2);
  border: 1px dashed var(--border); border-radius: 8px; padding: 8px 12px; margin-bottom: 10px;
}
.stored-info i { color: var(--nbcu-green); margin-right: 6px; }

/* ---------- Review modal digest ---------- */
.modal.wide { width: 560px; }
.digest { text-align: left; font-size: .85rem; margin-bottom: 14px; }
.digest .drow { display: flex; gap: 8px; padding: 3px 0; }
.digest .dk { flex: 0 0 130px; color: var(--muted); }
.digest .dv { flex: 1; }
.digest .pill { display: inline-block; background: var(--bg-3); border-radius: 12px; padding: 1px 9px; margin: 1px 3px 1px 0; font-size: .78rem; }
.digest .assume { color: var(--muted); font-size: .78rem; margin-top: 6px; line-height: 1.45; }
.modal textarea.native { min-height: 84px; margin-bottom: 12px; }

/* ---------- Review modal toggles ---------- */
.toggles { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; text-align: left; }
.tgl { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--border);
  border-radius: 8px; cursor: pointer; }
.tgl:hover { background: var(--bg-2); }
.tgl.off { opacity: .55; cursor: not-allowed; }
.tgl input { margin-top: 3px; accent-color: var(--uphe-purple); }
.tgl small { color: var(--muted); line-height: 1.4; }

/* ---------- Documentation ---------- */
.docs-sec { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted);
  margin: 14px 4px 6px; font-weight: 700; }
.docs-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.docs-list a { display: block; padding: 7px 10px; border-radius: 7px; color: var(--text);
  text-decoration: none; font-size: .9rem; }
.docs-list a:hover { background: var(--bg-3); }
.docs-list a.active { background: var(--bg-3); color: var(--accent); font-weight: 600;
  border-left: 3px solid var(--uphe-purple-light); }
.docs-view { max-width: 860px; }
#docs-content h2 { color: var(--accent); margin: 8px 0 14px; }
#docs-content h3 { color: var(--accent); margin: 22px 0 8px; font-size: 1.05rem; }
#docs-content p { line-height: 1.65; color: var(--text); }
#docs-content code { background: var(--bg-2); border: 1px solid var(--border); border-radius: 5px;
  padding: 1px 6px; font-size: .85em; }
.live { border-bottom: 1px dotted var(--uphe-purple-light); cursor: help; font-weight: 600; }

/* ---------- Diagrams (inline SVG, theme-aware, fully visible, printable) ---------- */
.diagram { width: 100%; height: auto; display: block; margin: 14px 0 6px; }
.diagram .dnode rect { fill: var(--bg-2); stroke: var(--uphe-purple-light); stroke-width: 1.5; }
.diagram .dnode { cursor: pointer; outline: none; }
.diagram .dnode:hover rect, .diagram .dnode:focus rect { fill: var(--bg-3); }
.diagram .dnode.on rect { stroke-width: 3; fill: var(--bg-3); }
.diagram .dnode.stage rect { stroke: var(--accent); }
.diagram .dnode.ai rect { stroke: var(--nbcu-yellow); }
.diagram .dnode.human rect { stroke: var(--nbcu-green); }
.diagram .dnode.db rect { stroke: var(--nbcu-blue, #0089D0); }
.diagram .thead { fill: var(--uphe-purple); stroke: none; }
.diagram .dnode .thead + .dt, .diagram .dt.small { fill: #fff; }
.diagram .dt { fill: var(--text); font: 600 13px Calibri, sans-serif; text-anchor: middle; }
.diagram .dt.small { font-size: 12px; }
.diagram .ds { fill: var(--muted); font: 11px Calibri, sans-serif; text-anchor: middle; }
.diagram .ds.left { text-anchor: start; }
.diagram .dedge { stroke: var(--muted); stroke-width: 1.4; fill: none; }
.diagram .dedge.dash { stroke-dasharray: 5 4; }
.diagram marker path { fill: var(--muted); }
.diagram .ghost { fill: none; stroke: var(--border); stroke-dasharray: 4 4; }
.dinfo { background: var(--bg-2); border: 1px solid var(--border); border-left: 3px solid var(--uphe-purple-light);
  border-radius: 8px; padding: 12px 14px; font-size: .9rem; color: var(--text); min-height: 1.4em; margin-bottom: 10px; }

/* ---------- Bookings data editor ---------- */
.bk-edit-modal { width: min(1560px, 96vw); height: 92vh; max-width: none; padding: 0;
  display: flex; flex-direction: column; overflow: hidden; }
.bk-ed-bar { display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 10px 14px; background: var(--uphe-purple); color: #fff; border-radius: 13px 13px 0 0; }
.bk-ed-bar .ttl { font-weight: 700; margin-right: auto; white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; }
.bk-ed-bar .cnt { font-size: .82rem; opacity: .9; white-space: nowrap; }
/* the toggle sits on the purple bar, so it dresses like the ghost buttons beside it —
   the settings-page .tgl look (theme border + hover fill) is unreadable here */
.bk-ed-bar label.tgl { display: inline-flex; align-items: center; gap: 8px;
  font-size: .92rem; font-weight: 600; cursor: pointer; user-select: none; white-space: nowrap;
  padding: 9px 16px; border: 1px solid rgba(255,255,255,.55); border-radius: 8px;
  background: transparent; color: #fff; }
.bk-ed-bar label.tgl:hover { background: rgba(255,255,255,.14); }
.bk-ed-bar label.tgl input { margin: 0; width: 14px; height: 14px; accent-color: #fff; }
.bk-ed-bar .btn.ghost { color: #fff; border-color: rgba(255,255,255,.55); }
.bk-ed-bar .btn.ghost:hover { background: rgba(255,255,255,.14); }
/* sheet tabs — the editor mirrors the workbook's two worksheets */
.bk-ed-tabs { display: flex; gap: 6px; padding: 8px 14px 0; background: var(--bg-2);
  border-bottom: 1px solid var(--border); }
.bk-tab { font-family: var(--font); font-size: .86rem; font-weight: 600; cursor: pointer;
  display: inline-flex; align-items: center; gap: 8px; padding: 8px 16px;
  color: var(--muted); background: transparent;
  border: 1px solid transparent; border-bottom: none; border-radius: 8px 8px 0 0; }
.bk-tab:hover { color: var(--text); }
.bk-tab.active { color: var(--text); background: var(--bg); border-color: var(--border);
  margin-bottom: -1px; padding-bottom: 9px; }
.bk-tab .n { font-size: .72rem; font-weight: 700; padding: 1px 8px; border-radius: 9px;
  background: var(--border); color: var(--text); transition: background .3s; }
.bk-tab.active .n { background: var(--uphe-purple); color: #fff; }
.bk-tab.flash .n { background: var(--nbcu-yellow); color: #1a1a2e; }
.bk-ed-outer { position: relative; flex: 1 1 auto; min-height: 0; }
.bk-ed-scroll tr.bk-row-hidden { display: none; }
.bk-ed-scroll { position: absolute; inset: 0; overflow: auto; border-radius: 0 0 13px 13px; }
.bk-ed-scroll table { border-collapse: separate; border-spacing: 0; width: max-content;
  min-width: 100%; font-size: .82rem; }
.bk-ed-scroll th { position: sticky; top: 0; z-index: 4; background: var(--uphe-purple);
  color: #fff; text-align: left; padding: 6px 8px; white-space: nowrap; cursor: context-menu; }
.bk-ed-scroll td { padding: 4px 8px; border-bottom: 1px solid var(--border);
  white-space: nowrap; max-width: 340px; overflow: hidden; text-overflow: ellipsis;
  background: var(--bg); }
/* zebra stripes are classed by the editor (visible rows only) — nth-child would
   keep counting rows hidden by the sheet tabs or the Hide Completed toggle */
.bk-ed-scroll tr.stripe td { background: var(--bg-2); }
.bk-ed-scroll td.editable { cursor: text; }
.bk-ed-scroll td .cell-input { width: 100%; min-width: 90px; border: 1px solid var(--accent);
  border-radius: 4px; padding: 2px 5px; font: inherit; color: var(--text); background: var(--bg); }
/* save states: yellow while the app is saving, pale red once the override is stored.
   Both are light pastels, so pin dark ink for readability in either theme. */
.bk-ed-scroll td.saving { background: var(--st-yellow) !important; color: #1a1a2e;
  transition: background .25s; }
.bk-ed-scroll td.override { background: var(--st-red) !important; color: #1a1a2e;
  transition: background .4s; }
.bk-ed-scroll tr.completed td { opacity: .55; }
.bk-ed-scroll tr.completed td.c-done { opacity: 1; }  /* the checkbox stays crisp */
.bk-ed-scroll td.c-done, .bk-ed-scroll th.c-done { text-align: center; cursor: default; }
.bk-ed-scroll td.c-done input { cursor: pointer; width: 15px; height: 15px;
  accent-color: var(--uphe-purple); }
.bk-freeze-line { position: absolute; top: 0; bottom: 0; width: 9px; margin-left: -4px;
  cursor: col-resize; z-index: 7; background: transparent; }
.bk-freeze-line::after { content: ""; position: absolute; top: 0; bottom: 0; left: 3px;
  width: 3px; background: var(--uphe-purple-light); opacity: .55; border-radius: 2px; }
.bk-freeze-line:hover::after, .bk-freeze-line.dragging::after { opacity: 1; }

/* ---------- Report Settings modal ---------- */
.rs-modal { width: min(760px, 94vw); max-height: 90vh; padding: 0; display: flex;
  flex-direction: column; overflow: hidden; }
.rs-bar { display: flex; align-items: center; gap: 12px; padding: 10px 14px;
  background: var(--uphe-purple); color: #fff; border-radius: 13px 13px 0 0; }
.rs-bar .ttl { font-weight: 700; margin-right: auto; }
.rs-bar .btn.ghost { color: #fff; border-color: rgba(255,255,255,.55); }
.rs-bar .btn.ghost:hover { background: rgba(255,255,255,.14); }
.rs-state { font-size: .82rem; opacity: .95; white-space: nowrap; }
.rs-state.saved { color: var(--nbcu-yellow); }
.rs-state.error { color: #ffd9d9; }
.rs-state.dirty { color: var(--muted); font-style: italic; }
.rs-body { padding: 14px 18px 18px; overflow: auto; }
.rs-note { font-size: .84rem; color: var(--muted); margin: 0 0 14px; line-height: 1.45; }
.rs-body h4 { margin: 14px 0 8px; font-size: .95rem; }
.rs-body h4 .rs-sub { font-weight: 400; color: var(--muted); font-size: .78rem; }
.rs-toggle { display: flex; align-items: flex-start; gap: 10px; padding: 8px 10px;
  border: 1px solid var(--border); border-radius: 8px; margin-bottom: 8px; cursor: pointer;
  color: var(--text); }
.rs-toggle:hover { background: var(--bg-2); }
.rs-toggle input { margin-top: 3px; accent-color: var(--uphe-purple); }
.rs-toggle span { display: flex; flex-direction: column; gap: 2px; }
.rs-toggle strong { color: var(--text); font-weight: 600; }
.rs-toggle small { color: var(--muted); line-height: 1.4; }
/* the reorderable column list is a single vertical column so top-to-bottom reads as Excel order */
.rs-reorder-hint { margin: 2px 0 8px; }
.rs-cols { display: flex; flex-direction: column; gap: 4px; margin-top: 4px; }
.rs-cols-fixed { margin-top: 6px; }
.rs-col { display: flex; align-items: center; gap: 9px; font-size: .86rem; padding: 7px 10px;
  cursor: pointer; color: var(--text); border: 1px solid var(--border); border-radius: 8px;
  background: var(--bg); }
.rs-col:hover { background: var(--bg-2); }
.rs-col input { accent-color: var(--uphe-purple); flex: none; margin: 0; }
.rs-col > span:last-child { flex: 1; }
.rs-grip { width: 14px; text-align: center; color: var(--muted); cursor: grab; flex: none; }
.rs-col.dragging { opacity: .55; border-color: var(--uphe-purple); background: var(--bg-2); }
.rs-col-fixed { cursor: default; opacity: .85; border-style: dashed; }
.rs-col-fixed .rs-grip { cursor: default; }
.rs-fixed-hint { margin: 6px 0 0; font-size: .8rem; }

/* ---------- Feedback panel (the editor's in-context notes) ---------- */
.bk-fb-panel { position: fixed; z-index: 1300; width: 400px; max-width: 92vw;
  background: var(--bg); color: var(--text); border: 1px solid var(--accent);
  border-radius: 12px; box-shadow: 0 14px 44px rgba(10, 8, 26, .45); }
.bk-fb-head { display: flex; align-items: center; gap: 8px; padding: 9px 12px;
  background: var(--uphe-purple); color: #fff; border-radius: 11px 11px 0 0;
  font-size: .86rem; font-weight: 600; cursor: default; }
.bk-fb-head .what { margin-right: auto; overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap; }
.bk-fb-head .state { font-weight: 400; font-size: .76rem; opacity: .9; white-space: nowrap; }
.bk-fb-close { background: none; border: 0; color: #fff; font-size: 1.15rem; cursor: pointer;
  padding: 0 2px; line-height: 1; }
.bk-fb-close:hover { color: var(--nbcu-yellow); }
.bk-fb-body { padding: 10px 12px 12px; }
.bk-fb-note { font-size: .78rem; color: var(--muted); margin: 0 0 8px; }
.bk-fb-panel textarea { width: 100%; min-height: 130px; resize: vertical; font: inherit;
  font-size: .88rem; color: var(--text); background: var(--bg-2);
  border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; box-sizing: border-box; }
.bk-fb-panel textarea:focus { outline: 2px solid var(--accent); }
.bk-fb-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.bk-fb-chips .fb-chip { display: inline-flex; align-items: center; gap: 5px;
  font-size: .76rem; padding: 2px 9px; border-radius: 999px; background: var(--bg-3);
  border: 1px solid var(--border); }
.bk-fb-hint { font-size: .72rem; color: var(--muted); margin-top: 7px; }

/* ---------- Print: documentation prints clean and complete ---------- */
@media print {
  /* Keep printouts white regardless of the on-screen theme: the dark html/.main
     canvas paint and dark color-scheme (added for the Windows scroller fix) must
     not leak into print. */
  :root, :root[data-theme="dark"] { color-scheme: light; }
  .nav, .login, #modal-root { display: none !important; }
  .main { padding: 0; overflow: visible; }
  .docs-view { max-width: none; }
  .diagram { break-inside: avoid; }
  html, .main { background: #fff; }
  body { background: #fff; color: #000; }
}
.tgl strong { color: var(--text); }

/* ---------- Docs PDF toolbar ---------- */
.pdf-bar { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.pdf-label { color: var(--muted); font-size: .82rem; font-weight: 700; }
.pdf-label i { color: var(--nbcu-red); margin-right: 4px; }
.btn.sm { padding: 5px 11px; font-size: .8rem; text-decoration: none; }
@media print { .no-print { display: none !important; } }

/* ---------- Job search ---------- */
.search { margin-bottom: 10px; font-size: .88rem; }

/* ---------- Progress line ---------- */
.progress-line { display: flex; align-items: center; gap: 10px; font-size: .85rem; color: var(--muted); margin: 8px 0; }
.progress-line .bar { flex: 1; height: 6px; border-radius: 4px; background: var(--bg-3); overflow: hidden; }
.progress-line .fill { height: 100%; background: var(--uphe-purple-light); width: 0%; transition: width .4s; }

/* ---------- Result preview tables ---------- */
.preview { margin-top: 16px; }
.preview h3 { color: var(--accent); font-size: 1rem; margin: 18px 0 8px; }
.ptable { width: 100%; border-collapse: collapse; font-size: .8rem; }
.ptable th { background: var(--uphe-purple); color: #fff; text-align: left; padding: 6px 8px; position: sticky; top: 0; }
.ptable th[data-tip] { cursor: help; }  /* headers with a purpose tooltip */
.col-tip { position: fixed; z-index: 1000; max-width: 280px; background: var(--bg-3); color: var(--text);
  border: 1px solid var(--uphe-purple); border-radius: 6px; padding: 7px 10px; font-size: .78rem;
  font-weight: 400; line-height: 1.35; box-shadow: 0 8px 24px rgba(0,0,0,.3); pointer-events: none; }
.col-tip.hidden { display: none; }
/* Source-file viewer modal (booking parser) */
.src-modal { width: min(1500px, 96vw); height: 90vh; max-width: none; padding: 0; overflow: hidden; }
.src-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 9px 12px 9px 14px; background: var(--uphe-purple); color: #fff;
  border-radius: 13px 13px 0 0; font-weight: 600; flex: 0 0 auto; }
.src-bar .src-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.src-bar .src-actions { display: flex; gap: 8px; flex: 0 0 auto; }
.src-bar .btn.ghost { color: #fff; border-color: rgba(255,255,255,.55); }
.src-frame { flex: 1 1 auto; width: 100%; border: 0; background: var(--bg); border-radius: 0 0 13px 13px; }
.src-link { color: var(--uphe-purple-light); text-decoration: underline; cursor: pointer; }
.ptable td { padding: 5px 8px; border-bottom: 1px solid var(--border); }
.ptable tr:nth-child(even) td { background: var(--bg-2); }
.ptable-wrap { max-height: 340px; overflow-y: auto; border: 1px solid var(--border); border-radius: 8px; }
.brief { background: var(--bg-2); border-left: 3px solid var(--uphe-purple-light); border-radius: 8px;
  padding: 12px 16px; line-height: 1.6; white-space: pre-wrap; }

/* ---------- Review modal: editable chips + sheet picks ---------- */
.digest .pill.edit { cursor: pointer; user-select: none; }
.digest .pill.edit:hover { background: var(--uphe-purple-light); color: #fff; }
.digest .dhint { color: var(--muted); font-size: .74rem; margin-top: 4px; }
.sheet-picks { display: flex; gap: 12px; margin-bottom: 12px; }
.sheet-picks label { flex: 1; font-size: .8rem; color: var(--muted); display: flex; flex-direction: column; gap: 4px; }

/* ---------- OAuth login ---------- */
.sso-login { display: flex; flex-direction: column; gap: 8px; text-align: center; }
.sso-login #sso-btn { display: flex; align-items: center; gap: 10px; justify-content: center; text-decoration: none; }
.sso-login .hint { color: var(--muted); font-size: .8rem; margin: 0; }
.login-divider::before, .login-divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }

/* ---------- Nav footer: user email + icon-only sign-out, pinned to the bottom ---------- */
/* The tool wrappers must carry flex:1 so the footer stays anchored regardless of content. */
#nav-compare { flex: 1; display: flex; flex-direction: column; min-height: 0; }
#nav-compare .job-list { flex: 1; min-height: 0; }
.nav-user {
  display: flex; align-items: center; gap: 8px; flex-shrink: 0;
  border-top: 1px solid var(--border); margin-top: 10px; padding: 10px 4px 2px;
}
.user-email {
  flex: 1; color: var(--muted); font-size: .8rem;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* admin "act as" — active-impersonation banner at the top of the main column */
.impersonation-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  background: var(--nbcu-yellow); color: #1a1a2e; font-size: .9rem; font-weight: 600;
  padding: 9px 16px; border-radius: 10px; margin: 0 0 16px;
}
.impersonation-banner .btn { flex-shrink: 0; background: #1a1a2e; color: #fff; border-color: #1a1a2e; }
.impersonation-banner .btn:hover { background: #000; border-color: #000; color: #fff; }

/* plan review: "reusing your approved plan" note */
.reuse-note {
  background: var(--bg-3); border: 1px solid var(--uphe-purple-light); border-radius: 8px;
  padding: 10px 12px; margin: 0 0 14px; font-size: .86rem; color: var(--text); line-height: 1.45;
}
.reuse-note i { color: var(--accent); margin-right: 6px; }

/* ---------- docs cost explorer ---------- */
.cx { border: 1px solid var(--border); border-radius: 12px; padding: 16px; margin: 18px 0; background: var(--bg-2); }
.cx-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.cx-tab { border: 1px solid var(--border); background: var(--bg); color: var(--text);
  padding: 7px 14px; border-radius: 999px; cursor: pointer; font-size: .85rem; }
.cx-tab.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.cx-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-bottom: 12px; }
.cx-card { background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; }
.cx-card.warn { border-color: color-mix(in srgb, var(--nbcu-red) 45%, var(--border)); }
.cx-n { font-size: 1.3rem; font-weight: 700; color: var(--text); }
.cx-card.warn .cx-n { color: var(--nbcu-red); }
.cx-l { font-size: .75rem; color: var(--muted); margin-top: 2px; }
.cx-chart svg { width: 100%; height: auto; display: block; }
.cxg { stroke: var(--border); stroke-width: 1; }
.cxa { fill: var(--muted); font-size: 11px; }
.cxfail { fill: var(--nbcu-red); opacity: .07; }
.cxline.us { stroke: var(--accent); stroke-width: 3; }
.cxline.them { stroke: var(--nbcu-red); stroke-width: 2.5; fill: none; stroke-dasharray: 1 0; }
.cxlab.us { fill: var(--accent); font-size: 12px; font-weight: 700; }
.cxlab.them { fill: var(--nbcu-red); font-size: 12px; font-weight: 700; }
.cxdot.us { fill: var(--accent); }
.cxdot.them { fill: var(--nbcu-red); }
.cx-slider { display: block; margin: 10px 2px 4px; font-size: .85rem; color: var(--text); }
.cx-slider input { width: 100%; margin-top: 6px; accent-color: var(--accent); }
.cx-note { font-size: .78rem; color: var(--muted); margin: 10px 2px 0; }
@media (max-width: 700px) { .cx-cards { grid-template-columns: 1fr; } }

/* ---------- self-running demo overlay ---------- */
#demo-cursor {
  position: fixed; left: 50%; top: 50%; z-index: 100000; pointer-events: none;
  transform: translate(-3px, -3px);
  transition: left .58s cubic-bezier(.4, 0, .2, 1), top .58s cubic-bezier(.4, 0, .2, 1);
  filter: drop-shadow(0 2px 6px rgba(64, 0, 149, .55));
}
#demo-cursor svg { display: block; }
#demo-cursor.press { transform: translate(-3px, -3px) scale(.8); }
#demo-cursor.wave { animation: demo-wave .5s ease-in-out 3; transition: none; }
@keyframes demo-wave {
  0%, 100% { transform: translate(-3px, -3px) rotate(-9deg); }
  50% { transform: translate(-3px, -3px) rotate(11deg); }
}
#demo-caption {
  position: fixed; left: 50%; bottom: 32px; transform: translateX(-50%); z-index: 100000;
  max-width: min(760px, 86vw); pointer-events: none; text-align: center;
  /* 80% transparent so the UI underneath shows through, blurred for legibility + a sense of depth */
  background: rgba(13, 7, 40, .2);
  -webkit-backdrop-filter: blur(7px) saturate(1.1); backdrop-filter: blur(7px) saturate(1.1);
  color: #fff; border: 1px solid rgba(255, 255, 255, .22);
  padding: 12px 20px; border-radius: 12px; font-size: 1rem; line-height: 1.45;
  text-shadow: 0 1px 4px rgba(0, 0, 0, .75); box-shadow: 0 10px 34px rgba(0, 0, 0, .35);
}
.demo-pulse { animation: demo-press .55s ease-out; }
@keyframes demo-press {
  0% { box-shadow: 0 0 0 0 rgba(110, 84, 220, .55); }
  100% { box-shadow: 0 0 0 18px rgba(110, 84, 220, 0); }
}
.demo-glow {
  outline: 3px solid var(--uphe-purple-light); outline-offset: 2px; border-radius: 8px;
  box-shadow: 0 0 0 6px rgba(110, 84, 220, .18); transition: box-shadow .2s;
}
#demo-btn.demo-on { color: #fff; background: var(--accent); }
/* faux dropdown the demo opens to reveal a native <select>'s options (which can't be opened by script) */
#demo-menu {
  position: fixed; z-index: 99990; pointer-events: none;
  background: var(--bg-2); border: 1px solid var(--border); border-radius: 10px;
  padding: 5px; box-shadow: 0 14px 40px rgba(0, 0, 0, .3);
  transform-origin: top center; animation: demo-menu-in .16s ease-out;
}
#demo-menu.hidden { display: none; }
#demo-menu .demo-menu-item {
  padding: 8px 14px; border-radius: 7px; color: var(--text); font-size: .95rem; white-space: nowrap;
}
#demo-menu .demo-menu-item.hot { background: var(--accent); color: #fff; }
@keyframes demo-menu-in {
  from { opacity: 0; transform: translateY(-6px) scale(.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ---------- Chat & AI interfaces (design-system layer) -------------------- */
/* Assistant replies are plain full-width markdown; user turns sit in a light bubble, right-aligned. */
.chat { max-width: 760px; margin: 0 auto; display: flex; flex-direction: column; height: 100%; position: relative; }
.msg-list { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 20px; padding: 8px 4px 24px; }
.msg { font-size: .95rem; line-height: 1.6; }
.msg.user { align-self: flex-end; max-width: 78%; background: var(--bg-2); border: 1px solid var(--border);
  border-radius: 16px; padding: 10px 14px; }
.msg.assistant { align-self: stretch; max-width: 100%; color: var(--text); }
.msg.assistant > :first-child { margin-top: 0; }
.msg.assistant > :last-child { margin-bottom: 0; }
.msg.assistant p { margin: 0 0 12px; }
.msg.assistant ul, .msg.assistant ol { margin: 0 0 12px; padding-left: 22px; }
.msg.assistant a { color: var(--accent); text-decoration: underline; }
.msg code { background: var(--bg-2); border: 1px solid var(--border); border-radius: 5px; padding: 1px 6px;
  font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .85em; }
.code-block { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; margin: 0 0 12px; background: var(--bg-2); }
.code-block .code-head { display: flex; align-items: center; justify-content: space-between;
  padding: 6px 10px; background: var(--bg-3); font-size: .74rem; color: var(--muted); }
.code-block .code-head .lang { text-transform: uppercase; letter-spacing: .04em; font-weight: 700; }
.code-block .code-copy { border: 0; background: transparent; color: var(--muted); cursor: pointer;
  font-size: .74rem; display: inline-flex; gap: 5px; align-items: center; }
.code-block .code-copy:hover { color: var(--accent); }
.code-block pre { margin: 0; padding: 12px 14px; overflow-x: auto; color: var(--text);
  font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .82rem; line-height: 1.5; }
.code-block pre code { background: none; border: 0; padding: 0; }
.reasoning { border: 1px solid var(--border); border-radius: 10px; background: var(--bg-2); margin: 0 0 12px; overflow: hidden; }
.reasoning summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: 8px;
  padding: 9px 12px; font-size: .82rem; font-weight: 600; color: var(--muted); }
.reasoning summary::-webkit-details-marker { display: none; }
.reasoning summary .chev { transition: transform .2s; }
.reasoning[open] summary .chev { transform: rotate(90deg); }
.reasoning .reasoning-body { padding: 0 12px 12px; font-size: .86rem; color: var(--muted); line-height: 1.55; }
.msg-actions { display: flex; gap: 4px; margin-top: 8px; opacity: 0; transition: opacity .15s; }
.msg.assistant:hover .msg-actions, .msg-actions:focus-within { opacity: 1; }
.msg-actions button { border: 0; background: transparent; color: var(--muted); cursor: pointer; padding: 5px; border-radius: 6px; font-size: .82rem; }
.msg-actions button:hover { color: var(--accent); background: var(--bg-2); }
.suggestions { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
.suggestion { border: 1px solid var(--border); background: var(--bg); color: var(--text); border-radius: 999px;
  padding: 7px 14px; font-size: .85rem; cursor: pointer; }
.suggestion:hover { border-color: var(--uphe-purple-light); background: var(--bg-2); color: var(--accent); }
.composer { border: 1px solid var(--border); background: var(--bg); border-radius: 16px; padding: 10px 12px;
  display: flex; flex-direction: column; gap: 8px; }
.composer:focus-within { border-color: var(--uphe-purple-light); box-shadow: 0 0 0 3px rgba(110,84,220,.15); }
.composer textarea { border: 0; background: transparent; resize: none; width: 100%; color: var(--text);
  font-family: var(--font); font-size: .95rem; line-height: 1.5; outline: none; max-height: 200px; }
.composer .composer-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.composer .composer-bar .left { display: flex; gap: 4px; }
.composer .send { width: 34px; height: 34px; border-radius: 999px; border: 0; background: var(--uphe-purple);
  color: #fff; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.composer .send:hover { background: var(--uphe-purple-light); }
.composer .send:disabled { background: var(--muted); cursor: not-allowed; opacity: .6; }
.typing { display: inline-flex; gap: 4px; align-items: center; padding: 4px 0; }
.typing span { width: 6px; height: 6px; border-radius: 50%; background: var(--uphe-purple-light); animation: typing-dot 1.2s infinite ease-in-out; }
.typing span:nth-child(2) { animation-delay: .18s; }
.typing span:nth-child(3) { animation-delay: .36s; }
@keyframes typing-dot { 0%, 60%, 100% { transform: translateY(0); opacity: .5; } 30% { transform: translateY(-4px); opacity: 1; } }
.source-chip { display: inline-flex; align-items: center; gap: 5px; font-size: .75rem; color: var(--muted);
  background: var(--bg-2); border: 1px solid var(--border); border-radius: 999px; padding: 2px 9px; text-decoration: none; }
.tool-call { border: 1px solid var(--border); border-left: 3px solid var(--uphe-purple-light); border-radius: 8px;
  background: var(--bg-2); padding: 8px 12px; font-size: .82rem; color: var(--muted); margin: 0 0 12px; }
.tool-call .tool-name { color: var(--text); font-weight: 600; }

/* ---------------------------------------------------------------- A2A tool ---
   Two panes side by side: the agent-to-agent transcript, and a human console
   pointed at the same NBCU agent.  Stacks on narrow screens. */
.a2a-split { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 14px; align-items: start; }
@media (max-width: 1100px) { .a2a-split { grid-template-columns: 1fr; } }

.a2a-pane { border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-2);
  display: flex; flex-direction: column; min-height: 340px; max-height: 62vh; }
.a2a-pane-h { display: flex; align-items: center; gap: 8px; padding: 10px 14px;
  border-bottom: 1px solid var(--border); font-size: .85rem; font-weight: 600; color: var(--text); }
.a2a-pane-h i { color: var(--uphe-purple-light); }
.a2a-state { margin-left: auto; font-weight: 500; font-size: .75rem; color: var(--muted);
  border: 1px solid var(--border); border-radius: 999px; padding: 2px 10px; background: var(--bg); }

.a2a-thread { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 12px; }
.a2a-empty { color: var(--muted); font-size: .85rem; line-height: 1.6; margin: 0; }

.a2a-msg { border: 1px solid var(--border); border-radius: 10px; background: var(--bg); padding: 10px 13px; }
.a2a-msg .who { font-size: .72rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  display: flex; align-items: center; gap: 6px; margin-bottom: 5px; }
.a2a-msg .bd { font-size: .88rem; line-height: 1.55; color: var(--text); white-space: pre-wrap; }
.a2a-msg.pv { border-left: 3px solid var(--nbcu-blue); }
.a2a-msg.pv .who { color: var(--nbcu-blue); }
.a2a-msg.nbcu { border-left: 3px solid var(--uphe-purple); }
.a2a-msg.nbcu .who { color: var(--uphe-purple-light); }
.a2a-msg.human { border-left: 3px solid var(--muted); }
.a2a-msg.human .who { color: var(--muted); }
.a2a-msg.sys { background: var(--bg-2); border-style: dashed; }
.a2a-msg.sys .bd { color: var(--muted); font-size: .82rem; }
.a2a-intent { margin-left: auto; font-weight: 500; text-transform: none; letter-spacing: 0;
  font-size: .72rem; color: var(--muted); }

/* What the agent looked up before it spoke — the grounding record. */
.a2a-tools { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 6px; }
.a2a-tool { font-size: .72rem; color: var(--muted); background: var(--bg-2);
  border: 1px solid var(--border); border-radius: 999px; padding: 2px 9px; cursor: default; }
.a2a-tool.err { color: var(--nbcu-red); border-color: var(--nbcu-red); }
.a2a-ungrounded { font-size: .72rem; color: var(--nbcu-red); margin-top: 6px; }

.a2a-envelope { margin: 0 14px; padding: 10px 12px; border: 1px solid var(--border);
  border-radius: 8px; background: var(--bg); font-size: .8rem; color: var(--muted); }
.a2a-envelope b { color: var(--text); }
.a2a-envelope .gt { text-transform: uppercase; letter-spacing: .04em; font-size: .72rem;
  color: var(--uphe-purple-light); font-weight: 700; }

.a2a-ask { display: flex; gap: 8px; padding: 10px 14px; border-top: 1px solid var(--border); }
.a2a-ask input { flex: 1; }
.a2a-ask .btn { padding: 8px 14px; }

.a2a-transition { align-self: center; font-size: .74rem; color: var(--muted); }
.a2a-transition b { color: var(--accent); }
/* The title picker holds full film names — give it the room the two selects beside it don't need. */
.a2a-title-field { flex: 2 1 320px; min-width: 0; }
.a2a-title-field select { width: 100%; text-overflow: ellipsis; }
/* Loading affordances: anything still fetching says so rather than sitting blank. */
.a2a-spinner { display: inline-block; width: 11px; height: 11px; vertical-align: -1px;
  border: 2px solid var(--border); border-top-color: var(--uphe-purple-light);
  border-radius: 50%; animation: a2a-spin .7s linear infinite; margin-right: 6px; }
@keyframes a2a-spin { to { transform: rotate(360deg); } }
select.a2a-loading { color: var(--muted); font-style: italic; }
/* Caret while a message types in — twAppend toggles `.typing` on the message element. */
.a2a-msg.typing .bd::after { content: "▏"; margin-left: 1px; color: var(--uphe-purple-light);
  animation: tw-caret .7s step-end infinite; }
select:disabled, .native:disabled { opacity: .65; cursor: progress; }

/* "Agent is thinking" dots. Own class, not the shared `.typing` used by the composer —
   that one is display:inline-flex and would reflow a whole message bubble. */
.a2a-dots { display: inline-flex; gap: 5px; align-items: center; padding: 3px 0; }
.a2a-dots span { width: 6px; height: 6px; border-radius: 50%; background: var(--uphe-purple-light);
  animation: a2a-dot 1.2s infinite ease-in-out; }
.a2a-dots span:nth-child(2) { animation-delay: .18s; }
.a2a-dots span:nth-child(3) { animation-delay: .36s; }
@keyframes a2a-dot { 0%, 60%, 100% { transform: translateY(0); opacity: .45; }
                     30% { transform: translateY(-4px); opacity: 1; } }
.a2a-msg.a2a-pending { opacity: .8; }
/* twAppend tags the message with `.typing` for the caret; the shared `.typing` rule is
   inline-flex, which would collapse the bubble mid-type. Keep it a block. */
.a2a-msg.typing { display: block; }
/* Inline rename: the input takes the heading's place, so it should read like the heading. */
#a2a-name { font-size: 1.15rem; font-weight: 600; padding: 4px 10px; min-width: 320px; max-width: 100%; }

/* Human approval gate — the only route from a conversation to a real edit, and it stops
   here until a person decides. Styled to stand out from the agents' turns. */
.a2a-msg.a2a-approval, .a2a-msg.a2a-approval-done {
  border-left: 3px solid var(--nbcu-yellow); background: var(--bg-2);
}
.a2a-approval .who, .a2a-approval-done .who { color: var(--nbcu-yellow); }
.a2a-prop { margin-bottom: 4px; }
.a2a-why { margin-top: 6px; color: var(--muted); font-size: .84rem; }
.a2a-approve-bar { display: flex; gap: 8px; align-items: center; margin-top: 10px; flex-wrap: wrap; }
.a2a-approve-bar input { flex: 1 1 160px; min-width: 0; }
.a2a-approve-bar .btn { padding: 6px 12px; font-size: .85rem; }
.a2a-decided { font-size: .85rem; }
.a2a-decided.ok { color: var(--nbcu-green); }
.a2a-decided.no { color: var(--nbcu-red); }

/* ===== Deck Builder =====
   The panel is an editor, not a form, so its feedback lives inline: the autosave badge
   changes state as you type, drop zones become spinners while a file uploads, and the
   embedded preview sits below the console showing the deck as it currently stands. */
.hint-inline { font-weight: 400; font-size: .78rem; color: var(--muted); }

/* Audience: three cards rather than a select, because the choice changes the whole deck
   and the difference between the three is worth reading before you pick one. */
.dk-aud { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 10px; }
.dk-aud-opt {
  display: flex; flex-direction: column; gap: 5px; text-align: left; cursor: pointer;
  padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--bg); color: var(--text); font: inherit; transition: border-color .15s, background .15s;
  /* WebAwesome's native.css styles bare buttons for a one-line label: nowrap sends the
     description off the side of the card, align-items centers it, and the fixed height clips
     it. These options are prose in a card, so all three are overridden here. */
  white-space: normal; overflow-wrap: anywhere; min-width: 0;
  align-items: stretch; height: auto;
}
.dk-aud-opt:hover { border-color: var(--uphe-purple-light); background: var(--bg-2); }
.dk-aud-opt .t { font-weight: 600; font-size: .92rem; }
.dk-aud-opt .t i { color: var(--muted); margin-right: 6px; }
.dk-aud-opt .d { font-size: .78rem; color: var(--muted); line-height: 1.45; }
.dk-aud-opt.on { border-color: var(--uphe-purple); background: var(--bg-3); box-shadow: inset 0 0 0 1px var(--uphe-purple); }
.dk-aud-opt.on .t, .dk-aud-opt.on .t i { color: var(--accent); }

.dk-slides-head { display: flex; align-items: center; gap: 12px; }
.dk-slides-head label { flex: 0 0 auto; }
.dk-slides-head .hint { flex: 1; }
.dk-empty, .dk-loading { color: var(--muted); font-size: .86rem; padding: 18px 4px; margin: 0;
  border: 1px dashed var(--border); border-radius: var(--radius); text-align: center; }

/* Slide tiles — the main interface. Order is the running order, so the grip and the number
   are the two things that must read instantly. */
/* Three tiles per row on a 1080p window, dropping to two and then one as it narrows.
   auto-fill + minmax does the whole thing without breakpoints: at the ~1560px main area a
   1080p screen gives, 420px minimum columns land on three. min(420px, 100%) keeps a single
   column from overflowing a very narrow window. */
.dk-tiles { display: grid; gap: 12px; align-items: start;
  grid-template-columns: repeat(auto-fill, minmax(min(420px, 100%), 1fr)); }
.dk-tile { border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-2);
  padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
/* The add-tile sits in the flow where the next slide would go, so a long deck doesn't send you
   back to the top to add one. */
.dk-tile-add { align-items: center; justify-content: center; gap: 6px; cursor: pointer;
  border-style: dashed; background: transparent; color: var(--muted); font: inherit;
  min-height: 120px; white-space: normal; height: auto; transition: border-color .15s, color .15s; }
.dk-tile-add:hover { border-color: var(--uphe-purple-light); color: var(--accent); background: var(--bg-2); }
.dk-tile-add i { font-size: 1.5rem; }
/* Upload feedback belongs on the tile being uploaded to, not only in the header badge. */
.dk-mstatus { margin: 0; font-size: .78rem; line-height: 1.45; }
.dk-mstatus-busy { color: var(--muted); }
.dk-mstatus-ok { color: var(--nbcu-green); }
.dk-mstatus-error { color: var(--nbcu-red); }
.dk-mstatus-info { color: var(--muted); }
.dk-ref-error { margin: 6px 0 0; font-size: .8rem; color: var(--nbcu-red); line-height: 1.45; }
.dk-tile.dragging { opacity: .5; border-color: var(--uphe-purple-light); }
.dk-tile-bar { display: flex; align-items: center; gap: 8px; }
.dk-grip { cursor: grab; color: var(--muted); padding: 2px 4px; touch-action: none; }
.dk-grip:active { cursor: grabbing; }
.dk-tile:hover .dk-grip { color: var(--accent); }
.dk-tile-n { flex: 0 0 auto; min-width: 22px; height: 22px; line-height: 22px; text-align: center;
  border-radius: 11px; background: var(--uphe-purple); color: #fff; font-size: .74rem; font-weight: 700; }
.dk-tile-name { flex: 1; min-width: 0; font-weight: 600; }
.dk-tile-del:hover { color: var(--nbcu-red); }
.dk-tile-desc { min-height: 84px; font-size: .86rem; }

/* Per-tile media zone. Visuals only — the caption states the caps up front so a rejection
   is never the first time you hear about them. */
.dk-mdrop {
  border: 1px dashed var(--border); border-radius: 8px; padding: 9px 12px; cursor: pointer;
  color: var(--muted); font-size: .8rem; text-align: center; transition: border-color .15s, background .15s;
}
.dk-mdrop:hover, .dk-mdrop.drag { border-color: var(--uphe-purple-light); color: var(--accent); background: var(--bg); }
.dk-mdrop.uploading { border-style: solid; border-color: var(--uphe-purple-light); color: var(--text); cursor: progress; }
.dk-mcap { display: block; font-size: .72rem; opacity: .8; margin-top: 2px; }
.dk-mlist { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.dk-mlist:empty { display: none; }
.dk-mlist li { display: flex; align-items: center; gap: 6px; max-width: 260px;
  background: var(--bg); border: 1px solid var(--border); border-radius: 20px; padding: 3px 6px 3px 10px; font-size: .78rem; }
.dk-mlist li .fi { color: var(--uphe-purple-light); }
.dk-mlist li .fn { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dk-mlist li .fx { color: var(--muted); cursor: pointer; border: 0; background: transparent; padding: 2px; }
.dk-mlist li .fx:hover { color: var(--nbcu-red); }
.dk-size { color: var(--muted); font-size: .75rem; flex: 0 0 auto; }
.drop.uploading { border-style: solid; border-color: var(--uphe-purple-light); cursor: progress; }

/* The autosave badge reuses `.saved` but carries four states, because a brief that saves
   silently is indistinguishable from one that failed to save. */
.saved.dk-save-pending { color: var(--muted); opacity: 1; }
.saved.dk-save-saving { color: var(--nbcu-yellow); opacity: 1; }
.saved.dk-save-saved { color: var(--nbcu-green); }
.saved.dk-save-error { color: var(--nbcu-red); opacity: 1; }

/* Embedded preview: the produced deck as a PDF, always the current build. */
.dk-preview { margin-top: 18px; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.dk-preview-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 8px 12px; background: var(--bg-2); border-bottom: 1px solid var(--border); }
.dk-preview-bar .ttl { font-weight: 600; font-size: .88rem; color: var(--accent); }
.dk-preview-bar .btn { margin-left: auto; padding: 4px 10px; font-size: .8rem; }
.dk-preview-note { color: var(--muted); font-size: .78rem; }
.dk-preview-frame { display: block; width: 100%; height: 620px; border: 0; background: var(--bg-3); }
.dk-preview-none { padding: 22px 16px; color: var(--muted); font-size: .86rem; text-align: center; }
.dk-preview-none i { color: var(--uphe-purple-light); margin-right: 6px; }

/* Template missing: the tool cannot build anything, so say so at the top of the run bar
   rather than letting someone invest a whole brief and fail at Generate. */
.dk-unavailable {
  display: flex; gap: 10px; align-items: flex-start; margin: 4px 0 14px;
  padding: 12px 14px; border-radius: var(--radius); font-size: .86rem; line-height: 1.5;
  background: var(--st-red); color: #7a0020; border: 1px solid var(--nbcu-red);
}
.dk-unavailable i { margin-top: 2px; }

/* A dependency outage is not a logout. This replaces the sign-in screen that used to appear
   for any boot failure, which invited people to re-enter credentials during an outage. */
.outage { display: flex; align-items: center; justify-content: center; height: 100vh; background: var(--bg-2); }
.outage-card {
  width: 460px; padding: 32px; border-radius: 14px; background: var(--bg);
  border: 1px solid var(--border); box-shadow: 0 12px 40px rgba(64, 0, 149, .12);
  display: flex; flex-direction: column; gap: 14px; text-align: center;
}
.outage-card .plate { background: var(--plate); border-radius: 10px; padding: 16px; }
.outage-card .plate img { width: 100%; height: auto; display: block; }
.outage-card h1 { font-size: 1.1rem; margin: 4px 0 0; color: var(--accent); }
.outage-card p { margin: 0; color: var(--muted); font-size: .88rem; line-height: 1.55; }
.outage-detail { font-family: ui-monospace, Consolas, monospace; font-size: .78rem !important;
  background: var(--bg-2); border-radius: 8px; padding: 8px 10px; word-break: break-word; }
.outage-card .btn { align-self: center; }
