/* 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: 12px; }
.console-notes[hidden] { display: none; }
/* notes while the call is on: a writing card - roomy, grows with the text, quick phrases underneath */
.livenotes { display: flex; flex-direction: column; border: 1px solid var(--line-2); border-radius: var(--r-lg); background: var(--panel); overflow: hidden; transition: border-color var(--t), box-shadow var(--t); }
.livenotes:focus-within { border-color: color-mix(in srgb, var(--live) 60%, var(--line-2)); box-shadow: 0 0 0 3px color-mix(in srgb, var(--live) 16%, transparent); }
.livenotes-h { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 9px 12px 0; }
.livenotes-t { display: inline-flex; align-items: center; gap: 7px; font-size: var(--fs-sm); font-weight: 650; color: var(--ink); }
.livenotes-t .ic { color: var(--live); }
.livenotes-s { font-size: var(--fs-xs); color: var(--ink-3); padding: 2px 8px; border-radius: 999px; background: var(--raised); white-space: nowrap; transition: opacity var(--t); }
.livenotes-s:empty { opacity: 0; }
.livenotes textarea { display: block; width: 100%; min-height: 96px; max-height: 260px; resize: none; border: 0; border-radius: 0; background: transparent; box-shadow: none; outline: none; padding: 8px 12px 10px; font-size: 14.5px; line-height: 1.55; color: var(--ink); }
.livenotes textarea:focus, .livenotes textarea:focus-visible { outline: none; box-shadow: none; border: 0; }
.livenotes textarea::placeholder { color: var(--ink-3); }
.livenotes-f { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 10px; border-top: 1px solid var(--line); background: color-mix(in srgb, var(--raised) 55%, transparent); }
.livenotes-q { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; min-width: 0; padding: 1px; }
.livenotes-q::-webkit-scrollbar { display: none; }
.livenotes-chip { flex: none; height: 26px; padding: 0 10px; border: 1px solid var(--line-2); border-radius: 999px; background: var(--panel); color: var(--ink-2); font: inherit; font-size: var(--fs-xs); font-weight: 550; cursor: pointer; white-space: nowrap; transition: background var(--t), color var(--t), border-color var(--t), transform 80ms; }
.livenotes-chip:hover { color: var(--ink); border-color: color-mix(in srgb, var(--live) 55%, var(--line-2)); background: color-mix(in srgb, var(--live) 9%, var(--panel)); }
.livenotes-chip:active { transform: scale(.96); }
.livenotes-n { font-size: var(--fs-xs); color: var(--ink-3); flex: none; }
.livenotes-hint { margin: 0; padding: 0 12px 9px; font-size: var(--fs-xs); color: var(--ink-3); background: color-mix(in srgb, var(--raised) 55%, transparent); }
@media (pointer: coarse) { .livenotes-chip { height: 34px; padding: 0 12px; } .livenotes textarea { font-size: 16px; } }
/* the wrap-up after the call: the same writing comfort */
.wrapup textarea { min-height: 84px; font-size: 14.5px; line-height: 1.55; padding: 10px 12px; }
.wrap-cb { margin-top: 0; }

/* 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); }

/* "Did they pick up?" in the wrap-up and on the call list; the no-pickup file dialog */
.wrap-pick, .cl-pick { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.wrap-pick .field-l, .cl-pick .field-l { margin: 0; }
.wrap-pick .seg-b[aria-pressed="true"][data-v="yes"], .cl-pick .seg-b[aria-pressed="true"][data-v="yes"] { background: color-mix(in srgb, var(--live) 22%, transparent); color: var(--ink); }
.wrap-pick .seg-b[aria-pressed="true"][data-v="no"], .cl-pick .seg-b[aria-pressed="true"][data-v="no"] { background: color-mix(in srgb, var(--err) 22%, transparent); color: var(--ink); }
.np-row { align-items: flex-end; gap: 10px; margin: 6px 0 12px; }
.np-f { display: flex; flex-direction: column; gap: 4px; }
.np-days { max-height: 300px; overflow: auto; border: 1px solid var(--line); border-radius: var(--r); }
.wrap-pick .seg-b, .cl-pick .seg-b { min-width: 56px; justify-content: center; }
