/* ============================================================
   Poly SC Phone
   PolyAI brand: Macaw / Slate / White primary, Inter + Roboto Mono,
   8-point spacing grid. Ported from prototype/styles.css.
   ============================================================ */

:root {
  --macaw: #D9EE50;
  --macaw-400: #C0D434;
  --macaw-100: #F7FDD0;
  --slate: #231F20;
  --white: #FFFFFF;
  --purple: #C3AFFE;
  --blue: #6FE1EE;
  --red: #FF9292;
  --red-400: #E96C5B;
  --red-100: #FFF1F1;
  --gray-1: #F1F1F1;
  --gray-2: #E8E8E8;
  --gray-3: #B5B5B5;
  --gray-4: #848484;
  --gray-5: #606060;

  --topbar-h: 72px;
  --r-card: 12px;
  --r-btn: 8px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { height: 100%; margin: 0; }

body {
  font-family: 'Inter', Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: var(--slate);
  background: var(--gray-1);
  -webkit-font-smoothing: antialiased;
}

.mono, .eyebrow { font-family: 'Roboto Mono', 'Courier New', monospace; }

button { font-family: inherit; cursor: pointer; }

.icon { width: 20px; height: 20px; fill: currentColor; flex: none; }

.eyebrow {
  display: block;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gray-5);
}

/* ---------------- top bar ---------------- */

.topbar {
  height: var(--topbar-h);
  background: var(--slate);
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 0 24px;
}

.topbar__brand { display: flex; align-items: center; gap: 16px; }

.topbar__logo {
  height: 28px;
  width: auto;
  display: block;
  /* Shipped asset is a flattened JPEG; screen blend drops its black backing. */
  mix-blend-mode: screen;
}

.topbar__divider { width: 1px; height: 24px; background: rgba(255,255,255,0.24); }

.topbar__appname {
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.14em;
  color: rgba(255,255,255,0.6);
}

.topbar__user { display: flex; align-items: center; gap: 12px; }
.topbar__user-meta { text-align: right; line-height: 1.3; }
.topbar__user-name { display: block; font-size: 14px; font-weight: 600; }
.topbar__user-line { display: block; font-size: 12px; color: var(--gray-3); }

.topbar__logout {
  border: 1px solid rgba(255,255,255,0.24);
  background: rgba(255,255,255,0.1);
  color: var(--white);
  font-size: 12px;
  padding: 6px 12px;
  border-radius: var(--r-btn);
}
.topbar__logout:hover { background: rgba(255,255,255,0.2); }

/* ---------------- avatars ---------------- */

.avatar {
  width: 40px; height: 40px;
  border-radius: 999px;
  background: var(--macaw);
  color: var(--slate);
  font-size: 13px; font-weight: 600;
  display: flex; align-items: center; justify-content: center;
  flex: none;
}

/* ---------------- layout ---------------- */

.app { height: calc(100% - var(--topbar-h)); display: flex; min-height: 0; }
.pane-host { flex: 1; overflow-y: auto; min-width: 0; }
.pane { padding: 40px; max-width: 720px; margin: 0 auto; }

/* ---------------- cards ---------------- */

.card {
  background: var(--white);
  border: 1px solid var(--gray-2);
  border-radius: var(--r-card);
  padding: 32px;
}

.card + .card { margin-top: 16px; }

.card h1 { font-size: 32px; font-weight: 600; margin: 8px 0 8px; line-height: 1.25; }
.card h2 { font-size: 20px; font-weight: 600; margin: 0 0 12px; }
.card p { margin: 0 0 12px; color: var(--gray-5); }
.card p:last-child { margin-bottom: 0; }

.card--warn { border-color: var(--red-400); background: var(--red-100); }
.card--warn p { color: var(--slate); }

/* ---------------- status rows ---------------- */

.status { list-style: none; margin: 0; padding: 0; }

.status li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid var(--gray-1);
  font-size: 14px;
}
.status li:last-child { border-bottom: none; }

.status__label { color: var(--gray-5); }
.status__value { font-family: 'Roboto Mono', monospace; font-size: 13px; }

