:root {
  color-scheme: light dark;
  --bg: #f6f7f9;
  --panel: #ffffff;
  --ink: #14171c;
  --muted: #6b7280;
  --line: #e3e6ea;
  --accent: #0f6fd6;
  --accent-soft: #e8f1fc;
  --ok: #157347;
  --warn: #a86200;
  --stop: #b32318;
  --ask: #6b3fb8;
  --shadow: 0 1px 2px rgba(16,24,40,.05), 0 1px 3px rgba(16,24,40,.04);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1116; --panel: #161a21; --ink: #e7eaee; --muted: #98a1ae;
    --line: #262c36; --accent: #4d9bf0; --accent-soft: #16273a;
    --ok: #4ec07f; --warn: #e0a55c; --stop: #f2837a; --ask: #b39ae8;
    --shadow: none;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--ink);
  font: 14px/1.5 "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}
h2, h3 { margin: 0; font-weight: 600; }
code, .mono { font-family: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .92em; }

/* topbar ------------------------------------------------------------- */
.stickytop { position: sticky; top: 0; z-index: 40; }
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px 22px; background: var(--panel); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand__mark { width: 32px; height: 32px; flex: none; }
.brand__mark rect { fill: #0f172a; }
.brand__mark path { stroke: #38bdf8; }
.brand__name { font-weight: 650; letter-spacing: -.01em; }
.brand__sub { color: var(--muted); font-size: 12.5px; }
.pill {
  display: inline-block; padding: 5px 11px; border-radius: 999px;
  font-size: 12.5px; font-weight: 550; border: 1px solid var(--line); color: var(--muted);
}
.pill--ok { background: var(--accent-soft); border-color: transparent; color: var(--accent); }
.pill--off { background: transparent; color: var(--muted); }

.demobar {
  margin: 0; padding: 9px 22px; font-size: 12.5px; color: var(--muted);
  background: var(--panel); border-bottom: 1px solid var(--line);
}
.demobar em { color: var(--ink); font-style: normal; font-weight: 550; }

/* layout ------------------------------------------------------------- */
.desk {
  display: grid; gap: 20px; padding: 20px 22px 40px;
  grid-template-columns: minmax(230px, 280px) minmax(360px, 1fr) minmax(300px, 380px);
  align-items: start; max-width: 1560px; margin: 0 auto;
}
@media (max-width: 1080px) { .desk { grid-template-columns: 1fr; } }
.col { min-width: 0; }
.col__title {
  font-size: 11.5px; text-transform: uppercase; letter-spacing: .07em;
  color: var(--muted); margin-bottom: 9px;
}
.col__title--spaced { margin-top: 22px; }
.card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 11px; padding: 15px; box-shadow: var(--shadow);
}
.muted { color: var(--muted); margin: 0; }

/* inbox -------------------------------------------------------------- */
.inbox { display: flex; flex-direction: column; gap: 9px; }
.mail {
  text-align: left; width: 100%; cursor: pointer; font: inherit; color: inherit;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 11px; padding: 12px 13px; box-shadow: var(--shadow);
}
.mail:hover { border-color: var(--accent); }
.mail--open { border-color: var(--accent); background: var(--accent-soft); }
.mail__top { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 4px; }
.mail__from { font-weight: 600; font-size: 12.5px; }
.mail__id { color: var(--muted); font-size: 11.5px; font-family: "IBM Plex Mono", ui-monospace, monospace; letter-spacing: -.02em; }
.mail__subject { font-size: 13px; line-height: 1.4; margin-bottom: 6px; }
.mail__meta { display: flex; justify-content: space-between; color: var(--muted); font-size: 11.5px; }

/* email -------------------------------------------------------------- */
.email__head { padding-bottom: 11px; border-bottom: 1px solid var(--line); margin-bottom: 12px; }
.email__subject { font-weight: 600; margin-bottom: 3px; }
.email__from { color: var(--muted); font-size: 12.5px; }
.email__body {
  margin: 0; white-space: pre-wrap; font: inherit; line-height: 1.6; color: var(--ink);
  max-height: 300px; overflow: auto;
}
.atts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 13px; }
.att {
  display: flex; flex-direction: column; gap: 2px; align-items: flex-start;
  cursor: pointer; font: inherit; color: inherit; text-align: left;
  background: transparent; border: 1px solid var(--line); border-radius: 9px; padding: 8px 11px;
}
.att:hover { border-color: var(--accent); }
.att--busy { opacity: .5; }
.att__name { font-size: 12.5px; font-weight: 550; }
.att__kind { font-size: 11.5px; color: var(--muted); }

