/* Layers, lowest to highest (Ella 2026-10-26: "make sure all popups register on top"): one scale for everything that
   floats, so a menu, list or tooltip never opens underneath something else. Pop-ups (<dialog>) are above all of
   these by themselves; a list inside one opens inside it (app.js). */
:root { --layer-sticky: 2; --layer-menu: 200; --layer-overlay: 300; --layer-dropdown: 400; --layer-tooltip: 500; }

/* Colours, fonts and the top bar live in theme.css (shared with the admin). */
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select { font: inherit; color: inherit; }
input, select { background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px; }
button { cursor: pointer; border: 1px solid var(--line); background: var(--surface); border-radius: 6px; padding: 6px 10px; }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
button.link { border: 0; background: none; padding: 0; color: var(--accent); }
button.link.danger { color: var(--danger); }
.nowrap { white-space: nowrap; }
.small { font-size: .875rem; color: var(--muted); }

.page { padding: 16px; }
.msg { padding: 8px 12px; border-radius: 6px; margin-bottom: 12px; background: var(--accent-soft); }
.msg.error { background: var(--danger-soft); color: var(--danger); }
.msg.success { background: var(--ok-soft); color: var(--ok); }
.msg.warning { background: var(--warn-soft); color: var(--warn); }

.login { display: grid; place-items: center; min-height: 100vh; padding: 16px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 24px; }
.login-card { width: min(360px, 100%); display: grid; gap: 12px; }
.login-card h1 { margin: 0 0 8px; color: var(--brand); }
.login-card label { display: grid; gap: 4px; font-size: .93rem; color: var(--muted); }

.views { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; margin-bottom: 12px; }
.views .tab { padding: 6px 12px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); color: var(--text); }
.views .tab.mine { border-style: dashed; }
.views .tab.active { background: var(--brand); color: #fff; border-color: var(--brand); }
details { position: relative; }
details > summary { list-style: none; cursor: pointer; padding: 6px 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); }
details > summary::-webkit-details-marker { display: none; }
details .menu { position: absolute; z-index: var(--layer-menu); margin-top: 4px; background: var(--surface); border: 1px solid var(--line);
                border-radius: 8px; padding: 8px; display: grid; gap: 6px; min-width: 220px; box-shadow: 0 6px 20px rgba(0,0,0,.12); }
.view-menu .menu { right: 0; }
.view-menu form { display: flex; gap: 6px; margin: 0; }
.multi .menu label { white-space: nowrap; }

/* Project list filters (screens-home-and-list.md rules 8-10a, 2026-11-03): a search and Sort by, then labelled filters */
.filters { display: flex; flex-direction: column; gap: 10px; margin-bottom: 10px; padding: 12px 14px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 8px; }
.filters-top { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; }
.filters-top #q { flex: 1 1 260px; max-width: 32rem; }
.filter-state { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-left: auto; }
.inline-field { display: inline-flex; gap: 6px; align-items: center; color: var(--muted); margin: 0; }
.clear-filters { white-space: nowrap; }
.filter-fields { display: flex; flex-wrap: wrap; gap: 10px 18px; align-items: flex-end; }
.filter-dates { padding-top: 10px; border-top: 1px solid var(--line); }
.filters .field { display: flex; flex-direction: column; gap: 4px; margin: 0; }
.filters .field > span:first-child { font-size: .78rem; font-weight: 600; color: var(--muted); text-transform: uppercase;
  letter-spacing: .03em; }
.filters .multi > summary { min-width: 9rem; }
.date-inputs { display: flex; gap: 10px 18px; }
.quick { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border-radius: 14px; padding: 3px 10px; font-size: .93rem; }
.chip.on { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.chip.clear { color: var(--muted); }

.count { color: var(--muted); margin: 8px 0; }
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; }
table.list, table.totals { border-collapse: collapse; width: 100%; }
table.list th, table.list td, table.totals th, table.totals td { padding: 6px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
table.list th { position: sticky; top: 0; z-index: var(--layer-sticky); background: var(--surface); font-size: .875rem; color: var(--muted); font-weight: 600; white-space: nowrap; }
table.list tbody tr:hover { background: var(--accent-soft); }
.num { text-align: right !important; }
.center { text-align: center !important; }
th button.sort { border: 0; background: none; padding: 0; color: inherit; font-weight: inherit; }
th button.sort.asc::after { content: " ▲"; }
th button.sort.desc::after { content: " ▼"; }
a.job { font-weight: 600; }
.badge { display: inline-block; padding: 1px 8px; border-radius: 10px; background: var(--accent-soft); color: var(--text); font-size: .875rem; white-space: nowrap; }
.badge.s-shipped, .badge.s-received { background: var(--ok-soft); color: var(--ok); }
.badge.s-on-hold { background: var(--warn-soft); color: var(--warn); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.s-cancelled, .badge.s-not-proceeding { background: var(--danger-soft); color: var(--danger); }
.flag { display: inline-block; margin: 0 4px 2px 0; padding: 0 6px; border-radius: 4px; background: var(--flag); font-size: .875rem; white-space: nowrap; }
.flag.mine { background: var(--flag-mine); font-weight: 600; }
.totals-title { font-size: 1rem; margin: 20px 0 8px; }
table.totals { width: auto; min-width: 360px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; }
.empty { color: var(--muted); padding: 24px; text-align: center; background: var(--surface); border-radius: 8px; }
.htmx-request #results, #results.htmx-request { opacity: .6; transition: opacity .2s; }

/* Project page (docs/rules/screens-project-page.md) */
.muted { color: var(--muted); }
.err { color: var(--danger); }
.ok { color: var(--ok); }
h1 { font-size: 1.43rem; margin: 0 0 12px; }
.project-header { display: flex; flex-wrap: wrap; gap: 12px 24px; align-items: flex-start; background: var(--surface);
                  border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; margin-bottom: 12px; position: relative; }
.project-header h1 { margin: 0; }
.project-header h1 span { font-weight: 400; }
.project-header .title { flex: 1 1 320px; }
.project-header .sub { color: var(--muted); margin-top: 4px; }
.project-header .facts { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; }
.project-header dl { display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 0; }
.project-header dl div { display: grid; }
.project-header dt { font-size: .8rem; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; }
.project-header dd { margin: 0; white-space: nowrap; }
.header-flags { flex-basis: 100%; }
.status-ask { flex-basis: 100%; margin: 4px 0; display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; padding: .5rem .75rem;
  border-radius: 6px; background: var(--warn-soft); color: var(--text); }
.status-ask > span { flex: 1 1 20rem; }
.header-links { position: absolute; right: 12px; bottom: 8px; display: flex; gap: 14px; }
.badge.archived { background: var(--grey-soft); color: var(--muted); }
.tabs { display: flex; gap: 2px; overflow-x: auto; border-bottom: 1px solid var(--line); margin-bottom: 12px; }
.tabs a { padding: 8px 14px; color: var(--muted); white-space: nowrap; border-bottom: 2px solid transparent; }
.tabs a.active { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }
.tabs a:hover { text-decoration: none; color: var(--text); }
/* A job on one page (screens-project-page.md rule 2a, 2026-11-03) */
.tabs .one-page-switch { margin-left: auto; color: var(--accent); }
.one-page-contents { position: sticky; top: 0; z-index: 5; background: var(--bg); padding-top: 4px; }
.one-page-part { scroll-margin-top: 56px; margin-bottom: 28px; }
.one-page-part > .part-title { margin: 22px 0 12px; padding: 0 0 6px; font-size: 1.2rem;
  border-bottom: 2px solid var(--accent); }
.one-page-part:first-child > .part-title { margin-top: 4px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(420px, 100%), 1fr)); gap: 12px; align-items: start;
        margin-bottom: 12px; }  /* a gap below a row of boxes too, so the next box never touches it (2026-10-21) */