.pill {
  font-family: 'Roboto Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 3px 10px;
  border-radius: 999px;
}
.pill--ok { background: var(--macaw); color: var(--slate); }
.pill--pending { background: var(--gray-2); color: var(--gray-5); }
.pill--bad { background: var(--red-400); color: var(--slate); }

/* ---------------- buttons ---------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px 24px;
  border: none;
  border-radius: var(--r-btn);
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  transition: background 120ms ease;
}

.btn--primary { background: var(--macaw); color: var(--slate); }
.btn--primary:hover { background: var(--macaw-400); }

/* ---------------- sign-in ---------------- */

.signin {
  min-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
}

.signin__card {
  background: var(--white);
  border: 1px solid var(--gray-2);
  border-radius: var(--r-card);
  padding: 48px;
  max-width: 420px;
  width: 100%;
  text-align: center;
}

.signin__card h1 { font-size: 28px; font-weight: 600; margin: 12px 0 8px; }
.signin__card p { color: var(--gray-5); font-size: 14px; margin: 0 0 24px; }

/* ============================================================
   DIALLER  (ported from prototype/styles.css)
   ============================================================ */

.pane--dialer { max-width: 480px; }

.dialer {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.dialer__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}

/* Device registration state. This is the honest indicator of whether the
   browser is actually connected to Twilio, not just whether the page loaded. */
.devicestate {
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 3px 10px;
  border-radius: 999px;
}
.devicestate.is-ready { background: var(--macaw); color: var(--slate); }
.devicestate.is-waiting { background: var(--gray-2); color: var(--gray-5); }

.dialer__number {
  width: 100%;
  font-size: 32px;
  color: var(--slate);
  background: var(--white);
  border: 1px solid var(--gray-2);
  border-radius: var(--r-card);
  padding: 20px 24px;
  text-align: center;
}
.dialer__number::placeholder { color: var(--gray-3); }
.dialer__number:focus {
  outline: none;
  border-color: var(--macaw-400);
  box-shadow: 0 0 0 3px var(--macaw-100);
}

.dialer__keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }

.key {
  background: var(--white);
  border: 1px solid var(--gray-2);
  border-radius: var(--r-card);
  padding: 14px 0 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  color: var(--slate);
  transition: background 120ms ease, border-color 120ms ease;
}
.key:hover { background: var(--macaw-100); border-color: var(--macaw); }
.key:active { background: var(--macaw); }

.key__digit { font-size: 24px; font-weight: 500; line-height: 1; }
.key__letters { font-size: 9px; letter-spacing: 0.1em; color: var(--gray-4); }
.key--fn { justify-content: center; padding: 20px 0; color: var(--gray-5); }

.dialer__from { font-size: 12px; color: var(--gray-4); text-align: center; margin: 0; }

.dialer__error {
  font-size: 12px;
  color: var(--slate);
  background: var(--red-100);
  border: 1px solid var(--red-400);
  border-radius: var(--r-btn);
  padding: 10px 14px;
  margin: 0;
}

/* ---------------- active call ---------------- */

.callpanel {
  background: var(--slate);
  color: var(--white);
  border-radius: var(--r-card);
  padding: 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  text-align: center;
}

.callpanel__state { color: var(--macaw); }
.callpanel__who { display: flex; align-items: center; gap: 20px; text-align: left; }
.callpanel__name { font-size: 28px; font-weight: 600; line-height: 1.25; margin: 0; }
.callpanel__number { font-size: 13px; color: var(--gray-3); margin: 4px 0 0; }

.callpanel__timer {
  font-size: 48px;
  letter-spacing: 0.04em;
  margin: 0;
  font-variant-numeric: tabular-nums;
}

.callpanel__controls { display: flex; gap: 12px; width: 100%; max-width: 480px; }
.callpanel__controls .btn { flex: 1; white-space: nowrap; }
/* Muted or speaker off: the same purple as the dark call bar's on-state. */
.callpanel__controls .btn.is-on { background: var(--purple); color: var(--slate); }

