/* ============================================================
   NICO — Call block module (renderer/call.html)

   Four columns inside the shipped window shell:
     #sidebar (shell chrome) | #queue | #cockpit | #nrail
   plus a status-bar footer.

   HONESTY NOTE (this drives the visual language):
   Nico does NOT place calls. There is no telephony in the Salestools
   MCP — no dial tool, no audio, no live transcription, no recording.
   So this module has:
     · a DEVICE HANDOFF button (a real tel: link) — never an in-app call
     · a LIVE NOTES pad the rep types into — never a diarised transcript
     · pre-loaded objection cards the rep pins — never speech detection
     · a "match a number" box — never a fabricated inbound ring
   Nothing here may imply audio Nico cannot hear.

   TOKENS: shipped nico.css vocabulary only, so all three themes
   (dark / light / sierra) work. The source design's tokens map as:
     --gate      -> --run          (the shipped "attention" ramp)
     --gate-dim  -> --run-dim
     --line-hi   -> --line-bright
     --err-dim   -> --call-err-dim (declared below, per theme)
   ============================================================ */

:root { --call-err-dim: oklch(0.690 0.190 25 / 0.14); }
[data-theme="light"]  { --call-err-dim: oklch(0.580 0.200 25 / 0.12); }
[data-theme="sierra"] { --call-err-dim: oklch(0.560 0.200 28 / 0.12); }

/* ============================================================
   PAGE SHELL — four columns + a status bar row
   ============================================================ */
body.call-page { overflow: hidden; }
body.call-page #window { grid-template-rows: 46px minmax(0, 1fr) 26px; }

#body.call-mode {
  grid-template-columns: var(--sidebar-w, 228px) 292px minmax(0, 1fr) 320px;
  min-height: 0;
}
/* narrower windows: drop the Nico rail, then squeeze the queue */
@media (max-width: 1240px) {
  #body.call-mode { grid-template-columns: var(--sidebar-w, 228px) 276px minmax(0, 1fr) 0; }
  #nrail { display: none; }
}
@media (max-width: 1000px) {
  #body.call-mode { grid-template-columns: 0 250px minmax(0, 1fr) 0; }
  #sidebar { display: none; }
}

/* the mode rail on this page navigates between pages, so the tabs are links */
.mode-rail a.mode-tab { text-decoration: none; }

/* titlebar breadcrumb + back pill — same look as the other sibling pages, declared
   here so call.html doesn't have to pull in the whole settings stylesheet */
.tl-center .crumb {
  display: flex; align-items: center; gap: 8px;
  font-family: var(--mono); font-size: 11.5px; color: var(--text-3);
  -webkit-app-region: no-drag;
}
.tl-center .crumb a { color: var(--text-3); text-decoration: none; transition: color .12s; }
.tl-center .crumb a:hover { color: var(--text); }
.tl-center .crumb .sep { color: var(--text-4); }
.tl-center .crumb .here { color: var(--text); font-weight: 500; }
.back-pill {
  display: flex; align-items: center; gap: 7px; height: 28px; padding: 0 12px 0 9px;
  background: var(--surface-2); border: 0.5px solid var(--line); border-radius: 8px;
  font-family: var(--mono); font-size: 11.5px; color: var(--text-2);
  text-decoration: none; -webkit-app-region: no-drag; transition: all .12s;
}
.back-pill:hover { background: var(--hover); color: var(--text); border-color: var(--line-bright); }
.back-pill svg { width: 13px; height: 13px; }

/* ---- status bar ---- */
#statusbar {
  display: flex; align-items: center; gap: 14px;
  height: 26px; padding: 0 14px;
  border-top: 0.5px solid var(--line);
  background: linear-gradient(180deg, var(--bg), var(--surface-1));
  font-family: var(--mono); font-size: 10px; color: var(--text-4);
  overflow: hidden; white-space: nowrap;
}
#statusbar .sb-i { display: inline-flex; align-items: center; gap: 6px; flex: none; }
#statusbar .sb-i b { color: var(--text-2); font-weight: 500; }
#statusbar .sb-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--text-4); flex: none; }
#statusbar .sb-dot.on { background: var(--ok); box-shadow: 0 0 6px oklch(0.805 0.15 150 / 0.5); }
#statusbar .sb-dot.warn { background: var(--run); }
#statusbar .sb-sp { flex: 1; }
#statusbar .sb-note { overflow: hidden; text-overflow: ellipsis; min-width: 0; }

/* ============================================================
   SIDEBAR EXTRAS — number matcher, connector state, block recap
   ============================================================ */
