/* Payment Disbursement Center: one shared stylesheet. No inline styles, no page-local <style> blocks. */

/* ---------- Tokens ---------- */
:root {
  --ink: #1a1a2e; --ink-light: #2d2d44; --ink-muted: #5f5f7c;
  --surface: #f5f7fa; --surface-alt: #e8ecf1; --panel: #ffffff;
  --border: rgba(26, 26, 46, .10); --border-strong: rgba(26, 26, 46, .18);
  --sidebar-bg: #1a1a2e; --sidebar-text: #c5c5d8; --sidebar-item: #a0a0be; --sidebar-hover: #e0e0f0;
  --sidebar-label: rgba(255, 255, 255, .38);

  --accent: #6d5bd0; --accent-hover: #5a48bd; --accent-soft: rgba(109, 91, 208, .10); --accent-ink: #4b3fa0;
  --on-accent: #ffffff; --link: #4b3fa0;

  --green: #2d9d78;  --green-ink: #1a6b52;  --green-soft: rgba(45, 157, 120, .12);
  --yellow: #e0a526; --yellow-ink: #7d5f0c; --yellow-soft: rgba(224, 165, 38, .16);
  --orange: #e07a2f; --orange-ink: #9a4a12; --orange-soft: rgba(224, 122, 47, .14);
  --red: #d94052;    --red-ink: #a0293a;    --red-soft: rgba(217, 64, 82, .11);
  --blue: #4a7fd4;   --blue-ink: #2d5a9e;   --blue-soft: rgba(74, 127, 212, .13);
  --teal: #0f9488;   --teal-ink: #0f766e;   --teal-soft: rgba(15, 118, 110, .12);
  --grey-ink: #54546c; --grey-soft: rgba(26, 26, 46, .07);

  --font-body: "Segoe UI", system-ui, -apple-system, Roboto, Arial, Helvetica, sans-serif;
  --font-mono: ui-monospace, "SFMono-Regular", Consolas, "Liberation Mono", monospace;

  --radius: 10px; --radius-sm: 6px; --radius-pill: 999px;
  --shadow-sm: 0 1px 3px rgba(26, 26, 46, .06);
  --shadow-md: 0 4px 16px rgba(26, 26, 46, .08);
  --shadow-lg: 0 12px 40px rgba(26, 26, 46, .16);
  --focus-ring: 0 0 0 3px rgba(109, 91, 208, .40);
  --sidebar-w: 248px; --sidebar-rail: 64px;
  color-scheme: light;
}