.avatar--lg { width: 64px; height: 64px; font-size: 20px; }

/* Dot language: scattered reads as noise, flowing reads as clarity. */
.dots { display: flex; align-items: center; gap: 6px; height: 32px; }

.dots span {
  width: 6px; height: 6px;
  border-radius: 999px;
  background: var(--gray-5);
  transition: background 200ms ease;
}
.dots.is-live span { background: var(--macaw); animation: flow 1.4s ease-in-out infinite; }
.dots.is-muted span { background: var(--purple); animation-play-state: paused; }

@keyframes flow {
  0%, 100% { transform: translateY(0) scale(1); opacity: 0.45; }
  50%      { transform: translateY(-8px) scale(1.5); opacity: 1; }
}

/* ---------------- incoming call ---------------- */

.incoming {
  background: var(--white);
  border: 1px solid var(--gray-2);
  border-radius: var(--r-card);
  padding: 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
}

.incoming__pulse { position: relative; margin: 16px 0 8px; }

/* Signals a ringing line without relying on sound. */
.incoming__pulse::after {
  content: '';
  position: absolute;
  inset: -8px;
  border-radius: 999px;
  border: 2px solid var(--macaw);
  animation: ring 1.6s ease-out infinite;
}

@keyframes ring {
  0%   { transform: scale(0.9); opacity: 0.9; }
  100% { transform: scale(1.35); opacity: 0; }
}

.incoming__name { font-size: 26px; font-weight: 600; margin: 0; }
.incoming__to { font-size: 12px; color: var(--gray-4); margin: 4px 0 0; }

.incoming__controls { display: flex; gap: 12px; width: 100%; margin-top: 24px; }
.incoming__controls .btn { flex: 1; }

/* ============================================================
   INBOX SIDEBAR  (ported from prototype/styles.css)

   Sits beside the main pane rather than over it, because the whole
   point is reading and replying while a call is in progress.
   ============================================================ */

.inbox {
  width: 372px;
  flex: none;
  background: var(--white);
  border-left: 1px solid var(--gray-2);
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
  transition: width 200ms ease;
}

.inbox.is-collapsed { width: 64px; }

.inbox__rail {
  display: none;
  position: relative;
  width: 100%;
  padding: 24px 0;
  border: none;
  background: none;
  color: var(--slate);
  justify-content: center;
}
.inbox.is-collapsed .inbox__rail { display: flex; }
.inbox.is-collapsed .inbox__body { display: none; }

.inbox__body { display: flex; flex-direction: column; min-height: 0; height: 100%; }

.inbox__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 24px 20px 16px;
  border-bottom: 1px solid var(--gray-2);
}

.inbox__count { font-size: 12px; color: var(--gray-4); margin: 4px 0 0; }

.inbox__collapse {
  border: none; background: none; color: var(--gray-4);
  padding: 4px; border-radius: var(--r-btn);
}
.inbox__collapse:hover { background: var(--gray-1); color: var(--slate); }

.inbox__foot { padding: 16px 20px; border-top: 1px solid var(--gray-2); }
.inbox__empty { padding: 40px; text-align: center; font-size: 14px; color: var(--gray-4); }

.btn--subtle {
  background: var(--white); color: var(--gray-5);
  border: 1px solid var(--gray-2); font-weight: 500;
}
.btn--subtle:hover { border-color: var(--gray-3); color: var(--slate); }
.btn--sm { padding: 8px 14px; font-size: 13px; }
.btn--full { width: 100%; }

/* Makes soft-delete semantics visible rather than looking like a hard delete. */
.softnote { margin: 12px 0 0; font-size: 11px; letter-spacing: 0.06em; color: var(--gray-4); }

/* ---------------- thread list ---------------- */

.threads { list-style: none; margin: 0; padding: 0; flex: 1; overflow-y: auto; }

