/* Phase 6 (agent flow): callback countdown card, auto-advance countdown and toggle, coach notes.
   Built on the existing tokens (base.css) and the top-right card look of .xfer-ok (phase5.css). */

/* ---- floating cards, top right ---- */
.flow-cards { position: fixed; z-index: 312; top: 14px; right: 16px; width: min(380px, calc(100vw - 32px)); display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.flow-cards-i { display: contents; }
.flow-cards-i > * { pointer-events: auto; }
/* another top-right card (transfer complete, call waiting) is up: sit below it */
body:has(> .xfer-ok) .flow-cards { top: 110px; }

.flow-card { display: flex; align-items: flex-start; gap: 10px; padding: 11px 12px; background: var(--raised); border: 1px solid var(--line-2); border-left: 3px solid var(--ring); border-radius: var(--r); box-shadow: var(--shadow); font-size: var(--fs-sm); line-height: 1.45; animation: rise 160ms ease-out; }
.flow-ic { display: grid; place-items: center; width: 26px; height: 26px; flex: none; border-radius: 50%; background: color-mix(in srgb, var(--ring) 18%, transparent); color: var(--ring); }
.flow-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.flow-title { font-size: var(--fs); color: var(--ink); overflow-wrap: anywhere; }
.flow-sub { color: var(--ink-2); overflow-wrap: anywhere; }
.flow-n { font-variant-numeric: tabular-nums; }
.flow-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 2px; }

/* the bar empties with the countdown */
.flow-bar { height: 3px; border-radius: 2px; background: var(--sunken); overflow: hidden; }
.flow-bar > i { display: block; height: 100%; width: 100%; background: var(--ring); transition: width 100ms linear; }

/* ---- auto-advance: countdown in the call-list lead card (and as a card elsewhere) ---- */
.flow-slot[hidden] { display: none; }
.flow-adv { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; }
.flow-adv-slot .flow-adv { padding: 9px 12px; border: 1px solid var(--line-2); border-left: 3px solid var(--ring); border-radius: var(--r); background: var(--raised); font-size: var(--fs-sm); }
.flow-adv-ic { display: grid; place-items: center; color: var(--ring); flex: none; }
.flow-adv-t { flex: 1 1 200px; min-width: 0; color: var(--ink-2); overflow-wrap: anywhere; }
.flow-adv-t strong { color: var(--ink); }
.flow-adv .flow-bar { flex: 1 0 100%; }
.flow-adv-note { display: flex; align-items: flex-start; gap: 6px; margin: 0; padding: 7px 10px; border: 1px dashed var(--line-2); border-radius: var(--r); font-size: var(--fs-sm); color: var(--ink-2); }
.flow-adv-note .ic { flex: none; margin-top: 2px; color: var(--info); }
.cl-card > .flow-slot { margin: 0 0 10px; }

/* the two "by itself" switches of the lead card sit on top of each other, so the action row keeps its width */
.flow-autos { display: inline-flex; flex-direction: column; gap: 3px; min-width: 0; }
.flow-auto { display: inline-flex; }
.flow-auto[hidden] { display: none; }
.cl-idle-a .flow-auto .check { font-size: var(--fs); }

/* ---- coach note: the agent's side ---- */
.flow-note { display: flex; align-items: flex-start; gap: 9px; width: 100%; padding: 9px 10px; text-align: left; font: inherit; font-size: var(--fs-sm); line-height: 1.45; color: var(--ink); background: color-mix(in srgb, var(--info) 9%, var(--raised)); border: 1px solid color-mix(in srgb, var(--info) 45%, var(--line-2)); border-left: 3px solid var(--info); border-radius: var(--r); cursor: pointer; animation: rise 160ms ease-out; }
.flow-note:hover { background: color-mix(in srgb, var(--info) 14%, var(--raised)); }
.flow-note:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.flow-note[data-floating] { box-shadow: var(--shadow); }
.flow-note-ic { display: grid; place-items: center; width: 22px; height: 22px; flex: none; border-radius: 50%; background: color-mix(in srgb, var(--info) 18%, transparent); color: var(--info); }
.flow-note-b { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.flow-note-b strong { font-size: var(--fs-xs); color: var(--ink-3); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.flow-note-x { font-size: var(--fs); overflow-wrap: anywhere; white-space: pre-wrap; }
.flow-note-d { flex: none; color: var(--ink-3); margin-top: 3px; }
.flow-coach-slot { margin: 8px 0 0; }
.console > .flow-coach-slot { margin: 0; padding: 0 12px 12px; }
.cl-card > .flow-coach-slot { margin: 0 0 10px; }

/* ---- coach note: the supervisor's field (monitor dock, monitoring wall tile) ---- */
.coach { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.coach[data-busy] { opacity: .7; }
.coach-row { display: flex; gap: 6px; min-width: 0; }
.coach-in { flex: 1 1 auto; min-width: 0; height: var(--ctl-sm); font-size: var(--fs-sm); }
.coach-canned { display: flex; flex-wrap: wrap; gap: 4px; }
.coach-chip { height: 24px; padding: 0 8px; font-size: var(--fs-xs); max-width: 100%; display: inline-block; line-height: 22px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.coach-st { font-size: var(--fs-xs); color: var(--ink-3); overflow-wrap: anywhere; min-height: 1em; }
.coach-st:empty { display: none; }
.coach-st[data-k="ok"] { color: var(--live); }
.coach-st[data-k="err"] { color: var(--err); }
.mdock-coach:empty, .tile-coach:empty { display: none; }
.mdock-coach { padding-top: 8px; border-top: 1px solid var(--line); }
.tile-coach { padding-top: 8px; border-top: 1px solid var(--line); }

/* ---- History: notes kept with a call ---- */
.coach-log { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.coach-log-i { display: flex; gap: 10px; align-items: baseline; font-size: var(--fs-sm); }
.coach-log-t { flex: none; color: var(--ink-3); }
.coach-log-b { min-width: 0; overflow-wrap: anywhere; }

/* ---- Admin › Agent flow ---- */
.flowpage { max-width: 860px; }
.flow-canned { gap: 6px; }

@media (max-width: 640px) {
  .flow-cards { top: 56px; left: 12px; right: 12px; width: auto; }
  body:has(> .xfer-ok) .flow-cards { top: 150px; }
  .flow-actions .btn, .flow-adv .btn, .coach-row .btn { min-height: 44px; }
  .coach-in { height: 44px; }
  .coach-chip { height: 36px; line-height: 34px; }
  /* the action row of the lead card is tight on a phone: the toggle lives on the idle card there, Pause is on the countdown */
  .cl-actions .flow-auto { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .flow-card, .flow-note { animation: none; }
  .flow-bar > i { transition: none; }
}

/* ---------- notes while the call is on ---------- */
.console-notes { margin-top: 10px; }
.console-notes[hidden] { display: none; }
.livenotes { display: flex; flex-direction: column; gap: 4px; }
.livenotes-h { display: flex; justify-content: space-between; align-items: baseline; font-size: var(--fs-xs); color: var(--ink-3); letter-spacing: .04em; text-transform: uppercase; }
.livenotes-s { text-transform: none; letter-spacing: 0; }
.livenotes textarea { resize: vertical; min-height: 54px; }

/* the agents' "Request new number" shortcut in the side menu (a button that looks like the links around it) */
button.nav-i.nav-req { width: 100%; background: none; border: 0; font: inherit; font-weight: 500; text-align: left; cursor: pointer; }
button.nav-i.nav-req:hover { background: var(--raised); color: var(--ink); }
