/* PayLoop dashboard. No external resources: system fonts, inline SVG icons. */

:root {
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI Variable Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, "Liberation Mono", monospace;

  --bg: #f6f6f8;
  --surface: #ffffff;
  --surface-2: #fafafb;
  --surface-3: #f2f2f5;
  --border: #e7e7ec;
  --border-strong: #d6d6de;
  --text: #17171c;
  --text-2: #4f4f5a;
  --text-3: #8a8a96;
  --accent: #4f46e5;
  --accent-2: #4338ca;
  --accent-soft: #eef0ff;
  --accent-line: #c7c9fb;
  --focus: #6366f1;

  --st-overdue: #dc3d43;
  --st-reminded: #e8590c;
  --st-promised: #3e63dd;
  --st-claimed: #0a8aa8;
  --st-attention: #c4307f;
  --st-paid: #2b9a5e;
  --st-open: #8a8a96;

  --ch-email: #5b4fd8;
  --ch-email-soft: #f3f1ff;
  --ch-sms: #0f8f86;
  --ch-sms-soft: #ecf8f6;
  --ch-wa: #23944f;
  --ch-wa-soft: #eaf7ee;

  --ok: #2b9a5e;
  --ok-soft: #e9f6ee;
  --warn: #b25e09;
  --warn-soft: #fff4e5;
  --bad: #c9373d;
  --bad-soft: #fdecec;
  --demo: #a3570a;
  --demo-soft: #fff6e8;
  --demo-line: #f2cf9a;

  --shadow-1: 0 1px 2px rgba(20, 20, 40, .05);
  --shadow-2: 0 1px 2px rgba(20, 20, 40, .05), 0 4px 14px rgba(20, 20, 40, .06);
  --shadow-3: 0 20px 60px rgba(20, 20, 40, .18), 0 2px 8px rgba(20, 20, 40, .08);
  --radius: 10px;
  --radius-sm: 7px;
  --ease: cubic-bezier(.2, .7, .2, 1);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d0d10; --surface: #151519; --surface-2: #19191e; --surface-3: #202027;
    --border: #25252d; --border-strong: #33333d; --text: #ececf1; --text-2: #a9a9b4; --text-3: #6f6f7b;
    --accent: #8b8cf8; --accent-2: #a5a6fb; --accent-soft: #1e1f3a; --accent-line: #3c3e7a; --focus: #8b8cf8;
    --st-overdue: #f2555a; --st-reminded: #f7843d; --st-promised: #6f8ef2; --st-claimed: #2bb5d1; --st-attention: #e35ea4; --st-paid: #3fbf7a; --st-open: #7a7a86;
    --ch-email: #9d93f7; --ch-email-soft: #1c1a30; --ch-sms: #2fc0b4; --ch-sms-soft: #11262a; --ch-wa: #43c477; --ch-wa-soft: #112619;
    --ok: #3fbf7a; --ok-soft: #102419; --warn: #f0a24a; --warn-soft: #2a1d0d; --bad: #f2555a; --bad-soft: #2c1214;
    --demo: #f0a24a; --demo-soft: #261b0c; --demo-line: #5b4320;
    --shadow-1: 0 1px 2px rgba(0, 0, 0, .4); --shadow-2: 0 1px 2px rgba(0, 0, 0, .4), 0 6px 18px rgba(0, 0, 0, .3); --shadow-3: 0 24px 70px rgba(0, 0, 0, .55);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0d0d10; --surface: #151519; --surface-2: #19191e; --surface-3: #202027;
  --border: #25252d; --border-strong: #33333d; --text: #ececf1; --text-2: #a9a9b4; --text-3: #6f6f7b;
  --accent: #8b8cf8; --accent-2: #a5a6fb; --accent-soft: #1e1f3a; --accent-line: #3c3e7a; --focus: #8b8cf8;
  --st-overdue: #f2555a; --st-reminded: #f7843d; --st-promised: #6f8ef2; --st-claimed: #2bb5d1; --st-attention: #e35ea4; --st-paid: #3fbf7a; --st-open: #7a7a86;
  --ch-email: #9d93f7; --ch-email-soft: #1c1a30; --ch-sms: #2fc0b4; --ch-sms-soft: #11262a; --ch-wa: #43c477; --ch-wa-soft: #112619;
  --ok: #3fbf7a; --ok-soft: #102419; --warn: #f0a24a; --warn-soft: #2a1d0d; --bad: #f2555a; --bad-soft: #2c1214;
  --demo: #f0a24a; --demo-soft: #261b0c; --demo-line: #5b4320;
  --shadow-1: 0 1px 2px rgba(0, 0, 0, .4); --shadow-2: 0 1px 2px rgba(0, 0, 0, .4), 0 6px 18px rgba(0, 0, 0, .3); --shadow-3: 0 24px 70px rgba(0, 0, 0, .55);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-width: 1000px; background: var(--bg); color: var(--text);
  font: 14px/1.45 var(--font); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
h1, h2, h3, p { margin: 0; }
h1 { font-size: 19px; font-weight: 650; letter-spacing: -.012em; }
h2 { font-size: 13.5px; font-weight: 620; letter-spacing: -.005em; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--text-2); }
.small { font-size: 12px; }
.num { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--mono); font-size: 12px; font-variant-ligatures: none; }
.ic { width: 16px; height: 16px; flex: none; display: inline-block; vertical-align: -3px; }

:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
.skip { position: absolute; left: 12px; top: -40px; background: var(--surface); padding: 6px 10px; border-radius: 6px; z-index: 100; box-shadow: var(--shadow-2); }
.skip:focus { top: 10px; }

/* ---------- top bar ---------- */
.topbar { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--border); }
.topbar__inner { display: flex; align-items: center; gap: 20px; padding: 0 24px; height: 56px; max-width: 1680px; margin: 0 auto; }
.brand { display: flex; align-items: center; gap: 9px; min-width: 0; flex: 1 1 auto; }
.brand__mark { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; color: #fff; background: linear-gradient(140deg, #6366f1, #4338ca); box-shadow: 0 1px 2px rgba(67, 56, 202, .35), inset 0 1px 0 rgba(255, 255, 255, .18); }
.brand__mark .ic { width: 17px; height: 17px; }
.brand__mark--lg { width: 40px; height: 40px; border-radius: 11px; }
.brand__mark--lg .ic { width: 24px; height: 24px; }
.brand__name { font-weight: 680; letter-spacing: -.015em; font-size: 15px; }
.brand__sep { color: var(--text-3); }
.brand__tenant { color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.tag { display: inline-flex; align-items: center; gap: 4px; height: 20px; padding: 0 7px; border-radius: 999px; font-size: 11px; font-weight: 560; letter-spacing: .01em; white-space: nowrap; border: 1px solid var(--border); color: var(--text-2); background: var(--surface-2); }
.tag--synthetic { color: var(--text-2); border-style: dashed; }
.tag--mock { color: var(--demo); background: var(--demo-soft); border-color: var(--demo-line); }
.tag--xs { height: 17px; font-size: 10.5px; padding: 0 6px; }

.tabs { display: flex; gap: 2px; padding: 3px; background: var(--surface-3); border-radius: 9px; flex: none; }
.tab { display: inline-flex; align-items: center; gap: 7px; border: 0; background: transparent; padding: 6px 12px; border-radius: 7px; color: var(--text-2); font-weight: 540; }
.tab:hover { color: var(--text); }
.tab[aria-current="page"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-1); }
.count { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--st-attention); color: #fff; font-size: 11px; font-weight: 650; display: inline-grid; place-items: center; font-variant-numeric: tabular-nums; }

.topbar__actions { display: flex; align-items: center; gap: 6px; flex: 1 1 auto; justify-content: flex-end; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 32px; padding: 0 12px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); font-weight: 560; white-space: nowrap; transition: background .15s, border-color .15s, color .15s, box-shadow .15s; box-shadow: var(--shadow-1); }
.btn:hover { background: var(--surface-2); border-color: var(--text-3); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn--primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn--primary:hover { background: var(--accent-2); border-color: var(--accent-2); }
:root[data-theme="dark"] .btn--primary { color: #0d0d10; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn--primary { color: #0d0d10; } }
.btn--ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--text-2); }
.btn--ghost:hover { background: var(--surface-3); color: var(--text); border-color: transparent; }
.btn--icon { width: 32px; padding: 0; }
.btn--danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn--danger:hover { filter: brightness(.95); background: var(--bad); }
.btn--demo { color: var(--demo); background: var(--demo-soft); border-color: var(--demo-line); box-shadow: none; }
.btn--demo:hover { background: var(--demo-soft); border-color: var(--demo); }
.btn--block { width: 100%; height: 38px; }
.btn--sm { height: 28px; padding: 0 10px; font-size: 12.5px; }
.link { border: 0; background: none; color: var(--accent); font-weight: 560; padding: 2px 0; display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; }
.link .ic { width: 14px; height: 14px; }

/* ---------- layout ---------- */
main { max-width: 1680px; margin: 0 auto; padding: 20px 24px 48px; outline: none; }
.view { margin-top: 26px; }
.view__head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 14px; }
.view__head p { margin-top: 3px; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-1); padding: 16px; }
.card__head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 12px; }

