/* Paragon Specialty — platform stylesheet.
   Brand: Paragon Blue #0278ae on white, black text. No other accent colours —
   neutrals are tints of the brand blue. Type: Inter / Helvetica Neue / Arial. */

:root {
  --blue: #0278ae;
  --blue-dark: #02628e;
  --blue-deep: #014a6b;
  --blue-100: #dcecf5;
  --blue-50: #eef6fa;
  --ink: #0d1418;
  --ink-soft: #3c4d57;
  --ink-faint: #6c7f8a;
  --line: #cfe0ea;
  --line-soft: #e2edf3;
  --bg: #f7fafc;
  --white: #ffffff;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(1, 74, 107, .07), 0 4px 16px rgba(1, 74, 107, .07);
  --font: 'Inter', 'Helvetica Neue', Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -0.01em; }
h1 { font-size: 22px; }
h2 { font-size: 17px; }
h3 { font-size: 14px; }
p { margin: 0 0 8px; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font-family: ui-monospace, Menlo, monospace; font-size: 12px; }

/* keyboard users always get a visible focus ring; mouse users never do */
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: .18em;
  font-size: 10.5px;
  font-weight: 650;
  color: var(--blue);
}
.muted { color: var(--ink-faint); }
.small { font-size: 12.5px; }
.strong { font-weight: 650; }
.mono { font-variant-numeric: tabular-nums; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }

/* ---------- App shell ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 228px; flex: 0 0 228px;
  background: var(--white);
  border-right: 1px solid var(--line-soft);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}
.shell.admin .sidebar { background: var(--blue-deep); border-right: none; }
.sidebar .logo-block { padding: 22px 18px 14px; }
.sidebar .logo-block img { width: 150px; display: block; }
.sidebar .portal-tag {
  margin: 6px 18px 14px;
  font-size: 10px; letter-spacing: .22em; text-transform: uppercase; font-weight: 650;
  color: var(--ink-faint);
}
.shell.admin .portal-tag { color: rgba(255,255,255,.65); }

.nav { flex: 1; padding: 4px 10px; overflow-y: auto; }
.nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; margin: 2px 0;
  border-radius: 8px;
  color: var(--ink-soft); font-weight: 530; text-decoration: none;
}
.nav a .badge { margin-left: auto; }
.nav a:hover { background: var(--blue-50); color: var(--blue-dark); text-decoration: none; }
.nav a.active { background: var(--blue); color: #fff; }
.shell.admin .nav a { color: rgba(255,255,255,.82); }
.shell.admin .nav a:hover { background: rgba(255,255,255,.09); color: #fff; }
.shell.admin .nav a.active { background: var(--white); color: var(--blue-deep); }
.shell.admin .nav a:focus-visible { outline-color: #fff; }
.nav .nav-section {
  margin: 14px 12px 4px; font-size: 10px; letter-spacing: .18em;
  text-transform: uppercase; color: var(--ink-faint); font-weight: 650;
}
.shell.admin .nav .nav-section { color: rgba(255,255,255,.45); }

.userbox { padding: 14px 18px; border-top: 1px solid var(--line-soft); font-size: 12.5px; }
.shell.admin .userbox { border-top: 1px solid rgba(255,255,255,.14); color: #fff; }
.userbox .name { font-weight: 650; }
.userbox .role { color: var(--ink-faint); }
.shell.admin .userbox .role { color: rgba(255,255,255,.6); }
.userbox button { margin-top: 8px; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.content { padding: 26px 32px 60px; max-width: 1180px; width: 100%; margin: 0 auto; flex: 1; }

.page-head { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head .grow { flex: 1; min-width: 240px; }
.page-head h1 { margin-top: 2px; }
.page-head .actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.footer {
  padding: 18px 32px 26px; color: var(--ink-faint); font-size: 11.5px;
  border-top: 1px solid var(--line-soft); background: var(--white);
}

/* ---------- Cards / panels ---------- */
.card {
  background: var(--white);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 20px;
  margin-bottom: 16px;
}
.card.flat { box-shadow: none; }
.card .card-title { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.card .card-title h2 { flex: 1; }

.grid { display: grid; gap: 14px; }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1000px) { .grid.cols-3, .grid.cols-4 { grid-template-columns: repeat(2, 1fr); } }