/* record ------------------------------------------------------------- */
.record { display: flex; flex-direction: column; gap: 12px; }
.group {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 11px; padding: 14px 15px; box-shadow: var(--shadow);
}
.group__title {
  font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--muted); margin-bottom: 11px;
}
.field {
  display: grid; grid-template-columns: 200px 1fr auto; gap: 10px;
  align-items: center; padding: 5px 8px; margin: 0 -8px; border-radius: 7px;
}
.group { display: flex; flex-direction: column; }
@media (max-width: 620px) { .field { grid-template-columns: 1fr; gap: 4px; } }
.field__label { color: var(--muted); font-size: 12.5px; }
.req { color: var(--stop); margin-left: 3px; }
.field__input {
  width: 100%; padding: 6px 9px; font: inherit; font-size: 13px;
  color: inherit; background: transparent;
  border: 1px solid var(--line); border-radius: 7px;
}
.field__input:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }
.field__src { color: var(--muted); font-size: 11px; white-space: nowrap; }
.field--missing .field__input { border-color: color-mix(in srgb, var(--stop) 45%, var(--line)); }
.field--toquote .field__input { border-color: color-mix(in srgb, var(--warn) 45%, var(--line)); border-style: dashed; }
.req--quote { color: var(--warn); }
.field--asked { background: color-mix(in srgb, var(--ask) 12%, transparent); }
.field--asked .field__input { border-color: var(--ask); }
@keyframes flashfill {
  from { background: color-mix(in srgb, var(--accent) 26%, transparent); }
  to   { background: transparent; }
}
.field--flash { animation: flashfill 1.1s ease-out; }

/* triage ------------------------------------------------------------- */
.meter { height: 6px; background: var(--line); border-radius: 999px; overflow: hidden; }
.meter__fill { height: 100%; width: 0; background: var(--accent); transition: width .35s ease; }
.meter__label { color: var(--muted); font-size: 12px; margin-top: 7px; }

.lanes { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin: 14px 0 4px; }
.lane {
  border: 1px solid var(--line); border-radius: 8px; padding: 9px 10px;
  font-size: 12.5px; font-weight: 550; color: var(--muted); text-align: center;
}
.lane--active { color: #fff; border-color: transparent; }
.lane[data-lane="quote_now"].lane--active     { background: var(--ok); }
.lane[data-lane="indication"].lane--active    { background: var(--warn); }
.lane[data-lane="send_for_info"].lane--active { background: var(--accent); }
.lane[data-lane="likely_decline"].lane--active{ background: var(--stop); }

.findings { display: flex; flex-direction: column; gap: 10px; margin-top: 13px; }
.finding { border-left: 3px solid var(--line); padding-left: 11px; }
.finding__title {
  font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em;
  font-weight: 650; margin-bottom: 4px;
}
.finding ul { margin: 0; padding-left: 17px; font-size: 12.5px; line-height: 1.5; }
.finding--stop     { border-color: var(--stop); }  .finding--stop .finding__title { color: var(--stop); }
.finding--conflict { border-color: var(--ask); }   .finding--conflict .finding__title { color: var(--ask); }
.finding--missing  { border-color: var(--accent); }.finding--missing .finding__title { color: var(--accent); }
.finding--note     { border-color: var(--warn); }  .finding--note .finding__title { color: var(--warn); }

.question { margin-top: 12px; border-color: var(--ask); background: color-mix(in srgb, var(--ask) 8%, var(--panel)); }
.question__label { font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--ask); font-weight: 650; margin-bottom: 6px; }
.question__text { font-size: 13px; line-height: 1.55; margin-bottom: 11px; }

