/* Applications, part 1: the applicant drawer (light and dark surfaces, the tabbed layout, the screening tab and its
   full-detail sections, the printable screening report) and the Applications KPI chips. Split #8 of index.html:
   moved unchanged and linked at the exact spot it used to sit so the cascade order is the same. */
  /* ── APPLICANT DRAWER — light mode surfaces ──────────────────────────
     The panel is warm off-white in light mode now (see #app-detail-modal
     .modal above), so the inner cards can't go on being translucent white
     — that was white on white. State the same tile treatment the unit card
     uses: a near-white fill on a hairline. Dark mode keeps its glass, so
     none of this applies there. */
  :root:not([data-theme="dark"]) #app-detail-modal .scr-hero,
  :root:not([data-theme="dark"]) #app-detail-modal .scr-rec,
  :root:not([data-theme="dark"]) #app-detail-modal .scr-report,
  :root:not([data-theme="dark"]) #app-detail-modal .scr-activity,
  :root:not([data-theme="dark"]) #app-detail-modal .scr-empty-card,
  :root:not([data-theme="dark"]) #app-detail-modal .scr-progress,
  :root:not([data-theme="dark"]) #app-detail-modal .scr-checks-details,
  :root:not([data-theme="dark"]) #app-detail-modal .scr-ws-block,
  :root:not([data-theme="dark"]) #app-detail-modal .scr-kpi,
  :root:not([data-theme="dark"]) #app-detail-modal .scr-sec,
  :root:not([data-theme="dark"]) #app-detail-modal .scr-card,
  :root:not([data-theme="dark"]) #app-detail-modal .scr-timeline-item,
  :root:not([data-theme="dark"]) #app-detail-modal .ad-placeholder,
  :root:not([data-theme="dark"]) #app-detail-modal .ov-stepper,
  :root:not([data-theme="dark"]) #app-detail-modal .ov-next,
  :root:not([data-theme="dark"]) #app-detail-modal .ov-fin,
  :root:not([data-theme="dark"]) #app-detail-modal .ov-checklist,
  :root:not([data-theme="dark"]) #app-detail-modal .ov-tour-row,
  :root:not([data-theme="dark"]) #app-detail-modal .ov-details-card,
  :root:not([data-theme="dark"]) #app-detail-modal .ov-edit-card,
  :root:not([data-theme="dark"]) #app-detail-modal .ov-activity-card {
    background: #fdfdfb;
    border-color: rgba(68,64,60,0.11);
    box-shadow: 0 1px 1px rgba(23,23,27,0.03);
  }
  /* Small chips and pills keep a wash of the brand blue, the same way the unit
     card's secondary buttons do — it's what stops the panel reading flat. */
  :root:not([data-theme="dark"]) #app-detail-modal .ad-chip,
  :root:not([data-theme="dark"]) #app-detail-modal .ov-badge,
  :root:not([data-theme="dark"]) #app-detail-modal .ov-checklist-pill,
  :root:not([data-theme="dark"]) #app-detail-modal .ov-step-dot,
  :root:not([data-theme="dark"]) #app-detail-modal .modal-x {
    background: #f1f6ff;
    border-color: #d3e2fb;
  }
  :root:not([data-theme="dark"]) #app-detail-modal .modal-x:hover,
  :root:not([data-theme="dark"]) #app-detail-modal .ov-overflow-btn:hover,
  :root:not([data-theme="dark"]) #app-detail-modal .ov-edit-link:hover { background: #e6eefd; }
  /* Head and foot washes were white-on-glass; on the warm ground they do nothing
     but wash the hairline out. Let the panel colour through instead. */
  :root:not([data-theme="dark"]) #app-detail-modal .modal-head,
  :root:not([data-theme="dark"]) #app-detail-modal .modal-footer { background: none; }
  :root:not([data-theme="dark"]) #app-detail-modal .modal-head { border-bottom-color: rgba(68,64,60,0.12); }
  :root:not([data-theme="dark"]) #app-detail-modal .modal-footer { border-top-color: rgba(68,64,60,0.12); }
  /* The gloss highlight only makes sense on glass. */
  :root:not([data-theme="dark"]) #app-detail-modal .modal::before { display: none; }

  /* ── APPLICANT DRAWER — TABBED LAYOUT ────────────────────────────
     New top-of-drawer header strip (avatar + address + voucher tag +
     contextual actions) and tab bar that lives at the top of the
     modal-body. The drawer's modal-head still owns the name input
     and close button; everything below it is tabbed. */
  #app-detail-modal .ad-header-strip {
    display: flex; align-items: center; gap: 12px;
    padding: 4px 0 12px;
    border-bottom: 1px solid rgba(200,220,255,0.4);
    margin-bottom: 4px;
  }
  [data-theme="dark"] #app-detail-modal .ad-header-strip { border-bottom-color: var(--border); }
  [data-theme="dark"] #app-detail-modal .ad-avatar { background: var(--bg3); color: var(--text); border-color: var(--border2); }
  [data-theme="dark"] #app-detail-modal .ad-header-meta .ad-chip { background: rgba(255,255,255,0.06); border-color: var(--border2); color: var(--text); }
  #app-detail-modal .ad-avatar {
    width: 38px; height: 38px; border-radius: 50%;
    background: rgba(255,255,255,0.55);
    color: #1a3370;
    display: flex; align-items: center; justify-content: center;
    font-weight: 600; font-size: 13px; flex-shrink: 0;
    border: 1px solid rgba(200,220,255,0.55);
  }
  #app-detail-modal .ad-header-meta {
    flex: 1; min-width: 0;
    font-size: 12px; color: var(--text2);
    display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  }
  #app-detail-modal .ad-header-meta .ad-chip {
    display: inline-flex; align-items: center; gap: 4px;
    background: rgba(255,255,255,0.4);
    border: 1px solid rgba(200,220,255,0.45);
    border-radius: 999px;
    padding: 2px 9px; font-size: 11px;
    color: #1a3370;
  }
  #app-detail-modal .ad-header-meta .ad-chip .lucide { width: 12px; height: 12px; }
  #app-detail-modal .ad-header-actions { display: flex; gap: 6px; flex-wrap: wrap; }
  #app-detail-modal .ad-header-actions .btn {
    font-size: 11px; padding: 5px 10px;
  }

  /* Tab bar */
  #app-detail-modal .ad-tabs {
    display: flex; gap: 0;
    border-bottom: 1px solid rgba(200,220,255,0.4);
    margin: 0 -22px 14px;
    padding: 0 22px;
    overflow-x: auto;
    scrollbar-width: none;
  }
  #app-detail-modal .ad-tabs::-webkit-scrollbar { display: none; }
  #app-detail-modal .ad-tab {
    padding: 9px 14px; font-size: 13px; font-family: inherit;
    cursor: pointer; border: none; background: none;
    color: var(--text2); border-bottom: 2px solid transparent;
    margin-bottom: -1px; transition: color .15s, border-color .15s;
    font-weight: 500; white-space: nowrap;
    display: inline-flex; align-items: center; gap: 6px;
  }
  #app-detail-modal .ad-tab .lucide { width: 14px; height: 14px; }
  #app-detail-modal .ad-tab:hover:not(.active) { color: var(--text); }
  #app-detail-modal .ad-tab.active {
    color: #1a3370; font-weight: 600;
    border-bottom-color: #1a3370;
  }
  #app-detail-modal .ad-tab .ad-tab-dot {
    width: 7px; height: 7px; border-radius: 50%; background: var(--success, #16a34a);
    flex-shrink: 0;
  }
  /* UI fix #44 (26 Nov 2026): at the drawer's standard 560px the seven tabs ran past the edge and "Documents"
     was cut off. The bar sizes itself to the drawer: when the tabs would not fit, the icons go and the tabs
     tighten so every label shows; on a phone they wrap onto a second line instead of hiding off the edge. */
  #app-detail-modal .ad-tabs { container-type: inline-size; }
  @container (max-width: 760px) {
    #app-detail-modal .ad-tab { padding: 9px 9px; gap: 4px; }
    #app-detail-modal .ad-tab .lucide { display: none; }
  }
  @media (max-width: 768px) {
    #app-detail-modal .ad-tabs { flex-wrap: wrap; overflow-x: visible; }
  }

  /* Tab panes */
  #app-detail-modal .ad-pane { display: none; }
  #app-detail-modal .ad-pane.active { display: block; }

  /* ── MOCKUP-STYLE SCREENING TAB ── */
  #app-detail-modal .ad-screening { display: flex; flex-direction: column; gap: 14px; }

  /* Recommendation hero card */
  #app-detail-modal .scr-hero {
    background: rgba(255,255,255,0.55);
    border: 1px solid rgba(200,220,255,0.5);
    border-left: 3px solid #3B6D11;
    border-radius: var(--radius-lg);
    padding: 16px 18px;
  }
  #app-detail-modal .scr-hero.warn { border-left-color: #BA7517; }
  #app-detail-modal .scr-hero.danger { border-left-color: #B91C1C; }
  #app-detail-modal .scr-hero.empty { border-left-color: rgba(180,210,255,0.6); }
  #app-detail-modal .scr-hero-top {
    display: flex; align-items: center; gap: 14px;
    margin-bottom: 14px;
  }
  #app-detail-modal .scr-icon {
    width: 42px; height: 42px; border-radius: 50%;
    background: #EAF3DE;
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  }
  #app-detail-modal .scr-icon .lucide { width: 22px; height: 22px; color: #3B6D11; }
  #app-detail-modal .scr-hero.warn .scr-icon { background: #FAEEDA; }
  #app-detail-modal .scr-hero.warn .scr-icon .lucide { color: #BA7517; }
  #app-detail-modal .scr-hero.danger .scr-icon { background: #FEE2E2; }
  #app-detail-modal .scr-hero.danger .scr-icon .lucide { color: #B91C1C; }
  #app-detail-modal .scr-hero.empty .scr-icon { background: rgba(180,210,255,0.35); }
  #app-detail-modal .scr-hero.empty .scr-icon .lucide { color: #3b71f8; }
  #app-detail-modal .scr-hero-text { flex: 1; min-width: 0; }
  #app-detail-modal .scr-eyebrow {
    font-size: 10px; font-weight: 600; color: var(--text3);
    text-transform: uppercase; letter-spacing: 0.06em;
  }
  #app-detail-modal .scr-title {
    font-size: 18px; font-weight: 600; color: var(--text);
    margin-top: 3px; line-height: 1.3;
  }
  #app-detail-modal .scr-sub { font-size: 12px; color: var(--text3); margin-top: 3px; }
  /* Weimark's recommendation: one quiet line in a small box between the credit
     score gauge and the six tiles (_wmHero). Ruby, 11 Sep 2026: "just plain text". */
  #app-detail-modal .scr-rec {
    background: rgba(255,255,255,0.55);
    border: 1px solid rgba(200,220,255,0.5);
    border-left: 3px solid #3B6D11;
    border-radius: var(--radius);
    padding: 7px 12px 8px;
  }
  #app-detail-modal .scr-rec.warn { border-left-color: #BA7517; }
  #app-detail-modal .scr-rec.danger { border-left-color: #B91C1C; }
  #app-detail-modal .scr-rec-line { display: flex; align-items: center; flex-wrap: wrap; gap: 3px 8px; line-height: 1.35; }
  #app-detail-modal .scr-rec-k { font-size: 10px; font-weight: 600; color: var(--text3); text-transform: uppercase; letter-spacing: 0.06em; }
  #app-detail-modal .scr-rec-v { font-size: 13px; font-weight: 600; color: var(--text); }
  #app-detail-modal .scr-rec.danger .scr-rec-v { color: #b91c1c; }
  #app-detail-modal .scr-rec .scr-source-pill { margin-left: 0; }
  #app-detail-modal .scr-rec .scr-print-btn { align-self: center; }
  #app-detail-modal .scr-rec-meta { font-size: 11px; color: var(--text3); margin-top: 1px; line-height: 1.4; }
  #app-detail-modal .scr-rec .scr-notrun { margin-top: 8px; }
  #app-detail-modal .scr-rec .scr-checks-details { margin: 3px 0 0; border: 0; border-radius: 0; background: none; box-shadow: none; overflow: visible; }
  #app-detail-modal .scr-rec .scr-checks-summary { display: inline-flex; padding: 1px 0; font-size: 11px; font-weight: 500; }
  #app-detail-modal .scr-rec .scr-checks-chev { margin-left: 2px; }
  #app-detail-modal .scr-rec .scr-checks-grid { margin-top: 4px; padding: 2px 0 0; border-top: 1px solid var(--border); }
  #app-detail-modal .scr-rec .scr-check-label, #app-detail-modal .scr-rec .scr-check-status { padding: 3px 0; font-size: 11px; }
  #app-detail-modal .scr-actions { display: flex; gap: 8px; flex-wrap: wrap; }
  #app-detail-modal .scr-actions .btn-approve {
    background: #173404; color: #EAF3DE; border-color: #173404;
  }
  #app-detail-modal .scr-actions .btn-approve:hover { background: #0c1f02; }
  #app-detail-modal .scr-actions .btn-decline { color: #B91C1C; }

  /* Anomaly callout */
  #app-detail-modal .scr-callout {
    background: #FAEEDA;
    border: 1px solid #BA7517;
    border-radius: var(--radius);
    padding: 11px 14px;
    display: flex; gap: 10px; align-items: flex-start;
  }
  #app-detail-modal .scr-callout .lucide { width: 16px; height: 16px; color: #92400e; margin-top: 1px; flex-shrink: 0; }
  #app-detail-modal .scr-callout-title { font-size: 13px; font-weight: 600; color: #633806; }
  #app-detail-modal .scr-callout-text { font-size: 12px; color: #854F0B; margin-top: 3px; line-height: 1.5; }

  /* KPI grid */
  #app-detail-modal .scr-kpi-grid {
    display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px;
  }
  #app-detail-modal .scr-kpi {
    padding: 10px 12px;
    border: 1px solid transparent;
    border-radius: var(--radius);
  }
  #app-detail-modal .scr-kpi.flagged {
    border-color: #BA7517;
    background: rgba(255,255,255,0.35);
  }
  #app-detail-modal .scr-kpi-label {
    font-size: 11px; color: var(--text2);
    display: flex; align-items: center; gap: 5px; margin-bottom: 3px;
  }
  #app-detail-modal .scr-kpi-label .lucide { width: 13px; height: 13px; color: var(--text3); }
  #app-detail-modal .scr-kpi-value {
    font-size: 22px; font-weight: 600; color: var(--text); line-height: 1.1;
  }
  #app-detail-modal .scr-kpi-sub {
    font-size: 11px; color: var(--text2); margin-top: 3px;
    display: flex; align-items: center; gap: 4px;
  }
  #app-detail-modal .scr-kpi-sub.success { color: #3B6D11; }
  #app-detail-modal .scr-kpi-sub.success .lucide { color: #3B6D11; width: 12px; height: 12px; }
  /* A check that did not come back is neither good nor bad news — it is an
     absence, and it has to look like one rather than borrowing either colour. */
  #app-detail-modal .scr-kpi.unknown { border-color: var(--text3); border-style: dashed; }
  #app-detail-modal .scr-kpi-sub.unknown { color: var(--text2); }
  #app-detail-modal .scr-kpi-sub.unknown .lucide { color: var(--text2); width: 12px; height: 12px; }
  #app-detail-modal .scr-kpi-selfreport {
    font-size: 10.5px; color: var(--text3); margin-top: 4px; font-style: italic;
  }
  /* "This screening did not run" — deliberately the loudest thing on the panel. */
  #app-detail-modal .scr-notrun {
    margin-top: 12px; padding: 12px 14px; border-radius: var(--radius);
    border: 1px solid #b91c1c; background: rgba(185,28,28,0.08);
    font-size: 12.5px; line-height: 1.5; color: var(--text);
  }
  #app-detail-modal .scr-notrun-title {
    font-weight: 700; display: flex; align-items: center; gap: 6px; margin-bottom: 5px; color: #b91c1c;
  }
  #app-detail-modal .scr-notrun-title .lucide { width: 15px; height: 15px; }
  .apps-stuck { padding: 8px 18px 0; }
  .apps-stuck-inner {
    display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
    padding: 9px 12px; border-radius: var(--radius);
    border: 1px solid var(--border); background: var(--bg2);
  }
  .apps-stuck-lbl {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: 11.5px; font-weight: 600; color: var(--text2);
  }
  .apps-stuck-lbl .lucide { width: 14px; height: 14px; }
  .apps-stuck-chip {
    display: inline-flex; align-items: center; gap: 5px;
    font-size: 11.5px; font-weight: 600; cursor: pointer;
    padding: 5px 10px; border-radius: 999px;
    border: 1px solid var(--border); background: var(--bg); color: var(--text2);
  }
  .apps-stuck-chip .lucide { width: 12px; height: 12px; }
  .apps-stuck-chip:hover { background: var(--bg3); }
  .apps-stuck-chip.bad { color: #b91c1c; border-color: rgba(185,28,28,0.35); }
  .apps-stuck-chip.active { background: var(--text); color: var(--bg); border-color: var(--text); }
  /* Ruby, 16 Sep 2026: the screening-alert banner is off the phone entirely.
     It is an owner's back-office queue — three red chips and a "Show all" that
     ate the top third of the Applications board on a 393px screen and pushed
     the actual pipeline below the fold. It stays on desktop, where there is
     room for it and where this work is actually done. Nothing is disabled:
     the same counts, the same filters and the same records are all still
     there on a larger screen. */
  @media (max-width: 768px) {
    .apps-stuck { padding: 8px 12px 0; }
    #apps-stuck-banner { display: none !important; }
  }

  #app-detail-modal .scr-court-detail {
    margin-top: 6px; font-size: 11px; color: var(--text2); line-height: 1.5;
    white-space: pre-wrap; word-break: break-word;
  }

  /* Section labels */
  #app-detail-modal .scr-section-lbl {
    font-size: 10px; font-weight: 600; color: var(--text3);
    text-transform: uppercase; letter-spacing: 0.08em;
    margin: 4px 0 8px;
  }

  /* Report breakdown cards */
  #app-detail-modal .scr-report {
    background: rgba(255,255,255,0.5);
    border: 1px solid rgba(200,220,255,0.4);
    border-radius: var(--radius);
    padding: 11px 13px;
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 6px;
  }
  #app-detail-modal .scr-report-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
  #app-detail-modal .scr-report-left > .lucide { width: 16px; height: 16px; color: var(--text2); flex-shrink: 0; }
  #app-detail-modal .scr-report-title { font-size: 13px; font-weight: 600; color: var(--text); }
  #app-detail-modal .scr-report-summary { font-size: 12px; color: var(--text2); margin-left: 6px; }
  #app-detail-modal .scr-report-right { display: flex; align-items: center; gap: 8px; }
  #app-detail-modal .scr-badge {
    background: #EAF3DE; color: #2C5408;
    font-size: 11px; font-weight: 600;
    padding: 3px 10px; border-radius: 999px;
  }
  #app-detail-modal .scr-badge.warn { background: #FAEEDA; color: #633806; }
  #app-detail-modal .scr-badge.danger { background: #FEE2E2; color: #B91C1C; }
  #app-detail-modal .scr-report-right .lucide { width: 14px; height: 14px; color: var(--text3); }

  /* Activity timeline */
  #app-detail-modal .scr-activity {
    background: rgba(255,255,255,0.4);
    border: 1px solid rgba(200,220,255,0.4);
    border-radius: var(--radius);
    padding: 2px 14px;
  }
  #app-detail-modal .scr-activity-row {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 0; font-size: 12px;
  }
  #app-detail-modal .scr-activity-row + .scr-activity-row { border-top: 1px solid rgba(200,220,255,0.35); }
  #app-detail-modal .scr-activity-row .lucide { width: 16px; height: 16px; color: #3B6D11; flex-shrink: 0; }
  #app-detail-modal .scr-activity-row.pending .lucide { color: var(--text3); }
  #app-detail-modal .scr-activity-row .lbl { color: var(--text2); flex: 1; }
  #app-detail-modal .scr-activity-row .t { color: var(--text3); font-size: 11px; }

  /* Empty state for screening */
  #app-detail-modal .scr-empty-grid {
    display: grid; grid-template-columns: 1fr; gap: 10px;
  }
  @media (min-width: 720px) {
    #app-detail-modal .scr-empty-grid { grid-template-columns: 1fr 1fr; }
  }
  #app-detail-modal .scr-empty-card {
    background: rgba(255,255,255,0.5);
    border: 1px solid rgba(200,220,255,0.5);
    border-radius: var(--radius-lg);
    padding: 18px;
    text-align: center;
    display: flex; flex-direction: column; align-items: center; gap: 6px;
  }
  #app-detail-modal .scr-empty-card.primary {
    border-color: #3b71f8;
    background: rgba(225,238,255,0.55);
  }
  #app-detail-modal .scr-empty-card > .lucide { width: 24px; height: 24px; color: var(--text3); }
  #app-detail-modal .scr-empty-card.primary > .lucide { color: #3b71f8; }
  #app-detail-modal .scr-empty-title { font-size: 13px; font-weight: 600; color: var(--text); }
  #app-detail-modal .scr-empty-desc { font-size: 12px; color: var(--text2); line-height: 1.45; }
  #app-detail-modal .scr-empty-card .btn { margin-top: 4px; }
  #app-detail-modal .scr-dropzone {
    width: 100%;
    border: 2px dashed rgba(200,220,255,0.7);
    background: rgba(255,255,255,0.35);
    border-radius: var(--radius);
    padding: 14px 10px;
    margin-top: 4px;
    cursor: pointer;
    transition: border-color .15s, background .15s;
  }
  #app-detail-modal .scr-dropzone:hover {
    border-color: #3b71f8;
    background: rgba(225,238,255,0.5);
  }
  #app-detail-modal .scr-dropzone .lucide { width: 18px; height: 18px; color: var(--text3); }
  #app-detail-modal .scr-dropzone-title { font-size: 12px; font-weight: 600; margin-top: 4px; }
  #app-detail-modal .scr-dropzone-sub { font-size: 10px; color: var(--text3); margin-top: 2px; }

  /* Progress checklist (in-progress state) */
  #app-detail-modal .scr-progress {
    background: rgba(255,255,255,0.45);
    border: 1px solid rgba(200,220,255,0.5);
    border-radius: var(--radius-lg);
    padding: 4px 16px;
  }
  #app-detail-modal .scr-progress-row {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 0; font-size: 13px;
  }
  #app-detail-modal .scr-progress-row + .scr-progress-row { border-top: 1px solid rgba(200,220,255,0.35); }
  #app-detail-modal .scr-progress-step {
    width: 22px; height: 22px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  }
  #app-detail-modal .scr-progress-step.done { background: #EAF3DE; color: #3B6D11; }
  #app-detail-modal .scr-progress-step.active { background: #DBEAFE; color: #2563EB; }
  #app-detail-modal .scr-progress-step.pending { background: rgba(200,220,255,0.3); color: var(--text3); }
  #app-detail-modal .scr-progress-step .lucide { width: 13px; height: 13px; }
  #app-detail-modal .scr-progress-label { flex: 1; color: var(--text); }
  #app-detail-modal .scr-progress-row.pending .scr-progress-label { color: var(--text3); }
  #app-detail-modal .scr-progress-t { color: var(--text3); font-size: 11px; }

  /* Source pill */
  #app-detail-modal .scr-source-pill {
    display: inline-flex; align-items: center; gap: 4px;
    font-size: 10px;
    background: rgba(225,238,255,0.65);
    color: #1a3370;
    padding: 2px 8px;
    border-radius: 999px;
    margin-left: 6px; font-weight: 500;
  }
  #app-detail-modal .scr-source-pill.manual { background: #FEF3C7; color: #92400E; }

  /* ── FULL-DETAIL SCREENING ADDITIONS ────────────────────────────
     Layered on top of the existing .scr-* base. Adds:
     - 6 status badges row inside the hero
     - Weimark Score 0-850+ visualization
     - 8-tile KPI grid (auto-flow to 2/4 columns)
     - Collapsible report sections (.scr-sec)
     - Reusable inner patterns: kv-grid, stat-row, acct-row */

  /* Status badges row */
  #app-detail-modal .scr-status-row {
    display: flex; gap: 6px; flex-wrap: wrap;
    margin-bottom: 12px;
  }
  #app-detail-modal .scr-status {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 11px; font-weight: 600;
    background: #EAF3DE; color: #2C5408;
  }
  #app-detail-modal .scr-status.warn { background: #FAEEDA; color: #633806; }
  #app-detail-modal .scr-status.danger { background: #FEE2E2; color: #B91C1C; }
  #app-detail-modal .scr-status .lucide { width: 11px; height: 11px; }

  /* Checks grid — replaces pill-wall */
  #app-detail-modal .scr-checks-details {
    margin: 10px 0 4px;
    border-radius: var(--radius);
    background: rgba(255,255,255,0.22);
    border: 1px solid rgba(0,0,0,0.07);
    overflow: hidden;
  }
  #app-detail-modal .scr-checks-summary {
    display: flex; align-items: center; gap: 6px;
    padding: 8px 12px;
    font-size: 11.5px; font-weight: 600; color: var(--text2);
    cursor: pointer; list-style: none; user-select: none;
  }
  #app-detail-modal .scr-checks-summary::-webkit-details-marker { display: none; }
  #app-detail-modal .scr-checks-summary .lucide { width: 13px; height: 13px; }
  #app-detail-modal .scr-checks-chev {
    margin-left: auto; transition: transform 0.18s;
    width: 13px !important; height: 13px !important;
  }
  #app-detail-modal .scr-checks-details[open] .scr-checks-chev { transform: rotate(180deg); }
  #app-detail-modal .scr-checks-flag { color: #BA7517; }
  #app-detail-modal .scr-checks-grid {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 0;
    padding: 4px 0 8px;
    border-top: 1px solid rgba(0,0,0,0.07);
  }
  #app-detail-modal .scr-check-label,
  #app-detail-modal .scr-check-status {
    display: flex; align-items: center; gap: 5px;
    padding: 5px 12px;
    font-size: 11.5px;
    border-bottom: 1px solid rgba(0,0,0,0.04);
  }
  #app-detail-modal .scr-check-label { color: var(--text2); }
  #app-detail-modal .scr-check-label .lucide { width: 12px; height: 12px; color: #3B6D11; flex-shrink: 0; }
  #app-detail-modal .scr-check-status { justify-content: flex-end; text-align: right; }
  #app-detail-modal .scr-check-status.ok   { color: #2C5408; font-weight: 600; }
  #app-detail-modal .scr-check-status.warn { color: #633806; font-weight: 600; }
  /* A check that errored. It is not a pass and it is not a flag on the person —
     it is a hole in the screening, and it gets its own colour so it cannot be
     mistaken for either. */
  #app-detail-modal .scr-check-status.danger { color: #b91c1c; font-weight: 700; }
  #app-detail-modal .scr-check-label.warn .lucide { color: #BA7517; }

  /* Co-applicant divider inside identity section */
  #app-detail-modal .scr-co-applicant {
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid rgba(0,0,0,0.08);
  }
  #app-detail-modal .scr-co-label {
    font-size: 10.5px; font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.05em; color: var(--text3);
    margin-bottom: 8px;
  }

  /* Weimark Score visualization — the first card on the report (Ruby, 11 Sep
     2026). Framed like the recommendation card under it so the two read as a
     set; the score has its own column, ruled off, at headline size. */
  #app-detail-modal .scr-ws-block {
    display: grid; grid-template-columns: minmax(0, 1fr) auto;
    align-items: center; gap: 20px;
    margin: 0; /* the report column's 14px gap sets the rhythm; paper has none, see below */
    padding: 16px 18px;
    background: rgba(255,255,255,0.55);
    border: 1px solid rgba(200,220,255,0.5);
    border-radius: var(--radius-lg);
  }
  #app-detail-modal .scr-ws-bar-wrap { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
  #app-detail-modal .scr-ws-bar-label {
    display: flex; justify-content: space-between; align-items: baseline; gap: 10px;
    font-size: 10.5px; font-weight: 600; letter-spacing: 0.06em; color: var(--text3);
  }
  /* The colours come from WM_CREDIT_BANDS (inline), never from here — one scale. */
  #app-detail-modal .scr-ws-bar {
    height: 10px; border-radius: 999px;
    position: relative;
  }
  /* No score to place: an empty track, dashed like a tile whose check did not
     come back — never a bar that reads as a zero or as fine. */
  #app-detail-modal .scr-ws-bar.scr-ws-bar-none { border: 1px dashed var(--text3); background: none; box-sizing: border-box; }
  #app-detail-modal .scr-ws-key {
    display: flex; flex-wrap: wrap; gap: 3px 12px;
    font-size: 10px; color: var(--text3); margin-top: 1px;
  }
  #app-detail-modal .scr-ws-key .dot {
    display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 4px;
  }
  #app-detail-modal .scr-ws-marker {
    position: absolute; top: -4px;
    width: 18px; height: 18px;
    background: #fff;
    border: 3px solid var(--text);
    border-radius: 50%;
    transform: translateX(-50%);
    box-shadow: 0 1px 2px rgba(0,0,0,0.18);
  }
  #app-detail-modal .scr-ws-note {
    font-size: 10.5px; color: var(--text3); margin-top: 1px;
  }
  #app-detail-modal .scr-ws-score {
    align-self: stretch; display: flex; flex-direction: column; justify-content: center;
    text-align: center; min-width: 96px; padding-left: 20px;
    border-left: 1px solid rgba(120,150,210,0.25);
  }
  #app-detail-modal .scr-ws-num {
    font-size: 34px; font-weight: 700; color: var(--text); line-height: 1; letter-spacing: -0.01em;
  }
  #app-detail-modal .scr-ws-num.scr-ws-num-none { font-size: 17px; font-weight: 600; color: var(--text2); line-height: 1.2; letter-spacing: 0; }
  #app-detail-modal .scr-ws-num.scr-ws-num-none.bad { color: #b91c1c; }
  #app-detail-modal .scr-ws-tag {
    font-size: 10px; color: var(--text2);
    text-transform: uppercase; letter-spacing: 0.06em;
    margin-top: 5px;
  }
  @media (max-width: 600px) {
    #app-detail-modal .scr-ws-block { gap: 14px; padding: 14px 14px; }
    #app-detail-modal .scr-ws-score { min-width: 78px; padding-left: 14px; }
    #app-detail-modal .scr-ws-num { font-size: 30px; }
  }

  /* Expanded KPI grid — 4 cols on wide drawers, 2 cols when narrow */
  #app-detail-modal .scr-kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 6px;
    margin-bottom: 14px;
  }
  #app-detail-modal .scr-kpi {
    padding: 9px 11px;
    background: rgba(255,255,255,0.4);
    border-color: rgba(200,220,255,0.4);
  }
  #app-detail-modal .scr-kpi.success { border-color: #C5DEA8; }
  /* Ruby, 15 Sep 2026: the pink fill was visually distracting. The red BORDER
     stays — a failed check must never read like a pass — but the tile keeps the
     same background as every other tile. */
  #app-detail-modal .scr-kpi.danger {
    border-color: #B91C1C;
  }
  /* THE SCREENING SUMMARY — six tiles (_wmSummaryTiles). Ruby, 11 Sep 2026: every
     tile the same size, all on one page, no empty slot. Equal columns, and every
     row as tall as the tallest tile. Six divides by 2, 3 and 6, so no width leaves
     a hole: three across in the drawer and on paper, two in a narrow drawer or on
     a phone, one row of six when the drawer is maximised. */
  #app-detail-modal .scr-band-wrap { container-type: inline-size; }
  #app-detail-modal .scr-band { display: grid; gap: 6px; grid-auto-rows: 1fr; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  @container (max-width: 559px) { #app-detail-modal .scr-band { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
  @container (min-width: 1400px) { #app-detail-modal .scr-band { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
  /* A phone shrinks the drawer body (zoom 0.8), so it measures wider than it
     looks — by the screen, not the panel, two across. */
  @media (max-width: 600px) { #app-detail-modal .scr-band { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
  #app-detail-modal .scr-band > .scr-kpi { container-type: inline-size; min-width: 0; display: flex; flex-direction: column; }
  #app-detail-modal .scr-band .scr-kpi.success { border-color: #C5DEA8; }
  #app-detail-modal .scr-band .scr-kpi.flagged { border-color: #BA7517; }
  #app-detail-modal .scr-band .scr-kpi.danger { border-color: #B91C1C; }
  #app-detail-modal .scr-band .scr-kpi.unknown { border-color: var(--text3); border-style: dashed; }
  #app-detail-modal .scr-band .scr-kpi-value { font-size: 21px; }
  #app-detail-modal .scr-band .scr-kpi-value.small { font-size: 15px; line-height: 1.2; }
  #app-detail-modal .scr-kpi-bw { font-size: 13px; font-weight: 500; color: var(--text2); margin-left: 6px; }
  #app-detail-modal .scr-band .scr-kpi-sub { display: block; line-height: 1.35; }
  #app-detail-modal .scr-facts { margin-top: 8px; padding-top: 6px; border-top: 1px solid var(--border2, rgba(68,64,60,0.11)); display: flex; flex-direction: column; gap: 5px; }
  #app-detail-modal .scr-f { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; font-size: 11px; line-height: 1.3; }
  #app-detail-modal .scr-fl { color: var(--text2); min-width: 0; }
  #app-detail-modal .scr-fl small, #app-detail-modal .scr-fv small { display: block; font-size: 9.5px; color: var(--text3); font-weight: 400; margin-top: 1px; }
  #app-detail-modal .scr-fv { color: var(--text); font-weight: 600; text-align: right; min-width: 0; overflow-wrap: anywhere; }
  #app-detail-modal .scr-f.flag .scr-fv { color: #8a560f; }
  #app-detail-modal .scr-f.bad .scr-fv { color: #b91c1c; }
  /* The renter's own answer: italic, never the weight of a check. */
  #app-detail-modal .scr-f.self .scr-fl, #app-detail-modal .scr-f.self .scr-fv { font-style: italic; }
  #app-detail-modal .scr-f.self .scr-fv { font-weight: 500; color: var(--text2); }
  /* Income: the renter's figure and the bank's side by side, each named. */
  #app-detail-modal .scr-split { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 2px; }
  #app-detail-modal .scr-sp { border: 1px solid var(--border2, rgba(68,64,60,0.11)); border-radius: 6px; padding: 5px 7px 6px; min-width: 0; }
  #app-detail-modal .scr-sp.none { border-style: dashed; border-color: var(--text3); }
  #app-detail-modal .scr-sk { font-size: 9.5px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text3); }
  #app-detail-modal .scr-sv { font-size: 15px; font-weight: 600; line-height: 1.2; margin-top: 2px; color: var(--text); }
  #app-detail-modal .scr-sp.self .scr-sv { font-style: italic; font-weight: 500; }
  #app-detail-modal .scr-ss { font-size: 9.5px; color: var(--text2); margin-top: 2px; line-height: 1.3; }
  /* In a narrow tile the two figures stack, and a fact's value goes under its label. */
  @container (max-width: 200px) { #app-detail-modal .scr-split { grid-template-columns: minmax(0, 1fr); } }
  @container (max-width: 170px) {
    #app-detail-modal .scr-f { flex-direction: column; gap: 1px; }
    #app-detail-modal .scr-fv, #app-detail-modal .scr-fv small { text-align: left; }
  }
  #app-detail-modal .scr-band-foot { font-size: 11px; color: var(--text3); margin: 8px 0 12px; line-height: 1.45; }

  /* Collapsible report sections */
  #app-detail-modal .scr-sec {
    border: 1px solid rgba(200,220,255,0.45);
    border-radius: var(--radius-lg);
    background: rgba(255,255,255,0.45);
    margin-bottom: 6px;
  }
  #app-detail-modal .scr-sec-head {
    padding: 10px 14px;
    display: flex; align-items: center; gap: 8px;
    cursor: pointer; user-select: none;
  }
  #app-detail-modal .scr-sec-head > .lucide { width: 16px; height: 16px; color: var(--text2); flex-shrink: 0; }
  #app-detail-modal .scr-sec-title { font-size: 13px; font-weight: 600; color: var(--text); }
  #app-detail-modal .scr-sec-summary {
    font-size: 11px; color: var(--text2); font-weight: 400;
    flex: 1; min-width: 0;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  #app-detail-modal .scr-sec-badge {
    font-size: 10px; font-weight: 600;
    padding: 2px 9px; border-radius: 999px;
    background: #EAF3DE; color: #2C5408;
    flex-shrink: 0;
  }
  #app-detail-modal .scr-sec-badge.warn { background: #FAEEDA; color: #633806; }
  #app-detail-modal .scr-sec-badge.danger { background: #FEE2E2; color: #B91C1C; }
  #app-detail-modal .scr-sec-badge.info { background: #DBEAFE; color: #1d4ed8; }
  #app-detail-modal .scr-sec-chev {
    color: var(--text3); width: 14px; height: 14px;
    transition: transform 0.15s;
  }
  #app-detail-modal .scr-sec.open .scr-sec-chev { transform: rotate(180deg); }
  #app-detail-modal .scr-sec-body {
    display: none;
    padding: 12px 14px 14px;
    border-top: 1px solid rgba(200,220,255,0.35);
  }
  #app-detail-modal .scr-sec.open .scr-sec-body { display: block; }

  /* Inner patterns inside section bodies */
  #app-detail-modal .scr-kv-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px 18px;
  }
  #app-detail-modal .scr-kv {
    display: flex; flex-direction: column;
    padding: 4px 0;
  }
  #app-detail-modal .scr-kv-label {
    font-size: 10px; color: var(--text3);
    text-transform: uppercase; letter-spacing: 0.04em;
    margin-bottom: 1px;
  }
  #app-detail-modal .scr-kv-val { font-size: 12px; color: var(--text); font-weight: 500; }
  #app-detail-modal .scr-kv-val.muted { color: var(--text2); font-weight: 400; }
  #app-detail-modal .scr-kv-val.warn { color: #92400e; }

  /* Boxed section card — borders each section so it's clear where one stops
     and the next begins (matches the Weimark report layout). */
  #app-detail-modal .scr-card {
    border: 1px solid rgba(120,150,210,0.30);
    border-radius: 10px;
    padding: 12px 14px;
    margin-bottom: 10px;
    background: rgba(255,255,255,0.42);
  }
  #app-detail-modal .scr-card:last-child { margin-bottom: 0; }

  /* Weimark-style report tables (Plaid accounts / income / expense / sources) */
  #app-detail-modal .scr-rpt { width: 100%; border-collapse: collapse; font-size: 11.5px; margin-top: 4px; }
  #app-detail-modal .scr-rpt th {
    text-align: left; font-size: 9.5px; text-transform: uppercase; letter-spacing: 0.04em;
    color: var(--text3); font-weight: 600; padding: 5px 8px; white-space: nowrap;
    border-bottom: 1px solid rgba(120,150,210,0.30);
  }
  #app-detail-modal .scr-rpt td {
    padding: 6px 8px; border-bottom: 1px dashed rgba(200,220,255,0.45);
    color: var(--text); vertical-align: top;
  }
  #app-detail-modal .scr-rpt tbody tr:last-child td,
  #app-detail-modal .scr-rpt tr:last-child td { border-bottom: none; }
  #app-detail-modal .scr-rpt td.num, #app-detail-modal .scr-rpt th.num {
    text-align: right; font-family: 'DM Mono','SF Mono',Menlo,monospace; white-space: nowrap;
  }
  #app-detail-modal .scr-rpt tr.total td { border-top: 2px solid rgba(120,150,210,0.45); border-bottom: none; font-weight: 700; }
  #app-detail-modal .scr-rpt tr.total td.num { color: #15803d; }
  #app-detail-modal .scr-rpt .sub { color: var(--text3); font-size: 10px; margin-top: 1px; }
  #app-detail-modal .scr-rpt-2col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
  #app-detail-modal .scr-rpt-note { font-size: 10px; color: var(--text3); margin-top: 6px; }
  #app-detail-modal .scr-bal-chart { width: 100%; height: auto; display: block; margin-top: 6px; overflow: visible; }
  #app-detail-modal .scr-bal-legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 10px; color: var(--text3); margin-top: 4px; }
  #app-detail-modal .scr-bal-legend i { display: inline-block; width: 14px; height: 0; vertical-align: middle; margin-right: 5px; }
  /* Combined accounts-balances chart (Weimark-style) */
  .wm-bal-wrap { position: relative; margin-top: 6px; }
  .wm-bal-svg { width: 100%; height: 250px; display: block; overflow: visible; }
  .wm-bal-tip { position: absolute; top: 8px; z-index: 5; pointer-events: none; background: var(--card, #fff); border: 1px solid var(--border2); border-radius: 8px; box-shadow: 0 8px 24px rgba(8,18,40,0.18); padding: 8px 10px; font-size: 11px; line-height: 1.5; color: var(--text); min-width: 150px; max-width: min(300px, 100%); box-sizing: border-box; }
  .wm-bal-tip .wm-tip-date { font-weight: 700; margin-bottom: 4px; color: var(--text2); }
  .wm-bal-tip .wm-tip-row { white-space: normal; }
  .wm-bal-tip .wm-tip-row b { white-space: nowrap; }
  #app-detail-modal .wm-neg { color: #b91c1c; font-weight: 600; }

  /* Bank (Plaid) section. Account colours: the validated categorical order
     (never red or green — those mean bad and good here). */
  #app-detail-modal { --wm-s1: #2a78d6; --wm-s2: #eb6834; --wm-s3: #1baf7a; --wm-s4: #eda100; --wm-s5: #e87ba4; --wm-grid: rgba(110,120,140,0.20); --wm-surface: #fff; }
  :root[data-theme="dark"] #app-detail-modal { --wm-s1: #3987e5; --wm-s2: #d95926; --wm-s3: #199e70; --wm-s4: #c98500; --wm-s5: #d55181; --wm-grid: rgba(255,255,255,0.10); --wm-surface: #1a1a19; }
  /* Bank data stays in the product: it is not selectable or copyable. */
  #app-detail-modal .wm-bank { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
  #app-detail-modal .wm-bank-meta { font-size: 11.5px; color: var(--text2); margin: -4px 0 8px; line-height: 1.45; }
  #app-detail-modal .wm-src { font-weight: 500; text-transform: none; letter-spacing: 0; color: var(--text3); margin-left: 6px; }
  #app-detail-modal .wm-bank-note { font-size: 11.5px; color: var(--text2); line-height: 1.5; margin: 0 0 8px; }
  #app-detail-modal .scr-card.wm-bank-empty { border-style: dashed; border-color: var(--text3); }
  #app-detail-modal .scr-card.wm-bank-empty.bad { border: 1px solid #b91c1c; background: rgba(185,28,28,0.06); }
  #app-detail-modal .wm-bank-empty-title { display: flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 600; color: var(--text); }
  #app-detail-modal .wm-bank-empty-title .lucide { width: 15px; height: 15px; color: var(--text3); flex-shrink: 0; }
  #app-detail-modal .wm-bank-empty.bad .wm-bank-empty-title .lucide { color: #b91c1c; }
  #app-detail-modal .wm-bank-empty-text { font-size: 12px; color: var(--text2); line-height: 1.55; margin-top: 4px; }
  /* Weekly balance chart: SVG for the marks, HTML for every word and dot, so
     nothing stretches when the drawer is narrow. */
  #app-detail-modal .wm-bc { position: relative; padding: 12px 6px 26px 52px; }
  #app-detail-modal .wm-bc-plot { position: relative; height: 200px; }
  #app-detail-modal .wm-bc-plot svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; display: block; }
  #app-detail-modal .wm-bc-y { position: absolute; left: -8px; transform: translate(-100%, -50%); font-size: 10px; color: var(--text3); white-space: nowrap; font-variant-numeric: tabular-nums; }
  #app-detail-modal .wm-bc-y.neg { color: #b91c1c; }
  #app-detail-modal .wm-bc-x { position: absolute; top: calc(100% + 7px); transform: translateX(-50%); font-size: 10px; color: var(--text3); white-space: nowrap; }
  #app-detail-modal .wm-bc-x.first { transform: none; }
  #app-detail-modal .wm-bc-x.last { transform: translateX(-100%); }
  #app-detail-modal .wm-bc-rent { position: absolute; left: 4px; transform: translateY(calc(-100% - 3px)); font-size: 10px; color: var(--text2); white-space: nowrap; background: var(--wm-surface); padding: 0 4px; border-radius: 4px; pointer-events: none; }
  /* The four bank tiles sit two by two, on a phone and in the drawer alike. */
  #app-detail-modal .wm-bank .scr-kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #app-detail-modal .wm-bc-low { position: absolute; width: 0; height: 0; pointer-events: none; }
  #app-detail-modal .wm-bc-low i { position: absolute; width: 8px; height: 8px; left: -4px; top: -4px; border-radius: 50%; background: var(--text); box-shadow: 0 0 0 2px var(--wm-surface); }
  #app-detail-modal .wm-bc-low.neg i { background: #b91c1c; }
  #app-detail-modal .wm-bc-low span { position: absolute; top: 8px; left: 0; transform: translateX(-50%); font-size: 10.5px; font-weight: 600; color: var(--text); white-space: nowrap; background: var(--wm-surface); padding: 1px 5px; border-radius: 4px; box-shadow: 0 0 0 1px var(--wm-grid); }
  #app-detail-modal .wm-bc-low.up span { top: auto; bottom: 8px; }
  #app-detail-modal .wm-bc-low.r span { transform: none; left: -4px; }
  #app-detail-modal .wm-bc-low.l span { transform: translateX(-100%); left: 4px; }
  #app-detail-modal .wm-bc-guide { position: absolute; top: 0; bottom: 0; width: 0; border-left: 1px solid var(--text3); pointer-events: none; }
  #app-detail-modal .wm-bc-dot { position: absolute; width: 8px; height: 8px; border-radius: 50%; transform: translate(-50%, -50%); box-shadow: 0 0 0 2px var(--wm-surface); pointer-events: none; }
  #app-detail-modal .wm-bc-dot.ink { background: var(--text); }
  /* Wider than the plot, so the first and last weeks are as easy to hit as the rest. */
  #app-detail-modal .wm-bc-hit { position: absolute; inset: -8px -14px; cursor: crosshair; touch-action: pan-y; outline: none; }
  /* The phone layout caps everything in a modal body at max-width:100%. These
     pieces are positioned against zero-width or narrower anchors, and that cap
     shrank the touch area short of the last week and collapsed the label boxes. */
  #app-detail-modal .wm-bc-hit, #app-detail-modal .wm-bc-low span, #app-detail-modal .wm-bc-rent,
  #app-detail-modal .wm-bc-x, #app-detail-modal .wm-bc-y { max-width: none; }
  #app-detail-modal .wm-bc-hit:focus-visible { box-shadow: 0 0 0 2px #2563eb; border-radius: 4px; }
  #app-detail-modal .wm-bc-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 11px; color: var(--text2); margin: 0 0 4px 52px; }
  #app-detail-modal .wm-bc-legend span { display: inline-flex; align-items: center; gap: 6px; }
  #app-detail-modal .wm-bc-legend i { display: inline-block; width: 12px; height: 8px; border-radius: 2px; }
  #app-detail-modal .wm-bc-legend i.line { height: 0; border-top: 2px solid var(--text); border-radius: 0; }
  #app-detail-modal .wm-bc-legend i.dash { height: 0; border-top: 1px dashed var(--text2); border-radius: 0; }
  .wm-bal-tip .wm-tip-key { display: inline-block; width: 10px; height: 0; border-top: 2px solid var(--text); vertical-align: middle; margin-right: 6px; }
  .wm-bal-tip .wm-tip-name { color: var(--text2); }
  .wm-bal-tip .wm-tip-total { border-top: 1px solid var(--border2); margin-top: 3px; padding-top: 3px; }
  .wm-bal-tip .wm-tip-rent { margin-top: 4px; font-size: 10.5px; color: var(--text2); }
  /* Drill-in rows: a category or an income source that opens to its detail. */
  #app-detail-modal .wm-drill { border-top: 1px dashed rgba(200,220,255,0.55); }
  #app-detail-modal .wm-drill:first-of-type { border-top: none; }
  #app-detail-modal .wm-drill > summary { list-style: none; display: flex; align-items: center; gap: 8px; padding: 9px 2px; cursor: pointer; font-size: 12px; color: var(--text); }
  #app-detail-modal .wm-drill > summary::-webkit-details-marker { display: none; }
  #app-detail-modal .wm-drill-name { font-weight: 600; min-width: 0; }
  #app-detail-modal .wm-drill-name .sub { display: block; font-weight: 400; font-size: 10.5px; color: var(--text3); margin-top: 1px; }
  #app-detail-modal .wm-drill-meta { color: var(--text2); font-size: 11.5px; margin-left: auto; text-align: right; white-space: nowrap; }
  #app-detail-modal .wm-drill-chev { width: 14px; height: 14px; color: var(--text3); transition: transform .15s; flex-shrink: 0; }
  #app-detail-modal .wm-drill[open] > summary .wm-drill-chev { transform: rotate(180deg); }
  #app-detail-modal .wm-drill.wm-fee > summary { color: #991b1b; }
  #app-detail-modal .wm-drill.wm-fee > summary .wm-fee-ico { width: 14px; height: 14px; color: #b91c1c; flex-shrink: 0; }
  #app-detail-modal .wm-scroll { max-height: 320px; overflow: auto; margin: 0 0 8px; }
  #app-detail-modal .wm-li { padding: 7px 2px; border-bottom: 1px dashed rgba(200,220,255,0.45); font-size: 12px; }
  #app-detail-modal .wm-li:last-child { border-bottom: none; }
  #app-detail-modal .wm-li-top { display: flex; gap: 10px; align-items: baseline; }
  #app-detail-modal .wm-li-top b { margin-left: auto; font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; }
  #app-detail-modal .wm-li-sub { font-size: 10.5px; color: var(--text3); margin-top: 2px; word-break: break-word; line-height: 1.45; }
  /* ── Print / Save as PDF — LeasePace's copy of the screening report ─────
     The copy (#scr-print-paper) is built only when Print is pressed, sits in
     this drawer so every Screening style above applies to it, and shows only
     on paper. Everything else is taken off the page while it prints. See
     screeningPrint(). */
  #app-detail-modal .scr-print-btn { margin-left: auto; align-self: flex-start; flex-shrink: 0; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }
  #app-detail-modal .scr-print-btn .lucide { width: 14px; height: 14px; }
  #app-detail-modal .scr-hero-text { min-width: 0; }
  #scr-print-paper { display: none; }
  @media print {
    html.scr-printing, html.scr-printing body, html.scr-printing .scr-print-path {
      position: static !important; display: block !important; overflow: visible !important;
      height: auto !important; min-height: 0 !important; max-height: none !important;
      width: auto !important; max-width: none !important; inset: auto !important;
      transform: none !important; margin: 0 !important; padding: 0 !important;
      background: #fff !important; box-shadow: none !important; border: 0 !important;
      opacity: 1 !important; filter: none !important; backdrop-filter: none !important; -webkit-backdrop-filter: none !important;
    }
    html.scr-printing body > :not(.scr-print-path),
    html.scr-printing .scr-print-path > :not(.scr-print-path):not(#scr-print-paper) { display: none !important; }
    html.scr-printing #scr-print-paper { display: block !important; }
    html.scr-printing #scr-print-paper, html.scr-printing #scr-print-paper * {
      visibility: visible !important; -webkit-print-color-adjust: exact; print-color-adjust: exact;
    }
  }
  #app-detail-modal #scr-print-paper {
    color-scheme: light;
    --bg: #fff; --bg2: #f8fafc; --bg3: #f1f5f9; --surface: #fff;
    --text: #111827; --text2: #374151; --text3: #6b7280;
    --border: #e5e7eb; --border2: #d1d5db;
    --wm-s1: #2a78d6; --wm-s2: #eb6834; --wm-s3: #1baf7a; --wm-s4: #eda100; --wm-s5: #e87ba4; --wm-grid: rgba(110,120,140,0.25); --wm-surface: #fff;
    color: var(--text); background: #fff; font-size: 12px; line-height: 1.45; pointer-events: none;
  }
  #scr-print-paper .scrp-head { display: flex; justify-content: space-between; align-items: baseline; border-bottom: 2px solid #2563eb; padding-bottom: 5px; margin-bottom: 8px; }
  #scr-print-paper .scrp-brand { font-size: 18px; font-weight: 800; color: #2563eb; letter-spacing: -0.01em; }
  #scr-print-paper .scrp-doc { font-size: 11px; font-weight: 600; color: var(--text2); text-transform: uppercase; letter-spacing: 0.06em; }
  #scr-print-paper .scrp-name { font-size: 18px; font-weight: 700; color: var(--text); line-height: 1.3; }
  #scr-print-paper .scrp-meta { font-size: 11px; color: var(--text2); margin: 1px 0 6px; }
  #scr-print-paper .scrp-conf { font-size: 9.5px; color: var(--text2); border: 1px solid var(--border2); border-radius: 6px; padding: 5px 8px; margin-bottom: 10px; line-height: 1.4; }
  #scr-print-paper .scrp-note { font-size: 12px; color: var(--text2); padding: 10px 0; }
  #scr-print-paper .scrp-foot { font-size: 10px; color: var(--text3); border-top: 1px solid var(--border2); margin-top: 14px; padding-top: 6px; }
  #app-detail-modal #scr-print-paper .scr-hero,
  #app-detail-modal #scr-print-paper .scr-ws-block,
  #app-detail-modal #scr-print-paper .scr-sec,
  #app-detail-modal #scr-print-paper .scr-card,
  #app-detail-modal #scr-print-paper .scr-kpi { background: #fff; border-color: var(--border2); }
  #app-detail-modal #scr-print-paper .scr-kpi.danger { background: #fef2f2; border-color: #b91c1c; }
  #app-detail-modal #scr-print-paper .scr-kpi-grid,
  #app-detail-modal #scr-print-paper .wm-bank .scr-kpi-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  #app-detail-modal #scr-print-paper .scr-band { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  #app-detail-modal #scr-print-paper .scr-band .scr-kpi.success { border-color: #C5DEA8; }
  #app-detail-modal #scr-print-paper .scr-band .scr-kpi.flagged { border-color: #BA7517; }
  #app-detail-modal #scr-print-paper .scr-band .scr-kpi.unknown { border-color: var(--text3); }
  #app-detail-modal #scr-print-paper .scr-sec-head { cursor: default; }
  #app-detail-modal #scr-print-paper .scr-sec-summary { white-space: normal; }
  #app-detail-modal #scr-print-paper .wm-scroll { max-height: none; overflow: visible; }
  #app-detail-modal #scr-print-paper .wm-bank { -webkit-user-select: text; user-select: text; }
  #scr-print-paper .scr-kpi, #scr-print-paper .scr-kv, #scr-print-paper tr, #scr-print-paper .wm-li,
  #scr-print-paper .wm-bc, #scr-print-paper .scr-acct-row, #scr-print-paper .wm-bank-empty,
  #scr-print-paper .scrp-conf, #scr-print-paper .scr-ws-block { break-inside: avoid; }
  /* The six summary tiles stay together on one page. */
  #scr-print-paper .scr-band-wrap { break-inside: avoid; }
  #app-detail-modal #scr-print-paper .scr-ws-block { margin-bottom: 12px; }
  #scr-print-paper .scr-mini-lbl, #scr-print-paper .scr-section-lbl, #scr-print-paper .scr-sec-head,
  #scr-print-paper .wm-drill > summary { break-after: avoid; }
  /* How the copy breaks across pages. Ruby, 11 Sep 2026: "the screening summary
     ... should be on one page, and then after that it should show you the next
     information ... if it is the middle of information it should not cut off
     aggressively, it should look natural", like Weimark's own report.
     • Page one is the summary: letterhead, gauge, the recommendation line, the six
       tiles — then a new page (scrp-page-one, set only when it fits on one page).
     • After that nothing forces a new page. A box that fits in well under a page
       is never split (scrp-keep, measured by _scrPrintPaginate); a longer one
       breaks between its rows, and each part gets its own border, top and bottom,
       like Weimark's continued tables. Rows, tiles, table rows and the chart are
       never cut, and a heading never ends a page (above).
     • The applicant is a heading on paper, not one frame drawn round twenty pages. */
  #scr-print-paper .scrp-page-one { break-after: page; }
  #scr-print-paper .scrp-keep { break-inside: avoid; }
  /* The closing line goes with the last section — never alone on a last page. */
  #scr-print-paper .scrp-foot { break-before: avoid; break-inside: avoid; }
  #app-detail-modal #scr-print-paper .scr-card { -webkit-box-decoration-break: clone; box-decoration-break: clone; }
  #app-detail-modal #scr-print-paper .scr-sec { border: 0; border-radius: 0; background: none; margin: 0 0 14px; }
  #app-detail-modal #scr-print-paper .scr-sec-head { padding: 0 0 6px; margin-bottom: 12px; border-bottom: 1.5px solid var(--text); }
  #app-detail-modal #scr-print-paper .scr-sec-body { padding: 0; border-top: 0; }
  /* The recommendation line on paper: its checks read as one run of plain text
     ("Registry History: No Records Found · ..."), not a table, so page one holds it all. */
  #app-detail-modal #scr-print-paper .scr-rec { margin-bottom: 4px; background: #fff; border-color: var(--border2); }
  #app-detail-modal #scr-print-paper .scr-rec .scr-checks-grid { display: block; margin-top: 3px; padding-top: 3px; line-height: 1.55; }
  #app-detail-modal #scr-print-paper .scr-rec .scr-check-label, #app-detail-modal #scr-print-paper .scr-rec .scr-check-status { display: inline; padding: 0; border: 0; font-size: 10.5px; }
  #app-detail-modal #scr-print-paper .scr-rec .scr-check-label .lucide { display: inline-block; vertical-align: -2px; margin-right: 3px; }
  #app-detail-modal #scr-print-paper .scr-rec .scr-check-label::after { content: ":"; }
  #app-detail-modal #scr-print-paper .scr-rec .scr-check-status::after { content: "\00a0\00a0·\00a0\00a0"; color: var(--text3); font-weight: 400; }
  #app-detail-modal #scr-print-paper .scr-rec .scr-check-status:last-child::after { content: ""; }
  @media (max-width: 680px) {
    #app-detail-modal .wm-bc { padding-left: 44px; }
    #app-detail-modal .wm-bc-plot { height: 170px; }
    #app-detail-modal .wm-bc-legend { margin-left: 0; }
    #app-detail-modal .wm-bc-x.minor { display: none; }
  }
  .wm-bal-tip .wm-tip-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px; vertical-align: middle; }
  .wm-bal-tip .wm-tip-dash { border-radius: 0; height: 0; width: 10px; border-top: 2px dashed var(--text); background: none !important; }
  .wm-bal-legend2 { display: flex; gap: 14px; flex-wrap: wrap; font-size: 10.5px; color: var(--text2); margin-top: 8px; justify-content: center; }
  .wm-bal-legend2 .wm-bl-item { display: inline-flex; align-items: center; gap: 5px; }
  .wm-bal-legend2 .wm-bl-item i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
  .wm-bal-legend2 .wm-bl-item i.wm-bl-dash { width: 14px; height: 0; border-radius: 0; border-top: 2px dashed var(--text); }
  @media (max-width: 680px) { #app-detail-modal .scr-rpt-2col { grid-template-columns: 1fr; gap: 4px; } }

  /* Mini section label inside a body */
  #app-detail-modal .scr-mini-lbl {
    font-size: 10px; font-weight: 600; color: var(--text3);
    text-transform: uppercase; letter-spacing: 0.06em;
    margin: 12px 0 6px;
  }
  #app-detail-modal .scr-mini-lbl:first-child { margin-top: 0; }

  /* Credit summary stat row */
  #app-detail-modal .scr-stat-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px 18px;
    font-size: 12px;
  }
  #app-detail-modal .scr-stat-row .scr-stat {
    display: flex; justify-content: space-between;
    padding: 4px 0;
    border-bottom: 1px dashed rgba(200,220,255,0.45);
  }
  #app-detail-modal .scr-stat-row .scr-stat .l { color: var(--text2); }
  #app-detail-modal .scr-stat-row .scr-stat .v { color: var(--text); font-weight: 600; }
  #app-detail-modal .scr-stat-row .scr-stat.flag .v { color: #92400e; }

  /* Account row (credit accounts, plaid accounts, income sources) */
  #app-detail-modal .scr-acct-row {
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 12px; align-items: center;
    padding: 8px 0;
    border-bottom: 1px dashed rgba(200,220,255,0.45);
    font-size: 12px;
  }
  #app-detail-modal .scr-acct-row:last-child { border-bottom: none; }
  #app-detail-modal .scr-acct-name { color: var(--text); font-weight: 500; }
  #app-detail-modal .scr-acct-sub { color: var(--text3); font-size: 11px; }
  #app-detail-modal .scr-acct-bal {
    color: var(--text); font-family: 'DM Mono', 'SF Mono', Menlo, monospace;
    font-size: 12px; text-align: right;
  }
  #app-detail-modal .scr-acct-bal.muted { color: var(--text3); }

  /* Score reasons list */
  #app-detail-modal .scr-reason-list {
    padding-left: 16px; margin: 4px 0 0;
    font-size: 12px; color: var(--text2); line-height: 1.55;
  }

  /* Activity timeline list */
  #app-detail-modal .scr-timeline {
    display: flex; flex-direction: column; gap: 4px;
  }
  #app-detail-modal .scr-timeline-item {
    display: flex; justify-content: space-between; align-items: center; gap: 10px;
    padding: 7px 10px;
    background: rgba(255,255,255,0.45);
    border-radius: 6px;
    font-size: 12px;
  }
  #app-detail-modal .scr-timeline-item .lbl { color: var(--text); font-weight: 500; }
  #app-detail-modal .scr-timeline-item .meta { color: var(--text3); font-size: 11px; flex-shrink: 0; }

  /* "Show all" or callout buttons inside sections */
  #app-detail-modal .scr-show-all {
    width: 100%;
    margin-top: 8px;
    font-size: 11px;
    background: transparent;
  }

  /* Section that has no data — dimmed */
  #app-detail-modal .scr-sec.no-data .scr-sec-summary {
    color: var(--text3); font-style: italic;
  }
  #app-detail-modal .scr-sec.no-data .scr-sec-badge {
    background: rgba(200,220,255,0.35); color: var(--text3);
  }

  /* Combined total footer in income/plaid */
  #app-detail-modal .scr-total-row {
    display: flex; justify-content: space-between;
    padding: 10px 0 2px;
    border-top: 2px solid rgba(200,220,255,0.55);
    margin-top: 4px;
  }
  #app-detail-modal .scr-total-row .l { font-size: 12px; font-weight: 600; color: var(--text); }
  #app-detail-modal .scr-total-row .v { font-size: 13px; font-weight: 700; color: var(--text); font-family: 'DM Mono','SF Mono',Menlo,monospace; }

  /* Messages tab placeholder */
  #app-detail-modal .ad-placeholder {
    border: 1px dashed rgba(200,220,255,0.6);
    border-radius: var(--radius-lg);
    padding: 28px 20px;
    text-align: center;
    background: rgba(255,255,255,0.35);
  }
  #app-detail-modal .ad-placeholder .lucide { width: 28px; height: 28px; color: var(--text3); }
  #app-detail-modal .ad-placeholder-title { font-size: 14px; font-weight: 600; margin-top: 8px; color: var(--text); }
  #app-detail-modal .ad-placeholder-desc { font-size: 12px; color: var(--text2); margin-top: 4px; line-height: 1.5; }

  /* ── OVERVIEW TAB — REDESIGNED ─────────────────────────────────────
     The Overview pane gets:
     - Sticky deal header with badges (rent / program / agent / date)
     - Horizontal pipeline stepper replacing the stage dropdown
     - "Next up" CTA card surfacing the next concrete action
     - Deal financials KPI grid (computed from settings + rent)
     - Active checklist expanded, done ones collapsed
     - Read-only application details with Edit toggle
     - Recent activity feed
     - Action bar at the bottom with Delete in overflow menu */

  /* Deal header (replaces the existing ad-header-strip when Overview tab is active) */
  #app-detail-modal .ov-deal-header {
    padding: 4px 0 14px;
    border-bottom: 1px solid rgba(200,220,255,0.4);
    margin-bottom: 14px;
  }
  #app-detail-modal .ov-deal-top {
    display: flex; align-items: center; gap: 12px;
    margin-bottom: 10px;
  }
  #app-detail-modal .ov-avatar {
    width: 44px; height: 44px; border-radius: 50%;
    background: rgba(180,210,255,0.45);
    color: #1a3370;
    display: flex; align-items: center; justify-content: center;
    font-size: 14px; font-weight: 600; flex-shrink: 0;
    border: 1px solid rgba(200,220,255,0.55);
  }
  #app-detail-modal .ov-name {
    font-size: 17px; font-weight: 600; color: var(--text);
  }
  #app-detail-modal .ov-unit {
    font-size: 12px; color: var(--text2);
    margin-top: 2px;
    display: flex; align-items: center; gap: 6px;
  }
  #app-detail-modal .ov-unit .lucide { width: 13px; height: 13px; color: var(--text3); }
  #app-detail-modal .ov-badges {
    display: flex; gap: 6px; flex-wrap: wrap;
    margin-top: 8px;
  }
  #app-detail-modal .ov-badge {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 3px 9px; border-radius: 6px;
    font-size: 11px; font-weight: 500;
    background: rgba(255,255,255,0.5); color: var(--text2);
    border: 1px solid rgba(200,220,255,0.45);
  }
  #app-detail-modal .ov-badge .lucide { width: 11px; height: 11px; }
  #app-detail-modal .ov-badge.program {
    background: #ede9fe; color: #6b21a8; border-color: #d9d4ff;
  }
  #app-detail-modal .ov-badge.rent {
    background: #EAF3DE; color: #2C5408; border-color: #C5DEA8;
  }
  #app-detail-modal .ov-badge.s8 {
    background: #ede9fe; color: #6b21a8; border-color: #d9d4ff;
  }
  #app-detail-modal .ov-overflow-btn {
    background: transparent; border: none;
    color: var(--text2);
    width: 28px; height: 28px;
    border-radius: 6px;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    margin-left: auto;
  }
  #app-detail-modal .ov-overflow-btn:hover { background: rgba(255,255,255,0.5); }

  /* Pipeline stepper */
  #app-detail-modal .ov-stepper {
    padding: 12px 14px;
    background: rgba(255,255,255,0.35);
    border: 1px solid rgba(200,220,255,0.4);
    border-radius: var(--radius-lg);
    margin-bottom: 14px;
  }
  #app-detail-modal .ov-stepper-label {
    font-size: 10px; font-weight: 600; color: var(--text3);
    text-transform: uppercase; letter-spacing: 0.08em;
    margin-bottom: 10px;
  }
  #app-detail-modal .ov-stepper-track {
    display: flex; align-items: flex-start;
    position: relative;
  }
  #app-detail-modal .ov-step {
    flex: 1; display: flex; flex-direction: column; align-items: center;
    gap: 5px; position: relative; z-index: 1;
    cursor: pointer;
  }
  #app-detail-modal .ov-step-dot {
    width: 22px; height: 22px; border-radius: 50%;
    background: rgba(255,255,255,0.6);
    border: 1px solid rgba(200,220,255,0.55);
    display: flex; align-items: center; justify-content: center;
    font-size: 10px; color: var(--text3);
    font-weight: 600;
    transition: all 0.15s;
    /* Stack ABOVE the connector line so the line visually stops at the
       circle edge (without z-index it renders on top of the dot). */
    position: relative;
    z-index: 2;
  }
  #app-detail-modal .ov-step.done .ov-step-dot {
    background: #EAF3DE; border-color: #C5DEA8; color: #3B6D11;
  }
  #app-detail-modal .ov-step.current .ov-step-dot {
    background: rgba(180,210,255,0.85);
    border: 1.5px solid #2563EB;
    color: #1d4ed8;
    width: 26px; height: 26px;
    font-size: 11px;
  }
  #app-detail-modal .ov-step.denied .ov-step-dot {
    background: #FEE2E2; border-color: #fecaca; color: #B91C1C;
  }
  #app-detail-modal .ov-step.disabled { cursor: not-allowed; opacity: 0.5; }
  #app-detail-modal .ov-step-dot .lucide { width: 11px; height: 11px; }
  #app-detail-modal .ov-step-label {
    font-size: 9px; color: var(--text3); text-align: center;
    line-height: 1.25; max-width: 64px;
  }
  /* UI fix #45 (26 Nov 2026): the stage names under the dots were 9px. 11px, using the full width of each step. */
  #app-detail-modal .ov-step { min-width: 0; }
  /* Review fix: labels break only between words ("Incomplete / Apps", never "Incomple / te"). They take the step's
     full width; in a narrower drawer they shrink a little, and where even that is too tight (a phone) the eight
     steps sit in two rows of four, so every word fits whole. */
  #app-detail-modal .ov-step-label { font-size: 11px; max-width: 100%; padding: 0; box-sizing: border-box;
    white-space: normal; overflow-wrap: normal; word-break: normal; hyphens: manual; }
  #app-detail-modal .ov-stepper { container-type: inline-size; }
  @container (max-width: 520px) {
    #app-detail-modal .ov-step-label { font-size: 10.5px; letter-spacing: -0.01em; }
  }
  @container (max-width: 470px) {
    #app-detail-modal .ov-stepper-track { flex-wrap: wrap; row-gap: 14px; }
    #app-detail-modal .ov-step { flex: 0 0 25%; }
    #app-detail-modal .ov-step-label { font-size: 11px; letter-spacing: 0; }
    #app-detail-modal .ov-step:nth-child(4) .ov-step-connector { display: none; }
  }
  #app-detail-modal .ov-stepper-label { font-size: 11px; }
  /* An empty date field reads "Pick a date" instead of the browser's raw "mm/dd/yyyy". */
  #app-detail-modal .ad-date { position: relative; display: block; }
  #app-detail-modal .ad-date.is-empty > input { color: transparent; }
  /* Dark mode paints drawer inputs with color !important; without this, "mm/dd/yyyy" showed through "Pick a date". */
  html body #app-detail-modal .ad-date.is-empty > input { color: transparent !important; }
  #app-detail-modal .ad-date.is-empty::after {
    content: attr(data-ph); position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
    font-size: 12px; color: var(--text3); pointer-events: none;
  }
  #app-detail-modal .ov-step.current .ov-step-label { color: #1d4ed8; font-weight: 600; }
  #app-detail-modal .ov-step.done .ov-step-label { color: var(--text2); }
  #app-detail-modal .ov-step.denied .ov-step-label { color: #B91C1C; font-weight: 600; }
  #app-detail-modal .ov-step.lost .ov-step-dot { background: #f1f5f9; border-color: #cbd5e1; color: #475569; }
  #app-detail-modal .ov-step.lost .ov-step-label { color: #475569; font-weight: 600; }
  #app-detail-modal .ov-step-connector {
    position: absolute; top: 11px; left: 50%; right: -50%;
    height: 1px;
    background: rgba(200,220,255,0.55);
    z-index: 0;
  }
  #app-detail-modal .ov-step.done .ov-step-connector { background: #C5DEA8; }
  #app-detail-modal .ov-step:last-child .ov-step-connector { display: none; }

  /* Next up CTA */
  #app-detail-modal .ov-next {
    background: rgba(255,255,255,0.5);
    border: 1px solid rgba(200,220,255,0.55);
    border-left: 3px solid #2563EB;
    border-radius: var(--radius);
    padding: 12px 14px;
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
  }
  #app-detail-modal .ov-next.done {
    border-left-color: #3B6D11;
  }
  #app-detail-modal .ov-next-text { flex: 1; min-width: 0; }
  #app-detail-modal .ov-next-label {
    font-size: 10px; font-weight: 600;
    color: #1d4ed8;
    text-transform: uppercase; letter-spacing: 0.08em;
    margin-bottom: 3px;
  }
  #app-detail-modal .ov-next.done .ov-next-label { color: #3B6D11; }
  #app-detail-modal .ov-next.bad { border-left-color: #b91c1c; }
  #app-detail-modal .ov-next.bad .ov-next-label { color: #b91c1c; }
  #app-detail-modal .ov-next-title {
    font-size: 14px; font-weight: 600; color: var(--text);
  }
  #app-detail-modal .ov-next-sub {
    font-size: 12px; color: var(--text2); margin-top: 2px;
  }
  #app-detail-modal .ov-next .btn {
    flex-shrink: 0;
  }

  /* Section header */
  #app-detail-modal .ov-section { margin-bottom: 14px; }
  #app-detail-modal .ov-section-head {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 8px;
  }
  #app-detail-modal .ov-section-label {
    font-size: 10px; font-weight: 600; color: var(--text3);
    text-transform: uppercase; letter-spacing: 0.08em;
  }
  #app-detail-modal .ov-section-meta {
    font-size: 11px; color: var(--text3);
  }

  /* Financials grid — always 2×2 (matches mockup) */
  #app-detail-modal .ov-fin-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }
  #app-detail-modal .ov-fin {
    background: rgba(255,255,255,0.5);
    border: 1px solid rgba(200,220,255,0.4);
    border-radius: var(--radius);
    padding: 10px 12px;
  }
  #app-detail-modal .ov-fin-label {
    font-size: 10px; color: var(--text2);
    display: flex; align-items: center; gap: 4px;
    margin-bottom: 3px;
  }
  #app-detail-modal .ov-fin-label .lucide { width: 12px; height: 12px; color: var(--text3); }
  #app-detail-modal .ov-fin-value {
    font-size: 17px; font-weight: 700; color: var(--text);
    line-height: 1.2;
  }
  #app-detail-modal .ov-fin-sub {
    font-size: 11px; color: var(--text3); margin-top: 3px;
  }
  #app-detail-modal .ov-fin-sub.success { color: #3B6D11; }
  #app-detail-modal .ov-fin-sub.warn { color: #92400e; }

  /* Checklist cards in new style */
  #app-detail-modal .ov-checklist {
    background: rgba(255,255,255,0.5);
    border: 1px solid rgba(200,220,255,0.4);
    border-radius: var(--radius);
    margin-bottom: 6px;
    overflow: hidden;
  }
  #app-detail-modal .ov-checklist.active {
    border-color: rgba(37,99,235,0.45);
    border-left: 3px solid #2563EB;
  }
  #app-detail-modal .ov-checklist.done { opacity: 0.75; }
  #app-detail-modal .ov-checklist-head {
    padding: 10px 14px;
    display: flex; align-items: center; gap: 8px;
    cursor: pointer;
    user-select: none;
  }
  #app-detail-modal .ov-checklist-head > .lucide { width: 16px; height: 16px; color: var(--text2); flex-shrink: 0; }
  #app-detail-modal .ov-checklist.active .ov-checklist-head > .lucide { color: #1d4ed8; }
  #app-detail-modal .ov-checklist.done .ov-checklist-head > .lucide { color: #3B6D11; }
  #app-detail-modal .ov-checklist-title {
    font-size: 13px; font-weight: 600; color: var(--text);
    flex: 1; min-width: 0;
  }
  #app-detail-modal .ov-checklist-pill {
    background: rgba(255,255,255,0.6);
    color: var(--text3);
    font-size: 10px; font-weight: 600;
    padding: 2px 9px; border-radius: 999px;
    margin-left: 8px;
  }
  #app-detail-modal .ov-checklist.active .ov-checklist-pill {
    background: rgba(180,210,255,0.65); color: #1d4ed8;
  }
  #app-detail-modal .ov-checklist-progress {
    width: 32px; height: 3px;
    background: rgba(200,220,255,0.45);
    border-radius: 999px; overflow: hidden;
  }
  #app-detail-modal .ov-checklist-progress-fill {
    height: 100%; background: #2563EB;
  }
  #app-detail-modal .ov-checklist.done .ov-checklist-progress-fill { background: #3B6D11; }
  #app-detail-modal .ov-checklist-ring {
    font-size: 11px; color: var(--text3); font-weight: 500;
  }
  #app-detail-modal .ov-checklist.active .ov-checklist-ring { color: #1d4ed8; }
  #app-detail-modal .ov-checklist.done .ov-checklist-ring { color: #3B6D11; }
  #app-detail-modal .ov-checklist-chev {
    width: 14px; height: 14px; color: var(--text3);
    transition: transform 0.15s;
  }
  #app-detail-modal .ov-checklist.open .ov-checklist-chev { transform: rotate(180deg); }
  #app-detail-modal .ov-checklist-body {
    display: none;
    padding: 6px 14px 12px;
    border-top: 1px solid rgba(200,220,255,0.35);
  }
  #app-detail-modal .ov-checklist.open .ov-checklist-body { display: block; }

  /* Details (collapsed read-only card) */
  /* Each tour (and each thing Pace sent) is its own card. Run together as plain
     rows, a person with three tours read as one paragraph and you had to parse
     the dot separators to see where one ended and the next began. Same glass as
     .ov-details-card so the drawer stays one surface. */
  #app-detail-modal .ov-tour-details { display: flex; flex-direction: column; gap: 8px; }
  #app-detail-modal .ov-tour-row {
    background: rgba(255,255,255,0.5);
    border: 1px solid rgba(200,220,255,0.4);
    border-radius: var(--radius);
    padding: 9px 12px;
  }
  #app-detail-modal .ov-tour-addr { font-size: 13px; font-weight: 600; color: var(--text); }
  #app-detail-modal .ov-tour-meta { font-size: 12px; color: var(--text2); margin-top: 3px; }
  #app-detail-modal .ov-details-card {
    background: rgba(255,255,255,0.5);
    border: 1px solid rgba(200,220,255,0.4);
    border-radius: var(--radius);
    padding: 4px 14px;
  }
  #app-detail-modal .ov-details-row {
    display: flex; justify-content: space-between; align-items: center;
    padding: 8px 0;
    border-bottom: 1px dashed rgba(200,220,255,0.4);
    font-size: 12px;
  }
  #app-detail-modal .ov-details-row:last-child { border-bottom: none; }
  #app-detail-modal .ov-details-key {
    display: flex; align-items: center; gap: 6px;
    color: var(--text2);
  }
  #app-detail-modal .ov-details-key .lucide { width: 13px; height: 13px; color: var(--text3); }
  #app-detail-modal .ov-details-val { color: var(--text); font-weight: 500; }
  /* Lease ready to review (leasePrepAfterRender): reuses .ov-details-card / .ov-details-row,
     greys only; the source of each value is quiet text, a missing field is plain text too. */
  #app-detail-modal .lprep-tpl { font-size: 12px; color: var(--text2); padding: 8px 0; border-bottom: 1px dashed var(--border); }
  #app-detail-modal .lprep-row .ov-details-key { flex-shrink: 0; }
  #app-detail-modal .lprep-row .ov-details-val { display: flex; align-items: baseline; justify-content: flex-end; gap: 8px; min-width: 0; text-align: right; }
  #app-detail-modal .lprep-src { font-size: 11px; font-weight: 400; color: var(--text3); white-space: nowrap; }
  #app-detail-modal .lprep-sub { font-size: 10px; font-weight: 600; color: var(--text3); text-transform: uppercase; letter-spacing: 0.08em; margin: 12px 0 4px; }
  #app-detail-modal .lprep-miss { display: flex; flex-direction: column; }
  #app-detail-modal .lprep-miss-row { display: flex; flex-direction: column; gap: 4px; padding: 4px 0; font-size: 12px; }
  #app-detail-modal .lprep-miss-label { color: var(--text); font-weight: 500; }
  #app-detail-modal .lprep-miss-why, #app-detail-modal .lprep-ask-why { font-size: 11px; color: var(--text3); }
  #app-detail-modal .lprep-ask { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; padding: 8px 12px; border-radius: 8px; background: rgba(68,64,60,0.04); border: 1px solid var(--border); }
  [data-theme="dark"] #app-detail-modal .lprep-ask { background: rgba(255,255,255,0.04); }
  #app-detail-modal .lprep-ask-text { font-size: 12px; color: var(--text); line-height: 1.45; }
  #app-detail-modal .lprep-actions { display: flex; gap: 8px; margin-top: 12px; }
  #app-detail-modal .lprep-actions .btn { flex: 1 1 0; justify-content: center; }
  #app-detail-modal .lprep-note { font-size: 11px; color: var(--text3); padding: 8px 0; }
  #app-detail-modal .lprep-why { font-size: 12px; color: var(--text2); padding: 8px 0; }
  #app-detail-modal .lprep-picks { display: flex; flex-wrap: wrap; gap: 8px; padding-bottom: 8px; }
  /* Editing variant of the details card — same translucent glass as the
     read-only .ov-details-card / .ov-fin cards so it blends on the drawer
     glass in BOTH light and dark mode. (Previously reused .ud-section, which
     the global `[data-theme="dark"] .ud-section{background:var(--bg)}` rule
     paints solid — and inside the drawer var(--bg) is forced to #fff, so it
     rendered as an opaque white block instead of glass.) */
  #app-detail-modal .ov-edit-card {
    background: rgba(255,255,255,0.5);
    border: 1px solid rgba(200,220,255,0.4);
    border-radius: var(--radius);
    padding: 14px;
  }
  #app-detail-modal .ov-edit-card .app-detail-grid:last-child { margin-bottom: 0; }
  /* Note: avoid the bare `.empty` class — it collides with a global
     empty-state style (padding: 60px 24px, white background). */
  #app-detail-modal .ov-details-val-empty {
    color: var(--text3); font-style: italic; font-weight: 400;
    cursor: pointer;
    background: transparent;
    padding: 0;
    font-size: 12px;
    display: inline-flex;
    align-items: center;
    gap: 3px;
  }
  #app-detail-modal .ov-details-val-empty:hover { color: var(--text); text-decoration: underline; }

  /* Activity feed */
  #app-detail-modal .ov-activity-card {
    background: rgba(255,255,255,0.5);
    border: 1px solid rgba(200,220,255,0.4);
    border-radius: var(--radius);
    padding: 4px 14px;
  }
  #app-detail-modal .ov-activity-item {
    display: flex; gap: 10px;
    padding: 8px 0;
    font-size: 12px;
    border-bottom: 1px dashed rgba(200,220,255,0.4);
  }
  #app-detail-modal .ov-activity-item:last-child { border-bottom: none; }
  #app-detail-modal .ov-activity-dot {
    width: 6px; height: 6px;
    border-radius: 50%;
    background: var(--text3);
    margin-top: 7px;
    flex-shrink: 0;
  }
  #app-detail-modal .ov-activity-dot.current { background: #2563EB; }
  #app-detail-modal .ov-activity-content { flex: 1; min-width: 0; }
  #app-detail-modal .ov-activity-text {
    color: var(--text2);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  #app-detail-modal .ov-activity-text strong {
    color: var(--text); font-weight: 600;
  }
  #app-detail-modal .ov-activity-time {
    font-size: 11px; color: var(--text3); margin-top: 1px;
  }
  #app-detail-modal .ov-activity-empty {
    padding: 16px; text-align: center;
    font-size: 12px; color: var(--text3); font-style: italic;
  }

  /* Overflow menu — appended to document.body (NOT inside #app-detail-modal),
     so these selectors must be un-scoped or they never apply; position:fixed
     because the coords come from getBoundingClientRect; z-index above the
     drawer/modals (which top out ~2620). */
  .ov-menu {
    position: fixed;
    background: var(--bg);
    border: 1px solid var(--border2);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 4px;
    min-width: 180px;
    z-index: 3000;
  }
  .ov-menu-item {
    display: flex; align-items: center; gap: 8px;
    padding: 8px 12px;
    font-size: 13px; color: var(--text);
    cursor: pointer;
    border-radius: 4px;
    border: none; background: transparent; width: 100%;
    box-sizing: border-box;
    text-align: left; text-decoration: none;
    font-family: inherit;
  }
  .ov-menu-item:hover { background: var(--bg2); }
  .ov-menu-item.danger { color: var(--danger, #B91C1C); }
  .ov-menu-item .lucide { width: 14px; height: 14px; }
  .ov-menu-head { padding: 6px 12px 4px; font-size: 11.5px; font-weight: 600; color: var(--text2); }
  .ov-menu-note { padding: 4px 12px 8px; font-size: 12.5px; line-height: 1.4; color: var(--text2); max-width: 240px; }

  /* Small "Edit" link in section headers */
  #app-detail-modal .ov-edit-link {
    font-size: 11px; color: var(--text3);
    background: none; border: none; padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer; font-family: inherit;
    display: inline-flex; align-items: center; gap: 4px;
  }
  #app-detail-modal .ov-edit-link:hover { background: rgba(255,255,255,0.5); color: var(--text); }
  #app-detail-modal .ov-edit-link .lucide { width: 12px; height: 12px; }

  /* ── APPLICANT DRAWER — DARK MODE ───────────────────────────────────────
     The drawer's rules above paint translucent white tiles, pale-blue borders and navy
     text for the light panel. On the dark navy glass those read as washed-out grey
     slabs and dark-on-dark text. Restated from the theme tokens; light mode is untouched. */
  [data-theme="dark"] #app-detail-modal .scr-hero,
  [data-theme="dark"] #app-detail-modal .scr-rec,
  [data-theme="dark"] #app-detail-modal .scr-report,
  [data-theme="dark"] #app-detail-modal .scr-activity,
  [data-theme="dark"] #app-detail-modal .scr-empty-card,
  [data-theme="dark"] #app-detail-modal .scr-progress,
  [data-theme="dark"] #app-detail-modal .scr-checks-details,
  [data-theme="dark"] #app-detail-modal .scr-ws-block,
  [data-theme="dark"] #app-detail-modal .scr-kpi,
  [data-theme="dark"] #app-detail-modal .scr-sec,
  [data-theme="dark"] #app-detail-modal .scr-card,
  [data-theme="dark"] #app-detail-modal .scr-timeline-item,
  [data-theme="dark"] #app-detail-modal .ad-placeholder,
  [data-theme="dark"] #app-detail-modal .ov-stepper,
  [data-theme="dark"] #app-detail-modal .ov-next,
  [data-theme="dark"] #app-detail-modal .ov-fin,
  [data-theme="dark"] #app-detail-modal .ov-checklist,
  [data-theme="dark"] #app-detail-modal .ov-tour-row,
  [data-theme="dark"] #app-detail-modal .ov-details-card,
  [data-theme="dark"] #app-detail-modal .ov-edit-card,
  [data-theme="dark"] #app-detail-modal .ov-activity-card {
    background: rgba(255,255,255,0.04); border-color: var(--border); box-shadow: none;
  }
  [data-theme="dark"] #app-detail-modal .ad-chip,
  [data-theme="dark"] #app-detail-modal .ov-badge,
  [data-theme="dark"] #app-detail-modal .ov-checklist-pill,
  [data-theme="dark"] #app-detail-modal .ov-step-dot {
    background: rgba(255,255,255,0.06); border-color: var(--border2); color: var(--text2);
  }
  /* Head, title and close button. Declared here, outside the desktop-only media block, so the
     phone sheet gets them too: its title is a native <input> and falls back to black without a colour. */
  [data-theme="dark"] #app-detail-modal .modal-head, [data-theme="dark"] #app-detail-modal .modal-footer { background: transparent; border-color: var(--border); }
  [data-theme="dark"] #app-detail-modal .modal-title { color: var(--text); background: transparent; }
  [data-theme="dark"] #app-detail-modal .modal-title::placeholder { color: var(--text3); }
  [data-theme="dark"] #app-detail-modal .modal-x { color: var(--text); background: rgba(255,255,255,0.06); border-color: var(--border2); }
  [data-theme="dark"] #app-detail-modal .modal-x:hover { background: rgba(255,255,255,0.12); }
  [data-theme="dark"] #app-detail-modal .ov-badge.program { background: var(--accent-soft); color: var(--accent); }
  [data-theme="dark"] #app-detail-modal .ad-tab.active { color: var(--text); border-bottom-color: var(--accent); }
  [data-theme="dark"] #app-detail-modal .ad-tabs, [data-theme="dark"] #app-detail-modal .ad-header-strip { border-bottom-color: var(--border); }
  [data-theme="dark"] #app-detail-modal .ov-overflow-btn:hover, [data-theme="dark"] #app-detail-modal .ov-edit-link:hover { background: rgba(255,255,255,0.08); }
  [data-theme="dark"] .toggle-label { color: var(--text2) !important; }
  [data-theme="dark"] .toggle-label.active-label { color: var(--text) !important; }

  /* ── LISTING MODAL TAB BAR ── */
  .lm-tabs {
    display: flex; gap: 0; border-bottom: 1px solid var(--border);
    padding: 0 20px; margin-top: 6px; flex-shrink: 0;
  }
  .lm-tab {
    padding: 6px 16px; font-size: 13px; font-family: 'DM Sans', sans-serif;
    cursor: pointer; border: none; background: none;
    color: var(--text2); border-bottom: 2px solid transparent;
    margin-bottom: -1px; transition: all 0.15s; font-weight: 500;
  }
  .lm-tab.active { color: var(--navy); border-bottom-color: var(--navy); }
  .lm-tab:hover:not(.active) { color: var(--text); }

  /* ── COVER PHOTO TAB ── */
  .uc-pane { display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; }
  .uc-preview {
    width: 240px; height: 176px; flex: 0 0 auto; position: relative;
    border-radius: var(--radius-lg); background: var(--bg3);
    border: 1px solid var(--border2); overflow: hidden; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: border-color 0.15s, background 0.15s;
  }
  .uc-preview:hover { border-color: var(--accent); }
  .uc-preview img { width: 100%; height: 100%; object-fit: cover; display: block; }
  .uc-preview-empty { flex-direction: column; gap: 6px; color: var(--text3); font-size: 12px; text-align: center; padding: 0 16px; }
  /* Children must not swallow the drag events, or dragleave fires constantly.
     lucide swaps the <i> for an <svg>, so both need covering. */
  .uc-preview > i, .uc-preview > svg, .uc-preview > span, .uc-preview > img { pointer-events: none; }
  .uc-preview.over { border-color: var(--accent); border-style: dashed; background: var(--accent-soft); }
  .uc-preview.over img { opacity: 0.25; }
  /* The resting content would otherwise show through behind the drop hint. */
  .uc-preview.over > i, .uc-preview.over > svg,
  .uc-preview.over > span:not(.uc-drop-hint) { visibility: hidden; }
  .uc-drop-hint {
    position: absolute; inset: 0; display: none;
    align-items: center; justify-content: center;
    font-size: 12.5px; font-weight: 600; color: var(--accent);
  }
  .uc-preview.over .uc-drop-hint { display: flex; }
  .uc-side { flex: 1 1 200px; min-width: 0; display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
  .uc-src { font-size: 12px; font-weight: 600; color: var(--text2); }
  .uc-src-ok { color: var(--text); }
  .uc-note { font-size: 12px; color: var(--text2); line-height: 1.45; }
  .uc-addr-check { font-size: 12px; color: var(--text2); line-height: 1.45; padding: 8px 0 0; }
  .uc-addr-check b { color: var(--text); font-weight: 600; }
  .uc-up { cursor: pointer; }
  .uc-next {
    margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border);
    display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  }
  .uc-next-count { font-size: 12px; color: var(--text2); }
  @media (max-width: 560px) { .uc-preview { width: 100%; height: 200px; } }

  /* ── EDIT FORM GRID ── */
  .ef-grid {
    display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
  }
  .ef-grid .ef-full { grid-column: 1 / -1; }
  .ef-section-title {
    font-size: 10px; font-weight: 600; color: var(--text3);
    text-transform: uppercase; letter-spacing: 0.1em;
    margin-top: 18px; margin-bottom: 10px; grid-column: 1 / -1;
    display: flex; align-items: center; gap: 8px;
  }
  .ef-section-title::after {
    content: ''; flex: 1; height: 1px; background: var(--border);
  }
  /* SENSITIVE — internal-only fields, grouped so the boundary is visible to the
     person typing. This is the VISIBLE half of a rule enforced in the database:
     `lockbox` and `notes` are not granted to the public (anon) key, are absent
     from Pace's unit query, and are absent from the syndication feed.
     WHY IT EXISTS. The danger was never the lockbox FIELD — it was a door code
     landing in a renter-facing one. A real manager's sheet (Roseville Ave) puts
     the keypad code on a building banner row, and the importer filed it under
     Washer/Dryer, which IS public on a published listing. Naming the safe drawer
     is how anyone — or the sheet importer — knows which drawer to use.
     Colour is checked against the modal glass at both ends of its gradient
     (8.3:1 top, 5.2:1 bottom). Don't lighten it without re-checking. */
  .ef-section-title.ef-sensitive { color: #7A2E08; }
  .ef-section-title.ef-sensitive::after { background: rgba(122,46,8,0.22); }
  .ef-sensitive-note {
    grid-column: 1 / -1; margin: -6px 0 10px;
    font-size: 11px; line-height: 1.55; color: #7A2E08;
  }
  .form-textarea {
    padding: 8px 12px; font-size: 13px; font-family: 'DM Sans', sans-serif;
    border: 1px solid var(--border2); border-radius: var(--radius);
    background: var(--bg); color: var(--text); outline: none;
    resize: vertical; min-height: 64px; width: 100%;
  }
  .form-textarea:focus { border-color: var(--navy); }

  /* ── TENANT CARD ── */
  .tc {
    background: var(--bg2); border-radius: var(--radius-lg);
    padding: 8px; margin-bottom: 6px;
  }
  .tc-addr { font-size: 15px; font-weight: 500; margin-bottom: 0; }
  .tc-meta { font-size: 12px; color: var(--text2); margin-bottom: 6px; display: flex; align-items: center; gap: 8px; }
  .tc-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; }
  .tc-lbl { font-size: 10px; color: var(--text3); text-transform: uppercase; letter-spacing: 0.05em; }
  .tc-val { font-size: 13px; font-weight: 500; margin-top: 0; }
  .divider { border: none; border-top: 1px solid var(--border); margin: 5px 0; }
  .tc-contact { font-size: 12px; color: var(--text3); text-align: center; }

  /* ── STATUS EDIT FORM ── */
  .form-group { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; }
  .form-label { font-size: 12px; font-weight: 500; color: var(--text2); }
  .form-input {
    padding: 8px 12px; font-size: 13px; font-family: 'DM Sans', sans-serif;
    border: 1px solid var(--border2); border-radius: var(--radius);
    background: var(--bg); color: var(--text); outline: none;
  }
  .form-input:focus { border-color: var(--navy); }

  /* ── MODAL BUTTONS ── */
  .btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 14px; font-size: 13px; font-family: 'DM Sans', sans-serif;
    font-weight: 500; letter-spacing: -0.01em;
    border: 1px solid var(--border2); border-radius: var(--radius);
    background: var(--bg); color: var(--text); cursor: pointer;
    transition: background 0.12s, border-color 0.12s, transform 0.12s;
    box-shadow: var(--shadow-xs);
  }
  .btn:hover { background: var(--bg2); border-color: rgba(68,64,60,0.3); }
  .btn:active { transform: translateY(0.5px); }
  /* No pointer-events:auto here — buttons are pointer-events:auto by default, so
     cursor:not-allowed still shows on visible disabled buttons. Forcing `auto`
     made a disabled button inside a CLOSED, centered .tasks-drawer modal (which is
     pointer-events:none) hit-testable, so it floated invisibly over screen-center
     and stole clicks from whatever modal was actually open (e.g. #esign-void-ok
     blocking the Send-for-Signing confirm button). */
  .btn:disabled { opacity: 0.4; cursor: not-allowed; }
  .btn-primary {
    background: var(--navy); color: #fff; border-color: var(--navy);
    box-shadow: var(--shadow-sm), inset 0 1px 0 rgba(255,255,255,0.1);
  }
  .btn-primary:hover { background: var(--navy2); border-color: var(--navy2); }

  /* ── APPLICATIONS KPI CHIPS ── */
  .app-kpi {
    padding: 4px 12px; border-radius: 20px; font-size: 12px; font-weight: 500;
    background: var(--bg2); color: var(--text2); border: 1px solid var(--border);
    white-space: nowrap;
  }
  .app-kpi-pending { background: #fef3e2; color: #854F0B; border-color: #f5d9a0; }
  .app-kpi-approved { background: #e8f5e2; color: #2d6a1f; border-color: #b8dda8; }
  .app-kpi-denied { background: #fdecea; color: #a32d2d; border-color: #f5b8b8; }