.card { margin-bottom: 12px; }  /* every box keeps a gap below it */
.card.section { padding: 14px 16px; margin-bottom: 12px; }
.grid > .card, .grid .card.section { margin-bottom: 0; }  /* inside a grid, the grid's gap does it */
.section > header { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.section > header h2 { font-size: 1.07rem; margin: 0; }
.section > header .actions, .section .actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.section .actions form { margin: 0; }
.section > .actions, .edit-form .actions { margin-top: 12px; }
.small-btn { padding: 3px 10px; font-size: .93rem; }
dl.fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px 16px; margin: 0; }
dl.fields dt { font-size: .875rem; color: var(--muted); }
dl.fields dd { margin: 2px 0 0; overflow-wrap: anywhere; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px 14px; }
.form-grid label { display: grid; gap: 4px; align-content: start; }
.form-grid label > span { font-size: .875rem; color: var(--muted); }
.form-grid label.wide { grid-column: 1 / -1; }
.form-grid label.check { grid-auto-flow: column; justify-content: start; align-items: center; gap: 8px; }
.form-grid textarea { min-height: 90px; width: 100%; font: inherit; background: var(--surface); color: var(--text); border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px; }
.form-grid small { color: var(--muted); font-size: .875rem; }
.form-grid small.err { color: var(--danger); }
.form-grid input, .form-grid select { width: 100%; }
table.list.edit td { padding: 4px; }
table.list.edit input, table.list.edit select { width: 100%; min-width: 70px; }
tr.voided td { text-decoration: line-through; color: var(--muted); }
.inline-form { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; }
.inline-form .grow, .inline-form input[name="note"] { flex: 1 1 220px; }
.flag-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 4px 0; }
.flag-row form { margin: 0; }
.note { border-top: 1px solid var(--line); padding: 8px 0; }
ul.compact { margin: 4px 0 8px; padding-left: 18px; }
.list-actions { display: flex; justify-content: flex-end; margin-bottom: 8px; }
a.button { display: inline-block; padding: 6px 12px; border-radius: 6px; background: var(--accent); color: var(--on-accent); }
a.button:hover { text-decoration: none; }

