/* ── Features: widgets one area of the app owns ─────────────────────────
   Chat bubbles, the SOP reader, the calendar, the work-order board, Ground
   Truth, the print queue, the assignment board and map, the AP board. Each
   belongs with its app; they move to static/css/apps/<app>.css as those apps
   are migrated onto the shared components. Loaded after components.css. */

/* "Under construction" tag */
/* Chat power badges — tell the user what each chat can actually do */
.chat-power{display:inline-flex;align-items:center;gap:4px;padding:3px 10px;border-radius:99px;font-size:10.5px;font-weight:700;letter-spacing:.3px;text-transform:uppercase;border:1px solid;vertical-align:middle;}
.chat-power-read   {background:var(--green-weak); color:var(--green-d); border-color:var(--green-line);}
.chat-power-suggest{background:var(--orange-weak);color:var(--orange); border-color:var(--orange-line);}
.chat-power-edit   {background:var(--red-weak); color:var(--red-d); border-color:var(--red-line);}
.chat-power-help{font-size:11px;color:var(--muted);margin-top:4px;}

/* SOP reading view — a polished, formatted render of the markdown body
   (with inline pictures). Two containers share the typography below: .sop-doc
   (the viewer POPUP — capped height, scrolls inside the modal) and .sop-body
   (the DETAIL PAGE — flows with normal page scroll, so no max-height). */
.sop-doc{font-size:14px;line-height:1.7;color:var(--text);max-height:62vh;overflow:auto;padding:2px 2px 6px;}
.sop-body{font-size:14.5px;line-height:1.75;color:var(--text);margin:6px 0 0;
  background:var(--surface);border:1px solid var(--border);border-radius:12px;
  padding:26px 30px 30px;box-shadow:var(--shadow-sm);}
/* Extra visual breakup for the full-page document: more air before each new
   section than the compact popup needs. */
.sop-body h2{margin-top:1.8em;}
.sop-body p{margin:.75em 0;}
.sop-body li{margin:.4em 0;}
.sop-doc>:first-child,.sop-body>:first-child{margin-top:0;}
.sop-doc h1,.sop-doc h2,.sop-doc h3,.sop-doc h4,.sop-body h1,.sop-body h2,.sop-body h3,.sop-body h4{color:var(--text);margin:1.3em 0 .5em;line-height:1.3;font-weight:700;}
.sop-doc h1,.sop-body h1{font-size:22px;border-bottom:2px solid var(--orange);padding-bottom:6px;}
.sop-doc h2,.sop-body h2{font-size:18px;border-bottom:1px solid var(--border);padding-bottom:4px;}
.sop-doc h3,.sop-body h3{font-size:15.5px;}
.sop-doc h4,.sop-body h4{font-size:14px;color:var(--muted);text-transform:uppercase;letter-spacing:.4px;}
.sop-doc p,.sop-body p{margin:.6em 0;}
.sop-doc img,.sop-body img{max-width:100%;height:auto;border-radius:8px;border:1px solid var(--border);margin:12px 0;display:block;box-shadow:1px 2px 10px rgba(0,0,0,.12);}
.sop-doc ul,.sop-doc ol,.sop-body ul,.sop-body ol{padding-left:22px;margin:.5em 0;}
.sop-doc li,.sop-body li{margin:.3em 0;}
.sop-doc blockquote,.sop-body blockquote{border-left:3px solid var(--orange);background:rgba(249,115,22,.07);margin:.8em 0;padding:8px 14px;border-radius:0 6px 6px 0;}
.sop-doc blockquote p,.sop-body blockquote p{margin:.2em 0;}
.sop-doc code,.sop-body code{background:var(--bg);border:1px solid var(--border);border-radius:4px;padding:1px 5px;font-size:12.5px;font-family:ui-monospace,Menlo,monospace;}
.sop-doc pre,.sop-body pre{background:var(--bg);border:1px solid var(--border);border-radius:8px;padding:12px;overflow:auto;margin:.7em 0;}
.sop-doc pre code,.sop-body pre code{border:none;padding:0;background:none;}
.sop-doc table,.sop-body table{border-collapse:collapse;width:100%;margin:1em 0;font-size:13px;}
.sop-doc th,.sop-doc td,.sop-body th,.sop-body td{border:1px solid var(--border);padding:6px 10px;text-align:left;vertical-align:top;}
.sop-doc th,.sop-body th{background:var(--card);font-weight:650;}
.sop-doc a,.sop-body a{color:var(--orange);}
.sop-doc hr,.sop-body hr{border:none;border-top:1px solid var(--border);margin:1.2em 0;}
.sop-edit-ta{width:100%;min-height:380px;font-family:ui-monospace,Menlo,monospace;font-size:12.5px;line-height:1.6;padding:12px;background:var(--bg);border:1px solid var(--border);border-radius:8px;color:var(--text);box-sizing:border-box;}
/* Pictures attached in the SOP word editor render inline in the viewer. */
.sop-body img{max-width:100%;height:auto;border:1px solid var(--border);border-radius:8px;margin:8px 0;display:block;}
/* SOP word editor (EasyMDE) — keep the toolbar/preview on-brand and bounded. */
.EasyMDEContainer .CodeMirror{border-color:var(--border);border-radius:0 0 8px 8px;background:var(--surface);color:var(--text);min-height:340px;}
.EasyMDEContainer .editor-toolbar{border-color:var(--border);border-top-left-radius:8px;border-top-right-radius:8px;}
.EasyMDEContainer .editor-preview img,.EasyMDEContainer .CodeMirror img{max-width:100%;height:auto;}
/* Standardized SOP letterhead — the same on every SOP (viewer chrome). */
.sop-brandbar{text-align:center;border-bottom:2px solid var(--orange);padding-bottom:9px;margin-bottom:12px;}
.sop-brandbar .sb-co{font-size:12.5px;font-weight:800;letter-spacing:1.4px;color:var(--orange);text-transform:uppercase;}
.sop-brandbar .sb-cf{font-size:10px;font-style:italic;color:var(--muted);letter-spacing:.6px;text-transform:uppercase;margin-top:2px;}

/* Dashboard widgets */

/* Index status bar */

