:root {
  --ink: #0f1729;
  --ink-2: #3a4459;
  --muted: #6b7489;
  --faint: #9aa2b3;
  --bg: #f5f6f9;
  --surface: #ffffff;
  --surface-2: #f8f9fb;
  --border: #e3e6ec;
  --violet: #6a5bff;
  --violet-soft: #efedff;
  --violet-ink: #4a3df0;
  --cyan: #1fb6d9;
  --cyan-soft: #e4f7fc;
  --green: #12a46b;
  --green-soft: #e3f6ee;
  --red: #e0414f;
  --red-soft: #fdecee;
  --amber: #d98a10;
  --amber-soft: #fdf3e1;
  --grey-soft: #eef0f4;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(15, 23, 41, .04), 0 4px 16px rgba(15, 23, 41, .05);
  --head: "Plus Jakarta Sans", system-ui, sans-serif;
  --rail-w: 248px;
  --body: "Inter", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Menlo, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.5 var(--body);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
h1, h2 { font-family: var(--head); margin: 0; letter-spacing: -.01em; }
h2 { font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-2); }
code { font-family: var(--mono); }
.muted { color: var(--muted); }
.small { font-size: 12px; }
[hidden] { display: none !important; }

/* OS shell: module rail + main column */
.os { display: grid; grid-template-columns: var(--rail-w) minmax(0, 1fr); min-height: 100vh; }
.os-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }

