/* ═══════════════════════════════════════════════════════════════
   ImagineX Agentic Session Canvas — canvas-specific styles.
   BRIGHT THEME: light surfaces, dark text for legibility. Loads
   AFTER the brand stylesheet.css and overrides its dark voice-card
   styling. Accent is a muted olive-green ramp (not the brand neon
   #CCFB55, which reads garish on white): solid --green fills carry
   white text; --green-mid handles borders, dots and focus accents.
   ═══════════════════════════════════════════════════════════════ */
:root {
  --green:      #567300;   /* primary green — solid fills, white text on top (5.45:1) */
  --green-deep: #46600a;   /* borders on solid-green fills */
  --green-mid:  #86a615;   /* accents: borders, dots, focus rings, flow gradient */
  --cyan-ink:   #0c7489;   /* Voice AI actor (text-safe cyan) */
  --amber-ink:  #955400;   /* API unavailable / degraded (text-safe) */
  --err:        #c62828;
  --ink:        #171a14;   /* primary text */
  --dim:        #4d5546;   /* secondary text */
  --faint:      #626b58;   /* labels / captions (still ≥4.5:1 on white) */
  --bg:         #f2f4ea;   /* page background */
  --card:       #ffffff;
  --line:       #e0e5d4;   /* card borders */
  --mono:       "Cascadia Code", "SF Mono", Consolas, monospace;
}

html, body {
  background: var(--bg);
  color: var(--ink);
  font-family: "Outfit", outfit, sans-serif;
  font-weight: 400;   /* brand stylesheet sets 300 (Outfit Light) — too thin on white */
  min-height: 100%;
}
/* reserve the scrollbar gutter so column widths don't shift as page height
   crosses the viewport (transcripts growing/shrinking made widgets "breathe") */