/* Toggle switch */

/* Complex modal */

/* Email history modal */
#hist-modal{position:fixed;inset:0;background:rgba(0,0,0,.30);backdrop-filter:blur(8px);-webkit-backdrop-filter:blur(8px);display:none;align-items:center;justify-content:center;z-index:200;}
#hist-modal.show{display:flex;}
#hist-box{background:var(--surface);border:1px solid var(--border);border-radius:18px;width:760px;max-width:94vw;max-height:88vh;display:flex;flex-direction:column;box-shadow:var(--shadow-lg);}
#hist-head{padding:16px 20px;border-bottom:1px solid var(--border);display:flex;justify-content:space-between;align-items:center;}
#hist-body{padding:16px 20px;overflow-y:auto;flex:1;}
.hist-row{background:var(--card);border:1px solid var(--border);border-radius:10px;padding:11px 13px;margin-bottom:8px;font-size:12px;}
.hist-meta{display:flex;justify-content:space-between;color:var(--muted);font-size:10px;margin-bottom:3px;}
.hist-subj{font-weight:600;color:var(--text);margin-bottom:5px;}
.hist-text{color:var(--soft);font-size:11.5px;line-height:1.5;max-height:140px;overflow:hidden;position:relative;}
.hist-text.expanded{max-height:none;}
.hist-text.collapsed::after{content:'';position:absolute;left:0;right:0;bottom:0;height:30px;background:linear-gradient(transparent,var(--card));}

/* Prior-email card with hover tooltip */

/* Floating progress pill (non-blocking) */
.plabel{font-size:11.5px;color:var(--muted);line-height:1.4;}

/* Stats */

/* Tasks — light tinted status tiles */
.tc{border-radius:12px;padding:12px;text-align:center;border:1px solid;}
.tc.tod{background:rgba(255,59,48,.08);border-color:rgba(255,59,48,.25);}
.tc.ov{background:rgba(255,149,0,.08);border-color:rgba(255,149,0,.25);}
.tc.li{background:rgba(255,107,26,.08);border-color:rgba(255,107,26,.25);}
.tc.ok{background:var(--card);border-color:var(--border);}
.tcl{font-size:10.5px;color:var(--muted);margin-top:3px;font-weight:500;}

/* Filters */
/* .fbar/.fbtn removed — they styled the dashboard's cut legacy "📬 Emails" filter bar. */

/* Activity rows */

/* Emails */
.sg{background:var(--surface);border:1px solid var(--border);border-radius:10px;margin-bottom:8px;overflow:hidden;box-shadow:var(--shadow-sm);}
.sh{padding:10px 14px;display:flex;justify-content:space-between;align-items:center;cursor:pointer;transition:background .12s;}
.sh:hover{background:var(--card);}
.sn{font-size:12.5px;font-weight:600;color:var(--orange);}
.sc{font-size:10px;color:var(--muted);background:var(--card-2);padding:2px 8px;border-radius:99px;}
.se{border-top:1px solid var(--border);}
.er{padding:10px 14px;border-bottom:1px solid var(--border);font-size:11.5px;}
.er:last-child{border-bottom:none;}
.pb{display:inline-block;padding:1px 7px;border-radius:99px;font-size:9.5px;font-weight:600;margin-left:5px;}

/* Chat */
/* Sorted inbox — the landing view inside "Search your email". Real mail
   bucketed by the smart classifier (invoices / work orders / important
   people); junk is left out and only counted. */
.sug{background:var(--surface);border:1px solid var(--border);border-radius:10px;padding:8px 14px;font-size:12px;color:var(--soft);cursor:pointer;text-align:left;transition:border-color .12s, color .12s, box-shadow .12s;}
.sug:hover{border-color:var(--orange);color:var(--text);box-shadow:var(--shadow-sm);}
.msg{display:flex;gap:8px;max-width:84%;}
.msg.u{align-self:flex-end;flex-direction:row-reverse;}
.mb{padding:11px 15px;border-radius:14px;font-size:13.5px;line-height:1.6;}
.msg.u .mb{background:var(--orange);color:#fff;white-space:pre-wrap;box-shadow:1px 1px 2px rgba(0,0,0,.06), 2px 4px 14px -4px rgba(255,107,26,.35);}
.msg.a .mb{background:var(--surface);color:var(--text);border:1px solid var(--border);box-shadow:var(--shadow-sm);}
.msg.a .mb p{margin:0 0 8px 0;}
.msg.a .mb p:last-child{margin-bottom:0;}
.msg.a .mb strong{color:var(--text);font-weight:600;}
.msg.a .mb em{color:var(--text);font-style:italic;}
.msg.a .mb code{background:var(--card);border:1px solid var(--border);padding:1px 6px;border-radius:5px;font-family:ui-monospace,Menlo,monospace;font-size:11.5px;color:var(--blue-d);}
.msg.a .mb h3{font-size:13.5px;margin:10px 0 5px 0;color:var(--text);font-weight:600;}
.msg.a .mb ul,.msg.a .mb ol{margin:4px 0 8px 0;padding-left:22px;}
.msg.a .mb li{margin-bottom:3px;}
.msg.a .mb blockquote{margin:6px 0;padding:8px 12px;border-left:3px solid var(--orange);background:var(--card);color:var(--soft);border-radius:0 8px 8px 0;font-style:italic;}
.msg.a .mb blockquote p{margin:0;}
.msg.a .mb hr{border:none;border-top:1px solid var(--border);margin:8px 0;}
.typ{display:flex;gap:4px;padding:12px 14px;}
.typ span{width:6px;height:6px;background:var(--muted);border-radius:50%;animation:bop .9s infinite;}
.typ span:nth-child(2){animation-delay:.15s;}.typ span:nth-child(3){animation-delay:.3s;}
@keyframes bop{0%,60%,100%{transform:translateY(0);}30%{transform:translateY(-5px);}}

/* Orange pulsing indicator for the general chat ("Digital Ivan is thinking…"). */
.thinking{display:flex;align-items:center;gap:8px;padding:10px 14px;background:var(--surface);border:1px solid var(--border);border-radius:12px;color:var(--soft);font-size:12.5px;align-self:flex-start;box-shadow:var(--shadow-sm);}

/* Composer states — focus glow + drag-over highlight. */

/* Digital Ivan chat — uses the same .msg / .mav / .mb bubble formatting
   as the email chat (defined above) so both chat surfaces look identical.
   The lead-paragraph emphasis stays — first paragraph of an assistant
   turn is the direct answer, rendered slightly heavier than supporting
   context. Scoped to .msg.a .mb p:first-child so it applies in both
   chats (email + Digital Ivan) symmetrically. */
.msg.a .mb p:first-child {
  font-size: 15.5px; font-weight: 500; color: var(--text); margin-top: 0; line-height: 1.5;
}
/* "Next:" line — a one-liner action suggestion the model can drop at
   the end. Rendered as a subtle hint, not a heading. */
.msg.a .mb p.next-step { color: var(--muted); font-size: 12.5px; font-style: italic; margin-top: 8px; padding-top: 6px; border-top: 1px dashed var(--border); }
/* Digital Ivan #gen-msgs is a flex column like email .cmsgs — keep the
   stretched widths for the "What I checked" panel + followup chips that
   sit between bubbles. */

/* Digital Ivan tab — make the chat use the full available vertical
   space. The tab is a flex column; the chat card grows to fill, with
   the "More tools" details tucked at the bottom as a thin handle. */
#general-tab.active { display: flex; flex-direction: column; padding: 14px 24px 10px; gap: 8px; }
#general-tab > .card:first-child {
  display: flex; flex-direction: column;
  flex: 1 1 auto; min-height: 0;
  margin-bottom: 0;
}