/* ---------- KPIs ---------- */
.kpis { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-1); overflow: hidden; }
.kpi { padding: 14px 16px 15px; border-right: 1px solid var(--border); min-width: 0; position: relative; }
.kpi:last-child { border-right: 0; }
.kpi__label { display: flex; align-items: center; gap: 6px; color: var(--text-2); font-size: 12px; font-weight: 540; white-space: nowrap; }
.kpi__dot { width: 7px; height: 7px; border-radius: 50%; background: var(--c, var(--text-3)); flex: none; }
.kpi__value { margin-top: 6px; font-size: 21px; font-weight: 640; letter-spacing: -.02em; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi__value small { font-size: 13px; color: var(--text-3); font-weight: 560; letter-spacing: 0; }
.kpi__sub { margin-top: 2px; font-size: 11.5px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi--skeleton .kpi__value { color: transparent; background: var(--surface-3); border-radius: 6px; width: 70%; }
.kpi.is-bumped .kpi__value { animation: bump .7s var(--ease); }
@keyframes bump { 0% { color: var(--accent); transform: translateY(-2px); } 100% { color: inherit; transform: none; } }

/* ---------- pipeline ---------- */
.search input { width: 260px; height: 32px; padding: 0 10px 0 30px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface) no-repeat 9px 50%/14px url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Ccircle cx='11' cy='11' r='6.5' fill='none' stroke='%238a8a96' stroke-width='2'/%3E%3Cpath d='m16 16 4 4' stroke='%238a8a96' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E"); }
.search input:focus { outline: none; border-color: var(--focus); box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 22%, transparent); }

.pipeline { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; align-items: start; }
.rail { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 16px; align-items: start; }
@media (min-width: 1760px) {
  .pipeline { grid-template-columns: minmax(0, 1fr) 320px; }
  .rail { display: flex; flex-direction: column; }
}

.board { display: grid; grid-template-columns: repeat(6, minmax(176px, 1fr)); gap: 10px; overflow-x: auto; padding-bottom: 4px; }
@media (max-width: 1200px) { .board { grid-template-columns: repeat(6, minmax(150px, 1fr)); gap: 8px; } .inv { padding: 9px 9px 8px; } }
.col { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); min-height: 220px; display: flex; flex-direction: column; min-width: 0; }
.col__head { display: flex; align-items: center; gap: 7px; padding: 10px 12px 8px; }
.col__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--c); box-shadow: 0 0 0 3px color-mix(in srgb, var(--c) 18%, transparent); }
.col__title { font-weight: 600; font-size: 12.5px; white-space: nowrap; }
.col__count { color: var(--text-3); font-size: 12px; font-variant-numeric: tabular-nums; }
.col__sum { margin-left: auto; font-size: 11.5px; color: var(--text-3); font-variant-numeric: tabular-nums; white-space: nowrap; }
.col__list { list-style: none; margin: 0; padding: 2px 8px 8px; display: flex; flex-direction: column; gap: 7px; }
.col__empty { color: var(--text-3); font-size: 12px; padding: 14px 6px; text-align: center; border: 1px dashed var(--border); border-radius: 8px; margin: 2px 0 0; }

.inv { display: block; width: 100%; text-align: left; background: var(--surface); border: 1px solid var(--border); border-radius: 9px; padding: 10px 11px 9px; box-shadow: var(--shadow-1); transition: border-color .15s, box-shadow .15s, transform .15s; position: relative; }
.inv:hover { border-color: var(--border-strong); box-shadow: var(--shadow-2); }
.inv.is-active { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 16%, transparent); }
.inv.is-flash { animation: flash 1.6s var(--ease); }
@keyframes flash { 0%, 30% { box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 30%, transparent); border-color: var(--accent); } 100% { box-shadow: var(--shadow-1); } }
.inv__top { display: flex; align-items: flex-start; gap: 6px; }
.inv__debtor { font-weight: 600; font-size: 13px; line-height: 1.3; flex: 1; min-width: 0; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.lang { font-size: 10px; font-weight: 700; letter-spacing: .04em; padding: 1px 5px; border-radius: 4px; background: var(--surface-3); color: var(--text-2); border: 1px solid var(--border); flex: none; margin-top: 1px; }
.inv__meta { display: flex; align-items: center; gap: 6px; margin-top: 3px; color: var(--text-3); font-size: 11.5px; }
.inv__amount { margin-top: 8px; font-size: 15px; font-weight: 640; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.inv__foot { display: flex; align-items: center; gap: 6px; margin-top: 7px; flex-wrap: wrap; row-gap: 5px; }
.overdue { white-space: nowrap; font-size: 11.5px; font-weight: 560; font-variant-numeric: tabular-nums; color: var(--text-2); }
.overdue.is-late { color: var(--st-overdue); }
.chips { display: inline-flex; gap: 3px; margin-left: auto; }
.chan { width: 20px; height: 20px; border-radius: 6px; display: inline-grid; place-items: center; color: var(--cc); background: color-mix(in srgb, var(--cc) 11%, transparent); }
.chan .ic { width: 12.5px; height: 12.5px; }
.chan.is-off { color: var(--text-3); background: var(--surface-3); position: relative; }
.chan.is-off::after { content: ""; position: absolute; width: 16px; height: 1.6px; background: var(--text-3); transform: rotate(-45deg); border-radius: 2px; }
.chan--email { --cc: var(--ch-email); }
.chan--sms { --cc: var(--ch-sms); }
.chan--whatsapp { --cc: var(--ch-wa); }
.inv__flag { display: flex; align-items: center; gap: 5px; margin-top: 7px; font-size: 11.5px; color: var(--text-2); padding: 4px 6px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--border); }
.inv__flag .ic { width: 13px; height: 13px; color: var(--fc, var(--text-3)); }
.inv__flag--bad { --fc: var(--bad); }
.inv__flag--ok { --fc: var(--ok); }
.inv__flag--promise { --fc: var(--st-promised); }

.status { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 560; color: var(--text); padding: 2px 8px 2px 7px; border-radius: 999px; background: color-mix(in srgb, var(--c) 11%, transparent); white-space: nowrap; }
.status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--c); }