.cs-block { padding: 9px 10px 4px; }
.cs-hint { font-size: 10.5px; line-height: 1.5; color: var(--text-4); padding: 0 6px; }
.cs-field { display: flex; gap: 6px; padding: 0 6px; }
.cs-field input {
  flex: 1; min-width: 0; height: 30px; padding: 0 9px;
  background: var(--surface-2); border: 0.5px solid var(--line); border-radius: 8px;
  color: var(--text); font-family: var(--mono); font-size: 11.5px;
}
.cs-field input:focus { outline: none; border-color: var(--accent-line); }
.cs-mini {
  height: 30px; padding: 0 10px; flex: none; cursor: pointer;
  background: var(--surface-2); border: 0.5px solid var(--line-bright); border-radius: 8px;
  color: var(--text-2); font-family: var(--mono); font-size: 11px;
}
.cs-mini:hover { color: var(--accent-text); border-color: var(--accent-line); }
.cs-mini:disabled { opacity: 0.5; cursor: default; }
.cs-result { padding: 7px 6px 0; font-family: var(--mono); font-size: 10.5px; color: var(--text-3); line-height: 1.55; }
.cs-result .bad { color: var(--err); }
.cs-hit {
  display: block; width: 100%; text-align: left; margin-top: 5px; cursor: pointer;
  background: var(--surface-2); border: 0.5px solid var(--line); border-radius: 8px;
  padding: 7px 9px; color: var(--text-2); font-family: var(--sans); font-size: 12px;
}
.cs-hit:hover { border-color: var(--accent-line); color: var(--text); }
.cs-hit span { display: block; font-family: var(--mono); font-size: 10px; color: var(--text-4); margin-top: 2px; }
.cs-recap { display: flex; flex-wrap: wrap; gap: 6px 14px; padding: 4px 6px 0; }
.cs-recap div { font-family: var(--mono); font-size: 10px; color: var(--text-4); }
.cs-recap b { display: block; font-size: 15px; color: var(--text); font-weight: 600; letter-spacing: -0.01em; }

/* ============================================================
   QUEUE RAIL
   ============================================================ */
#queue {
  display: flex; flex-direction: column; min-height: 0;
  background: var(--surface-1);
  border-right: 0.5px solid var(--line);
}
.q-head { flex: none; padding: 11px 12px 9px; border-bottom: 0.5px solid var(--line-soft); }
.q-head h2 {
  font-family: var(--mono); font-size: 11px; font-weight: 600;
  letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-4);
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.q-head .q-reload {
  background: none; border: 0; padding: 2px 4px; border-radius: 5px; cursor: pointer;
  color: var(--text-4); font-family: var(--mono); font-size: 10px;
}
.q-head .q-reload:hover { color: var(--accent-text); background: var(--surface-2); }
.q-agent {
  width: 100%; margin-top: 8px; height: 30px; padding: 0 8px;
  background: var(--surface-2); border: 0.5px solid var(--line); border-radius: 8px;
  color: var(--text); font-family: var(--sans); font-size: 12.5px;
}
.q-agent:focus { outline: none; border-color: var(--accent-line); }
.q-src { margin-top: 6px; font-family: var(--mono); font-size: 10px; color: var(--text-4); line-height: 1.5; }

/* 4-up stat grid */
.q-st { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--line-soft); flex: none; }
.q-st > div { background: var(--surface-1); padding: 9px 11px; }
.q-st .v { font-family: var(--mono); font-size: 17px; font-weight: 600; color: var(--text); letter-spacing: -0.01em; line-height: 1.1; }
.q-st .v small { font-size: 11px; color: var(--text-4); font-weight: 500; }
.q-st .k { font-family: var(--mono); font-size: 9.5px; color: var(--text-4); margin-top: 3px; letter-spacing: 0.02em; }
.q-st .k i { font-style: normal; color: var(--text-3); }
.q-cap {
  flex: none; padding: 7px 12px 8px; font-size: 10.5px; line-height: 1.5;
  color: var(--text-4); border-bottom: 0.5px solid var(--line-soft);
}

/* auto-advance toggle */
.q-auto {
  flex: none; display: flex; align-items: center; gap: 9px;
  padding: 9px 12px; border-bottom: 0.5px solid var(--line-soft);
  font-size: 11.5px; color: var(--text-3); cursor: pointer;
}
.q-auto .sw {
  width: 30px; height: 17px; border-radius: 9px; flex: none; position: relative;
  background: var(--surface-3); border: 0.5px solid var(--line); transition: background 0.15s;
}
.q-auto .sw::after {
  content: ""; position: absolute; top: 1.5px; left: 2px;
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--text-4); transition: transform 0.15s, background 0.15s;
}
.q-auto.on .sw { background: var(--accent-dim); border-color: var(--accent-line); }
.q-auto.on .sw::after { transform: translateX(13px); background: var(--accent); }

.q-scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 6px 8px 20px; overscroll-behavior: contain; }
.q-sec {
  font-family: var(--mono); font-size: 9.5px; font-weight: 600;
  letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-4);
  padding: 10px 6px 5px; display: flex; justify-content: space-between;
}