/* Compose */
.cgrid{display:grid;grid-template-columns:1fr 1fr;gap:16px;}
.dp{background:var(--card);border:1px solid var(--border);border-radius:10px;padding:14px;font-size:12.5px;line-height:1.7;white-space:pre-wrap;min-height:100px;color:var(--text);}
.dm{font-size:11.5px;color:var(--muted);margin-bottom:8px;}
.dm span{font-weight:600;color:var(--text);}
@media(max-width:700px){.cgrid{grid-template-columns:1fr;}}

/* ── Admin dashboard — sectioned, uniform, calm ───────────── */
#admin-tab{max-width:1180px;margin:0 auto;}
.admin-sec{padding:18px 2px 8px;margin:18px 0 10px;border-bottom:1px solid var(--border);display:flex;align-items:baseline;gap:12px;flex-wrap:wrap;}
.admin-sec:first-child{margin-top:0;padding-top:0;}


.ahead{display:flex;justify-content:space-between;align-items:baseline;gap:12px;flex-wrap:wrap;margin-bottom:4px;}
.ahead h3{margin:0;font-size:15px;font-weight:600;letter-spacing:-.2px;color:var(--text);}
.ahead .actions{display:flex;gap:6px;align-items:center;flex-wrap:wrap;}

/* Big "currently processing" card — calmer than the old purple-orange blast */

/* Stage tile within proc-card */

/* Reconciliation row (on-disk vs in-index) */

/* List row used in: namespaces, sources, recent */


/* ─── PDF SPLIT-VIEW PREVIEW ───────────────────────────────────────────
   Opens when a PDF is dropped on an invoice routine drop zone. Takes the
   LEFT half of the viewport. The rest of the page (header + main) shifts
   to the right half. A floating button on the right edge of the panel
   toggles full-screen. */

/* Shift the rest of the page right when the preview is open */

/* Loading bar inside the original drop zone — shown briefly after drop */

/* ─────────────────────────────────────── */


/* ─────────────────────────────────────── */