/* attention list */
.attn { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.attn li + li { border-top: 1px solid var(--border); }
.attn button { width: 100%; text-align: left; background: none; border: 0; padding: 9px 2px; display: grid; grid-template-columns: auto 1fr; gap: 2px 9px; border-radius: 6px; }
.attn button:hover .attn__title { color: var(--accent); }
.attn__icon { grid-row: span 2; width: 26px; height: 26px; border-radius: 7px; display: grid; place-items: center; background: color-mix(in srgb, var(--st-attention) 12%, transparent); color: var(--st-attention); }
.attn__title { font-weight: 580; font-size: 12.5px; }
.attn__sub { font-size: 11.5px; color: var(--text-3); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.empty-sm { color: var(--text-3); font-size: 12.5px; padding: 8px 0 2px; }

/* forecast chart */
.forecast svg { display: block; max-width: 100%; height: auto; overflow: visible; }
.forecast .bar { fill: color-mix(in srgb, var(--st-promised) 78%, transparent); transition: fill .15s; }
.forecast .bar.is-zero { fill: var(--surface-3); }
.forecast g.day:hover .bar { fill: var(--st-promised); }
.forecast .cum { fill: none; stroke: var(--st-paid); stroke-width: 1.8; stroke-linejoin: round; stroke-linecap: round; }
.forecast .cum-area { fill: color-mix(in srgb, var(--st-paid) 9%, transparent); }
.forecast .axis { fill: var(--text-3); font-size: 10px; font-family: var(--font); }
.forecast .grid { stroke: var(--border); stroke-dasharray: 2 3; }
.forecast .today { stroke: var(--text-3); stroke-width: 1; }
.forecast__legend { display: flex; gap: 14px; margin: 8px 0 6px; font-size: 11.5px; color: var(--text-2); }
.forecast__legend i { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }
.forecast__tip { min-height: 18px; font-size: 12px; color: var(--text-2); font-variant-numeric: tabular-nums; }

/* ---------- drawer ---------- */
.scrim { position: fixed; inset: 0; background: rgba(15, 15, 25, .28); z-index: 40; animation: fade .2s ease; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(760px, 62vw); min-width: 600px; background: var(--bg); border-left: 1px solid var(--border); box-shadow: var(--shadow-3); z-index: 41; display: flex; flex-direction: column; animation: slide .28s var(--ease); }
@keyframes slide { from { transform: translateX(28px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.drawer__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 16px 20px 14px; background: var(--surface); border-bottom: 1px solid var(--border); }
.drawer__title h2 { font-size: 18px; font-weight: 650; letter-spacing: -.015em; }
.eyebrow { font-size: 11.5px; color: var(--text-3); font-weight: 560; letter-spacing: .02em; margin-bottom: 2px; display: flex; gap: 8px; align-items: center; }
.eyebrow--demo { color: var(--demo); text-transform: uppercase; letter-spacing: .06em; font-size: 11px; }
.drawer__body { overflow-y: auto; padding: 16px 20px 40px; flex: 1; scroll-behavior: smooth; }

.facts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; background: var(--border); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-1); }
.fact { padding: 10px 14px; background: var(--surface); min-width: 0; }
.fact__k { font-size: 11.5px; color: var(--text-3); font-weight: 540; }
.fact__v { margin-top: 2px; font-weight: 580; font-variant-numeric: tabular-nums; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fact__v.mono { font-size: 12.5px; font-weight: 560; }
.fact--wrap .fact__v { white-space: normal; overflow-wrap: anywhere; }
.fact--wide { grid-column: span 2; }
.promise-box { margin-top: 10px; display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: var(--radius); background: color-mix(in srgb, var(--st-promised) 8%, var(--surface)); border: 1px solid color-mix(in srgb, var(--st-promised) 25%, var(--border)); }
.promise-box .ic { color: var(--st-promised); }
.promise-box.is-broken { background: var(--bad-soft); border-color: color-mix(in srgb, var(--bad) 30%, var(--border)); }
.promise-box.is-broken .ic { color: var(--bad); }
.promise-box.is-kept { background: var(--ok-soft); border-color: color-mix(in srgb, var(--ok) 30%, var(--border)); }
.promise-box.is-kept .ic { color: var(--ok); }
.callout { margin-top: 10px; display: flex; gap: 10px; padding: 10px 14px; border-radius: var(--radius); background: color-mix(in srgb, var(--st-attention) 7%, var(--surface)); border: 1px solid color-mix(in srgb, var(--st-attention) 22%, var(--border)); font-size: 13px; }
.callout .ic { color: var(--st-attention); margin-top: 1px; }

.section-title { display: flex; align-items: center; justify-content: space-between; margin: 22px 0 10px; }
.section-title h3 { font-size: 13px; font-weight: 620; }
.legend { display: flex; gap: 12px; font-size: 11.5px; color: var(--text-3); }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.legend i { width: 8px; height: 8px; border-radius: 2px; background: var(--c); }

/* ---------- timeline (the hero) ---------- */
.tl { list-style: none; margin: 0; padding: 0; position: relative; }
.tl::before { content: ""; position: absolute; left: 15px; top: 6px; bottom: 6px; width: 1.5px; background: var(--border); border-radius: 2px; }
.tl-day { position: relative; padding: 4px 0 10px 40px; font-size: 11.5px; font-weight: 600; color: var(--text-3); letter-spacing: .02em; }
.tl-day:not(:first-child) { padding-top: 12px; }
.tl-item { position: relative; padding: 0 0 12px 40px; }
.tl-node { position: absolute; left: 4px; top: 4px; width: 24px; height: 24px; border-radius: 8px; display: grid; place-items: center; color: var(--nc, var(--text-2)); background: var(--surface); border: 1px solid color-mix(in srgb, var(--nc, var(--text-3)) 35%, var(--border)); box-shadow: 0 0 0 4px var(--bg); }
.tl-node .ic { width: 13px; height: 13px; }
.tl-item--email { --nc: var(--ch-email); --soft: var(--ch-email-soft); }
.tl-item--sms { --nc: var(--ch-sms); --soft: var(--ch-sms-soft); }
.tl-item--whatsapp { --nc: var(--ch-wa); --soft: var(--ch-wa-soft); }
.tl-item--agent { --nc: var(--accent); }
.tl-item--action { --nc: var(--accent); }
.tl-item--escalation { --nc: var(--st-attention); }
.tl-item--note { --nc: var(--text-3); }
.tl-item--bank { --nc: var(--st-paid); }
.tl-item--delivery { padding-bottom: 10px; }
.tl-item--delivery .tl-node { width: 10px; height: 10px; left: 11px; top: 5px; border-radius: 50%; border: 0; background: var(--dc, var(--ok)); box-shadow: 0 0 0 4px var(--bg); }
.tl-item.is-new { animation: rise .45s var(--ease) both; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.tl-meta { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--text-3); margin-bottom: 5px; min-height: 22px; flex-wrap: wrap; }
.tl-meta strong { color: var(--text); font-weight: 600; }
.tl-meta .time { margin-left: auto; font-variant-numeric: tabular-nums; }
.dir { font-size: 10.5px; font-weight: 650; letter-spacing: .04em; text-transform: uppercase; padding: 1px 6px; border-radius: 4px; color: var(--nc); background: color-mix(in srgb, var(--nc) 11%, transparent); }

/* messages */
.msg { border-radius: 10px; padding: 11px 13px; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 13.5px; line-height: 1.5; border: 1px solid var(--border); background: var(--surface); box-shadow: var(--shadow-1); }
.msg__subject { font-weight: 600; font-size: 12.5px; color: var(--text-2); margin: -1px 0 7px; padding-bottom: 7px; border-bottom: 1px solid var(--border); white-space: normal; display: flex; gap: 6px; align-items: center; }
.msg--out { background: var(--soft); border-color: color-mix(in srgb, var(--nc) 22%, var(--border)); }
.msg--email.msg--in { border-left: 3px solid var(--ch-email); }
.msg--sms, .msg--whatsapp { border-radius: 16px; max-width: 88%; padding: 9px 13px; }
.msg--sms.msg--in, .msg--whatsapp.msg--in { border-bottom-left-radius: 5px; }
.msg--sms.msg--out, .msg--whatsapp.msg--out { border-bottom-right-radius: 5px; margin-left: auto; }
.msg--sms.msg--in { border-color: color-mix(in srgb, var(--ch-sms) 35%, var(--border)); }
.msg--whatsapp.msg--in { border-color: color-mix(in srgb, var(--ch-wa) 35%, var(--border)); }
.tl-item--sms .tl-meta, .tl-item--whatsapp .tl-meta { max-width: 100%; }
.msg.is-collapsed { max-height: 128px; overflow: hidden; -webkit-mask-image: linear-gradient(#000 60%, transparent); mask-image: linear-gradient(#000 60%, transparent); }
.more { border: 0; background: none; color: var(--accent); font-size: 12px; font-weight: 560; padding: 4px 0 0; }

/* agent trace */
.trace { border-radius: 10px; border: 1px solid var(--accent-line); background: linear-gradient(180deg, var(--accent-soft), color-mix(in srgb, var(--accent-soft) 35%, var(--surface))); padding: 11px 13px; }
.trace__row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.intent { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 6px; font-size: 12px; font-weight: 620; color: var(--ic, var(--accent)); background: color-mix(in srgb, var(--ic, var(--accent)) 13%, var(--surface)); border: 1px solid color-mix(in srgb, var(--ic, var(--accent)) 26%, transparent); }
.conf { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.conf__bar { position: relative; width: 84px; height: 6px; border-radius: 99px; background: color-mix(in srgb, var(--text-3) 22%, transparent); overflow: visible; }
.conf__fill { position: absolute; inset: 0 auto 0 0; border-radius: 99px; background: var(--cf, var(--ok)); transition: width .6s var(--ease); }
.conf__thr { position: absolute; top: -3px; bottom: -3px; width: 1.5px; background: var(--text-2); border-radius: 1px; opacity: .6; }
.trace__summary { margin-top: 8px; font-size: 13.5px; color: var(--text); }
.kv { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.kv span { font-size: 11.5px; padding: 2px 7px; border-radius: 5px; background: var(--surface); border: 1px solid var(--border); color: var(--text-2); }
.kv b { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.trace__model { margin-top: 8px; display: flex; gap: 12px; font-size: 11.5px; color: var(--text-3); flex-wrap: wrap; }
.trace__model span { display: inline-flex; gap: 4px; align-items: center; }

.action { border-radius: 10px; border: 1px solid var(--border); background: var(--surface); padding: 9px 12px; display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; align-items: center; }
.action__name { font-family: var(--mono); font-size: 12.5px; font-weight: 600; color: var(--text); }
.action__res { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 600; padding: 1px 7px; border-radius: 999px; color: var(--ok); background: var(--ok-soft); }
.action__res.is-bad { color: var(--bad); background: var(--bad-soft); }
.action__params { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 4px; }
.action__params code { font-family: var(--mono); font-size: 11.5px; padding: 1px 6px; border-radius: 5px; background: var(--surface-3); color: var(--text-2); }
.action__detail { grid-column: 1 / -1; font-size: 12.5px; color: var(--text-2); }
.action__policy { grid-column: 1 / -1; display: flex; gap: 5px; align-items: center; font-size: 11.5px; color: var(--text-3); }
.action__policy .ic { width: 13px; height: 13px; color: var(--accent); }

.escal { border-radius: 10px; padding: 10px 13px; border: 1px solid color-mix(in srgb, var(--st-attention) 30%, var(--border)); background: color-mix(in srgb, var(--st-attention) 7%, var(--surface)); font-size: 13px; }
.note { font-size: 12.5px; color: var(--text-2); padding: 1px 0; }
.deliv { font-size: 12px; color: var(--text-3); display: flex; gap: 6px; align-items: center; min-height: 18px; }
.deliv b { font-weight: 600; color: var(--dc, var(--ok)); }

/* simulate composer */
.composer { margin-top: 18px; border: 1px dashed var(--demo-line); background: var(--demo-soft); border-radius: 12px; padding: 14px; }
.composer__head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.composer__head h3 { font-size: 13px; font-weight: 640; }
.composer__head .tag { margin-left: auto; }
.seg { display: inline-flex; padding: 2px; border-radius: 8px; background: var(--surface); border: 1px solid var(--border); }
.seg button { border: 0; background: none; height: 26px; padding: 0 10px; border-radius: 6px; display: inline-flex; gap: 6px; align-items: center; font-size: 12.5px; color: var(--text-2); font-weight: 560; }
.seg button[aria-pressed="true"] { background: var(--surface-3); color: var(--text); box-shadow: inset 0 0 0 1px var(--border); }
.samples { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; }
.sample { border: 1px solid var(--border); background: var(--surface); border-radius: 999px; height: 26px; padding: 0 10px 0 4px; display: inline-flex; gap: 6px; align-items: center; font-size: 12px; color: var(--text-2); }
.sample:hover { border-color: var(--text-3); color: var(--text); }
.sample .lang { margin: 0; }
.composer textarea, .case textarea { width: 100%; min-height: 76px; resize: vertical; border: 1px solid var(--border-strong); border-radius: 9px; padding: 9px 11px; background: var(--surface); line-height: 1.5; }
.composer textarea:focus, .case textarea:focus, .field input:focus, .field select:focus { outline: none; border-color: var(--focus); box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 22%, transparent); }
.composer__foot { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.composer__foot .muted { font-size: 12px; }
.composer__foot .btn { margin-left: auto; }

.steps { list-style: none; display: flex; gap: 0; margin: 0 0 12px; padding: 10px 12px; border-radius: 10px; background: var(--surface); border: 1px solid var(--border); }
.steps--sticky { position: sticky; top: 0; z-index: 3; margin: -16px -20px 14px; border-radius: 0; border-width: 0 0 1px; padding: 11px 20px; background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(8px); box-shadow: 0 6px 16px -10px rgba(20, 20, 40, .25); animation: fade .25s ease; }
.step { flex: 1; display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--text-3); font-weight: 560; position: relative; white-space: nowrap; }
.step + .step::before { content: ""; flex: 0 1 18px; height: 1.5px; background: var(--border-strong); margin-right: 6px; border-radius: 2px; }
.step__dot { width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; border: 1.5px solid var(--border-strong); background: var(--surface); flex: none; }
.step__dot .ic { width: 11px; height: 11px; opacity: 0; }
.step.is-active { color: var(--text); }
.step.is-active .step__dot { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); animation: pulse 1s ease-in-out infinite; }
.step.is-done { color: var(--text); }
.step.is-done .step__dot { background: var(--accent); border-color: var(--accent); color: #fff; }
.step.is-done .step__dot .ic { opacity: 1; }
.step.is-error .step__dot { background: var(--bad); border-color: var(--bad); color: #fff; }
.step.is-done + .step::before { background: var(--accent); }
@keyframes pulse { 50% { box-shadow: 0 0 0 5px color-mix(in srgb, var(--accent) 8%, transparent); } }

.bankline { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; border-radius: 10px; padding: 10px 13px; background: var(--ok-soft); border: 1px solid color-mix(in srgb, var(--ok) 28%, var(--border)); }
.bankline__amt { font-weight: 680; font-size: 15px; color: var(--ok); font-variant-numeric: tabular-nums; }
.bankline__meta { display: flex; gap: 10px; flex-wrap: wrap; font-size: 12px; color: var(--text-2); }

/* demo controls */
.demo { margin-top: 18px; border: 1px dashed var(--demo-line); background: var(--demo-soft); border-radius: 12px; padding: 12px 14px; }
.demo .composer__head { margin-bottom: 8px; }
.demo .composer__head .muted { margin-left: 2px; }
.demo__row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.demo__pay { display: inline-flex; gap: 6px; margin-left: auto; }
.demo__amount { width: 96px; height: 28px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: 0 8px; background: var(--surface); font-size: 12.5px; text-align: right; font-variant-numeric: tabular-nums; }
.demo__amount:focus { outline: none; border-color: var(--focus); box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 22%, transparent); }

/* simulate turn result */
.simres { margin: 4px 0 0 40px; padding: 11px 13px; border-radius: 10px; background: var(--surface); border: 1px solid var(--border); display: flex; flex-direction: column; gap: 7px; font-size: 12.5px; animation: rise .35s var(--ease); }
.simres__head { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.simres__head strong { margin-right: 4px; font-size: 13px; }
.pill { display: inline-flex; align-items: center; gap: 4px; height: 21px; padding: 0 8px; border-radius: 999px; font-size: 11.5px; font-weight: 560; background: var(--surface-3); color: var(--text-2); font-variant-numeric: tabular-nums; }
.pill .ic { width: 12px; height: 12px; }
.pill--backend { background: var(--accent-soft); color: var(--accent); border: 1px solid var(--accent-line); font-family: var(--mono); font-size: 11px; }
.simres__line { display: grid; grid-template-columns: 128px 1fr; gap: 10px; align-items: baseline; color: var(--text); }
.simres__k { color: var(--text-3); font-weight: 560; }
.simres__line--warn { grid-template-columns: auto 1fr; color: var(--warn); }
.simres__chips { display: flex; flex-wrap: wrap; gap: 4px; }
.req { display: inline-flex; align-items: center; gap: 4px; font-family: var(--mono); font-size: 11.5px; padding: 1px 7px 1px 5px; border-radius: 5px; border: 1px solid var(--border); background: var(--surface-2); }
.req .ic { width: 12px; height: 12px; }
.req.is-ok .ic { color: var(--ok); }
.req.is-miss { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 35%, var(--border)); }
.req em { font-style: normal; font-family: var(--font); font-size: 10.5px; color: var(--accent); margin-left: 2px; }

/* ---------- review queue ---------- */
.cases { display: grid; grid-template-columns: repeat(auto-fill, minmax(460px, 1fr)); gap: 14px; }
.case { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-1); padding: 16px; display: flex; flex-direction: column; gap: 12px; transition: opacity .3s, transform .3s; }
.case.is-leaving { opacity: 0; transform: scale(.98); }
.case__head { display: flex; align-items: flex-start; gap: 10px; }
.case__icon { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; color: var(--st-attention); background: color-mix(in srgb, var(--st-attention) 12%, transparent); flex: none; }
.case__title { font-weight: 620; font-size: 14px; }
.case__sub { font-size: 12px; color: var(--text-3); margin-top: 1px; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.reason { margin-left: auto; font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 999px; color: var(--st-attention); background: color-mix(in srgb, var(--st-attention) 11%, transparent); white-space: nowrap; }
.case__summary { display: flex; gap: 9px; padding: 10px 12px; border-radius: 9px; background: var(--accent-soft); border: 1px solid var(--accent-line); font-size: 13px; }
.case__summary .ic { color: var(--accent); margin-top: 2px; }
.case label > span { display: block; font-size: 12px; color: var(--text-2); font-weight: 560; margin-bottom: 5px; }
.case textarea { min-height: 150px; font-size: 13px; }
.case__foot { display: flex; align-items: center; gap: 8px; }
.case__foot .muted { font-size: 12px; margin-right: auto; display: flex; align-items: center; gap: 6px; }
.empty { text-align: center; padding: 56px 20px; border: 1px dashed var(--border-strong); border-radius: 12px; color: var(--text-2); background: var(--surface); }
.empty .ic { width: 28px; height: 28px; color: var(--ok); margin-bottom: 8px; }
.empty h3 { font-size: 15px; margin-bottom: 4px; color: var(--text); }

/* ---------- evaluation ---------- */
.banner { display: flex; gap: 10px; align-items: flex-start; padding: 10px 14px; border-radius: 10px; margin-bottom: 14px; font-size: 13px; background: var(--demo-soft); border: 1px solid var(--demo-line); color: var(--text); }
.banner .ic { color: var(--demo); margin-top: 1px; }
.eval-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 1250px) { .eval-grid { grid-template-columns: minmax(0, 1fr); } }
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
.tbl th { text-align: left; font-size: 11.5px; color: var(--text-3); font-weight: 560; padding: 8px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.tbl td { padding: 9px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl td.n, .tbl th.n { text-align: right; }
.tbl .win { font-weight: 650; }
.delta { font-size: 11.5px; font-weight: 600; color: var(--ok); }
.delta.is-neg { color: var(--bad); }
.meter { display: grid; grid-template-columns: 120px 1fr 52px; gap: 10px; align-items: center; font-size: 12.5px; padding: 5px 0; }
.meter__track { height: 18px; position: relative; display: flex; flex-direction: column; gap: 2px; justify-content: center; }
.meter__bar { height: 7px; border-radius: 3px; background: var(--accent); transform-origin: left; }
.meter__bar--base { background: color-mix(in srgb, var(--text-3) 45%, transparent); }
.meter__val { text-align: right; font-variant-numeric: tabular-nums; color: var(--text-2); }
.eval-meta { display: flex; gap: 18px; flex-wrap: wrap; font-size: 12.5px; color: var(--text-2); margin-bottom: 14px; }
.eval-meta b { color: var(--text); font-weight: 600; }
pre.raw { font-family: var(--mono); font-size: 12px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 9px; padding: 12px; overflow: auto; max-height: 480px; }

/* ---------- dialogs, sign-in, toasts ---------- */
.modal { border: 1px solid var(--border); border-radius: 14px; padding: 0; background: var(--surface); color: var(--text); box-shadow: var(--shadow-3); width: 440px; max-width: calc(100vw - 32px); }
.modal::backdrop { background: rgba(15, 15, 25, .38); }
.modal[open] { animation: pop .2s var(--ease); }
@keyframes pop { from { opacity: 0; transform: translateY(6px) scale(.98); } to { opacity: 1; transform: none; } }
.modal__inner { padding: 20px; display: flex; flex-direction: column; gap: 10px; }
.modal__inner h2 { font-size: 16px; }
.modal__actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field > span { font-size: 12px; color: var(--text-2); font-weight: 560; }
.field input, .field select { height: 36px; border: 1px solid var(--border-strong); border-radius: 8px; padding: 0 10px; background: var(--surface); }

.signin { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; background: radial-gradient(1200px 600px at 50% -10%, var(--accent-soft), var(--bg)); }
.signin__card { width: 380px; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow-3); padding: 28px; display: flex; flex-direction: column; gap: 12px; }
.signin__card h1 { margin-top: 6px; }
.error { color: var(--bad); font-size: 12.5px; }

.toasts { position: fixed; bottom: 20px; left: 24px; z-index: 70; display: flex; flex-direction: column; gap: 8px; align-items: flex-start; pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 9px; padding: 9px 14px; border-radius: 10px; background: var(--text); color: var(--bg); font-size: 13px; font-weight: 520; box-shadow: var(--shadow-3); animation: rise .25s var(--ease); }
.toast .ic { color: var(--st-paid); }
.toast--bad .ic { color: var(--st-overdue); }

.loading { color: var(--text-3); padding: 24px 0; font-size: 13px; }
.spin { width: 14px; height: 14px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; display: inline-block; animation: spin .8s linear infinite; vertical-align: -2px; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}