.thread-item {
  display: grid;
  grid-template-columns: 40px 1fr;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--gray-1);
  cursor: pointer;
  transition: background 120ms ease;
}
.thread-item:hover { background: var(--gray-1); }
.thread-item.is-unread { background: var(--macaw-100); }
.thread-item.is-unread:hover { background: #f1fabd; }

.thread-item__top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }

.thread-item__name {
  font-size: 14px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.thread-item__time { font-size: 11px; color: var(--gray-4); flex: none; }

.thread-item__preview {
  font-size: 13px; color: var(--gray-5); margin: 2px 0 0;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}

.thread-item__meta { display: flex; align-items: center; gap: 8px; margin-top: 6px; }

.badge {
  min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 999px;
  background: var(--slate); color: var(--white);
  font-size: 10px; font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center;
}

.badge--rail { position: absolute; top: 18px; right: 12px; background: var(--macaw); color: var(--slate); }

/* Shown when a thread's contact is the one on the live call. */
.oncall-chip {
  font-family: 'Roboto Mono', monospace;
  font-size: 9px; letter-spacing: 0.1em; text-transform: uppercase;
  padding: 2px 8px; border-radius: 999px;
  background: var(--macaw); color: var(--slate);
}

/* ---------------- single thread ---------------- */

.thread__head {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 20px; border-bottom: 1px solid var(--gray-2);
}

.thread__back {
  border: none; background: none; color: var(--gray-5);
  padding: 6px; border-radius: var(--r-btn); display: flex;
}
.thread__back:hover { background: var(--gray-1); color: var(--slate); }

.thread__who { flex: 1; min-width: 0; }
.thread__name { font-size: 14px; font-weight: 600; margin: 0; }
.thread__number { font-size: 12px; color: var(--gray-4); margin: 0; }

.bubbles {
  flex: 1; overflow-y: auto; padding: 20px;
  display: flex; flex-direction: column; gap: 12px;
}

.bubble {
  max-width: 82%;
  padding: 10px 14px;
  border-radius: var(--r-card);
  font-size: 14px; line-height: 1.45;
  word-break: break-word;
}

.bubble__time {
  display: block;
  font-family: 'Roboto Mono', monospace;
  font-size: 10px; margin-top: 6px; opacity: 0.6;
}

.bubble--in { align-self: flex-start; background: var(--gray-1); border-bottom-left-radius: 4px; }
.bubble--out { align-self: flex-end; background: var(--macaw); color: var(--slate); border-bottom-right-radius: 4px; }

.composer { display: flex; gap: 8px; padding: 16px 20px; border-top: 1px solid var(--gray-2); }

.composer__input {
  flex: 1; min-width: 0;
  font: inherit; font-size: 14px;
  padding: 10px 14px;
  border: 1px solid var(--gray-2);
  border-radius: var(--r-btn);
  color: var(--slate);
}
.composer__input:focus {
  outline: none;
  border-color: var(--macaw-400);
  box-shadow: 0 0 0 3px var(--macaw-100);
}

.composer__send {
  border: none; border-radius: var(--r-btn);
  background: var(--slate); color: var(--white);
  padding: 0 14px; display: flex; align-items: center;
}
.composer__send:hover { background: #3a3436; }

.composer__error {
  margin: 0 20px 16px;
  padding: 10px 12px;
  font-size: 11px;
  line-height: 1.5;
  color: var(--slate);
  background: var(--red-100);
  border: 1px solid var(--red-400);
  border-radius: var(--r-btn);
  word-break: break-word;
}

/* The inbox is meant to live beside a call, so it collapses to a rail
   rather than stacking underneath the dialler. */
@media (max-width: 900px) {
  .inbox { width: 64px; }
  .inbox .inbox__rail { display: flex; }
  .inbox .inbox__body { display: none; }
}

/* ============================================================
   TABS + CALL HISTORY  (ported from prototype/styles.css)
   ============================================================ */

.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--gray-2);
  margin-bottom: 32px;
}

