:root {
  --navy: #0b1f3a;
  --navy-2: #143260;
  --navy-3: #21497f;
  --on-navy: #c9d6ea;
  --gold: #f2b01e;
  --gold-2: #ffc94d;
  --gold-ink: #7a5200;
  --paper: #f3f5f9;
  --card: #ffffff;
  --ink: #0e1a2b;
  --muted: #5a6a80;
  --line: #dde3ec;
  --red: #b3261e;
  --red-bg: #fdecea;
  --green: #1d7a4b;
  --green-bg: #e5f4ec;
  --amber: #8a5a00;
  --amber-bg: #fff4d6;
  --blue: #1f4f99;
  --blue-bg: #e7eefa;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(11, 31, 58, 0.06), 0 8px 24px rgba(11, 31, 58, 0.06);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  background: var(--paper);
  line-height: 1.5;
}
button, input, textarea, select { font: inherit; color: inherit; }
a { color: var(--blue); }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ── Top bar ───────────────────────────────────────────── */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  max-width: 1080px; margin: 0 auto; padding: 1.1rem 1rem;
}
.brand { display: flex; align-items: center; gap: 0.6rem; color: #fff; text-decoration: none; }
.brand-mark {
  width: 2.1rem; height: 2.1rem; border-radius: 0.6rem; display: grid; place-items: center;
  background: var(--gold); color: var(--navy);
}
.brand-name { font-weight: 800; font-size: 1.25rem; letter-spacing: -0.01em; }
.brand-sub { font-size: 0.8rem; color: var(--on-navy); font-weight: 500; }
.pill {
  display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.35rem 0.75rem; border-radius: 999px;
  background: var(--navy-2); color: #fff; font-size: 0.75rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
}
.pill::before { content: ""; width: 0.45rem; height: 0.45rem; border-radius: 50%; background: var(--gold); }

/* ── Hero ──────────────────────────────────────────────── */
.hero { background: var(--navy); color: #fff; padding-bottom: 5.5rem; }
.hero-inner { max-width: 1080px; margin: 0 auto; padding: 1.5rem 1rem 0; }
.eyebrow { margin: 0 0 0.75rem; color: var(--gold); font-size: 0.8rem; font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase; }
.hero h1 { margin: 0; max-width: 16ch; font-size: clamp(2.1rem, 6vw, 3.6rem); line-height: 1.04; letter-spacing: -0.03em; font-weight: 800; }
.hero h1 em { color: var(--gold); font-style: normal; }
.hero p.lead { max-width: 56ch; margin: 1.25rem 0 1.4rem; color: var(--on-navy); font-size: 1.05rem; }
.chips { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0 0 1.75rem; padding: 0; list-style: none; }
.chips li { padding: 0.4rem 0.8rem; border-radius: 999px; background: var(--navy-2); color: #e6edf7; font-size: 0.85rem; font-weight: 600; }

/* ── Buttons ───────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  min-height: 2.5rem; padding: 0.5rem 1rem; border-radius: 10px; border: 1px solid var(--line);
  background: #fff; color: var(--ink); font-weight: 650; cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn:hover { border-color: #b9c4d4; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn-primary:hover { background: var(--navy-2); }
.btn-gold { background: var(--gold); border-color: var(--gold); color: var(--navy); }
.btn-gold:hover { background: var(--gold-2); }
.btn-danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-sm { min-height: 2rem; padding: 0.3rem 0.7rem; font-size: 0.85rem; border-radius: 8px; }
.cta {
  display: inline-flex; align-items: center; gap: 0.8rem; padding: 0.45rem 1.6rem 0.45rem 0.45rem;
  border: 0; border-radius: 999px; background: var(--gold); color: var(--navy); font-size: 1.1rem; font-weight: 800; cursor: pointer;
  box-shadow: 0 10px 30px rgba(242, 176, 30, 0.35);
}
.cta img { width: 3rem; height: 3rem; border-radius: 50%; background: #fff; }
.cta:hover { background: var(--gold-2); }
.cta:disabled { opacity: 0.6; cursor: wait; }
.note-off { margin-top: 0.9rem; color: var(--gold-2); font-size: 0.9rem; }

/* ── Cards ─────────────────────────────────────────────── */
.wrap { max-width: 1080px; margin: -4rem auto 3rem; padding: 0 1rem; display: grid; gap: 1rem; grid-template-columns: 1fr 1fr; align-items: start; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.4rem 1.5rem; min-width: 0; }
.card h2 { margin: 0 0 0.2rem; font-size: 0.78rem; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; color: var(--amber); }
.card h3 { margin: 0 0 0.35rem; font-size: 1.15rem; }
.card .sub { margin: 0 0 1rem; color: var(--muted); }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 0.45rem 1.2rem; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.kv .money { color: var(--amber); font-size: 1.15rem; font-weight: 800; }
.tries { margin: 0; padding: 0; list-style: none; display: grid; gap: 0.8rem; }
.tries li { padding-left: 1.1rem; position: relative; }
.tries li::before { content: ""; position: absolute; left: 0; top: 0.55rem; width: 0.45rem; height: 0.45rem; border-radius: 50%; background: var(--gold); }
.tries b { display: block; }
.tries span { color: var(--muted); font-size: 0.9rem; }
.footer { max-width: 1080px; margin: 0 auto 2.5rem; padding: 0 1rem; color: var(--muted); font-size: 0.85rem; }

/* ── Report-received card ──────────────────────────────── */
.received { grid-column: 1 / -1; }
.ref-big { font-size: 1.6rem; font-weight: 800; letter-spacing: 0.02em; margin: 0.1rem 0 0.8rem; }
.steps { display: flex; gap: 0; margin: 0.5rem 0 1.2rem; padding: 0; list-style: none; counter-reset: s; }
.steps li { flex: 1; position: relative; padding-top: 1.9rem; font-size: 0.85rem; color: var(--muted); text-align: center; }
.steps li::before {
  counter-increment: s; content: counter(s); position: absolute; top: 0; left: 50%; transform: translateX(-50%);
  width: 1.5rem; height: 1.5rem; border-radius: 50%; background: var(--line); color: var(--muted); display: grid; place-items: center; font-size: 0.75rem; font-weight: 800; z-index: 1;
}
.steps li::after { content: ""; position: absolute; top: 0.7rem; left: -50%; right: 50%; height: 2px; background: var(--line); }
.steps li:first-child::after { display: none; }
.steps li.done { color: var(--ink); font-weight: 650; }
.steps li.done::before { background: var(--green); color: #fff; content: "✓"; }
.steps li.done::after, .steps li.now::after { background: var(--green); }
.steps li.now { color: var(--ink); font-weight: 700; }
.steps li.now::before { background: var(--gold); color: var(--navy); }

/* ── Call launcher + panel ─────────────────────────────── */
.launcher {
  position: fixed; right: 1rem; bottom: 1rem; z-index: 20; display: flex; align-items: center; gap: 0.6rem;
  padding: 0.35rem 1.2rem 0.35rem 0.35rem; border: 0; border-radius: 999px; background: var(--navy); color: #fff;
  font-weight: 700; cursor: pointer; box-shadow: 0 10px 30px rgba(11, 31, 58, 0.35);
}
.launcher img { width: 2.6rem; height: 2.6rem; border-radius: 50%; display: block; background: #fff; }
.panel {
  position: fixed; right: 1rem; bottom: 1rem; z-index: 30; width: min(21rem, calc(100vw - 2rem));
  padding: 1.2rem 1.2rem 1.3rem; border-radius: 20px; background: var(--navy); color: #fff; text-align: center;
  box-shadow: 0 20px 50px rgba(11, 31, 58, 0.45);
}
.panel .close { position: absolute; top: 0.6rem; right: 0.6rem; width: 2rem; height: 2rem; border: 0; border-radius: 50%; background: var(--navy-2); color: #fff; cursor: pointer; font-size: 1.1rem; line-height: 1; }
.face { position: relative; width: 9.5rem; height: 9.5rem; margin: 0.8rem auto 1.1rem; }
.face .ring { position: absolute; inset: -0.45rem; border-radius: 50%; border: 2px solid var(--navy-3); transition: border-color 150ms; }
.face[data-speaking="on"] .ring { border-color: var(--gold); animation: pulse 1.2s ease-in-out infinite; }
.face .photo { position: relative; width: 100%; height: 100%; border-radius: 50%; overflow: hidden; background: #fff; }
.face img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.face .talking { opacity: 0; transition: opacity 250ms; }
.face[data-speaking="on"] .talking { opacity: 1; }
.panel[data-live="off"] .face .idle, .panel[data-live="off"] .face .talking { display: none; }
@keyframes pulse { 50% { transform: scale(1.06); } }
@media (prefers-reduced-motion: reduce) {
  .face[data-speaking="on"] .ring { animation: none; }
  .face .idle, .face .talking { display: none; }
}
.panel .name { margin: 0; font-size: 1.1rem; font-weight: 800; }
.panel .role { margin: 0.1rem 0 0; font-size: 0.8rem; color: var(--on-navy); }
.panel .status { margin: 0.5rem 0 1rem; min-height: 1.5em; font-size: 0.9rem; color: var(--on-navy); }
.panel .row { display: flex; gap: 0.5rem; justify-content: center; flex-wrap: wrap; }
.panel .btn { border-color: var(--navy-3); background: var(--navy-2); color: #fff; }
.panel .btn-danger { background: var(--red); border-color: var(--red); }
.panel .btn-gold { background: var(--gold); border-color: var(--gold); color: var(--navy); }

/* ── App shell (officer + bank) ────────────────────────── */
.appbar { background: var(--navy); color: #fff; }
.appbar .topbar { max-width: none; padding: 0.7rem 1.2rem; }
.appbar .who { display: flex; align-items: center; gap: 0.8rem; font-size: 0.9rem; color: var(--on-navy); }
.appbar .who b { color: #fff; }
.appbar .btn { background: var(--navy-2); border-color: var(--navy-3); color: #fff; }
.login {
  max-width: 24rem; margin: 4rem auto; padding: 1.8rem; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
}
.login h1 { margin: 0 0 0.2rem; font-size: 1.4rem; }
.login p { margin: 0 0 1.2rem; color: var(--muted); }
.field { display: grid; gap: 0.3rem; margin-bottom: 0.9rem; font-weight: 600; font-size: 0.9rem; }
.field input, textarea, select {
  width: 100%; padding: 0.6rem 0.75rem; border: 1px solid var(--line); border-radius: 10px; background: #fff; font-weight: 400;
}
input:focus, textarea:focus, select:focus, .btn:focus-visible, .cta:focus-visible { outline: 3px solid rgba(242, 176, 30, 0.55); outline-offset: 1px; }
.error { color: var(--red); font-size: 0.9rem; min-height: 1.3em; margin: 0.2rem 0 0.6rem; }

.console { display: grid; grid-template-columns: 22rem 1fr; min-height: calc(100vh - 3.6rem); }
.queue { border-right: 1px solid var(--line); background: #fff; display: flex; flex-direction: column; min-width: 0; }
.queue-head { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; padding: 0.9rem 1rem; border-bottom: 1px solid var(--line); }
.queue-head h1 { margin: 0; font-size: 1rem; }
.queue-list { list-style: none; margin: 0; padding: 0; overflow-y: auto; }
.qi { display: block; width: 100%; text-align: left; padding: 0.85rem 1rem; border: 0; border-bottom: 1px solid var(--line); background: #fff; cursor: pointer; }
.qi:hover { background: #f8fafd; }
.qi[aria-current="true"] { background: var(--blue-bg); box-shadow: inset 3px 0 0 var(--navy); }
.qi .top { display: flex; justify-content: space-between; gap: 0.5rem; font-size: 0.8rem; color: var(--muted); }
.qi .ttl { margin: 0.15rem 0 0.35rem; font-weight: 700; line-height: 1.3; }
.qi .meta { display: flex; flex-wrap: wrap; gap: 0.35rem; align-items: center; }
.qi.dim { opacity: 0.6; }
.empty { padding: 2rem 1rem; color: var(--muted); text-align: center; }

.tag { display: inline-flex; align-items: center; gap: 0.3rem; padding: 0.12rem 0.5rem; border-radius: 6px; font-size: 0.75rem; font-weight: 700; background: var(--paper); color: var(--muted); white-space: nowrap; }
.tag.red { background: var(--red-bg); color: var(--red); }
.tag.green { background: var(--green-bg); color: var(--green); }
.tag.amber { background: var(--amber-bg); color: var(--amber); }
.tag.blue { background: var(--blue-bg); color: var(--blue); }
.tag.navy { background: var(--navy); color: #fff; }

.detail { padding: 1.3rem 1.6rem 3rem; min-width: 0; }
.detail-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1rem; align-items: flex-start; margin-bottom: 1rem; }
.detail-head h2 { margin: 0.15rem 0 0.3rem; font-size: 1.45rem; line-height: 1.2; letter-spacing: -0.01em; }
.detail-head .refline { font-size: 0.85rem; color: var(--muted); display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; }
.detail-head .actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }

.alert { display: flex; gap: 0.8rem; align-items: flex-start; padding: 0.85rem 1rem; border-radius: 12px; margin-bottom: 1rem; }
.alert.red { background: var(--red-bg); color: #5c1410; }
.alert.amber { background: var(--amber-bg); color: #4d3300; }
.alert.blue { background: var(--blue-bg); color: #10294f; }
.alert b { display: block; }

/* Journey map */
.journey { display: grid; grid-template-columns: repeat(5, 1fr); gap: 0; margin: 0 0 1.2rem; padding: 1rem 0.6rem 0.9rem; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); list-style: none; }
.journey li { position: relative; text-align: center; padding: 0 0.3rem; }
.journey li::after { content: ""; position: absolute; top: 1.1rem; left: calc(50% + 1.3rem); right: calc(-50% + 1.3rem); height: 2px; background: var(--line); }
.journey li:last-child::after { display: none; }
.journey li.done::after { background: var(--green); }
.journey .dot { width: 2.2rem; height: 2.2rem; margin: 0 auto 0.4rem; border-radius: 50%; display: grid; place-items: center; background: var(--paper); color: var(--muted); border: 2px solid var(--line); }
.journey li.done .dot { background: var(--green); border-color: var(--green); color: #fff; }
.journey li.now .dot { background: var(--gold); border-color: var(--gold); color: var(--navy); box-shadow: 0 0 0 4px rgba(242, 176, 30, 0.25); }
.journey li.bad .dot { background: var(--red); border-color: var(--red); color: #fff; }
.journey .lbl { font-size: 0.8rem; font-weight: 700; line-height: 1.2; }
.journey .who { font-size: 0.72rem; color: var(--muted); margin-top: 0.15rem; }
.journey svg { width: 1.05rem; height: 1.05rem; }

.grid2 { display: grid; grid-template-columns: 1.35fr 1fr; gap: 1rem; align-items: start; }
.panel-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.1rem; margin-bottom: 1rem; min-width: 0; }
.panel-card h3 { margin: 0 0 0.7rem; font-size: 0.78rem; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; }
.panel-card .kv { font-size: 0.92rem; }
.big-loss { font-size: 1.8rem; font-weight: 800; color: var(--amber); letter-spacing: -0.02em; }

.txns { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.txns th { text-align: left; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); padding: 0 0.5rem 0.45rem 0; border-bottom: 1px solid var(--line); }
.txns td { padding: 0.55rem 0.5rem 0.55rem 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.txns tr:last-child td { border-bottom: 0; }
.txns .amt { font-weight: 800; white-space: nowrap; }
.txns .acct { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.85rem; white-space: nowrap; }
.table-scroll { overflow-x: auto; }

.bankrow { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 0.6rem; padding: 0.7rem 0; border-top: 1px solid var(--line); }
.bankrow:first-of-type { border-top: 0; }
.bankrow .bn { font-weight: 700; }
.bankrow .bs { font-size: 0.85rem; color: var(--muted); }
.outcome { margin-top: 0.5rem; padding: 0.7rem 0.8rem; border-radius: 10px; background: var(--paper); font-size: 0.9rem; }

.list { margin: 0; padding-left: 1.1rem; display: grid; gap: 0.3rem; font-size: 0.92rem; }

.tabs { display: flex; gap: 0.25rem; border-bottom: 1px solid var(--line); margin: 0 0 1rem; overflow-x: auto; }
.tabs button { padding: 0.6rem 0.9rem; border: 0; border-bottom: 3px solid transparent; background: none; font-weight: 650; color: var(--muted); cursor: pointer; white-space: nowrap; }
.tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--gold); }
.report-text { width: 100%; min-height: 22rem; font-family: Georgia, "Times New Roman", serif; font-size: 1rem; line-height: 1.65; padding: 1rem 1.1rem; white-space: pre-wrap; }
.report-view { white-space: pre-wrap; font-family: Georgia, "Times New Roman", serif; font-size: 1rem; line-height: 1.65; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 1rem 1.2rem; }
.sig { margin-top: 0.8rem; font-size: 0.9rem; color: var(--green); font-weight: 700; }

.bubbles { display: grid; gap: 0.55rem; }
.bubble { max-width: 80%; padding: 0.55rem 0.8rem; border-radius: 14px; font-size: 0.93rem; line-height: 1.45; }
.bubble .sp { display: block; font-size: 0.7rem; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; opacity: 0.7; margin-bottom: 0.1rem; }
.bubble.ai { background: var(--blue-bg); color: #10294f; justify-self: start; border-bottom-left-radius: 4px; }
.bubble.user { background: #fff; border: 1px solid var(--line); justify-self: end; border-bottom-right-radius: 4px; }

.timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.6rem; }
.timeline li { display: grid; grid-template-columns: 7.5rem 1fr; gap: 0.8rem; font-size: 0.9rem; }
.timeline time { color: var(--muted); font-size: 0.82rem; }
.timeline b { font-weight: 700; }

.toast { position: fixed; left: 50%; bottom: 1.2rem; transform: translateX(-50%); z-index: 50; padding: 0.7rem 1.1rem; border-radius: 10px; background: var(--navy); color: #fff; font-weight: 600; box-shadow: var(--shadow); }
.muted { color: var(--muted); }
.spinner { display: inline-block; width: 0.9rem; height: 0.9rem; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin 0.8s linear infinite; vertical-align: -0.1rem; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Bank desk */
.ringing { display: flex; flex-wrap: wrap; gap: 1.2rem; align-items: center; padding: 1.2rem 1.3rem; border-radius: var(--radius); background: var(--navy); color: #fff; margin-bottom: 1rem; }
.ringing .face { width: 5.5rem; height: 5.5rem; margin: 0; }
.ringing .face .ring { border-color: var(--gold); animation: pulse 1s ease-in-out infinite; }
.ringing .txt { flex: 1; min-width: 12rem; }
.ringing .txt b { display: block; font-size: 1.15rem; }
.ringing .txt span { color: var(--on-navy); font-size: 0.9rem; }

@media (max-width: 900px) {
  .wrap { grid-template-columns: 1fr; }
  .console { grid-template-columns: 1fr; }
  .queue { border-right: 0; border-bottom: 1px solid var(--line); max-height: 40vh; }
  .grid2 { grid-template-columns: 1fr; }
  .detail { padding: 1rem; }
  .journey { grid-template-columns: repeat(5, minmax(0, 1fr)); padding: 0.8rem 0.2rem; }
  .journey .who { display: none; }
  .journey .lbl { font-size: 0.68rem; }
  .timeline li { grid-template-columns: 1fr; gap: 0; }
}
@media (max-width: 520px) {
  .steps li { font-size: 0.72rem; }
  .bubble { max-width: 92%; }
  .appbar .who span { display: none; }
}