.qrow {
  display: grid; grid-template-columns: 18px 22px minmax(0, 1fr) auto;
  gap: 8px; align-items: center;
  padding: 7px 7px; border-radius: var(--r-md); cursor: pointer;
  border: 0.5px solid transparent; background: transparent;
  text-align: left; width: 100%; font: inherit; color: inherit;
}
.qrow:hover { background: var(--surface-2); }
.qrow .qi { font-family: var(--mono); font-size: 10px; color: var(--text-4); text-align: right; }
.qrow .qt {
  width: 22px; height: 22px; border-radius: 7px; display: grid; place-items: center;
  background: var(--surface-3); border: 0.5px solid var(--line);
  font-family: var(--mono); font-size: 10px; font-weight: 700; color: var(--text-3);
}
.qrow .qn { min-width: 0; }
.qrow .qn b { display: block; font-size: 12.5px; font-weight: 500; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.qrow .qn span { display: block; font-family: var(--mono); font-size: 10px; color: var(--text-4); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }
.qrow .qr { text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: 3px; }
.qrow .qsc { font-family: var(--mono); font-size: 11px; color: var(--text-3); }
.qtag {
  font-family: var(--mono); font-size: 9px; letter-spacing: 0.02em;
  padding: 1.5px 6px; border-radius: 5px; background: var(--surface-3); color: var(--text-4);
  white-space: nowrap;
}
.qtag.ok { background: var(--ok-dim); color: var(--ok); }
.qtag.att { background: var(--run-dim); color: var(--run); }
.qtag.bad { background: var(--call-err-dim); color: var(--err); }

.qrow.on { border-color: var(--accent-line); background: var(--accent-dim); }
.qrow.on .qt { background: var(--accent); color: var(--on-accent); border-color: transparent; }
.qrow.done { opacity: 0.5; }
.qrow.nophone { opacity: 0.62; }
/* a row with a prospect id but no lead id: nothing to open, nothing to write to,
   so it is rendered as a plain div — not a button that would lie about being live */
.qrow.nolead { cursor: default; opacity: 0.55; }
.qrow.nolead:hover { background: transparent; }
.qrow.live .qtag { animation: callPulse 1.5s ease-in-out infinite; }
@keyframes callPulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }

/* ============================================================
   COCKPIT
   ============================================================ */
#cockpit { display: flex; flex-direction: column; min-height: 0; background: var(--bg); border-right: 0.5px solid var(--line); position: relative; }

/* ---- empty / gate states ---- */
.cp-idle {
  flex: 1; min-height: 0; display: none;
  flex-direction: column; align-items: center; justify-content: center;
  gap: 10px; padding: 30px 40px; text-align: center;
}
.cp-idle.show { display: flex; }
.cp-idle .mark {
  width: 42px; height: 42px; border-radius: 12px;
  border: 1px dashed var(--line-bright); display: grid; place-items: center;
  color: var(--text-4);
}
.cp-idle h3 { font-size: 14.5px; font-weight: 600; color: var(--text-2); }
.cp-idle p { font-size: 12.5px; color: var(--text-4); max-width: 380px; line-height: 1.6; }
.cp-idle .acts { display: flex; gap: 8px; margin-top: 4px; flex-wrap: wrap; justify-content: center; }

/* ---- head ---- */
.cp-live { flex: 1; min-height: 0; display: none; flex-direction: column; }
.cp-live.show { display: flex; }