.tab {
  border: none;
  background: none;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 500;
  color: var(--gray-5);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.tab:hover { color: var(--slate); }
/* The way into the stage view: pushed right, in the brand's dark and green. */
.tab--stage {
  margin-left: auto; margin-bottom: 6px; align-self: center;
  border: 1px solid var(--slate); border-radius: 999px; padding: 6px 14px;
  background: var(--slate); color: var(--macaw); font-size: 13px; font-weight: 600;
}
.tab--stage:hover { color: var(--macaw); background: #000; }

.tab--active {
  color: var(--slate);
  font-weight: 600;
  border-bottom-color: var(--macaw-400);
}

.history__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.history__search {
  width: 100%;
  font: inherit;
  font-size: 14px;
  padding: 10px 14px;
  margin-bottom: 16px;
  border: 1px solid var(--gray-2);
  border-radius: var(--r-btn);
  color: var(--slate);
}
.history__search:focus {
  outline: none;
  border-color: var(--macaw-400);
  box-shadow: 0 0 0 3px var(--macaw-100);
}

.calllist {
  list-style: none;
  margin: 0;
  padding: 0;
  background: var(--white);
  border: 1px solid var(--gray-2);
  border-radius: var(--r-card);
  overflow: hidden;
}

.callrow {
  display: grid;
  grid-template-columns: 32px 1fr auto auto;
  align-items: center;
  gap: 16px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--gray-1);
  cursor: pointer;
  transition: background 120ms ease;
}
.callrow:last-child { border-bottom: none; }
.callrow:hover { background: var(--macaw-100); }

.callrow__dir {
  width: 28px; height: 28px;
  border-radius: 999px;
  display: flex; align-items: center; justify-content: center;
  background: var(--gray-1);
  color: var(--gray-5);
}
.callrow__dir .icon { width: 14px; height: 14px; }

/* Missed calls are the ones worth calling back, so they get the accent. */
.callrow__dir.is-missed { background: var(--red-100); color: var(--red-400); }
.callrow__dir.is-out { background: var(--macaw-100); color: var(--slate); }

.callrow__name { font-size: 14px; font-weight: 500; }
.callrow__number { font-size: 12px; color: var(--gray-4); }
.callrow__when { font-size: 12px; color: var(--gray-4); }
.callrow__dur { font-size: 13px; color: var(--gray-5); min-width: 56px; text-align: right; }

.calllist__empty { padding: 40px; text-align: center; font-size: 14px; color: var(--gray-4); }

/* ---------------- in-call bar on the history tab ---------------- */

/* A live call must stay controllable from any tab: losing the End call
   button by opening history would be alarming. */
.callbar {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--slate);
  color: var(--white);
  border-radius: var(--r-btn);
  padding: 12px 16px;
  margin-bottom: 24px;
}

.callbar__who { flex: 1; font-size: 13px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.callbar__timer { font-size: 15px; font-variant-numeric: tabular-nums; color: var(--macaw); }

.callbar__btn {
  border: 1px solid rgba(255,255,255,0.24);
  background: rgba(255,255,255,0.1);
  color: var(--white);
  font-size: 12px;
  font-weight: 600;
  padding: 7px 12px;
  border-radius: var(--r-btn);
}
.callbar__btn:hover { background: rgba(255,255,255,0.2); }
.callbar__btn.is-on { background: var(--purple); border-color: var(--purple); color: var(--slate); }

/* An on/off switch inside a button: the knob shows the state, so "Speaker" with the
   knob right is on, knob left is off. Used where a label alone was ambiguous. */
.switch {
  position: relative; display: inline-block; flex: none;
  width: 30px; height: 16px; border-radius: 99px;
  background: var(--macaw); transition: background 0.2s;
  vertical-align: middle;
}
.switch__knob {
  position: absolute; top: 2px; left: 16px; width: 12px; height: 12px; border-radius: 50%;
  background: var(--slate); transition: left 0.2s;
}
.is-off > .switch { background: var(--gray-3); }
.is-off > .switch .switch__knob { left: 2px; background: var(--white); }
.callbar__btn.is-off > .switch { background: rgba(255,255,255,0.25); }
.callbar__btn--end { background: var(--red-400); border-color: var(--red-400); color: var(--slate); }

/* A ringing call needs to read as urgent, not just present. */
.callbar--ringing {
  animation: callbar-pulse 1.4s ease-in-out infinite;
}

@keyframes callbar-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(217, 238, 80, 0); }
  50%      { box-shadow: 0 0 0 4px rgba(217, 238, 80, 0.45); }
}