/* Scan station (docs/rules/screens-scan-station.md) */
.scan-top { display: flex; flex-wrap: wrap; gap: 8px 20px; align-items: center; margin-bottom: 12px; }
.scan-top h1 { margin: 0; flex: 1 1 auto; }
.scan-layout { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 12px; align-items: start; }
.scan-layout.single { grid-template-columns: minmax(0, 1fr); max-width: 900px; }
@media (max-width: 900px) { .scan-layout { grid-template-columns: minmax(0, 1fr); } }
.scan-form input { width: 100%; font-size: 2rem; padding: 14px 16px; border: 2px solid var(--accent); border-radius: 10px; }
.scan-result { margin: 12px 0; padding: 16px; border-radius: 10px; font-size: 1.3rem; border: 2px solid var(--line); background: var(--surface); }
.scan-result.ok { background: #e3f6ec; border-color: #12b76a; color: #054f31; }
.scan-result.error { background: #fde8e8; border-color: #f04438; color: #7a271a; }
.scan-result.confirm { background: #fef0c7; border-color: #f79009; color: #7a2e0e; font-size: 1.43rem; }
.scan-result.confirm form { display: flex; gap: 10px; margin-top: 10px; }
.scan-result.confirm button { font-size: 1.3rem; padding: 10px 18px; }
.scan-result p { margin: 0 0 6px; }
a.button.big { padding: 12px 20px; font-size: 1.15rem; }
.wide-input { width: 100%; margin-bottom: 8px; }
table.job-pick tr.mine td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
.scan-result.confirm button:not(.primary) { background: #fff; color: #7a2e0e; border-color: #f79009; }

/* QC entry (docs/rules/screens-qc-entry.md) */
.qc-figures { display: flex; flex-wrap: wrap; gap: 10px 28px; }
.qc-figures div { display: grid; }
.qc-figures strong { font-size: 1.3rem; }
.qc-figures .over strong { color: var(--danger); }
.locked-banner { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.locked-banner form { margin: 0; }
.finding { display: flex; gap: 14px; padding: 12px 0; border-top: 1px solid var(--line); align-items: flex-start; }
.finding:first-of-type { border-top: 0; }
.photo-col { display: flex; gap: 6px; align-items: flex-start; }
.photo-slot { width: 96px; height: 96px; padding: 0; overflow: hidden; position: relative; display: grid; place-items: center;
              border: 2px dashed var(--line); border-radius: 8px; background: var(--bg); }
.photo-slot img { width: 100%; height: 100%; object-fit: contain; }  /* the whole photo, label included */
.photo-slot:disabled { cursor: default; }
.photo-count { position: absolute; right: 4px; bottom: 4px; background: rgba(0,0,0,.7); color: #fff; border-radius: 10px; padding: 0 7px; font-size: .875rem; }
.photo-form { margin: 0; display: grid; gap: 4px; justify-items: center; }
.add-photo { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%; background: var(--accent); color: var(--on-accent);
             font-size: 1.85rem; line-height: 1; cursor: pointer; position: relative; overflow: hidden; }
.add-photo input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.photo-form .uploading { display: none; font-size: .8rem; color: var(--muted); }
.photo-form.busy .uploading, .photo-form.htmx-request .uploading { display: block; }
.take-photo { font-size: .875rem; padding: 4px 8px; }
/* Damage label on a photo, and the camera (screens-qc-entry.md rules 7a-7b) */
.ov-modal { position: fixed; inset: 0; z-index: var(--layer-overlay); background: rgba(0,0,0,.75); display: grid; place-items: center; padding: 12px; }
.ov-box { background: var(--surface); color: var(--text); border-radius: 10px; padding: 12px; max-width: min(96vw, 1100px);
          display: grid; gap: 10px; }
.ov-box p { margin: 0; }
.ov-stage { position: relative; justify-self: center; line-height: 0; touch-action: none; }
.ov-stage img { max-width: 100%; max-height: 70vh; display: block; user-select: none; -webkit-user-select: none;
                -webkit-touch-callout: none; cursor: crosshair; }
.ov-label { position: absolute; left: 0; top: 0; background: #fff; color: #000; border: 3px solid #000; padding: .2em .6em;
            display: grid; justify-items: center; line-height: 1.05; cursor: grab; touch-action: none; user-select: none;
            -webkit-user-select: none; box-shadow: 0 0 0 3px rgba(255,255,255,.7), 0 2px 8px rgba(0,0,0,.5); }
.ov-label.dragging { cursor: grabbing; outline: 3px dashed #f79009; outline-offset: 3px; }
.ov-label strong { font-size: 1.6em; font-family: Arial, sans-serif; }
.ov-label small { font-size: .7em; font-weight: 700; font-family: Arial, sans-serif; }
.cam-box video { width: 100%; max-height: 65vh; background: #000; border-radius: 6px; }
.cam-strip { display: flex; gap: 6px; overflow-x: auto; }
.cam-strip img { height: 56px; border-radius: 4px; }
.qc-discount { flex-wrap: wrap; gap: 6px; align-items: end; margin-top: 8px; }
.finding-fields { flex: 1; display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px 12px; }
.finding-fields label { display: grid; gap: 3px; }
.finding-fields label > span { font-size: .875rem; color: var(--muted); }
.finding-fields input, .finding-fields select { width: 100%; min-height: 38px; }
.finding-fields .msg { grid-column: 1 / -1; margin: 0; }
.finding-meta { grid-column: 1 / -1; display: flex; gap: 12px; align-items: center; }
.gallery-overlay { position: fixed; inset: 0; z-index: var(--layer-overlay); background: rgba(0,0,0,.6); display: grid; place-items: center; padding: 16px; }
.gallery { background: var(--surface); border-radius: 10px; padding: 16px; width: min(1000px, 100%); max-height: 90vh; overflow: auto; }
.gallery header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.gallery header h2 { font-size: 1.15rem; margin: 0; }
.gallery-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.gallery-grid figure { margin: 0; }
.gallery-grid img { width: 100%; aspect-ratio: 4 / 3; object-fit: contain; border-radius: 6px; background: #111; }  /* portrait photos whole, not cut to landscape */
.gallery-grid figcaption { display: flex; justify-content: space-between; gap: 6px; margin-top: 4px; }

/* Signatures (docs/rules/screens-signatures.md) */
.view-title { font-size: 1.15rem; margin: 20px 0 8px; }
a.button.secondary { background: var(--surface); color: var(--accent); border: 1px solid var(--accent); }
.sig-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.sig-box { border: 1px solid var(--line); border-radius: 8px; padding: 10px; display: grid; gap: 6px; align-content: start; }
.sig-box.signed { border-color: #12b76a; }
.sig-box .sig-label { font-weight: 600; font-size: .93rem; }
.sig-box img { width: 100%; max-height: 90px; object-fit: contain; background: #fff; border-radius: 4px; }
.sig-box a.button { justify-self: start; }
.sign-page { max-width: 1100px; margin: 0 auto; }
.sign-summary h1 { margin: 0; }
.sign-summary dd strong { font-size: 1.3rem; }
.pad-wrap { position: relative; margin-top: 12px; }
#pad { width: 100%; height: min(45vh, 380px); background: #fff; border: 2px solid var(--line); border-radius: 10px;
       touch-action: none; display: block; cursor: crosshair; }
.pad-hint { position: absolute; left: 24px; bottom: 28px; color: #98a2b3; font-size: 1.43rem; pointer-events: none;
            border-top: 2px solid #d0d5dd; padding-top: 4px; width: 40%; }
#sign-form .actions button { font-size: 1.15rem; padding: 10px 18px; }

/* Job checklist (docs/rules/job-checklist.md) */
.check-row { display: grid; grid-template-columns: minmax(160px, 1.2fr) auto minmax(120px, 1fr); gap: 6px 12px; align-items: center;
             padding: 6px 0; border-top: 1px solid var(--line); }
.check-row:first-of-type { border-top: 0; }
.check-name { display: grid; }
.check-states { display: flex; gap: 4px; flex-wrap: wrap; }
.check-row.state-done .check-name strong { color: var(--ok); }
.check-row.state-na .check-name strong { color: var(--muted); text-decoration: line-through; }
.check-note { width: 100%; }
@media (max-width: 700px) { .check-row { grid-template-columns: 1fr; } }
.grid .wide { grid-column: 1 / -1; }
/* Scan station start: a narrow Scan in card, the job list gets the rest; stacked on small screens. */
.scan-start { display: grid; grid-template-columns: minmax(240px, 1fr) minmax(0, 3fr); gap: 12px; align-items: start; }
.scan-start > .card.section { margin-bottom: 0; min-width: 0; }
@media (max-width: 800px) { .scan-start { grid-template-columns: minmax(0, 1fr); } }

/* Searchable dropdowns (Tom Select), matched to the app's colours (screens-access.md, rule 6) */
.ts-wrapper { min-width: 140px; }
.ts-control, .ts-control input, .ts-dropdown { font-size: 1rem; }  /* Tom Select's own 13px was smaller than the page */
.ts-wrapper.single .ts-control, .ts-wrapper .ts-control, .ts-dropdown {
  background: var(--surface); color: var(--text); border-color: var(--line); border-radius: 6px; }
.ts-wrapper.single .ts-control { padding: 6px 28px 6px 8px; box-shadow: none; background-image: none; }
.ts-wrapper.single.input-active .ts-control { background: var(--surface); }
.ts-control > input { color: var(--text); }
.ts-dropdown { z-index: var(--layer-dropdown); min-width: 280px; }  /* opens over the page (app.js), wider than a narrow table column */
.ts-dropdown .option, .ts-dropdown .optgroup-header { color: var(--text); background: var(--surface); }
.ts-dropdown .active { background: var(--accent-soft); color: var(--text); }
.ts-dropdown .optgroup-header { font-size: .875rem; color: var(--muted); }
.form-grid .ts-wrapper, .finding-fields .ts-wrapper, table.list.edit .ts-wrapper { width: 100%; }
.msg.view-only { background: var(--accent-soft); }

/* Schedule / Gantt (docs/rules/screens-schedule.md). Phase colours: validated categorical slots 1-4
   (CVD-safe adjacent pairs, light and dark), "out" is a neutral grey. */
:root { --phase-outbound: #2a78d6; --phase-onsite: #eb6834; --phase-return: #1baf7a; --phase-qc: #eda100;
        --phase-out: #8d8b84; --phase-cross: #7a5af5; --gantt-weekend: rgba(0,0,0,.035); --gantt-grid: var(--line); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --phase-outbound: #3987e5; --phase-onsite: #d95926; --phase-return: #199e70; --phase-qc: #c98500;
          --phase-out: #77756e; --phase-cross: #9d85ff; --gantt-weekend: rgba(255,255,255,.04); }
}
:root[data-theme="dark"] { --phase-outbound: #3987e5; --phase-onsite: #d95926; --phase-return: #199e70; --phase-qc: #c98500;
          --phase-out: #77756e; --phase-cross: #9d85ff; --gantt-weekend: rgba(255,255,255,.04); }
.gantt-bar { display: flex; flex-wrap: wrap; gap: 8px 24px; align-items: center; justify-content: space-between; margin: 8px 0; }
.gantt-nav { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.gantt-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; list-style: none; margin: 0; padding: 0; font-size: .93rem; color: var(--muted); }
.gantt-legend li { display: flex; align-items: center; gap: 6px; }
.swatch { display: inline-block; width: 14px; height: 10px; border-radius: 3px; }
.swatch.today { width: 2px; height: 14px; background: var(--text); border-radius: 0; }
.gantt { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; overflow-x: auto; }
.gantt-row { display: grid; grid-template-columns: 240px minmax(560px, 1fr); border-top: 1px solid var(--line); min-height: 38px; }
.gantt-row:first-child { border-top: 0; }
.gantt-head { position: sticky; top: 0; z-index: 3; background: var(--surface); min-height: 30px; }
.gantt-label { padding: 5px 10px; display: grid; align-content: center; min-width: 0; border-right: 1px solid var(--line); }
.gantt-label .gantt-show { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: .93rem; }
.gantt-head .gantt-label { font-size: .875rem; color: var(--muted); font-weight: 600; }
.gantt-track { position: relative; }
.gantt-track .weekend { position: absolute; top: 0; bottom: 0; background: var(--gantt-weekend); }
.gantt-track .week-line { position: absolute; top: 0; bottom: 0; border-left: 1px solid var(--gantt-grid); }
.gantt-track .week { position: absolute; top: 7px; padding-left: 4px; font-size: .8rem; color: var(--muted); white-space: nowrap;
                     border-left: 1px solid var(--gantt-grid); }
.gantt-track .today-line { position: absolute; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: var(--text); z-index: 2; opacity: .75; }
.gantt-track .seg { position: absolute; top: 9px; height: 20px; border-radius: 4px; box-shadow: 0 0 0 1px var(--surface);
                    z-index: 1; display: block; }
.gantt-track .seg:hover, .gantt-track .seg:focus { outline: 2px solid var(--text); outline-offset: 1px; z-index: 4; }
.seg.phase-outbound, .swatch.phase-outbound { background: var(--phase-outbound); }
.seg.phase-onsite, .swatch.phase-onsite { background: var(--phase-onsite); }
.seg.phase-return, .swatch.phase-return { background: var(--phase-return); }
.seg.phase-qc, .swatch.phase-qc { background: var(--phase-qc); }
.seg.phase-out, .swatch.phase-out { background: var(--phase-out); }
.seg.phase-cross, .swatch.phase-cross { background: var(--phase-cross); }  /* cross-rentals.md rule 5 */
/* Show days: a hatched band inside "on site" (texture, not another colour) */
.gantt-track .seg.show-days { top: 13px; height: 12px; z-index: 2; border-radius: 3px; box-shadow: none;
  background: repeating-linear-gradient(45deg, rgba(255,255,255,.85) 0 2px, transparent 2px 5px); }
.swatch.show-days { background: var(--phase-onsite) repeating-linear-gradient(45deg, rgba(255,255,255,.85) 0 2px, transparent 2px 5px); }
.gantt-tip { position: fixed; z-index: var(--layer-tooltip); pointer-events: none; background: var(--surface); color: var(--text);
             border: 1px solid var(--line); border-radius: 6px; padding: 6px 10px; font-size: .93rem; box-shadow: 0 6px 20px rgba(0,0,0,.15); }
@media (max-width: 700px) { .gantt-row { grid-template-columns: 140px minmax(480px, 1fr); } }
/* One long timeline per chart, scrolled sideways (rule 4): a day is a fixed width, the names stay on the left,
   the jobs chart has its own height so its scroll bar stays on screen. */
.gantt-title { font-size: 1.07rem; margin: 14px 0 6px; display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; }
.gantt-scroll .gantt-row { grid-template-columns: 240px var(--track); width: max-content; min-width: 100%; }
.gantt-scroll .gantt-label { position: sticky; left: 0; z-index: 5; background: var(--surface); }
.gantt-scroll .gantt-head .gantt-label { z-index: 6; }
.gantt-jobs { max-height: 70vh; overflow: auto; }
@media (max-width: 700px) { .gantt-scroll .gantt-row { grid-template-columns: 140px var(--track); } }

/* Walls (docs/rules/walls.md) */
.walls-bar { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.walls-bar h2 { font-size: 1.15rem; margin: 0; }
.card.section.wall > header { align-items: flex-start; }

/* QC quantity required (screens-qc-entry.md rule 13) */
.finding-fields input.needs-value { border-color: var(--danger); }

/* Numbered pages (screens-home-and-list.md rule 13) */
.pager { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px 16px; margin: 10px 0; }
.pager .pages { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; color: var(--muted); }
.pager .pages a, .pager .pages .current { min-width: 32px; padding: 4px 8px; border-radius: 6px; text-align: center; border: 1px solid var(--line); }
.pager .pages a { background: var(--surface); }
.pager .pages .current { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 600; }
.pager .per-page { display: flex; align-items: center; gap: 6px; color: var(--muted); }

/* Shipping documents and damage labels (docs/rules/shipping-documents.md) */
.ship-docs { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(260px, 100%), 1fr)); gap: 12px; }
.ship-doc { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; }
.ship-doc h3 { margin: 0 0 6px; font-size: 1rem; }
.ship-doc p { margin: 4px 0; }
.label-no { color: var(--text); }
/* Stock rows: a bar per day, height = share of the stock out on jobs; short days red, with ⚠ in the label */
.gantt-section { background: var(--bg); min-height: 28px; }
.gantt-section .gantt-label { font-weight: 600; font-size: .93rem; }
.gantt-section .gantt-track { display: flex; align-items: center; padding: 0 8px; color: var(--muted); }
.stock-row { min-height: 44px; }
.stock-day { position: absolute; bottom: 4px; height: calc((100% - 10px) * var(--h) / 100); min-height: 2px;
             background: var(--phase-outbound); opacity: .55; border-radius: 2px 2px 0 0; box-shadow: 0 0 0 1px var(--surface); }
.stock-day.short { background: var(--danger); opacity: 1; height: calc(100% - 10px); }
.stock-day.untracked { background: var(--phase-out); }
/* Jobs not confirmed yet (screens-schedule.md rules 9-10): faded bars; in the stock rows a hatched part on top of
   the confirmed one, amber when the day would be short if they all go ahead. */
.gantt-row.tentative .gantt-track .seg { opacity: .4; }
.gantt-row.tentative .gantt-label .job, .gantt-row.tentative .gantt-show { font-style: italic; }
.swatch.tentative { opacity: .4; }
.pending-note { color: var(--warn); }
.warn { color: var(--warn); }
.stock-day.pending { bottom: calc(4px + (100% - 10px) * var(--below) / 100); border-radius: 2px 2px 0 0;
  background: repeating-linear-gradient(45deg, var(--phase-outbound) 0 2px, transparent 2px 5px); opacity: .9; }
.stock-day.pending.at-risk { background: repeating-linear-gradient(45deg, var(--phase-qc) 0 2px, transparent 2px 5px); opacity: 1; }
.stock-day:hover, .stock-day:focus { opacity: 1; outline: 2px solid var(--text); outline-offset: 1px; z-index: 4; }

/* Quote history (labour-quote.md rule 10a) */
.quote-history-title { margin: 20px 0 2px; font-size: 1.07rem; }
details.quote-revision { border-top: 1px solid var(--line); padding: 6px 0; }
details.quote-revision summary { cursor: pointer; }
details.quote-revision tr.rev-added td { color: var(--ok); }
details.quote-revision tr.rev-changed td { color: var(--warn); }
details.quote-revision tr.rev-removed td { color: var(--danger); text-decoration: line-through; }
.download-menu .menu a { white-space: nowrap; }

/* Laptops and small monitors: the text is bigger here (theme.css), so the controls get tighter to make room:
   slimmer boxes and buttons, and the job list's headings wrap instead of pushing the table off the screen.
   Touch screens keep their 44px tap targets (next block). */
@media (max-width: 1599px) {
  .page { padding: 12px; }
  input, select { padding: 4px 8px; }
  button, details > summary { padding: 4px 10px; }
  .ts-wrapper.single .ts-control { padding: 4px 24px 4px 8px; }
  .ts-wrapper { min-width: 0; }
  .filters { gap: 6px; }
  .views .tab { padding: 4px 10px; }
  .chip { padding: 2px 9px; }
  table.list th, table.list td { padding: 5px 8px; }
  table.list th { white-space: normal; }
  .card.section { padding: 12px 14px; }
}
/* Small laptops (e.g. 1536px screens at 150% scaling): tile colours in lists may wrap (dates stay on one line). */
@media (max-width: 1279px) {
  table.list td.num .nowrap { white-space: normal; }
  table.list th, table.list td { padding: 5px 6px; }
}

/* Touch screens and phones (scan station, QC, signatures in the warehouse): text in form boxes is 16px so
   iPhones and iPads don't zoom in when a box is tapped, and everything tapped is at least 44px high. */
@media (pointer: coarse), (max-width: 700px) {
  input:not([type=checkbox]):not([type=radio]):not([type=file]), select, textarea, .ts-control, .ts-control input,
  .ts-dropdown { font-size: 16px; }
  input:not([type=checkbox]):not([type=radio]):not([type=file]), select, .ts-control { min-height: 44px; }
  button, a.button, .small-btn, details > summary { min-height: 44px; }
  .small-btn { font-size: 15px; padding: 6px 14px; }
  button.link, a.tap, table.list td a.job { display: inline-flex; align-items: center; min-height: 44px; }
  .tap { padding: 0 2px; }
}
/* Phones: a QC finding's photos above its fields; the signing screen's job details in two columns. */
@media (max-width: 600px) {
  .finding { flex-direction: column; }
  .finding-fields { width: 100%; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .finding-fields label:has(textarea), .finding-fields label:has(input[name=note]) { grid-column: 1 / -1; }
  .sign-summary dl.fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  table.list th { white-space: normal; }  /* "Scanned out" wraps so short tables fit without scrolling */
  table.list th, table.list td { padding: 6px; }
  .card { padding: 16px; }
}

/* Practice week (docs/rules/practice-week.md) */
.practice-banner { background: var(--flag); color: var(--text); padding: 6px 16px; font-size: .93rem; border-bottom: 1px solid var(--line); }
.practice-intro { max-width: 70ch; }
.practice-progress progress { width: 160px; vertical-align: middle; margin-left: 8px; }
.practice-task { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); }
.practice-task:first-of-type { border-top: 0; }
.practice-what { flex: 1 1 320px; min-width: 0; display: grid; gap: 3px; }
.practice-name { font-weight: 600; }
.practice-task.is-worked .practice-name::before { content: "✓ "; color: var(--ok); }
.practice-reply { color: var(--accent); }
.practice-answer { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; flex: 0 1 420px; }
.practice-answer input { flex: 1 1 200px; min-width: 0; }
button.danger { color: var(--danger); }
.practice-report .wide { grid-column: 1 / -1; }

/* Accounting (docs/rules/accounting.md) */
.badge.hold { background: var(--danger-soft); color: var(--danger); font-weight: 600; }
.badge.hold.lifted { background: var(--warn-soft); color: var(--warn); font-weight: 400; }
tr.payment-row td { border-bottom-style: dashed; color: var(--muted); }
table.list tr.voided td .badge { text-decoration: none; }
.add-invoice { margin-top: 12px; }
.add-invoice > summary { display: inline-block; }
summary.link-summary { border: 0; background: none; padding: 0; }
table.aging td { vertical-align: top; }
.due-form { display: inline-flex; gap: 4px; align-items: center; margin: 0; }
.due-form input[type=date] { padding: 2px 6px; }
.due-line { display: flex; flex-wrap: wrap; gap: 2px 6px; align-items: center; padding: 2px 0; }
.due-line + .due-line { border-top: 1px dashed var(--line); }

/* Notifications page (status-and-notifications.md rule 13a): the bell's list in full */
.bell-list { border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.bell-list .bell-item:last-child { border-bottom: 0; }
.bell-list .bell-link { flex: 1; display: grid; gap: 2px; color: var(--text); }
.bell-list .bell-link:hover { text-decoration: none; }
.bell-list .bell-item:hover { background: var(--accent-soft); }

/* Cross-rentals (docs/rules/cross-rentals.md) */
.badge.cr-confirmed { background: #e8efff; color: var(--accent); }
.badge.cr-received { background: var(--ok-soft); color: var(--ok); }
.badge.cr-returned { background: var(--grey-soft); color: var(--muted); }
.badge.cr-cancelled { background: var(--danger-soft); color: var(--danger); }
tr.cr-problems td { border-top: 0; padding-top: 0; }
.cr-form { right: 0; width: min(560px, 90vw); grid-template-columns: repeat(2, minmax(0, 1fr)); }
.table-wrap.cr-wrap { overflow: visible; }  /* the edit form opens over the page, not clipped inside the table */

/* Delivery receipt (docs/rules/delivery-receipt.md) */
.receipt-lines { display: grid; gap: 0; border: 1px solid var(--line); border-radius: 8px; }
.receipt-line { display: grid; grid-template-columns: minmax(0, 3fr) 6rem 6rem minmax(0, 2fr); gap: 8px 12px; align-items: end;
  padding: 10px 12px; border-top: 1px solid var(--line); }
.receipt-line:first-child { border-top: 0; }
.receipt-line label { display: grid; gap: 2px; }
.receipt-line input { width: 100%; }
.receipt-what { display: grid; gap: 2px; align-self: center; }
.codes { font-family: Consolas, monospace; font-size: .8rem; word-break: break-all; }
tr.receipt-off td { background: color-mix(in srgb, var(--danger-soft) 50%, transparent); }
@media (max-width: 700px) {
  .receipt-line { grid-template-columns: 1fr 1fr; }
  .receipt-what, .receipt-note { grid-column: 1 / -1; }
}
/* Crew schedule (crew-schedule.md): a coloured box per day with its code */
.crew-day { position: absolute; top: 4px; bottom: 4px; display: flex; align-items: center; justify-content: center;
            background: var(--c); color: var(--t, #fff); font-size: 9px; font-weight: 700; border-radius: 3px; overflow: hidden;
            text-decoration: none; letter-spacing: -.02em; border: 1px solid rgba(0,0,0,.15); box-sizing: border-box; }
.crew-day.changed { outline: 2px dashed rgba(255,255,255,.7); outline-offset: -3px; }
.crew-code { display: inline-block; min-width: 2.4em; padding: 1px 4px; margin-right: 4px; border-radius: 3px; background: var(--c);
             color: var(--t, #fff); font-size: 11px; font-weight: 700; text-align: center; }


/* The Quote tab, in steps (labour-quote.md rule 1a, booths.md rule 6) */
.step-title { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; font-size: 1.15rem; margin: 22px 0 10px; }
.step-no { display: inline-grid; place-items: center; width: 1.7em; height: 1.7em; border-radius: 50%; background: var(--accent);
           color: var(--on-accent); font-size: .9rem; font-weight: 700; flex: none; }
.quote-totals { display: flex; flex-wrap: wrap; gap: 8px 28px; margin: 0 0 8px; }
.quote-totals dt { font-size: .875rem; color: var(--muted); }
.quote-totals dd { margin: 0; font-size: 1.1rem; font-variant-numeric: tabular-nums; }
.quote-totals .grand dd { font-size: 1.35rem; font-weight: 700; }
.quote-checks { margin: 6px 0 0; padding: 8px 12px 8px 30px; border-radius: 6px; background: var(--warn-soft); color: var(--warn); }
.quote-checks li + li { margin-top: 3px; }
.quote-grid td.center, .quote-grid th.center { text-align: center; }
.quote-grid input[type="checkbox"] { width: 20px; height: 20px; }
.quote-grid tr.quote-docs td { vertical-align: middle; }
.quote-grid tr.quote-docs td.center { white-space: nowrap; }
.quote-grid tfoot th { color: inherit; }
#quote-history summary h2.inline { display: inline; font-size: 1.07rem; margin: 0; }
.offscreen { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* Phone width (checked 2026-10-21) */
.filters-toggle { display: none; }
@media (max-width: 700px) {
  .filters-toggle { display: inline-block; }
  .filters:not(.open) > :not(.filters-top), .filters:not(.open) .filter-state { display: none; }  /* the search stays */
  .filter-state { margin-left: 0; }
  .quote-grid tr.quote-docs td.center { white-space: normal; min-width: 132px; }
  .quote-grid tr.quote-docs td.center > .small-btn, .quote-grid tr.quote-docs td.center > input,
  .quote-grid tr.quote-docs td.center > button { display: block; width: 100%; margin: 0 0 6px; box-sizing: border-box; text-align: center; }
}
@media (max-width: 1100px) {  /* the job header's links get their own line instead of sitting on the dates */
  .header-links { position: static; flex-basis: 100%; flex-wrap: wrap; justify-content: flex-end; }
}

/* The void popup (quickbooks-plan.md rule 20b) */
.void-dialog { border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: inherit;
               padding: 18px 20px; width: min(460px, calc(100vw - 32px)); box-sizing: border-box; white-space: normal;
               overflow-x: hidden; text-align: left; }
.void-dialog::backdrop { background: rgba(0, 0, 0, .45); }
.void-dialog h2 { font-size: 1.1rem; margin: 0 0 6px; }
.void-dialog label { display: grid; gap: 4px; margin: 10px 0; }
.void-dialog .actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
table.invoice-pick th:first-child, table.invoice-pick td:first-child { width: 1%; }  /* the tick box, not the line */
table.list.edit input[type="checkbox"] { width: auto; min-width: 0; }  /* a tick box is only as wide as itself */

/* The practice week's guides (practice-week.md rule 3a) */
.practice-guide details { border-top: 1px solid var(--line); padding: 8px 0; }
.practice-guide details:first-of-type { border-top: 0; }
.practice-guide summary { cursor: pointer; }
.practice-guide ol { margin: 8px 0 4px; padding-left: 22px; line-height: 1.45; }
.practice-guide li + li { margin-top: 4px; }

/* Skids of frames and hardware (shipping-manifest.md rule 7) */
#skids form.skid + form.skid { border-top: 1px solid var(--line); padding-top: 6px; }
#skids .inline-form label input { width: 5em; }

/* quickbooks-plan.md rule 16b: where an invoice lands in QuickBooks */
.goes-to { margin: 8px 0; }
.goes-to ul { margin: 4px 0; }

/* quickbooks-plan.md rule 8: each invoice status its own colour (2026-10-26): draft amber, in QuickBooks blue (the
   badge's own), sent to the client purple, paid green, voided bright red */
.badge.inv-draft { background: var(--warn-soft); color: var(--warn); }
.badge.inv-sent { background: var(--purple-soft); color: var(--purple); }
.badge.inv-void { background: var(--void-red); color: #fff; font-weight: 600; }  /* bright red (Ella 2026-10-26) */

/* Reports: each report is a panel that opens and closes (docs/rules/reports.md rule 10) */
details.report { padding: 0; }
details.report > summary { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; padding: 12px 16px 12px 36px;
  border: 0; border-radius: inherit; background: none; position: relative; }
details.report > summary::before { content: "\25B8"; position: absolute; left: 14px; top: 13px; color: var(--muted);
  transition: transform .15s; }
details.report[open] > summary::before { transform: rotate(90deg); }
details.report > summary:hover { background: var(--grey-soft); }
details.report > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
details.report > summary h2 { margin: 0; font-size: 1.05rem; }
details.report > summary .report-key { font-size: .95rem; }
details.report > summary .small { flex-basis: 100%; }
details.report[open] > summary { border-bottom: 1px solid var(--line); border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
details.report > :not(summary) { margin-left: 16px; margin-right: 16px; }
details.report > :last-child { margin-bottom: 14px; }
@media (prefers-reduced-motion: reduce) { details.report > summary::before { transition: none; } }
.money-fields { border: 1px solid var(--line); border-radius: 8px; padding: 10px 14px; margin: 12px 0; }
.money-fields legend { padding: 0 6px; font-weight: 600; }

/* Reports toolbar (rules 10-11): labels above their menus, everything on one baseline, the note on its own line */
.report-bar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 14px 28px; }
.report-filters, .report-rate { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 16px; margin: 0; }
.report-bar .field { display: flex; flex-direction: column; gap: 4px; margin: 0; }
.report-bar .field > span:first-child { font-size: .8rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.report-bar select, .report-bar input[name="rate"] { min-height: 34px; }
.report-bar .field-check { display: flex; align-items: center; gap: 6px; min-height: 34px; margin: 0; }
.report-bar .rate-input { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.report-bar .report-rate .small-btn, .report-actions .small-btn { min-height: 34px; display: inline-flex; align-items: center; }
.report-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-left: auto; align-items: flex-end; }
.report-actions a.small-btn { text-decoration: none; }
.report-note { flex-basis: 100%; margin: 0; padding-top: 10px; border-top: 1px solid var(--line); }
.report-tools { display: flex; justify-content: flex-end; align-items: center; gap: 8px; margin-top: 12px !important; }
.report-tools a.small-btn { text-decoration: none; }

/* Stat tiles and charts (rules 12-16; colours from theme.css --series-N) */
.stat-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin: 12px 16px 18px; }
.stat { display: flex; flex-direction: column; gap: 4px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.stat-label { font-size: .8rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.stat-value { font-size: 1.45rem; line-height: 1.2; }
.stat-sub { font-size: .85rem; color: var(--muted); }
.up { color: var(--ok); }
.down { color: var(--danger); }
.chart-title { font-size: .98rem; margin: 18px 0 6px; }
.chart { position: relative; }
.chart-svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart[data-kind="line"], .chart[data-kind="bars"] { width: 80%; margin: 0 auto; }
@media (max-width: 700px) { .chart[data-kind="line"], .chart[data-kind="bars"] { width: 100%; } }
.chart-svg .grid { stroke: var(--chart-grid); stroke-width: 1; }
.chart-svg .axis { stroke: var(--chart-axis); stroke-width: 1; }
.chart-svg .tick { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart-svg .tick.label { fill: var(--text); font-size: 12px; }
.chart-svg .tick.value { fill: var(--text); }
.chart-svg .series-line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart-svg .series-line.dashed { stroke-dasharray: 5 4; }
.chart-svg .crosshair { stroke: var(--chart-axis); stroke-width: 1; }
.chart-svg .dot { stroke: var(--surface); stroke-width: 2; }
.chart-svg .hit { fill: transparent; }
.chart-svg .slice { stroke: var(--surface); stroke-width: 2; outline: none; }
.chart-svg .slice:hover, .chart-svg .slice:focus { opacity: .85; }
.chart-svg .bar.on { opacity: .8; }
.chart-svg .reference { stroke: var(--text); stroke-width: 1; stroke-dasharray: 3 3; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; list-style: none; padding: 0; margin: 0 0 6px; font-size: .88rem; }
.chart-legend li { display: inline-flex; align-items: center; gap: 6px; }
.swatch { width: 12px; height: 12px; border-radius: 3px; background: var(--c); display: inline-block; flex: none; }
.swatch.dashed { height: 0; border-top: 2px dashed var(--c); background: none; border-radius: 0; }
.chart-tip { position: absolute; display: none; z-index: var(--layer-tooltip); pointer-events: none; padding: 6px 9px; font-size: .85rem;
  background: var(--surface); color: var(--text); border: 1px solid var(--line); border-radius: 6px; box-shadow: 0 4px 14px rgba(0,0,0,.15); white-space: nowrap; }
.chart-tip div { display: flex; align-items: center; gap: 6px; }
.chart-pair { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 12px 28px; }
.pie-wrap { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.pie-wrap .chart-svg.pie { width: 200px; flex: none; }
.pie-wrap .chart-legend { flex-direction: column; flex: 1 1 160px; }
details.chart-table { margin: 6px 0 4px; }
details.chart-table > summary { display: inline-block; padding: 3px 10px; }
.cost-input { display: inline-flex; align-items: center; gap: 4px; }
.cost-input input { width: 84px; text-align: right; }
.cost-input select { padding: 4px 4px; }
table.payback td { vertical-align: top; }
a.small-btn { display: inline-flex; align-items: center; border: 1px solid var(--line); background: var(--surface); color: var(--text);
  border-radius: 6px; text-decoration: none; }
a.small-btn:hover { background: var(--grey-soft); }
.stat-cur { font-weight: 500; opacity: .8; }
.pie-wrap .chart-legend li { display: grid; grid-template-columns: 12px minmax(0, 1fr) auto; gap: 8px; align-items: baseline; }
.pie-wrap .chart-legend li .muted { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
/* QuickBooks customer pop-up (quickbooks-plan.md rule 16f) */
.link-dialog { width: min(560px, calc(100vw - 32px)); }
.link-dialog .link-choice { border: 1px solid var(--line); border-radius: 8px; padding: 10px 14px; margin: 12px 0; }
.link-dialog .link-choice legend { font-weight: 600; padding: 0 6px; }
.link-dialog .link-choice label { display: grid; gap: 4px; }
.link-dialog .fields { margin: 4px 0 0; }
[data-problem="customer"] .small-btn { margin-left: 6px; }
.link-btn { border: 0; background: none; padding: 2px 0; color: var(--accent); cursor: pointer; justify-self: start; text-align: left; }
.link-btn:hover { text-decoration: underline; }
.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; }
.page-head h1 { margin: 0; }
/* The conversation with the client (screens-project-page.md rule 20) */
.trail-add { margin: 0 0 12px; }
.trail-add > summary { display: inline-block; }
.trail-entry { border-left: 3px solid var(--line); padding: 6px 0 6px 12px; margin: 8px 0; }
.trail-entry.from-client { border-left-color: var(--series-2); }
.trail-entry.to-client { border-left-color: var(--series-1); }
.trail-head { color: var(--muted); }
.trail-head strong { color: var(--text); }
.trail-subject { font-weight: 600; margin-top: 2px; }
.trail-text { white-space: normal; margin-top: 6px; padding: 8px 10px; background: var(--grey-soft); border-radius: 6px; }
form.inline { display: inline; }
/* Ready for invoice (accounting.md rule 16) */
.badge.ready { background: var(--ok-soft); color: var(--ok); font-weight: 600; }
/* Reports for everyone (general-reports.md) */
.report-sections { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 16px; align-items: start; }
.report-list { list-style: none; padding: 0; margin: 0; }
.report-list li { display: grid; gap: 2px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.report-list li:last-child { border-bottom: 0; }
.report-list a { font-weight: 600; }
.faint { opacity: .7; }
.report-bar .wide-field { min-width: 220px; }

/* Pop-ups filled from a page (crew chart: crew-schedule.md rule 3b) */
.page-dialog:has(.crew-editor.wide) { width: min(1180px, calc(100vw - 32px)); }
.crew-editor .inline-form label { display: inline-grid; margin: 6px 8px 6px 0; }
.crew-editor input[type="datetime-local"] { min-width: 13em; }
.crew-editor label.tick { display: flex; align-items: center; gap: 4px; margin: 0 0 4px; font-size: .85em; }
.gantt-track.crew-editable { cursor: cell; }
button.crew-day { padding: 0; font-family: inherit; cursor: pointer; }
.crew-facts { display: flex; flex-wrap: wrap; gap: 2px 8px; align-items: center; }
.about .about-facts { display: grid; gap: 4px; margin: 8px 0; }
.about .about-facts div { display: grid; grid-template-columns: 7em 1fr; gap: 8px; }
.about .about-facts dt { color: var(--muted); }
.about .about-facts dd { margin: 0; }
.about details { border-top: 1px solid var(--line); padding: 6px 0; }
.about summary { cursor: pointer; }
.about details ul { margin: 6px 0 2px; padding-left: 20px; }

/* Project list: products on the job (screens-home-and-list.md rule 8a) */
.product-pick { display: inline-flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.product-filter .ts-wrapper { min-width: 260px; max-width: 520px; }
.about-page { max-width: 720px; }

/* Analytics (reports.md rules 27, 31): the seasonal heatmap and payback progress */
table.heatmap td.heat { background: color-mix(in srgb, var(--series-1) calc(var(--heat) * 38%), transparent); }
.progress { height: 5px; border-radius: 3px; background: var(--grey-soft); margin-top: 4px; min-width: 70px; overflow: hidden; }
.progress span { display: block; height: 100%; background: var(--ok); }
.report-narrow .menu { min-width: 280px; }

/* A question to answer (status-and-notifications.md rule 18) */
.question form label { display: grid; gap: 6px; margin-top: 12px; }
.question textarea { width: 100%; min-height: 8em; box-sizing: border-box; font: inherit; }
.question .question-text { font-size: 1.05rem; }

/* Prices & rates (prices-page.md, 2026-11-03) */
table.prices tr.no-price td:first-child { box-shadow: inset 3px 0 0 var(--warn); }
table.prices input { width: 100%; max-width: 10rem; text-align: right; }
table.prices td:nth-child(5) input { max-width: 18rem; text-align: left; }
.sticky-save { position: sticky; bottom: 0; padding: 10px 0; background: var(--bg); border-top: 1px solid var(--line); }