html { scrollbar-gutter: stable; }
body {
  background: linear-gradient(160deg, #f7f9f0 0%, #f2f4ea 45%, #eaeedd 100%) fixed;
}
* { box-sizing: border-box; }
button { font-family: inherit; }

/* stylesheet.css forces ::placeholder to solid black — restore a muted but
   WCAG-passing placeholder (≥4.5:1 on white) for every input on this page */
::placeholder { color: var(--faint); opacity: 1; }
::-ms-input-placeholder { color: var(--faint); }

/* stylesheet.css hides the page scrollbar (width 0) and keeps #000/#222
   dark-theme colors — restore a visible light scrollbar */
#style-6::-webkit-scrollbar { width: 10px; height: 10px; background: transparent; }
#style-6::-webkit-scrollbar-track { background: transparent; -webkit-box-shadow: none; }
#style-6::-webkit-scrollbar-thumb { background-color: rgba(0,0,0,0.22); border-radius: 5px; }

/* ───────────────────────── Top bar ───────────────────────── */
.cv-topbar {
  position: relative; overflow: hidden;
  border-bottom: 1px solid var(--line);
  background: #ffffff;
}
.cv-topbar-inner {
  position: relative; z-index: 1;
  display: flex; align-items: center; justify-content: space-between; gap: 18px;
  flex-wrap: wrap;
  max-width: 1560px; margin: 0 auto; padding: 16px 28px;
}
.cv-brand { display: flex; align-items: center; gap: 16px; }
.cv-logo { height: 38px; width: auto; display: block; }
.cv-title h1 { margin: 0; font-size: 19px; font-weight: 600; letter-spacing: .01em; color: var(--ink); }
.cv-title p { margin: 2px 0 0; font-size: 12.5px; color: var(--faint); font-weight: 400; }

.cv-session { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.cv-picker-label { font-size: 12px; color: var(--faint); }
.cv-picker {
  background: #fff; color: var(--ink);
  border: 1px solid #cfd6c0; border-radius: 50px;
  padding: 8px 16px; font-size: 13px; cursor: pointer; max-width: 320px;
  transition: border-color .2s;
}
.cv-picker:hover { border-color: var(--green); }
.cv-picker:focus { outline: none; border-color: var(--green); box-shadow: 0 0 0 3px rgba(134,166,21,0.15); }
.cv-status {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 12.5px; color: var(--dim);
  border: 1px solid var(--line); border-radius: 50px; padding: 7px 14px;
  background: #fafbf5;
}
.cv-status-dot {
  width: 8px; height: 8px; border-radius: 50%; background: #a9b19c;
  transition: background .3s, box-shadow .3s;
}
.cv-status.live .cv-status-dot { background: var(--green-mid); box-shadow: 0 0 8px rgba(134,166,21,0.6); animation: cvBlink 1.4s infinite; }
.cv-status.err .cv-status-dot { background: var(--err); box-shadow: 0 0 8px rgba(198,40,40,0.5); }
@keyframes cvBlink { 0%,100% { opacity: 1; } 50% { opacity: .35; } }

/* ───────────────────── Session Spine ─────────────────────── */
.cv-spine-wrap { max-width: 1560px; margin: 0 auto; padding: 22px 28px 4px; }
.cv-spine {
  display: flex; align-items: flex-start;
  background: var(--card);
  border: 1px solid var(--line); border-radius: 24px;
  padding: 22px 30px 18px;
  box-shadow: 0 8px 24px rgba(46,64,10,0.06);
}
.spine-node {
  flex: 1 1 0; min-width: 70px;
  display: flex; flex-direction: column; align-items: center; text-align: center;
  transition: opacity .3s;
}
.sp-ic {
  width: 52px; height: 52px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: #f3f5ec; border: 1.5px solid #dde3cf;
  transition: background .3s, border-color .3s, box-shadow .3s, transform .3s;
}
.sp-ic svg { width: 23px; height: 23px; color: #8b937d; transition: color .3s; }
.sp-label { margin-top: 9px; font-size: 12.5px; font-weight: 500; color: var(--dim); white-space: nowrap; }
.sp-actor { margin-top: 3px; font-size: 10.5px; font-weight: 400; color: var(--faint); letter-spacing: .03em; white-space: nowrap; }
.sp-actor[data-actor="voice"] { color: var(--cyan-ink); }
.sp-actor[data-actor="system"] { color: var(--green); }

.spine-conn {
  flex: 0 1 90px; height: 2px; margin-top: 25px;
  background: #dde3cf; border-radius: 2px; position: relative; overflow: hidden;
}
.spine-conn.conn-flow::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, var(--green-mid), transparent);
  animation: connFlow 1.4s linear infinite;
}
@keyframes connFlow { from { transform: translateX(-100%); } to { transform: translateX(100%); } }
@keyframes connFlowV { from { transform: translateY(-100%); } to { transform: translateY(100%); } }

/* dim only the icon when locked — a blanket opacity drops the labels below
   readable contrast on white */
.spine-node.locked .sp-ic { opacity: .55; }
.spine-node.locked .sp-label,
.spine-node.locked .sp-actor,
.spine-node.locked .sp-actor[data-actor] { color: #6b7263; }
.spine-node.active .sp-ic {
  border-color: var(--green-mid); background: rgba(134,166,21,0.14);
  box-shadow: 0 0 0 6px rgba(134,166,21,0.18);
  animation: spPulse 2s ease-in-out infinite;
}
.spine-node.active .sp-ic svg { color: #3c5200; }
.spine-node.active .sp-label { color: var(--ink); font-weight: 600; }
@keyframes spPulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.07); } }
.spine-node.done .sp-ic { background: var(--green); border-color: var(--green-deep); }
.spine-node.done .sp-ic svg { color: #fff; }
.spine-node.warning .sp-ic {
  border-color: #e0a33c; background: #fdf1dc;
  box-shadow: 0 0 0 6px rgba(224,163,60,0.18);
}
.spine-node.warning .sp-ic svg { color: var(--amber-ink); }
.spine-node.warning .sp-label { color: var(--amber-ink); }

/* ─────────────────────── Canvas grid ─────────────────────── */
/* two widgets per row: EHR + Ledger (left) · Benefits + Live Call (right) */
.cv-grid {
  display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 20px;
  max-width: 1320px; margin: 0 auto; padding: 18px 28px 46px;
  align-items: start;
}
.cv-col { display: flex; flex-direction: column; gap: 20px; min-width: 0; }

.cvcard {
  background: var(--card);
  border: 1px solid var(--line); border-radius: 24px;
  padding: 20px 22px 22px; position: relative; overflow: hidden;
  box-shadow: 0 8px 24px rgba(46,64,10,0.06);
}
.cvcard-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  flex-wrap: wrap; margin-bottom: 14px;
}
.cvcard-head h2 { margin: 0; font-size: 15px; font-weight: 600; letter-spacing: .02em; color: var(--ink); }

