/* Foreman's own look, over Quill's stylesheet: Quill's layout and its token names, Foreman's values. */

/* ── The look ──
   A work order, not a dashboard: paper, ink, one marking-paint orange for the thing to do next. Flat
   surfaces, square corners, hairlines. Nothing glows, blurs or moves.
   Type: Barlow for reading (it comes from highway signs and plates, so it holds up small and outdoors) and
   Barlow Condensed for names and numbers. Quill's rules ask for "Roboto" by name in every font shorthand,
   so Barlow is served under that name here rather than changing Quill's stylesheet. Fonts: SIL OFL 1.1
   (fonts/OFL.txt). */
@font-face { font-family: "Roboto"; font-weight: 400; font-style: normal; font-display: swap; src: url("../fonts/barlow-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Roboto"; font-weight: 500; font-style: normal; font-display: swap; src: url("../fonts/barlow-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Roboto"; font-weight: 600; font-style: normal; font-display: swap; src: url("../fonts/barlow-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Foreman Head"; font-weight: 600; font-style: normal; font-display: swap; src: url("../fonts/barlow-condensed-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Foreman Head"; font-weight: 700; font-style: normal; font-display: swap; src: url("../fonts/barlow-condensed-latin-700-normal.woff2") format("woff2"); }

:root {
  --canvas: #F2EEE4; --surface: #FFFDF7; --surface-2: #E8E2D3;
  --border: #D3CBB8; --border-strong: #6F6857;
  --text: #1C1A15; --text-2: #47423A; --text-3: #625C50;
  --accent: #B13D08; --accent-pressed: #8E3006; --on-accent: #FFFFFF;
  --overdue: #A8201A; --paid: #1C6B3A;
  --inverse: #1C1A15; --on-inverse: #F2EEE4;
  --ink: #1C1A15; --on-ink: #F2EEE4; --ink-2: #C9C2B0;
  /* The side rail and the phone's bottom bar follow the theme: paper in light, near black in dark. */
  --bar: #E3DCCB; --on-bar: #1C1A15; --bar-2: #47423A; --bar-line: #BDB49F;
  --shadow: none;
  --head: "Foreman Head", "Roboto", system-ui, sans-serif;
}
:root[data-theme="dark"] {
  --canvas: #141310; --surface: #1D1C18; --surface-2: #2A2823;
  --border: #3B3831; --border-strong: #8A8474;
  --text: #F0ECE2; --text-2: #C6C0B2; --text-3: #9C9687;
  --accent: #FF9450; --accent-pressed: #FFB07C; --on-accent: #1B0E04;
  --overdue: #FF8B7E; --paid: #74CB8E;
  --inverse: #F0ECE2; --on-inverse: #1C1A15;
  --ink: #0C0B09; --on-ink: #F0ECE2; --ink-2: #9C9687; --bar: #0C0B09; --on-bar: #F0ECE2; --bar-2: #9C9687; --bar-line: #47423A;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --canvas: #141310; --surface: #1D1C18; --surface-2: #2A2823;
    --border: #3B3831; --border-strong: #8A8474;
    --text: #F0ECE2; --text-2: #C6C0B2; --text-3: #9C9687;
    --accent: #FF9450; --accent-pressed: #FFB07C; --on-accent: #1B0E04;
    --overdue: #FF8B7E; --paid: #74CB8E;
    --inverse: #F0ECE2; --on-inverse: #1C1A15;
    --ink: #0C0B09; --on-ink: #F0ECE2; --ink-2: #9C9687; --bar: #0C0B09; --on-bar: #F0ECE2; --bar-2: #9C9687; --bar-line: #47423A;
  }
}

/* The look is for screens. Paper (stickers, invoices) prints exactly as it did before. */
@media screen {
/* Names and numbers in the condensed face; everything read as a sentence stays in the plain one. */
.title, .setup-title, .state-page .title { font: 700 30px/32px var(--head); letter-spacing: .005em; }
.heading { font: 600 22px/26px var(--head); }
.display { font: 700 40px/42px var(--head); }
.section > h2, .label { font: 600 14px/20px "Roboto", sans-serif; color: var(--text-2); }
.btn { border-radius: 4px; font-weight: 600; }
.btn-text { text-decoration: underline; text-underline-offset: 3px; }
.card, .list, .choice, .chip, .banner, .field input, .field select, .field textarea, .input { border-radius: 4px; }
.card, .list { border-color: var(--border); }
.chip { font-weight: 500; }
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--on-ink); }
.banner { border: 1px solid var(--border); border-left: 4px solid var(--border-strong); background: var(--surface); }
.banner.warn { border-color: var(--border); border-left-color: var(--overdue); }
.empty { border: 1px dashed var(--border-strong); border-radius: 4px; background: transparent; padding: 32px 20px; }
.empty p { max-width: 52ch; }

.setup-what { font: 500 18px/26px "Roboto", sans-serif; color: var(--text); max-width: 46ch; margin: 4px 0 8px; }
.setup-modules { margin-top: 16px; }
.setup-modules summary { min-height: 44px; display: flex; align-items: center; cursor: pointer; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.setup-start { margin-top: 16px; }
/* First visit: light or dark, each shown as a small piece of the real screen in its own colors. */
.setup-look { margin-top: 16px; }
@media (max-width: 599px) {
  .setup-page { padding-top: 20px; padding-bottom: 24px; }
  .setup-page .choice { padding: 10px 12px; }
  .setup-page .choice .meta { font-size: 14px; line-height: 19px; }
}
.looks { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.look { position: relative; display: grid; gap: 8px; padding: 8px 8px 10px; border: 1px solid var(--border); border-radius: 4px; background: var(--surface); cursor: pointer; }
.look input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.look:has(input:checked) { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.look:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.look .primary { font: 600 16px/20px "Roboto", sans-serif; padding-left: 4px; }
.look:has(input:checked) .primary::after { content: " (in use)"; font-weight: 400; color: var(--text-2); }
.look-screen { display: grid; gap: 6px; padding: 8px 8px 0; border: 1px solid var(--l-line); border-radius: 3px; background: var(--l-canvas); color: var(--l-text); overflow: hidden; }
.look-head { font: 700 15px/18px var(--head); }
.look-row { display: grid; padding: 5px 7px; border: 1px solid var(--l-line); border-radius: 3px; background: var(--l-surface); }
.look-name { font: 600 13px/16px var(--head); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.look-meta { font: 400 11px/14px "Roboto", sans-serif; color: var(--l-text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.look-btn { justify-self: start; padding: 2px 12px; border-radius: 3px; background: var(--l-accent); color: var(--l-on-accent); font: 600 11px/16px "Roboto", sans-serif; }
.look-bar { height: 10px; margin: 2px -8px 0; background: var(--l-bar); border-top: 1px solid var(--l-line); }
.look[data-look="light"] { --l-canvas: #F2EEE4; --l-surface: #FFFDF7; --l-line: #D3CBB8; --l-text: #1C1A15; --l-text-2: #47423A; --l-accent: #B13D08; --l-on-accent: #FFFFFF; --l-bar: #E3DCCB; }
.look[data-look="dark"] { --l-canvas: #141310; --l-surface: #1D1C18; --l-line: #3B3831; --l-text: #F0ECE2; --l-text-2: #C6C0B2; --l-accent: #FF9450; --l-on-accent: #1B0E04; --l-bar: #0C0B09; }

/* The shell: an ink rail down the side of a wide screen, an ink bar across the bottom of a phone. The
   tab you're on is marked with the one orange. */
.foreman-brand { font: 700 26px/28px var(--head); letter-spacing: .01em; color: var(--text); text-decoration: none; }
.topbar { border-bottom: 2px solid var(--ink); background: var(--canvas); }
.foreman .tabs { background: var(--bar); border-top: 1px solid var(--bar-line); }
.foreman .tabs a { color: var(--bar-2); font: 500 14px/18px "Roboto", sans-serif; padding: 0 2px; border-top: 4px solid transparent; }
.foreman .tabs a[aria-current="page"] { color: var(--on-bar); font-weight: 600; border-top-color: var(--accent); }
@media screen and (min-width: 900px) {
  .foreman .rail { background: var(--bar); border-right: 1px solid var(--bar-line); padding: 24px 12px; }
  .foreman .rail .foreman-brand { color: var(--on-bar); padding: 0 12px; }
  .foreman .rail nav a { color: var(--bar-2); border-radius: 0; border-left: 4px solid transparent; font-weight: 500; }
  .foreman .rail nav a[aria-current="page"] { background: transparent; color: var(--on-bar); border-left-color: var(--accent); font-weight: 600; }
  .foreman .rail .sub { border-left-color: var(--bar-line); }
  .foreman .rail nav .sub a[aria-current="page"] { color: var(--on-bar); }
  .foreman .main { max-width: 1240px; padding-left: 32px; padding-right: 32px; }
}
}
/* Foreman has one look: the choice between Quill's two styles is not offered here. */
fieldset:has(#style-glass) { display: none; }
/* Light or dark is set on Foreman's own Settings page: one place for it, so the copy on the invoicing page is hidden. */
section[aria-labelledby="set-look"] { display: none; }


/* The rail: Invoices opens its own pages under it. */
@media (min-width: 900px) {
  .rail .sub { display: flex; flex-direction: column; gap: 2px; margin: 2px 0 6px 12px; padding-left: 8px; border-left: 1px solid var(--border); }
  .rail .sub a { min-height: 44px; font-size: 15px; }
  .rail nav .sub a[aria-current="page"] { background: transparent; box-shadow: none; color: var(--accent); font-weight: 500; }
  .module-nav { display: none; }
}

/* On a phone the Invoices pages are a row that wraps, never one that scrolls sideways. */
.module-nav { display: flex; flex-wrap: wrap; gap: 4px 8px; margin: 0 0 8px; }
.module-nav a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 14px; border-radius: 999px; color: var(--text-2); text-decoration: none; font: 500 15px/20px "Roboto", sans-serif; border: 1px solid transparent; }
.module-nav a[aria-current="page"] { color: var(--text); border-color: var(--border-strong); background: var(--surface); }

/* Five tabs at most on a phone: a little tighter than Quill's four. */
.foreman .tabs a { font-size: 14px; padding: 0 2px; }

/* Home: one card per module, as many columns as fit. */
.module-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; margin-top: 24px; }
.module-cards li { display: grid; }
.module-cards .card + .card { margin-top: 0; }
.module-card { display: grid; gap: 4px; min-height: 96px; align-content: start; color: var(--text); text-decoration: none; }
.module-card .primary { font: 500 17px/24px "Roboto", sans-serif; }
.module-card.is-low .primary { color: var(--overdue); }

/* Module switches: the name, then what it does, wrapping under it on a phone. */
.module-switch { align-items: flex-start; padding: 10px 0; }
.module-switch input { margin-top: 2px; }
.module-switch .primary { font-weight: 500; margin-right: 6px; }
.module-switch + .module-switch { border-top: 1px solid var(--border); }

/* First run. */
.setup-page { max-width: 640px; margin: 0 auto; padding: 48px var(--side) 48px; }
.setup-title { font: 500 28px/36px "Roboto", sans-serif; margin-bottom: 8px; }
.setup-start { display: grid; gap: 12px; }
.choice { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px 12px; align-items: start; min-height: 44px; padding: 16px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); cursor: pointer; }
.choice input { grid-row: 1 / span 2; width: 20px; height: 20px; margin-top: 2px; accent-color: var(--accent); }
.choice .primary { font: 500 17px/24px "Roboto", sans-serif; }
.choice:has(input:checked) { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.choice:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }

/* boot.js marks a first visit for Quill's welcome, which hides #app. Foreman has no welcome:
   its "Opening Foreman" stays on screen while the app downloads. */
html.is-new #app { display: block; }

/* ── Inventory ── */
/* Sticker codes: read off a label by eye, so a face where 0 and O, 1 and I never look alike. */
.code { font-family: ui-monospace, "Cascadia Mono", Consolas, Menlo, monospace; letter-spacing: .04em; white-space: nowrap; }
.stock-row .amount { font-weight: 500; }

/* The stock panel: the count is the biggest thing on the screen, the two buttons the next. */
.stock { display: grid; gap: 16px; }
.stock-count { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.stock-num { font: 500 56px/60px "Roboto", sans-serif; letter-spacing: -.01em; }
.stock-unit { font: 500 22px/28px "Roboto", sans-serif; color: var(--text-2); }
.stock-low { color: var(--overdue); font-weight: 500; }
.stock-step { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.stock-btn { min-height: 88px; display: grid; justify-items: center; align-content: center; gap: 2px; padding: 8px 12px; font-size: 15px; line-height: 20px; }
.stock-sign { font: 400 40px/40px "Roboto", sans-serif; }
.stock-amount { display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); }
.stock-amount .field input[type="number"] { font-size: 20px; }
.stock-units legend { margin-bottom: 6px; }
.stock-units .chip { min-height: 56px; padding: 0 18px; }
/* The amount is typed or stepped with the big buttons: no tiny spinner arrows beside it. */
.stock input[type="number"] { -moz-appearance: textfield; appearance: textfield; }
.stock input[type="number"]::-webkit-inner-spin-button, .stock input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.stock-count-btn { width: 100%; }
.stock-other { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 160px), 1fr)); gap: 12px; }
.stock-more { padding-top: 12px; border-top: 1px solid var(--border); }
@media (min-width: 520px) { .stock-amount { grid-template-columns: minmax(120px, 180px) minmax(0, 1fr); align-items: end; } .stock-units, .stock-note { grid-column: 1 / -1; } }

/* An item: the stock panel and its facts, then the history beside them on a wide screen. */
.item-layout { display: grid; gap: 24px; grid-template-columns: minmax(0, 1fr); }
.item-history .label { display: block; }
.move-row { min-height: 56px; }
.move-row .amount.is-out { color: var(--text-2); }
@media (min-width: 1100px) { .item-layout { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; } }

/* ── Scan ── */
/* On a phone the scanned item comes straight under the camera; typing a code is the last resort. */
.scan-layout { display: grid; gap: 24px; grid-template-columns: minmax(0, 1fr); grid-template-areas: "camera" "result" "manual"; }
.scan-camera { grid-area: camera; }
#scan-result { grid-area: result; }
.scan-manual { grid-area: manual; }
@media (min-width: 1100px) { .scan-layout { grid-template-columns: minmax(0, 480px) minmax(0, 1fr); grid-template-areas: "camera result" "manual result"; align-items: start; } }
.scan-view { position: relative; aspect-ratio: 4 / 3; max-width: 480px; border-radius: 12px; overflow: hidden; background: #1B1C1E; color: #ECECEA; }
.scan-view video { width: 100%; height: 100%; object-fit: cover; display: block; }
.scan-view:not(.is-on) video { display: none; }
/* The guide box: the middle of the frame is what the reader looks at. */
.scan-view.is-on::after { content: ""; position: absolute; top: 15%; bottom: 15%; left: 50%; aspect-ratio: 1 / 1; transform: translateX(-50%); border: 3px solid rgba(255, 255, 255, .85); border-radius: 16px; box-shadow: 0 0 0 999px rgba(0, 0, 0, .28); pointer-events: none; }
.scan-off { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 16px; padding: 24px; text-align: center; }
.scan-manual { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: end; max-width: 480px; }
.scan-item { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; margin-bottom: 12px; }
.scan-item .heading { color: var(--text); text-decoration: none; }
label.btn { cursor: pointer; }
input.sr-only:focus-visible + *, label.btn:has(+ input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ── Stickers ── */
.stickers-layout { display: grid; gap: 24px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 1100px) { .stickers-layout { grid-template-columns: minmax(0, 420px) minmax(0, 1fr); align-items: start; } .sheets { position: sticky; top: 24px; } }
/* Picking one item at a time is the long way round, so it folds away under the quick picks. */
.pick-more > summary { list-style: none; }
.pick-more > summary::-webkit-details-marker { display: none; }
.pick-more[open] > summary { margin-bottom: 4px; }
.pick-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 8px 8px 8px 16px; min-height: 60px; }
.pick-qty { display: inline-flex; align-items: center; gap: 4px; }
.pick-qty .btn { min-width: 44px; padding: 0; font-size: 20px; }
.pick-n { min-width: 28px; text-align: center; font-weight: 500; }
.start-map { display: grid; gap: 8px; min-width: 0; }
.map-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.map-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.map-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.map-cols-8 { grid-template-columns: repeat(8, minmax(0, 1fr)); }
.start-map button { -webkit-appearance: none; appearance: none; min-width: 0; width: 100%; overflow: hidden; min-height: 44px; border: 1px dashed var(--border-strong); border-radius: 4px; background: transparent; color: var(--text-2); font: 400 13px/16px "Roboto", sans-serif; cursor: pointer; padding: 0; }
.start-map button.is-used { background: var(--surface-2); border-style: solid; border-color: var(--border); color: var(--text-3); text-decoration: line-through; }
.start-map button.is-start { background: var(--accent); border: 1px solid var(--accent); color: var(--on-accent); font-weight: 500; }
.segments a { cursor: pointer; }
/* On a phone the print button rides above the tab bar, so it's there after scrolling the preview. */
@media (max-width: 1099px) {
  .print-bar { position: fixed; z-index: 15; left: 12px; right: 12px; bottom: calc(var(--nav-h) + 24px + env(safe-area-inset-bottom, 0px)); margin: 0; justify-content: stretch; }
  .print-bar .btn { flex: 1; box-shadow: var(--shadow); }
  .stickers-layout { padding-bottom: 88px; }
}
@media (min-width: 900px) and (max-width: 1099px) { .print-bar { left: calc(var(--rail) + 32px); right: 32px; bottom: 24px; } }

/* A sheet: one SVG in hundredths of an inch. On screen it fills the column like paper on the bench. */
.sheets { display: grid; gap: 16px; }
.sheet { display: block; width: 100%; height: auto; background: #FFFFFF; border-radius: 2px; box-shadow: 0 1px 2px rgba(0, 0, 0, .12), 0 8px 24px rgba(0, 0, 0, .14); }
.sheet .paper { fill: #FFFFFF; }
.sheet .cell { fill: none; stroke: #C9CACD; stroke-width: 1; stroke-dasharray: 4 3; }
.sheet .test-cell { fill: none; stroke: #000; stroke-width: .8; stroke-dasharray: 5 4; }
.sheet .test-line { fill: none; stroke: #000; stroke-width: 1; }
.sheet text { fill: #000; font-family: "Roboto", Arial, sans-serif; }
.sheet .t-code { font-family: ui-monospace, "Cascadia Mono", Consolas, Menlo, monospace; font-weight: 700; letter-spacing: .5px; }
.sheet .t-small { fill: #000; }

/* Printing: only the sheets, black on white, at exact size. Nothing else on the page reaches paper. */
@media print {
  @page { size: letter; margin: 0; }
  .rail, .topbar, .tabs, .banner, .skip, .no-print, .say, #quill-dialog, .module-nav { display: none !important; }
  .main { padding: 0; margin: 0; max-width: none; }
  .shell.foreman { padding: 0; }
  .stickers-layout, .sheets { display: block; padding: 0; }
  .sheet { width: 8.5in; height: 11in; border-radius: 0; box-shadow: none; break-after: page; print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  .sheet:last-child { break-after: auto; }
  .sheet .cell { stroke: none; }
}

/* Quill's lock screen shows Quill's icon; Foreman has none of its own yet. */
#lock-screen img { display: none; }

/* ── Leads ── */
/* The first thing on a card says what kind of thing it is. A possible customer is an outline: nothing is
   known about demand. An open request is filled with the one orange: it is real work with a deadline.
   A permit is ink: a project that exists and may be underway. A closed request is struck through. */
.tag { display: inline-flex; align-items: center; min-height: 24px; padding: 0 8px; border: 1.5px solid var(--border-strong); border-radius: 2px; font: 600 13px/18px "Roboto", sans-serif; color: var(--text-2); white-space: nowrap; }
.tag-request { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.tag-permit { background: var(--inverse); border-color: var(--inverse); color: var(--on-inverse); }
.tag-closed { color: var(--text-3); border-style: dashed; text-decoration: line-through; }

.leads-head { align-items: baseline; padding-bottom: 8px; }
.leads-for { flex: 1 1 260px; }
.leads-nav { margin-top: 0; border-bottom: 2px solid var(--ink); gap: 0 4px; }
.module-nav a { border-radius: 0; border: 0; border-bottom: 4px solid transparent; padding: 0 12px; font-weight: 500; }
.module-nav a[aria-current="page"] { background: transparent; border-color: var(--accent); color: var(--text); font-weight: 600; }

/* Rows on the left, the open one on the right. On a phone the open one takes the screen. */
.lead-split { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; margin-top: 12px; }
.lead-list { counter-reset: none; }
.lead-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; align-items: center; width: 100%; min-height: 76px; padding: 12px 14px; border: 0; border-left: 4px solid transparent; background: transparent; text-align: left; cursor: pointer; }
.lead-row .tag { justify-self: start; }
.lead-row .lead-dist { grid-column: 2; grid-row: 1; }
.lead-row-name { grid-column: 1 / -1; font: 600 21px/24px var(--head); color: var(--text); overflow-wrap: anywhere; }
.lead-row-why { grid-column: 1 / -1; font: 400 14px/20px "Roboto", sans-serif; color: var(--text-2); }
.lead-row[aria-current="true"] { background: var(--surface-2); border-left-color: var(--accent); }
.lead-row:active { background: var(--surface-2); }
.lead-row[data-basis="closed"] .lead-row-name { color: var(--text-3); }
.lead-dist { font: 500 14px/20px "Roboto", sans-serif; color: var(--text-2); }
.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 12px; }
.lead-pane-empty { padding: 24px 0; }
.lead-back { border: 0; background: transparent; padding: 0; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
@media (max-width: 899px) {
  /* The open result is the screen: the title, the tabs and the filters wait behind Back. */
  .main:has(.lead-split.has-open) :is(.leads-head, .leads-nav, .leads-toolbar, .lead-count, .today > :not(:has(.lead-split)), #today-h, #today-line, .leads-credit, .lead-coverage, .lead-dnc, #leads-refresh) { display: none; }
  .leads-toolbar { grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
  .leads-toolbar .field:first-child { grid-column: 1 / -1; }
  .lead-split .lead-pane { display: none; }
  .lead-split.has-open .lead-rows { display: none; }
  .lead-split.has-open .lead-pane { display: block; }
}
@media (min-width: 900px) {
  .lead-split { grid-template-columns: minmax(300px, 400px) minmax(0, 1fr); align-items: start; gap: 24px; }
  .lead-back { display: none; }
  .lead-pane { position: sticky; top: 16px; }
}

/* One result in full: a ticket. What it is, who, why, what isn't known, what to do, where it came from. */
.lead-detail { display: grid; gap: 14px; align-content: start; padding: 18px; background: var(--surface); border: 1px solid var(--border); border-top: 4px solid var(--ink); border-radius: 4px; }
.lead-detail[data-basis="request"] { border-top-color: var(--accent); }
.lead-detail-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.lead-name { font: 700 28px/30px var(--head); overflow-wrap: anywhere; }
.lead-name + .meta { margin-top: -8px; }
.lead-why, .lead-next { display: grid; gap: 6px; padding-top: 12px; border-top: 1px solid var(--border); }
.lead-fit { display: grid; gap: 8px; }
.lead-fit [data-part="fit"] { font: 500 16px/22px "Roboto", sans-serif; }
.lead-why:not(:has(li)) { display: none; }
.facts { display: grid; gap: 4px; padding-left: 18px; list-style: square; }
.facts li { padding-left: 2px; }
.facts li::marker { color: var(--text-3); }
.lead-caveat { padding: 8px 12px; background: var(--surface-2); border-radius: 2px; font: 500 15px/22px "Roboto", sans-serif; color: var(--text); }
.lead-stale { color: var(--overdue); font: 500 15px/22px "Roboto", sans-serif; }
.lead-say { font-size: 15px; line-height: 22px; }
.lead-source { font-size: 13px; line-height: 18px; color: var(--text-3); }
.prospect-sample { padding-top: 12px; border-top: 1px solid var(--border); }
.lead-detail .btn, .lead-layout .btn { min-height: 52px; }
.prospect-reach { display: flex; flex-wrap: wrap; gap: 8px; }
.prospect-reach .btn { flex: 1 1 auto; padding: 0 16px; }
.prospect-decide { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 130px), 1fr)); gap: 8px; padding-top: 12px; border-top: 1px solid var(--border); }
.prospect-reasons { padding-top: 12px; border-top: 1px solid var(--border); }
.prospect-reasons legend { font: 600 15px/20px "Roboto", sans-serif; color: var(--text); margin-bottom: 8px; }
.prospect-reasons .chip { min-height: 52px; padding: 0 16px; }

/* Today: the picks, and beside them on a wide screen the follow-ups that are due. */
.today { display: grid; gap: 24px; margin-top: 16px; }
.today .nudges { margin-top: 0; }
.lead-count { margin-top: 4px; max-width: 80ch; }
.nudges { margin-top: 8px; }
.nudge { display: grid; grid-template-columns: minmax(0, 1fr); gap: 4px 16px; align-items: center; padding: 12px 16px; }
.nudge .actions { margin: 0; gap: 8px; }
.nudge .btn { min-height: 48px; }
@media (min-width: 700px) { .nudge { grid-template-columns: minmax(0, 1fr) auto; } }

/* Saved leads and one lead's page. */
.lead-row.row { min-height: 68px; }
.lead-layout { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); }
.lead-layout .chip { min-height: 52px; padding: 0 18px; }
.lead-notes .check { align-items: flex-start; }
.lead-notes .check input { margin-top: 2px; }
@media (min-width: 1100px) { .lead-layout { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; } }
#lead-why { max-width: 70ch; margin-bottom: 16px; border-top: 0; padding-top: 0; }
.leads-credit { margin-top: 24px; max-width: 80ch; }
.leads-toolbar { grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); align-items: end; margin-top: 16px; }
/* On a phone the two pickers share a row under the search box, so the list starts higher. */
@media (max-width: 899px) {
  .leads-toolbar { grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
  .leads-toolbar .field:first-child { grid-column: 1 / -1; }
}
.lead-dnc, .lead-coverage, .lead-key { margin-top: 20px; }
.lead-dnc summary, .lead-coverage summary, .lead-key summary { min-height: 44px; display: flex; align-items: center; cursor: pointer; font-weight: 600; color: var(--text); text-decoration: underline; text-underline-offset: 3px; }
.lead-coverage .hint { margin-top: 8px; max-width: 70ch; }
.coverage-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 16px; padding: 12px 16px; }
.coverage-row .primary { font-weight: 600; }
.coverage-row .meta { grid-column: 1 / -1; max-width: 70ch; }
.lead-start { margin-top: 24px; }

/* My business: four steps, one on screen at a time. */
.steps { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; margin: 16px 0 20px; }
.step { display: grid; gap: 2px; width: 100%; min-height: 56px; padding: 6px 8px; border: 0; border-top: 4px solid var(--border); background: transparent; text-align: left; cursor: pointer; color: var(--text-2); }
.step:disabled { cursor: default; color: var(--text-3); }
.step[aria-current="step"] { border-top-color: var(--accent); color: var(--text); }
.step-n { font: 700 20px/22px var(--head); }
.step-name { font: 500 13px/16px "Roboto", sans-serif; }
.biz-step { max-width: 760px; }
.biz-step > .meta { margin-top: 4px; max-width: 64ch; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; margin-top: 12px; }
.tile { min-height: 60px; padding: 8px 12px; border: 1px solid var(--border-strong); border-radius: 4px; background: var(--surface); font: 600 19px/22px var(--head); color: var(--text); text-align: left; cursor: pointer; }
.tile[aria-checked="mixed"] { box-shadow: inset 0 -4px 0 var(--accent); }
.tiles-groups { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
/* Nineteen kinds of business on step 1: tight rows so a phone shows them without a long scroll. */
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; margin-top: 12px; border: 1px solid var(--border-strong); border-radius: 4px; overflow: hidden; }
.seg button { min-height: 44px; padding: 4px 8px; border: 0; border-left: 1px solid var(--border-strong); background: var(--surface); color: var(--text); font: 600 16px/18px var(--head); cursor: pointer; }
.seg button:first-child { border-left: 0; }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--on-ink); }
.seg button:focus-visible { outline: 2px solid var(--accent); outline-offset: -3px; }
#biz-trades { gap: 6px; }
#biz-trades .tile { min-height: 40px; font-size: 16px; line-height: 18px; padding: 4px 10px; }
#biz-trades .tile[data-trade="other"] { grid-column: 1 / -1; }
@media (min-width: 700px) { #biz-trades { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); } }
.tiles-groups .tile { min-height: 52px; font-size: 17px; line-height: 20px; padding: 6px 12px; }
.biz-adjust > summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; font-weight: 600; color: var(--accent); }
.biz-adjust[open] > summary { margin-bottom: 4px; }
.tile[aria-checked="true"] { background: var(--ink); border-color: var(--ink); color: var(--on-ink); box-shadow: inset 0 -4px 0 var(--accent); }
.kind-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0 12px; align-items: center; padding: 6px 14px; }
.kind-row select { min-height: 44px; padding: 0 8px; border: 1px solid var(--border-strong); border-radius: 4px; background: var(--surface); }
.kind-row .meta { grid-column: 1 / -1; padding-bottom: 6px; }
.kind-row select { width: 132px; }
@media (max-width: 599px) {
  .kind-row { padding: 4px 12px; gap: 0 8px; }
  .kind-row select { width: 112px; }
  .kind-row .primary { font-size: 15px; line-height: 20px; }
}
.lead-home .field { max-width: 360px; }

/* The toast is as wide as its words, so it sits over less of the list, and Undo never wraps. */
.say { width: max-content; }
.say-action { white-space: nowrap; flex: none; }

/* A job's photos: a grid that wraps, never a row that scrolls sideways. */
.photo-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
.photo-grid li { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.photo-open, .photo-gone { display: block; width: 100%; aspect-ratio: 4 / 3; padding: 0; border: 1px solid var(--border); border-radius: 6px; overflow: hidden; background: var(--canvas); }
.photo-open { cursor: pointer; }
.photo-open img { display: block; width: 100%; height: 100%; object-fit: cover; }
.photo-open:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.photo-gone { display: flex; align-items: center; justify-content: center; padding: 8px; text-align: center; }
.photo-grid .btn-text { align-self: flex-start; }

/* Help: what changed, newest first. */
.help-update { display: block; padding: 12px 16px; }
.help-update .primary { display: block; font-weight: 600; }
.help-update .meta { display: block; }
.help-update p { margin: 6px 0 0; }