#calendar-tab { max-width: 1100px; margin: 0 auto; }
.cal-nav-btn { background:none; border:1px solid var(--border); border-radius:8px; padding:5px 12px; cursor:pointer; font-size:14px; color:var(--text); font-weight:600; }
.cal-nav-btn:hover { background:var(--card); }
.cal-month-label { font-size:16px; font-weight:700; min-width:140px; text-align:center; }
.cal-filters { display:flex; gap:6px; flex-wrap:wrap; align-items:center; }
.cal-filter-btn { padding:4px 11px; border-radius:99px; border:1.5px solid var(--border); background:var(--surface); font-size:11.5px; font-weight:600; cursor:pointer; color:var(--soft); transition:all .13s; }
.cal-filter-btn:hover { border-color:#aaa; color:var(--text); }
.cal-filter-btn.active { color:#fff; border-color:transparent; }
.cal-filter-btn[data-type="all"].active     { background:#374151; }
.cal-filter-btn[data-type="inspection"].active { background:#1d4ed8; }
.cal-filter-btn[data-type="follow-up"].active  { background:#c2410c; }
.cal-filter-btn[data-type="meeting"].active    { background:#6d28d9; }
.cal-filter-btn[data-type="deadline"].active   { background:#b91c1c; }
.cal-filter-btn[data-type="other"].active      { background:#4b5563; }
.cal-grid { display:grid; grid-template-columns:repeat(7,1fr); gap:0; border:1px solid var(--border); border-radius:12px; overflow:hidden; }
.cal-dow  { background:var(--card); padding:7px 4px; text-align:center; font-size:11px; font-weight:700; color:var(--muted); text-transform:uppercase; letter-spacing:.5px; border-bottom:1px solid var(--border); }
.cal-cell { min-height:90px; padding:6px; border-right:1px solid var(--border); border-bottom:1px solid var(--border); cursor:pointer; transition:background .1s; position:relative; vertical-align:top; background:var(--surface); }
.cal-cell:nth-child(7n) { border-right:none; }
.cal-cell:hover { background:rgba(255,107,26,.04); }
.cal-cell.other-month { background:var(--card); opacity:.5; }
.cal-cell.today { background:rgba(255,107,26,.07); }
.cal-cell.today .cal-day-num { background:var(--orange); color:#fff; }
.cal-day-num { display:inline-flex; align-items:center; justify-content:center; width:22px; height:22px; border-radius:50%; font-size:12px; font-weight:600; color:var(--text); margin-bottom:4px; }
.cal-chip { display:block; font-size:10.5px; font-weight:600; border-radius:4px; padding:2px 5px; margin-bottom:2px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; cursor:pointer; line-height:1.4; }
.cal-chip:hover { filter:brightness(.93); }
.cal-chip-inspection { background:#dbeafe; color:#1d4ed8; }
.cal-chip-follow-up  { background:#ffedd5; color:#c2410c; }
.cal-chip-meeting    { background:#ede9fe; color:#6d28d9; }
.cal-chip-deadline   { background:#fee2e2; color:#b91c1c; }
.cal-chip-other      { background:#f3f4f6; color:#374151; }
.cal-chip-task       { background:#f5f3ff; color:#6d28d9; border:1px dashed #c4b5fd; }
.cal-chip-task:hover { background:#ede9fe; }
.cal-body { display:grid; grid-template-columns:1fr 260px; gap:18px; align-items:start; }
@media (max-width:760px) { .cal-body { grid-template-columns:1fr; } }
.cal-upcoming-card { background:var(--card); border:1px solid var(--border); border-radius:12px; padding:14px; position:sticky; top:12px; }
.cal-upcoming-card h4 { margin:0 0 10px 0; font-size:13px; font-weight:700; }
.cal-upcoming-item { padding:8px 0; border-bottom:1px solid var(--border); cursor:pointer; }
.cal-upcoming-item:last-child { border-bottom:none; }
.cal-upcoming-item:hover .cal-upcoming-title { color:var(--orange); }
.cal-upcoming-title { font-size:13px; font-weight:600; }
.cal-upcoming-meta  { font-size:11px; color:var(--muted); margin-top:2px; }
.cal-upcoming-dot   { display:inline-block; width:8px; height:8px; border-radius:50%; margin-right:5px; flex-shrink:0; }

/* ── 10-day view ── */

/* ─────────────────────────────────────── */

/* Layout */

    /* Stage chips — bigger, clearer */
    .wb-chip { padding:10px 18px; border:1.5px solid #d8d8de; border-radius:24px; background:#fff; cursor:pointer; font-size:13px; font-weight:500; user-select:none; transition:all .12s; display:inline-flex; align-items:center; gap:8px; }
    .wb-chip:hover { border-color:#a8a8b0; background:#f5f5f7; }
    .wb-chip.active { background:var(--orange); color:#fff; border-color:var(--orange); box-shadow:1px 2px 6px rgba(255,107,26,0.25); }
    .wb-chip-count { background:rgba(0,0,0,0.08); padding:2px 9px; border-radius:11px; font-size:11px; font-weight:700; min-width:20px; text-align:center; }
    .wb-chip.active .wb-chip-count { background:rgba(255,255,255,0.25); color:#fff; }

    /* Kanban — Label → Follow up → Bill → Done. Done is collapsed; the
       three actionable stages get equal width. */
    /* Fork board: To Be Confirmed (amber) → Simple (blue) | Complex (orange) → Done (green) */
    /* legacy classes kept so any un-remapped row still styles */

    /* Inline data-entry fields */
    .wb-input { padding:6px 10px; border:1px solid #d8d8de; border-radius:6px; font-size:12px; font-family:inherit; background:#fff; transition:border-color .12s, background .12s; }
    .wb-input:focus { outline:none; border-color:var(--orange); background:#fffaf5; }
    /* The expanded card's Type of work and Category pickers fill their column like the text fields. */
    select.wb-input { width:100%; }
    .wb-textarea { padding:6px 10px; border:1px solid #d8d8de; border-radius:6px; font-size:12px; font-family:inherit; resize:vertical; min-height:44px; background:#fff; transition:border-color .12s, background .12s; }
    .wb-textarea:focus { outline:none; border-color:var(--orange); background:#fffaf5; }

    /* Stage pill — bigger */
    /* Action buttons — per-stage colors */
    /* Label Focus primary CTA — green = "confirm, advance to follow-up". Made
       visually loud so it's obviously THE action on the page. */
    /* Label-Focus confirm button forced red w/ white text for legibility. Scoped to the
       id (not .lf-confirm-cta) so the shared green confirm buttons elsewhere stay green. */
    /* Compound selectors (.wb-btn.X) so the colored background beats the base
       .wb-btn white — without this, white text lands on a white bg. */

    .wb-kind-badge { font-size:10px; padding:3px 9px; border-radius:4px; background:#eee; text-transform:uppercase; font-weight:700; letter-spacing:0.3px; }
    .wb-kind-email { background:#fff2d4; color:#8a5a00; }
    .wb-kind-wo    { background:#d8efd8; color:#0a5a0a; }
    /* Origin-lane badge — shows whether a downstream WO was tagged Simple or
       Complex back at the fork, so Ready/Generated/Done still carry that. */
    /* Bill tier (1–3) — the surfaced classification that replaces Simple/Complex. */
    .wb-tier-badge { font-size:10px; padding:3px 9px; border-radius:11px; font-weight:700; text-transform:uppercase; letter-spacing:0.3px; display:inline-flex; align-items:center; gap:4px; }
    .wb-tier1 { background:#e7f5ec; color:#0f7a3d; border:1px solid #86cfa4; }
    .wb-tier2 { background:#fdeede; color:#9a4a00; border:1px solid #f0b070; }
    .wb-tier3 { background:#fbe7e7; color:#9b1c1c; border:1px solid #e79b9b; }
    /* Job-completion gate — a Simple/Complex WO can't be billed until done. */
    /* Named piles: new-pile (light) + generate-pile (solid purple, white text on color — never white-on-white) */
    /* Invoice AI-match: suggest (light indigo) + confirm (green, white on color) */
    /* Ready "build your shards" interactivity */
    /* Solid blue action (Mark complete + Ready to bill) — solid even when the
       Ready button is disabled, so it reads as a real button, not a ghost.
       Compound selector so it wins over the base .wb-btn white. */
    /* Lane re-route (→ Complex / → Simple) — a SECONDARY choice, so it's a soft
       outlined button, not a third loud filled color competing with the primaries. */
    /* Send-back-one-stage — a quiet neutral "go back" control. */

    /* WO reference photos (not used by the AI — storage only). */

    /* Body — invoice block */

    /* Body — email block */

    /* Labels + actions */
    .wb-label { background:#e8e8ee; color:#3a3a45; padding:4px 11px; border-radius:14px; font-size:12px; display:inline-flex; align-items:center; font-weight:500; }
    .wb-label .x { margin-left:7px; cursor:pointer; opacity:0.5; font-size:14px; line-height:1; }
    .wb-label .x:hover { opacity:1; color:#a00; }
    .wb-label-input { padding:4px 11px; border:1px dashed #b8b8c0; border-radius:14px; font-size:12px; width:120px; background:transparent; outline:none; transition:border-color .15s; }
    .wb-label-input:focus { border-color:var(--orange); background:#fff; }

    /* Filled actions get a touch of depth so the row reads as real buttons. */


    /* ─── View toggle (Accounting | Operational) ─── */

    /* ─── Operational weekly calendar ─── */

    /* Operational job card */
    /* Duration + auto/locked state */
    /* Day capacity / overtime */

    /* ───────────────────────────────────────────────────────────────
       GRAPH VIEW — the pipeline drawn as a left→right directed graph.
       To Be Confirmed ─┬─ Simple ─┐
                        └─ Complex ┴─ Ready ── Generated ── Done
       Nodes are clickable; clicking one drills its work orders into the
       panel below. Edges are an SVG layer measured from the live layout.
       ─────────────────────────────────────────────────────────────── */
    /* ── Review carousel ─────────────────────────────────────────────── */
    @keyframes wb-flow { to { stroke-dashoffset:-14; } }

    /* A node = one stage. Accent color comes from --nc / --nc2 set inline. */
    /* the fork node spans both rows so it sits centered between Simple/Complex */

    /* Detail panel below the graph — cards for the selected stage. */
    .wb-panel-body { padding:16px; display:grid; grid-template-columns:repeat(auto-fill,minmax(330px,1fr)); gap:14px; align-items:start; }

    /* Stage-history popup — click a WO to see its journey + the view it had at
       each earlier stage (defaults to the previous stage). */
    /* Timeline rail of stages the WO passed through. */
    /* Email Tool — clickable source-email cards under each answer, + the
       mini email-reader popup they open (work-order Label-Focus styling). */
    /* Details modal — clean, formatted alternative to the raw JSON dump. */
    /* The Details modal renders the SAME body / portal-card markup the labeling
       carousel does (lf-email-body, rp-portal). Those styles are scoped to
       #label-focus-tab, so re-declare them here (scoped to .wbsm-modal) or the
       plain-text + portal views would come out as raw, unstyled text. */

    /* "How this works" explainer — the human process + what the stages mean. */
    /* ─────────────────────────────────────── */


/* ─────────────────────────────────────── */

                          /* Editable pricing sources */

/* ─────────────────────────────────────── */

    /* Large ledgers (HW Foote) — give the editable table the dominant width. */
    /* ─────────────────────────────────────── */

#hw-foote-tab { padding:0; }
  /* ─────────────────────────────────────── */

    /* Match-Invoices renders the SAME body / portal-card markup (lf-email-body,
       rp-portal) as the labeling carousel — see miRenderCurrent()'s no-attachment
       fallback. Share the scope with #match-invoices-tab or that preview comes
       out as raw, unstyled text. (cf. the .wbsm-modal re-declarations above.) */
    /* RealPage portal SR — clean sectioned key/value card (the "HTML view" look) */
    /* Labeling guide */
    /* Copyable email message block */

/* ─────────────────────────────────────── */


/* ─────────────────────────────────────── */


    /* Header bar */

    /* Sheet pill tabs */

    /* Table shell */

    /* Body rows */

    /* Cell: read mode */

    /* Cell: edit mode input */

    /* Save flash animations */

    /* Add-row form */


/* ─────────────────────────────────────── */

/* ─────────────────────────────────────── */

#hl-grid-table table.dg{border-collapse:separate;border-spacing:0;width:100%;min-width:640px;font-size:12.5px;}
#hl-grid-table .dg thead th{position:sticky;top:0;z-index:3;background:var(--card-2);border-bottom:2px solid var(--border-strong);padding:8px 4px;color:var(--soft);font-weight:600;text-align:center;}
#hl-grid-table .dg tbody td{border-bottom:1px solid var(--border);height:40px;}
#hl-grid-table .dg tbody tr:nth-child(even) td{background:var(--card);}
#hl-grid-table .dg tbody tr:hover td{background:rgba(255,107,26,.07);}
#hl-grid-table .dg tfoot td{position:sticky;bottom:0;z-index:3;background:#eef0f4;border-top:2px solid var(--border-strong);font-weight:800;text-align:center;padding:9px 4px;color:var(--text);font-size:13px;}

/* ─────────────────────────────────────── */


/* ─────────────────────────────────────── */


/* ─────────────────────────────────────── */


/* ─────────────────────────────────────── */


/* ── Ground Truth panel (shared: Details card + Print Queue preview + AR matchers) ── */
.sed{border:1px solid var(--border,rgba(0,0,0,.12));border-radius:12px;padding:14px;background:var(--card,#fafafc);}
.sed-head{display:flex;align-items:center;gap:10px;flex-wrap:wrap;margin-bottom:8px;}
.sed-title{font-size:14px;font-weight:800;}
.sed-meta{font-size:12px;color:var(--soft,#555);line-height:1.5;margin-bottom:10px;}
.sed-pages{display:flex;flex-direction:column;gap:10px;max-height:70vh;overflow:auto;}
/* WORK-ORDER-ONLY PANEL — shown when no source document or email body survived
   ingestion. It stands in for the document, so it is deliberately quieter than
   one: a flagged banner, then the job's own words, then its fields. Reads as a
   record, not as paperwork, so nobody mistakes it for the real thing. */
.sed-fb{display:flex;flex-direction:column;gap:14px;}
.sed-fb__flag{font-size:12.5px;line-height:1.5;color:var(--text);background:var(--amber-weak);border:1px solid var(--amber-line);border-left:3px solid var(--amber);border-radius:8px;padding:10px 12px;}
.sed-fb__flag b{display:block;font-size:13px;font-weight:800;margin-bottom:3px;}
.sed-fb__lbl{font-size:11px;font-weight:800;letter-spacing:.04em;text-transform:uppercase;color:var(--muted);margin-bottom:6px;}
.sed-fb__scope{border:1px solid var(--border);border-radius:8px;padding:11px 12px;background:var(--card-2);}
.sed-fb__scope p{margin:0 0 8px;font-size:13.5px;line-height:1.55;color:var(--text);white-space:pre-wrap;}
.sed-fb__scope p:last-child{margin-bottom:0;}
.sed-fb__scope--empty p{color:var(--muted);font-style:italic;}
.sed-fb__dl{display:grid;grid-template-columns:auto 1fr;gap:5px 14px;margin:0;font-size:12.5px;line-height:1.45;}
.sed-fb__dl dt{color:var(--muted);white-space:nowrap;}
.sed-fb__dl dd{margin:0;color:var(--text);font-weight:600;overflow-wrap:anywhere;}
.sed-fb__portal{align-self:flex-start;font-size:12.5px;font-weight:700;color:var(--blue);text-decoration:none;}
.sed-fb__portal:hover{text-decoration:underline;}
.sed-pagewrap{position:relative;display:block;line-height:0;}
/* Everything past page 1 folds away: page 1 carries the WO number, address and
   unit, and the rest were eating the pane's height unread. */
.sed-more{border-top:1px solid var(--border,rgba(0,0,0,.12));margin-top:2px;padding-top:8px;}
.sed-more__sum{cursor:pointer;font-size:12px;font-weight:600;color:var(--muted,#666);list-style:none;padding:3px 0;line-height:1.4;}
.sed-more__sum::-webkit-details-marker{display:none;}
.sed-more__sum::before{content:"▸";display:inline-block;margin-right:6px;transition:transform .15s ease;}
.sed-more[open] > .sed-more__sum::before{transform:rotate(90deg);}
.sed-more__sum:hover{color:var(--fg,#111);}
.sed-more__sum:focus-visible{outline:2px solid #ff6b1a;outline-offset:2px;border-radius:4px;}
/* Scoped to [open] on purpose: an unscoped `display:flex` here is an AUTHOR rule
   that outranks the UA rule hiding a closed <details>, so the pages would stay on
   screen and the fold would collapse nothing. */
.sed-more[open] > .sed-more__body{display:flex;flex-direction:column;gap:10px;margin-top:8px;}
.sed-page{width:100%;height:auto;min-height:120px;background:var(--card-2,#f5f5f7);border:1px solid var(--border,rgba(0,0,0,.12));border-radius:8px;box-shadow:1px 1px 3px rgba(0,0,0,.06);}
/* A PAGE THAT DID NOT RENDER MUST NOT LEAVE ITS BOXES BEHIND. `.sed-page` is
   height:auto, so a failed PNG collapses the image to nothing — while
   `.sed-pagewrap` stays position:relative and the highlight boxes, positioned in
   PERCENTAGES of that now-zero box, keep drawing. The result is a grey line with
   coloured bars on it and no page: unreadable, and it reads as corrupt data
   rather than a missing image. min-height above keeps the frame; this hides the
   orphaned overlay and says what happened. */
.sed-pagewrap.is-broken .sed-box{display:none;}
.sed-pagewrap.is-broken::after{content:attr(data-broken);position:absolute;inset:0;display:flex;align-items:center;justify-content:center;padding:12px;font-size:12.5px;line-height:1.5;color:var(--muted,#86868b);text-align:center;}
/* Overlay boxes: bigger (3px border) + a different color per kind of field. The
   matched text rides in title=; the legend above the pages spells out the colors. */
.sed-box{position:absolute;border:3px solid #ff3b30;background:rgba(255,59,48,.10);border-radius:3px;pointer-events:none;box-shadow:0 0 0 1px rgba(255,255,255,.6) inset;}
.sed-box--wo{border-color:#ff3b30;background:rgba(255,59,48,.12);}
.sed-box--address{border-color:#0a84ff;background:rgba(10,132,255,.12);}
.sed-box--issue{border-color:#8e44ad;background:rgba(142,68,173,.15);}
.sed-box--service{border-color:#13a05a;background:rgba(19,160,90,.15);}
.sed-box--meta{border-color:#ff9500;background:rgba(255,149,0,.13);}
.sed-box--field{border-color:#ff3b30;background:rgba(255,59,48,.10);}
/* The floor-plan DRAWING (Ivan, 2026-09-07: billing is off the plan). Thicker,
   dashed, teal, so it reads as "this region" rather than "this text", and the
   one box that takes clicks: it is a link to the full-resolution page. */
.sed-box--plan{border:4px dashed #0e8a8a;background:rgba(14,138,138,.07);pointer-events:auto;cursor:zoom-in;
  box-shadow:0 0 0 2px rgba(255,255,255,.85) inset;text-decoration:none;}
.sed-box--plan:hover,.sed-box--plan:focus-visible{background:rgba(14,138,138,.16);border-style:solid;outline:none;}
.sed-box--plan::before{content:attr(data-tag);position:absolute;left:-4px;top:-4px;padding:2px 8px;
  font-size:11px;font-weight:800;line-height:1.3;letter-spacing:.02em;color:#fff;background:#0e8a8a;
  border-radius:3px 0 6px 0;white-space:nowrap;}
.sed-legend{display:flex;gap:14px;flex-wrap:wrap;font-size:11px;font-weight:700;color:#444;margin:0 2px 8px;}
.sed-legend span{display:inline-flex;align-items:center;gap:5px;}
.sed-legend i{width:13px;height:13px;border-radius:3px;border:2px solid;box-sizing:border-box;}
.sed-legend .lg-wo{border-color:#ff3b30;background:rgba(255,59,48,.2);}
.sed-legend .lg-address{border-color:#0a84ff;background:rgba(10,132,255,.2);}
.sed-legend .lg-issue{border-color:#8e44ad;background:rgba(142,68,173,.22);}
.sed-legend .lg-service{border-color:#13a05a;background:rgba(19,160,90,.22);}
.sed-legend .lg-meta{border-color:#ff9500;background:rgba(255,149,0,.22);}
.sed-legend .lg-plan{border-color:#0e8a8a;border-style:dashed;background:rgba(14,138,138,.15);}
/* ── Scope spotlight (Ground Truth opened while linking a bill) ───────────────
   The reviewer's question is "is this the same JOB", so the SCOPE boxes (Issue
   description / Service comments) burn bright and the identifier boxes drop back
   — right building + right unit + wrong work is the mistake that pays the wrong
   invoice, and it hides in a page of equally-weighted boxes. */
.sed-legend__lit{color:#6d28d9;background:#f5f0ff;border:1px solid #ddd0f2;border-radius:999px;padding:1px 9px;}
.sed--scopelit .sed-box{opacity:.22;border-width:2px;}
.sed--scopelit .sed-box--plan{opacity:.6;border-width:3px;}
.sed--scopelit .sed-box--issue,.sed--scopelit .sed-box--service{opacity:1;border-width:4px;
  box-shadow:0 0 0 3px rgba(255,255,255,.9),0 0 16px 4px rgba(142,68,173,.45);
  animation:sed-scope-pulse 2.2s ease-in-out 3;}
@keyframes sed-scope-pulse{0%,100%{box-shadow:0 0 0 3px rgba(255,255,255,.9),0 0 16px 4px rgba(142,68,173,.45);}
  50%{box-shadow:0 0 0 3px rgba(255,255,255,.9),0 0 26px 9px rgba(142,68,173,.65);}}
@media (prefers-reduced-motion:reduce){.sed--scopelit .sed-box--issue,.sed--scopelit .sed-box--service{animation:none;}}
/* The strip: the two scopes as each document words them, shared words marked. */
.sed-scope{border:1px solid #ddd0f2;border-left:4px solid #8e44ad;border-radius:10px;
  background:#faf7ff;padding:11px 14px;margin:0 0 11px;}
.sed-scope--strong{border-color:#a7dcbc;border-left-color:#13a05a;background:#f4fdf7;}
.sed-scope--none{border-color:#f3c9c9;border-left-color:#d65a5a;background:#fff7f7;}
.sed-scope__hd{display:flex;align-items:center;gap:9px;flex-wrap:wrap;margin-bottom:8px;}
.sed-scope__title{font-size:13.5px;font-weight:800;color:#2c2c33;}
.sed-scope__pill{font-size:10.5px;font-weight:800;letter-spacing:.03em;text-transform:uppercase;
  color:#5b3aa0;background:#fff;border:1px solid #ddd0f2;border-radius:999px;padding:2px 9px;white-space:nowrap;}
.sed-scope--strong .sed-scope__pill{color:#0c5132;border-color:#9ad3ad;}
.sed-scope--none .sed-scope__pill{color:#8a2b2b;border-color:#e9b4b4;}
.sed-scope__row{display:grid;grid-template-columns:9.5rem 1fr;gap:4px 12px;align-items:baseline;margin:0 0 5px;}
.sed-scope__lbl{font-size:10.5px;font-weight:800;letter-spacing:.04em;text-transform:uppercase;color:#8b8b96;}
.sed-scope__txt{font-size:13px;line-height:1.45;color:#1a1a1f;}
.sed-scope__verdict{font-size:12.5px;line-height:1.45;color:#4a4a55;margin:8px 0 0;}
/* A shared scope word, marked in the document text — distinct from the plain
   yellow field-value <mark> so "the job" reads apart from "the identifiers". */
.sed mark.mk-scope{background:#e9d5ff;box-shadow:0 0 0 1px #c4a4e8 inset;}
/* Honest banner: the source PDF wasn't captured, so we're showing the text instead. */
.sed-warn{font-size:12.5px;line-height:1.45;color:#7a4500;background:#fff3cd;border:1px solid #e0a800;
  border-radius:8px;padding:9px 12px;margin:0 0 10px;}
.sed mark{background:#fff3a3;color:inherit;padding:0 1px;border-radius:2px;}
.sed-frame{width:100%;height:60vh;border:1px solid var(--border,rgba(0,0,0,.12));border-radius:8px;background:#fff;}
/* The email body rendered as a human reads it: a readable sans-serif block (NOT a
   monospace dump, NOT a blank iframe), line breaks preserved, field values <mark>ed. */
.sed-email{white-space:pre-wrap;word-break:break-word;
  font:13.5px/1.6 -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Helvetica,Arial,sans-serif;
  color:#1a1a1f;background:#fff;border:1px solid var(--border,rgba(0,0,0,.12));border-radius:8px;
  padding:16px 18px;margin:0;max-height:60vh;overflow:auto;}

.pq-held{display:flex;align-items:center;gap:6px;flex-wrap:wrap;}

/* ── Print-log filter bar ── a .toolbar; its type select stays readable. */
#print-queue-body .toolbar select{min-width:150px;}

/* ── Region (proximity) sections ───────────────────────────────────────── */
.region{margin-bottom:22px;}

/* ── Compact, collapsible property cards ───────────────────────────────── */
.prop-card{border:1px solid var(--border,rgba(0,0,0,.10));border-left:3px solid var(--muted,#c8c8cf);
  border-radius:11px;background:var(--surface,#fff);overflow:hidden;transition:box-shadow .15s,border-color .15s;}
.prop-card:hover{box-shadow:1px 1px 8px rgba(0,0,0,.06);}
.prop-card--green{border-left-color:var(--green,#34c759);}
.prop-card--red{border-left-color:var(--red,#ff3b30);}
.prop-card--amber{border-left-color:var(--orange,#ff6b1a);}
.prop-card__head{display:flex;align-items:center;gap:9px;cursor:pointer;list-style:none;padding:11px 13px;}
.prop-card__head::-webkit-details-marker{display:none;}
.prop-card__chev{color:var(--muted,#9a9aa4);font-size:15px;font-weight:700;line-height:1;
  transition:transform .15s ease;flex:0 0 auto;}
.prop-card[open]>.prop-card__head .prop-card__chev{transform:rotate(90deg);}
.prop-card__title{display:flex;flex-direction:column;gap:1px;min-width:0;flex:1 1 auto;}
.prop-card__addr-line{font-size:13.5px;font-weight:700;color:var(--text,#222);line-height:1.25;
  overflow:hidden;text-overflow:ellipsis;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;}
.prop-card__count{font-size:11px;color:var(--muted,#86868b);font-weight:500;}
.prop-card__body{display:flex;flex-direction:column;gap:9px;max-height:520px;overflow-y:auto;
  padding:2px 13px 13px;border-top:1px solid var(--border,rgba(0,0,0,.06));}
.prop-card--flash{box-shadow:0 0 0 2px var(--orange,#ff6b1a);border-color:var(--orange,#ff6b1a);}

.prop-badge{display:inline-flex;align-items:center;gap:4px;font-size:12px;font-weight:800;
  padding:.28rem .55rem;border-radius:999px;white-space:nowrap;flex:0 0 auto;}
.prop-badge--green{background:rgba(52,199,89,.14);color:var(--green-d);}
.prop-badge--red{background:rgba(255,59,48,.13);color:var(--red-d);}
.prop-badge--amber{background:rgba(255,149,0,.16);color:var(--yellow-d);}

/* ── Map pins ───────────────────────────────────────────────────────────── */
/* Custom marker: a Leaflet divIcon whose innerHTML is this dot + tooltip. */
.map-pin{cursor:pointer;transition:transform .1s;}
.map-pin:hover{transform:scale(1.12);z-index:1000!important;}
.map-pin.is-dim{opacity:.2;}
.map-pin__tip{background:#1c1c1e;color:#fff;font-size:11px;font-weight:600;padding:4px 8px;
  border-radius:6px;white-space:nowrap;border:none;box-shadow:none;}
.map-pin__tip::before{display:none;}

.worker-chip{display:inline-flex;align-items:center;gap:6px;font-size:12.5px;font-weight:600;
  border:1px solid var(--border-strong,rgba(0,0,0,.14));border-radius:999px;background:var(--card-2,#f5f5f7);
  color:var(--text,#222);padding:.3rem .65rem .3rem .5rem;cursor:pointer;font-family:inherit;}
.worker-chip:hover{border-color:var(--soft,#6e6e73);}
.worker-chip__light{width:9px;height:9px;border-radius:50%;flex:0 0 auto;background:#9a9aa4;}
.worker-chip--grey .worker-chip__light{background:#9a9aa4;}
.worker-chip--yellow .worker-chip__light{background:var(--yellow,#ff9500);}
.worker-chip--red .worker-chip__light{background:var(--red,#ff3b30);}
.worker-chip--green .worker-chip__light{background:var(--green,#34c759);}

/* ── WO AI search bar ─────────────────────────────────────────────────────── */
.wo-search-form{margin:14px 0 6px;}
.wo-search-row{display:flex;gap:8px;align-items:center;}
.wo-search-input{flex:1;padding:11px 14px;border:1.5px solid var(--border-strong);border-radius:10px;font-size:14px;background:var(--surface);color:var(--text);min-width:0;transition:border-color .15s;}
.wo-search-input:focus{outline:none;border-color:var(--orange);}
.wo-search-loading{display:none;font-size:12px;color:var(--muted);margin-top:6px;}
.htmx-request .wo-search-loading{display:block;}
.wo-search-interp{background:var(--card);border:1px solid var(--border);border-radius:10px;padding:10px 14px;font-size:13px;margin-bottom:12px;}
.wo-search-interp strong{color:var(--text);}
.wo-search-answer{margin-top:5px;color:var(--text);font-style:italic;}

/* ── Invoices: unified accounts-payable board ───────────────────────────── */
.inv-card-amt{font-size:18px;font-weight:700;}
.inv-verify{display:grid;grid-template-columns:1fr 1fr;gap:28px;align-items:start;}
/* Inside the Approvals queue's pane, too narrow for two columns: the invoice, then the work order. */
.inv-verify--stack{grid-template-columns:minmax(0,1fr);gap:18px;}
@media(max-width:900px){.inv-verify{grid-template-columns:1fr;}}
.inv-verify iframe{width:100%;height:78vh;border:1px solid var(--border);border-radius:10px;background:#fff;}
.inv-doc-empty{height:78vh;display:flex;align-items:center;justify-content:center;border:1px dashed var(--border-strong);border-radius:10px;color:var(--muted);}
.inv-warn{color:var(--red-d);font-weight:600;}
/* `.badge--purple` was redefined here in a DIFFERENT purple (#f3e8ff/#7c3aed)
   from the one two other rules already agree on, so the same badge rendered
   one shade with `.badge` on it and another shade without. Removed 2026-08-24;
   the definitions near .badge--blue and .badge.badge--purple are the pair that
   agree, and they are now the only two. */

/* Roll call reach ladder (hours/_roll_call_reach.html): the next step's
   button with a line on why it is the next one, today's log under it. */
.rc-reach{display:flex;flex-direction:column;gap:6px;margin-top:6px;}
.rc-reach__step{display:flex;align-items:center;flex-wrap:wrap;gap:8px;}

/* The bill beside the phones (operations/_bill_table.html, on Contracts
   and Recurring jobs): each bill line, and beside it the jobs on the
   crew's phones it pays for, as chips. */
.pre{white-space:pre-line;}
.bill-map h4{display:flex;gap:8px;align-items:center;}
.bill-table{table-layout:fixed;}
.bill-table .bt-line{width:42%;}
.bill-table td{vertical-align:top;}
.bill-table textarea,.bill-table input[type=text]{width:100%;box-sizing:border-box;}
.bill-table input.bt-rate{width:96px;text-align:right;}
.job-chips{display:flex;flex-wrap:wrap;gap:8px;}
.job-chip{border:1px solid var(--line);border-left:4px solid var(--navy);border-radius:var(--radius-sm);padding:6px 10px;display:grid;gap:3px;min-width:180px;max-width:320px;background:var(--surface);}
.job-chip__task{font-weight:700;}
.job-chip__how{background:var(--teal-weak);border:1px solid var(--teal-line);border-radius:6px;padding:4px 6px;font-size:12px;}
.job-chip__media{display:grid;gap:4px;}
.job-chip__media video,.job-chip__media audio{width:100%;max-height:140px;}
.job-chip select{width:100%;}