.callbar__btn--accept { background: var(--macaw); border-color: var(--macaw); color: var(--slate); }
.callbar__btn--accept:hover { background: var(--macaw-400); }

/* ============================================================
   AGENT ASSIST  (ported from the DemoEngine agent assist page)

   Answered inbound calls only. The dialler pane widens and the call
   controls collapse to the callbar, so notes, conversation and
   knowledge each get a column beside the inbox.
   ============================================================ */

.pane--assist { max-width: 1440px; }

.assistview { display: flex; flex-direction: column; }

/* After hang-up the notes stay up for wrap-up, with a light bar so it
   reads as finished rather than live. */
.callbar--ended { background: var(--white); color: var(--slate); border: 1px solid var(--gray-2); }
.callbar--ended .callbar__btn { background: var(--macaw); border-color: var(--macaw); color: var(--slate); }
.callbar--ended .callbar__btn:hover { background: var(--macaw-400); }

.assist { container-type: inline-size; }

.assist__head { display: flex; align-items: center; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.assist__status { font-size: 12px; color: var(--gray-5); display: inline-flex; align-items: center; gap: 8px; }

.assist__dot { width: 8px; height: 8px; border-radius: 999px; background: var(--gray-3); }
.assist__dot.is-live { background: var(--macaw-400); animation: assist-live 1.6s ease-out infinite; }

@keyframes assist-live {
  0%   { box-shadow: 0 0 0 0 rgba(192, 212, 52, 0.6); }
  70%  { box-shadow: 0 0 0 6px rgba(192, 212, 52, 0); }
  100% { box-shadow: 0 0 0 0 rgba(192, 212, 52, 0); }
}

.assist__switch { margin-left: auto; font-size: 13px; color: var(--gray-5); display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.assist__switch input { accent-color: var(--slate); }

/* Fixed height with each column scrolling on its own, so a long call
   never pushes the callbar off screen. */
.assist__grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr) minmax(0, 1fr);
  gap: 16px;
  height: calc(100vh - var(--topbar-h) - 300px);
  min-height: 420px;
}

.assist__col {
  background: var(--white);
  border: 1px solid var(--gray-2);
  border-radius: var(--r-card);
  padding: 20px;
  overflow-y: auto;
  min-height: 0;
}

.assist__col > h3 { margin: 0 0 12px; display: flex; align-items: baseline; gap: 8px; }
.assist__updating { font-size: 11px; letter-spacing: 0; text-transform: none; color: var(--gray-4); }
.assist__empty { font-size: 13px; color: var(--gray-4); margin: 0; }

/* Two columns, then one, by the space the pane actually has: the inbox
   beside it takes a varying share of the window. Notes go last, since
   corrections and knowledge are what the agent needs mid-sentence. */
@container (max-width: 960px) {
  .assist__grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); height: auto; }
  .assist__col { max-height: 60vh; }
  .assist__notes { grid-column: 1 / -1; order: 1; max-height: none; }
}

@container (max-width: 620px) {
  .assist__grid { grid-template-columns: minmax(0, 1fr); }
}

/* ---------------- notes ---------------- */

.notes__facts { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 0 0 12px; font-size: 14px; }
.notes__facts dt { font-family: 'Roboto Mono', monospace; font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--gray-4); padding-top: 2px; }
.notes__facts dd { margin: 0; font-weight: 500; }

.notes__title { font-size: 12px; font-weight: 600; margin: 16px 0 4px; }
.notes__list { margin: 0; padding-left: 18px; font-size: 14px; }
.notes__list li + li { margin-top: 2px; }
.notes__summary { font-size: 13px; color: var(--gray-5); margin: 16px 0 8px; padding-top: 12px; border-top: 1px solid var(--gray-1); }
.notes__meta { font-size: 11px; color: var(--gray-3); }