/* source pill (EHR · Athena, Patient line…) */
.src-pill {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 11px; font-weight: 600; letter-spacing: .04em;
  color: #44610a; background: #eff8d3;
  border: 1px solid #c8dd83; border-radius: 50px; padding: 5px 12px;
  white-space: nowrap;
}
.src-pill .src-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green-mid); }
.src-pill.cyan { color: #085e70; background: #e0f3f7; border-color: #9fd4de; }
.src-pill.cyan .src-dot { background: var(--cyan-ink); }
.src-pill.amber { color: #8a4f00; background: #fdf1dc; border-color: #ecc27a; }
.src-pill.amber .src-dot { background: #d98e14; }

/* mono API trace line */
.trace {
  font-family: var(--mono); font-size: 11px; color: var(--faint);
  background: #f4f6ec; border: 1px solid var(--line); border-radius: 10px;
  padding: 8px 12px; margin-bottom: 14px;
  white-space: nowrap; overflow-x: auto;
}
.trace::-webkit-scrollbar { height: 4px; }
.trace::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.18); border-radius: 3px; }
.trace.ok { color: #45660a; border-color: #c8dd83; background: #f4fbe2; }
.trace.warn { color: var(--amber-ink); border-color: #ecc27a; background: #fdf6e7; }
.trace.err { color: var(--err); border-color: #f0b4ae; background: #fdefed; }

/* buttons */
.btn {
  display: inline-flex; align-items: center; gap: 8px; justify-content: center;
  border-radius: 50px; padding: 10px 18px; font-size: 13px; font-weight: 500;
  cursor: pointer; transition: transform .2s, box-shadow .2s, background .2s, border-color .2s, color .2s;
  border: 1px solid transparent;
}
.btn svg { width: 16px; height: 16px; }
.btn.ghost { background: #fff; border-color: #cfd6c0; color: #333a2c; }
.btn.ghost:hover { border-color: var(--green); color: var(--ink); background: #fafcf3; }
/* class is named "lime" in the markup; the fill is the muted green */
.btn.lime { background: var(--green); color: #fff; font-weight: 600; border-color: var(--green-deep); }
.btn.lime:hover { transform: translateY(-2px); box-shadow: 0 10px 22px rgba(86,115,0,0.28); }
.btn.cyan { background: #e6f5f8; border-color: #8fcbd7; color: #085e70; font-weight: 600; }
.btn.cyan:hover { background: var(--cyan-ink); border-color: var(--cyan-ink); color: #fff; }
.btn.danger { background: #fff; border-color: #e0a6a2; color: #b3261e; font-weight: 600; }
.btn.danger:hover { background: var(--err); border-color: var(--err); color: #fff; transform: translateY(-2px); box-shadow: 0 10px 22px rgba(198,40,40,0.22); }
.btn.sm { padding: 6px 13px; font-size: 11.5px; }
.btn.wide { width: 100%; margin-top: 14px; }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none !important; box-shadow: none !important; }
.btn.busy { position: relative; pointer-events: none; opacity: .7; }

/* ─────────────────── EHR Patient Record ──────────────────── */
.ehr-card { border-color: #cfe190; }
.ehr-card::before {
  content: ""; position: absolute; top: -40%; right: -20%;
  width: 320px; height: 320px; pointer-events: none;
  background: radial-gradient(circle, rgba(134,166,21,0.12), transparent 65%);
}
.ehr-card > * { position: relative; }

.ehr-fields { margin: 0; display: flex; flex-direction: column; }
.ehr-row {
  display: flex; align-items: baseline; justify-content: space-between; gap: 14px;
  padding: 8px 2px; border-bottom: 1px dashed #e4e8d8;
}
.ehr-row:last-child { border-bottom: none; }
.ehr-row dt { font-size: 11.5px; color: var(--faint); font-weight: 500; letter-spacing: .04em; }
.ehr-row dd { margin: 0; font-size: 13.5px; font-weight: 600; color: var(--ink); text-align: right; word-break: break-word; }
.ehr-row.ehr-notes { flex-direction: column; align-items: flex-start; gap: 4px; }
.ehr-row.ehr-notes dd { text-align: left; font-size: 12px; font-weight: 400; color: var(--dim); }
.ehr-row dd.flash { animation: ehrFlash 1.2s ease; }
@keyframes ehrFlash { 0% { color: var(--green); } 100% { color: inherit; } }

.ehr-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  flex-wrap: wrap; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line);
}
.ehr-foot-right { display: flex; align-items: center; gap: 10px; }
.ehr-synced { font-family: var(--mono); font-size: 10px; color: var(--faint); }
.wb-ind { display: inline-flex; align-items: center; gap: 7px; font-size: 11.5px; color: var(--faint); }
.wb-dot { width: 8px; height: 8px; border-radius: 50%; background: #b4bba6; transition: background .3s, box-shadow .3s; }
.wb-ind.pending .wb-dot { background: #d98e14; box-shadow: 0 0 6px rgba(217,142,20,0.5); animation: cvBlink 1.2s infinite; }
.wb-ind.pending { color: var(--amber-ink); }
.wb-ind.committed .wb-dot { background: var(--green-mid); box-shadow: 0 0 6px rgba(134,166,21,0.5); }
.wb-ind.committed { color: var(--green); font-weight: 600; }

/* ───────────────────── Actors / Roles ────────────────────── */
.driver-pill {
  font-size: 11.5px; color: var(--dim);
  border: 1px solid var(--line); border-radius: 50px; padding: 5px 13px;
  background: #fafbf5;
}
.driver-pill b { font-weight: 700; }
.driver-pill.voiceai b { color: var(--cyan-ink); }
.driver-pill.human b { color: var(--green); }

.actor {
  display: flex; align-items: flex-start; gap: 12px;
  border: 1px solid var(--line); border-radius: 16px;
  padding: 12px 14px; margin-bottom: 10px;
  background: #fdfdfa;
  transition: border-color .3s, background .3s, box-shadow .3s;
}
.actor:last-of-type { margin-bottom: 0; }
.actor-orb { width: 12px; height: 12px; border-radius: 50%; margin-top: 4px; flex: none; background: #b4bba6; }
.actor.voiceai .actor-orb { background: var(--cyan-ink); box-shadow: 0 0 8px rgba(12,116,137,0.4); }
.actor.human .actor-orb { background: var(--green-mid); box-shadow: 0 0 8px rgba(134,166,21,0.4); }
.actor-info { min-width: 0; flex: 1; }
.actor-name { font-size: 13.5px; font-weight: 600; color: var(--ink); }
.actor-sub { font-size: 11px; font-weight: 400; color: var(--faint); margin-left: 6px; }
.actor-desc { font-size: 11.5px; font-weight: 400; color: var(--dim); margin-top: 3px; line-height: 1.45; }
.actor-state {
  flex: none; font-size: 10.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
  border-radius: 50px; padding: 4px 10px; margin-top: 2px;
  background: #eef0e5; color: var(--faint);
  transition: background .3s, color .3s;
}
.actor.driving { background: #fff; }
.actor.voiceai.driving { border-color: #7cc3d1; box-shadow: 0 4px 16px rgba(12,116,137,0.12); }
.actor.voiceai.driving .actor-state { background: #dff2f6; color: #085e70; }
.actor.human.driving { border-color: rgba(86,115,0,0.4); box-shadow: 0 4px 16px rgba(134,166,21,0.14); }
.actor.human.driving .actor-state { background: #eff8d3; color: #44610a; }

/* ─────────────── Benefits & Coverage widget ──────────────── */
.benefits-widget { border-color: var(--line); }

/* source segment: shows where the current benefits data came from AND acts as
   a launcher — clicking a segment runs that verification path */
.seg { display: inline-flex; background: #eef0e5; border: 1px solid var(--line); border-radius: 50px; padding: 3px; }
.seg-btn {
  border: none; background: transparent; color: var(--dim); font-family: inherit;
  border-radius: 50px; padding: 6px 15px; font-size: 12px; font-weight: 500; cursor: pointer;
  transition: background .2s, color .2s;
}
.seg-btn:hover { color: var(--ink); background: rgba(255,255,255,0.7); }
.seg-btn.active { background: var(--green); color: #fff; font-weight: 700; }
.seg-btn[data-source="voice"].active { background: var(--cyan-ink); color: #fff; }

.bx-banner {
  border-radius: 14px; padding: 12px 16px; margin-bottom: 14px;
  font-size: 13px; line-height: 1.5; animation: bxIn .35s ease;
}
.bx-banner.amber { background: #fdf3e1; border: 1px solid #ecc27a; color: #7c4a00; }
.bx-banner.lime { background: #f2fbdc; border: 1px solid #c4e36a; color: #40590a; }
.bx-banner.err { background: #fdecea; border: 1px solid #f0b4ae; color: #b3261e; }
.bx-banner b { font-weight: 700; }
.bx-banner .bx-banner-sub { display: block; margin-top: 4px; font-size: 11.5px; font-weight: 400; color: var(--dim); }
@keyframes bxIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

.bx-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px 14px; }
.bx-sec {
  grid-column: 1 / -1;
  font-size: 10.5px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase;
  color: var(--faint); border-bottom: 1px solid var(--line);
  padding-bottom: 5px; margin-top: 4px;
}
.bx-field label {
  display: flex; align-items: center; gap: 8px;
  font-size: 11.5px; color: var(--faint); font-weight: 500; letter-spacing: .04em; margin-bottom: 5px;
}
.bx-field input, .bx-field select {
  width: 100%; background: #fff; border: 1px solid #cfd6c0;
  color: var(--ink); border-radius: 12px; padding: 10px 13px; font-size: 13.5px; font-family: inherit;
  transition: border-color .2s, box-shadow .2s;
}
.bx-field input::placeholder { color: var(--faint); }
.bx-field input:focus, .bx-field select:focus { outline: none; border-color: var(--green-mid); box-shadow: 0 0 0 3px rgba(134,166,21,0.15); }
.bx-field input.filled, .bx-field select.filled { animation: bxFill .8s ease; }
@keyframes bxFill { 0% { border-color: #86a615; box-shadow: 0 0 10px rgba(134,166,21,0.4); } 100% { } }
.bx-field input.filled-cyan, .bx-field select.filled-cyan { animation: bxFillCyan .8s ease; }
@keyframes bxFillCyan { 0% { border-color: #0c7489; box-shadow: 0 0 10px rgba(12,116,137,0.35); } 100% { } }

/* provenance chip on each field */
.prov {
  font-size: 9px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  border-radius: 50px; padding: 2px 8px;
}
.prov.api { background: #eef0e5; color: #4d5546; }
.prov.voice { background: #dff2f6; color: #085e70; }
.prov.human { background: #eff8d3; color: #44610a; }

.bx-actions-label {
  font-size: 10px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase;
  color: var(--faint); margin: 16px 0 7px;
}
.bx-actions { display: flex; flex-wrap: wrap; gap: 9px; }
.bx-actions .btn { flex: 1 1 auto; }

/* voice-AI ↔ insurer transcript */
.bx-transcript-wrap { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 14px; animation: bxIn .35s ease; }
.bx-transcript-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.bx-transcript-note { font-size: 10.5px; color: var(--faint); font-weight: 400; }
.bx-transcript {
  display: flex; flex-direction: column; gap: 8px;
  max-height: 230px; overflow-y: auto; padding: 2px;
}
.bx-transcript::-webkit-scrollbar { width: 5px; }
.bx-transcript::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.18); border-radius: 3px; }
.bx-line {
  max-width: 86%; padding: 9px 13px; border-radius: 14px;
  font-size: 12.5px; line-height: 1.45; animation: bxIn .3s ease;
}
.bx-line.agent { align-self: flex-start; background: #e6f5f8; border: 1px solid #b9e0e8; color: #123c46; border-bottom-left-radius: 4px; }
.bx-line.insurer { align-self: flex-end; background: #f1f3e9; border: 1px solid #e0e5d4; color: #2c3226; border-bottom-right-radius: 4px; }
.bx-line.patient { align-self: flex-end; background: #eff8d3; border: 1px solid #c8dd83; color: #2c3a10; border-bottom-right-radius: 4px; }
.bx-line .bx-who { display: block; font-size: 9px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; opacity: .75; margin-bottom: 2px; }

/* ───────── Live patient call (observe-only transcript) ───────── */
.call-card { border-color: #b9e0e8; }
.call-status {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  font-size: 12px; color: var(--dim); margin-bottom: 10px;
}
.call-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; background: #b4bba6; transition: background .3s, box-shadow .3s; }
.call-dot.live { background: var(--cyan-ink); box-shadow: 0 0 8px rgba(12,116,137,0.55); animation: cvBlink 1.2s infinite; }
.call-dot.amber.live { background: #d98e14; box-shadow: 0 0 8px rgba(217,142,20,0.55); }
.call-note { margin-left: auto; font-size: 10.5px; color: var(--faint); font-style: italic; }
.call-transcript { max-height: 300px; min-height: 120px; }
.call-empty { color: var(--faint); font-size: 12px; padding: 18px 6px; text-align: center; }

/* ───────────────────── Session Ledger ────────────────────── */
.ledger-list {
  list-style: none; margin: 0; padding: 0;
  max-height: 340px; overflow-y: auto;
  display: flex; flex-direction: column; gap: 8px;
}
.ledger-list::-webkit-scrollbar { width: 5px; }
.ledger-list::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.18); border-radius: 3px; }
.ledger-empty { color: var(--faint); font-size: 12.5px; font-weight: 400; padding: 10px 2px; }
/* no entry animation: renderLedger() rebuilds the list on refresh and a
   replayed fade makes the whole ledger flicker */
.ledger-item {
  display: flex; align-items: flex-start; gap: 10px;
  border: 1px solid var(--line); border-radius: 12px; padding: 9px 12px;
  background: #fdfdfa;
}
.ledger-dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 5px; flex: none; background: #a9b19c; }
.ledger-item.lime .ledger-dot { background: var(--green-mid); }
.ledger-item.cyan .ledger-dot { background: var(--cyan-ink); }
.ledger-item.amber .ledger-dot { background: #d98e14; }
.ledger-item.err .ledger-dot { background: var(--err); }
.ledger-body { min-width: 0; flex: 1; }
.ledger-text { font-size: 12px; line-height: 1.45; color: var(--ink); }
.ledger-meta { font-family: var(--mono); font-size: 10px; color: var(--faint); margin-top: 2px; }

/* ─────────────────────── Responsive ──────────────────────── */
@media (max-width: 860px) {
  .cv-grid { grid-template-columns: minmax(0,1fr); padding: 14px 16px 40px; }
  .cv-spine-wrap { padding: 16px 16px 2px; }
  .cv-spine { flex-direction: column; align-items: stretch; gap: 2px; padding: 18px 20px; }
  .spine-node { flex-direction: row; text-align: left; gap: 14px; align-items: center; }
  .spine-node .sp-ic { width: 44px; height: 44px; flex: none; }
  .sp-label { margin-top: 0; }
  .sp-actor { margin: 0 0 0 auto; }
  .spine-conn { width: 2px; height: 18px; flex: none; margin: 2px 0 2px 21px; }
  /* connector is vertical here — sweep the flow gradient downward instead */
  .spine-conn.conn-flow::after {
    background: linear-gradient(180deg, transparent, var(--green-mid), transparent);
    animation-name: connFlowV;
  }
  .cv-topbar-inner { padding: 14px 16px; }
  .bx-fields { grid-template-columns: 1fr; }
}

/* ═══════════════ v3: tabs, flow-bar, EHR subsections ═══════════════ */

/* ── generic tabs (EHR, Benefits, Live Call) — folder style so they read
      clearly as tabs: each is a bordered chip; the active one is white and
      merges into the panel below it, with a green top edge ── */
.tabs { display: flex; gap: 4px; flex-wrap: wrap; border-bottom: 1px solid var(--line); margin-bottom: 12px; padding-top: 2px; }
.tab {
  position: relative; border: 1px solid var(--line); border-bottom: none; background: #f1f3e9;
  color: var(--dim); font-family: inherit; font-size: 12.5px; font-weight: 600;
  padding: 7px 13px; cursor: pointer; border-radius: 9px 9px 0 0; margin-bottom: -1px;
  display: inline-flex; align-items: center; gap: 6px; transition: background .15s, color .15s, box-shadow .15s;
}
.tab:hover { background: #e7ecd8; color: var(--ink); }
.tab.active {
  background: #fff; color: var(--green); z-index: 1;
  box-shadow: inset 0 2px 0 var(--green);   /* green top edge signals the selected tab */
}
/* white strip masks the 1px row border under the active tab, connecting it to the panel */
.tab.active::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: #fff; }

.tab-live { width: 7px; height: 7px; border-radius: 50%; background: var(--cyan-ink); box-shadow: 0 0 6px rgba(12,116,137,.6); animation: cvBlink 1.2s infinite; }
.tab-live.amber { background: #d98e14; box-shadow: 0 0 6px rgba(217,142,20,.6); }

/* a call tab with a live transcript pulses to pull the eye to it */
.call-card .tab:has(.tab-live:not([hidden])) { color: #085e70; animation: tabAlive 1.5s ease-in-out infinite; }
.call-card .tab:has(.tab-live.amber:not([hidden])) { color: var(--amber-ink); animation: tabAliveAmber 1.5s ease-in-out infinite; }
.call-card .tab.active:has(.tab-live:not([hidden]))::after { background: #eaf6f9; }
.call-card .tab.active:has(.tab-live.amber:not([hidden]))::after { background: #fdf3e1; }
@keyframes tabAlive {
  0%, 100% { background: #eaf6f9; box-shadow: inset 0 2px 0 var(--cyan-ink), 0 0 0 0 rgba(12,116,137,0.28); }
  50% { background: #d7eef3; box-shadow: inset 0 2px 0 var(--cyan-ink), 0 0 0 5px rgba(12,116,137,0.02); }
}
@keyframes tabAliveAmber {
  0%, 100% { background: #fdf3e1; box-shadow: inset 0 2px 0 #d98e14, 0 0 0 0 rgba(217,142,20,0.28); }
  50% { background: #fbe9c8; box-shadow: inset 0 2px 0 #d98e14, 0 0 0 5px rgba(217,142,20,0.02); }
}
.tab-panel { display: none; }
.tab-panel.active { display: block; animation: bxIn .25s ease; }
/* cap panel height so the surrounding CTAs / footer stay visible without scrolling the whole widget */
.benefits-widget .tab-panels, .ehr-card .tab-panels { max-height: 328px; overflow-y: auto; padding-right: 2px; }
/* the booking form's multi-select dropdowns must not be clipped by the panel
   scroll container — let the Appointments panel grow instead of scrolling */
.ehr-card .tab-panels:has(> .tab-panel[data-panel="appts"].active) { max-height: none; overflow: visible; }
.benefits-widget .tab-panels::-webkit-scrollbar, .ehr-card .tab-panels::-webkit-scrollbar { width: 5px; }
.benefits-widget .tab-panels::-webkit-scrollbar-thumb, .ehr-card .tab-panels::-webkit-scrollbar-thumb { background: rgba(0,0,0,.18); border-radius: 3px; }

/* ── spine: outbound/inbound badges + progress-filled connectors ── */
.sp-badge { font-size: 8px; font-weight: 800; letter-spacing: .05em; border-radius: 50px; padding: 1px 5px; }
.sp-badge.out { background: #dff2f6; color: #085e70; }
.sp-badge.in { background: #eef0e5; color: #4d5546; }
.spine-node.locked .sp-badge { opacity: .55; }
.spine-conn.filled { background: #b3d949; }

/* ── flow "you are here" strip + compact actors widget ── */
.cv-flowbar {
  position: relative; display: flex; align-items: center; justify-content: space-between;
  gap: 12px 16px; flex-wrap: wrap; margin-top: 14px; padding-top: 13px; border-top: 1px solid var(--line);
}
.flow-now { display: inline-flex; align-items: center; gap: 9px; font-size: 13px; color: var(--dim); min-width: 0; }
.flow-now-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; background: var(--green-mid); box-shadow: 0 0 8px rgba(134,166,21,.65); animation: cvBlink 1.3s infinite; }
.flow-now-text b { color: var(--ink); font-weight: 700; }
.actors-mini { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.am-actor { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--faint); border: 1px solid var(--line); border-radius: 50px; padding: 4px 11px; transition: background .3s, border-color .3s, color .3s; }
.am-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; background: #b4bba6; }
.am-actor.voiceai .am-dot, .am-dot.voice { background: var(--cyan-ink); }
.am-actor.human .am-dot, .am-dot.human { background: var(--green-mid); }
.am-actor.driving { color: var(--ink); font-weight: 600; }
.am-actor.voiceai.driving { border-color: #7cc3d1; background: #eaf6f9; }
.am-actor.human.driving { border-color: #b3d949; background: #f2fbdc; }

.roles-pop { position: absolute; right: 0; top: 100%; z-index: 6; margin-top: 8px; width: min(380px, 92vw); background: #fff; border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 14px 34px rgba(46,64,10,.16); padding: 8px 12px; }
.rp-row { display: flex; gap: 10px; padding: 9px 4px; }
.rp-row + .rp-row { border-top: 1px solid var(--line); }
.rp-row .am-dot { margin-top: 5px; }
.rp-row b { font-size: 13px; color: var(--ink); }
.rp-row p { margin: 3px 0 0; font-size: 11.5px; color: var(--dim); line-height: 1.45; }

/* ── EHR subsections ── */
.sub-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.sub-title { font-size: 11.5px; font-weight: 600; color: var(--dim); }
.sub-title.muted { color: var(--faint); font-weight: 400; }
.sub-empty { color: var(--faint); font-size: 12px; padding: 12px 2px; list-style: none; }
.sub-trace { font-size: 10px; margin-bottom: 8px; }
.btn.xs { padding: 4px 10px; font-size: 11px; }

.note-list, .rx-list, .hist-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.note-item { border: 1px solid var(--line); border-left: 3px solid var(--green-mid); border-radius: 10px; padding: 8px 11px; background: #fdfdfa; }
.note-when { font-family: var(--mono); font-size: 10px; color: var(--faint); margin-bottom: 3px; }
.note-text { font-size: 12px; line-height: 1.45; color: var(--ink); word-break: break-word; }

.rx-item, .hist-item { border: 1px solid var(--line); border-radius: 10px; padding: 9px 11px; background: #fdfdfa; }
.rx-main { display: flex; flex-direction: column; }
.rx-main b { font-size: 13px; color: var(--ink); }
.rx-sig { font-size: 11.5px; color: var(--dim); }
.rx-meta { display: flex; align-items: center; gap: 8px; margin-top: 6px; flex-wrap: wrap; }
.rx-refills { font-size: 10.5px; color: var(--faint); font-family: var(--mono); }
.pill { font-size: 9.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; border-radius: 50px; padding: 2px 9px; background: #eef0e5; color: #4d5546; }
.pill.lime { background: #eff8d3; color: #44610a; }
.pill.amber { background: #fdf1dc; color: #8a4f00; }
.hist-top { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.hist-top b { font-size: 13px; color: var(--ink); }
.hist-date { font-size: 11px; color: var(--faint); font-family: var(--mono); }
.hist-sub { font-size: 11.5px; color: var(--dim); margin-top: 3px; }

.ehr-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.ehr-actions-label { font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); margin-right: 2px; }

/* ── benefits: always-visible verify/outcome bars + tabbed body ── */
.bx-note { font-size: 11px; color: var(--faint); line-height: 1.5; margin: 0 0 12px; }
.bx-note b { color: var(--dim); font-weight: 600; }
.bx-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 10px 0; }
.bx-bar.bottom { border-top: 1px solid var(--line); margin-top: 12px; padding-bottom: 0; }
.bx-bar-label { font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); }
.bx-bar .btn { flex: 1 1 auto; }

/* ═══════════════ v4: note composer, booking flow, comms placeholders ═══════════════ */

/* icon-only button (phone = human payer call; CCaaS dial-out on integration) */
.btn.icon-only { flex: 0 0 auto; width: 34px; height: 34px; padding: 0; border-radius: 50%; }
.btn.icon-only svg { width: 16px; height: 16px; }
.bx-bar-hint { font-size: 10px; color: var(--faint); font-style: italic; }

/* note composer (Notes tab) */
.note-compose { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.note-compose textarea {
  width: 100%; resize: vertical; min-height: 44px;
  background: #fff; border: 1px solid #cfd6c0; border-radius: 12px;
  color: var(--ink); font-family: inherit; font-size: 12.5px; padding: 9px 12px;
}
.note-compose textarea:focus { outline: none; border-color: var(--green-mid); box-shadow: 0 0 0 3px rgba(134,166,21,0.15); }
.note-compose .btn { align-self: flex-end; }

/* note author chips */
.note-author { font-size: 8.5px; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; border-radius: 50px; padding: 1px 7px; margin-right: 5px; }
.note-author.human { background: #eff8d3; color: #44610a; }
.note-author.voice { background: #dff2f6; color: #085e70; }
.note-author.system { background: #eef0e5; color: #4d5546; }
.note-item.voice { border-left-color: var(--cyan-ink); }
.note-item.system { border-left-color: #b4bba6; }

/* searchable multi-select (locations / specialities) */
.ms { position: relative; border: 1px solid #cfd6c0; border-radius: 12px; background: #fff; padding: 5px 8px; display: flex; flex-wrap: wrap; gap: 5px; align-items: center; }
.ms:focus-within { border-color: var(--green-mid); box-shadow: 0 0 0 3px rgba(134,166,21,0.15); }
.ms-chips { display: contents; }
.ms-chip {
  display: inline-flex; align-items: center; gap: 5px;
  background: #eff8d3; color: #44610a; border: 1px solid #c8dd83;
  border-radius: 50px; padding: 2px 6px 2px 10px; font-size: 11.5px; font-weight: 600;
}
.ms-chip button {
  border: none; background: transparent; color: #44610a; font-size: 14px; line-height: 1; cursor: pointer;
  width: 20px; height: 20px; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%;
}
.ms-chip button:hover { color: #fff; background: var(--err); }
.ms-input { flex: 1 1 90px; min-width: 90px; border: none; background: transparent; color: var(--ink); font-family: inherit; font-size: 12.5px; padding: 4px 2px; }
.ms-input:focus { outline: none; }
/* kept short so it stays inside the capped .tab-panels scroll container */
.ms-drop {
  position: absolute; left: -1px; right: -1px; top: calc(100% + 4px); z-index: 8;
  background: #fff; border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 12px 28px rgba(46,64,10,0.14); max-height: 132px; overflow-y: auto; padding: 4px;
}
.ms-opt { padding: 7px 11px; border-radius: 8px; font-size: 12.5px; color: var(--ink); cursor: pointer; }
.ms-opt:hover, .ms-opt.hi { background: #f2fbdc; }
.ms-none { padding: 9px 11px; font-size: 12px; color: var(--faint); }

/* appointment booking form */
.appt-form { display: flex; flex-direction: column; gap: 7px; }
.af-label { font-size: 10.5px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--faint); margin-top: 4px; }
.af-dt {
  width: 100%; background: #fff; border: 1px solid #cfd6c0; border-radius: 12px;
  color: var(--ink); font-family: inherit; font-size: 12.5px; padding: 9px 12px;
}
.af-dt:focus { outline: none; border-color: var(--green-mid); box-shadow: 0 0 0 3px rgba(134,166,21,0.15); }
.btn.wide-sm { width: 100%; margin-top: 4px; }
.slot-list { display: flex; flex-direction: column; gap: 7px; margin-top: 4px; }
.slot-item {
  border: 1px solid var(--line); border-radius: 12px; background: #fdfdfa;
  padding: 9px 12px; cursor: pointer; transition: border-color .15s, background .15s, box-shadow .15s;
}
.slot-item b { display: block; font-size: 13px; color: var(--ink); }
.slot-sub { font-size: 11.5px; color: var(--dim); }
.slot-item:hover { border-color: var(--green-mid); }
.slot-item.sel { border-color: var(--green); background: #f2fbdc; box-shadow: 0 0 0 3px rgba(134,166,21,0.15); }
.slot-item:focus-visible { outline: 2px solid var(--green-mid); outline-offset: 1px; }
.af-hint { font-size: 11.5px; color: var(--green); font-weight: 600; min-height: 15px; }
#apptBook { margin-top: 4px; }

/* comms placeholders under the call-back button */
.notify-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.notify-hint { font-size: 10px; color: var(--faint); font-style: italic; }

/* respect the OS "reduce motion" setting — stop the perpetual pulses/sweeps
   while keeping the static (non-animated) styling intact */
@media (prefers-reduced-motion: reduce) {
  .cv-status.live .cv-status-dot, .flow-now-dot, .spine-node.active .sp-ic,
  .spine-conn.conn-flow::after, .wb-ind.pending .wb-dot, .call-dot.live,
  .tab-live, .call-card .tab:has(.tab-live:not([hidden])),
  .call-card .tab:has(.tab-live.amber:not([hidden])) {
    animation: none !important;
  }
}