.stat {
  background: var(--white); border: 1px solid var(--line-soft); border-radius: var(--radius);
  padding: 14px 16px; box-shadow: var(--shadow);
}
.stat .num { font-size: 26px; font-weight: 700; letter-spacing: -.02em; margin-top: 2px; }
.stat.accent { background: var(--blue); border-color: var(--blue); color: #fff; }
.stat.accent .eyebrow { color: rgba(255,255,255,.75); }
.stat.credit { background: var(--blue-50); border-color: var(--blue-100); }
a.stat { display: block; color: inherit; text-decoration: none; transition: border-color .12s, transform .12s; }
a.stat:hover { text-decoration: none; border-color: var(--blue); }
a.stat.accent:hover { background: var(--blue-dark); }

.banner {
  border: 1px solid var(--blue); background: var(--blue-50);
  border-radius: var(--radius); padding: 12px 16px; margin-bottom: 16px;
  display: flex; gap: 10px; align-items: flex-start;
}
.banner.dark { background: var(--ink); border-color: var(--ink); color: #fff; }
.banner .grow { flex: 1; }

/* ---------- Buttons ---------- */
.btn {
  font: inherit; font-weight: 600; font-size: 13.5px;
  border-radius: 8px; padding: 8px 14px; cursor: pointer;
  border: 1px solid var(--blue); background: var(--blue); color: #fff;
  transition: background .12s, border-color .12s;
  display: inline-flex; align-items: center; gap: 7px; text-decoration: none;
}
.btn:hover { background: var(--blue-dark); border-color: var(--blue-dark); text-decoration: none; }
.btn.secondary { background: var(--white); color: var(--blue-dark); border-color: var(--line); }
.btn.secondary:hover { background: var(--blue-50); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--blue-dark); }
.btn.ghost:hover { background: var(--blue-50); }
.btn.dark { background: var(--ink); border-color: var(--ink); }
.btn.dark:hover { background: #000; }
.btn.small { padding: 5px 10px; font-size: 12.5px; border-radius: 7px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

/* ---------- Forms ---------- */
.field { display: block; margin-bottom: 14px; }
.field > .lbl, .lbl {
  display: block; font-weight: 600; font-size: 13px; margin-bottom: 5px; color: var(--ink);
}
.lbl .req { color: var(--blue); margin-left: 2px; }
.help { font-size: 12px; color: var(--ink-faint); margin-top: 4px; }
.fielderr { font-size: 12.5px; color: #000; background: var(--blue-100); border-left: 3px solid var(--blue); padding: 4px 8px; margin-top: 5px; border-radius: 0 6px 6px 0; font-weight: 550; }

input[type=text], input[type=email], input[type=password], input[type=number],
input[type=date], select, textarea {
  font: inherit; width: 100%;
  border: 1px solid var(--line); border-radius: 8px;
  padding: 8px 10px; background: var(--white); color: var(--ink);
}
textarea { min-height: 84px; resize: vertical; }
input:focus, select:focus, textarea:focus, .seg button:focus {
  outline: 2px solid var(--blue); outline-offset: 1px; border-color: var(--blue);
}
input.invalid, select.invalid, textarea.invalid,
.field.has-error input, .field.has-error select, .field.has-error textarea, .field.has-error .seg {
  border-color: var(--blue-dark); background: var(--blue-50);
}
.field.has-error .seg button { background: transparent; }
.field.has-error .seg button.on { background: var(--blue); }

.input-prefix { position: relative; }
.input-prefix .prefix {
  position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
  color: var(--ink-faint); font-weight: 600;
}
.input-prefix input { padding-left: 26px; }
.input-suffix { position: relative; }
.input-suffix .suffix {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  color: var(--ink-faint);
}

/* yes/no segmented control */
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: #fff; }
.seg button {
  font: inherit; font-weight: 600; font-size: 13px; padding: 7px 16px;
  background: #fff; color: var(--ink-soft); border: none; cursor: pointer;
}
.seg button + button { border-left: 1px solid var(--line); }
.seg button.on { background: var(--blue); color: #fff; }
.seg button:focus-visible { outline-offset: -2px; }

.checks { display: flex; flex-direction: column; gap: 6px; }
.checks label { display: flex; gap: 8px; align-items: flex-start; font-size: 13.5px; cursor: pointer; }
.checks input { width: auto; margin-top: 2px; }

/* searchable select */
.ssel { position: relative; }
.ssel .ssel-panel {
  position: absolute; z-index: 60; left: 0; right: 0; top: calc(100% + 4px);
  background: #fff; border: 1px solid var(--line); border-radius: 8px;
  box-shadow: var(--shadow); max-height: 260px; overflow-y: auto;
}
.ssel .opt { padding: 7px 11px; cursor: pointer; font-size: 13.5px; }
.ssel .opt:hover, .ssel .opt.hl { background: var(--blue-50); }
.ssel .opt.none { color: var(--ink-faint); cursor: default; }
.ssel .opt.none:hover { background: none; }

/* password reveal on the sign-in form */
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 60px; }
.pw-toggle {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  font: inherit; font-size: 12px; font-weight: 600; color: var(--blue-dark);
  background: var(--blue-50); border: 0; border-radius: 6px; padding: 4px 8px; cursor: pointer;
}
.pw-toggle:hover { background: var(--blue-100); }

/* ---------- Tables ---------- */
.tbl-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th {
  text-align: left; font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase;
  color: var(--ink-faint); font-weight: 650; padding: 8px 10px; border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.tbl td { padding: 10px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.tbl td:first-child, .tbl .btn { white-space: nowrap; }
.row-actions { display: inline-flex; gap: 6px; align-items: center; }
.tbl tr:last-child td { border-bottom: none; }
.tbl tbody tr.click { cursor: pointer; }
.tbl tbody tr.click:hover { background: var(--blue-50); }
.tbl .right { text-align: right; }

/* ---------- Badges & status ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; font-weight: 650; letter-spacing: .04em;
  padding: 3px 9px; border-radius: 99px; white-space: nowrap;
  border: 1px solid transparent;
}
.badge.b-draft { background: var(--line-soft); color: var(--ink-soft); }
.badge.b-submitted { background: var(--blue-100); color: var(--blue-deep); }
.badge.b-under_review { background: var(--blue); color: #fff; }
.badge.b-quoted { background: #fff; color: var(--blue-dark); border-color: var(--blue); }
.badge.b-accepted { background: var(--blue-deep); color: #fff; }
.badge.b-bound, .badge.b-on_cover, .badge.b-paid, .badge.b-processed, .badge.b-settled, .badge.b-active { background: var(--ink); color: #fff; }
.badge.b-declined, .badge.b-cancelled, .badge.b-suspended { background: #fff; color: var(--ink); border-color: var(--ink); }
.badge.b-lost, .badge.b-expired { background: #fff; color: var(--ink-faint); border-color: var(--line); }
.badge.b-unpaid, .badge.b-requested, .badge.b-generated { background: #fff; color: var(--blue-dark); border-color: var(--blue); }
.badge.b-overdue { background: var(--ink); color: #fff; border: 1px dashed #fff; outline: 1px solid var(--ink); }
.badge.b-credit { background: var(--blue-50); color: var(--blue-deep); border-color: var(--blue-100); }

/* status timeline */
.timeline { display: flex; align-items: center; gap: 0; margin: 6px 0 2px; flex-wrap: wrap; }
.timeline .step { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--ink-faint); font-weight: 550; }
.timeline .dot { width: 11px; height: 11px; border-radius: 50%; border: 2px solid var(--line); background: #fff; }
.timeline .step.done { color: var(--blue-deep); }
.timeline .step.done .dot { background: var(--blue); border-color: var(--blue); }
.timeline .step.now { color: var(--ink); font-weight: 700; }
.timeline .step.now .dot { background: #fff; border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-100); }
.timeline .bar { width: 34px; height: 2px; background: var(--line); margin: 0 8px; }
.timeline .bar.done { background: var(--blue); }

/* ---------- Chat ---------- */
.chat { display: flex; flex-direction: column; height: 420px; }
.chat .chat-scroll { flex: 1; overflow-y: auto; padding: 6px 4px; display: flex; flex-direction: column; gap: 10px; }
.chat .chat-empty { margin: auto; text-align: center; color: var(--ink-faint); font-size: 12.5px; max-width: 260px; }
.msg { max-width: 78%; }
.msg .bubble {
  padding: 9px 12px; border-radius: 12px; font-size: 13.5px;
  background: var(--white); border: 1px solid var(--line);
  white-space: pre-wrap; word-wrap: break-word;
}
.msg.mine { align-self: flex-end; }
.msg.mine .bubble { background: var(--blue); color: #fff; border-color: var(--blue); border-bottom-right-radius: 4px; }
.msg.theirs .bubble { border-bottom-left-radius: 4px; }
.msg .meta { font-size: 11px; color: var(--ink-faint); margin: 3px 6px 0; }
.msg.mine .meta { text-align: right; }
.msg.system { align-self: center; max-width: 92%; text-align: center; }
.msg.system .bubble {
  background: var(--blue-50); border: 1px dashed var(--line); color: var(--ink-soft);
  font-size: 12px; border-radius: 9px;
}
.chat .chat-input { display: flex; gap: 8px; margin-top: 10px; }
.chat .chat-input textarea { min-height: 44px; height: 44px; flex: 1; }
.chat .chat-hint { font-size: 11px; color: var(--ink-faint); margin-top: 5px; }

/* ---------- Journey form ---------- */
.journey { display: flex; gap: 26px; align-items: flex-start; }
.journey .jnav {
  position: sticky; top: 20px; width: 210px; flex: 0 0 210px;
  background: var(--white); border: 1px solid var(--line-soft); border-radius: var(--radius);
  padding: 10px; box-shadow: var(--shadow);
}
.journey .jnav .jnav-link {
  display: flex; align-items: center; gap: 8px; width: 100%; text-align: left;
  font: inherit; font-size: 13px; font-weight: 550; line-height: 1.35;
  padding: 7px 10px; border-radius: 7px; border: 0; background: transparent; cursor: pointer;
  color: var(--ink-soft);
}
.journey .jnav .jnav-link .ttl { flex: 1; }
.journey .jnav .jnav-link:hover { background: var(--blue-50); }
.journey .jnav .jnav-link.active { background: var(--blue); color: #fff; }
.journey .jnav .cnt {
  font-size: 10.5px; font-weight: 700; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 99px; display: inline-flex; align-items: center; justify-content: center;
  background: var(--blue-100); color: var(--blue-deep); flex: none;
}
.journey .jnav .cnt.done { background: transparent; color: var(--blue); }
.journey .jnav .cnt.err { background: var(--ink); color: #fff; }
.journey .jnav .jnav-link.active .cnt { background: rgba(255,255,255,.28); color: #fff; }
.journey .jnav .jnav-link.active .cnt.err { background: var(--ink); }
.journey .jbody { flex: 1; min-width: 0; }
.jsection { margin-bottom: 18px; scroll-margin-top: 16px; }
.jsection .intro { color: var(--ink-soft); font-size: 13px; margin: 4px 0 12px; }
.jfields { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 4px 22px; }
.jfields .wide { grid-column: 1 / -1; }
@media (max-width: 900px) { .jfields { grid-template-columns: 1fr; } .journey .jnav { display:none; } }
.jinfo {
  grid-column: 1 / -1; font-weight: 650; color: var(--blue-deep);
  border-top: 1px solid var(--line-soft); padding-top: 12px; margin-top: 6px;
}
.repeat-item { border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 16px 6px; margin-bottom: 12px; background: var(--blue-50); }
.repeat-item .repeat-head { display: flex; align-items: center; margin-bottom: 10px; }
.repeat-item .repeat-head .ttl { font-weight: 700; color: var(--blue-deep); flex: 1; }
.review-grid { display: grid; grid-template-columns: minmax(180px, 38%) 1fr; gap: 0; font-size: 13.5px; }
.review-grid > div { padding: 7px 10px; border-bottom: 1px solid var(--line-soft); }
.review-grid > .q { color: var(--ink-soft); }
.review-grid > .a { font-weight: 550; }

/* action bar that stays in view while a long form is being completed */
.sticky-actions {
  position: sticky; bottom: 0; z-index: 30;
  margin: 8px -32px -60px; padding: 12px 32px;
  background: rgba(255,255,255,.94); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  border-top: 1px solid var(--line-soft);
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
}
.sticky-actions .grow { flex: 1; min-width: 220px; }
.sticky-actions .progress { width: 180px; flex: none; }

/* ---------- Modal / toast ---------- */
.modal-back {
  position: fixed; inset: 0; background: rgba(7, 26, 36, .45);
  display: flex; align-items: flex-start; justify-content: center; z-index: 100;
  padding: 7vh 16px 16px;
}
.modal {
  background: #fff; border-radius: 12px; box-shadow: 0 12px 50px rgba(0,0,0,.25);
  width: 100%; max-width: 560px; max-height: 84vh; overflow-y: auto; padding: 20px 22px;
}
.modal h2 { margin-bottom: 12px; }
.modal .modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }

.toasts { position: fixed; bottom: 18px; right: 18px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 9px;
  font-size: 13.5px; font-weight: 550; box-shadow: var(--shadow);
  max-width: 380px; animation: toast-in .18s ease-out;
}
.toast.blue { background: var(--blue); }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- Login ---------- */
.login-wrap {
  min-height: 100vh; display: flex; flex-direction: column;
  align-items: center; justify-content: center; background: var(--bg); padding: 20px;
}
.login-card {
  width: 100%; max-width: 400px; background: #fff; border: 1px solid var(--line-soft);
  border-radius: 14px; box-shadow: var(--shadow); padding: 34px 32px 28px; text-align: center;
}
.login-card img.lockup { width: 210px; margin: 4px auto 2px; display: block; }
.login-card .strap { font-size: 10px; letter-spacing: .28em; font-weight: 650; color: var(--ink-soft); text-transform: uppercase; margin-bottom: 22px; }
.login-card form { text-align: left; }
.login-card .portal-name { font-size: 15px; font-weight: 700; color: var(--blue-deep); margin-bottom: 16px; }
.login-card .alt { margin-top: 16px; font-size: 12.5px; color: var(--ink-faint); }
.login-foot { margin-top: 18px; max-width: 420px; text-align: center; color: var(--ink-faint); font-size: 11px; }

/* docs */
.dropzone {
  border: 2px dashed var(--line); border-radius: var(--radius); padding: 18px;
  text-align: center; color: var(--ink-faint); cursor: pointer; background: var(--blue-50);
}
.dropzone.drag { border-color: var(--blue); color: var(--blue-dark); }
.doc-row { display: flex; align-items: center; gap: 10px; padding: 8px 4px; border-bottom: 1px solid var(--line-soft); font-size: 13.5px; }
.doc-row:last-child { border-bottom: none; }
.doc-row .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.progress { height: 6px; background: var(--line-soft); border-radius: 4px; overflow: hidden; }
.progress > div { height: 100%; background: var(--blue); transition: width .2s; }

.empty {
  text-align: center; color: var(--ink-faint); padding: 30px 16px; font-size: 13.5px;
}
.empty .eyebrow { display: block; margin-bottom: 6px; }
.error-state { color: var(--ink-soft); }
.error-state .error-actions { margin-top: 12px; display: flex; gap: 8px; justify-content: center; }

.filter-bar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.filter-bar input[type=text] { width: 230px; }
.filter-bar select { width: auto; }
.filter-bar .seg button { padding: 6px 12px; font-size: 12.5px; }

.kv { display: grid; grid-template-columns: max-content 1fr; gap: 4px 18px; font-size: 13.5px; }
.kv dt { color: var(--ink-faint); }
.kv dd { margin: 0; font-weight: 550; }

.subjectivity { display: flex; gap: 8px; align-items: center; margin-bottom: 6px; }
.subjectivity input { flex: 1; }

.spin {
  width: 22px; height: 22px; border-radius: 50%; margin: 30px auto;
  border: 3px solid var(--line-soft); border-top-color: var(--blue);
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.two-col { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 18px; align-items: flex-start; }
@media (max-width: 1100px) { .two-col { grid-template-columns: 1fr; } }

.terms-table { width: 100%; font-size: 13.5px; border-collapse: collapse; }
.terms-table td { padding: 5px 0; }
.terms-table td.right { font-variant-numeric: tabular-nums; }
.terms-table tr.total td { border-top: 2px solid var(--ink); font-weight: 700; padding-top: 8px; font-size: 15px; }

.ptb {
  border: 1px solid var(--blue); border-radius: var(--radius);
  background: var(--blue-50); padding: 10px 14px; display: flex; align-items: center; gap: 12px;
}
.ptb .big { font-size: 20px; font-weight: 750; color: var(--blue-deep); }

/* ---------- Billing record (mirrors the live Invoice_Screen) ---------- */
.modal.wide { max-width: 780px; }
.billing .brow { display: flex; align-items: center; gap: 10px; margin: 5px 0; flex-wrap: wrap; }
.billing .brow.top { margin-bottom: 12px; }
.billing .blbl { font-weight: 700; font-size: 13px; min-width: 148px; text-align: right; white-space: nowrap; }
.billing .brow.top .blbl { min-width: 0; }
.billing .blbl.breason { min-width: 0; margin-left: auto; }
.billing .bname { white-space: nowrap; }
.billing .bval {
  display: inline-block; box-sizing: border-box; border: 1px solid #9ec9dc; background: #f3fbfe;
  padding: 4px 8px; min-height: 28px; font-size: 13px; color: var(--ink-soft); font-variant-numeric: tabular-nums;
}
.billing .bval.right { text-align: right; }
.billing .bpanel { border: 1px solid var(--line); border-radius: 6px; padding: 14px 16px 12px; background: #fff; }
.billing .bgap { height: 14px; }
.billing .bnotes-lbl { text-align: left; margin: 12px 0 4px; }
.billing .bnote { border: 1px solid #9ec9dc; background: #f3fbfe; padding: 5px 8px; margin: 4px 0; min-height: 30px; font-size: 13px; }
.billing .bnav { display: inline-flex; align-items: center; gap: 4px; }
.billing .bactions { display: flex; gap: 8px; margin-top: 12px; }

/* bind panel: the money block as it will invoice */
.billing-summary { background: var(--blue-50); margin: 4px 0 14px; }
.billing-summary .bgrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 14px; margin-top: 8px; }
.billing-summary .bcell .strong { font-size: 14px; }

/* ---------- Accounting ---------- */
.badge.b-part_paid { background: var(--blue-100); color: var(--blue-deep); border-color: var(--blue); }
.badge.b-sent { background: #fff; color: var(--ink-soft); border-color: var(--line); }
.badge.b-closed { background: var(--ink); color: #fff; }
.badge.b-open { background: #fff; color: var(--blue-dark); border-color: var(--blue); }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line-soft); margin-bottom: 14px; }
.tabs button { font: inherit; font-weight: 600; font-size: 13.5px; padding: 8px 14px; border: 0; background: none; border-bottom: 2px solid transparent; margin-bottom: -1px; color: var(--ink-soft); cursor: pointer; }
.tabs button:hover { color: var(--blue-dark); }
.tabs button.on { color: var(--blue-dark); border-bottom-color: var(--blue); }
.tbl td.age0 { color: var(--ink-faint); }
.tbl td.age3 { font-weight: 700; }
.alloc input[type=text] { width: 120px; text-align: right; font-variant-numeric: tabular-nums; }
.alloc .tbl td { padding: 6px 8px; }
.kpi-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
@media (max-width: 1000px) { .kpi-row { grid-template-columns: repeat(2, 1fr); } }
.kpi .num { font-size: 24px; }
.kpi .sub { font-size: 12px; color: var(--ink-faint); margin-top: 2px; }
.split-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 1000px) { .split-row { grid-template-columns: 1fr; } }

/* ---- MI charts ---- */
.chart { margin: 4px 0 0; }
.chart-tip { position: absolute; pointer-events: none; background: var(--blue-deep, #0a2a3a); color: #fff; font-size: 12px; padding: 6px 9px; border-radius: 6px; box-shadow: 0 4px 14px rgba(0,0,0,.18); white-space: nowrap; z-index: 5; }
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12px; color: var(--ink-soft); margin-top: 6px; }
.legend-item { display: inline-flex; align-items: center; gap: 6px; }
.legend .swatch { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }
.tbl td.neg { color: #BA1318; }
.tbl td.pos-paid { background: #eaf6e4; }

.kpi-row.six { grid-template-columns: repeat(6, minmax(0, 1fr)); }
@media (max-width: 1100px) { .kpi-row.six { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.kpi-row.five { grid-template-columns: repeat(5, minmax(0, 1fr)); }
@media (max-width: 1100px) { .kpi-row.five { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

/* ---- insurer reconciliation ---- */
.badge.b-ready { background: var(--blue); color: #fff; }
.badge.b-awaiting_broker { background: #fff; color: var(--blue-dark); border-color: var(--blue); }
.badge.b-mismatch { background: var(--ink); color: #fff; border: 1px dashed #fff; outline: 1px solid var(--ink); }
.badge.b-unmatched { background: #fff; color: var(--ink); border-color: var(--ink); }
.badge.b-ignored { background: #fff; color: var(--ink-faint); border-color: var(--line); }
.badge.b-imported { background: var(--blue-50); color: var(--blue-deep); border-color: var(--blue-100); }
.badge.b-part_settled { background: var(--blue-100); color: var(--blue-deep); border-color: var(--blue); }
.map-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 14px; }
@media (max-width: 800px) { .map-grid { grid-template-columns: 1fr; } }
.map-grid label { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 13px; }
.map-grid select { max-width: 60%; }
.preview-grid { font-size: 11px; }
.preview-grid td, .preview-grid th { padding: 2px 6px; white-space: nowrap; max-width: 160px; overflow: hidden; text-overflow: ellipsis; }