/* ---------------- conversation ---------------- */

.assist__convo { display: flex; flex-direction: column; overflow: hidden; }

/* column-reverse anchors the scroll to the newest turn without JS. */
.convo__scroll { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column-reverse; }

.turn { padding: 10px 14px; border-radius: var(--r-btn); margin-bottom: 8px; font-size: 14px; }
.turn p { margin: 0; }
.turn__who { display: block; font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--gray-4); margin-bottom: 2px; }
.turn.is-partial p { color: var(--gray-4); }

.turn--caller { background: var(--gray-1); margin-right: 32px; }
.turn--you { background: var(--slate); color: var(--white); margin-left: 32px; }
.turn--you .turn__who { color: var(--gray-3); }
.turn--you.is-partial p { color: var(--gray-3); }
.turn--model { border: 1px dashed var(--gray-3); color: var(--gray-5); font-size: 13px; }

.chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }
.chip {
  font-family: 'Roboto Mono', monospace;
  font-size: 10px; letter-spacing: 0.04em;
  padding: 2px 8px; border-radius: 999px;
  background: var(--gray-2); color: var(--gray-5);
}
.chip--cited { background: var(--macaw-100); color: var(--slate); }
.chip--warn { background: var(--red-100); color: var(--red-400); }
.chip--action { background: var(--white); border: 1px solid var(--gray-2); color: var(--slate); font-size: 11px; }

/* The verdict sits inside your own (dark) turn, so it is its own light card. */
.verdict { background: var(--white); color: var(--slate); border-radius: var(--r-btn); padding: 8px 10px; margin-top: 8px; font-size: 13px; }
.verdict .chips { margin-top: 0; margin-bottom: 4px; }
.verdict--correct .chip--verdict { background: var(--macaw); color: var(--slate); }
.verdict--partial .chip--verdict { background: var(--blue); color: var(--slate); }
.verdict--incorrect .chip--verdict { background: var(--red-400); color: var(--slate); }
.verdict--not_assessable .chip--verdict { background: var(--purple); color: var(--slate); }
.fact { margin-top: 2px; }
.fact--wrong { color: var(--red-400); }
.verdict__coaching { margin-top: 6px; color: var(--gray-5); font-style: italic; }

/* ---------------- knowledge ---------------- */

.kcard {
  border: 1px solid var(--gray-2);
  border-radius: var(--r-card);
  padding: 14px 16px;
  margin-bottom: 12px;
  animation: assist-arrive 2.5s ease-out;
}

/* The newest (or re-cited) card flashes so the eye goes to it. */
@keyframes assist-arrive {
  0%   { transform: translateY(-4px); border-color: var(--macaw-400); box-shadow: 0 0 0 4px var(--macaw-100); }
  15%  { transform: none; }
  100% { border-color: var(--gray-2); box-shadow: none; }
}

.kcard__head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.kcard__head h4 { font-size: 15px; font-weight: 600; margin: 0; flex: 1; }
.kcard__icon { font-size: 18px; }
.kcard__meta { font-size: 10px; color: var(--gray-4); }
.kcard ul { margin: 0; padding-left: 18px; font-size: 14px; }

/* An order looked up on the call: its status first, then the facts the agent reads out. */
.ostatus {
  display: inline-block;
  font-family: 'Roboto Mono', monospace;
  font-size: 11px; letter-spacing: 0.04em; font-weight: 500;
  padding: 2px 10px; border-radius: 999px; margin-bottom: 10px;
  background: var(--gray-2); color: var(--slate);
}
.ostatus--outfordelivery, .ostatus--dispatched, .ostatus--readytocollect { background: var(--macaw); }
.ostatus--delivered { background: var(--blue); }
.ostatus--delayed, .ostatus--missing { background: var(--red-400); }
.ostatus--processing { background: var(--purple); }
.ostatus--locked { background: var(--gray-2); }
.ocard__facts { margin-bottom: 8px; }
.ocard__steps { margin: 0; padding-left: 20px; font-size: 14px; color: var(--gray-4); }
.ocard__steps li + li { margin-top: 4px; }
.ocard__steps .is-next { color: var(--slate); font-weight: 600; }
/* The one card action that does something: the agent vouching for the caller. */
.chip--button {
  border: 1px solid var(--slate); background: var(--slate); color: var(--white);
  font-size: 11px; padding: 4px 12px; cursor: pointer;
}
.chip--button:hover { background: var(--gray-5); border-color: var(--gray-5); }
.ocard__detail { font-size: 13px; color: var(--gray-5); margin: 0; }