[data-theme="dark"] {
  color-scheme: dark;
  --ink: #e4e4ec; --ink-light: #c8c8d4; --ink-muted: #9a9ab0;
  --surface: #121218; --surface-alt: #1e1e2a; --panel: #1a1a26;
  --border: rgba(255, 255, 255, .08); --border-strong: rgba(255, 255, 255, .16);
  --sidebar-bg: #0d0d14;
  --accent: #9d8ff0; --accent-hover: #b0a4f5; --accent-soft: rgba(157, 143, 240, .16); --accent-ink: #c4baf8;
  --on-accent: #121218; --link: #b0a4f5;
  --green-ink: #6fd3ae; --green-soft: rgba(45, 157, 120, .20);
  --yellow-ink: #f0c860; --yellow-soft: rgba(224, 165, 38, .18);
  --orange-ink: #f5a36a; --orange-soft: rgba(224, 122, 47, .18);
  --red-ink: #f08594; --red-soft: rgba(217, 64, 82, .18);
  --blue-ink: #8fb4f0; --blue-soft: rgba(74, 127, 212, .20);
  --teal-ink: #5fd0c4; --teal-soft: rgba(15, 148, 136, .20);
  --grey-ink: #b4b4c6; --grey-soft: rgba(255, 255, 255, .07);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, .3); --shadow-md: 0 4px 16px rgba(0, 0, 0, .4); --shadow-lg: 0 12px 40px rgba(0, 0, 0, .55);
  --focus-ring: 0 0 0 3px rgba(157, 143, 240, .45);
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { font-size: 15px; }
body {
  margin: 0; font-family: var(--font-body); line-height: 1.55; color: var(--ink);
  background: var(--surface); -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { margin: 0; line-height: 1.25; color: var(--ink); }
h1 { font-size: 1.6rem; font-weight: 700; letter-spacing: -.02em; }
h2 { font-size: 1.1rem; font-weight: 650; }
h3 { font-size: .95rem; font-weight: 650; }
p { margin: 0 0 .75rem; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
code, .mono { font-family: var(--font-mono); font-size: .92em; }
.muted { color: var(--ink-muted); }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.nowrap { white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); border: 0; }
:focus-visible { outline: none; box-shadow: var(--focus-ring); border-radius: var(--radius-sm); }
.skip-link { position: absolute; left: 12px; top: -48px; z-index: 200; padding: 8px 14px; border-radius: 8px; background: var(--accent); color: var(--on-accent); font-weight: 600; }
.skip-link:focus { top: 12px; text-decoration: none; }
.icon { width: 20px; height: 20px; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.icon-sm { width: 16px; height: 16px; }

/* ---------- App shell ---------- */
.shell { min-height: 100vh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); z-index: 40;
  display: flex; flex-direction: column; background: var(--sidebar-bg); color: var(--sidebar-text);
  transition: width .18s ease, transform .2s ease;
}
.main { margin-left: var(--sidebar-w); min-height: 100vh; display: flex; flex-direction: column; transition: margin-left .18s ease; }
.content { flex: 1; width: 100%; max-width: 1440px; padding: 28px 32px 48px; }

.brand { display: flex; align-items: center; gap: 12px; padding: 20px 18px 18px; color: #fff; text-decoration: none; }
.brand:hover { text-decoration: none; }
.brand-mark { width: 36px; height: 36px; flex: none; }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; white-space: nowrap; overflow: hidden; }
.brand-name { font-size: 1.05rem; font-weight: 700; letter-spacing: -.01em; }
.brand-sub { font-size: .62rem; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; color: var(--sidebar-label); margin-top: 3px; }

.nav { flex: 1; overflow-y: auto; padding: 4px 10px 12px; }
.nav-section { font-size: .65rem; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: var(--sidebar-label); padding: 18px 10px 6px; white-space: nowrap; }
.nav-item {
  display: flex; align-items: center; gap: 12px; padding: 9px 10px; margin: 1px 0; border-radius: 8px;
  color: var(--sidebar-item); font-size: .9rem; font-weight: 500; text-decoration: none; white-space: nowrap;
  position: relative;
}
.nav-item:hover { background: rgba(255, 255, 255, .06); color: var(--sidebar-hover); text-decoration: none; }
.nav-item.active { background: rgba(157, 143, 240, .16); color: #d6cffb; }
.nav-item.active::before { content: ""; position: absolute; left: -10px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: #9d8ff0; }
.nav-count { margin-left: auto; min-width: 22px; padding: 1px 7px; border-radius: var(--radius-pill); background: #9d8ff0; color: #121218; font-size: .72rem; font-weight: 700; text-align: center; }
.nav-label { overflow: hidden; text-overflow: ellipsis; }

.sidebar-foot { border-top: 1px solid rgba(255, 255, 255, .07); padding: 10px; }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 6px 4px 8px 10px; }
.icon-btn {
  margin-left: auto; width: 36px; height: 36px; flex: none; display: grid; place-items: center; border: 0; border-radius: 8px;
  background: transparent; color: var(--sidebar-item); cursor: pointer; text-decoration: none;
}
.icon-btn:hover { background: rgba(255, 255, 255, .08); color: var(--sidebar-hover); text-decoration: none; }
.avatar { width: 32px; height: 32px; flex: none; border-radius: 50%; display: grid; place-items: center; background: rgba(157, 143, 240, .22); color: #d6cffb; font-size: .78rem; font-weight: 700; }
.user-meta { flex: 1; min-width: 0; line-height: 1.25; }
.user-name, .user-role { display: block; }
.user-name { color: #e8e8f2; font-size: .85rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { color: var(--sidebar-label); font-size: .72rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.foot-actions { display: flex; gap: 4px; padding: 2px 4px 0; }
.foot-btn {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 8px; padding: 8px; border: 0; border-radius: 8px;
  background: transparent; color: var(--sidebar-item); font: inherit; font-size: .8rem; cursor: pointer; text-decoration: none;
}
.foot-btn:hover { background: rgba(255, 255, 255, .06); color: var(--sidebar-hover); text-decoration: none; }
.theme-light-only { display: none !important; }
[data-theme="dark"] .theme-light-only { display: inline !important; }
[data-theme="dark"] .theme-dark-only { display: none !important; }

/* Collapsed icon rail (desktop). */
[data-sidebar="rail"] .sidebar { width: var(--sidebar-rail); }
[data-sidebar="rail"] .main { margin-left: var(--sidebar-rail); }
[data-sidebar="rail"] .brand-text, [data-sidebar="rail"] .nav-label, [data-sidebar="rail"] .nav-section,
[data-sidebar="rail"] .user-meta, [data-sidebar="rail"] .foot-label, [data-sidebar="rail"] .nav-count { display: none; }
[data-sidebar="rail"] .brand { padding: 20px 14px 18px; }
[data-sidebar="rail"] .nav-item { justify-content: center; }
[data-sidebar="rail"] .nav-sep { display: block; height: 1px; margin: 10px 8px; background: rgba(255, 255, 255, .07); }
[data-sidebar="rail"] .foot-actions { flex-direction: column; }
[data-sidebar="rail"] .user-chip { flex-direction: column; padding: 8px 0; gap: 6px; }
[data-sidebar="rail"] .icon-btn { margin-left: 0; }
[data-sidebar="rail"] .rail-flip { transform: rotate(180deg); }
.nav-sep { display: none; }

/* Mobile top bar + off-canvas drawer. */
.topbar { display: none; }
.scrim { display: none; }
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); width: var(--sidebar-w) !important; box-shadow: var(--shadow-lg); }
  .main, [data-sidebar="rail"] .main { margin-left: 0; }
  .drawer-open .sidebar { transform: none; }
  .drawer-open .scrim { display: block; position: fixed; inset: 0; z-index: 30; background: rgba(10, 10, 20, .45); }
  [data-sidebar="rail"] .brand-text, [data-sidebar="rail"] .nav-label, [data-sidebar="rail"] .nav-section,
  [data-sidebar="rail"] .user-meta, [data-sidebar="rail"] .foot-label { display: revert; }
  .rail-toggle { display: none !important; }
  .topbar {
    display: flex; align-items: center; gap: 10px; position: sticky; top: 0; z-index: 20;
    padding: 8px 12px; background: var(--sidebar-bg); color: #fff;
  }
  .topbar .brand { padding: 4px; }
  .menu-btn { width: 44px; height: 44px; display: grid; place-items: center; border: 0; border-radius: 8px; background: transparent; color: #fff; cursor: pointer; }
  .content { padding: 20px 16px 40px; }
}

/* Dry-run banner: shown whenever PAYMENT_WRITES_ENABLED is off. */
.dryrun-banner {
  display: flex; align-items: center; gap: 10px; padding: 8px 32px; font-size: .82rem;
  background: var(--yellow-soft); color: var(--yellow-ink); border-bottom: 1px solid rgba(224, 165, 38, .35);
}
.dryrun-banner strong { font-weight: 700; }
@media (max-width: 900px) { .dryrun-banner { padding: 8px 16px; } }

/* ---------- Page header ---------- */
.page-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-header p { margin: 4px 0 0; color: var(--ink-muted); font-size: .9rem; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.eyebrow { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--accent-ink); margin-bottom: 4px; }
[data-theme="dark"] .eyebrow { color: var(--accent); }

/* ---------- Cards / stats ---------- */
.card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card-pad { padding: 20px 22px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 22px; border-bottom: 1px solid var(--border); }
.card-head p { margin: 2px 0 0; color: var(--ink-muted); font-size: .85rem; }
.card-body { padding: 18px 22px; }
.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }
.stack > * + * { margin-top: 18px; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 22px; }
.stat { padding: 16px 18px; border-left: 4px solid var(--border-strong); }
.stat-label { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-muted); }
.stat-value { font-size: 1.65rem; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; margin-top: 4px; }
.stat-note { font-size: .8rem; color: var(--ink-muted); margin-top: 2px; }
.stat-accent { border-left-color: var(--accent); }
.stat-warn { border-left-color: var(--yellow); }
.stat-danger { border-left-color: var(--red); }
.stat-ok { border-left-color: var(--green); }

/* Action cards: queues that need someone. */
.action-card { display: flex; gap: 14px; align-items: flex-start; padding: 16px 18px; border-left: 4px solid var(--accent); text-decoration: none; color: inherit; }
.action-card:hover { text-decoration: none; box-shadow: var(--shadow-md); }
.action-card .icon { color: var(--accent-ink); margin-top: 2px; }
[data-theme="dark"] .action-card .icon { color: var(--accent); }
.action-card h3 { margin-bottom: 2px; }
.action-card p { margin: 0; color: var(--ink-muted); font-size: .85rem; }
.action-card .count { margin-left: auto; font-size: 1.4rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.action-card.warn { border-left-color: var(--yellow); }
.action-card.danger { border-left-color: var(--red); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th {
  position: sticky; top: 0; z-index: 1; text-align: left; padding: 10px 14px; background: var(--surface);
  font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-muted);
  border-bottom: 1px solid var(--border); white-space: nowrap;
}
.table th.num { text-align: right; }
.table td { padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:hover { background: var(--accent-soft); }
.table tbody tr:last-child td { border-bottom: 0; }
.table tfoot td { font-weight: 700; border-top: 2px solid var(--border-strong); }
.table-dense td { padding: 7px 12px; }
.table .empty { text-align: center; color: var(--ink-muted); padding: 36px 14px; }

/* ---------- Badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: var(--radius-pill);
  font-size: .75rem; font-weight: 650; line-height: 1.6; white-space: nowrap; background: var(--grey-soft); color: var(--grey-ink);
}
.badge-draft { background: var(--grey-soft); color: var(--grey-ink); }
.badge-pending { background: var(--yellow-soft); color: var(--yellow-ink); }
.badge-hold { background: transparent; color: var(--yellow-ink); border: 1px dashed var(--yellow); }
.badge-approved { background: var(--blue-soft); color: var(--blue-ink); }
.badge-processing { background: var(--accent-soft); color: var(--accent-ink); }
.badge-processing::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; animation: pulse 1.4s ease-in-out infinite; }
.badge-sent { background: var(--teal-soft); color: var(--teal-ink); }
.badge-cleared { background: var(--green-soft); color: var(--green-ink); }
.badge-stale { background: var(--orange-soft); color: var(--orange-ink); }
.badge-returned { background: transparent; color: var(--orange-ink); border: 1px solid var(--orange); }
.badge-failed { background: var(--red-soft); color: var(--red-ink); }
.badge-void { background: transparent; color: var(--ink-muted); text-decoration: line-through; }
[data-theme="dark"] .badge-processing { color: var(--accent-ink); }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .3; } }
@media (prefers-reduced-motion: reduce) { .badge-processing::before { animation: none; } * { transition: none !important; } }

.chip { display: inline-block; padding: 1px 8px; border-radius: var(--radius-pill); border: 1px solid var(--border-strong); font-size: .75rem; color: var(--ink-muted); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 38px; padding: 8px 16px;
  border: 1px solid transparent; border-radius: 8px; font: inherit; font-size: .88rem; font-weight: 600; line-height: 1.2;
  cursor: pointer; text-decoration: none; white-space: nowrap; transition: background .12s ease, border-color .12s ease, box-shadow .12s ease;
}
.btn:hover { text-decoration: none; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn-secondary { background: var(--panel); color: var(--ink); border-color: var(--border-strong); }
.btn-secondary:hover:not(:disabled) { background: var(--surface-alt); }
.btn-ghost { background: transparent; color: var(--ink-light); }
.btn-ghost:hover:not(:disabled) { background: var(--surface-alt); }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover:not(:disabled) { background: #c23446; }
.btn-success { background: var(--green); color: #fff; }
.btn-success:hover:not(:disabled) { background: #238466; }
.btn-sm { min-height: 30px; padding: 5px 11px; font-size: .8rem; }
.btn-lg { min-height: 46px; padding: 12px 22px; font-size: .95rem; }
.btn-block { width: 100%; }

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field label, .label { font-size: .8rem; font-weight: 650; color: var(--ink-light); }
.field .hint { font-size: .78rem; color: var(--ink-muted); }
.field .error-text { font-size: .78rem; color: var(--red-ink); }
.input, .select, .textarea {
  width: 100%; min-height: 38px; padding: 8px 12px; border: 1px solid var(--border-strong); border-radius: 8px;
  background: var(--panel); color: var(--ink); font: inherit; font-size: .9rem;
}
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--accent); box-shadow: var(--focus-ring); }
.input.is-invalid { border-color: var(--red); }
.textarea { min-height: 90px; resize: vertical; }
.input-money { text-align: right; font-variant-numeric: tabular-nums; }
.check { display: flex; align-items: center; gap: 10px; padding: 8px 0; font-size: .9rem; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }
fieldset.role-group { border: 1px solid var(--border); border-radius: 8px; padding: 6px 14px 4px; margin: 0 0 12px; }
fieldset.role-group legend { padding: 0 6px; }
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; justify-content: flex-start; margin-bottom: 16px; }
.filters .field { margin: 0; min-width: 160px; }

/* ---------- Flash / alerts ---------- */
.flashes { display: flex; flex-direction: column; gap: 10px; margin-bottom: 20px; }
.alert {
  display: flex; align-items: flex-start; gap: 12px; padding: 12px 16px; border-radius: 8px;
  border-left: 3px solid var(--blue); background: var(--blue-soft); color: var(--ink); font-size: .9rem;
}
.alert .icon { margin-top: 1px; }
.alert-success { border-left-color: var(--green); background: var(--green-soft); }
.alert-success .icon { color: var(--green-ink); }
.alert-warning { border-left-color: var(--yellow); background: var(--yellow-soft); }
.alert-warning .icon { color: var(--yellow-ink); }
.alert-error { border-left-color: var(--red); background: var(--red-soft); }
.alert-error .icon { color: var(--red-ink); }
.alert-info .icon { color: var(--blue-ink); }
.alert-close { margin-left: auto; border: 0; background: transparent; color: var(--ink-muted); cursor: pointer; padding: 0 2px; }

/* ---------- Empty state ---------- */
.empty-state { text-align: center; padding: 48px 20px; color: var(--ink-muted); }
.empty-state .icon { width: 40px; height: 40px; color: var(--border-strong); margin-bottom: 10px; }
.empty-state h3 { color: var(--ink); margin-bottom: 4px; }

/* ---------- Definition list (detail pages) ---------- */
.dl { display: grid; grid-template-columns: minmax(140px, max-content) 1fr; gap: 10px 20px; margin: 0; font-size: .9rem; }
.dl dt { color: var(--ink-muted); font-weight: 600; }
.dl dd { margin: 0; }

/* ---------- Modal / confirm / toast (driven by core.js) ---------- */
.modal-backdrop { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 16px; background: rgba(10, 10, 20, .5); }
.modal { width: 100%; max-width: 520px; max-height: calc(100vh - 32px); overflow: auto; background: var(--panel); color: var(--ink); border-radius: 14px; box-shadow: var(--shadow-lg); }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 22px 0; }
.modal-body { padding: 14px 22px 4px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 22px 20px; }
.confirm-summary { margin: 6px 0 14px; padding: 14px 16px; border-radius: 8px; background: var(--surface); }
.confirm-amount { font-size: 1.8rem; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }

.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 110; display: flex; flex-direction: column; gap: 10px; max-width: min(420px, calc(100vw - 40px)); }
.toast { display: flex; gap: 10px; align-items: flex-start; padding: 12px 16px; border-radius: 10px; background: var(--ink); color: var(--panel); box-shadow: var(--shadow-lg); font-size: .88rem; animation: toast-in .18s ease-out; }
.toast-error { background: var(--red); color: #fff; }
.toast-success { background: var(--green); color: #fff; }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- Sign-in ---------- */
.auth-page { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; background: var(--panel); }
.auth-hero {
  position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: space-between; padding: 44px 52px;
  color: #fff; background: radial-gradient(1200px 600px at -10% 110%, rgba(109, 91, 208, .55), transparent 60%),
                           radial-gradient(800px 500px at 120% -10%, rgba(15, 148, 136, .30), transparent 55%), #16162a;
}
.auth-hero h1 { color: #fff; font-size: 2.6rem; line-height: 1.1; letter-spacing: -.03em; max-width: 12ch; }
.auth-hero h1 span { color: #b3a8f5; }
.auth-hero p { color: rgba(255, 255, 255, .72); max-width: 44ch; font-size: 1rem; margin-top: 16px; }
.auth-points { list-style: none; margin: 28px 0 0; padding: 0; display: grid; gap: 12px; color: rgba(255, 255, 255, .82); font-size: .92rem; }
.auth-points li { display: flex; gap: 10px; align-items: center; }
.auth-points .icon { color: #b3a8f5; }
.auth-foot { color: rgba(255, 255, 255, .45); font-size: .78rem; }
.auth-panel { display: flex; align-items: center; justify-content: center; padding: 40px 24px; background: var(--surface); }
.auth-card { width: 100%; max-width: 400px; }
.auth-card h2 { font-size: 1.5rem; margin-bottom: 6px; }
.auth-card > p { color: var(--ink-muted); margin-bottom: 26px; }
.ms-btn {
  display: flex; align-items: center; justify-content: center; gap: 12px; width: 100%; min-height: 48px; padding: 12px 18px;
  border: 1px solid #8c8c8c; border-radius: 6px; background: #fff; color: #1f1f1f; font: inherit; font-size: .95rem; font-weight: 600; text-decoration: none;
}
.ms-btn:hover { background: #f3f3f3; text-decoration: none; }
.auth-divider { display: flex; align-items: center; gap: 12px; color: var(--ink-muted); font-size: .75rem; text-transform: uppercase; letter-spacing: .08em; margin: 22px 0; }
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; height: 1px; background: var(--border-strong); }
.auth-note { margin-top: 24px; font-size: .8rem; color: var(--ink-muted); }
@media (max-width: 900px) {
  .auth-page { grid-template-columns: 1fr; }
  .auth-hero { padding: 32px 24px; }
  .auth-hero h1 { font-size: 2rem; }
  .auth-points, .auth-foot { display: none; }
}

/* ---------- Error page ---------- */
.error-page { max-width: 560px; margin: 10vh auto 0; text-align: center; }
.error-code { font-size: 4rem; font-weight: 800; letter-spacing: -.04em; color: var(--accent); line-height: 1; }

/* ---------- Footer ---------- */
.app-foot { padding: 14px 32px; color: var(--ink-muted); font-size: .75rem; border-top: 1px solid var(--border); }

@media (max-width: 600px) {
  html { font-size: 14px; }
  .page-header { align-items: flex-start; }
  .card-pad, .card-body { padding: 16px; }
  .card-head { padding: 14px 16px; }
}

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 18px; overflow-x: auto; }
.tab {
  display: inline-flex; align-items: center; gap: 8px; padding: 10px 14px; margin-bottom: -1px; white-space: nowrap;
  border-bottom: 2px solid transparent; color: var(--ink-muted); font-weight: 600; font-size: .9rem; text-decoration: none;
}
.tab:hover { color: var(--ink); text-decoration: none; }
.tab.active { color: var(--accent-ink); border-bottom-color: var(--accent); }
[data-theme="dark"] .tab.active { color: var(--accent); }
.tab .count { padding: 0 8px; border-radius: var(--radius-pill); background: var(--surface-alt); color: var(--ink-light); font-size: .75rem; font-variant-numeric: tabular-nums; }
.tab.active .count { background: var(--accent-soft); color: var(--accent-ink); }
[data-theme="dark"] .tab.active .count { color: var(--accent); }

/* ---------- Chips (reasons / checks) ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-block, .chip-stop, .chip-warn, .chip-info {
  display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: var(--radius-pill);
  font-size: .74rem; font-weight: 600; line-height: 1.6; white-space: nowrap;
}
.chip-block { background: var(--orange-soft); color: var(--orange-ink); }
.chip-stop { background: var(--red-soft); color: var(--red-ink); }
.chip-warn { background: var(--yellow-soft); color: var(--yellow-ink); }
.chip-info { background: var(--blue-soft); color: var(--blue-ink); }
.chip-channel { display: inline-flex; align-items: center; gap: 5px; font-size: .8rem; font-weight: 600; color: var(--ink-light); }
.chip-channel .icon { width: 15px; height: 15px; }
.chip-weak { display: inline-block; padding: 0 7px; border-radius: var(--radius-pill); border: 1px dashed var(--border-strong); font-size: .7rem; color: var(--ink-muted); }
.sev-critical { color: #fff; background: var(--red); border-radius: 4px; padding: 0 6px; font-weight: 700; }
.sev-high { color: var(--red-ink); font-weight: 700; }
.sev-medium { color: var(--yellow-ink); font-weight: 700; }
.sev-low { color: var(--ink-muted); font-weight: 700; }

/* ---------- Freshness / source notes ---------- */
.freshness { display: inline-flex; align-items: center; gap: 6px; font-size: .78rem; color: var(--ink-muted); }
.freshness.stale { color: var(--orange-ink); }
.source-tag { display: inline-block; min-width: 52px; padding: 1px 7px; border-radius: 5px; font-size: .68rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; text-align: center; }
.source-CMS { background: var(--blue-soft); color: var(--blue-ink); }
.source-Queue { background: var(--accent-soft); color: var(--accent-ink); }
.source-Bank { background: var(--teal-soft); color: var(--teal-ink); }
[data-theme="dark"] .source-Queue { color: var(--accent); }

/* ---------- Health strip ---------- */
.health-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; margin-bottom: 22px; }
.health { display: flex; gap: 12px; align-items: flex-start; padding: 12px 16px; border-left: 4px solid var(--green); }
.health.warn { border-left-color: var(--yellow); }
.health.down { border-left-color: var(--red); }
.health-title { font-weight: 700; font-size: .9rem; }
.health-meta { font-size: .8rem; color: var(--ink-muted); line-height: 1.5; }
.dot { width: 9px; height: 9px; border-radius: 50%; flex: none; margin-top: 6px; background: var(--green); }
.health.warn .dot { background: var(--yellow); }
.health.down .dot { background: var(--red); }

/* ---------- Timeline ---------- */
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline::before { content: ""; position: absolute; left: 7px; top: 6px; bottom: 6px; width: 2px; background: var(--border); }
.tl-item { position: relative; padding: 0 0 18px 30px; }
.tl-item::before { content: ""; position: absolute; left: 1px; top: 5px; width: 14px; height: 14px; border-radius: 50%; background: var(--panel); border: 3px solid var(--border-strong); }
.tl-item.k-sent::before, .tl-item.k-cleared::before { border-color: var(--teal); }
.tl-item.k-failed::before { border-color: var(--red); }
.tl-item.k-processing::before { border-color: var(--accent); }
.tl-item.k-hold::before { border-color: var(--yellow); }
.tl-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.tl-title { font-weight: 650; }
.tl-when { font-size: .78rem; color: var(--ink-muted); font-variant-numeric: tabular-nums; }
.tl-detail { font-size: .85rem; color: var(--ink-light); margin-top: 2px; }

/* ---------- Detail header / callout ---------- */
.detail-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.detail-amount { font-size: 2rem; font-weight: 750; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.callout { display: flex; gap: 12px; padding: 16px 18px; border-radius: var(--radius); background: var(--accent-soft); border: 1px solid rgba(109, 91, 208, .25); }
.callout .icon { color: var(--accent-ink); margin-top: 2px; }
[data-theme="dark"] .callout .icon { color: var(--accent); }
.callout-label { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--accent-ink); margin-bottom: 4px; }
[data-theme="dark"] .callout-label { color: var(--accent); }
.callout p { margin: 0; font-size: .98rem; }
.search-bar { display: flex; gap: 10px; max-width: 720px; }
.search-bar .input { min-height: 44px; font-size: 1rem; }
.row-link { color: inherit; }
.row-link:hover { text-decoration: none; }
tr.clickable { cursor: pointer; }
.subtle-list { margin: 0; padding-left: 18px; font-size: .88rem; }
.kv-mini { font-size: .8rem; color: var(--ink-muted); }
.stack-gap { margin-bottom: 18px; }
tr.matched td { background: var(--accent-soft); }
.pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 16px; border-top: 1px solid var(--border); font-size: .85rem; }
.health.off { border-left-color: var(--border-strong); }
.health.off .dot { background: var(--border-strong); }
.health-state { display: inline-block; margin-left: 6px; padding: 0 7px; border-radius: var(--radius-pill); font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; background: var(--green-soft); color: var(--green-ink); vertical-align: 1px; }
.health.warn .health-state { background: var(--yellow-soft); color: var(--yellow-ink); }
.health.down .health-state { background: var(--red-soft); color: var(--red-ink); }
.health.off .health-state { background: var(--grey-soft); color: var(--grey-ink); }
/* Chips wrap instead of running off the page (including in table cells). */
.chips > span { white-space: normal; max-width: 100%; }
.table .chips { min-width: 220px; max-width: 360px; }
.auth-card-wide { max-width: 480px; }
.role-row { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; padding: 4px 0; border-top: 1px solid var(--border); }
.role-row:first-of-type { border-top: 0; }
.role-dept { flex: 1 0 150px; font-size: .85rem; font-weight: 600; color: var(--ink-light); }
.role-row .check { padding: 4px 0; font-size: .85rem; }

/* Stuck Payments: acknowledged findings stay listed but step back */
.table tr.row-muted td { color: var(--ink-muted); }

/* HHG Claim Payments: selecting claims to approve as a dry run */
.cell-check { width: 1%; }
.cell-check input { width: 18px; height: 18px; accent-color: var(--accent); cursor: pointer; }
.select-bar {
  position: sticky; bottom: 12px; z-index: 15; display: flex; flex-wrap: wrap; align-items: center;
  justify-content: space-between; gap: 12px; margin-top: 12px; padding: 12px 16px;
  border: 1px solid var(--border); border-radius: 12px; background: var(--surface);
  box-shadow: 0 6px 24px rgba(0, 0, 0, .14);
}
.select-bar[hidden] { display: none; }
.dryrun-banner { border-left: 4px solid var(--accent); }
/* Live mode (PAYMENT_WRITES_ENABLED on) must never look like the dry run: approving queues real checks. */
.dryrun-banner[data-banner="live"] {
  background: var(--red-soft); color: var(--red-ink); border-bottom-color: rgba(217, 64, 82, .35); border-left-color: var(--red);
}
.dryrun-banner[data-banner="live-paused"] {
  background: var(--accent-soft); color: var(--accent-ink); border-bottom-color: var(--border); border-left-color: var(--accent-ink);
}
[data-theme="dark"] .dryrun-banner[data-banner="live-paused"] { color: var(--accent); }
.calls { margin: 0; padding-left: 18px; }
.calls li { margin-bottom: 8px; }
.calls .params { font-size: .8rem; color: var(--ink-muted); word-break: break-word; }

/* Notifications bell in the sidebar user area */
.icon-btn + .icon-btn { margin-left: 0; }
.bell { position: relative; }
.bell.active { background: rgba(157, 143, 240, .16); color: #d6cffb; }
.bell-count {
  position: absolute; top: 1px; right: 0; min-width: 17px; height: 17px; padding: 0 4px; border-radius: var(--radius-pill);
  background: #9d8ff0; color: #121218; font-size: .64rem; font-weight: 700; line-height: 17px; text-align: center;
}
form.inline { display: inline; margin: 0; }
.walkthrough-steps { margin: 0; padding-left: 1.3em; display: grid; gap: 10px; line-height: 1.55; }