.cp-head {
  flex: none; display: grid; grid-template-columns: 42px minmax(0, 1fr) auto;
  gap: 12px; align-items: start;
  padding: 13px 16px 12px; border-bottom: 0.5px solid var(--line-soft);
}
.cp-av {
  width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center;
  background: var(--surface-2); border: 0.5px solid var(--line);
  font-family: var(--mono); font-size: 14px; font-weight: 700; color: var(--text-2);
}
.cp-id { min-width: 0; }
.cp-id .nm { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cp-id .nm b { font-size: 16px; font-weight: 600; color: var(--text); letter-spacing: -0.01em; }
.cp-chip {
  font-family: var(--mono); font-size: 9.5px; padding: 2px 7px; border-radius: 6px;
  background: var(--surface-3); color: var(--text-3); white-space: nowrap;
}
.cp-chip.acc { background: var(--accent-dim); color: var(--accent-text); }
.cp-id .sub { font-family: var(--mono); font-size: 11px; color: var(--text-4); margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cp-phone { display: flex; align-items: center; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.cp-phone .num { font-family: var(--mono); font-size: 14px; font-weight: 500; color: var(--text); letter-spacing: 0.01em; }
.cp-phone .none { font-family: var(--mono); font-size: 11.5px; color: var(--run); }
.prov {
  display: inline-flex; align-items: center; gap: 5px;
  font-family: var(--mono); font-size: 9px; color: var(--text-4);
  border: 0.5px solid var(--line); border-radius: 20px; padding: 2px 7px; background: var(--surface-2);
}
.prov i { width: 5px; height: 5px; border-radius: 50%; background: var(--text-4); flex: none; }
.prov.src i { background: var(--ok); }

.cp-state { text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.st-chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--mono); font-size: 10px; color: var(--text-3);
  border: 0.5px solid var(--line); border-radius: 20px; padding: 3px 9px; background: var(--surface-2);
}
.st-chip i { width: 6px; height: 6px; border-radius: 50%; background: var(--text-4); }
.st-chip.handoff { color: var(--run); border-color: var(--line-bright); background: var(--run-dim); }
.st-chip.handoff i { background: var(--run); animation: callPulse 1.5s infinite; }
.st-chip.notes { color: var(--accent-text); border-color: var(--accent-line); background: var(--accent-dim); }
.st-chip.notes i { background: var(--accent); }
.st-chip.logged { color: var(--ok); background: var(--ok-dim); border-color: var(--line); }
.st-chip.logged i { background: var(--ok); }
.cp-timer { font-family: var(--mono); font-size: 26px; font-weight: 600; color: var(--text); letter-spacing: -0.02em; line-height: 1; }
.cp-timer.idle { color: var(--text-4); }
.cp-dev { font-family: var(--mono); font-size: 9.5px; color: var(--text-4); }

/* ---- stepper ---- */
.cp-steps {
  flex: none; display: flex; align-items: center; gap: 0;
  padding: 10px 16px; border-bottom: 0.5px solid var(--line-soft); background: var(--surface-1);
}
.cp-steps .nd { display: flex; align-items: center; gap: 6px; flex: none; }
.cp-steps .nd i {
  width: 15px; height: 15px; border-radius: 50%; flex: none;
  border: 1.2px solid var(--line-bright); background: var(--surface-2);
  display: grid; place-items: center; font-family: var(--mono); font-size: 8px; color: var(--text-4);
  font-style: normal;
}
.cp-steps .nd span { font-family: var(--mono); font-size: 10px; color: var(--text-4); white-space: nowrap; }
.cp-steps .nd.done i { background: var(--ok); border-color: transparent; color: var(--bg); }
.cp-steps .nd.done span { color: var(--text-3); }
.cp-steps .nd.on i { background: var(--accent); border-color: transparent; color: var(--on-accent); box-shadow: 0 0 0 3px var(--accent-dim); }
.cp-steps .nd.on span { color: var(--text); }
.cp-steps .bar { flex: 1; height: 1px; background: var(--line); margin: 0 8px; min-width: 8px; }
.cp-steps .bar.done { background: var(--ok); opacity: 0.55; }

/* ---- scrolling card column ---- */
.cp-body { flex: 1; min-height: 0; overflow-y: auto; padding: 14px 16px 18px; overscroll-behavior: contain; display: flex; flex-direction: column; gap: 12px; }

.card { background: var(--surface-1); border: 0.5px solid var(--line); border-radius: var(--r-lg); padding: 13px 14px; }
.card.hot { border-color: var(--accent-line); background: linear-gradient(180deg, var(--accent-dim), transparent 62%), var(--surface-1); }
.card.warn { border-color: var(--line-bright); }
.card-h { display: flex; align-items: baseline; gap: 9px; margin-bottom: 10px; flex-wrap: wrap; }
.ct { font-family: var(--mono); font-size: 10.5px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-2); }
.cm { font-family: var(--mono); font-size: 10px; color: var(--text-4); }
.csrc {
  margin-left: auto; display: inline-flex; align-items: center; gap: 5px; flex-wrap: wrap;
  font-family: var(--mono); font-size: 9px; color: var(--text-4);
}
.csrc b {
  font-weight: 500; border: 0.5px solid var(--line); border-radius: 20px;
  padding: 1.5px 7px; background: var(--surface-2); color: var(--text-3);
}
.cempty { font-size: 12px; color: var(--text-4); line-height: 1.6; }
.cempty b { color: var(--text-3); font-weight: 500; }

/* ---- talk track ---- */
.tt-row {
  display: grid; grid-template-columns: 74px minmax(0, 1fr) auto; gap: 10px;
  padding: 9px 0; border-top: 0.5px solid var(--line-soft);
}
.tt-row:first-of-type { border-top: 0; padding-top: 2px; }
.tt-k { font-family: var(--mono); font-size: 9.5px; color: var(--text-4); text-transform: uppercase; letter-spacing: 0.04em; padding-top: 2px; }
.tt-t { font-size: 13px; color: var(--text); line-height: 1.5; }
.tt-w { font-size: 11.5px; color: var(--text-3); line-height: 1.5; margin-top: 3px; }
.tt-s { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.tt-s .tag { font-family: var(--mono); font-size: 9px; padding: 1.5px 6px; border-radius: 5px; background: var(--surface-3); color: var(--text-3); white-space: nowrap; }

/* ---- objections ---- */
.obj {
  border: 0.5px solid var(--line); border-left: 2px solid var(--run);
  border-radius: var(--r-md); background: var(--surface-2);
  padding: 9px 11px; margin-top: 8px;
}
.obj:first-of-type { margin-top: 0; }
.obj.pin { border-left-color: var(--accent); background: var(--accent-dim); }
.obj-h { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.obj-h b { font-size: 12.5px; font-weight: 500; color: var(--text); flex: 1; min-width: 0; }
.obj-pin {
  background: none; border: 0; cursor: pointer; padding: 1px 5px; border-radius: 5px;
  font-family: var(--mono); font-size: 9px; color: var(--text-4);
}
.obj-pin:hover { color: var(--accent-text); background: var(--surface-3); }
.obj.pin .obj-pin { color: var(--accent-text); }
.obj-b { display: none; margin-top: 8px; }
.obj.open .obj-b { display: block; }
.obj-say {
  font-size: 12.5px; color: var(--text); line-height: 1.6;
  border-left: 2px solid var(--line-bright); padding: 2px 0 2px 10px; font-style: italic;
}
.obj-note { font-size: 11.5px; color: var(--text-3); margin-top: 7px; line-height: 1.5; }

/* ---- data record ---- */
.rec-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px 16px; }
.rec-f { min-width: 0; }
.rec-f.wide { grid-column: 1 / -1; }
.rec-f .k { font-family: var(--mono); font-size: 9.5px; color: var(--text-4); text-transform: uppercase; letter-spacing: 0.04em; }
.rec-f .v { font-size: 12.5px; color: var(--text-2); margin-top: 2px; overflow-wrap: anywhere; }
.rec-f .v.dim { color: var(--text-4); font-style: italic; }
.rec-f .v a { color: var(--accent-text); text-decoration: none; }
.rec-f .v a:hover { text-decoration: underline; }

.cad { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 12px; padding-top: 11px; border-top: 0.5px solid var(--line-soft); }
.cad .lbl { font-family: var(--mono); font-size: 9.5px; color: var(--text-4); text-transform: uppercase; letter-spacing: 0.04em; margin-right: 3px; }
.cad-dot {
  font-family: var(--mono); font-size: 9.5px; padding: 2px 8px; border-radius: 20px;
  background: var(--surface-2); border: 0.5px solid var(--line); color: var(--text-4); white-space: nowrap;
}
.cad-dot.done { color: var(--ok); border-color: var(--line); }
.cad-dot.now { background: var(--accent-dim); border-color: var(--accent-line); color: var(--accent-text); }

/* ---- activity timeline ---- */
.tl-row { display: grid; grid-template-columns: 30px 9px minmax(0, 1fr); gap: 8px; }
.tl-row .when { font-family: var(--mono); font-size: 9.5px; color: var(--text-4); text-align: right; padding-top: 5px; }
.tl-row .ln { position: relative; }
.tl-row .ln::before { content: ""; position: absolute; left: 4px; top: 0; bottom: 0; width: 1px; background: var(--line); }
.tl-row:first-child .ln::before { top: 7px; }
.tl-row:last-child .ln::before { bottom: auto; height: 7px; }
.tl-row .ln i { position: absolute; left: 1px; top: 6px; width: 7px; height: 7px; border-radius: 50%; background: var(--text-4); border: 0.5px solid var(--bg); }
.tl-row .ln i.call { background: var(--run); }
.tl-row .ln i.email { background: var(--info); }
.tl-row .ln i.note { background: var(--accent); }
.tl-row .bd { padding: 2px 0 9px; min-width: 0; }
.tl-row .bd b { display: block; font-size: 12.5px; font-weight: 450; color: var(--text-2); line-height: 1.5; overflow-wrap: anywhere; }
.tl-row .bd span { font-family: var(--mono); font-size: 9.5px; color: var(--text-4); }

/* ---- stack + competitors ---- */
.tchips { display: flex; flex-wrap: wrap; gap: 6px; }
.tchip {
  font-family: var(--mono); font-size: 10px; padding: 3px 9px; border-radius: 20px;
  background: var(--surface-2); border: 0.5px solid var(--line); color: var(--text-3);
}
.cmp { display: flex; align-items: baseline; gap: 9px; padding: 7px 0; border-top: 0.5px solid var(--line-soft); }
.cmp:first-of-type { border-top: 0; }
.cmp b { font-size: 12.5px; font-weight: 500; color: var(--text); flex: none; }
.cmp span { font-size: 11.5px; color: var(--text-3); line-height: 1.5; }

/* ---- idle CTA strip ---- */
.cta-strip {
  display: flex; align-items: center; gap: 11px; flex-wrap: wrap;
  padding: 13px 14px; border-radius: var(--r-lg);
  border: 0.5px dashed var(--line-bright); background: var(--surface-1);
}
.cta-strip .txt { flex: 1; min-width: 180px; }
.cta-strip .txt b { display: block; font-size: 13px; color: var(--text); font-weight: 500; }
.cta-strip .txt span { display: block; font-size: 11.5px; color: var(--text-4); margin-top: 2px; line-height: 1.5; }

.callbtn {
  display: inline-flex; align-items: center; gap: 8px; flex: none;
  height: 34px; padding: 0 15px; border-radius: 10px; cursor: pointer;
  background: var(--accent); color: var(--on-accent); border: 0.5px solid transparent;
  font-family: var(--mono); font-size: 12px; font-weight: 600; text-decoration: none;
  box-shadow: 0 2px 12px var(--accent-dim);
}
.callbtn:hover { filter: brightness(1.06); }
.callbtn:active { transform: translateY(1px); }
.callbtn.red { background: transparent; color: var(--err); border-color: var(--err); box-shadow: none; }
.callbtn.red:hover { background: var(--call-err-dim); }
.callbtn.ghost { background: transparent; color: var(--text-2); border-color: var(--line-bright); box-shadow: none; }
.callbtn.ghost:hover { color: var(--accent-text); border-color: var(--accent-line); }
.callbtn[aria-disabled="true"], .callbtn:disabled { opacity: 0.45; pointer-events: none; }
/* display:inline-flex would otherwise beat the UA [hidden] rule */
.callbtn[hidden], .cp-chip[hidden] { display: none !important; }

/* ---- wrap-up ---- */
.disp { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.dbtn {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
  padding: 9px 11px; border-radius: var(--r-md); cursor: pointer; text-align: left;
  background: var(--surface-2); border: 0.5px solid var(--line); color: var(--text-2);
  font-family: var(--sans); font-size: 12.5px;
}
.dbtn small { font-family: var(--mono); font-size: 9.5px; color: var(--text-4); }
.dbtn:hover { border-color: var(--line-bright); color: var(--text); }
.dbtn.on { background: var(--accent); border-color: transparent; color: var(--on-accent); }
.dbtn.on small { color: var(--on-accent); opacity: 0.8; }
.dbtn.bad:hover { border-color: var(--err); color: var(--err); background: var(--call-err-dim); }
.dbtn.bad.on { background: var(--err); border-color: transparent; color: oklch(0.99 0 0); }
.dbtn.bad.on small { color: oklch(0.99 0 0); opacity: 0.85; }

.notes-blk { margin-top: 11px; }
.notes-blk label { display: block; font-family: var(--mono); font-size: 9.5px; color: var(--text-4); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 5px; }
.notes-blk textarea, .tr textarea {
  width: 100%; resize: vertical; min-height: 66px;
  background: var(--surface-2); border: 0.5px solid var(--line); border-radius: var(--r-md);
  padding: 9px 11px; color: var(--text); font-family: var(--sans); font-size: 12.5px; line-height: 1.6;
}
.notes-blk textarea:focus, .tr textarea:focus { outline: none; border-color: var(--accent-line); }
.fu-row { display: flex; align-items: center; gap: 8px; margin-top: 9px; flex-wrap: wrap; }
.fu-row label { font-family: var(--mono); font-size: 10px; color: var(--text-3); }
.fu-row input[type="date"] {
  height: 30px; padding: 0 9px; background: var(--surface-2);
  border: 0.5px solid var(--line); border-radius: 8px; color: var(--text);
  font-family: var(--mono); font-size: 11.5px;
}
.fu-row input[type="date"]:focus { outline: none; border-color: var(--accent-line); }

.log-wrap { margin-top: 12px; padding-top: 11px; border-top: 0.5px solid var(--line-soft); }
.log-r { display: flex; align-items: baseline; gap: 9px; padding: 4px 0; font-family: var(--mono); font-size: 11px; }
.log-r .lk { color: var(--text-4); min-width: 118px; flex: none; }
.log-r .lv { color: var(--text-2); overflow-wrap: anywhere; }
.log-r .lv.add { color: var(--ok); }
.wrap-acts { display: flex; align-items: center; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.wrap-msg { font-family: var(--mono); font-size: 10.5px; color: var(--text-3); }
.wrap-msg.bad { color: var(--err); }
.wrap-msg.ok { color: var(--ok); }

/* ============================================================
   NOTES PAD (never a transcript) + CONTROL BAR + KEYPAD
   ============================================================ */
.tr {
  flex: none; max-height: 200px; overflow-y: auto;
  border-top: 0.5px solid var(--line); background: var(--surface-1);
  padding: 10px 16px 12px;
}
.tr-h { display: flex; align-items: center; gap: 9px; margin-bottom: 7px; flex-wrap: wrap; }
.tr-h b { font-family: var(--mono); font-size: 10px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-2); }
.tr-h .why { font-size: 10.5px; color: var(--text-4); }
.tr-h .saved { margin-left: auto; font-family: var(--mono); font-size: 9.5px; color: var(--text-4); }

.cbar {
  flex: none; display: flex; align-items: center; gap: 7px; flex-wrap: wrap;
  padding: 10px 16px; border-top: 0.5px solid var(--line); background: var(--bg);
}
.cbtn {
  display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 11px;
  border-radius: 20px; cursor: pointer; background: var(--surface-2);
  border: 0.5px solid var(--line); color: var(--text-3);
  font-family: var(--mono); font-size: 11px;
}
.cbtn:hover { color: var(--text); border-color: var(--line-bright); }
.cbtn.on { background: var(--accent-dim); border-color: var(--accent-line); color: var(--accent-text); }
.cbtn:disabled { opacity: 0.45; cursor: default; }
.cbar .hint { margin-left: auto; font-family: var(--mono); font-size: 9.5px; color: var(--text-4); text-align: right; max-width: 300px; line-height: 1.45; }

.pad {
  position: absolute; right: 16px; bottom: 56px; z-index: 20; display: none;
  width: 208px; padding: 11px; border-radius: var(--r-lg);
  background: var(--surface-1); border: 0.5px solid var(--line-bright);
  box-shadow: 0 18px 44px oklch(0.10 0.01 264 / 0.42);
}
.pad.on { display: block; }
.pad .disp-n {
  height: 32px; display: flex; align-items: center; justify-content: space-between; gap: 6px;
  padding: 0 10px; margin-bottom: 9px; border-radius: 8px;
  background: var(--surface-2); border: 0.5px solid var(--line);
  font-family: var(--mono); font-size: 13px; color: var(--text);
}
.pad .disp-n em { font-style: normal; color: var(--text-4); font-size: 11px; }
.pad .keys { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.pad .keys button {
  height: 32px; border-radius: 8px; cursor: pointer;
  background: var(--surface-2); border: 0.5px solid var(--line); color: var(--text);
  font-family: var(--mono); font-size: 13px;
}
.pad .keys button:hover { background: var(--hover); }
.pad .pacts { display: flex; flex-direction: column; gap: 6px; margin-top: 9px; }
.pad .pacts .callbtn, .pad .pacts .cbtn { width: 100%; justify-content: center; }
.pad .pnote { font-size: 10px; color: var(--text-4); line-height: 1.5; margin-top: 8px; }
.pad .pres { font-family: var(--mono); font-size: 10px; color: var(--text-3); margin-top: 7px; line-height: 1.5; }

/* ============================================================
   NICO RAIL
   ============================================================ */
#nrail { display: flex; flex-direction: column; min-height: 0; background: var(--surface-1); overflow: hidden; }
.nr-head { flex: none; display: flex; align-items: center; gap: 9px; padding: 11px 13px; border-bottom: 0.5px solid var(--line-soft); }
.nr-av {
  width: 24px; height: 24px; border-radius: 7px; display: grid; place-items: center; flex: none;
  background: var(--accent-dim); color: var(--accent-text); border: 0.5px solid var(--accent-line);
}
.nr-head .who { min-width: 0; }
.nr-head .who b { display: block; font-family: var(--mono); font-size: 12px; font-weight: 600; color: var(--text); }
.nr-head .who span { display: block; font-family: var(--mono); font-size: 9.5px; color: var(--text-4); }

.nr-scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 12px 13px 16px; overscroll-behavior: contain; }
.nr-p { font-size: 12.5px; color: var(--text-2); line-height: 1.62; margin-bottom: 11px; overflow-wrap: anywhere; }
.nr-p.dim { color: var(--text-4); }
/* streamed answers are rendered with textContent — never parsed as HTML */
.nr-p.ans { white-space: pre-wrap; border-left: 2px solid var(--accent-line); padding-left: 9px; }
.nr-p.ans.err { border-left-color: var(--err); color: var(--err); }
.nr-q { font-family: var(--mono); font-size: 10.5px; color: var(--text-4); margin: 10px 0 4px; overflow-wrap: anywhere; }
.nr-p b { color: var(--text); font-weight: 600; }

.nr-oplog { margin: 4px 0 12px; }
.nr-op { display: flex; align-items: baseline; gap: 7px; padding: 3px 0; font-family: var(--mono); font-size: 10px; }
.nr-op .g { flex: none; color: var(--ok); width: 9px; }
.nr-op .g.bad { color: var(--err); }
.nr-op .g.run { color: var(--run); }
.nr-op .fn { color: var(--text-2); overflow-wrap: anywhere; }
.nr-op .nt { margin-left: auto; color: var(--text-4); text-align: right; flex: none; padding-left: 8px; max-width: 55%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.nr-card { background: var(--surface-2); border: 0.5px solid var(--line); border-radius: var(--r-md); padding: 10px 11px; margin-bottom: 10px; }
.nr-card > .t { font-family: var(--mono); font-size: 9.5px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-4); margin-bottom: 7px; }
.nr-krow { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; padding: 2.5px 0; font-family: var(--mono); font-size: 10.5px; }
.nr-krow .k { color: var(--text-4); }
.nr-krow .v { color: var(--text-2); text-align: right; overflow-wrap: anywhere; }
.nr-why { margin-top: 8px; display: flex; flex-direction: column; gap: 5px; }
.nr-why div { font-size: 11.5px; color: var(--text-3); line-height: 1.5; padding-left: 12px; position: relative; }
.nr-why div::before { content: "·"; position: absolute; left: 3px; color: var(--text-4); }

.nr-foot { flex: none; border-top: 0.5px solid var(--line-soft); padding: 10px 13px 12px; }
.nr-box { display: flex; gap: 6px; }
.nr-box input {
  flex: 1; min-width: 0; height: 32px; padding: 0 10px;
  background: var(--surface-2); border: 0.5px solid var(--line); border-radius: 9px;
  color: var(--text); font-size: 12.5px;
}
.nr-box input:focus { outline: none; border-color: var(--accent-line); }
.nr-box button {
  height: 32px; padding: 0 12px; flex: none; cursor: pointer; border-radius: 9px;
  background: var(--accent); color: var(--on-accent); border: 0.5px solid transparent;
  font-family: var(--mono); font-size: 11.5px; font-weight: 600;
}
.nr-box button:disabled { opacity: 0.5; cursor: default; }
.qk { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.qk button {
  cursor: pointer; padding: 4px 9px; border-radius: 20px;
  background: var(--surface-2); border: 0.5px solid var(--line); color: var(--text-3);
  font-family: var(--mono); font-size: 10px;
}
.qk button:hover { color: var(--accent-text); border-color: var(--accent-line); }
.qk button:disabled { opacity: 0.5; cursor: default; }
.nr-note { font-size: 10px; color: var(--text-4); margin-top: 8px; line-height: 1.5; }

/* ============================================================
   SHARED — banners, gates, toasts
   ============================================================ */
.cbanner {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 11px 13px; border-radius: var(--r-md);
  border: 0.5px solid var(--line-bright); background: var(--surface-2);
  font-size: 12px; color: var(--text-3); line-height: 1.55;
}
.cbanner.warn { border-color: var(--run); background: var(--run-dim); color: var(--text-2); }
.cbanner.err { border-color: var(--err); background: var(--call-err-dim); color: var(--text-2); }
.cbanner b { color: var(--text); font-weight: 600; display: block; margin-bottom: 2px; }
.cbanner .acts { margin-top: 8px; display: flex; gap: 7px; flex-wrap: wrap; }

.q-empty, .nr-empty { padding: 16px 12px; font-size: 12px; color: var(--text-4); line-height: 1.6; }
.q-empty b { display: block; color: var(--text-3); font-size: 12.5px; margin-bottom: 4px; }

#callToast {
  position: fixed; left: 50%; bottom: 46px; transform: translateX(-50%) translateY(10px);
  z-index: 200; opacity: 0; pointer-events: none; transition: opacity 0.16s, transform 0.16s;
  background: var(--surface-3); border: 0.5px solid var(--line-bright); border-radius: 10px;
  padding: 8px 14px; font-family: var(--mono); font-size: 11.5px; color: var(--text);
  box-shadow: 0 12px 34px oklch(0.10 0.01 264 / 0.35); max-width: 70vw; text-align: center;
}
#callToast.on { opacity: 1; transform: translateX(-50%) translateY(0); }

/* full-page gate (signed out / bridge too old) */
#callGate {
  position: absolute; inset: 46px 0 26px; z-index: 40; display: none;
  align-items: center; justify-content: center; padding: 40px;
  background: var(--bg); text-align: center;
}
#callGate.show { display: flex; }
#callGate .inner { max-width: 420px; }
#callGate h3 { font-size: 16px; color: var(--text); margin-bottom: 7px; }
#callGate p { font-size: 13px; color: var(--text-3); line-height: 1.65; margin-bottom: 14px; }

/* light + sierra: the elevated popovers need a lighter shadow than the dark default */
[data-theme="light"] .pad, [data-theme="sierra"] .pad { box-shadow: 0 18px 40px oklch(0.45 0.03 60 / 0.18); }
[data-theme="light"] #callToast, [data-theme="sierra"] #callToast { box-shadow: 0 12px 30px oklch(0.45 0.03 60 / 0.18); }