.correction {
  border: 1px solid;
  border-radius: var(--r-card);
  padding: 12px 16px;
  margin-bottom: 20px;
  font-size: 14px;
  animation: assist-arrive 2.5s ease-out;
}
.correction h4 { font-size: 13px; font-weight: 600; margin: 0 0 4px; }
.correction ul { margin: 0; padding-left: 18px; }
.correction p { margin: 6px 0 0; color: var(--gray-5); }
.correction--incorrect { background: var(--red-100); border-color: var(--red-400); }
.correction--partial { background: var(--macaw-100); border-color: var(--macaw-400); }

/* ---------------- event log ---------------- */

.assist__log { margin-top: 16px; }
.assist__log summary { font-size: 11px; color: var(--gray-4); cursor: pointer; }
.assist__log pre { font-size: 11px; max-height: 240px; overflow: auto; background: var(--white); border: 1px solid var(--gray-2); border-radius: var(--r-btn); padding: 12px; white-space: pre-wrap; }

/* ============================================================
   SETTINGS DIALOG
   ============================================================ */

.topbar__settings {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid rgba(255,255,255,0.24);
  background: rgba(255,255,255,0.1);
  color: var(--white);
  font-size: 12px;
  padding: 6px 12px;
  border-radius: var(--r-btn);
}
.topbar__settings:hover { background: rgba(255,255,255,0.2); }
.topbar__settings:focus-visible, .modal__close:focus-visible, .modal__select:focus-visible {
  outline: 2px solid var(--macaw-400);
  outline-offset: 2px;
}
.topbar__settings .icon { width: 16px; height: 16px; }

.modal-backdrop { position: fixed; inset: 0; background: rgba(35, 31, 32, 0.55); z-index: 100; }

.modal {
  position: fixed;
  z-index: 101;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(520px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  background: var(--white);
  color: var(--slate);
  border-radius: var(--r-card);
  box-shadow: 0 24px 48px rgba(35, 31, 32, 0.25);
  display: flex;
  flex-direction: column;
}
.modal:focus { outline: none; }

.modal__head { display: flex; align-items: center; justify-content: space-between; padding: 20px 24px 12px; }
.modal__title { font-size: 20px; font-weight: 600; margin: 0; }
.modal__close { border: none; background: none; color: var(--gray-4); padding: 6px; border-radius: var(--r-btn); display: flex; }
.modal__close:hover { background: var(--gray-1); color: var(--slate); }

.modal__body { padding: 8px 24px 16px; display: flex; flex-direction: column; gap: 10px; }

.modal__select {
  font: inherit;
  font-size: 15px;
  padding: 10px 12px;
  border: 1px solid var(--gray-2);
  border-radius: var(--r-btn);
  background: var(--white);
  color: var(--slate);
}

.modal__summary { font-size: 14px; color: var(--gray-5); margin: 4px 0 0; }

.modal__topics { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.modal__topics li { font-size: 13px; padding: 4px 10px; border-radius: 999px; background: var(--gray-1); }

.modal__status { font-size: 12px; color: var(--gray-5); margin: 6px 0 0; }
.modal__status.is-error { color: var(--slate); background: var(--red-100); border: 1px solid var(--red-400); border-radius: var(--r-btn); padding: 8px 10px; }

.modal__foot { display: flex; justify-content: flex-end; padding: 12px 24px 20px; border-top: 1px solid var(--gray-1); }