.rail {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column;
  background: var(--surface); border-right: 1px solid var(--border);
  padding: 18px 14px 14px;
}
.os-brand { display: flex; align-items: center; gap: 11px; padding: 4px 8px 18px; color: inherit; text-decoration: none; }
.os-mark {
  width: 36px; height: 36px; flex: none; display: grid; place-items: center;
  border-radius: 10px; background: var(--ink); color: #fff;
  font: 800 18px var(--head); letter-spacing: -.02em;
  box-shadow: inset 0 -2px 0 rgba(255, 255, 255, .08), 0 4px 12px rgba(15, 23, 41, .18);
}
.os-name { display: flex; flex-direction: column; line-height: 1.2; }
.os-name strong { font: 700 15.5px var(--head); letter-spacing: -.01em; }
.os-name small { font-size: 11.5px; color: var(--violet-ink); font-weight: 500; }
.rail-scroll { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; }
.rail-group {
  margin: 18px 10px 6px; font-size: 11px; font-weight: 600; letter-spacing: .08em;
  text-transform: uppercase; color: var(--faint);
}
.rail-link {
  position: relative; display: flex; align-items: center; gap: 11px;
  height: 38px; padding: 0 10px; border-radius: 9px;
  color: var(--ink-2); text-decoration: none; font-weight: 500;
  transition: background .15s, color .15s;
}
.rail-link .ico { width: 18px; height: 18px; flex: none; }
a.rail-link:hover { background: var(--surface-2); color: var(--ink); }
.rail-link[aria-current="page"] { background: var(--violet); color: #fff; box-shadow: 0 4px 14px rgba(106, 91, 255, .28); }
.rail-link[aria-current="page"]:hover { background: var(--violet-ink); color: #fff; }
.rail-module { display: flex; flex-direction: column; gap: 2px; }
.rail-module-head { color: var(--ink); font-weight: 600; }
.rail-module.open .rail-module-head .ico { color: var(--violet); }
.rail-sub { height: 34px; margin-left: 18px; padding-left: 12px; font-size: 13.5px; }
.rail-sub .ico { width: 16px; height: 16px; }
.rail-module:not(.open) .rail-sub { display: none; }
.rail-live, .rail-next em {
  margin-left: auto; font-style: normal; font-size: 10.5px; font-weight: 600;
  letter-spacing: .04em; padding: 1px 7px; border-radius: 999px;
}
.rail-live { color: var(--green); background: var(--green-soft); }
.rail-next { color: var(--faint); cursor: default; }
.rail-next em { color: var(--muted); background: var(--grey-soft); }
.rail-ring { display: none; width: 8px; height: 8px; margin-left: auto; border-radius: 50%; background: var(--green); }
.os:has(.phone[data-state="ringing"]) .rail-ring { display: block; animation: blink .6s steps(2) infinite; }
.rail-link[aria-current="page"] .rail-ring { background: #fff; box-shadow: 0 0 0 3px rgba(18, 164, 107, .9); }
.rail-foot { margin: 10px 8px 0; font-size: 11.5px; color: var(--faint); line-height: 1.4; }

/* Header */
.topbar {
  display: flex; align-items: center; gap: 18px;
  padding: 14px 24px; min-height: 72px;
  background: rgba(245, 246, 249, .86); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 10;
}
.crumbs { min-width: 0; }
.crumb-trail { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); }
.crumb-trail a { color: inherit; text-decoration: none; }
.crumb-trail a:hover { color: var(--violet-ink); }
.crumb-sep { color: var(--faint); }
.page-title { font-size: 21px; font-weight: 700; letter-spacing: -.02em; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pills { display: flex; gap: 8px; flex-wrap: wrap; margin-left: auto; }
.pill {
  display: inline-flex; align-items: center; gap: 7px;
  height: 30px; padding: 0 12px;
  border: 1px solid var(--border); border-radius: 999px;
  font-size: 13px; font-weight: 500; background: var(--surface);
  white-space: nowrap;
}
.pill i { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); }
.pill.ok { background: var(--green-soft); border-color: #bfe8d6; color: #0b6b46; }
.pill.ok i { background: var(--green); box-shadow: 0 0 0 3px rgba(18, 164, 107, .18); }
.pill.bad { background: var(--red-soft); border-color: #f6c3c8; color: #a8202d; }
.pill.bad i { background: var(--red); animation: blink 1s steps(2) infinite; }
.pill.off { background: var(--grey-soft); color: var(--muted); }
.pill-info { gap: 6px; }
.pill-label { color: var(--muted); font-weight: 400; }
#pill-tx-name { font-family: var(--mono); font-size: 12px; color: var(--violet-ink); }
.clock { font-family: var(--mono); font-size: 13px; color: var(--ink-2); min-width: 64px; text-align: right; }

/* Banners */
.banner {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 24px;
  background: var(--red); color: #fff;
  font-size: 15px;
  animation: slide-down .3s ease-out;
}
.banner svg { width: 22px; height: 22px; flex: none; }
.banner-core { background: var(--amber); }

/* Layout */
.layout {
  flex: 1;
  display: grid;
  grid-template-columns: 264px minmax(0, 1fr) 312px;
  gap: 16px;
  padding: 16px;
  min-height: 0;
}
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.panel-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 18px 12px;
}
.count {
  font-family: var(--mono); font-size: 12px; color: var(--muted);
  background: var(--grey-soft); border-radius: 999px; padding: 1px 9px;
}
.empty { display: flex; gap: 10px; color: var(--muted); padding: 4px 18px 18px; margin: 0; font-size: 13px; }
.empty p { margin: 0; line-height: 1.45; }
.empty strong { display: block; color: var(--ink); font-weight: 600; font-size: 13.5px; margin-bottom: 2px; }
.empty-dot { width: 8px; height: 8px; margin-top: 6px; flex: none; border-radius: 50%; background: var(--amber); animation: pulse 1.8s ease-in-out infinite; }

@media (min-width: 1201px) {
  .os { height: 100vh; overflow: hidden; }
  .os-main { overflow: hidden; }
  .layout { overflow: hidden; }
  .home { overflow-y: auto; }
  .conv-list, .commit-panel, .transcript { overflow-y: auto; }
}

/* Conversation list */
.conv-list { list-style: none; margin: 0; padding: 0 10px 10px; }
.conv {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 8px;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
.conv + .conv { margin-top: 4px; }
.conv:hover { background: var(--surface-2); }
.conv.selected { background: var(--violet-soft); border-color: #d6d1ff; }
.conv:focus-visible { outline: 2px solid var(--violet); outline-offset: 1px; }
.conv-caller { font-family: var(--mono); font-weight: 500; font-size: 14px; letter-spacing: .02em; }
.conv-dur { font-family: var(--mono); font-size: 12px; color: var(--muted); text-align: right; }
.conv-agent { font-size: 12px; color: var(--muted); }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em;
  padding: 2px 9px; border-radius: 999px; justify-self: end; height: 22px;
}
.chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.chip.ringing { background: var(--amber-soft); color: var(--amber); }
.chip.ringing::before { animation: blink 0.8s steps(2) infinite; }
.chip.active { background: var(--green-soft); color: var(--green); }
.chip.active::before { animation: pulse 1.6s ease-in-out infinite; }
.chip.transferring { background: var(--cyan-soft); color: #0e86a3; }
.chip.transferring::before { animation: blink 0.8s steps(2) infinite; }
.chip.ended { background: var(--grey-soft); color: var(--muted); }

/* Detail */
.detail-panel { overflow: hidden; }
.detail-empty { flex: 1; display: grid; place-items: center; padding: 40px; text-align: center; }
.detail-empty svg { width: 40px; height: 40px; color: var(--faint); }
.detail-empty p { margin: 6px 0 0; }
.detail-empty-inner { max-width: 360px; }
.detail-empty-inner svg { width: 52px; height: 52px; padding: 12px; border-radius: 16px; background: var(--violet-soft); color: var(--violet); }
.detail-empty-title { font: 700 18px var(--head); color: var(--ink); margin-top: 14px !important; }
.detail-empty-dial { margin-top: 18px !important; font: 600 15px var(--head); color: var(--violet-ink); letter-spacing: .01em; }
.detail-body { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.detail-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
  padding: 20px 22px 14px;
}
.detail-title { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.detail-title h1 { font-size: 26px; font-weight: 600; font-family: var(--mono); letter-spacing: .01em; }
.duration { font-family: var(--mono); font-size: 14px; color: var(--ink-2); }
.conv-id { margin-top: 6px; font-size: 12px; color: var(--muted); }
.conv-id code {
  font-size: 11.5px; color: var(--violet-ink); background: var(--violet-soft);
  padding: 2px 7px; border-radius: 6px; word-break: break-all;
}
.btn-transfer {
  flex: none;
  display: inline-flex; align-items: center; gap: 8px;
  height: 40px; padding: 0 16px;
  font: 600 14px var(--body);
  color: #fff; background: var(--violet);
  border: 0; border-radius: 10px; cursor: pointer;
  box-shadow: 0 4px 14px rgba(106, 91, 255, .3);
  transition: transform .1s, background .15s;
}
.btn-transfer:hover { background: var(--violet-ink); }
.btn-transfer:active { transform: translateY(1px); }
.btn-transfer:disabled { background: var(--faint); box-shadow: none; cursor: default; }
.btn-transfer svg { width: 16px; height: 16px; }

/* Timeline */
.timeline {
  list-style: none; margin: 0; padding: 14px 22px;
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px 0;
  border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}
.tl-step { display: flex; align-items: center; }
.tl-node {
  display: flex; flex-direction: column;
  padding: 6px 12px; border-radius: 10px;
  background: var(--surface); border: 1px solid var(--border);
  min-width: 84px;
}
.tl-node strong { font-size: 13px; font-weight: 600; }
.tl-node span { font-size: 11.5px; color: var(--muted); font-family: var(--mono); }
.tl-node.live { border-color: #9be0c4; box-shadow: 0 0 0 3px var(--green-soft); }
.tl-node.live strong::after {
  content: ""; display: inline-block; width: 7px; height: 7px; margin-left: 7px;
  border-radius: 50%; background: var(--green); vertical-align: 1px;
  animation: pulse 1.6s ease-in-out infinite;
}
.tl-node.ringing { border-color: #f0cf96; box-shadow: 0 0 0 3px var(--amber-soft); }
.tl-node.done { opacity: .62; }
.tl-node.caller strong { font-family: var(--mono); }
.tl-arrow { width: 26px; height: 12px; color: var(--faint); flex: none; margin: 0 4px; }
.tl-transfer {
  margin-right: 8px;
  font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em;
  color: #0e86a3; background: var(--cyan-soft); border-radius: 999px; padding: 3px 9px;
}

/* Transcript */
.transcript-head {
  display: flex; align-items: baseline; justify-content: space-between;
  padding: 16px 22px 4px;
}
.transcript {
  flex: 1;
  padding: 10px 22px 22px;
  display: flex; flex-direction: column; gap: 10px;
  min-height: 240px;
  scroll-behavior: smooth;
}
.transcript .empty { padding: 20px 0; }
.bubble-row { display: flex; flex-direction: column; max-width: 78%; animation: fade-up .25s ease-out; }
.bubble-row.caller { align-self: flex-start; }
.bubble-row.agent { align-self: flex-end; align-items: flex-end; }
.bubble-meta { font-size: 11.5px; color: var(--muted); margin: 0 6px 3px; display: flex; gap: 8px; }
.bubble-meta b { font-weight: 600; color: var(--ink-2); }
.bubble {
  padding: 10px 14px; border-radius: 16px;
  font-size: 15px; line-height: 1.45;
  white-space: pre-wrap; overflow-wrap: anywhere;
  transition: background .3s, color .3s, box-shadow .3s;
}
.caller .bubble { background: var(--grey-soft); border-bottom-left-radius: 5px; }
.agent .bubble { background: var(--violet-soft); color: #241a8c; border-bottom-right-radius: 5px; }
.bubble.interim { color: var(--faint); background: transparent; border: 1px dashed var(--border); font-style: italic; }
.bubble.interim::after { content: " …"; }
.bubble-row.has-commit .bubble {
  box-shadow: 0 0 0 2px var(--violet), 0 6px 20px rgba(106, 91, 255, .18);
  background: #fff;
  color: var(--ink);
}
.commit-tag {
  display: inline-flex; align-items: center; gap: 5px;
  margin: 5px 6px 0; font-size: 11px; font-weight: 600;
  color: var(--violet-ink); text-transform: uppercase; letter-spacing: .05em;
}
.commit-tag::before { content: ""; width: 6px; height: 6px; border-radius: 2px; background: var(--violet); transform: rotate(45deg); }
.bubble-row.flash .bubble { animation: flash 1.2s ease-out; }

/* Commitments */
.commit-list { padding: 0 14px 14px; display: flex; flex-direction: column; gap: 12px; }
.card {
  border: 1px solid var(--border); border-radius: 12px;
  padding: 14px 16px 14px 18px;
  position: relative; overflow: hidden;
  background: var(--surface);
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s;
}
.card::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px;
  background: linear-gradient(var(--violet), var(--cyan));
}
.card:hover { border-color: #cfc9ff; box-shadow: 0 4px 16px rgba(106, 91, 255, .12); }
.card.new { animation: card-in .55s cubic-bezier(.2, .9, .3, 1.2); }
.card-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.kind {
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
  color: var(--violet-ink); background: var(--violet-soft); border-radius: 6px; padding: 2px 8px;
}
.kind.callback { color: #0e86a3; background: var(--cyan-soft); }
.kind.visit { color: #0b6b46; background: var(--green-soft); }
.kind.purchase { color: #8a5a00; background: var(--amber-soft); }
.kind.other { color: var(--ink-2); background: var(--grey-soft); }
.card-time { font-family: var(--mono); font-size: 11.5px; color: var(--muted); }
.card-summary { font-family: var(--head); font-size: 16px; font-weight: 600; line-height: 1.3; margin: 10px 0 8px; }
.card-due { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 500; color: var(--ink-2); }
.card-due svg { width: 14px; height: 14px; color: var(--violet); flex: none; }
.card-quote {
  margin: 10px 0 12px; padding: 8px 12px;
  border-left: 2px solid var(--border);
  color: var(--ink-2); font-style: italic; font-size: 13.5px;
}
.conf { display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--muted); }
.conf-bar { flex: 1; height: 5px; border-radius: 3px; background: var(--grey-soft); overflow: hidden; }
.conf-bar > i { display: block; height: 100%; background: linear-gradient(90deg, var(--violet), var(--cyan)); border-radius: 3px; }
.conf b { font-family: var(--mono); font-weight: 500; color: var(--ink); }
.saved { display: inline-flex; align-items: center; gap: 4px; }
.saved::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--green); }

/* Coach: the live next line for the rep */
.coach {
  flex: none;
  margin: 0 16px 16px;
  padding: 16px 20px 14px;
  border-radius: 14px;
  color: #fff;
  background:
    radial-gradient(120% 140% at 0% 0%, rgba(106, 91, 255, .45), transparent 55%),
    radial-gradient(120% 140% at 100% 100%, rgba(31, 182, 217, .30), transparent 55%),
    var(--ink);
  border: 1px solid rgba(124, 110, 255, .7);
  box-shadow: 0 12px 32px rgba(74, 61, 240, .28);
  position: sticky;
  bottom: 12px;
  z-index: 2;
}
.coach-head { display: flex; align-items: center; gap: 10px; }
.coach-label {
  display: inline-flex; align-items: center; gap: 6px;
  font: 700 12px var(--head); text-transform: uppercase; letter-spacing: .12em; color: #8fe3f5;
}
.coach-label svg { width: 13px; height: 13px; }
.coach-kind {
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
  padding: 2px 9px; border-radius: 999px; background: rgba(255, 255, 255, .14); color: #fff;
}
.coach-kind.next_line { background: #6a5bff; }
.coach-kind.objection { background: #d98a10; }
.coach-kind.question { background: #1592b0; }
.coach-kind.close { background: #12a46b; }
.coach-time { margin-left: auto; font-family: var(--mono); font-size: 11.5px; color: rgba(255, 255, 255, .55); }
.coach.paused { border-color: rgba(255, 255, 255, .2); box-shadow: none; }
.coach.paused .coach-time { color: #ffb4bb; font-family: var(--body); font-weight: 600; }
.coach.paused .coach-body { opacity: .55; }
.coach-body.fresh { animation: coach-in .5s cubic-bezier(.2, .9, .3, 1.1); }
.coach.flash { animation: coach-glow 1.4s ease-out; }
.coach-line { margin: 10px 0 4px; font: 600 21px/1.32 var(--head); letter-spacing: -.01em; overflow-wrap: anywhere; }
.coach-why { margin: 0; font-size: 13px; color: rgba(255, 255, 255, .62); overflow-wrap: anywhere; }
.coach-idle { margin: 10px 0 2px; font-size: 15px; color: rgba(255, 255, 255, .7); }
.coach-history { margin-top: 10px; border-top: 1px solid rgba(255, 255, 255, .12); padding-top: 8px; }
.coach-history summary { cursor: pointer; font-size: 12px; color: rgba(255, 255, 255, .6); list-style: none; }
.coach-history summary::-webkit-details-marker { display: none; }
.coach-history summary::before { content: "▸ "; }
.coach-history[open] summary::before { content: "▾ "; }
.coach-history ol { list-style: none; margin: 8px 0 0; padding: 0; max-height: 132px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; }
.coach-history li { font-size: 13px; color: rgba(255, 255, 255, .82); display: flex; gap: 8px; align-items: baseline; }
.coach-history li .coach-kind { flex: none; font-size: 10px; padding: 1px 7px; }

/* Call notes (ended calls) */
.notes {
  margin: 14px 14px 4px;
  padding: 16px;
  border: 1px solid #d6d1ff;
  border-radius: 12px;
  background: linear-gradient(180deg, var(--violet-soft), #fff 70%);
  animation: fade-up .3s ease-out;
}
.notes-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 8px; }
.notes-time { font-family: var(--mono); font-size: 11.5px; color: var(--muted); }
.notes-summary { margin: 0 0 14px; font-size: 14.5px; line-height: 1.5; color: var(--ink); }
.notes h3 { margin: 0 0 6px; font: 600 11.5px var(--body); text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.steps { list-style: none; margin: 0 0 14px; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.steps li { display: flex; gap: 9px; font-size: 13.5px; line-height: 1.4; }
.steps li::before {
  content: ""; flex: none; width: 14px; height: 14px; margin-top: 2px;
  border: 1.5px solid var(--violet); border-radius: 4px; background: #fff;
}
.facts { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 0; font-size: 13.5px; }
.facts dt { color: var(--muted); font-size: 12.5px; }
.facts dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }
.facts dd.unknown { color: var(--faint); font-weight: 400; }
.notes-pending { margin: 0; font-size: 13.5px; color: var(--muted); }

/* Animations */
/* Rep phone (/rep) */
.phone {
  margin: 12px 12px 4px; padding: 14px 16px 16px;
  border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2);
}
.phone[data-state="ringing"] { border-color: var(--green); background: var(--green-soft); animation: ring-pulse 1.2s ease-in-out infinite; }
.phone[data-state="ringing"] .phone-state strong { font: 700 18px var(--head); color: #0b6b46; }
.phone[data-state="ringing"] .ph-btn { height: 46px; font-size: 15px; }
.phone[data-state="active"] { border-color: #bfe8d6; background: var(--green-soft); }
.phone-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.phone-head h2 { font-size: 15px; }
.phone-head select {
  font: 500 13px var(--body); color: var(--ink); background: var(--surface);
  border: 1px solid var(--border); border-radius: 8px; padding: 4px 8px;
}
.phone-state { display: flex; align-items: center; gap: 8px; margin-top: 12px; font-size: 14px; }
.phone-state i { width: 9px; height: 9px; border-radius: 50%; background: var(--faint); }
.phone[data-state="connecting"] .phone-state i { background: var(--amber); animation: blink 1s steps(2) infinite; }
.phone[data-state="ready"] .phone-state i,
.phone[data-state="active"] .phone-state i { background: var(--green); box-shadow: 0 0 0 3px rgba(18, 164, 107, .18); }
.phone[data-state="ringing"] .phone-state i { background: var(--green); animation: blink .6s steps(2) infinite; }
.phone-detail { margin: 2px 0 0 17px; min-height: 1.5em; color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
.phone-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.ph-btn {
  flex: 1 1 auto; height: 38px; padding: 0 14px;
  font: 600 14px var(--body); color: var(--ink); background: var(--surface);
  border: 1px solid var(--border); border-radius: 10px; cursor: pointer;
}
.ph-btn.primary { color: #fff; background: var(--violet); border-color: var(--violet); }
.ph-btn.answer { color: #fff; background: var(--green); border-color: var(--green); }
.ph-btn.decline { color: #fff; background: var(--red); border-color: var(--red); }
.ph-btn.on { background: var(--amber-soft); border-color: var(--amber); }
.ph-btn:active { transform: translateY(1px); }
@keyframes ring-pulse { 50% { box-shadow: 0 0 0 8px rgba(18, 164, 107, .2); } }

@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
@keyframes blink { 50% { opacity: .25; } }
@keyframes fade-up { from { opacity: 0; transform: translateY(6px); } }
@keyframes slide-down { from { transform: translateY(-100%); opacity: 0; } }
@keyframes card-in {
  0% { opacity: 0; transform: translateX(24px) scale(.96); box-shadow: 0 0 0 0 rgba(106, 91, 255, .5); }
  60% { opacity: 1; box-shadow: 0 0 0 8px rgba(106, 91, 255, 0); }
  100% { transform: none; }
}
@keyframes coach-in { from { opacity: 0; transform: translateY(10px); filter: blur(2px); } }
@keyframes coach-glow { 0% { box-shadow: 0 0 0 4px rgba(143, 227, 245, .55), 0 12px 32px rgba(74, 61, 240, .45); } }
@keyframes flash { 0% { box-shadow: 0 0 0 6px rgba(106, 91, 255, .45); } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* OS Home */
.home { flex: 1; padding: 28px 28px 32px; display: flex; flex-direction: column; gap: 22px; }
.home > * { width: 100%; max-width: 1240px; margin-left: auto; margin-right: auto; }
.home-date { margin: 0; font-size: 13px; color: var(--muted); }
.home-greeting { margin-top: 2px; font-size: 30px; font-weight: 800; letter-spacing: -.03em; text-transform: none; color: var(--ink); }
.home-lede { margin: 6px 0 0; max-width: 560px; color: var(--ink-2); font-size: 14.5px; }
.home-modules { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 16px; }
.tile {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 20px;
}
.tile h3 { margin: 0; font: 700 17px var(--head); letter-spacing: -.01em; }
.tile p { margin: 4px 0 0; color: var(--muted); font-size: 13.5px; line-height: 1.45; }
.tile-icon { display: grid; place-items: center; width: 40px; height: 40px; flex: none; border-radius: 11px; background: var(--violet-soft); color: var(--violet); }
.tile-icon .ico { width: 21px; height: 21px; }
.tile-live { display: flex; flex-direction: column; gap: 18px; position: relative; overflow: hidden; }
.tile-live::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 3px;
  background: linear-gradient(90deg, var(--violet), var(--cyan));
}
.tile-head { display: flex; align-items: flex-start; gap: 14px; }
.tile-badge {
  margin-left: auto; display: inline-flex; align-items: center; gap: 6px; flex: none;
  font-size: 12px; font-weight: 600; color: var(--green); background: var(--green-soft);
  padding: 3px 10px; border-radius: 999px;
}
.tile-badge i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; animation: pulse 1.8s ease-in-out infinite; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 0; }
.stats div { background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; }
.stats dt { font-size: 12px; color: var(--muted); }
.stats dd { margin: 4px 0 0; font: 700 30px var(--head); letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.tile-actions { display: flex; gap: 10px; margin-top: auto; }
.tile-line {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 18px; margin: 0;
  padding: 12px 14px; border-radius: 12px; background: var(--violet-soft); color: var(--ink-2); font-size: 13px;
}
.tile-line strong { font-family: var(--mono); font-weight: 500; color: var(--ink); }
.tile-line span { display: inline-flex; align-items: center; gap: 6px; }
.tile-line .ico { width: 15px; height: 15px; color: var(--violet); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; height: 40px; padding: 0 18px;
  border-radius: 10px; border: 1px solid var(--border); background: var(--surface);
  color: var(--ink); font: 600 14px var(--body); text-decoration: none;
  transition: background .15s, transform .1s;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--violet); border-color: var(--violet); color: #fff; box-shadow: 0 4px 14px rgba(106, 91, 255, .3); }
.btn-primary:hover { background: var(--violet-ink); }
.tile-next-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.tile-next { position: relative; padding: 18px; background: var(--surface-2); box-shadow: none; }
.tile-next .tile-icon { background: var(--grey-soft); color: var(--muted); margin-bottom: 12px; }
.tile-next h3 { color: var(--ink-2); }
.tile-soon {
  position: absolute; top: 18px; right: 18px; font-size: 11px; font-weight: 600;
  color: var(--muted); background: var(--surface); border: 1px solid var(--border);
  padding: 2px 8px; border-radius: 999px;
}
.home-recent { padding-bottom: 6px; }
.panel-link { font-size: 13px; font-weight: 600; color: var(--violet-ink); text-decoration: none; }
.panel-link:hover { text-decoration: underline; }
.recent-list { list-style: none; margin: 0; padding: 0 10px 8px; }
.recent { display: flex; align-items: center; gap: 14px; padding: 12px 10px; border-top: 1px solid var(--border); }
.recent:first-child { border-top: 0; }
.recent-kind {
  flex: none; min-width: 96px; text-align: center; font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .05em; padding: 3px 9px; border-radius: 999px;
  background: var(--violet-soft); color: var(--violet-ink);
}
.recent-kind.kind-callback { background: var(--cyan-soft); color: #0e86a3; }
.recent-kind.kind-purchase { background: var(--green-soft); color: var(--green); }
.recent-body { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.recent-body strong { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recent-meta { font-size: 12.5px; color: var(--muted); }
.recent-at { flex: none; font-family: var(--mono); font-size: 12px; color: var(--muted); }

/* Tablet: commitments drop under the transcript */
@media (max-width: 1200px) {
  .layout { flex: 1 0 auto; grid-template-columns: 260px minmax(0, 1fr); }
  .panel { min-height: auto; }
  .detail-panel { overflow: visible; }
  .commit-panel { grid-column: 1 / -1; }
  .commit-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
}

/* Narrow: the rail becomes a top bar */
@media (max-width: 900px) {
  .os { grid-template-columns: minmax(0, 1fr); }
  .rail {
    position: static; height: auto; flex-direction: row; align-items: center; gap: 8px;
    padding: 10px 12px; border-right: 0; border-bottom: 1px solid var(--border);
  }
  .os-brand { padding: 0 4px 0 0; }
  .os-mark { width: 32px; height: 32px; font-size: 16px; }
  .os-name small, .rail-group, .rail-next, .rail-foot, .rail-module-head { display: none; }
  .rail-scroll { flex-direction: row; overflow-x: auto; gap: 4px; margin-left: auto; scrollbar-width: none; }
  .rail-module { flex-direction: row; gap: 4px; }
  .rail-module:not(.open) .rail-sub { display: flex; }
  .rail-link, .rail-sub { height: 34px; margin: 0; padding: 0 10px; font-size: 13px; white-space: nowrap; }
  .topbar { position: static; }
  .home { padding: 20px 16px 24px; }
  .home-modules { grid-template-columns: minmax(0, 1fr); }
}

/* Phone */
@media (max-width: 720px) {
  .os-name strong { font-size: 14px; }
  .rail .os-name { display: none; }
  .rail-link .ico { display: none; }
  .topbar { flex-wrap: wrap; gap: 10px 12px; padding: 12px 16px; min-height: 0; }
  .page-title { font-size: 18px; }
  .pills { order: 3; width: 100%; margin-left: 0; }
  .pill { height: 26px; padding: 0 10px; font-size: 12px; }
  .clock { margin-left: auto; }
  .banner { padding: 10px 16px; font-size: 14px; }
  .layout { grid-template-columns: minmax(0, 1fr); padding: 12px; gap: 12px; }
  .conv-list { display: flex; gap: 8px; overflow-x: auto; padding: 0 12px 12px; scroll-snap-type: x mandatory; }
  .conv { flex: 0 0 210px; border-color: var(--border); scroll-snap-align: start; }
  .conv + .conv { margin-top: 0; }
  .detail-head { flex-direction: column; padding: 16px; }
  .detail-title h1 { font-size: 22px; }
  .conv-id code { display: block; width: fit-content; margin-top: 4px; font-size: 10.5px; }
  .btn-transfer { width: 100%; justify-content: center; }
  .timeline { padding: 12px 16px; }
  .tl-node { min-width: 0; }
  .tl-arrow { width: 18px; margin: 0 2px; }
  .transcript-head { padding: 14px 16px 4px; }
  .transcript { padding: 8px 16px 16px; }
  .bubble-row { max-width: 90%; }
  .commit-list { display: flex; }
  .coach { margin: 0 10px 10px; padding: 14px 16px 12px; }
  .coach-line { font-size: 19px; }
  .notes { margin: 12px 12px 4px; }
  .home-greeting { font-size: 25px; }
  .stats dd { font-size: 24px; }
  .stats div { padding: 12px; }
  .tile-next-grid { grid-template-columns: minmax(0, 1fr); }
  .recent { display: grid; grid-template-columns: auto 1fr; gap: 6px 10px; }
  .recent-kind { min-width: 0; justify-self: start; }
  .recent-at { justify-self: end; align-self: center; }
  .recent-body { grid-column: 1 / -1; grid-row: 2; }
  .recent-body strong { white-space: normal; }
}

/* Sign in, forgot password, choose a password */
.auth { display: grid; grid-template-columns: minmax(380px, 46%) minmax(0, 1fr); min-height: 100vh; }
.auth-brand {
  position: relative; overflow: hidden;
  display: flex; flex-direction: column; justify-content: space-between; gap: 40px;
  padding: 36px 44px; color: #fff;
  background:
    radial-gradient(90% 70% at 0% 0%, rgba(106, 91, 255, .55), transparent 60%),
    radial-gradient(80% 60% at 100% 100%, rgba(31, 182, 217, .35), transparent 60%),
    var(--ink);
}
.auth-brand::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image: linear-gradient(rgba(255, 255, 255, .04) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, .04) 1px, transparent 1px);
  background-size: 40px 40px;
  mask-image: radial-gradient(70% 60% at 30% 40%, #000, transparent);
}
.auth-brand > * { position: relative; z-index: 1; }
.auth-brand-top { display: flex; align-items: center; gap: 12px; }
.auth-brand .os-mark { background: #fff; color: var(--ink); }
.auth-brand .os-name small { color: #b9b2ff; }
.auth-pitch { max-width: 460px; }
.auth-kicker {
  display: inline-flex; align-items: center; gap: 8px; margin: 0 0 18px;
  font-size: 12.5px; font-weight: 600; letter-spacing: .04em; color: #8fe3c2;
}
.auth-kicker::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #3ddc97; box-shadow: 0 0 0 4px rgba(61, 220, 151, .2); animation: pulse 1.8s ease-in-out infinite; }
.auth-headline { font: 700 34px/1.18 var(--head); letter-spacing: -.025em; text-transform: none; color: #fff; }
.auth-points { list-style: none; margin: 26px 0 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.auth-points li { display: flex; gap: 12px; font-size: 15px; color: rgba(255, 255, 255, .78); line-height: 1.45; }
.auth-points li::before {
  content: ""; flex: none; width: 18px; height: 18px; margin-top: 1px; border-radius: 6px;
  background: rgba(143, 227, 245, .16) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238fe3f5' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 12 5 5 9-10'/%3E%3C/svg%3E") center / 12px no-repeat;
}
.auth-foot { margin: 0; font-size: 12.5px; color: rgba(255, 255, 255, .5); }
.auth-main { display: grid; place-items: center; padding: 40px 24px; }
.auth-card { width: min(400px, 100%); display: flex; flex-direction: column; animation: rise .35s ease-out; }
.auth-card h1 { font-size: 28px; font-weight: 700; letter-spacing: -.02em; }
.auth-sub { margin: 8px 0 26px; color: var(--muted); font-size: 14.5px; }
.auth-card form { display: flex; flex-direction: column; gap: 16px; }
.field { display: flex; flex-direction: column; gap: 7px; }
.field > span:first-child { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.field input, .field select {
  width: 100%; height: 44px; padding: 0 14px;
  border: 1px solid var(--border); border-radius: 10px; background: var(--surface);
  font: 15px var(--body); color: var(--ink);
  transition: border-color .15s, box-shadow .15s;
}
.field input:focus, .field select:focus { outline: none; border-color: var(--violet); box-shadow: 0 0 0 4px rgba(106, 91, 255, .14); }
.field-hint { font-size: 12px; color: var(--muted); }
.pw { position: relative; display: block; }
.pw input { padding-right: 46px; }
.pw-eye {
  position: absolute; top: 50%; right: 6px; transform: translateY(-50%);
  width: 34px; height: 34px; display: grid; place-items: center;
  border: 0; border-radius: 8px; background: transparent; color: var(--muted); cursor: pointer;
}
.pw-eye:hover { background: var(--surface-2); color: var(--ink); }
.pw-eye:focus-visible { outline: 2px solid var(--violet); }
.pw-eye svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.pw-eye .eye-shut, .pw-eye[aria-pressed="true"] .eye-open { display: none; }
.pw-eye[aria-pressed="true"] .eye-shut { display: inline; }
.auth-error {
  margin: 0; padding: 10px 12px; border-radius: 10px;
  background: var(--red-soft); color: #a8202d; font-size: 13.5px; border: 1px solid #f6c3c8;
}
.auth-submit { height: 46px; margin-top: 4px; font-size: 15px; border: 0; cursor: pointer; width: 100%; }
.auth-submit:disabled { opacity: .7; cursor: default; }
.auth-link {
  align-self: center; margin-top: 18px; padding: 4px;
  border: 0; background: none; cursor: pointer;
  font: 600 13.5px var(--body); color: var(--violet-ink); text-decoration: none;
}
.auth-link:hover { text-decoration: underline; }
.auth-alt { height: 46px; margin-top: 10px; width: 100%; font-size: 15px; cursor: pointer; background: #fff; border: 1px solid var(--line, #e3e6ee); color: var(--ink, #111827); font-weight: 600; }
.auth-skip { margin-top: 6px; color: var(--muted, #6b7280); font-weight: 500; }
.auth-done { padding: 16px; border-radius: 12px; background: var(--green-soft); border: 1px solid #bfe8d6; }
.auth-done strong { display: block; font-size: 15px; color: #0b6b46; }
.auth-done p { margin: 4px 0 0; color: var(--ink-2); }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }

@media (max-width: 900px) {
  .auth { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr; }
  .auth-brand { padding: 20px; gap: 0; }
  .auth-pitch, .auth-foot { display: none; }
  .auth-main { place-items: start center; padding: 32px 20px; }
}

/* Profile pill and menu in the header */
.me { position: relative; }
.me-btn {
  display: inline-flex; align-items: center; gap: 9px; height: 36px; padding: 0 12px 0 4px;
  border: 1px solid var(--border); border-radius: 999px; background: var(--surface);
  font: 600 13px var(--body); color: var(--ink); cursor: pointer;
}
.me-btn:hover { background: var(--surface-2); }
.me-avatar {
  width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center;
  background: var(--violet-soft); color: var(--violet-ink); font: 700 11.5px var(--head);
}
.me-menu {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 30; min-width: 230px;
  padding: 6px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: 0 12px 32px rgba(15, 23, 41, .14);
}
.me-who { padding: 8px 10px 10px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.me-who strong { display: block; font-size: 13.5px; }
.me-who span { font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }
.me-item {
  display: flex; width: 100%; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 8px;
  border: 0; background: none; font: 500 13.5px var(--body); color: var(--ink-2); text-decoration: none; cursor: pointer; text-align: left;
}
.me-item:hover { background: var(--surface-2); color: var(--ink); }
.me-item .ico { width: 16px; height: 16px; }

/* Team (admins) */
.team { padding: 24px; display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 16px; align-items: start; }
.team .panel { overflow: hidden; }
.team-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.team-table th { text-align: left; font-size: 11.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: 10px 18px; border-bottom: 1px solid var(--border); }
.team-table td { padding: 12px 18px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.team-table tr:last-child td { border-bottom: 0; }
.team-name strong { display: block; }
.team-name span { color: var(--muted); font-size: 12.5px; overflow-wrap: anywhere; }
.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 600; }
.badge.active { background: var(--green-soft); color: #0b6b46; }
.badge.pending { background: var(--amber-soft); color: #8a5300; }
.btn-sm { height: 32px; padding: 0 12px; font-size: 12.5px; cursor: pointer; }
.team-form { padding: 4px 18px 18px; display: flex; flex-direction: column; gap: 14px; }
.team-form .auth-submit { margin-top: 2px; }
.team-link { margin: 0 18px 18px; padding: 14px; border-radius: 12px; background: var(--violet-soft); border: 1px solid #d6d1ff; }
.team-link strong { display: block; font-size: 13.5px; }
.team-link p { margin: 4px 0 10px; font-size: 12.5px; color: var(--ink-2); }
.team-link-row { display: flex; gap: 8px; }
.team-link-row input { flex: 1; min-width: 0; height: 36px; padding: 0 10px; border: 1px solid var(--border); border-radius: 8px; font: 12px var(--mono); color: var(--ink-2); background: var(--surface); }
.team-ok { margin: 0 18px 18px; }

@media (max-width: 1000px) {
  .team { grid-template-columns: minmax(0, 1fr); padding: 16px; }
}
@media (max-width: 720px) {
  .me-btn .me-label { display: none; }
  .me-btn { padding: 0 4px; }
  .team-table th:nth-child(2), .team-table td:nth-child(2) { display: none; }
  /* The coach card is sticky on wide screens; on a phone the page scrolls and a sticky card covers the call chain. */
  .coach { position: static; }
}