/* routing ------------------------------------------------------------ */
.proposal__head { font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.proposal__lane { font-size: 19px; font-weight: 650; margin: 5px 0 8px; letter-spacing: -.01em; }
.proposal__why { margin: 0 0 13px; font-size: 13px; line-height: 1.55; }
.proposal__actions { display: flex; gap: 8px; }
.proposal__note { margin: 11px 0 0; font-size: 11.5px; color: var(--muted); }
.decision__lane { font-size: 19px; font-weight: 650; color: var(--ok); letter-spacing: -.01em; }
.decision__meta { color: var(--muted); font-size: 12px; margin-top: 4px; }

.btn {
  font: inherit; font-size: 13px; font-weight: 550; cursor: pointer;
  border-radius: 8px; padding: 8px 14px; border: 1px solid transparent;
}
.btn--primary { background: var(--accent); color: #fff; }
.btn--ghost { background: transparent; color: var(--muted); border-color: var(--line); }
.btn--ghost:hover { color: var(--ink); }

/* activity ----------------------------------------------------------- */
.activity { display: flex; flex-direction: column; gap: 2px; max-height: 320px; overflow: auto; font-size: 12px; }
.logrow { display: grid; grid-template-columns: auto 1fr auto; gap: 9px; align-items: baseline; padding: 5px 0; border-bottom: 1px solid var(--line); }
.logrow:last-child { border-bottom: 0; }
.logname { color: var(--accent); font-weight: 500; white-space: nowrap; font-family: "IBM Plex Mono", ui-monospace, monospace; font-size: 11.5px; }
.logdetail { color: var(--ink); min-width: 0; }
.logtime { color: var(--muted); font-size: 11px; white-space: nowrap; }
.logrow--human .logname { color: var(--muted); }
.logrow--ask .logname { color: var(--ask); }
.logrow--propose .logname { color: var(--warn); }
.logrow--error .logname { color: var(--stop); }

/* modal -------------------------------------------------------------- */
.modal { border: 1px solid var(--line); border-radius: 12px; padding: 0; max-width: 720px; width: 92vw; background: var(--panel); color: var(--ink); }
.modal::backdrop { background: rgba(10,14,20,.45); }
.modal__head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 13px 16px; border-bottom: 1px solid var(--line); }
.modal__body { margin: 0; padding: 16px; white-space: pre-wrap; font-family: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; line-height: 1.6; max-height: 62vh; overflow: auto; }

/* footer ------------------------------------------------------------- */
.foot {
  display: flex; flex-wrap: wrap; gap: 8px 20px; justify-content: space-between;
  padding: 16px 22px; border-top: 1px solid var(--line);
  color: var(--muted); font-size: 12px; background: var(--panel);
}

/* ---- the action bar that follows you down the page -------------------- */
.actionbar {
  display: flex; align-items: center; gap: 9px; flex-wrap: wrap;
  padding: 9px 22px;
  background: color-mix(in srgb, var(--ask) 11%, var(--panel));
  border-bottom: 1px solid color-mix(in srgb, var(--ask) 35%, var(--line));
}
.actionbar__label {
  font-size: 11px; text-transform: uppercase; letter-spacing: .06em;
  font-weight: 650; color: var(--ask); white-space: nowrap;
}
.actionchip {
  font: inherit; font-size: 12.5px; font-weight: 550; cursor: pointer;
  padding: 5px 12px; border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--ask) 45%, transparent);
  background: var(--panel); color: var(--ask);
}
.actionchip:hover { background: var(--ask); color: #fff; border-color: transparent; }
.actionchip:focus-visible { outline: 2px solid var(--ask); outline-offset: 2px; }
.actionbar--clear {
  background: var(--panel); border-bottom-color: var(--line);
}
.actionbar--clear .actionbar__label { color: var(--muted); }

/* ---- the note that sits with the field being asked about -------------- */
.fieldnote {
  margin: 2px 0 8px; border-left: 3px solid var(--ask); padding: 9px 0 9px 11px;
  background: color-mix(in srgb, var(--ask) 7%, transparent);
  border-radius: 0 7px 7px 0;
}
.fieldnote__head { font-size: 12.5px; font-weight: 600; color: var(--ask); margin-bottom: 5px; }
.fieldnote__ask { margin: 0 0 6px; font-size: 12.5px; line-height: 1.5; }
.fieldnote__why { margin: 0; font-size: 12px; line-height: 1.5; color: var(--muted); }

/* ---- a contradiction gets its own card, with the receipts -------------- */
.conflict {
  border: 1px solid var(--ask); border-radius: 10px; padding: 13px;
  background: color-mix(in srgb, var(--ask) 7%, var(--panel));
}
.conflict__title {
  font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em;
  font-weight: 650; color: var(--ask); margin-bottom: 7px;
}
.conflict__message { margin: 0 0 12px; font-size: 12.5px; line-height: 1.55; }
.conflict__hint { margin: 0 0 12px; font-size: 12px; color: var(--muted); }
.evidence { display: grid; gap: 8px; margin-bottom: 13px; }
.evidence__item {
  border-left: 3px solid var(--line); padding: 7px 0 7px 10px;
  background: var(--panel); border-radius: 0 7px 7px 0;
}
.evidence__item--application { border-left-color: var(--warn); }
.evidence__item--loss_run { border-left-color: var(--accent); }
.evidence__source {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 11px; color: var(--muted); margin-bottom: 3px;
}
.evidence__quote { display: block; font-size: 12px; line-height: 1.5; quotes: none; }
.conflict__actions { display: grid; gap: 7px; margin-bottom: 9px; }
.btn--choice {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
  text-align: left; background: var(--panel); border-color: var(--line); color: inherit;
  padding: 9px 12px;
}
.btn--choice:hover { border-color: var(--ask); }
.btn__label { font-weight: 600; font-size: 13px; }
.btn__detail { font-weight: 400; font-size: 11.5px; color: var(--muted); line-height: 1.45; }
.btn--wide { width: 100%; }
.finding--settled { border-color: var(--ok); }
.finding--settled .finding__title { color: var(--ok); }

/* ---- the question panel, made unmissable ------------------------------ */
.question__do { font-size: 17px; font-weight: 650; letter-spacing: -.01em; margin-bottom: 7px; }
.question__text { margin: 0 0 11px; font-size: 13px; line-height: 1.55; }
.question__why {
  background: var(--panel); border-radius: 8px; padding: 9px 11px; margin-bottom: 12px;
}
.question__whylabel {
  display: block; font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em;
  font-weight: 650; color: var(--muted); margin-bottom: 4px;
}
.question__whytext { margin: 0; font-size: 12.5px; line-height: 1.5; }
.question__actions { display: flex; gap: 8px; flex-wrap: wrap; }
.question__pickup { margin: 10px 0 0; font-size: 11.5px; color: var(--muted); line-height: 1.45; }

/* ---- side by side document check -------------------------------------- */
.modal__body--compare {
  display: grid; grid-template-columns: 1fr 1fr; gap: 16px; font-family: inherit;
}
@media (max-width: 700px) { .modal__body--compare { grid-template-columns: 1fr; } }
.compare__col { min-width: 0; }
.compare__head {
  display: flex; flex-direction: column; gap: 2px; padding-bottom: 7px;
  margin-bottom: 9px; border-bottom: 1px solid var(--line);
}
.compare__head strong { font-size: 12.5px; }
.compare__kind { font-size: 11.5px; color: var(--muted); }
.compare__text {
  margin: 0; white-space: pre-wrap; font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 11px; line-height: 1.6;
}

/* ---- who is signed in ------------------------------------------------- */
.topbar__right { display: flex; align-items: center; gap: 16px; }
.who { text-align: right; line-height: 1.35; }
.who__name { font-size: 12.5px; font-weight: 600; }
.who__meta {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 10.5px; color: var(--muted);
}
@media (max-width: 720px) { .who { display: none; } }

.demobar strong { color: var(--ink); font-weight: 600; }
.demobar__fine { display: block; margin-top: 4px; font-size: 11.5px; opacity: .8; }

/* ---- what the agent cannot do ----------------------------------------- */
.limits__lead { margin: 0 0 10px; font-size: 12.5px; line-height: 1.55; color: var(--ink); }
.limits__list { margin: 0; padding-left: 17px; }
.limits__list li {
  font-size: 12px; line-height: 1.5; color: var(--muted); margin-bottom: 7px;
}
.limits__list li::marker { color: var(--stop); }

/* ---- the drafted reply ------------------------------------------------- */
.reply__to {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 11px; color: var(--muted); margin-bottom: 5px;
}
.reply__subject { font-size: 13.5px; font-weight: 600; margin-bottom: 10px; }
.reply__body {
  margin: 0 0 13px; white-space: pre-wrap; font: inherit; font-size: 12.5px;
  line-height: 1.6; max-height: 250px; overflow: auto;
}
.reply__body--editing {
  outline: 2px solid var(--accent); outline-offset: 6px; border-radius: 4px;
}
.reply__actions { display: flex; gap: 8px; }
.reply__note { margin: 11px 0 0; font-size: 11.5px; color: var(--muted); }
.reply__sent { font-size: 12.5px; font-weight: 550; color: var(--ok); }

/* ---- empty workspace: tell the visitor what to do ---------------------- */
.empty { padding: 26px 4px; }
.empty__h { font-size: 17px; font-weight: 600; letter-spacing: -.01em; margin-bottom: 8px; }
.empty__p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.6; max-width: 62ch; }

