/* ═══════════════════════════════════════════════════════════════════════
   Fortvoice — outbound desk console

   Built on the client's blues, never its name or mark. Colour is rationed to
   three meanings: the brand blue is a brief line the gate has unsealed, or a
   call that is live; green is a factor confirmed; red is the gate refusing.
   Everything else is ink on a blue-cast paper, with hairlines.

   The signature is the mailer: the call's brief drawn as a bank security
   envelope, its lines under the crosshatch tint that stops a PIN mailer being
   read against the light. The tint lifts only when the person on the line has
   proved who they are.
   ═══════════════════════════════════════════════════════════════════════ */

:root {
  --canvas: #EEF3F7;
  --sheet: #FFFFFF;
  --inset: #F5F8FB;
  --ink: #0D1F2D;
  --ink-2: #33475A;
  --mute: #5B6B78;
  --line: #D3DEE7;
  --line-2: #E4EBF1;

  --brand: #0083CA;
  --brand-deep: #0F5885;
  --brand-soft: #3EA1DE;
  --brand-wash: #E3F1FA;

  --ok: #12805C;
  --ok-wash: #E3F3EC;
  --hold: #9A6400;
  --hold-wash: #FBF1DD;
  --refuse: #B83227;
  --refuse-wash: #FBE9E7;

  --tint-a: #C9D6E1;
  --tint-b: #DCE5ED;

  --font: "Figtree", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-rtl: "Noto Naskh Arabic", "Figtree", serif;

  --r-lg: 14px;
  --r-md: 10px;
  --r-sm: 6px;

  --gutter: 24px;
}

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

html, body { margin: 0; }
body {
  background: var(--canvas);
  color: var(--ink);
  font: 400 15px/1.5 var(--font);
  font-feature-settings: "tnum" 0;
  -webkit-font-smoothing: antialiased;
}
.num, .tools, .ledger__v, .mailer__v, .crib__a, .score__v { font-variant-numeric: tabular-nums; }

h1, h2, h3 { margin: 0; font-weight: 700; letter-spacing: -0.01em; }
p { margin: 0; }
button, input, select { font: inherit; color: inherit; }

