/* Applications, part 2: the kanban board and its cards, and the applicant detail blocks (checklist, documents,
   funding, duplicates strip). Split #8 of index.html: moved unchanged and linked at the exact spot it used to sit. */
  /* ── KANBAN ── */
  .kanban-wrap {
    flex: 1; display: flex; overflow-x: auto; overflow-y: hidden;
    padding: 22px 0; gap: 14px; align-items: flex-start;
    /* Left & right edges line up with the floating header card (margin:10px 22px 0),
       so the board cuts off exactly under the header on BOTH sides and columns
       scroll/fade past those lines (tiles unchanged, not shrunk). */
    margin-left: 22px; margin-right: 22px;
    background: var(--bg2);
    position: relative;
    /* Soft edge fade: columns dissolve to clear at the (header-aligned) board edges
       instead of a hard chop. Paint-only mask — does NOT touch the margins above, so
       the alignment is unchanged. Fade widths are driven by _kanbanEdgeFade() so a
       side fades only when there's more to scroll that way (first/last column stays
       crisp at rest). */
    --kb-fade-l: 0px; --kb-fade-r: 40px;
    -webkit-mask-image: linear-gradient(to right, transparent 0, #000 var(--kb-fade-l), #000 calc(100% - var(--kb-fade-r)), transparent 100%);
            mask-image: linear-gradient(to right, transparent 0, #000 var(--kb-fade-l), #000 calc(100% - var(--kb-fade-r)), transparent 100%);
  }
  .kanban-wrap::after {
    content: ''; pointer-events: none;
    position: sticky; right: 0; top: 0; bottom: 0;
    width: 48px; flex-shrink: 0;
    background: linear-gradient(to right, transparent, var(--bg2));
    margin-left: -48px;
  }
  .kanban-col {
    flex-shrink: 0; width: 176px; display: flex; flex-direction: column;
    min-height: 200px; max-height: 100%; height: 100%;
  }
  .kanban-col-header {
    display: flex; align-items: center; justify-content: flex-start; gap: 6px;
    padding: 0 2px 8px; margin-bottom: 4px;
  }
  .kanban-col-title {
    font-size: 11px; font-weight: 600; text-transform: uppercase;
    letter-spacing: 0.08em; color: var(--text2);
  }
  .kanban-col-count {
    font-size: 11px; font-family: 'DM Mono', monospace;
    background: rgba(26,26,46,0.08); color: var(--text2);
    padding: 1px 8px; border-radius: 20px; border: 1px solid var(--border2);
  }
  .kanban-cards {
    display: flex; flex-direction: column; gap: 8px;
    min-height: 120px; padding: 8px;
    background: rgba(26,26,46,0.03);
    border: 1px solid var(--border2);
    border-radius: var(--radius-lg);
    transition: border-color 0.15s, background 0.15s;
    flex: 1; overflow-y: auto; overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: rgba(26,26,46,0.25) transparent;
  }
  .kanban-cards::-webkit-scrollbar { width: 6px; }
  .kanban-cards::-webkit-scrollbar-track { background: transparent; }
  .kanban-cards::-webkit-scrollbar-thumb { background: rgba(26,26,46,0.2); border-radius: 3px; }
  .kanban-cards::-webkit-scrollbar-thumb:hover { background: rgba(26,26,46,0.35); }
  .kanban-cards.drag-over {
    border-color: rgba(37,99,235,0.4);
    background: rgba(37,99,235,0.04);
  }
  /* Empty column: show a quiet hint instead of a blank drop-zone that reads as broken. */
  .kanban-cards:has(> .kanban-empty) { align-items: center; justify-content: center; }
  .kanban-empty {
    color: var(--text3); font-size: 11px; font-style: italic;
    text-align: center; padding: 0 8px;
  }
  /* Glass navy card */
  .kanban-card {
    position: relative; overflow: hidden;
    flex-shrink: 0;
    height: 120px;
    box-sizing: border-box;
    background: #ffffff;
    border: 1px solid rgba(0,0,0,0.08);
    border-radius: var(--radius-lg); padding: 10px 11px;
    cursor: grab;
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.15s;
    user-select: none;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06), 0 2px 8px rgba(0,0,0,0.04);
  }
  .kanban-card .kc-tags, .kanban-card .kc-meta-row { flex-wrap: nowrap; overflow: hidden; }
  .kanban-card::before { display: none; }
  .kanban-card:hover {
    transform: translateY(-2px);
    border-color: rgba(0,0,0,0.13);
    box-shadow: 0 4px 16px rgba(0,0,0,0.10);
  }
  .kanban-card.dragging { opacity: 0.45; cursor: grabbing; transform: scale(0.97); }
  .kc-name { font-size: 11px; font-weight: 600; color: #1a2f5c; margin-bottom: 3px; }
  /* A merged application: one line — first person, then "+N more". */
  .kc-name.kc-name-group { display: flex; align-items: baseline; gap: 6px; min-width: 0; white-space: nowrap; }
  .kc-name-group .kc-name-primary { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
  .kc-name-group .kc-name-more { flex: none; font-weight: 500; opacity: .6; font-size: .86em; }
  .kc-unit { font-size: 9px; color: rgba(26,47,92,0.55); margin-bottom: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .kc-tags { display: flex; flex-wrap: wrap; gap: 3px; margin-bottom: 6px; }
  .kc-tag {
    font-size: 8px; font-weight: 500; padding: 2px 6px; border-radius: 20px;
    background: rgba(26,47,92,0.07); color: rgba(26,47,92,0.60);
    border: 1px solid rgba(26,47,92,0.12);
  }
  .kc-tag-s8  { background: rgba(22,163,74,0.10);  color: #15803d; border-color: rgba(22,163,74,0.22); }
  .kc-tag-rta { background: rgba(37,99,235,0.10);  color: #1d4ed8; border-color: rgba(37,99,235,0.22); }
  .kc-tag-mkt { background: rgba(26,47,92,0.07); color: rgba(26,47,92,0.55); border-color: rgba(26,47,92,0.12); }
  .kc-tag-tasks   { background: rgba(217,119,6,0.10); color: #b45309; border-color: rgba(217,119,6,0.22); }
  .kc-tag-new     { background: rgba(22,163,74,0.12);  color: #15803d; border-color: rgba(22,163,74,0.24); }
  .kc-tag-weimark { background: rgba(124,58,237,0.10); color: #6d28d9; border-color: rgba(124,58,237,0.22); }
  .kc-tag-follow  { background: rgba(100,116,139,0.10); color: #475569; border-color: rgba(100,116,139,0.22); }
  .kc-tag-overdue { background: rgba(220,38,38,0.10);  color: #dc2626; border-color: rgba(220,38,38,0.22); font-weight: 600; }
  /* Kanban card tags — no pill, just plain text labels */
  .kanban-card .kc-tag { background: none; border: none; padding: 0; border-radius: 0; }

  /* ── Duplicate reviewer (one pair at a time, inside the glass .tasks-drawer) ──
     The drawer is light glass in light mode only; in dark mode it is the shared dark glass and the
     dark-sweep-2 block at the end of the sheet restates these cards with theme tokens. */
  .dup-rev-bar-track { height: 2px; background: rgba(26,47,92,0.12); border-radius: 2px; overflow: hidden; margin-bottom: 14px; }
  .dup-rev-bar { height: 2px; background: #2563eb; transition: width .25s ease; }
  .dup-rev-count { font-size: 11px; font-weight: 600; color: #2c4a86; background: rgba(255,255,255,0.55); padding: 3px 10px; border-radius: 20px; }
  .dup-rev-reason { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 4px 11px; border-radius: 20px; background: rgba(37,99,235,0.12); color: #1d4ed8; }
  .dup-rev-reason.weak { background: rgba(100,116,139,0.16); color: #475569; }
  .dup-rev-reason .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
  .dup-pair { display: flex; gap: 12px; align-items: stretch; }
  .dup-pc { flex: 1; min-width: 0; cursor: pointer; background: rgba(255,255,255,0.78); border: 1.5px solid rgba(26,47,92,0.14); border-radius: 12px; padding: 12px 13px; transition: opacity .15s, border-color .15s, box-shadow .15s; }
  .dup-pc.keep { border-color: #2563eb; box-shadow: 0 0 0 2px rgba(37,99,235,0.25); }
  .dup-pc.drop { opacity: 0.6; }
  .dup-pc-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 7px; gap: 6px; }
  .dup-pc-pill { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.4px; padding: 2px 8px; border-radius: 20px; white-space: nowrap; }
  .dup-pc-pill.keep { background: rgba(37,99,235,0.14); color: #1d4ed8; }
  .dup-pc-pill.drop { background: rgba(220,38,38,0.12); color: #b91c1c; }
  .dup-pc-date { font-size: 11px; color: #7185a8; }
  .dup-pc-name { font-size: 14px; font-weight: 600; color: #1a2f5c; line-height: 1.3; }
  .dup-pc-sub { font-size: 12px; color: #5a6b8c; margin: 2px 0 8px; }
  .dup-pc-row { font-size: 11px; color: #5a6b8c; margin-bottom: 5px; display: flex; align-items: center; gap: 5px; }
  .dup-pc-row i { width: 13px; height: 13px; flex-shrink: 0; }
  .dup-pc-tags { display: flex; gap: 5px; flex-wrap: wrap; margin-bottom: 7px; }
  .dup-pc-tag { font-size: 10px; font-weight: 500; padding: 2px 7px; border-radius: 20px; background: rgba(26,47,92,0.07); color: #3f567f; }
  .dup-rev-note { font-size: 12px; color: #5a6b8c; text-align: center; margin: 12px 0 2px; line-height: 1.5; }
  .dup-rev-empty { text-align: center; padding: 24px 12px; }
  .dup-rev-empty .ico { width: 46px; height: 46px; border-radius: 50%; background: rgba(34,197,94,0.16); color: #16a34a; display: inline-flex; align-items: center; justify-content: center; margin-bottom: 12px; }
  @media (max-width: 768px) { .dup-pair { flex-direction: column; } }

  /* In-card duplicate strip (lives in #app-detail-modal .modal, which DOES have dark tokens) */
  .ad-dup-strip { display: flex; align-items: center; gap: 9px; margin: 10px 0 0; padding: 9px 12px; border-radius: 10px; background: rgba(37,99,235,0.08); border: 1px solid rgba(37,99,235,0.18); font-size: 12.5px; color: #234a86; }
  .ad-dup-strip > i { flex-shrink: 0; }
  .ad-dup-strip .ad-dup-txt { flex: 1; min-width: 0; line-height: 1.4; }
  .ad-dup-strip .ad-dup-sub { color: #5a6b8c; font-size: 11px; }
  .ad-dup-strip .btn { font-size: 12px; padding: 5px 11px; }
  [data-theme="dark"] .ad-dup-strip { background: rgba(79,139,232,0.14); border-color: rgba(79,139,232,0.30); color: #cfe0ff; }
  [data-theme="dark"] .ad-dup-strip .ad-dup-sub { color: #9fb2d6; }

  /* Bell "Needs tidying" icon — neutral slate-blue, never alarm-colored */
  .notif-ico.tidy { background: rgba(37,99,235,0.12); color: #2563eb; }
  [data-theme="dark"] .notif-ico.tidy { background: rgba(79,139,232,0.18); color: #9bc0ff; }
  /* Fixed-width tag rows — agent fills its row; meta tags share space equally */
  .kc-tags .kc-tag { width: 100%; box-sizing: border-box; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
  .kc-meta-row    { display: flex; flex-wrap: nowrap; gap: 6px; margin-bottom: 6px; overflow: hidden; }
  .kc-meta-row .kc-tag { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; box-sizing: border-box; }
  /* Funding-request-submitted indicator on the kanban card —
     small glowing green dot with a one-line label so users can scan
     the board and see at a glance which deals are at the broker. */
  .kc-funding-sent {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: 8px; font-weight: 500; color: #15803d;
    min-width: 0; flex: 1; overflow: visible;
  }
  .kc-fs-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
  .kc-date { flex-shrink: 0; margin-left: 4px; }
  .kc-funding-sent .kc-fs-dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: #22c55e;
    box-shadow: 0 0 6px rgba(34,197,94,0.85);
    animation: kcFundingPulse 2s ease-out infinite;
    flex-shrink: 0;
  }
  @keyframes kcFundingPulse {
    0%   { box-shadow: 0 0 0 0 rgba(34,197,94,0.55), 0 0 6px rgba(34,197,94,0.85); }
    70%  { box-shadow: 0 0 0 6px rgba(34,197,94,0),  0 0 6px rgba(34,197,94,0.85); }
    100% { box-shadow: 0 0 0 0 rgba(34,197,94,0),    0 0 6px rgba(34,197,94,0.85); }
  }
  /* Post-tour outcome — same inline dot+text language as the funding indicator,
     coloured per outcome; the pending (Awaiting reply) dot pulses. */
  .kc-tour-status {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: 8px; font-weight: 500;
    min-width: 0; flex: 1; overflow: visible;
  }
  .kc-ts-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
  .kc-tour-status .kc-ts-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
  .kc-tour-liked        { color: #15803d; }
  .kc-tour-liked .kc-ts-dot        { background: #22c55e; box-shadow: 0 0 6px rgba(34,197,94,0.85); }
  .kc-tour-missed       { color: #b45309; }
  .kc-tour-missed .kc-ts-dot       { background: #f59e0b; box-shadow: 0 0 6px rgba(245,158,11,0.75); }
  .kc-tour-not_for_them { color: #64748b; }
  .kc-tour-not_for_them .kc-ts-dot { background: #94a3b8; box-shadow: none; }
  .kc-tour-awaiting     { color: #2563eb; }
  .kc-tour-awaiting .kc-ts-dot     { background: #3b82f6; box-shadow: 0 0 6px rgba(59,130,246,0.85); }
  .kc-tour-withdrew     { color: #9f1239; }
  .kc-tour-withdrew .kc-ts-dot     { background: #e11d48; box-shadow: none; }
  .kc-tour-status.is-pending .kc-ts-dot { animation: kcTourPulse 2s ease-out infinite; }
  @keyframes kcTourPulse {
    0%   { box-shadow: 0 0 0 0 rgba(59,130,246,0.55), 0 0 6px rgba(59,130,246,0.85); }
    70%  { box-shadow: 0 0 0 6px rgba(59,130,246,0),  0 0 6px rgba(59,130,246,0.85); }
    100% { box-shadow: 0 0 0 0 rgba(59,130,246,0),    0 0 6px rgba(59,130,246,0.85); }
  }
  .kc-footer { display: flex; align-items: center; justify-content: space-between; }
  .kc-agent { font-size: 11px; color: rgba(26,47,92,0.42); }
  .kc-date  { font-size: 10px; color: rgba(26,47,92,0.42); font-family: 'DM Mono', monospace; }

  /* ── COLUMN ACCENTS ── */
  .col-denied .kanban-col-title   { color: var(--text2); }
  .col-denied .kanban-card        { opacity: 0.88; box-shadow: inset 3px 0 0 0 #5A2430, 0 1px 3px rgba(0,0,0,0.06); }
  .col-lost .kanban-col-title     { color: var(--text2); }
  .col-lost .kanban-card          { opacity: 0.9; box-shadow: inset 3px 0 0 0 #64748b, 0 1px 3px rgba(0,0,0,0.06); }
  .col-closed .kanban-col-title   { color: var(--text2); }
  .col-closed .kanban-card        { opacity: 0.82; box-shadow: inset 3px 0 0 0 #166534, 0 1px 3px rgba(0,0,0,0.06); }
  .col-closed .kc-funding-sent    { color: rgba(255,255,255,0.45); }
  .col-closed .kc-funding-sent .kc-fs-dot { background: #94a3b8; box-shadow: none; animation: none; }
  /* Section 8 status badge */
  .s8-status-badge { display:inline-block; font-size:11px; font-weight:700; padding:3px 10px; border-radius:20px; background:rgba(59,130,246,0.15); color:#3b82f6; border:1px solid rgba(59,130,246,0.3); margin-bottom:10px; }
  /* Comments */
  .comment-item { padding:10px 14px; border-radius:var(--radius); background:var(--bg2); border:1px solid var(--border2); margin-bottom:8px; }
  .comment-body { font-size:13px; color:var(--text); line-height:1.5; white-space:pre-wrap; word-break:break-word; }
  .comment-meta { font-size:10px; color:var(--text2); margin-top:6px; display:flex; justify-content:space-between; align-items:center; }
  .comment-del  { background:none; border:none; cursor:pointer; color:var(--text3); font-size:11px; padding:2px 6px; border-radius:4px; }
  .comment-del:hover { color:#ef4444; background:rgba(239,68,68,0.08); }
  .comment-input-wrap { display:flex; flex-direction:column; gap:6px; }
  .comment-input { width:100%; min-height:60px; padding:8px 10px; border-radius:var(--radius); border:1px solid var(--border2); background:var(--bg2); color:var(--text); font-size:12px; font-family:inherit; resize:vertical; outline:none; box-sizing:border-box; }
  .comment-input:focus { border-color:var(--accent); }
  .inspector-box { background:var(--bg2); border:1px solid var(--border2); border-radius:var(--radius); padding:12px 14px; margin-top:10px; display:flex; flex-direction:column; gap:8px; }
  .inspector-box label { font-size:11px; font-weight:700; color:var(--text2); text-transform:uppercase; letter-spacing:.04em; }

  /* ── APPLICANT DETAIL ── */
  .app-detail-section { margin-bottom: 16px; }
  /* Inline-editable inputs in the application detail card */
  .app-edit-input {
    width: 100%; font-size: 13px; font-weight: 500; color: var(--text);
    padding: 5px 8px; border: 1px solid transparent;
    background: transparent; border-radius: var(--radius);
    font-family: inherit;
    transition: background 0.12s, border-color 0.12s;
  }
  .app-edit-input:hover  { background: var(--bg3); }
  .app-edit-input:focus  {
    background: var(--bg); border-color: var(--accent);
    outline: none; box-shadow: 0 0 0 2px rgba(37,99,235,0.12);
  }
  select.app-edit-input { cursor: pointer; }

  /* ── DOCUMENTS SECTION ── */
  .docs-dropzone {
    border: 2px dashed var(--border2); border-radius: var(--radius-lg);
    padding: 18px; text-align: center; background: var(--bg2);
    cursor: pointer; transition: border-color 0.15s, background 0.15s;
  }
  .docs-dropzone:hover, .docs-dropzone.drag-over {
    border-color: var(--accent); background: rgba(37,99,235,0.04);
  }
  .docs-dropzone-icon { font-size: 22px; color: var(--text3); margin-bottom: 4px; }
  .docs-dropzone-text { font-size: 12px; color: var(--text2); }
  .docs-dropzone-text strong { color: var(--accent); }
  .doc-row {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 12px; background: var(--bg); border: 1px solid var(--border2);
    border-radius: var(--radius); margin-top: 8px;
  }
  .doc-icon {
    width: 36px; height: 36px; border-radius: 6px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    font-size: 16px; font-weight: 600;
  }
  .doc-icon.pdf  { background: #fee2e2; color: #b91c1c; }
  .doc-icon.img  { background: #dcfce7; color: #15803d; }
  .doc-icon.doc  { background: #dbeafe; color: #1d4ed8; }
  .doc-icon.xls  { background: #d1fae5; color: #047857; }
  .doc-icon.gen  { background: var(--bg3); color: var(--text2); }
  .doc-info { flex: 1; min-width: 0; }
  .doc-name { font-size: 13px; font-weight: 500; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .doc-name-editable { cursor: text; padding: 2px 4px; margin: -2px -4px; border-radius: 4px; transition: background 0.12s; }
  .doc-name-editable:hover { background: var(--bg3); }
  .doc-meta { font-size: 11px; color: var(--text3); margin-top: 1px; }
  .doc-actions { display: flex; gap: 4px; flex-shrink: 0; }
  .doc-action-btn {
    background: none; border: 1px solid var(--border2); border-radius: 6px;
    padding: 5px 7px; cursor: pointer; color: var(--text2);
    transition: all 0.12s;
  }
  .doc-action-btn:hover { background: var(--bg3); color: var(--text); border-color: var(--border); }
  .doc-action-btn.danger:hover { color: #dc2626; border-color: rgba(220,38,38,0.3); background: rgba(220,38,38,0.05); }
  .doc-action-btn i { width: 13px; height: 13px; display: block; }
  .doc-bulk-bar {
    display: flex; gap: 8px; justify-content: flex-end;
    margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--border);
  }

  /* Inline preview modal */
  .doc-preview-overlay {
    display: none; position: fixed; inset: 0; z-index: 3100;
    background: rgba(0,0,0,0.85); padding: 20px;
    align-items: center; justify-content: center;
    flex-direction: column; gap: 12px;
  }
  .doc-preview-overlay.open { display: flex; }
  .doc-preview-head {
    display: flex; align-items: center; gap: 12px;
    width: 100%; max-width: 1100px; color: #fff;
  }
  .doc-preview-title { flex: 1; font-size: 14px; font-weight: 500; }
  .doc-preview-btn {
    background: rgba(255,255,255,0.12); border: 1px solid rgba(255,255,255,0.2);
    color: #fff; padding: 7px 14px; border-radius: var(--radius);
    cursor: pointer; font-size: 13px; display: inline-flex; align-items: center; gap: 6px;
    transition: background 0.12s;
  }
  .doc-preview-btn:hover { background: rgba(255,255,255,0.22); }
  /* Wrapper carries the rounded corners + overflow clip so the iframe itself
     stays rectangular. Putting border-radius directly on a PDF iframe forces
     the browser to re-clip the embedded viewer on every scroll frame (very
     visible jank on WebKit). Used only as the fallback when pdf.js hasn't
     loaded yet. */
  .doc-preview-frame-wrap {
    flex: 1; width: 100%; max-width: 1100px; height: calc(100vh - 120px);
    background: #fff; border-radius: var(--radius-lg); overflow: hidden;
    transform: translateZ(0);
    contain: layout paint;
  }
  .doc-preview-frame {
    width: 100%; height: 100%;
    background: #fff; border: none; display: block;
  }
  /* Native pdf.js viewer — scrolls in the parent document (no iframe input
     lag) and only rasterizes pages near the viewport via IntersectionObserver. */
  .doc-pdf-viewer {
    flex: 1; width: 100%; max-width: 1100px; height: calc(100vh - 120px);
    background: #525659; border-radius: var(--radius-lg);
    overflow-y: auto; overflow-x: hidden;
    padding: 16px 0; display: flex; flex-direction: column;
    align-items: center; gap: 12px;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    transform: translateZ(0);
    contain: layout paint;
  }
  .doc-pdf-page {
    background: #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.35);
    flex-shrink: 0;
    position: relative;
  }
  .doc-pdf-page canvas {
    display: block; width: 100%; height: 100%;
  }
  .doc-pdf-loading {
    color: #e5e7eb; padding: 40px; font-size: 13px; text-align: center;
  }
  .doc-preview-img {
    max-width: 100%; max-height: calc(100vh - 120px);
    border-radius: var(--radius-lg); object-fit: contain;
  }
  .doc-preview-fallback {
    background: #fff; padding: 60px 40px; border-radius: var(--radius-lg);
    text-align: center; color: var(--text2); max-width: 420px;
  }

  /* Applicant drawer save state — a line of text in the footer, never a dialog.
     Same treatment as the unit drawer's .uc-save so the two drawers read alike. */
  .app-save-state {
    display: flex; align-items: center; gap: 6px;
    font-size: 11.5px; min-width: 0; margin-right: auto;
  }
  .app-save-state .lucide { width: 13px; height: 13px; }
  .app-save-state.is-ok   { color: #7f9673; }
  .app-save-state.is-held { color: #b45309; }
  .app-save-state.is-busy { color: #6d81a8; font-weight: 500; }
  .app-save-state.is-err  { color: #c2410c; font-weight: 500; cursor: pointer; }
  .app-save-state.is-view { color: #8fa0bf; }
  .app-save-dot { width: 6px; height: 6px; border-radius: 50%; background: #2563eb; }

  /* A stage move or tour outcome waiting to be confirmed. Amber, inline, above
     the tabs — it must be reachable and obvious from whichever tab is open. */
  .app-pending {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    background: #fffbeb; border: 1px solid #fcd34d; border-left: 3px solid #d97706;
    border-radius: var(--radius);
    padding: 11px 13px; margin: 0 0 12px;
  }
  .app-pending-text { flex: 1; min-width: 0; }
  .app-pending-label {
    font-size: 10px; font-weight: 700; color: #b45309;
    text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 3px;
  }
  .app-pending-title { font-size: 13.5px; font-weight: 600; color: #78350f; }
  .app-pending-title b { font-weight: 700; }
  .app-pending-sub { font-size: 12px; color: #92400e; margin-top: 2px; }
  .app-pending-actions { display: flex; align-items: center; gap: 7px; flex-shrink: 0; }
  .app-detail-label { font-size: 11px; color: var(--text3); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 4px; }
  .app-detail-val { font-size: 14px; color: var(--text); font-weight: 500; }
  .app-detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 16px; }
  .move-stage-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 4px; }
  .stage-btn {
    padding: 5px 12px; font-size: 12px; font-family: 'DM Sans', sans-serif;
    border: 1px solid var(--border2); border-radius: var(--radius);
    background: var(--bg); color: var(--text2); cursor: pointer; transition: all 0.12s;
  }
  .stage-btn:hover { background: var(--navy); color: #fff; border-color: var(--navy); }
  .stage-btn.current { background: var(--navy); color: #fff; border-color: var(--navy); font-weight: 500; }
  .stage-btn-denied { border-color: #f5b8b8; color: #a32d2d; }
  .stage-btn-denied:hover { background: #a32d2d; color: #fff; border-color: #a32d2d; }
  .notes-box {
    width: 100%; 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: 70px;
  }
  .notes-box:focus { border-color: var(--navy); }

  /* ── UNIFIED DETAIL SECTIONS ── */
  .ud-section {
    padding: 16px 0;
    border-bottom: 1px solid var(--border);
    margin-bottom: 0;
  }
  .ud-section:last-child { border-bottom: none; }
  .ud-section-title {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 12px;
    font-size: 11px; font-weight: 500; color: var(--text3);
    text-transform: uppercase; letter-spacing: 0.07em;
  }
  /* Collapsible section variant — used to keep prior-stage checklists visible
     but tucked away when the user has moved past them. Click the title to
     toggle the data-collapsed attribute on .ud-collapsible. */
  .ud-collapsible .ud-section-title { cursor: pointer; user-select: none; }
  .ud-collapsible .ud-section-title:hover { color: var(--text2); }
  .ud-chev {
    display: inline-block; font-size: 14px; color: var(--text3);
    transition: transform 0.15s; margin-right: 6px; line-height: 1;
  }
  .ud-collapsible:not([data-collapsed]) .ud-chev { transform: rotate(90deg); }
  .ud-collapsible[data-collapsed] .ud-collapsible-body { display: none; }
  .ud-collapsible[data-collapsed] .ud-section-title { margin-bottom: 0; }
  .ud-progress-mini {
    font-size: 11px; font-weight: 500; padding: 2px 9px;
    border-radius: 10px; background: var(--bg3); color: var(--text3);
    text-transform: none; letter-spacing: 0;
  }
  .ud-progress-mini.complete { color: #15803d; background: rgba(34,197,94,0.12); }
  .ud-stage-badge {
    font-size: 11px; font-weight: 500; padding: 3px 10px;
    border-radius: 20px; background: var(--navy); color: #fff;
    text-transform: none; letter-spacing: 0;
  }
  .stage-dropdown {
    width: 100%; padding: 9px 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);
    cursor: pointer; outline: none; margin-top: 4px;
  }
  .stage-dropdown:focus { border-color: var(--navy); }

  /* ── CHECKLIST STYLES ── */
  .checklist-section { margin-bottom: 0; }
  .checklist-toggle-row {
    display: flex; align-items: center; gap: 10px; margin-bottom: 14px;
  }
  .toggle-label { font-size: 12px; font-weight: 800; color: #000 !important; }
  .toggle-label.active-label { color: #000 !important; font-weight: 800; }
  .toggle-switch {
    position: relative; width: 44px; height: 24px; cursor: pointer;
  }
  .toggle-switch input { opacity: 0; width: 0; height: 0; }
  .toggle-slider {
    position: absolute; inset: 0;
    background: #08101c;
    border-radius: 24px; transition: background 0.25s, box-shadow 0.25s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.25), inset 0 0 0 1px #08101c;
  }
  .toggle-slider::before {
    content: ''; position: absolute; width: 18px; height: 18px;
    left: 3px; top: 50%; margin-top: -9px; background: #fff;
    border-radius: 50%; transition: transform 0.25s, background 0.25s;
    box-shadow: 0 2px 4px rgba(0,0,0,0.25);
  }
  .toggle-switch input:checked + .toggle-slider {
    background: #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.15), inset 0 0 0 1.5px #08101c;
  }
  .toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(20px); background: #08101c;
  }
  .checklist-items { display: flex; flex-direction: column; gap: 2px; }
  .checklist-item {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 12px; border-radius: var(--radius);
    cursor: pointer; transition: background 0.1s; user-select: none;
  }
  .checklist-item:hover { background: var(--bg2); }
  .checklist-item input[type=checkbox] { display: none; }
  .ci-box {
    width: 18px; height: 18px; border-radius: 5px; flex-shrink: 0;
    border: 1.5px solid var(--border2); background: var(--bg);
    display: flex; align-items: center; justify-content: center;
    transition: all 0.15s;
  }
  .checklist-item.checked .ci-box {
    background: var(--navy); border-color: var(--navy);
  }
  .checklist-item.checked .ci-box::after {
    content: ''; display: block; width: 5px; height: 9px;
    border: 2px solid #fff; border-top: none; border-left: none;
    transform: rotate(45deg) translate(-1px, -1px);
  }
  .ci-label { font-size: 13px; color: var(--text); transition: color 0.15s; }
  .checklist-item.checked .ci-label { color: var(--text3); text-decoration: line-through; }
  .checklist-progress {
    display: flex; align-items: center; gap: 8px; margin-bottom: 10px;
  }
  .progress-bar-wrap {
    flex: 1; height: 4px; background: var(--bg3); border-radius: 4px; overflow: hidden;
  }
  .progress-bar-fill {
    height: 100%; background: var(--navy); border-radius: 4px;
    transition: width 0.3s ease;
  }
  .progress-text { font-size: 11px; color: var(--text3); font-family: 'DM Mono', monospace; white-space: nowrap; }
  .detail-tabs {
    display: flex; border-bottom: 1px solid var(--border); margin-bottom: 16px;
    margin-left: -20px; margin-right: -20px; padding: 0 20px;
    overflow-x: auto; -webkit-overflow-scrolling: touch;
  }
  .detail-tabs::-webkit-scrollbar { display: none; }
  .detail-tab {
    padding: 9px 14px; font-size: 12px; font-family: 'DM Sans', sans-serif;
    cursor: pointer; border: none; background: none; color: var(--text2);
    border-bottom: 2px solid transparent; margin-bottom: -1px;
    white-space: nowrap; transition: all 0.15s;
  }
  .detail-tab.active { color: var(--text); border-bottom-color: var(--navy); font-weight: 500; }
  .detail-pane { display: none; }
  .detail-pane.active { display: block; }
  .funding-item {
    display: flex; align-items: flex-start; gap: 10px;
    padding: 9px 12px; border-radius: var(--radius); cursor: pointer;
    transition: background 0.1s; user-select: none;
  }
  .funding-item:hover { background: var(--bg2); }
  .funding-item.checked .ci-label { color: var(--text3); text-decoration: line-through; }
  .funding-item.checked .ci-box { background: var(--navy); border-color: var(--navy); }
  .funding-item.checked .ci-box::after {
    content: ''; display: block; width: 5px; height: 9px;
    border: 2px solid #fff; border-top: none; border-left: none;
    transform: rotate(45deg) translate(-1px, -1px);
  }
  .funding-sub { font-size: 11px; color: var(--text3); margin-top: 2px; }
  .funding-request-btn {
    width: 100%; margin-top: 14px; padding: 11px;
    background: var(--navy); color: #fff; border: none;
    border-radius: var(--radius); font-size: 13px; font-weight: 500;
    font-family: 'DM Sans', sans-serif; cursor: pointer; transition: background 0.15s;
  }
  .funding-request-btn:hover { background: var(--navy2); }
  .funding-request-btn.submitted { background: #2d6a1f; cursor: pointer; }
  /* On hover, hint that the submitted state is reversible — slightly
     darker green + a subtle shift in label spacing so users notice. */
  .funding-request-btn.submitted:hover { background: #1f4d15; }
  .funding-request-btn.submitted:hover::after {
    content: ' (click to undo)';
    font-size: 12px; font-weight: 400; opacity: 0.85;
  }

  /* ── SCROLL FIX ── */
  html:not(.public-view), body:not(.public-view) { height: 100%; overflow: hidden; }
  .layout { height: 100vh; overflow: hidden; }
  .main { overflow-y: auto; height: 100vh; }

  /* ── WIDE SCREENS (wide-screen job, Nov 19 2026) ──
     Desktop only: the columns share the board instead of stopping at 176px each and leaving a blank strip on the
     right. They still never get narrower than 176px, so a laptop (where nine of them do not fit) scrolls sideways
     exactly as before. The phone rules are in applications-phone.css and are untouched: this block starts at 769px,
     and flex-basis 0 would otherwise override the phone's 149px column width. */
  @media (min-width: 769px) {
    .kanban-col { flex: 1 1 0; min-width: 176px; width: auto; }
  }
  /* Above 1600px (a 1600px laptop is still today's look): taller cards, type one step up. */
  @media (min-width: 1601px) {
    .kanban-card { height: 150px; }
    .kc-name { font-size: 12px; }
    .kc-unit { font-size: 10px; }
    .kc-tag { font-size: 9px; }
    .kc-funding-sent, .kc-tour-status { font-size: 9px; }
    .kc-date { font-size: 11px; }
    .kanban-col .kanban-card .kc-rem { font-size: 11px; }
    .kanban-col-title, .kanban-col-count { font-size: 12px; }
    .kanban-empty { font-size: 12px; }
  }

  /* ── UI fix #43 (26 Nov 2026), desktop board cards ──
     Names and addresses were cut off in 9-11px text, cards looked uneven because the footer floated wherever the
     content ended, and the grey count pills were hard to read. One fixed card height with the footer pinned to the
     bottom, readable type (name 13px, address 11px over up to two lines), and a count pill in the theme's own
     tokens so it reads in light and dark. Desktop only; the phone board keeps its own rules. */
  @media (min-width: 769px) {
    #page-apps .kanban-card { display: flex; flex-direction: column; }
    #page-apps .kanban-card > * { flex-shrink: 0; }
    #page-apps .kc-name { font-size: 13px; line-height: 1.3; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    /* Review fix: a long name wraps to a second line (cut only past two), as it did before #43. Words break only
       between words. A merged card ("Name +2 more") keeps its one-line layout. */
    #page-apps .kc-name:not(.kc-name-group) {
      white-space: normal; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2;
    }
    /* The meta row (tasks left, follow-up date) wraps instead of cutting a tag to "Overdue…": each tag keeps its
       whole text and the follow-up date moves under the task count when both do not fit. */
    #page-apps .kanban-card .kc-meta-row { flex-wrap: wrap; row-gap: 3px; }
    #page-apps .kanban-card .kc-meta-row .kc-tag { flex: 0 1 auto; max-width: 100%; }
    /* With room for a two-line name and a wrapped meta row, the shared card height is 158px; a card that still needs
       more (every optional row at once) grows rather than hiding its footer. */
    /* Cards keep their original size, as tall as their content (Reuven, 26 Nov 2026). */
    #page-apps .kc-unit {
      font-size: 11px; line-height: 1.35; color: var(--text2); margin-bottom: 6px;
      white-space: normal; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden;
    }
    #page-apps .kc-tag, #page-apps .kc-funding-sent, #page-apps .kc-tour-status { font-size: 10.5px; }
    #page-apps .kanban-col .kanban-card .kc-rem { font-size: 11px; }
    #page-apps .kc-date { font-size: 11px; color: var(--text2); }
    #page-apps .kc-footer { margin-top: auto; gap: 6px; min-width: 0; }
    #page-apps .kanban-col-count {
      font-family: inherit; font-size: 12px; font-weight: 700; line-height: 1.5;
      background: var(--bg3); color: var(--text); border-color: var(--border2);
    }
  }
  @media (min-width: 1601px) {
    #page-apps .kc-name { font-size: 14px; }
    #page-apps .kc-unit { font-size: 12px; }
    #page-apps .kc-tag, #page-apps .kc-funding-sent, #page-apps .kc-tour-status { font-size: 11px; }
  }