/* ---- the risk, at a glance -------------------------------------------- */
.risk {
  background: var(--panel); border: 1px solid var(--line); border-radius: 11px;
  padding: 15px 17px 4px; box-shadow: var(--shadow);
}
.risk__head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.risk__name {
  font-size: 19px; font-weight: 600; letter-spacing: -.015em; line-height: 1.25; min-width: 0;
}
.risk__name--empty { color: var(--muted); font-weight: 500; }
.risk__lane {
  flex: none; font-size: 11.5px; font-weight: 600; padding: 4px 10px; border-radius: 999px;
  color: #fff; white-space: nowrap;
}
.risk__lane--quote_now { background: var(--ok); }
.risk__lane--indication { background: var(--warn); }
.risk__lane--send_for_info { background: var(--accent); }
.risk__lane--likely_decline { background: var(--stop); }
.risk__sub { color: var(--muted); font-size: 12.5px; margin-top: 4px; }
.risk__stats {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(112px, 1fr));
  gap: 1px; margin: 15px -17px 0; background: var(--line);
  border-top: 1px solid var(--line);
}
.stat { background: var(--panel); padding: 11px 17px 13px; }
.stat__v {
  font-size: 16px; font-weight: 600; letter-spacing: -.02em;
  font-variant-numeric: tabular-nums; line-height: 1.2;
}
.stat__l {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--muted); margin-top: 4px;
}
.stat--bad .stat__v { color: var(--stop); }
.stat--soft .stat__v { color: var(--warn); }