:focus-visible {
  outline: 3px solid var(--brand);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.muted { color: var(--mute); }
.sm { font-size: 13px; }

/* ─────────────────────────────────────────────────────────── the mark ── */
.mark {
  display: inline-flex; align-items: center; gap: 10px;
  font-weight: 800; font-size: 19px; letter-spacing: -0.02em;
  color: var(--brand-deep);
}
.mark__glyph {
  width: 26px; height: 20px; border-radius: 4px; position: relative;
  border: 2px solid var(--brand-deep);
}
.mark__glyph::before {                     /* the flap */
  content: ""; position: absolute; inset: 0 0 auto 0; height: 60%;
  background: var(--brand-deep);
  clip-path: polygon(0 0, 100% 0, 50% 100%);
}
.mark__glyph::after {                      /* the voice, sealed inside */
  content: ""; position: absolute; width: 6px; height: 6px; border-radius: 50%;
  background: var(--brand); left: 50%; bottom: 3px; transform: translateX(-50%);
}
.mark--lg { font-size: 26px; }
.mark--lg .mark__glyph { width: 32px; height: 24px; }

/* ─────────────────────────────────────────────────────────── controls ── */
.field { display: grid; gap: 6px; }
.field__label { font-size: 13px; font-weight: 600; color: var(--ink-2); }
input, select {
  width: 100%; min-height: 40px; padding: 8px 12px;
  border: 1px solid var(--line); border-radius: var(--r-sm);
  background: var(--sheet);
}
input::placeholder { color: #8594A0; }

.btn {
  min-height: 40px; padding: 8px 16px; border-radius: var(--r-sm);
  border: 1px solid transparent; cursor: pointer; font-weight: 600;
}
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn--ink { background: var(--ink); color: #fff; }
.btn--ink:not(:disabled):hover { background: #1B3347; }
.btn--ghost { background: var(--sheet); border-color: var(--line); }
.btn--ghost:hover { border-color: var(--ink-2); }
.btn--stop { background: var(--refuse); color: #fff; }
.btnrow { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.linkbtn {
  background: none; border: 0; padding: 4px 0; cursor: pointer;
  color: var(--mute); text-decoration: underline; text-underline-offset: 3px;
}
.linkbtn:hover { color: var(--ink); }

/* ────────────────────────────────────────────────────────────── login ── */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login__card {
  width: min(380px, 100%); display: grid; gap: 18px; padding: 36px 32px;
  background: var(--sheet); border: 1px solid var(--line); border-radius: var(--r-lg);
}
.login__sub { color: var(--mute); margin-top: -8px; }
.login__err { color: var(--refuse); font-size: 14px; }

/* ────────────────────────────────────────────────────────────── shell ── */
.shell { display: grid; grid-template-columns: 208px 1fr; min-height: 100vh; }
.nav {
  position: sticky; top: 0; height: 100vh; padding: 24px 20px;
  display: flex; flex-direction: column; gap: 6px;
  border-right: 1px solid var(--line); background: var(--sheet);
}
.nav__desk { color: var(--mute); font-size: 13px; margin: 2px 0 20px 36px; }
.nav__list { list-style: none; padding: 0; margin: 0; display: grid; gap: 2px; }
.navbtn {
  width: 100%; text-align: left; padding: 9px 12px; border: 0; border-radius: var(--r-sm);
  background: none; cursor: pointer; font-weight: 500; color: var(--ink-2);
}
.navbtn:hover { background: var(--inset); color: var(--ink); }
.navbtn.is-active { background: var(--canvas); color: var(--ink); font-weight: 700; }
.nav__out { margin-top: auto; align-self: flex-start; }

.main { padding: 28px var(--gutter) 48px; min-width: 0; }
.view { display: none; }
.view.is-active { display: block; }
.vhead { max-width: 72ch; margin-bottom: 22px; }
.vhead__t { font-size: 30px; font-weight: 800; letter-spacing: -0.025em; }
.vhead__s { color: var(--ink-2); margin-top: 6px; }

.panel {
  background: var(--sheet); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 16px; min-width: 0;
}
.panel__t { font-size: 14px; font-weight: 700; margin: 4px 0 10px; }

/* ──────────────────────────────────────────────────────────── calls ── */
.callgrid {
  display: grid; gap: 16px; align-items: start;
  grid-template-columns: 280px minmax(0, 1fr) 300px;
}
.stage { display: grid; gap: 12px; min-width: 0; }

/* the book */
.book { display: grid; gap: 6px; max-height: calc(100vh - 220px); overflow: auto; margin: 0 -6px; padding: 0 6px; }
.rec {
  text-align: left; width: 100%; padding: 10px 12px; border-radius: var(--r-md);
  border: 1px solid var(--line-2); background: var(--sheet); cursor: pointer;
  display: grid; gap: 2px;
}
.rec:hover { border-color: var(--line); background: var(--inset); }
.rec.is-sel { border-color: var(--ink); box-shadow: inset 3px 0 0 var(--ink); }
.rec__n { font-weight: 700; }
.rec__w { font-size: 13px; color: var(--ink-2); }
.rec__m { font-size: 12px; color: var(--mute); }
.flag {
  justify-self: start; margin-top: 4px; font-size: 12px; font-weight: 600;
  padding: 1px 8px; border-radius: 999px; border: 1px solid currentColor;
}
.flag--gate { color: var(--refuse); }
.flag--stop { color: var(--refuse); background: var(--refuse-wash); border-color: transparent; }
.flag--decline { color: var(--hold); }

/* who is being rung */
.who {
  display: flex; flex-wrap: wrap; gap: 4px 16px; align-items: baseline;
  padding: 2px 2px 0;
}
.who__empty { color: var(--mute); }
.who__n { font-size: 22px; font-weight: 800; letter-spacing: -0.02em; }
.who__m { color: var(--mute); font-size: 14px; }

/* ═══════════════════════════════════════════════════════════ THE MAILER ═══ */
.mailer {
  position: relative; overflow: hidden;
  background: var(--sheet); border: 1px solid var(--line); border-radius: var(--r-lg);
}
.mailer__flap {
  position: relative; display: flex; align-items: center; gap: 16px;
  padding: 14px 18px 22px;
  background: var(--inset);
  border-bottom: 1px dashed var(--line);
}
/* the flap's point */
.mailer__flap::after {
  content: ""; position: absolute; left: 50%; bottom: -1px; width: 44px; height: 12px;
  transform: translateX(-50%);
  background: var(--sheet);
  clip-path: polygon(0 100%, 50% 0, 100% 100%);
}
.mailer__state { margin-left: auto; font-weight: 700; font-size: 14px; color: var(--ink-2); }

.seals { display: flex; gap: 10px; flex-wrap: wrap; }
.seal {
  display: flex; align-items: center; gap: 8px; padding: 4px 12px 4px 4px;
  border-radius: 999px; background: var(--sheet); border: 1px solid var(--line);
  font-size: 13px; font-weight: 600; color: var(--ink-2);
}
.seal__pip {
  width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center;
  font-size: 12px; font-weight: 800; background: var(--canvas); color: var(--mute);
  border: 1px dashed #9EB0BF;
}
.seal.is-on .seal__pip { background: var(--ok); color: #fff; border: 0; }
.seal.is-on { color: var(--ok); border-color: #B7DCCB; }
.seal.is-warn .seal__pip { background: var(--hold); color: #fff; border: 0; }
.seal.is-warn { color: var(--hold); border-color: #E7CF9E; }
.seal.is-dead .seal__pip { background: var(--refuse); color: #fff; border: 0; }
.seal.is-dead { color: var(--refuse); border-color: #EBB9B3; }

.mailer__lines { list-style: none; margin: 0; padding: 14px 18px 4px; display: grid; gap: 8px; }
.mailer__line {
  display: grid; grid-template-columns: minmax(120px, 30%) 1fr; gap: 12px; align-items: center;
  padding: 6px 0 6px 12px; border-left: 3px solid var(--line-2);
}
.mailer__k { font-size: 13px; color: var(--mute); }
.mailer__v { position: relative; font-weight: 600; min-height: 22px; }
.mailer__v span { transition: opacity .35s ease; }

/* The security tint. Two crossing hatches, as inside a PIN mailer. */
.mailer__v::after {
  content: ""; position: absolute; inset: 0 auto 0 0; width: 100%;
  border-radius: 3px;
  background:
    repeating-linear-gradient(45deg, var(--tint-a) 0 2px, transparent 2px 6px),
    repeating-linear-gradient(-45deg, var(--tint-a) 0 2px, var(--tint-b) 2px 6px);
  transform-origin: right center;
  transition: transform .55s cubic-bezier(.6,0,.2,1);
}
.mailer.is-sealed .mailer__v span,
.mailer.is-locked .mailer__v span { opacity: 0; }

.mailer.is-open .mailer__line { border-left-color: var(--brand); }
.mailer.is-open .mailer__v::after { transform: scaleX(0); }
.mailer.is-open .mailer__v { color: var(--ink); }
/* stagger the reveal down the envelope */
.mailer.is-open .mailer__line:nth-child(2) .mailer__v::after { transition-delay: .08s; }
.mailer.is-open .mailer__line:nth-child(3) .mailer__v::after { transition-delay: .16s; }
.mailer.is-open .mailer__line:nth-child(4) .mailer__v::after { transition-delay: .24s; }
.mailer.is-open .mailer__line:nth-child(5) .mailer__v::after { transition-delay: .32s; }

.mailer.is-open .mailer__state { color: var(--brand); }
.mailer.is-verified .mailer__state { color: var(--ok); }
.mailer.is-locked { border-color: #E3B5AF; }
.mailer.is-locked .mailer__state { color: var(--refuse); }
.mailer.is-locked .mailer__v::after {
  background:
    repeating-linear-gradient(45deg, #D9B7B2 0 2px, transparent 2px 6px),
    repeating-linear-gradient(-45deg, #D9B7B2 0 2px, #EBD6D3 2px 6px);
}
.mailer__note { padding: 8px 18px 16px; font-size: 13px; color: var(--mute); max-width: 72ch; }

.stamp {
  position: absolute; right: 22px; top: 62px; transform: rotate(-7deg);
  padding: 8px 14px; border: 3px double var(--refuse); border-radius: var(--r-sm);
  color: var(--refuse); background: rgba(255,255,255,.88);
  font-weight: 800; font-size: 15px; letter-spacing: .01em; max-width: 260px; text-align: center;
  line-height: 1.25;
}
.stamp small { display: block; font-weight: 600; font-size: 12px; }

.shield {
  display: grid; gap: 2px; padding: 10px 14px; border-radius: var(--r-md);
  background: var(--hold-wash); color: #5E3E00; font-size: 14px;
}

/* status + transcript */
.statusbar {
  display: flex; align-items: center; gap: 10px; padding: 10px 14px;
  background: var(--sheet); border: 1px solid var(--line); border-radius: var(--r-md);
  font-size: 14px;
}
.statusbar__sp { flex: 1; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: #A9B7C3; }
.dot.is-live { background: var(--brand); box-shadow: 0 0 0 4px var(--brand-wash); }
.dot.is-done { background: var(--ink-2); }

.transcript {
  min-height: 260px; max-height: 46vh; overflow: auto;
  background: var(--sheet); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 14px 16px; display: grid; align-content: start; gap: 12px;
}
.transcript:empty::before { content: "The conversation appears here."; color: var(--mute); }
.turn { max-width: 78ch; }
.turn__w { font-size: 12px; font-weight: 700; color: var(--mute); margin-bottom: 2px; }
.turn--agent .turn__w { color: var(--brand-deep); }
.turn--supervisor { padding-left: 10px; border-left: 2px solid var(--hold); }
.turn--supervisor .turn__w { color: var(--hold); }
.turn__t { white-space: pre-wrap; }
.turn__t:dir(rtl) { font-family: var(--font-rtl); font-size: 17px; line-height: 1.8; }

.composer { display: flex; gap: 8px; }

/* side panel */
.setup { display: grid; gap: 12px; }
.warn {
  font-size: 14px; padding: 10px 12px; border-radius: var(--r-md);
  background: var(--refuse-wash); color: #7A1F17;
}
.warn.is-info { background: var(--hold-wash); color: #5E3E00; }

.crib {
  margin-top: 16px; padding: 12px 14px; border-radius: var(--r-md);
  background: var(--inset); border: 1px solid var(--line-2); display: grid; gap: 8px;
}
.crib__t { font-weight: 700; font-size: 14px; }
.crib__story { font-size: 13px; color: var(--ink-2); font-style: italic; }
.crib__row { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; font-size: 13px; }
.crib__q { color: var(--mute); }
.crib__a { font-weight: 700; text-align: right; }
.crib__a.is-bad { color: var(--refuse); }
.crib__foot { font-size: 12px; color: var(--mute); }

.tools { display: grid; gap: 6px; max-height: 320px; overflow: auto; font-size: 13px; }
.tool { padding: 6px 10px; border-radius: var(--r-sm); border-left: 3px solid var(--line); background: var(--inset); }
.tool b { font-weight: 600; }
.tool small { display: block; color: var(--mute); }
.tool.is-ok { border-left-color: var(--ok); }
.tool.is-gate { border-left-color: var(--refuse); background: var(--refuse-wash); }
.tool.is-gate small { color: #7A1F17; }
.tool.is-shield { border-left-color: var(--hold); background: var(--hold-wash); }
.tool.is-fail { border-left-color: var(--hold); }

/* wrap-up */
.wrapup {
  margin-top: 16px; padding: 20px; background: var(--sheet);
  border: 1px solid var(--line); border-radius: var(--r-lg);
}
.wrapup h2 { font-size: 18px; margin-bottom: 12px; }
.scoregrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 1px; background: var(--line-2); border: 1px solid var(--line-2); border-radius: var(--r-md); overflow: hidden; }
.score { background: var(--sheet); padding: 10px 12px; }
.score__t { font-size: 12px; color: var(--mute); }
.score__v { font-weight: 700; font-size: 17px; }
.score__v small { font-weight: 500; font-size: 12px; color: var(--mute); }
.score--good .score__v { color: var(--ok); }
.score--hold .score__v { color: var(--hold); }
.score--bad .score__v { color: var(--refuse); }
.wrapup__p { margin-top: 12px; max-width: 78ch; }
.breach { margin-top: 12px; padding: 10px 12px; border-radius: var(--r-md); background: var(--refuse-wash); color: #7A1F17; font-weight: 600; }
.coach { margin: 10px 0 0; padding-left: 20px; max-width: 78ch; }
.coach li + li { margin-top: 6px; }

/* ──────────────────────────────────────────────────── client cards ── */
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.card {
  display: grid; grid-template-rows: auto auto 1fr auto; gap: 10px;
  padding: 18px; background: var(--sheet); border: 1px solid var(--line); border-radius: var(--r-lg);
}
.card__wf { font-size: 13px; font-weight: 700; color: var(--brand-deep); }
.card__n { font-size: 20px; font-weight: 800; letter-spacing: -0.02em; }
.card__m { font-size: 13px; color: var(--mute); }
.card__goal { color: var(--ink-2); font-size: 14px; }
.card__brief { margin: 0; padding: 10px 12px; list-style: none; background: var(--inset); border-radius: var(--r-md); display: grid; gap: 4px; font-size: 13px; }
.card__brief li { display: grid; grid-template-columns: 42% 1fr; gap: 8px; }
.card__brief span:first-child { color: var(--mute); }
.card__foot { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.card.is-stop { background: repeating-linear-gradient(-45deg, var(--sheet) 0 14px, #FBF3F2 14px 16px); }

/* ──────────────────────────────────────────────────────── knowledge ── */
.kbbar { display: flex; gap: 12px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
.kbbar input { flex: 1 1 420px; }
.kblist { display: grid; gap: 10px; max-width: 900px; }
.kb { padding: 14px 16px; background: var(--sheet); border: 1px solid var(--line-2); border-radius: var(--r-md); }
.kb--hit:first-child { border-color: var(--brand-soft); }
.kb__h { display: flex; gap: 12px; align-items: baseline; flex-wrap: wrap; }
.kb__t { font-weight: 700; }
.kb__s { margin-left: auto; font-size: 12px; color: var(--mute); }
.kb__x { margin-top: 4px; color: var(--ink-2); max-width: 80ch; }

/* ───────────────────────────────────────────────────────── playbook ── */
.pb { display: grid; gap: 16px; max-width: 900px; }
.pbc { padding: 22px 24px; background: var(--sheet); border: 1px solid var(--line); border-radius: var(--r-lg); }
.pbc h2 { font-size: 20px; margin-bottom: 10px; }
.pbc h3 { font-size: 15px; margin: 16px 0 6px; }
.pbc p, .pbc li { max-width: 74ch; color: var(--ink-2); }
.pbc p + p { margin-top: 8px; }
.pbc ul, .pbc ol { padding-left: 20px; margin: 8px 0 0; }
.pbc li + li { margin-top: 4px; }
.pbc code { font-size: 13px; background: var(--inset); padding: 1px 5px; border-radius: 4px; }
.pbc--gate { border-left: 4px solid var(--brand); }
.steps { display: grid; gap: 8px; margin-top: 8px; }
.step { display: grid; grid-template-columns: 26px 1fr; gap: 10px; color: var(--ink-2); }
.step__n { font-weight: 800; color: var(--brand-deep); }
.wf { display: grid; gap: 0; margin-top: 8px; border-top: 1px solid var(--line-2); }
.wf__row { display: grid; grid-template-columns: 220px 1fr; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line-2); }
.wf__row b { font-weight: 700; }

/* ───────────────────────────────────────────────────────────── desk ── */
.ledger { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; max-width: 1100px; }
.ledger__col { background: var(--sheet); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 8px 18px; }
.ledger__col h2 { font-size: 15px; padding: 10px 0 6px; }
.ledger__row { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-top: 1px solid var(--line-2); }
.ledger__k { color: var(--ink-2); }
.ledger__v { font-weight: 700; }
.ledger__v.is-good { color: var(--ok); }
.ledger__v.is-hold { color: var(--hold); }
.basis { margin: 18px 0; max-width: 90ch; font-size: 13px; color: var(--mute); }

/* ─────────────────────────────────────────────────────── responsive ── */
@media (max-width: 1280px) {
  .callgrid { grid-template-columns: 250px minmax(0, 1fr); }
  .panel--side { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
  .panel--side .panel__t, .panel--side .tools { grid-column: 2; }
  .panel--side .crib { margin-top: 0; }
}
@media (max-width: 860px) {
  :root { --gutter: 16px; }
  .shell { grid-template-columns: 1fr; }
  .nav {
    position: sticky; top: 0; z-index: 5; height: auto; flex-direction: row; flex-wrap: wrap;
    align-items: center; padding: 10px 16px; gap: 8px; border-right: 0; border-bottom: 1px solid var(--line);
  }
  .nav__desk { display: none; }
  .nav__list { display: flex; overflow-x: auto; order: 3; width: 100%; }
  .navbtn { white-space: nowrap; }
  .nav__out { margin: 0 0 0 auto; }
  .callgrid { grid-template-columns: 1fr; }
  .panel--side { display: block; }
  .book { max-height: 280px; }
  .mailer__line { grid-template-columns: 1fr; gap: 2px; }
  .stamp { top: 12px; right: 12px; }
  .wf__row { grid-template-columns: 1fr; gap: 2px; }
  .vhead__t { font-size: 26px; }
  .composer { flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