/* ---- the email, clipped by default ------------------------------------ */
.email__body--clipped {
  max-height: 132px; overflow: hidden;
  -webkit-mask-image: linear-gradient(to bottom, #000 78%, transparent);
  mask-image: linear-gradient(to bottom, #000 78%, transparent);
}
.email__more {
  margin-top: 8px; padding: 0; border: 0; background: transparent; cursor: pointer;
  font: inherit; font-size: 12.5px; font-weight: 550; color: var(--accent);
}
.email__more:hover { text-decoration: underline; }

/* ---- the scripted replays --------------------------------------------- */
.playerbar {
  padding: 11px 22px; background: var(--panel); border-bottom: 1px solid var(--line);
}
.playerbar__row { display: flex; align-items: stretch; gap: 9px; flex-wrap: wrap; }
.playerbar__label {
  align-self: center; font-size: 11px; text-transform: uppercase; letter-spacing: .06em;
  font-weight: 650; color: var(--muted); margin-right: 3px;
}
.playerbar__note { color: var(--muted); font-size: 12.5px; max-width: 96ch; margin: 8px 0 0; }
.playerbar__note strong { color: var(--ink); font-weight: 600; }
.btn--play {
  flex: 0 1 250px;
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
  text-align: left; background: var(--panel); border-color: var(--line); color: inherit;
  padding: 9px 12px;
}
.btn--play:hover { border-color: var(--accent); }
.btn--play[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); }
.btn[disabled] { opacity: .45; cursor: default; }

.transcript {
  display: flex; flex-direction: column; gap: 9px; font-size: 13px; line-height: 1.55;
  max-height: 300px; overflow-y: auto;
}
.turn { display: grid; grid-template-columns: 54px 1fr; gap: 10px; align-items: baseline; }
.turn__who {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em;
  font-weight: 600; padding-top: 2px;
}
.turn--agent .turn__who { color: var(--accent); }
.turn--you .turn__who { color: var(--ask); }
.turn__text { min-width: 0; }
.turn--pending .turn__text::after {
  content: ''; display: inline-block; width: 6px; height: 6px; margin-left: 5px;
  border-radius: 50%; background: var(--muted); animation: blink 1.1s steps(2) infinite;
  vertical-align: middle;
}
@keyframes blink { 50% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  .turn--pending .turn__text::after { animation: none; }
  .field--flash { animation: none; }
  .meter__fill { transition: none; }
}
