/* Apex Pro Cabinets — Projects & Accounting (staff only), v7.12.
   Same look as the estimate page: fixed light chrome, #1d2d44
   primary buttons, white cards on #e9e9e9, Lora 13px controls.
   Money is whole dollars only — no cents anywhere. */

:root {
  --prj-bar: #4b5a6a;
  --prj-ink: #1f2d3a;
  --prj-border: #c9c9c9;
  --prj-text: #2b2b2b;
}

html { color-scheme: light; }
html[data-theme="dark"] { color-scheme: dark; }

/* v7.18 — [hidden] must actually hide: .est-btn / .prj-btn set
   display: inline-flex, which beats the browser's built-in
   [hidden] { display: none } rule, so buttons hidden with the
   hidden attribute still rendered (caught by the rendered probe:
   "Continue without a project" showed in new-project mode, and
   the Download ZIP button showed on a brand-new project with no
   id). The one-off [hidden] rules elsewhere in this file stay. */
[hidden] { display: none !important; }
/* v7.15 — the page background is the website's own background
   (the cabinet-door photo the homepage sections use, light or
   dark to match the theme — see the v7.15 block at the end of
   this file). The white boxes stay white (light) or go dark
   (dark mode). Print is always white. */
body { background: #e9e9e9; color: var(--prj-text); }
.prj-wrap input, .prj-wrap select, .prj-wrap textarea { box-sizing: border-box; }

.prj-wrap { max-width: 850px; margin: 0 auto; padding: 24px 16px 60px; font-family: Georgia, 'Times New Roman', serif; color: var(--prj-text); }
/* v7.17 — the old white top bar (.prj-site-header) is gone: the
   staff header (see the v7.17 block at the end of this file) is
   the page header now. No rule for it may come back — the DARK
   toggle lives inside the staff header. */

.prj-card { font-family: "Lora", Georgia, serif; background: #fff; border: 1px solid var(--prj-border); border-radius: 8px; padding: 24px 22px; box-shadow: 0 0 12px rgba(0,0,0,.08); margin-bottom: 16px; }
.prj-card h1 { font-size: 22px; color: var(--prj-ink); margin: 0 0 6px; font-family: "Cinzel", Georgia, serif; }
.prj-card h2 { font-size: 16px; color: var(--prj-ink); margin: 0 0 8px; }
.prj-card h3 { font-size: 14px; color: var(--prj-ink); margin: 18px 0 8px; }
/* v23 (Igor, item 25) — ONE card for the whole Projects section:
   the outer .est-start card holds the heading + controls + list,
   so this middle card's own border / background / shadow are
   gone (the section no longer shows three nested border lines:
   outer card > middle card > POB). Padding and bottom margin are
   zeroed too, so the controls sit directly in the outer card —
   the same spacing the Customers view already has (its list sits
   straight inside .est-start, no middle card there). The POB
   rows keep their own borders. Scoped to #projListScreen: the
   .prj-card sections in the project detail keep their cards.
   ID specificity (1,1,0) outranks .prj-card, its dark-mode rule
   and the mobile padding rule below, so this holds in both
   modes and at every width. */
#projListScreen.prj-card { background: transparent; border: none; border-radius: 0; box-shadow: none; padding: 0; margin-bottom: 0; }
.prj-sub { font-size: 13.5px; color: #555; margin: 0 0 14px; line-height: 1.5; }
.prj-line { font-size: 13px; color: var(--prj-ink); margin: 10px 0; }
.prj-note { font-size: 12.5px; color: #555; line-height: 1.5; margin: 8px 0; }
.prj-error { background: #fdecea; border: 1px solid #c0392b; color: #7b1f16; border-radius: 6px; padding: 10px 12px; margin: 0 0 18px; font-size: 13px; line-height: 1.5; }
.prj-status { font-size: 13px; color: #555; }
/* v13 (Igor, item 18) — the "N of N projects …" count line is
   gone: renderProjectList leaves this line empty when the list
   renders normally, and an empty line hides itself so no blank
   gap is left behind. It still shows for its other jobs —
   "Loading projects…", "No projects yet.", "No projects match",
   load errors, and messages mirrored from the editor. */
.prj-status:empty { display: none; }
/* v8 fix — the backup result is mirrored into the list status
   line (see setSaveStatus); errors there are red too. */
.prj-status.error { color: #c0392b; }
.prj-status-line { font-size: 13px; color: var(--prj-ink); font-weight: bold; margin: 0 0 8px; }
/* v7.15 — website-form lead: where it came from (+ service) and the
   client's original message, kept readable in both themes. */
.prj-source-line { font-size: 13px; color: var(--prj-ink); margin: 0 0 8px; }
.prj-notes { white-space: pre-wrap; }

.prj-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 26px; justify-content: center; }
/* Buttons round (Igor, 2026-11-24): the three toolbar buttons
   share the row equally at every width (they only did so on a
   phone before); capped at 300px so they do not stretch the
   whole desktop width. */
.prj-actions .prj-btn { flex: 1 1 0; min-width: 0; max-width: 300px; }
.prj-toolbar { max-width: 850px; margin: 0 auto 12px; display: flex; flex-wrap: wrap; gap: 12px; align-items: center; font-family: "Lora", Georgia, serif; background: #fff; border: 1px solid var(--prj-border); border-radius: 8px; padding: 10px 12px; }
.prj-toolbar-group { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; min-width: 0; }
/* Buttons round (Igor, 2026-11-24): each toolbar group takes an
   equal share of the toolbar (capped at 480px) and its buttons
   share the group equally — Save project / All Projects, Close /
   Archive, Download / Delete. The close note, the download note
   and the save/autosave status each take their own line under
   the buttons, and the "Saved …" time drops under its row too,
   so no text can ever squeeze a button off its row. */
.prj-toolbar-group { flex: 1 1 300px; max-width: 480px; }
.prj-toolbar-group .prj-btn { flex: 1 1 0; min-width: 0; }
/* v14 (Igor, post-v13 item 16) — the Save button's wrap is the
   flex child in the toolbar group, so it takes the button's
   equal share and the button fills it; the tiny save time sits
   under the button. */
.prj-toolbar-group .est-save-wrap { flex: 1 1 0; min-width: 0; }
.prj-toolbar-group .est-save-wrap .prj-btn { width: 100%; }
/* v14 (Igor, item 1) — the "+ Expenses" button at the top of the
   project form is THE SAME SIZE as the "1. Project Details"
   section box below it: its toolbar wrapper drops its own box
   (no padding, border or background — the button IS the box),
   and the button spans the full width of the detail column, the
   same outer width as the section card, at the standard 38px
   button height — the same height as the bordered "1. Project
   Details" title box. A button as tall as the whole (tall)
   form section would not be a button, so the size match is the
   section box's width and the title box's height. The other
   toolbars on this page are untouched. */
#projDetail .prj-toolbar--expenses { padding: 0; border: none; background: transparent; box-shadow: none; max-width: none; margin-bottom: 16px; }
#projDetail .prj-toolbar--expenses .prj-toolbar-group { flex: 1 1 100%; max-width: none; }
#projDetail .prj-toolbar--expenses #projBackBtn { flex: 1 1 100%; width: 100%; min-height: 38px; box-sizing: border-box; }
html[data-theme="dark"] #projDetail .prj-toolbar--expenses { background: transparent; border: none; }
.prj-toolbar-group .prj-saved-at { flex: 1 1 100%; order: 10; }
.prj-toolbar .prj-close-note, .prj-toolbar > .prj-note, .prj-toolbar .prj-status-wrap { flex-basis: 100%; }
/* v7.15 — buttons never shrink: a button keeps its own width and
   wraps whole to the next line instead of squeezing its label onto
   two lines. Groups wrap as units. */
.prj-btn, .prj-list button, .prj-entries button { flex-shrink: 0; white-space: nowrap; }
/* v7.15 — Delete sits at the far end of its row, away from the
   workflow buttons (it is the last button in the row). v7.17 —
   the Download link is a link, not a button, so the rule covers
   it too. */
.prj-list li > button:last-child, .prj-list li > a:last-child { margin-left: auto; }
/* v7.15 — one button SIZE: every button on this page is the same
   height (38px), padding (9px 16px), font-size (13px) and radius
   (6px) — the big start-screen buttons match "Open" / "Delete" in
   size. Colours are UNCHANGED: navy filled primary, white outlined
   secondary — the same two-colour scheme as before. The old 48px
   --big size is gone. */
.prj-btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 38px; padding: 9px 16px; border-radius: 6px;
  cursor: pointer; font-size: 13px; line-height: 1.2; font-family: "Lora", Georgia, serif;
  text-decoration: none; white-space: nowrap; text-align: center;
  background: #1d2d44; color: #fff; border: 1px solid #1d2d44;
  /* v7.15 — border-box: see estimate.css (an <a> button is
     content-box by default, so 38px min-height rendered as 58px). */
  box-sizing: border-box;
}
.prj-btn:hover { background: #324357; border-color: #324357; }
.prj-btn--primary { background: #1d2d44; color: #fff; border: 1px solid #1d2d44; }
/* v23 (item 13) — "+ New Project" in LIGHT mode matches the
   dark-mode colour scheme: the SAME button colour in both
   modes (#5b729f, hover #4a628f — the dark values from the dark
   rule below). Scoped to #newProjectBtn only, so the other
   primary buttons keep navy in light mode. */
#newProjectBtn.prj-btn--primary { background: #5b729f; border-color: #5b729f; }
#newProjectBtn.prj-btn--primary:hover { background: #4a628f; border-color: #4a628f; }
.prj-btn--secondary { background: #fff; color: #1f2d3a; border: 1px solid #1f2d3a; }
.prj-btn--secondary:hover { background: #f2f2f2; border-color: #1f2d3a; }
.prj-btn--big { min-height: 38px; padding: 9px 16px; font-size: 13px; }
.prj-btn:disabled { opacity: .55; cursor: not-allowed; }
.prj-btn:focus-visible { outline: 2px solid #516f9d; outline-offset: 2px; }
.prj-save-status { font-size: 13px; color: #2e7d32; margin-left: auto; }
.prj-save-status.error { color: #c0392b; }
/* v7.17 autosave indicator: small plain text next to the save
   status, same 13px Lora as the other staff-page text — muted
   grey when all is well, red only when a save failed. */
.prj-autosave { font-size: 13px; color: #555; font-family: "Lora", Georgia, serif; }
.prj-autosave.error { color: #c0392b; font-weight: bold; }

.prj-list { list-style: none; margin: 10px 0 0; padding: 0; }
.prj-list li { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; border: 1px solid var(--prj-border); border-radius: 6px; padding: 10px 12px; margin-bottom: 8px; font-size: 13px; }
.prj-list .prj-id { font-weight: bold; color: var(--prj-ink); }
.prj-list .prj-client { flex: 1 1 160px; min-width: 0; overflow-wrap: anywhere; }
.prj-list .prj-money { font-weight: bold; }
.prj-list .prj-meta { color: #555; font-size: 12px; }
/* v7.15 — sizing only: "Open" is now the same size as every other
   button (38px, 9px 16px, 13px) instead of 30px. Colours unchanged:
   navy filled here, white outlined for .secondary below. */
/* v7.19 — LIST-ROW BUTTONS (Igor): same as estimate.css — the
   Open/Delete buttons were 38px tall against a ~19px text line.
   Compact 28px now, aligned with the number/text line, on the
   project lists and the payment/expense entry rows. Colours
   unchanged; the 38px buttons elsewhere are NOT touched. */
.prj-list button { background: #1d2d44; color: #fff; border: 1px solid #1d2d44; padding: 5px 12px; border-radius: 6px; cursor: pointer; font-size: 12.5px; font-family: "Lora", Georgia, serif; min-height: 28px; box-sizing: border-box; }
.prj-list button:hover { background: #324357; border-color: #324357; }
/* v22 fix (item 15) — the embedded doc toolbar lives inside a
   .prj-list row, so the 28px list-button rule above (0,1,1) beat
   .est-btn (0,1,0) and shrank Convert/Print to 28px while
   Save/Send were rescued only by their #id height rule. The
   toolbar buttons keep the list rule's padding/font-size (so
   the 402px 2-column grid still fits) but get the same 38px
   height as Save/Send (0,3,0 beats 0,1,1; Save/Send untouched). */
.prj-list .est-toolbar button, .prj-list .est-toolbar .est-btn { min-height: 38px; height: 38px; }
.prj-list button.secondary { background: #fff; color: #1f2d3a; border: 1px solid #1f2d3a; }

/* v7.17 — the old .prj-list-controls / .prj-control rules are
   gone: the filter bar is .prj-filter-bar now (see the v7.17
   block at the end of this file), styled like the main site's
   contact form with a search icon + clear button, a compact
   sort, and a custom date range. */
.prj-fields { font-size: 13px; margin: 12px 0 4px; }
.prj-field { margin-bottom: 8px; }
.prj-field label, .prj-form-row label { display: block; font-size: 11px; font-weight: bold; color: var(--prj-ink); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 2px; }
.prj-fields input { width: 100%; min-width: 0; border: none; border-bottom: 1px solid var(--prj-border); padding: 4px 2px; font-size: 16px; font-family: "Lora", Georgia, serif; background: transparent; box-sizing: border-box; }
/* Buttons round (Igor, item 5): the "Same as billing" checkbox
   is a checkbox, not a text field — the 100% width above made
   it 332px wide, sticking 4px past its container. Checkboxes
   stay their natural 16px (same as the .prj-form-row rule). */
.prj-fields input[type="checkbox"] { width: 16px; }
.prj-fields input:focus { outline: 1px dashed #9fb3c8; background: #f7fbff; }
/* Dates round (Igor, item 5): the selects and textareas had no
   width rule at all (unlike the inputs), so they rendered at
   browser-default width instead of filling the form like the
   other fields. */
.prj-fields select, .prj-fields textarea { display: block; width: 100%; min-width: 0; box-sizing: border-box; }
.prj-grid2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; min-width: 0; }
/* Dates round (Igor, item 5): a grid child defaults to
   min-width:auto, so a date input's intrinsic minimum width can
   push its column past the form edge (the Safari path behind the
   sticking-out Start/End dates). min-width:0 lets every field
   shrink to its column. */
/* v11 (Igor, item 1) — the v10 min-width:0 fix did NOT hold on
   Igor's iPhone: the Start/End date fields STILL stuck out past
   the right edge when they held a value ("Nov 24, 2026"). Root
   cause, found by reproducing the live form: the v10 probe
   measured a project with NO dates, so its date inputs were
   empty (small intrinsic width). With a value, iOS Safari's
   native date control reports a much larger intrinsic minimum
   width than desktop Chromium's — and a `1fr` grid track has an
   `auto` minimum, so WebKit grows the track past the card to
   fit the control, ignoring the child's min-width:0. The cure
   is minmax(0, 1fr): the track minimum is 0 by construction, so
   no child — however wide its intrinsic size — can stretch the
   track past the form. min-width:0 on the grid children stays
   as a second layer. */
.prj-grid2 > .prj-field { min-width: 0; }

.prj-checklist { margin: 0 0 10px; }
.prj-checklist label { display: flex; gap: 8px; align-items: center; font-size: 13px; padding: 6px 0; border-bottom: 1px solid #eee; position: relative; cursor: pointer; }
/* v8 fix — CHECK MARKS (Igor): the native checkbox is visually
   hidden (still focusable and toggled by tapping its label) and
   a custom square shows the check: empty bordered square when
   unticked, navy square with a white ✓ when ticked — the same
   check-mark style as the customer picker. */
.prj-checklist input[type="checkbox"] {
  position: absolute; width: 1px; height: 1px; margin: 0; padding: 0;
  opacity: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}
.prj-check-box {
  flex-shrink: 0; width: 22px; height: 22px; box-sizing: border-box;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--staff-input-border); border-radius: 6px;
  background: var(--staff-input-bg); color: transparent;
  font-size: 15px; font-weight: 700; line-height: 1;
}
.prj-checklist input[type="checkbox"]:checked + .prj-check-box {
  background: #1d2d44; border-color: #1d2d44; color: #fff;
}
/* v8 fix — the linked-list rows carry the same navy ✓ without a
   checkbox behind them (the dropdown links now; the list shows
   what is linked). */
.prj-check-box.is-checked { background: #1d2d44; border-color: #1d2d44; color: #fff; }
.prj-linked-row { display: flex; gap: 8px; align-items: center; font-size: 13px; padding: 6px 0; border-bottom: 1px solid #eee; }
.prj-linked-row .prj-linked-text { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.prj-linked-row .doc-open-btn { margin-left: auto; }
html[data-theme="dark"] .prj-linked-row { border-bottom-color: rgba(255, 255, 255, 0.08); }

/* v8 fix — LINK-DOCUMENT DROPDOWNS (Igor): the same styled
   dropdown-panel pattern as the searchable customer picker — a
   button opens a panel with a search input, then the documents
   grouped "Matching this customer" first. A row is number +
   customer name on the main line, address · total · date below,
   with the ✓ check on linked ones and an Open button that opens
   the document. Light + dark via the staff tokens. */
.prj-doc-picker { margin: 0 0 10px; }
.prj-doc-picker-btn {
  display: block; width: 100%; box-sizing: border-box; text-align: left;
  font-family: "Lora", Georgia, serif; font-size: 15px; line-height: 1.3;
  color: var(--staff-input-text); background-color: var(--staff-input-bg);
  border: 1px solid var(--staff-input-border); border-radius: 14px;
  padding: 12px 36px 12px 12px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%231d2d44' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
}
.prj-doc-picker-btn:hover, .prj-doc-picker-btn:focus-visible { border-color: var(--staff-input-focus); box-shadow: 0 0 0 3px var(--staff-focus-ring); outline: none; }
html[data-theme="dark"] .prj-doc-picker-btn {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%23eef1f6' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
.prj-doc-picker-panel {
  margin-top: 8px; padding: 12px; box-sizing: border-box;
  background: var(--staff-input-bg); border: 1px solid var(--staff-input-border);
  border-radius: 14px; box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
  max-height: 340px; overflow-y: auto;
}
.prj-doc-picker-search {
  display: block; width: 100%; box-sizing: border-box; margin-bottom: 8px;
  font-family: "Lora", Georgia, serif; font-size: 16px;
  color: var(--staff-input-text); background: var(--staff-input-bg);
  border: 1px solid var(--staff-input-border); border-radius: 14px;
  padding: 5px 12px; min-height: 34px; transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.prj-doc-picker-search:focus { outline: none; border-color: var(--staff-input-focus); box-shadow: 0 0 0 3px var(--staff-focus-ring); }
.prj-doc-picker-search::placeholder { color: var(--staff-input-placeholder); }
.prj-doc-picker-list { display: flex; flex-direction: column; gap: 6px; margin: 0; padding: 0; list-style: none; }
.prj-doc-pick-group { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--staff-input-text); opacity: 0.75; padding: 6px 2px 0; }
.prj-doc-pick-row { display: flex; gap: 8px; align-items: stretch; }
.prj-doc-pick-main {
  flex: 1 1 auto; min-width: 0; display: flex; gap: 10px; align-items: flex-start; text-align: left;
  font-family: "Lora", Georgia, serif; font-size: 15px; line-height: 1.3;
  color: var(--staff-input-text); background: var(--staff-input-bg);
  border: 1px solid var(--staff-input-border); border-radius: 14px;
  padding: 12px; cursor: pointer;
}
.prj-doc-pick-main:hover, .prj-doc-pick-main:focus-visible { border-color: var(--staff-input-focus); box-shadow: 0 0 0 3px var(--staff-focus-ring); outline: none; }
.prj-doc-pick-main[aria-selected="true"] { background: #1d2d44; border-color: #1d2d44; color: #fff; font-weight: 700; }
.prj-doc-pick-main[aria-selected="true"] .cust-pick-check { color: #fff; }
.prj-doc-pick-main[disabled] { cursor: default; opacity: 0.85; }
.prj-doc-pick-row .doc-open-btn { align-self: center; }
.prj-checklist input[type="checkbox"]:focus-visible + .prj-check-box {
  outline: 2px solid var(--staff-input-focus); outline-offset: 2px;
}
.prj-checklist .prj-empty { color: #555; font-size: 13px; }

.prj-form-row { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: flex-end; margin-bottom: 12px; }
.prj-form-row label { font-size: 11px; font-weight: bold; color: var(--prj-ink); text-transform: uppercase; letter-spacing: .5px; }
.prj-form-row label.prj-check { display: inline-flex; gap: 8px; align-items: center; text-transform: none; font-size: 13px; font-weight: normal; letter-spacing: 0; }
.prj-form-row input, .prj-form-row select { display: block; margin-top: 2px; padding: 6px 8px; border: 1px solid #9fb3c8; border-radius: 4px; font-size: 16px; font-family: "Lora", Georgia, serif; background: #fff; color: #1f2d3a; }
.prj-form-row input[type="number"] { width: 110px; text-align: right; }
.prj-form-row input[type="date"] { width: 150px; }
.prj-form-row input[type="text"] { width: 170px; }
.prj-form-row input[type="file"] { max-width: 240px; }
.prj-form-row input[type="checkbox"] { width: 16px; height: 16px; accent-color: #1d2d44; }

.prj-entries { list-style: none; margin: 10px 0 0; padding: 0; }
.prj-entries li { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; border: 1px solid var(--prj-border); border-radius: 6px; padding: 8px 12px; margin-bottom: 6px; font-size: 13px; }
.prj-entries .prj-entry-main { flex: 1 1 200px; }
.prj-entries .prj-entry-amount { font-weight: bold; }
.prj-entries .prj-locked { color: #7b1f16; font-size: 12px; }
.prj-entries .prj-flag { color: #8a6d00; font-size: 12px; }
/* v8 merge (Igor item 5) — payments received on the linked
   invoices, shown read-only in the Payments list (they are
   edited on the invoice, not here). */
.prj-entry-invoice-paid { color: #555; }
html[data-theme="dark"] .prj-entry-invoice-paid { color: #c0c7d6; }
.prj-entries a { color: var(--prj-ink); }
/* v7.15 — sizing only: the payment/expense row buttons are the
   same size as every other button now (38px, 9px 16px, 13px).
   Colours unchanged (white outlined). */
.prj-entries button { background: #fff; color: #1f2d3a; border: 1px solid #1f2d3a; padding: 5px 12px; border-radius: 6px; cursor: pointer; font-size: 12.5px; font-family: "Lora", Georgia, serif; min-height: 28px; box-sizing: border-box; }
.prj-entries button:hover { background: #f2f2f2; border-color: #1f2d3a; }
.prj-entries button:disabled { opacity: .55; cursor: not-allowed; }

.prj-totals { display: flex; flex-wrap: wrap; gap: 10px 28px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--prj-border); }
.prj-totals div { font-size: 13px; }
.prj-totals span { color: #555; margin-right: 6px; }
.prj-totals strong { color: var(--prj-ink); font-size: 15px; }

/* === v7.13 — Mobile portrait (iPhone 18 Pro, 402px) ===
   Forms stack: each field gets its own row with a full-width
   input, so nothing is squeezed side-by-side and no label, date,
   number or file input clips. The two-column grids collapse to
   one column and the site header wraps. */
@media (max-width: 520px) {
  .prj-wrap { padding: 16px 10px 48px; }
  /* Buttons round (Igor, item 1): the project-box bottom row
     ("Reopen project" needs ~77px at 11px, ~70px at 10px) only gets
     a 66px share when the card keeps 16px side padding — the full
     chain is .est-start (8px after the estimate.css fix) > .prj-card
     > .prj-list li (12px). 8px here + 8px on the box frees ~16px of
     container, ~4px of share. */
  .prj-card { padding: 14px 8px; }
  .prj-list li { padding: 10px 8px; }
  /* v11 (Igor, item 1) — minmax(0, 1fr), not 1fr: see the note
     above .prj-grid2. A bare 1fr track keeps an `auto` minimum
     and iOS Safari's filled date control stretches it past the
     card. */
  .prj-grid2 { grid-template-columns: minmax(0, 1fr); }
  .prj-form-row { flex-direction: column; align-items: stretch; }
  .prj-form-row > label { width: 100%; }
  .prj-form-row input, .prj-form-row select { width: 100%; max-width: none; box-sizing: border-box; }
  .prj-form-row input[type="checkbox"] { width: 16px; }
  .prj-form-row label.prj-check { flex-direction: row; align-items: center; }
}

/* ================================================================
   v7.15 — staff-page background, Light/Dark,
   list controls, mobile fit
   (v23 item 26: the Back/Forward toolbar is eliminated.)
   ================================================================ */

/* --- Page background: the website's own background, light/dark ---
   Same asset and overlay as the homepage (styles.css body::before):
   the cabinet-door photo (light_background.jpg / dark_background.jpg)
   with the site's overlay tint. White boxes stay opaque on top of it. */
html[data-theme="light"] body, html:not([data-theme]) body {
  background:
    linear-gradient(rgba(241, 243, 245, 0.4), rgba(241, 243, 245, 0.4)),
    url("assets/light_background.jpg") 51.2% 50% / cover no-repeat scroll;
}
html[data-theme="dark"] body {
  background:
    linear-gradient(rgba(90, 123, 175, 0.08), rgba(90, 123, 175, 0.08)),
    url("assets/dark_background.jpg") 51.2% 50% / cover no-repeat scroll;
}

/* --- Theme toggle (v7.17: inside the staff header now) ---
   The toggle is a 38px button like every other staff button
   (v7.15's 44px standalone toggle is gone with the old top bar).
   Its colours are the header's own: it sits on the dark header in
   BOTH themes, like the main site's toggle. See the v7.17 staff
   header block at the end of this file. */

/* --- Dark mode: the whole chrome goes dark ---
   Cards, toolbars, list, forms and buttons use the site's dark
   tokens (#10121a / #1a1f26 surfaces, #eef1f6 text, #5b729f
   primary). Print forces the page back to white (below). */
html[data-theme="dark"] .prj-card,
html[data-theme="dark"] .prj-toolbar { background: #161b24; border-color: rgba(255, 255, 255, 0.14); color: #eef1f6; }
html[data-theme="dark"] .prj-card h1,
html[data-theme="dark"] .prj-card h2,
html[data-theme="dark"] .prj-card h3 { color: #eef1f6; }
html[data-theme="dark"] .prj-sub,
html[data-theme="dark"] .prj-note,
html[data-theme="dark"] .prj-status,
html[data-theme="dark"] .prj-line { color: #c0c7d6; }
html[data-theme="dark"] .prj-status-line,
html[data-theme="dark"] .prj-source-line { color: #eef1f6; }
html[data-theme="dark"] .prj-list li,
html[data-theme="dark"] .prj-entries li { background: #1a1f26; border-color: rgba(255, 255, 255, 0.14); }
html[data-theme="dark"] .prj-list .prj-id,
html[data-theme="dark"] .prj-list .prj-money,
html[data-theme="dark"] .prj-entries .prj-entry-amount { color: #eef1f6; }
html[data-theme="dark"] .prj-list .prj-client,
html[data-theme="dark"] .prj-list .prj-meta,
html[data-theme="dark"] .prj-entries .prj-entry-main { color: #c0c7d6; }
html[data-theme="dark"] .prj-btn--primary,
html[data-theme="dark"] .prj-list button,
html[data-theme="dark"] .prj-btn { background: #5b729f; border-color: #5b729f; }
html[data-theme="dark"] .prj-btn--primary:hover,
html[data-theme="dark"] .prj-list button:hover { background: #4a628f; border-color: #4a628f; }
html[data-theme="dark"] .prj-btn--secondary,
html[data-theme="dark"] .prj-list button.secondary,
html[data-theme="dark"] .prj-entries button { background: #1a1f26; color: #eef1f6; border-color: rgba(255, 255, 255, 0.22); }
html[data-theme="dark"] .prj-btn--secondary:hover { background: #232a36; }
/* v7.17 — the toggle lives in the dark staff header in both
   themes; its colours come from the header block below. (Old
   dark .theme-toggle rules deleted.) */
html[data-theme="dark"] .prj-field label,
html[data-theme="dark"] .prj-form-row label { color: #eef1f6; }
html[data-theme="dark"] .prj-fields input,
html[data-theme="dark"] .prj-form-row input,
html[data-theme="dark"] .prj-form-row select { background: #1a1f26; color: #eef1f6; border-color: rgba(255, 255, 255, 0.22); }
html[data-theme="dark"] .prj-fields input:focus { background: #232a36; }
html[data-theme="dark"] .prj-save-status { color: #81c995; }
html[data-theme="dark"] .prj-save-status.error { color: #ff8a80; }
html[data-theme="dark"] .prj-status.error { color: #ff8a80; }
html[data-theme="dark"] .prj-autosave { color: #b9bec7; }
html[data-theme="dark"] .prj-autosave.error { color: #ff8a80; }
html[data-theme="dark"] .prj-totals { border-top-color: rgba(255, 255, 255, 0.14); }
html[data-theme="dark"] .prj-totals span { color: #c0c7d6; }
html[data-theme="dark"] .prj-totals strong { color: #eef1f6; }
html[data-theme="dark"] .prj-checklist label { border-bottom-color: rgba(255, 255, 255, 0.08); }
html[data-theme="dark"] .prj-entries .prj-locked { color: #ff8a80; }

/* --- Mobile: the v7.17 filter bar wraps as a unit at <=520px
   (see the v7.17 block at the end of this file). --- */

/* --- Print: white page, like the estimate document --- */
@media print {
  body { background: #fff !important; }
  .prj-card, .prj-toolbar { background: #fff !important; }
}

/* ================================================================
   v7.17 — staff header (logo-only, like the main site header),
   uniform 38px buttons, main-site form controls, compact filter
   bar (search + sort + period + custom date range). THE
   STAFF-HEADER BLOCK BELOW IS IDENTICAL IN estimate.css AND
   projects.css — change it in both places.
   ================================================================ */

/* --- Main-site input tokens (styles.css --color-input-*) ---
   Light: bg rgba(255,255,255,.9), border rgba(29,45,68,.18),
   focus border #1D2D44, text #0E1116, placeholder #6C757D,
   focus ring rgba(29,45,68,.45). Dark: bg rgba(26,31,38,.8),
   border rgba(255,255,255,.14), focus border #6B8ABF, text
   #EEF1F6, placeholder #73777D, ring rgba(214,223,243,.30). */
:root {
  --staff-input-bg: rgba(255, 255, 255, 0.9);
  --staff-input-border: rgba(29, 45, 68, 0.18);
  --staff-input-focus: #1d2d44;
  --staff-input-text: #0e1116;
  --staff-input-placeholder: #6c757d;
  --staff-focus-ring: rgba(29, 45, 68, 0.45);
}
html[data-theme="dark"] {
  --staff-input-bg: rgba(26, 31, 38, 0.8);
  --staff-input-border: rgba(255, 255, 255, 0.14);
  --staff-input-focus: #6b8abf;
  --staff-input-text: #eef1f6;
  --staff-input-placeholder: #73777d;
  --staff-focus-ring: rgba(214, 223, 243, 0.30);
}

/* --- v7.19 — restyled selects: no generic browser dropdown ---
   Every <select> that genuinely has to stay (Sort, Period,
   payment method, expense category, tax period/quarter) gets the
   main site's contact-form treatment from the tokens above —
   same border, radius, padding, text, focus ring — plus a proper
   chevron, in both themes. The customer/address pickers are gone
   (text + Change link, tappable address chips — see below), so
   no other select exists on this page. v8 merge: this file now
   loads on estimate.html too, so the rules are scoped to the
   Projects screens (#projListScreen / #projDetail) — a bare
   `select` here would restyle the estimate page's selects. */
#projListScreen select, #projDetail select {
  appearance: none; -webkit-appearance: none;
  font-family: "Lora", Georgia, serif; font-size: 16px; line-height: 1.3;
  color: var(--staff-input-text); background-color: var(--staff-input-bg);
  border: 1px solid var(--staff-input-border); border-radius: 14px;
  padding: 5px 36px 5px 12px; min-height: 34px; box-sizing: border-box; max-width: 100%;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%231d2d44' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
#projListScreen select:focus, #projDetail select:focus {
  outline: none; border-color: var(--staff-input-focus);
  box-shadow: 0 0 0 3px var(--staff-focus-ring);
}
html[data-theme="dark"] #projListScreen select, html[data-theme="dark"] #projDetail select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%23d6dff3' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
/* Compact selects next to the 38px buttons (list Sort/Period).
   v9 fix — ID-scoped so it outranks the #projListScreen select
   rule above (padding 12px, font 15px), which used to make these
   46px tall instead of half height. */
#projListScreen .prj-filter-field select, #projListScreen .prj-filter-sort select {
  font-size: 12px; line-height: 1.3; padding: 1px 30px 1px 10px; min-height: 17px;
  background-position: right 10px center;
}

/* --- Staff header: the main website header, logo-only ---
   NAVY background (#1d2d44, the site's navy) in BOTH themes
   (v8 fix, Igor: the black header was wrong), sticky; the brand
   is the AP logo alone (no wordmark, no tagline). The header
   holds ONLY the logo, the icon-only Dark/Light toggle and the
   title-as-menu — NO nav links in the header on any screen size.
   The four destinations live in the drawer (opened from the
   title, v23 item 27: the nav row below the header is gone).
   The old .nav-fits measurement switch is gone with the header
   nav: there is nothing left to measure, so the title always
   opens the drawer. The header never wraps
   (flex-wrap: nowrap, brand + actions flex-shrink: 0), so the
   toggle can never drop to its own full-width row. */
.staff-header {
  position: sticky; top: 0; z-index: 50;
  background: #1d2d44;
  border-bottom: 1px solid rgba(214, 223, 243, 0.14);
  border-radius: 8px; margin-bottom: 12px;
}
.staff-header-inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; padding: 8px 12px; flex-wrap: nowrap;
}
.staff-brand { display: inline-flex; align-items: center; flex-shrink: 0; min-width: 0; }
/* v7.18 — the staff header logo is WHITE, like the main website
   header logo: the logo file itself is navy (like the main site's),
   so the same filter the main site header uses (styles.css
   --brand-logo-filter) inverts it to white on the dark header. */
/* v7.19 — the staff header uses a genuinely white logo file
   (assets/logo-white.png: the navy mark re-rendered white, alpha
   kept), NOT a CSS filter. The v7.18 brightness/invert filter did
   not take on the live site, so the logo stayed navy. No filter
   here on purpose — the file itself is white. */
.staff-brand img { display: block; height: 40px; width: auto; }
.staff-header-actions { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
/* v7.19 — DARK/LIGHT toggle is ICON-ONLY on EVERY screen size,
   exactly the same 38px square as the old burger button (Igor: the desktop
   "LIGHT" text button is wrong and must go). Sun in dark mode,
   moon in light mode — the icon is the theme you switch TO.
   At <=520px the toggle is 32px; at <=480px it is 44px (step 3). */
.staff-header .theme-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; min-width: 38px; min-height: 38px; padding: 0; box-sizing: border-box;
  border-radius: 6px; border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(0, 0, 0, 0.18); color: #eef1f6; cursor: pointer;
  font-size: 18px; font-family: "Lora", Georgia, serif;
  white-space: nowrap; flex-shrink: 0;
}
.staff-header .theme-toggle:hover { background: rgba(214, 223, 243, 0.12); }
.staff-header .theme-toggle:focus-visible { outline: 2px solid #516f9d; outline-offset: 2px; }
.staff-header .theme-toggle__icon { font-size: 18px; line-height: 1; }
/* v24 (step 4) — the burger button is REMOVED: the header title
   IS the menu now (it carries data-mobile-toggle), with a small ▾
   after the text so it still reads as tappable. */
.staff-drawer { display: block; border-top: 1px solid rgba(214, 223, 243, 0.14); padding: 10px 12px 14px; }
.staff-drawer a {
  display: block; padding: 12px 8px; border-radius: 12px;
  font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase;
  color: #d6dff3; text-decoration: none; font-family: "Lora", Georgia, serif;
  text-align: center; border: 1px solid transparent;
}
.staff-drawer a:hover { background: rgba(214, 223, 243, 0.08); text-decoration: none; }
/* v24 (item 15) — the choices are CENTERED and get the SAME
   border treatment as the title on hover/tap (uniform selection
   look). The font stays as now (Lora). The border is transparent
   in the resting state, so it appears without shifting anything. */
.staff-drawer a:hover, .staff-drawer a:active { border-color: rgba(214, 223, 243, 0.55); }
.staff-drawer a[aria-current="page"] { background: rgba(214, 223, 243, 0.12); }
/* v23 (item 29, Igor, 2026-11-27) — the current page's link is
   hidden in the drawer (setStaffNavCurrent sets .hidden on it).
   The [hidden] rule is needed because .staff-drawer a above sets
   display: block, which beats the browser's built-in [hidden]
   hiding. Same rule in estimate.css. */
.staff-drawer a[hidden] { display: none; }
.u-hidden { display: none; }
@media (max-width: 520px) {
  .staff-header-inner { padding: 6px 6px; gap: 4px; }
  .staff-brand img { height: 28px; }
  /* v8 fix — the header holds no nav links any more: the toggle
     stays minimal icon-only ~32px (44px at <=480px, step 3).
     The header still never wraps and never overflows: one row,
     brand + actions. */
  .staff-header-actions { gap: 4px; }
  .staff-header .theme-toggle { width: 32px; height: 32px; min-width: 32px; min-height: 32px; padding: 0; }
}
@media (max-width: 360px) {
  .staff-header-inner { padding: 4px; gap: 3px; }
  .staff-brand img { height: 24px; }
  .staff-header-actions { gap: 3px; }
}

/* --- Filter controls: search + sort + period (+ range) ---
   v23 (item 30) — the .prj-filter-bar container is GONE (its
   sub-filters moved INTO the search row's dropdown row,
   #projFilterRow — see the .global-search-row block). What
   stays here are the shared field rules the row's controls
   build on: every control uses the main-site input tokens
   above (Lora stack, 14px radius, navy-tinted border, navy
   focus border + 3px ring). Labels are the main site's label
   treatment (uppercase, letter-spaced) at the staff size. The
   row rule (1,2,1) in the .global-search-row block restates
   the sizes for the row itself, so the two ID-scoped
   #projListScreen rules below can no longer drift them. */
.prj-filter-field {
  display: block; font-size: 11px; font-weight: bold; color: var(--prj-ink);
  text-transform: uppercase; letter-spacing: .5px; font-family: "Lora", Georgia, serif;
  min-width: 0;
}
.prj-filter-field select,
.prj-filter-field input {
  display: block; margin-top: 2px; width: 100%;
  font-family: "Lora", Georgia, serif; font-size: 16px; line-height: 1.15;
  color: var(--staff-input-text); background-color: var(--staff-input-bg);
  border: 1px solid var(--staff-input-border); border-radius: 14px;
  padding: 1px 10px; min-height: 17px; box-sizing: border-box;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
#projListScreen .prj-filter-field select {
  /* v8 fix — the background shorthand above used to wipe the
     chevron from the bare select rule (Sort/Period rendered
     with the native arrow). background-color keeps it; the dark
     chevron comes from the bare dark select rule, which wins on
     specificity.
     v9 fix — ID-scoped with a full padding shorthand so it beats
     the #projListScreen select ID rule (padding 12px, font 15px). */
  padding: 1px 30px 1px 10px; min-height: 17px; font-size: 12px; line-height: 1.3;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%231d2d44' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center;
}
.prj-filter-field select:focus,
.prj-filter-field input:focus {
  outline: none; border-color: var(--staff-input-focus);
  box-shadow: 0 0 0 3px var(--staff-focus-ring);
}
.prj-filter-field select::placeholder,
.prj-filter-field input::placeholder { color: var(--staff-input-placeholder); }
/* Sort stays aligned to its grid column: the select fills the
   column (width 100% of its grid item), so it never sizes to
   its content and drifts from the search bar's right edge.
   v23 (item 30) — the sort label is a grid item in
   #projFilterRow now, not a flex item, so no flex sizing here;
   the row rule governs it. */
.prj-filter-sort select { width: 100%; min-width: 0; }
/* Search: grows, magnifier inside on the left, clear (×) on the
   right when there is text. The browser's own search cancel
   button is hidden — the × below is the one clear control. */
.prj-search-wrap {
  position: relative; flex: 1 1 220px; min-width: 0;
  display: flex; align-items: center;
}
.prj-search-wrap input[type="search"] {
  /* Main-site size (not the compact filter-bar size): the search
     is the primary field, so it takes the main site's form
     styling verbatim — 15px Lora, 12px padding, 14px radius,
     same border and focus ring. Sort/period stay compact 38px. */
  width: 100%; padding: 5px 34px 5px 38px; min-height: 34px;
  box-sizing: border-box; font-family: "Lora", Georgia, serif; font-size: 16px;
  color: var(--staff-input-text); background: var(--staff-input-bg);
  border: 1px solid var(--staff-input-border); border-radius: 14px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.prj-search-wrap input[type="search"]::-webkit-search-cancel-button { display: none; }
.prj-search-wrap input[type="search"]::placeholder { color: var(--staff-input-placeholder); }
.prj-search-wrap input[type="search"]:focus {
  outline: none; border-color: var(--staff-input-focus);
  box-shadow: 0 0 0 3px var(--staff-focus-ring);
}
.prj-search-icon {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  color: #6c757d; pointer-events: none; flex-shrink: 0;
}
.prj-search-clear {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  width: 26px; height: 26px; min-width: 26px; min-height: 26px; padding: 0;
  border: none; border-radius: 50%; background: transparent;
  color: #555; font-size: 18px; line-height: 1; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.prj-search-clear:hover { background: rgba(29, 45, 68, 0.08); color: #1f2d3a; }
.prj-search-clear:focus-visible { outline: 2px solid #516f9d; outline-offset: 1px; }
.prj-search-clear[hidden] { display: none; }
/* Custom range: From/To date fields, each with a small calendar
   icon at the left (the native date picker is on the right).
   v23 (item 30) — the wrap is `display: contents` inside the
   dropdown row (#projFilterRow), so its two labels are grid
   items in their own right and take row 2 50/50 at the
   Custom-range split (v24 step 5; instead of sharing one flex
   row). The [hidden] rule
   still wins (higher specificity), so a hidden wrap stays
   hidden. The icon/padding rules below are the non-row
   defaults; the row overrides them (icon hidden, 4px padding)
   in the .global-search-row block. */
#projFilterRangeWrap { display: contents; }
#projFilterRangeWrap[hidden] { display: none; }
#projFilterMonthWrap[hidden], #projFilterYearWrap[hidden], #projFilterTaxWrap[hidden] { display: none; }
/* v23 (item 30) — Month / Year / Tax year are grid items in the
   dropdown row. v24 (step 5): each wrap spans the FULL second row
   (grid-column: 1 / -1) — this restores the v14 item 3 full-width
   rule and supersedes the v23 1/3 split. The wrap itself carries
   no sizing beyond that — the row's grid does it — and its label
   fills it via the row rule. The [hidden] rules above still
   win, so a hidden wrap stays hidden. */
#projFilterMonthWrap, #projFilterYearWrap, #projFilterTaxWrap { min-width: 0; grid-column: 1 / -1; }
.prj-date-wrap { position: relative; display: flex; align-items: center; margin-top: 2px; }
.prj-date-wrap input[type="date"] { padding-left: 32px; width: 100%; }
.prj-date-icon {
  position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
  color: #6c757d; pointer-events: none; flex-shrink: 0;
}
/* v23 (item 30) — the <=520px filter-bar overrides are GONE
   with the bar: the search always takes its own row and the
   dropdown row splits equally at every width, so there is
   nothing left to re-flow at phone size. */

/* --- Main-site form controls on the project detail ---
   The standalone client/address/email/phone fields use the full
   main-site size (12px padding, 15px Lora). The inline form-row
   inputs (payments, expenses, tax) use the compact 38px size so
   the rows stay tidy next to the 38px buttons. The file input
   gets the same border/radius/font instead of the browser's
   bare look. */
.prj-fields input {
  font-family: "Lora", Georgia, serif; font-size: 16px;
  color: var(--staff-input-text); background: var(--staff-input-bg);
  border: 1px solid var(--staff-input-border); border-radius: 14px;
  padding: 5px 12px; min-height: 34px; box-sizing: border-box;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.prj-fields input::placeholder { color: var(--staff-input-placeholder); }
.prj-fields input:focus {
  outline: none; border-color: var(--staff-input-focus);
  box-shadow: 0 0 0 3px var(--staff-focus-ring);
}
.prj-form-row input,
.prj-form-row select {
  font-family: "Lora", Georgia, serif; font-size: 16px;
  color: var(--staff-input-text); background: var(--staff-input-bg);
  border: 1px solid var(--staff-input-border); border-radius: 14px;
  padding: 4px 10px; min-height: 27px; box-sizing: border-box;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.prj-form-row input:focus,
.prj-form-row select:focus {
  outline: none; border-color: var(--staff-input-focus);
  box-shadow: 0 0 0 3px var(--staff-focus-ring);
}
.prj-form-row input::placeholder { color: var(--staff-input-placeholder); }
html[data-theme="dark"] .prj-filter-field { color: #eef1f6; }
/* v14 (Igor, post-v13 item 5) — ROOT CAUSE of the broken dark-mode
   Sort/Period dropdowns: this rule used the `background:`
   shorthand, which resets EVERY background longhand — including
   background-repeat (back to `repeat`) and background-position
   (back to `0% 0%`) — on the selects that carry the SVG chevron.
   The light chevron rule sets repeat: no-repeat + right-center,
   but at lower specificity (0,2,1) than this dark rule (0,2,2),
   so in dark mode the 12×8 chevron tiled across the whole field
   and overlapped the text. The dark rule that re-sets the chevron
   image only restores the image, not repeat/position. On the
   Projects view the (1,1,1) #projListScreen rule re-declared
   repeat/position, which is why Projects looked fine and only
   the Customers view broke. background-color changes the fill
   only and leaves the chevron's repeat/position alone — the same
   fix the codebase already uses for the doc-assign select
   (estimate.css, "background-color, NOT the background
   shorthand"). The inputs in this rule have no background image,
   so this is behaviour-identical for them. */
html[data-theme="dark"] .prj-filter-field select,
html[data-theme="dark"] .prj-filter-field input,
html[data-theme="dark"] .prj-search-wrap input[type="search"],
html[data-theme="dark"] .prj-fields input,
html[data-theme="dark"] .prj-form-row input,
html[data-theme="dark"] .prj-form-row select {
  background-color: var(--staff-input-bg); color: var(--staff-input-text);
  border-color: var(--staff-input-border);
}
html[data-theme="dark"] .prj-search-icon,
html[data-theme="dark"] .prj-date-icon { color: #73777d; }
html[data-theme="dark"] .prj-search-clear { color: #c0c7d6; }
html[data-theme="dark"] .prj-search-clear:hover { background: rgba(214, 223, 243, 0.12); color: #eef1f6; }

/* --- Print: the staff header never prints (it has .no-print,
   covered by the print rule above) --- */

/* --- Save button "Saved" state + last-saved time (v7.17) ---
   After a manual Save the page stays put; the button inverts
   (white background, navy text — the inverse of the primary
   navy button) and reads "Saved", with the relative last-saved
   time beside it ("Today, HH:MM" / "Yesterday, HH:MM" /
   "YYYY-MM-DD, HH:MM"). The next edit reverts it. */
.prj-btn--primary.is-saved {
  background: #fff;
  color: #1d2d44;
  border-color: #1d2d44;
}
.prj-saved-at {
  font-family: "Lora", Georgia, serif;
  font-size: 13px;
  color: #555;
  white-space: nowrap;
  align-self: center;
}
.prj-saved-at[hidden] { display: none; }
html[data-theme="dark"] .prj-btn--primary.is-saved {
  background: #1a1f26;
  color: #eef1f6;
  border-color: rgba(255, 255, 255, 0.22);
}
html[data-theme="dark"] .prj-saved-at { color: #9aa3b2; }

/* --- Split project lists: Open / Closed headings (v7.17) --- */
.prj-section-title {
  font: 700 12px/1.4 "Cinzel", Georgia, serif;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #6c757d;
  margin: 14px 0 6px;
}
.prj-empty { color: #6c757d; font-size: 13px; padding: 6px 2px; list-style: none; }
html[data-theme="dark"] .prj-section-title,
html[data-theme="dark"] .prj-empty { color: #9aa3b2; }

/* --- Save/Close toolbar layout (v7.17, Igor's layout) ---
   [Save Project | time | All Projects] on the far left,
   [Close Project + its note] alone on the far right (the group
   is a column: button on top, note under it, right-aligned).
   The save/autosave status takes its own full-width row below,
   so nothing ever sits to the right of Close. */
.prj-toolbar-group--right {
  margin-left: auto;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
}
.prj-close-note {
  font-family: "Lora", Georgia, serif;
  font-size: 11px;
  line-height: 1.4;
  color: #6c757d;
  text-align: right;
}
.prj-close-note[hidden] { display: none; }
.prj-status-wrap { display: flex; gap: 12px; flex-basis: 100%; align-items: center; }
.prj-status-wrap .prj-save-status { margin-left: 0; }
html[data-theme="dark"] .prj-close-note { color: #9aa3b2; }

/* --- v7.19 — customer line + address chips (NO dropdowns) ---
   The CUSTOMER dropdown is gone: a project/document created from
   inside a customer shows "Customer: <name>" as plain text with a
   small Change link; only tapping Change opens the picker (a
   tappable list of customers). The ADDRESS dropdown is gone too:
   the customer's addresses are tappable chips; the selected one
   is navy with white text and a check — exactly the primary
   button colours. One address is picked automatically and just
   shown as text in the address field — no chips at all. The same
   block is in estimate.css and projects.css (the staff-header
   block is shared the same way). */
/* Customer line (Igor, item 6): the name + Change link were
   cramped — a 4px gap and no breathing room around the line.
   The line now reads like the other fields on the form: the
   same underline as the inputs, padding above and below it, and
   a proper gap between the name and the Change link. The same
   block is in estimate.css and projects.css (the staff-header
   block is shared the same way). */
.prj-customer-line, .picker-customer-line, .doc-project-line {
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px 16px;
  font-family: "Lora", Georgia, serif; font-size: 15px; line-height: 1.4;
  color: var(--staff-input-text);
  padding: 8px 2px; border-bottom: 1px solid var(--prj-border);
}
.prj-link-btn {
  appearance: none; background: none; border: none; padding: 6px 8px;
  font-family: "Lora", Georgia, serif; font-size: 14px; font-weight: 700;
  color: var(--staff-input-focus); text-decoration: underline;
  cursor: pointer; border-radius: 6px;
}
.prj-link-btn:focus-visible { outline: 2px solid var(--staff-input-focus); outline-offset: 2px; }
.prj-customer-picker {
  margin-top: 10px; padding: 12px; box-sizing: border-box;
  background: var(--staff-input-bg); border: 1px solid var(--staff-input-border);
  border-radius: 14px; box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
}
.prj-picker-list { display: flex; flex-direction: column; gap: 6px; margin: 0 0 8px; padding: 0; list-style: none; }
.prj-picker-list button {
  display: block; width: 100%; text-align: left;
  font-family: "Lora", Georgia, serif; font-size: 15px; line-height: 1.3;
  color: var(--staff-input-text); background: var(--staff-input-bg);
  border: 1px solid var(--staff-input-border); border-radius: 14px;
  padding: 12px; cursor: pointer;
}
.prj-picker-list button:hover, .prj-picker-list button:focus-visible {
  border-color: var(--staff-input-focus);
  box-shadow: 0 0 0 3px var(--staff-focus-ring);
  outline: none;
}
.prj-picker-list button[aria-pressed="true"] {
  background: #1d2d44; border-color: #1d2d44; color: #fff; font-weight: 700;
}
.prj-picker-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.addr-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 8px; }
.addr-chip {
  appearance: none; cursor: pointer;
  font-family: "Lora", Georgia, serif; font-size: 15px; line-height: 1.3;
  color: var(--staff-input-text); background: var(--staff-input-bg);
  border: 1px solid var(--staff-input-border); border-radius: 999px;
  padding: 8px 14px;
}
.addr-chip:hover, .addr-chip:focus-visible {
  border-color: var(--staff-input-focus); outline: none;
  box-shadow: 0 0 0 3px var(--staff-focus-ring);
}
.addr-chip[aria-pressed="true"] {
  background: #1d2d44; border-color: #1d2d44; color: #fff; font-weight: 700;
}
.prj-address-add { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 4px; }
.prj-address-add input { flex: 1 1 200px; font-family: "Lora", Georgia, serif; font-size: 16px; }
.cust-assign-list { margin: 0 0 12px; }
.cust-assign-empty { font-family: "Lora", Georgia, serif; font-size: 14px; color: var(--staff-input-text); opacity: 0.75; }

/* v8 fix — SEARCHABLE CUSTOMER PICKER (Igor): the picker is a
   proper dropdown panel (not a generic browser dropdown): a
   search input on top, then one row per customer — v23 (item
   43): the TOP BOLD name, the ADDRESS below it (street, city,
   state, ZIP — never the name), and PHONE + EMAIL sharing one
   line below the address — with a check mark (✓) on the
   currently selected customer. Typing filters live on name,
   phone (digits only, so 555 matches (555) 555-5555), email
   and address. "+ New customer" stays at the bottom. Tapping
   outside or Escape closes it. The check mark is the same
   style as the project checklists below: navy, white ✓. */
.cust-picker-search {
  display: block; width: 100%; box-sizing: border-box; margin-bottom: 8px;
  font-family: "Lora", Georgia, serif; font-size: 16px;
  color: var(--staff-input-text); background: var(--staff-input-bg);
  border: 1px solid var(--staff-input-border); border-radius: 14px;
  padding: 5px 12px; min-height: 34px; transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.cust-picker-search:focus { outline: none; border-color: var(--staff-input-focus); box-shadow: 0 0 0 3px var(--staff-focus-ring); }
.cust-picker-search::placeholder { color: var(--staff-input-placeholder); }
.cust-picker-list button { display: flex; gap: 10px; align-items: flex-start; }
.cust-pick-check {
  flex-shrink: 0; width: 20px; text-align: center;
  font-size: 15px; line-height: 1.3; font-weight: 700; color: transparent;
}
.cust-picker-list button[aria-pressed="true"] .cust-pick-check { color: #fff; }
.cust-pick-text { display: block; min-width: 0; }
.cust-pick-name { display: block; font-weight: 700; }
.cust-pick-sub { display: block; font-size: 13px; opacity: 0.8; overflow-wrap: anywhere; }
.cust-pick-contact { display: block; font-size: 13px; opacity: 0.8; overflow-wrap: anywhere; }

/* v8 fix — OPEN BUTTONS (Igor): a small navy/white secondary
   button wherever a document or project number is mentioned
   (the linked lines on a project). Same 28px height as the
   list-row buttons. */
.doc-open-btn {
  appearance: none; cursor: pointer; flex-shrink: 0;
  min-height: 28px; padding: 4px 12px; box-sizing: border-box;
  border-radius: 6px; border: 1px solid #1d2d44; background: #1d2d44; color: #fff;
  font-size: 12px; font-family: "Lora", Georgia, serif; white-space: nowrap;
}
.doc-open-btn:hover { background: #2a3f5e; }
.doc-open-btn:focus-visible { outline: 2px solid #516f9d; outline-offset: 2px; }
html[data-theme="dark"] .doc-open-btn { background: #5b729f; border-color: #5b729f; }
html[data-theme="dark"] .doc-open-btn:hover { background: #4a628f; border-color: #4a628f; }
/* Open buttons inside a linked-estimates/invoices line sit on
   the text baseline with a small gap, and wrap on narrow
   screens. */
.prj-line .doc-open-btn { margin: 2px 6px 2px 0; vertical-align: middle; }

/* v8 Stage 1 — project detail new fields + show-archived toggle. */
.prj-show-archived { display: inline-flex; gap: 6px; align-items: center; font-size: 13px; font-family: "Lora", Georgia, serif; margin: 0 0 8px; }
.prj-show-archived input { width: 16px; height: 16px; accent-color: #1d2d44; }
/* v15 (Igor, item 7) — the project-form Notes textarea is
   always visible at single-field height (22px, like the other
   project-form fields) and grows in place; the min-height is
   the floor, autoGrowNotes sets the height as text grows. */
.prj-field textarea { width: 100%; box-sizing: border-box; padding: 2px 8px; min-height: 22px; border: 1px solid #9fb3c8; border-radius: 4px; font-size: 16px; font-family: "Lora", Georgia, serif; background-color: #fff; color: #1f2d3a; }
.prj-field textarea:focus { outline: 1px dashed #9fb3c8; background: #f7fbff; }
.prj-field select { width: 100%; box-sizing: border-box; padding: 2px 30px 2px 8px; border: 1px solid #9fb3c8; border-radius: 4px; font-size: 16px; font-family: "Lora", Georgia, serif; background-color: #fff; color: #1f2d3a;
  /* v8 fix — background-color, NOT the background shorthand, so
     the chevron from the bare select rule survives (Work type /
     Status rendered with the native arrow before this). */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%231d2d44' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center;
}
html[data-theme="dark"] .prj-field textarea, html[data-theme="dark"] .prj-field select { background-color: #1a1f26; color: #eef1f6; border-color: rgba(255,255,255,.22); }
html[data-theme="dark"] .prj-field textarea:focus { background: #232a36; }

/* ================================================================
   v8 next — confirmed 8-item list (Igor, 2026-11-24): status
   chips, label-above-amount figures, one-row button rows.
   ================================================================ */

/* --- Status chips (item 6, restyled buttons round item 7):
   Paid green, Partial amber, Sent blue, Draft grey — as TINY
   BUTTONS: a small solid-colour pill with white bold text on it.
   The old pastel chips (pale background, coloured text) were
   not visible enough on Igor's phone — they blended into the
   card. These are the same solid colours in BOTH themes, so the
   chip is unmistakable light or dark: white on #137333 is
   5.9:1, on #8a6d00 4.9:1, on #174ea6 7.8:1, on #5f6368 6.0:1 —
   all above the 4.5:1 readable-text bar. (This block is duplicated
   from estimate.css — this file loads after it, so it must match.) --- */
.st-chip {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 22px; padding: 3px 10px; box-sizing: border-box;
  border-radius: 999px;
  font-size: 12px; font-weight: 700; line-height: 1.2;
  font-family: "Lora", Georgia, serif; white-space: nowrap; color: #fff;
}
.st-paid { background: #137333; color: #fff; }
.st-partial { background: #8a6d00; color: #fff; }
.st-sent { background: #174ea6; color: #fff; }
.st-draft { background: #5f6368; color: #fff; }
html[data-theme="dark"] .st-paid { background: #137333; color: #fff; }
html[data-theme="dark"] .st-partial { background: #8a6d00; color: #fff; }
html[data-theme="dark"] .st-sent { background: #174ea6; color: #fff; }
html[data-theme="dark"] .st-draft { background: #5f6368; color: #fff; }
/* v9 (Igor, items 4/6/7/9) — Projects screen: centered "+ New
   Project" where the intro text was; "Download backup" at the
   very bottom of the list; "Show archived" beside the search bar;
   tappable status chips open a small status picker. */
.prj-new-wrap { display: flex; justify-content: center; margin-bottom: 14px; }
.prj-new-wrap .prj-btn { flex: 0 0 auto; }
.prj-bottom-actions { display: flex; justify-content: center; margin-top: 18px; }
.prj-bottom-actions .prj-btn { flex: 0 1 300px; }
/* v23 (item 30, Igor, 2026-11-27) — search bar FULL LENGTH on
   its own row; Sort / Period move to the row BELOW it.
   SUPERSEDES the v13 item 18 stacked layout (search 4fr +
   Sort/Period stacked in 1fr) and the v23 item 22 (2,1,1) fix
   for it.
   v24 (step 5) — HOW THE SPLIT IS COMPUTED NOW: the dropdown
   row (#projFilterRow) is a fixed 2-column grid
   (`grid-template-columns: repeat(2, minmax(0, 1fr))`), so at
   most TWO dropdowns share a row, with no JS counting: Sort +
   Period fill the first row 50/50; a Month / Year / Tax-year
   picker spans the second row full-width (grid-column: 1 / -1
   on its wrap); Custom range puts From + To on the second row
   50/50 (its wrap is `display: contents`, so the two labels
   are grid items in their own right). Hidden wraps
   (display: none) create no cell. This SUPERSEDES the v23
   item-30 equal split (2 → 50/50, 3 → 1/3, 4 → 1/4). The
   search row itself is a one-column grid, so the search wrap
   always spans the full length and the dropdown row sits below
   it, at every width, in both themes (layout is identical;
   only the colours differ).
   SIZES: with two columns the row is ~170px per dropdown at
   402px, so the row controls are 16px Lora like every other
   input (step 2) — the old 11px selects / 10px dates were
   sized for the 4-way split (82.5px per dropdown), which no
   longer exists. The Period option reads "Custom", not
   "Custom range": the From/To fields beside it already say
   what is custom. The decorative calendar icon stays hidden
   in the row (the native picker indicator stays).
   ONE authoritative row rule (1,2,1) restates every property
   the two ID-scoped rules used to drift
   (#projListScreen .prj-filter-field select), so the row
   renders the same on the Customers view (outside the list
   screen) as on the Projects view (inside it). The separate
   (2,1,1) override from item 22 is deleted with the stacked
   layout it fixed. The dark chevron rule below is (1,3,2) on
   purpose — it must outrank this (1,2,1) rule or the navy
   chevron would survive into dark mode. */
.global-search-row { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; align-items: stretch; max-width: 850px; margin: 0 auto 8px; }
.global-search-row .prj-search-wrap { min-width: 0; }
/* v9 fix — #globalSearchWrap { flex: none; width: 100% } (an ID rule)
   used to win over the row's flex rule, so the wrap took the whole
   row and "Show archived" hung off the right edge at phone width. */
.global-search-row #globalSearchWrap { min-width: 0; width: 100%; margin: 0; justify-self: stretch; align-self: stretch; }
.global-show-archived { flex: 0 0 auto; white-space: nowrap; margin: 0; }
.global-show-archived .sa-short { display: none; }
.prj-show-archived[hidden], .global-show-archived[hidden] { display: none; }
@media (max-width: 520px) {
  .global-show-archived .sa-full { display: none; }
  .global-show-archived .sa-short { display: inline; }
  .global-search-row .prj-search-wrap input[type="search"] { font-size: 16px; padding-left: 32px; padding-right: 28px; }
}
/* The dropdown row: one equal grid column per VISIBLE child
   (see the header comment). Hidden while a global search runs
   or on detail / document screens (syncProjFilterRow in
   estimate.js). */
/* v24 (step 5) — at most TWO dropdowns per row: a fixed 2-column
   grid. Sort + Period fill row 1 50/50; a Month / Year / Tax-year
   picker spans row 2 full-width (grid-column: 1 / -1 on its wrap);
   Custom range puts From + To on row 2 50/50 (its wrap is
   display: contents, so the two labels are grid items in their
   own right). SUPERSEDES the v23 item-30 equal split
   (2 -> 50/50, 3 -> 1/3, 4 -> 1/4). */
.global-search-row .prj-filter-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; min-width: 0; }
.global-search-row .prj-filter-row[hidden] { display: none; }
/* Each dropdown is one grid item: the Sort / Period labels
   directly, the Month / Year / Tax-year wraps as a whole, and
   the From / To labels through the range wrap's display:
   contents. Labels are a flex column so the control stretches
   to the row height (the picker labels carry "Month" / "From"
   text above the input while Sort / Period are a bare select)
   and every control fills its column (min-width: 0 so a long
   value can never force its column wider than its share). */
#globalSearchRow .prj-filter-row .prj-filter-field { display: flex; flex-direction: column; min-width: 0; }
#globalSearchRow .prj-filter-row .prj-filter-field select {
  flex: 1 1 auto; width: 100%; min-width: 0; min-height: 34px; box-sizing: border-box;
  margin-top: 0;
  font-family: "Lora", Georgia, serif; font-size: 16px; line-height: 1.2;
  color: var(--staff-input-text); background-color: var(--staff-input-bg);
  border: 1px solid var(--staff-input-border); border-radius: 14px;
  padding: 1px 10px 1px 2px;
  appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%231d2d44' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 2px center; background-size: 8px 6px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
#globalSearchRow .prj-filter-row .prj-filter-field select:focus {
  outline: none; border-color: var(--staff-input-focus);
  box-shadow: 0 0 0 3px var(--staff-focus-ring);
}
/* v7.19 pattern — dark chevron on the row selects. (1,3,2) so it
   outranks the (1,2,1) light rule above (see the header
   comment); it re-declares repeat / position / size too, so the
   dark chevron is self-contained and never depends on the light
   rule surviving some other dark `background:` shorthand (the
   v14 item 5 tiling hazard). */
html[data-theme="dark"] #globalSearchRow .prj-filter-row .prj-filter-field select {
  background-color: var(--staff-input-bg); color: var(--staff-input-text);
  border-color: var(--staff-input-border);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%23d6dff3' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 2px center; background-size: 8px 6px;
}
/* The picker inputs (Month, From, To): same 16px as the selects
   (v24 step 2), tight padding, stretched by the flex-column
   label. No appearance reset — the date/month inputs keep their
   native picker indicators. */
#globalSearchRow .prj-filter-row .prj-filter-field input {
  flex: 1 1 auto; width: 100%; min-width: 0; min-height: 34px; box-sizing: border-box;
  margin-top: 0;
  font-family: "Lora", Georgia, serif; font-size: 16px; line-height: 1.2;
  color: var(--staff-input-text); background-color: var(--staff-input-bg);
  border: 1px solid var(--staff-input-border); border-radius: 14px;
  padding: 1px 4px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
#globalSearchRow .prj-filter-row .prj-filter-field input:focus {
  outline: none; border-color: var(--staff-input-focus);
  box-shadow: 0 0 0 3px var(--staff-focus-ring);
}
/* The From/To date fields: the decorative calendar icon is
   hidden in this row (the native date-picker indicator stays),
   and the input loses its 32px icon padding — the icon and the
   date do not fit side by side in a half-width column. The date
   wrap itself stretches like the other controls. */
.global-search-row .prj-filter-row .prj-date-wrap { display: flex; flex: 1 1 auto; min-width: 0; margin-top: 0; }
/* v24 (step 2) — the date value is 16px like every other input:
   at the old 1/4 split "11/01/2026" + the native picker
   indicator did not fit at 11px (the year lost its last digit
   on the 402px render), so it was 10px; the 2-column grid
   leaves each date ~170px, so 16px fits with room to spare.
   The Month input is 16px too. */
.global-search-row .prj-filter-row .prj-date-wrap input[type="date"] { padding-left: 4px; font-size: 16px; }
.global-search-row .prj-filter-row .prj-date-icon { display: none; }

.st-chip--btn { cursor: pointer; border: none; }
.st-chip--btn:focus-visible { outline: 2px solid #516f9d; outline-offset: 2px; }
.st-status-pop { position: fixed; z-index: 60; min-width: 190px; max-width: 280px; background: #fff; color: #1f2d3a; border: 1px solid #b9c4d6; border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.25); padding: 8px; font-family: "Lora", Georgia, serif; box-sizing: border-box; }
.st-status-pop h3 { margin: 2px 4px 8px; font-size: 12px; text-transform: uppercase; letter-spacing: .5px; color: #555; }
.st-status-pop button.st-status-opt { display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; margin: 0 0 4px; padding: 8px 10px; border-radius: 6px; border: 1px solid transparent; background: transparent; font-size: 13px; cursor: pointer; color: inherit; font-family: "Lora", Georgia, serif; box-sizing: border-box; }
.st-status-pop button.st-status-opt:hover { background: rgba(29,45,68,.08); }
.st-status-pop button.st-status-opt.is-current { font-weight: 700; outline: 2px solid #516f9d; }
.st-status-pop button.st-status-opt.st-status-action { font-weight: 700; color: #1d2d44; }
.st-status-pop .st-status-cancel { display: block; width: 100%; margin-top: 4px; padding: 8px 10px; border-radius: 6px; border: 1px solid #b9c4d6; background: #fff; font-size: 13px; cursor: pointer; color: #1f2d3a; font-family: "Lora", Georgia, serif; }
html[data-theme="dark"] .st-status-pop { background: #161b24; color: #eef1f6; border-color: #3a4356; }
html[data-theme="dark"] .st-status-pop h3 { color: #9aa3b2; }
html[data-theme="dark"] .st-status-pop button.st-status-opt:hover { background: rgba(214,223,243,.12); }
html[data-theme="dark"] .st-status-pop button.st-status-opt.st-status-action { color: #d6dff3; }
html[data-theme="dark"] .st-status-pop .st-status-cancel { background: #161b24; color: #eef1f6; border-color: #3a4356; }


/* --- Label-above-amount figures (item 4): one figure per
   column, label on top of its dollar amount, above the bottom
   buttons. --- */
.prj-figures { display: flex; flex-wrap: wrap; gap: 6px 22px; flex-basis: 100%; }

/* --- v8 one-page (Igor, step 3): associated documents row ---
   Below the project number + customer name, the project's
   estimates and invoices as chips: number + a coloured status
   chip WITH the status text inside it (the .st-chip colours:
   Paid green, Partial amber, Sent blue, Draft grey). Each chip
   is a button that opens its document. The chip button itself
   is plain (transparent, bordered) — the colour lives in the
   status chip, not the button — so it never inherits the navy
   .prj-list button style. */
.prj-box-docs { display: flex; flex-wrap: wrap; gap: 6px 8px; flex-basis: 100%; align-items: center; }
.prj-box-docs-empty { color: #555; font-size: 12px; }
.prj-list .prj-box-docs button.prj-doc-chip {
  display: inline-flex; align-items: center; gap: 6px; flex: 0 1 auto;
  min-height: 26px; padding: 2px 8px; font-size: 12px; font-weight: 600;
  background: transparent; color: var(--prj-ink);
  border: 1px solid var(--prj-border); border-radius: 6px; cursor: pointer;
  box-sizing: border-box; max-width: 100%;
  /* v8 one-page 402px fix: no nowrap — a long status ("Converted to
     invoice INV-…") must wrap inside the chip instead of pushing
     the chip past the box edge (428px wide at a 402px viewport). */
}
.prj-list .prj-box-docs button.prj-doc-chip .st-chip { white-space: normal; text-align: left; }
.prj-list .prj-box-docs button.prj-doc-chip:hover { background: rgba(29, 45, 68, 0.06); border-color: var(--prj-border); }
.prj-doc-chip-no { overflow-wrap: anywhere; }
html[data-theme="dark"] .prj-box-docs-empty { color: #9aa3b2; }
html[data-theme="dark"] .prj-list .prj-box-docs button.prj-doc-chip { color: #eef1f6; }
html[data-theme="dark"] .prj-list .prj-box-docs button.prj-doc-chip:hover { background: rgba(214, 223, 243, 0.12); }
.prj-figure { display: flex; flex-direction: column; gap: 1px; }
.prj-figure-label { font-size: 11px; font-weight: bold; text-transform: uppercase; letter-spacing: .5px; color: #555; line-height: 1.2; }
.prj-figure-value { font-weight: bold; font-size: 14px; color: var(--prj-ink); line-height: 1.2; }
html[data-theme="dark"] .prj-figure-label { color: #c0c7d6; }
html[data-theme="dark"] .prj-figure-value { color: #eef1f6; }

/* --- Bottom button row (item 3): Download / Close project /
   Archive / Delete — all the same compact 28px size as Open
   (.prj-list button already is 28px; the Download link is
   pulled down from the 38px .prj-btn size), one row, centered.
   The two-row close note sits centered under the row while the
   project is open. --- */
.prj-box-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; flex-basis: 100%; margin-top: 2px; }
/* Buttons round (Igor, 2026-11-24): the four bottom buttons
   share the row equally — same width even when the labels
   differ. */
.prj-box-actions .prj-btn, .prj-box-actions button { flex: 1 1 0; min-width: 0; }
.prj-box-actions .prj-btn { min-height: 28px; padding: 5px 12px; font-size: 12.5px; }
.prj-box-close-note { flex-basis: 100%; text-align: center; }
html[data-theme="dark"] .prj-box-close-note { color: #9aa3b2; }

/* --- Top toolbar, one row (item 2): "+ New Project",
   "Open G-drive" and "Download backup" never wrap — one row,
   same size. On a phone they share the row equally. --- */
.prj-actions { flex-wrap: nowrap; }
@media (max-width: 520px) {
  .prj-actions { gap: 8px; }
  /* Toolbar labels must not clip: at 402px the three equal buttons
     are 94px each and "Download backup" is ~86px at 12px — 2px too
     wide even at 4px padding. 11px (the size already used for
     these buttons at <=360px) fits with room. */
  .prj-actions .prj-btn { flex: 1 1 0; min-width: 0; padding: 9px 4px; font-size: 11px; }
  /* Four bottom buttons fit one row at 402px: nowrap (never wrap
     Delete onto a second row) with a 2px gap — and equal widths.
     v22 (item 6): the labels grew ("Download Project" /
     "Archive Project"), so the side padding drops to 1px; at
     10px the longest label ("Download Project", ~84px) fits its
     equal share (~87px) without clipping. Same 28px height. */
  .prj-box-actions { flex-wrap: nowrap; gap: 2px; }
  .prj-box-actions button, .prj-box-actions .prj-btn { padding: 5px 1px; font-size: 10px; }
}
@media (max-width: 360px) {
  .prj-actions .prj-btn { padding: 9px 4px; font-size: 11px; }
}

/* ================= v10 (Igor, items 11–25, 2026-11-25) ================= */
/* 12. Header title, centered, Cinzel (loaded in estimate.html).
   v23 (item 28 refinement, Igor, 2026-11-27): the "ApexPro
   Dashboard" text is gone — this now shows the current PAGE
   title ("Projects" / "Customers", set by showStartPanel),
   so the title appears once, in the header.
   v23 (item 29, Igor, 2026-11-27): the title is a BUTTON that
   opens the burger menu on tap (same toggle as the ☰). The
   button reset below (transparent background, no border, no
   padding) keeps the centered Cinzel look exactly as before;
   only cursor: pointer + the hover underline + the focus ring
   say it is tappable. Same colours in both modes: white text
   on the navy header, like the burger. */
.staff-header-title { font-family: "Cinzel", Georgia, serif; font-weight: 600; color: #fff; text-align: center; flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 17px; letter-spacing: .04em; background: transparent; border: 1px solid transparent; border-radius: 6px; padding: 2px 8px; box-sizing: border-box; cursor: pointer; }
/* v24 (item 15) — the title reads as a clickable button: a
   border appears on hover / tap / while the menu is open
   (aria-expanded, set by the drawer toggle). The border is
   transparent in the resting state and the box is border-box,
   so it appears without shifting anything. Same navy header in
   both modes, so one border colour serves both. */
.staff-header-title:hover, .staff-header-title:active, .staff-header-title[aria-expanded="true"] { border-color: rgba(214, 223, 243, 0.55); }
/* v24 (step 4) — no underline on the title any more: the small ▾
   after the text is the only cue that it opens the menu. */
.staff-header-title::after { content: "▾"; font-size: 11px; margin-left: 6px; }
.staff-header-title:focus-visible { outline: 2px solid #516f9d; outline-offset: 2px; }
.staff-header-inner { align-items: center; }
@media (max-width: 480px) { .staff-header-title { font-size: 14px; letter-spacing: .02em; } }
/* 13. Back/Forward (v13, Igor item 3) — REMOVED in v23 item 26
   (Igor, 2026-11-27): the row and its buttons are eliminated. */
/* 14. "+ New Project" as wide as the box below it (the search bar). */
.prj-new-wrap .prj-btn { width: 100%; box-sizing: border-box; }
/* 11. Three collapsible project categories. */
.prj-cat-head { display: flex; align-items: center; gap: 8px; width: 100%; background: none; border: none; padding: 8px 0 4px; cursor: pointer; font: inherit; color: inherit; text-align: left; }
.prj-cat-title { font-size: 15px; font-weight: 700; }
.prj-cat-count { font-size: 12px; color: #666; }
html[data-theme="dark"] .prj-cat-count { color: #9aa3b2; }
.prj-cat-arrow { margin-left: auto; font-size: 13px; }
/* 15. Project rows: PRJ left, status right; figures centered. */
.prj-box-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; flex-basis: 100%; }
/* v11 (Igor, item 3) — the PRJ number in a project ROW is the
   SAME SIZE as the customer name in that row (13px,
   .prj-box-cust). It was font:inherit (the card's larger size). */
.prj-id-btn { background: none; border: none; padding: 0; font: inherit; font-size: 13px; font-weight: 700; color: #1d2d44; cursor: pointer; text-align: left; }
html[data-theme="dark"] .prj-id-btn { color: #dfe6f2; }
.prj-box-cust { flex-basis: 100%; font-size: 13px; }
.prj-box-addr { flex-basis: 100%; font-size: 13px; color: #555; white-space: pre-line; }
html[data-theme="dark"] .prj-box-addr { color: #9aa3b2; }
.prj-figures { justify-content: center; }
.prj-figure { text-align: center; }
/* 23. Status date stamp: half the size of the status text. */
.st-chip { display: inline-flex; flex-direction: column; align-items: center; line-height: 1.25; }
.st-chip-date { font-size: 12px; line-height: 1.2; font-weight: 400; opacity: .92; }
/* v23 (item 6, probe-caught) — the POB bar matches the section bar
   height: above phone width the BAR chip is ONE line and compact
   (status + date side by side, date at the 12px stamp floor), so
   the bar is 6px padding + ~16px content = the section bar's
   28px. The two-line chip (date under the status) lives ONLY at
   phone width — the <=480px rule below restores the column there,
   where the 44px bars keep both heights equal. History / doc
   chips keep the two-line column everywhere: this rule touches
   the bar chip only. */
.prj-list .prj-ws-ov-bar-chip { flex-direction: row; align-items: center; gap: 6px; min-height: 0; padding: 1px 10px; line-height: 1.2; }
.prj-list .prj-ws-ov-bar-chip .st-chip-date { font-size: 12px; }
/* 18. Date fields (and every other detail field) fit inside the
   form at phone width: grid children keep no intrinsic minimum,
   inputs never exceed their container. */
/* v11 (Igor, item 1) — the v10 version of this rule did not hold
   live (see the note above .prj-grid2): the track itself is now
   minmax(0, 1fr), and the date inputs are block-level so no
   inline sizing quirk can widen them either. */
#projDetail .prj-fields, #projDetail .prj-field, #projDetail .prj-grid2, #projDetail .prj-grid2 > .prj-field { min-width: 0; }
#projDetail input, #projDetail select, #projDetail textarea { width: 100%; max-width: 100%; min-width: 0; box-sizing: border-box; }
#projDetail input[type="date"] { min-width: 0; width: 100%; max-width: 100%; display: block; }
.prj-detail-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
/* v11 (Igor, item 3) — the PRJ number is the SAME SIZE as the
   customer name below it (15px, .prj-cust-name). The big title
   size is gone from the project form header. */
.prj-detail-head h1 { text-align: left; margin: 0; min-width: 0; font-size: 15px; }
.prj-detail-head .prj-status-line { margin: 0; flex-shrink: 0; }
.prj-cust-head { text-align: left; margin: 4px 0 8px; }
/* v15 (Igor, item 5) — the "change customer" button sits RIGHT
   OF THE NAME on the same row. Its height is the CAP HEIGHT of
   the name's 15px font (15px × ~0.72 ≈ 11px), so the button is
   11px tall with 9px text — small by design, exactly as asked. */
.prj-cust-name-row { display: flex; align-items: center; gap: 8px; }
.prj-cust-name { font-weight: 600; font-size: 15px; flex: 0 1 auto; min-width: 0; }
#projCustomerChangeBtn.prj-change-cust-btn { flex: 0 0 auto; height: 11px; min-height: 0; padding: 0 5px; font-size: 9px; line-height: 1; }
.prj-cust-addr { font-size: 13px; white-space: pre-line; }
/* 20. Notes row INSIDE A BORDER, small square PLUS button next to
   "Notes" (like the Forward button, with a plus instead of an
   arrow). The notes field is the same size as the address field. */
/* v15 (Igor, item 7) — the Notes "+" toggle is GONE (the
   field is always visible and grows in place), so the toggle
   rules are deleted too. The label row keeps its border. */
.notes-label-row { border: 1px solid #c9d2de; border-radius: 10px; padding: 6px 8px; }
html[data-theme="dark"] .notes-label-row { border-color: rgba(255, 255, 255, 0.28); }
/* 21. "Same as billing" — clean empty box in both modes (Apex
   site style: navy border, transparent unchecked background;
   site-blue fill + white check when checked). No generic
   browser checkbox look. */
.prj-check { display: inline-flex; align-items: center; gap: 8px; }
.prj-check input[type="checkbox"] { appearance: none; -webkit-appearance: none; width: 20px; height: 20px; min-width: 20px; margin: 0; padding: 0; border: 2px solid #1d2d44; border-radius: 4px; background: transparent; background-color: transparent; cursor: pointer; box-sizing: border-box; }
html[data-theme="dark"] .prj-check input[type="checkbox"] { border-color: #c9d2de; background: transparent; background-color: transparent; }
.prj-check input[type="checkbox"]:checked { background-color: #2f6fed; border-color: #2f6fed; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3 8.5l3.2 3L13 4.5' fill='none' stroke='white' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: center; background-size: 14px 14px; }
/* 15. USPS address inputs: Name / Street / City + ST + ZIP row. */
.usps-block { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.usps-block input { width: 100%; min-width: 0; box-sizing: border-box; }
.usps-city-row { display: flex; gap: 8px; min-width: 0; }
.usps-city-row input:nth-child(1) { flex: 3 1 0; }
.usps-city-row input:nth-child(2) { flex: 1 1 0; text-transform: uppercase; }
.usps-city-row input:nth-child(3) { flex: 1.4 1 0; }
/* 23. Estimate rows: number left (+ amount under it, half size),
   status right; check box = linked/unlinked. */
.prj-linked-row { display: flex; align-items: flex-start; gap: 8px; padding: 8px 0; border-bottom: 1px solid #eee; }
html[data-theme="dark"] .prj-linked-row { border-bottom-color: rgba(255, 255, 255, 0.08); }
.prj-linked-left { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; }
.prj-linked-num { background: none; border: none; padding: 0; font: inherit; font-weight: 700; color: #1d2d44; cursor: pointer; text-align: left; }
html[data-theme="dark"] .prj-linked-num { color: #dfe6f2; }
.est-amt { font-size: 0.5em; line-height: 1.3; color: #555; }
html[data-theme="dark"] .est-amt { color: #9aa3b2; }
.prj-link-check { appearance: none; -webkit-appearance: none; width: 20px; height: 20px; min-width: 20px; margin: 2px 0 0; padding: 0; border: 2px solid #1d2d44; border-radius: 4px; background: transparent; cursor: pointer; box-sizing: border-box; flex-shrink: 0; }
html[data-theme="dark"] .prj-link-check { border-color: #c9d2de; }
.prj-link-check:checked { background-color: #1d2d44; border-color: #1d2d44; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3 8.5l3.2 3L13 4.5' fill='none' stroke='white' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: center; background-size: 14px 14px; }
html[data-theme="dark"] .prj-link-check:checked { background-color: #2f6fed; border-color: #2f6fed; }
/* 24/25. Step-by-step sections: a filled section shows as a
   summary line (tap to expand and edit); an empty section stays
   hidden until its button opens it. */
.prj-step-trigger { margin: 10px 0; }
.prj-step-trigger .prj-btn { width: 100%; box-sizing: border-box; }
.prj-step-summary { cursor: pointer; font-size: 13px; color: #1d2d44; background: rgba(29, 45, 68, 0.06); border: 1px solid #c9d2de; border-radius: 10px; padding: 8px 10px; margin: 6px 0; }
html[data-theme="dark"] .prj-step-summary { color: #dfe6f2; background: rgba(214, 223, 243, 0.08); border-color: rgba(255, 255, 255, 0.2); }
.prj-step.collapsed .prj-step-body { display: none; }
/* v11 (Igor, item 2) — ALL section names are ALIGNED CENTER and
   have a BUTTON-LIKE BORDER: the 8 step headings on the project
   form, the History heading, and the customer form's section
   headings. Same border language as the Notes row (1px, 10px
   radius, site tokens), light and dark. The text, size and
   fonts are untouched — only the alignment and the border. */
#projDetail section.prj-step > h2,
#projDetail section[aria-label="Project history"] > h2,
#customerDetail h2 {
  text-align: center;
  border: 1px solid #c9d2de;
  border-radius: 10px;
  padding: 8px 10px;
  margin: 6px 0 10px;
}
html[data-theme="dark"] #projDetail section.prj-step > h2,
html[data-theme="dark"] #projDetail section[aria-label="Project history"] > h2,
html[data-theme="dark"] #customerDetail h2 { border-color: rgba(255, 255, 255, 0.28); }
#genInvPicker { margin-top: 8px; padding: 10px; border: 1px solid #c9d2de; border-radius: 10px; }
/* 26. Customers screen rework (v13, Igor item 2): name LEFT,
   address under it left-aligned, phone = Google Voice call
   link, per-customer totals on top of the expanded box, grouped
   PRJ / EST / INV list (newest project first, its docs
   indented below it). The head layout (.cust-box-head: a
   column, one child per line, so the name can never sit next
   to the address) lives in estimate.css — that is where the
   live "Elina Ava 352 Burton Ave…" bug was fixed, in one
   place only. */
.cust-head-main { display: flex; align-items: flex-start; gap: 8px; }
/* The name button must NOT take the navy .est-saved-list button
   background: that generic rule (estimate.css) beats the plain
   .cust-name-btn rule on specificity, so the name sat dark-on-
   dark in light mode. The more specific selector below wins,
   and the name reads as plain dark text on the white box.
   v13 fix (probe) — the same generic rule also beat
   .cust-name-btn on PADDING (5px 12px), FONT (12.5px Lora)
   and MIN-HEIGHT (28px), so the name sat 13px right of the
   address line below it: the probe caught the name 13px right.
   The override below neutralises all of it, so the name's left
   edge lines up with the address's left edge.
   v14 (Igor, item 18) — the header bar: on hover / after a tap
   the generic :hover rule paints this button's background
   (#324357 light, #4a628f dark) across the whole row — the
   "blue bar". Two geometry fixes, resting state unchanged:
   (a) min-height 28px, the same as the Open button beside it,
   so the bar is exactly as tall as Open; align-items center so
   the name + ▼ sit centred in that height. (b) The bar's left
   edge is pulled 8px left of the text (margin-left -8px, and
   padding-left 8px to match): the first letter sits 8px inside
   the bar instead of flush on its edge, while the TEXT itself
   stays exactly where it was — flush with the address line
   below, so the v13 alignment still holds. CAREFUL — the
   geometry (margin-left -8px, padding-left 8px) MUST live in
   the .est-saved-list button.cust-name-btn override below, NOT
   in the plain .cust-name-btn rule: the override's specificity
   (0,2,1) beats the plain rule (0,1,0), so a "padding: 0" here
   would silently win and push the text 8px LEFT of the address
   line (probe: nameLeft 32 vs addrLeft 40). The plain rule
   keeps margin/padding 0; the override carries the -8px/+8px. */
.est-saved-list button.cust-name-btn { background: transparent; color: inherit; margin: 0 0 0 -8px; padding: 0 0 0 8px; border: none; font: inherit; min-height: 28px; }
.cust-name-btn { flex: 1 1 auto; min-width: 0; margin: 0; padding: 0; border: none; font: inherit; cursor: pointer; text-align: left; display: flex; align-items: center; justify-content: flex-start; gap: 6px; }
.cust-name-btn .cust-name { flex: 0 1 auto; min-width: 0; text-align: left; }
.cust-expand-arrow { font-size: 10px; color: #555; flex: 0 0 auto; }
html[data-theme="dark"] .cust-expand-arrow { color: #9aa3b2; }
.cust-addr-row { text-align: left; color: #555; font-size: 13px; overflow-wrap: anywhere; }
html[data-theme="dark"] .cust-addr-row { color: #c0c7d6; }
.cust-box-head .cust-contact { align-items: flex-start; }
/* v24 (item 13) — the Customers-list phone shares the contact
   block's one secondary style (see .cust-contact .cust-phone /
   .cust-email in estimate.css): no dotted underline any more,
   the tap action stays. */
a.cust-phone { cursor: pointer; }
a.cust-phone:hover { color: var(--est-ink); }
html[data-theme="dark"] a.cust-phone { color: #c0c7d6; }
html[data-theme="dark"] a.cust-phone:hover { color: #eef1f6; }
/* Per-customer totals at the top of the expanded box: centered,
   in their own line, reusing the page-bottom .cust-total
   figures (label above amount, dark-mode amount fix included). */
.cust-box-totals { display: flex; flex-wrap: wrap; gap: 8px 28px; justify-content: center; margin: 8px 0 2px; padding-top: 8px; border-top: 1px solid var(--est-border); }
html[data-theme="dark"] .cust-box-totals { border-top-color: rgba(255, 255, 255, 0.14); }
/* Grouped docs in the expanded box: PRJ number left in its
   line; its EST / INV rows indented a little to the right. */
.cust-box-doc--sub { margin-left: 16px; }
/* Totals footer: label above amount, centered like the other figures. */
.cust-totals { display: flex; flex-wrap: wrap; gap: 8px 28px; justify-content: center; margin: 18px 0 6px; padding-top: 12px; border-top: 1px solid var(--est-border); }
.cust-total { display: flex; flex-direction: column; align-items: center; text-align: center; min-width: 0; }
.cust-total-label { font-size: 11px; text-transform: uppercase; letter-spacing: .4px; color: #555; }
html[data-theme="dark"] .cust-total-label { color: #9aa3b2; }
.cust-total-amount { font-size: 16px; color: var(--est-ink); }
/* v13 (Igor, item 15) — the $ amounts were dark-on-dark in dark
   mode: --est-ink is a dark navy in both themes and the amount
   had no dark override (only the label did). Same fix applies to
   the per-customer totals in an expanded box (item 2), which
   reuse .cust-total-amount. */
html[data-theme="dark"] .cust-total-amount { color: #eef1f6; }
/* 27. "New project" dialog: the four buttons (New customer /
   Returning customer / Back to projects / Cancel) form one
   centered 2x2 matrix, all the SAME SIZE. The two rows share
   one grid geometry (equal 1fr columns, 8px gap, capped width,
   centered), so row 1 (New / Returning) sits exactly over row 2
   (Back / Cancel). Colours are untouched: primary dark navy for
   New / Returning, secondary white/outline for Back / Cancel. */
.est-start-actions.est-actions--equal.picker-choice-row,
.est-picker-actions.picker-choice-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; max-width: 560px; margin-left: auto; margin-right: auto; }
.est-start-actions.est-actions--equal.picker-choice-row .est-btn,
.est-picker-actions.picker-choice-actions .est-btn { flex: none; width: 100%; max-width: none; min-width: 0; margin: 0; }
@media (max-width: 520px) {
  .est-start-actions.est-actions--equal.picker-choice-row .est-btn,
  .est-picker-actions.picker-choice-actions .est-btn { padding: 9px 6px; font-size: 11px; }
}

/* v16 (Igor, item 2) — the "project address the same as billing
   address" caption MATCHES the PROJECT ADDRESS label's font size
   (same size, 1em — the row and the label are both 11px, so 1em =
   11px). This SUPERSEDES the v15 item 2 rule (0.75em). The 0.75em
   rule itself lives in estimate.css (the other v16 worker's
   file); this file loads after it in estimate.html, so this 1em
   rule wins. Same size in both themes — no theme override. */
.picker-same-text { font-size: 1em; }
/* v16 (Igor, items 3-4) — new-customer popup rows, built at
   runtime by restructureNewCustomerPopup() in projects.js (the
   popup markup lives in estimate.html and is not edited here).
   (3) PHONE + EMAIL share one row, side by side, like the city /
   ST / ZIP row — one row at every width, same 12px gap as the
   other popup rows. (4) NAME (75%) + SOURCE (25%) share one row.
   The row wrappers carry the 12px bottom spacing; the fields
   inside drop their own margin so the spacing is not doubled.
   min-width: 0 on both levels is the grid-blowout guard (same
   pattern as .picker-dates), so the narrow SOURCE select and the
   phone input cannot push past the picker edge. Layout is
   identical in light and dark mode — colours only. */
.picker-nc-row, .picker-nc-namerow { display: grid; gap: 12px; min-width: 0; margin-bottom: 12px; }
.picker-nc-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.picker-nc-namerow { grid-template-columns: minmax(0, 3fr) minmax(0, 1fr); }
.picker-nc-row > .picker-field, .picker-nc-namerow > .picker-field { margin-bottom: 0; min-width: 0; }

/* ================= v18 (item 5) — project workspace in the list =================
   The expanded project row grows a workspace below the figures
   row: Overview, Estimate, Invoice, Payments + Expenses. Same
   layout in light and dark mode — only the corresponding colours
   change (the POB bar keeps its lighter blue and the section
   bars their navy in both themes, with white text on both — see
   the v22 bar swap below). At phone width the Overview body
   stacks, like the doc page's. */
.prj-ws { flex-basis: 100%; min-width: 0; display: flex; flex-direction: column; gap: 10px; }
/* v20 (items 1–2) — the POB: the navy bar IS the box now, so the
   workspace no longer needs its top border (it separated the
   workspace from the old header, which is gone). .prj-pob is the
   contracted POB (same top, no sections); .prj-pob-top holds the
   Overview, identical in both states. v22 (items 1–2): the
   figures row left the top for Project Details, so there is no
   figures band here any more. */
.prj-pob { flex-basis: 100%; min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.prj-pob-top { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
/* v20 (item 5) — the editor embedded in a POB section: its own
   Overview box is hidden (the POB already shows the navy bar);
   the inline host takes no space until the editor moves in. */
.doc-embedded #projOverviewBox { display: none; }
.prj-ws-inline-doc:empty { display: none; }
.prj-ws-sec { border: 1px solid var(--prj-border); border-radius: 6px; padding: 0; min-width: 0; box-sizing: border-box; }
.prj-ws-sec-title { font-family: "Cinzel", Georgia, serif; font-weight: 600; font-size: 14px; text-align: center; color: var(--prj-ink); margin-bottom: 6px; }
.prj-ws-subhead { font-size: 12px; font-weight: bold; text-transform: uppercase; letter-spacing: .5px; color: var(--prj-ink); margin: 8px 0 2px; }
.prj-ws-subhead:first-of-type { margin-top: 0; }
.prj-ws-note { font-size: 12px; color: #555; margin: 2px 0; }
.prj-ws-note:empty { display: none; }
/* v22 (items 1–3, BAR SWAP): the POB bar takes the section
   bars' old look — LIGHTER BLUE #5b729f — with WHITE text in
   BOTH modes (white on #5b729f is ~4.8:1, readable in light
   mode too). v23 (item 6) — the POB bar is the SAME HEIGHT as
   the section bars now: 6px padding, like .prj-ws-sec-head
   below (was 12px in v22). The .prj-list selector is what wins
   over the generic .prj-list button rule (navy) below. */
.prj-ws-ov { border: 1px solid var(--prj-border); border-radius: 6px; overflow: hidden; min-width: 0; }
.prj-list .prj-ws-ov-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; width: 100%; box-sizing: border-box; padding: 6px 12px; background: #5b729f; color: #fff; border: none; border-radius: 0; cursor: pointer; font-family: "Lora", Georgia, serif; font-size: 13px; font-weight: bold; text-align: left; appearance: none; -webkit-appearance: none; }
.prj-list .prj-ws-ov-bar:hover { background: #4a628f; }
.prj-ws-ov-bar:focus-visible { outline: 2px solid #516f9d; outline-offset: -2px; }
.prj-ws-ov-prj { flex-shrink: 0; white-space: nowrap; }
.prj-ws-ov-name { font-weight: 700; font-size: 13px; overflow-wrap: anywhere; color: var(--prj-ink); }
.prj-ws-ov-body { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; padding: 10px 12px; }
.prj-ws-ov-col { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.prj-ws-ov-col--left { align-items: flex-start; }
.prj-ws-ov-col--right { align-items: flex-end; text-align: right; margin-left: auto; }
/* v23 (item 20) — status history reads LEFT TO RIGHT, wrapping
   TOP TO BOTTOM (not a vertical stack). */
.prj-ws-ov-history { display: flex; flex-direction: row; flex-wrap: wrap; gap: 4px; align-items: flex-start; }
.prj-ws-ov-history .st-chip { text-align: center; }
/* v24 (item 13) — the contact block shares ONE secondary style:
   phone, email and address are the same size, weight and colour
   (subdued next to the bold name). The tap actions stay; only
   the look is one style. The .prj-list scope beats the base
   .prj-list button rule that painted the phone navy and the
   email a dark pill with a blue outline. */
.prj-list .prj-ws-ov-phone, .prj-list .prj-ws-ov-email, .prj-list .prj-ws-ov-street, .prj-list .prj-ws-ov-rest { background: none; border: none; padding: 0; font-family: "Lora", Georgia, serif; font-size: 13px; font-weight: 400; color: #555; text-decoration: none; text-align: left; overflow-wrap: anywhere; }
.prj-list .prj-ws-ov-phone, .prj-list .prj-ws-ov-email { cursor: pointer; }
.prj-ws-ov-compose { border-top: 1px solid var(--prj-border); padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; }
.prj-ws-ov-compose input, .prj-ws-ov-compose textarea { width: 100%; box-sizing: border-box; font-family: "Lora", Georgia, serif; font-size: 16px; padding: 4px 8px; border: 1px solid var(--prj-border); border-radius: 6px; background: #fff; color: var(--prj-ink); min-width: 0; }
.prj-ws-ov-compose textarea { resize: vertical; min-height: 54px; }
.prj-ws-ov-compose-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.prj-ws-ov-compose-status { font-size: 12.5px; color: #555; }
.prj-ws-ov-compose-status:empty { display: none; }
/* Minimized doc bars — "Estimate - $XXX" / "Invoice - $XXX"
   with the date-time, centered; the chevron at the right
   expands/contracts the read-only summary. */
.prj-ws-barwrap { margin-bottom: 6px; }
.prj-ws-barwrap:last-child { margin-bottom: 0; }
.prj-ws-bar { display: flex; align-items: stretch; gap: 6px; }
.prj-ws-bar-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 7px 10px; border: 1px solid var(--prj-border); border-radius: 6px; background: rgba(29, 45, 68, .04); color: var(--prj-ink); cursor: pointer; font-family: "Lora", Georgia, serif; font-size: 13px; box-sizing: border-box; }
.prj-ws-bar-main:hover { background: rgba(29, 45, 68, .08); }
.prj-ws-bar-title { font-weight: 700; }
.prj-ws-bar-date { font-size: 12px; color: #555; }
.prj-ws-bar-chev { flex: 0 0 auto; width: 34px; border: 1px solid var(--prj-border); border-radius: 6px; background: transparent; color: var(--prj-ink); cursor: pointer; font-size: 13px; box-sizing: border-box; }
.prj-ws-bar-chev:hover { background: rgba(29, 45, 68, .06); }
.prj-ws-bar-detail { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; padding: 8px 2px 2px; font-size: 12.5px; }
.prj-ws-bar-detail .secondary { margin-left: auto; }
.prj-ws-locked { color: #555; font-size: 12px; }
/* Payments + expenses forms and lists. */
.prj-ws-form { display: flex; flex-wrap: wrap; gap: 6px; align-items: flex-end; margin-top: 6px; }
.prj-ws-form .secondary { flex: 0 0 auto; }
.prj-ws-field { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.prj-ws-field label { font-size: 11px; font-weight: bold; color: var(--prj-ink); text-transform: uppercase; letter-spacing: .5px; }
.prj-ws-form input, .prj-ws-form select { min-width: 0; width: 100%; padding: 5px 6px; font-size: 16px; font-family: "Lora", Georgia, serif; border: 1px solid var(--prj-border); border-radius: 4px; background: #fff; color: var(--prj-ink); box-sizing: border-box; }
.prj-ws-field--amt { flex: 0 1 90px; }
.prj-ws-field--date { flex: 0 1 140px; }
.prj-ws-field--method { flex: 0 1 110px; }
.prj-ws-field--cat { flex: 0 1 130px; }
.prj-ws-field--ref { flex: 1 1 120px; }
.prj-ws-field--vendor { flex: 1 1 110px; }
.prj-ws-field--desc { flex: 1 1 140px; }
.prj-ws-list { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.prj-ws-list li { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; border: 1px solid var(--prj-border); border-radius: 6px; padding: 6px 8px; margin-bottom: 0; font-size: 12.5px; }
.prj-ws-entry-main { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.prj-ws-entry-amount { font-weight: 700; white-space: nowrap; }
.prj-ws-list .secondary { padding: 3px 8px; font-size: 12px; min-height: 24px; }
.prj-ws-empty { color: #555; font-size: 12px; border: none !important; padding: 2px 0 !important; }
/* v24 (item 7) — the receipt photo input is visually hidden but
   NOT display:none, so the "Take receipt photo" button can still
   open the camera/file picker with .click(). */
.prj-ws-receipt-input { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; }
@media (max-width: 520px) {
  .prj-ws-ov-body { flex-direction: column; }
  .prj-ws-ov-col--right { align-items: flex-start; text-align: left; margin-left: 0; }
  .prj-ws-bar-detail .secondary { margin-left: 0; }
}
/* Dark mode — corresponding colours only. The .prj-list button
   rules would otherwise paint every workspace button navy, so
   the bar / chevron / email buttons are restated here. */
html[data-theme="dark"] .prj-ws-sec-title, html[data-theme="dark"] .prj-ws-subhead { color: #eef1f6; }
html[data-theme="dark"] .prj-ws-note, html[data-theme="dark"] .prj-ws-empty, html[data-theme="dark"] .prj-ws-locked, html[data-theme="dark"] .prj-ws-bar-date, html[data-theme="dark"] .prj-ws-ov-compose-status { color: #c0c7d6; }
/* v22 (item 3) — the POB bar keeps the SAME lighter blue + white
   text in dark mode too (not the generic navy button rule). */
html[data-theme="dark"] .prj-list .prj-ws-ov-bar { background: #5b729f; color: #fff; border-color: #5b729f; }
html[data-theme="dark"] .prj-list .prj-ws-ov-bar:hover { background: #4a628f; }
/* v23 (item 8) — field titles visible in DARK mode: the root
   cause was .prj-ws-field label using var(--prj-ink) (a static
   dark #1f2d3a) with no dark override, so every Details /
   Payments / Expenses / Accounting label was invisible on the
   dark surface. The same defect lived on the overview name /
   street / rest (explicit ink now, light in dark) and on the
   filter-bar labels above the sort / period / month / year /
   range fields. Per-selector overrides, the file's own
   pattern — the variable itself is NOT redefined in dark mode,
   so nothing else moves. */
html[data-theme="dark"] .prj-ws-field label { color: #eef1f6; }
html[data-theme="dark"] .prj-ws-ov-name { color: #eef1f6; }
html[data-theme="dark"] .prj-filter-field { color: #eef1f6; }
/* v24 (item 13) — the contact block's shared secondary style in
   dark mode: one colour for phone, email and address. The
   background/border reset matters: the dark base button rule
   would otherwise paint the phone/email buttons #5b729f. */
html[data-theme="dark"] .prj-list .prj-ws-ov-phone, html[data-theme="dark"] .prj-list .prj-ws-ov-email, html[data-theme="dark"] .prj-list .prj-ws-ov-street, html[data-theme="dark"] .prj-list .prj-ws-ov-rest { color: #c0c7d6; background: none; border: none; }
html[data-theme="dark"] .prj-ws-ov-compose { border-top-color: rgba(255, 255, 255, .14); }
html[data-theme="dark"] .prj-ws-ov-compose input, html[data-theme="dark"] .prj-ws-ov-compose textarea, html[data-theme="dark"] .prj-ws-form input, html[data-theme="dark"] .prj-ws-form select { background: #161b24; color: #eef1f6; border-color: rgba(255, 255, 255, .22); color-scheme: dark; }
html[data-theme="dark"] .prj-list .prj-ws-bar-main { background: rgba(214, 223, 243, .08); color: #eef1f6; border-color: rgba(255, 255, 255, .22); }
html[data-theme="dark"] .prj-list .prj-ws-bar-main:hover { background: rgba(214, 223, 243, .14); }
html[data-theme="dark"] .prj-list .prj-ws-bar-chev { background: transparent; color: #eef1f6; border-color: rgba(255, 255, 255, .22); }
html[data-theme="dark"] .prj-list .prj-ws-bar-chev:hover { background: rgba(214, 223, 243, .12); }
/* v19 — POB child-section headers (Project Details, Estimate,
   Invoice, Payments, Expenses, Accounting): a full-width button,
   Cinzel title centered with a chevron at the right. v22
   (items 1–3, BAR SWAP): the section bars take the POB bar's
   old look — DARK NAVY #1d2d44 and SHORTER (6px padding, less
   than the POB bar's 12px) — with WHITE title + chevron in BOTH
   modes (white on #1d2d44 is high contrast in light mode too).
   The head is a real bar now, so the section box carries no
   padding of its own (see .prj-ws-sec above) and the body
   carries it instead. The .prj-list selector wins over the
   generic .prj-list button rule; the head's 5px top radius
   sits inside the section's 1px border (6px outer radius). */
.prj-list .prj-ws-sec-head { display: flex; align-items: center; gap: 8px; width: 100%; box-sizing: border-box; padding: 6px 10px; margin: 0; background: #1d2d44; color: #fff; border: none; border-radius: 5px 5px 0 0; cursor: pointer; font-family: inherit; }
.prj-list .prj-ws-sec-head:hover { background: #324357; }
.prj-ws-sec-head:focus-visible { outline: 2px solid #516f9d; outline-offset: 2px; }
.prj-ws-sec-head .prj-ws-sec-title { flex: 1 1 auto; min-width: 0; margin-bottom: 0; color: #fff; }
.prj-ws-sec-chev { flex: 0 0 auto; color: #fff; font-size: 13px; }
.prj-ws-sec-body { margin-top: 0; padding: 8px 10px 10px; }
/* v19 — the POB figures row sits right after the Overview, in
   the same centered label-above-amount layout as the old PB. */
.prj-ws-figures { padding: 2px 0; }
/* v19 — save/lock pattern (item 6): a locked section shows its
   fields as plain text (label above value, like the form fields)
   and a saved row with the "[Section] saved" button, its time
   stamp, and the "Edit [section]" button. */
.prj-ws-locked-row { margin: 4px 0; font-size: 13px; }
.prj-ws-kv-label { display: block; font-size: 11px; font-weight: bold; text-transform: uppercase; letter-spacing: .5px; color: var(--prj-ink); }
.prj-ws-kv-value { overflow-wrap: anywhere; white-space: pre-line; }
.prj-ws-saved-row { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; margin-top: 8px; }
.prj-ws-saved-time { font-size: 12px; color: #555; }
.prj-ws-save-status:empty { display: none; }
/* v19 — Project Details / bookkeeping entry forms: a full-width
   notes field and a wide description field, next to the shared
   .prj-ws-field sizes; textareas match the other ws inputs. */
.prj-ws-field--full { flex: 1 1 100%; }
.prj-ws-field--wide { flex: 1 1 220px; }
/* v22 — the Accounting "taxes filed" confirm line: checkbox +
   text on one row, full width of the form. */
.prj-ws-acc-confirm { display: flex; align-items: center; gap: 6px; flex: 1 1 100%; font-size: 13px; cursor: pointer; }
.prj-ws-acc-confirm input[type="checkbox"] { width: 16px; height: 16px; accent-color: #1d2d44; flex-shrink: 0; }
.prj-ws-form textarea { min-width: 0; width: 100%; padding: 5px 6px; font-size: 16px; font-family: "Lora", Georgia, serif; border: 1px solid var(--prj-border); border-radius: 4px; background: #fff; color: var(--prj-ink); box-sizing: border-box; resize: vertical; min-height: 28px; }
html[data-theme="dark"] .prj-ws-sec-chev, html[data-theme="dark"] .prj-ws-kv-label { color: #eef1f6; }
/* v22 (item 3) — inside a dark-navy section bar the title and
   chevron stay WHITE in dark mode too (the rules above would
   otherwise paint them #eef1f6). */
html[data-theme="dark"] .prj-ws-sec-head .prj-ws-sec-title, html[data-theme="dark"] .prj-ws-sec-head .prj-ws-sec-chev { color: #fff; }
html[data-theme="dark"] .prj-list .prj-ws-sec-head { background: #1d2d44; color: #fff; border-color: #1d2d44; }
html[data-theme="dark"] .prj-list .prj-ws-sec-head:hover { background: #324357; }
html[data-theme="dark"] .prj-ws-saved-time { color: #c0c7d6; }
html[data-theme="dark"] .prj-ws-form textarea { background: #161b24; color: #eef1f6; border-color: rgba(255, 255, 255, .22); color-scheme: dark; }

/* ================================================================
   v23 — POB side (items 2, 6–8, 10–24). Same layout in light and
   dark mode — only the corresponding colours change.
   ================================================================ */

/* --- Item 23 — customer LEFT, quick access RIGHT. The phone is
   a BUTTON now (was a link); its look is the shared secondary
   style (v24 item 13, see the .prj-ws-ov-* rule above). Owed is
   a line, not a button; the deadline sits under it (item 24). --- */
.prj-ws-ov-quick { width: 100%; text-align: center; }
.prj-ws-ov-owed { font-size: 13px; font-weight: 700; color: var(--prj-ink); overflow-wrap: anywhere; }
.prj-ws-ov-deadline-wrap { min-width: 0; }
.prj-ws-ov-deadline { background: none; border: none; padding: 0; cursor: pointer; font-family: "Lora", Georgia, serif; font-size: 13px; color: #555; text-align: right; overflow-wrap: anywhere; }
.prj-ws-ov-deadline-input { width: 100%; box-sizing: border-box; padding: 5px 6px; font-size: 16px; font-family: "Lora", Georgia, serif; border: 1px solid var(--prj-border); border-radius: 4px; background: #fff; color: var(--prj-ink); }
html[data-theme="dark"] .prj-ws-ov-owed { color: #eef1f6; }
html[data-theme="dark"] .prj-ws-ov-deadline { color: #c0c7d6; }
html[data-theme="dark"] .prj-ws-ov-deadline-input { background: #161b24; color: #eef1f6; border-color: rgba(255, 255, 255, .22); color-scheme: dark; }
/* --- Item 23 — the Call / Text choice popover: same look as the
   status picker (.st-status-pop above). v24 (item 14, refined
   13:02 CST) — the popup is just the two buttons, the same size,
   stacked one on top of the other: NO repeated phone number at
   the top, NO Cancel button (tapping away dismisses it). The
   popup-scoped rules below beat the shared .st-status-opt rule
   (same specificity family, later in the file); the status
   picker itself is untouched. --- */
.prj-phone-pop { position: fixed; z-index: 60; min-width: 190px; max-width: 280px; background: #fff; color: #1f2d3a; border: 1px solid #b9c4d6; border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.25); padding: 8px; font-family: "Lora", Georgia, serif; box-sizing: border-box; display: flex; flex-direction: column; gap: 8px; }
.prj-phone-pop button.st-status-opt { display: block; width: 100%; min-height: 38px; margin: 0; padding: 9px 16px; border-radius: 6px; font-family: "Lora", Georgia, serif; font-size: 13px; text-align: center; box-sizing: border-box; background: #1d2d44; color: #fff; border: 1px solid #1d2d44; }
.prj-phone-pop button.st-status-opt:hover { background: #324357; }
html[data-theme="dark"] .prj-phone-pop { background: #1a1f26; color: #eef1f6; border-color: rgba(255, 255, 255, .22); }
html[data-theme="dark"] .prj-phone-pop button.st-status-opt { background: #5b729f; color: #fff; border-color: #5b729f; }
html[data-theme="dark"] .prj-phone-pop button.st-status-opt:hover { background: #4a628f; }

/* --- Item 12 — "+ New estimate": CENTERED and FULL LENGTH,
   under the Estimate section bar. The row hides (display:none,
   set in JS) while the estimate form shows. --- */
.prj-ws-new-est-row { display: flex; justify-content: center; width: 100%; box-sizing: border-box; }
.prj-ws-new-est-row .prj-ws-new-est-btn { flex: 1 1 auto; width: 100%; min-width: 0; }

/* --- Items 14–18 — Project Details. --- */
/* v24 (item 12) — customer information is the first block under
   the bar, in both states: one ADD button per field (Customer
   Name, Phone, Email, Address), in .prj-ws-custedit. The v23
   item-14 'Edit customer information' button is gone. */
.prj-ws-custedit { margin-bottom: 4px; }
.prj-ws-custedit .prj-ws-form { margin-top: 0; }
/* Item 15 — a field TITLE is a tappable button that looks like
   its label (11px bold uppercase); an empty title reads "Add
   project type" (etc.). Tapping reveals / unlocks that ONE
   field. v24 (item 12) — the .prj-list scope is REQUIRED: the
   base .prj-list button rule (0,1,1) beats this plain class
   (0,1,0) and painted every title navy with white text — the
   titles (project AND customer ADD buttons) rendered as navy
   buttons instead of plain bold text. Scoped, the reset wins. */
.prj-list .prj-ws-field-title { display: block; width: 100%; box-sizing: border-box; background: none; border: none; padding: 0; margin: 0; cursor: pointer; font-family: "Lora", Georgia, serif; font-size: 11px; font-weight: bold; color: var(--prj-ink); text-transform: uppercase; letter-spacing: .5px; text-align: left; }
.prj-ws-field-title:focus-visible { outline: 2px solid #516f9d; outline-offset: 1px; }
/* Item 18f — a saved value shows in a BOX WITH ROUNDED CORNERS
   around the VALUE (not the title), non-editable; tapping the
   box unlocks just that field, like the title. */
.prj-ws-value-box { display: block; box-sizing: border-box; margin-top: 2px; padding: 5px 8px; font-size: 13px; color: var(--prj-ink); background: rgba(29, 45, 68, .04); border: 1px solid var(--prj-border); border-radius: 6px; cursor: pointer; overflow-wrap: anywhere; white-space: pre-line; }
.prj-ws-value-box:focus-visible { outline: 2px solid #516f9d; outline-offset: 1px; }
/* v24 (item 12) — the 'Add ...' links inside a partially filled
   address value box: an underlined link, in place in the address
   line. Display-only: they never reach any stored field. The
   .prj-list scope is required for the same reason as the field
   titles above (the base button rule would paint them navy). */
.prj-list .prj-ws-addr-add { background: none; border: none; padding: 0; margin: 0; cursor: pointer; font-family: "Lora", Georgia, serif; font-size: 13px; color: #516f9d; text-decoration: underline; text-underline-offset: 2px; }
.prj-ws-addr-add:focus-visible { outline: 2px solid #516f9d; outline-offset: 1px; }
/* v24 (item 12) — the address group's city / ST / ZIP row:
   city takes the room, ST and ZIP are fixed narrow. */
.prj-ws-addr-row { display: flex; gap: 6px; flex: 1 1 100%; min-width: 0; }
.prj-ws-addr-row > .prj-ws-addr-city { flex: 1 1 0; min-width: 0; }
.prj-ws-addr-row > .prj-ws-addr-state { flex: 0 1 56px; min-width: 0; }
.prj-ws-addr-row > .prj-ws-addr-zip { flex: 0 1 84px; min-width: 0; }
/* Item 16 — Start / End share one row, EQUAL halves, together
   FULL WIDTH of the Details box. Item 17 — Project Type and
   Project Description are FULL ROWS (stacked) via
   .prj-ws-field--full. */
.prj-ws-dates-row { display: flex; gap: 6px; flex: 1 1 100%; min-width: 0; }
.prj-ws-dates-row > .prj-ws-field { flex: 1 1 0; min-width: 0; }
/* Items 18a–d — the save row: "Save project details" gets a
   FULL ROW; WHEN SAVED it shares that row 50/50 with "Edit
   project details", and the DATE STAMP sits INSIDE the saved
   button (label line + stamp line). ONE FIXED HEIGHT (44px) in
   both states — it never grows. */
.prj-ws-save-row { display: flex; gap: 8px; margin-top: 8px; flex: 1 1 100%; min-width: 0; }
/* PROBE FIX (2026-11-27): the SAVED row ("Project details saved"
/ "Edit project details") is appended to the section body, NOT
inside .prj-ws-form — so the old ".prj-ws-form .prj-ws-save-row"
selector never matched it and the two buttons sized to content
(155px / 128px) instead of sharing the row 50/50. The row selector
no longer requires the .prj-ws-form ancestor. The --full rules
below still win for the open-state full row (higher specificity /
later in the file). */
.prj-ws-save-row .prj-ws-save-btn { flex: 1 1 0; min-width: 0; }
.prj-ws-form .prj-ws-save-row--full .prj-ws-save-btn { flex: 1 1 100%; }
.prj-ws-form .prj-ws-save-btn--full { flex: 1 1 100%; }
.prj-ws-save-btn { height: 44px; min-height: 44px; max-height: 44px; box-sizing: border-box; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0; line-height: 1.2; padding: 4px 10px; overflow: hidden; }
.prj-ws-save-btn-label { font-size: 13px; font-weight: 700; }
.prj-ws-save-btn-stamp { font-size: 13px; font-weight: 400; color: #555; }
html[data-theme="dark"] .prj-ws-field-title { color: #eef1f6; }
html[data-theme="dark"] .prj-list .prj-ws-field-title { background: none; border: none; color: #eef1f6; }
html[data-theme="dark"] .prj-ws-value-box { background: rgba(214, 223, 243, .08); color: #eef1f6; border-color: rgba(255, 255, 255, .22); }
html[data-theme="dark"] .prj-ws-addr-add { color: #9db8e8; }
html[data-theme="dark"] .prj-list .prj-ws-addr-add { background: none; border: none; color: #9db8e8; }
html[data-theme="dark"] .prj-ws-save-btn-stamp { color: #c0c7d6; }

/* --- Item 2 — Messages section. Records, not editable fields:
   each message shows who sent it, when, and what was said,
   oldest first. --- */
.prj-ws-msg-list { display: flex; flex-direction: column; gap: 8px; margin: 6px 0; }
.prj-ws-msg { border: 1px solid var(--prj-border); border-radius: 6px; padding: 8px 10px; min-width: 0; }
.prj-ws-msg--sent { background: rgba(29, 45, 68, .04); }
.prj-ws-msg--received { background: transparent; }
.prj-ws-msg-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-size: 12px; }
.prj-ws-msg-who { font-weight: 700; color: var(--prj-ink); }
.prj-ws-msg-when { font-size: 13px; color: #555; white-space: nowrap; }
.prj-ws-msg-subject { font-size: 13px; font-weight: 700; color: var(--prj-ink); margin-top: 4px; overflow-wrap: anywhere; }
.prj-ws-msg-body { font-size: 13px; color: var(--prj-ink); margin-top: 2px; overflow-wrap: anywhere; white-space: pre-line; }
.prj-ws-msg-compose { display: flex; flex-direction: column; gap: 8px; margin-top: 6px; }
.prj-ws-msg-compose input, .prj-ws-msg-compose textarea { width: 100%; box-sizing: border-box; font-family: "Lora", Georgia, serif; font-size: 16px; padding: 4px 8px; border: 1px solid var(--prj-border); border-radius: 6px; background: #fff; color: var(--prj-ink); min-width: 0; }
.prj-ws-msg-compose textarea { resize: vertical; min-height: 54px; }
.prj-ws-msg-actions { display: flex; gap: 8px; flex-wrap: wrap; }
html[data-theme="dark"] .prj-ws-msg--sent { background: rgba(214, 223, 243, .08); }
html[data-theme="dark"] .prj-ws-msg-who, html[data-theme="dark"] .prj-ws-msg-subject, html[data-theme="dark"] .prj-ws-msg-body { color: #eef1f6; }
html[data-theme="dark"] .prj-ws-msg-when { color: #c0c7d6; }
html[data-theme="dark"] .prj-ws-msg-compose input, html[data-theme="dark"] .prj-ws-msg-compose textarea { background: #161b24; color: #eef1f6; border-color: rgba(255, 255, 255, .22); color-scheme: dark; }

/* --- Item 19b — Accounting as one story: each line a sentence
   with the number inside it. --- */
.prj-ws-acc-story { font-size: 13px; color: var(--prj-ink); margin: 2px 0; overflow-wrap: anywhere; }
/* v24 (step 5) — each amount is BOLD at the END of its line: the
   story line is a flex row, sentence left, amount right, so the
   numbers scan as a column. Plain lines (status / tax) have one
   child and render unchanged. */
.prj-ws-acc-story { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.prj-ws-acc-story-text { min-width: 0; }
.prj-ws-acc-story-amt { white-space: nowrap; }
.prj-ws-acc-story-head { margin-top: 10px; }
.prj-ws-acc-story-head:first-of-type { margin-top: 0; }
.prj-ws-acc-exp-link { margin: 4px 0 2px; }
html[data-theme="dark"] .prj-ws-acc-story { color: #eef1f6; }

/* --- Item 21 — mobile rules (480px and below), POB side.
   Phone-first hierarchy is the DOM order (bar → customer →
   sections in work order → admin buttons last); this block only
   sizes things. Every button at least 44px tall — the 28px
   list buttons grow, the bottom admin buttons go 2×2, and the
   bars take the same 44px so the POB bar and the section bars
   stay the SAME height (item 6 holds at phone width too).
   Everything FULL-WIDTH except P number + chip sharing the bar,
   Start/End dates 50/50, and the 2×2 admin buttons. Text:
   titles 15px, body 14px, chips 12px, stamps 12px — nothing
   below 12px. One column, no horizontal scrolling. --- */
@media (max-width: 480px) {
  .prj-list button:not(.est-add-line-btn):not(.est-remove), .prj-box-actions .prj-btn { min-height: 44px; }
  /* v24 (step 3) — buttons v23 missed at <=480px: the "+ New
     Project" / "Download backup" buttons, the category heads
     (they open a category, so they are tappable), every
     customer / document row button, the picker buttons and
     project rows, the expiry banner's close button, the theme
     toggle and the search-clear button (hit area). The square
     "+" add-line button and the "×" remove buttons stay 30x30
     (v23 exemption, step 3). */
  .prj-new-wrap.prj-btn, .prj-bottom-actions.prj-btn,
  .est-start-actions.est-btn, .est-picker.est-btn,
  .est-saved-list button, .est-picker-project,
  #expiryNoticeClose { min-height: 44px; }
  .prj-cat-head { min-height: 44px; box-sizing: border-box; }
  /* The header title IS the menu now (step 4): 44px tall so it is
     a proper tap target at phone widths. */
  .staff-header-title { min-height: 44px; }
  #expiryNoticeClose { min-width: 44px; }
  .staff-header .theme-toggle { width: 44px; height: 44px; min-width: 44px; min-height: 44px; }
  .prj-search-clear { width: 44px; height: 44px; }
  #globalSearch { min-height: 44px; padding-right: 48px; }
  /* v23 (item 21) — the small square row buttons (+ add-line,
     × remove-line) are EXEMPT from that 44px: they are 22px
     square (30px at phone width) by Igor's v22 item-11 design,
     the same size and shape as each other, and the blanket rule
     stretched them to 30x44 — no longer square (probe run 4). */
  /* v23 (item 21) — the EMBEDDED doc toolbar: the 38px rule above
     (.prj-list .est-toolbar button, 0,3,0) beat estimate.css's
     <=480px 44px rule (0,2,0), so Edit/Convert/Print/Cancel
     rendered 38px at phone width while only #saveBtn/#sendBtn
     escaped via their #id rule (probe run 3). Same specificity,
     later + media-scoped, so it wins at <=480px. */
  .prj-list .est-toolbar button, .prj-list .est-toolbar .est-btn { min-height: 44px; height: 44px; }
  .prj-ws-ov-bar, .prj-list .prj-ws-sec-head { min-height: 44px; }
  /* The bar at 402px fits P number + uniform chip on ONE row:
     the chip stacks its date UNDER its status text (two lines),
     so the chip never forces the bar wider or taller than its
     two lines. */
  .prj-list .prj-ws-ov-bar-chip { flex-direction: column; align-items: center; gap: 0; line-height: 1.15; padding-top: 2px; padding-bottom: 2px; }
  .prj-list .prj-ws-ov-bar-chip .st-chip-date { display: block; }
  /* Bottom admin buttons 2×2 at 44px, labels at the 12px floor
     (the <=520px rule's 10px is raised here). */
  .prj-box-actions { flex-wrap: wrap; gap: 8px; }
  .prj-box-actions button, .prj-box-actions .prj-btn { flex: 1 1 40%; min-width: 0; padding: 5px 8px; font-size: 12px; }
  /* Top toolbar: same 44px, labels at the 12px floor (the
     <=520px rule's 11px is raised here). */
  .prj-actions .prj-btn { min-height: 44px; padding: 9px 4px; font-size: 12px; }
  /* Full-width fields (the pairs that stay 50/50 — Start/End
     dates in .prj-ws-dates-row — are re-pinned below). */
  .prj-ws-ov-body { align-items: stretch; }
  .prj-ws-ov-col { width: 100%; }
  .prj-ws-ov-quick { width: 100%; }
  .prj-ws-form .prj-ws-field { flex: 1 1 100%; }
  .prj-ws-dates-row > .prj-ws-field { flex: 1 1 0; }
  .prj-ws-msg-actions .secondary, .prj-ws-msg-compose .secondary { flex: 1 1 100%; }
  /* Text sizes: titles 15px, body 14px, chips 12px, stamps
     12px (the stamp floor also lives in estimate.css, which
     sets .st-chip .st-chip-date to 12px below 480px). */
  .prj-ws-sec-head .prj-ws-sec-title { font-size: 15px; }
  .prj-ws-ov-name, .prj-ws-ov-phone, .prj-ws-ov-email, .prj-ws-ov-street, .prj-ws-ov-rest,
  .prj-ws-ov-owed, .prj-ws-msg-body, .prj-ws-acc-story, .prj-ws-locked-row { font-size: 14px; }
  .prj-ws-field label, .prj-list .prj-ws-field-title, .prj-ws-subhead, .prj-ws-note { font-size: 12px; }
  .st-chip { font-size: 12px; }
  /* Status picker / phone-choice options are tappable rows too. */
  .st-status-opt, .st-status-cancel { min-height: 44px; }
  /* v24 (item 14) — the phone popup's two buttons are 44px at
     phone widths too (the shared rule above is 0,1,0 and would
     lose to the popup's 0,2,1 38px rule). */
  .prj-phone-pop button.st-status-opt { min-height: 44px; }
}

/* v25 (item 42, Igor, 2026-11-27) — gated clear: "Clear everything"
   sits under Download backup at the bottom of the Projects list.
   Same family as Download backup: Lora, navy/white, same sizes
   (38px, full width up to 300px like the backup button). The
   review panel below it is a plain bordered box, left aligned.
   Layout, sizes, spacing and positions are IDENTICAL in dark and
   light mode; only the colours change (dark rules below). */
.prj-clear-wrap { display: flex; flex-direction: column; align-items: center; margin-top: 10px; }
.prj-clear-wrap > .prj-btn { width: 100%; max-width: 300px; }
.prj-clear-panel { width: 100%; max-width: 560px; margin-top: 12px; border: 1px solid var(--prj-border); border-radius: 6px; padding: 14px 16px; background: #fff; color: var(--prj-text); text-align: left; box-sizing: border-box; font-size: 13px; line-height: 1.5; }
.prj-clear-panel .prj-clear-title { font-size: 15px; margin: 0 0 8px; }
.prj-clear-counts { list-style: none; margin: 0 0 8px; padding: 0; }
.prj-clear-counts li { padding: 1px 0; }
.prj-clear-backup { font-weight: bold; margin: 8px 0; }
.prj-clear-note { margin: 8px 0; }
.prj-clear-warning { margin: 8px 0; }
.prj-clear-loading { margin: 8px 0; color: #555; }
.prj-clear-error { color: #c0392b; font-weight: bold; margin: 8px 0; }
.prj-clear-result { margin: 8px 0; }
.prj-clear-result.error { color: #c0392b; font-weight: bold; }
.prj-clear-result .prj-clear-done { color: #2e7d32; margin: 4px 0; }
.prj-clear-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.prj-clear-actions .prj-btn { flex: 1 1 160px; min-width: 0; }
html[data-theme="dark"] .prj-clear-panel { background: #1a1f26; border-color: rgba(255, 255, 255, 0.14); color: #eef1f6; }
html[data-theme="dark"] .prj-clear-panel .prj-clear-title { color: #eef1f6; }
html[data-theme="dark"] .prj-clear-loading { color: #c0c7d6; }
html[data-theme="dark"] .prj-clear-error,
html[data-theme="dark"] .prj-clear-result.error { color: #ff8a80; }
html[data-theme="dark"] .prj-clear-result .prj-clear-done { color: #81c995; }
@media (max-width: 480px) {
  .prj-clear-wrap > .prj-btn { min-height: 44px; }
  .prj-clear-panel { font-size: 14px; }
  .prj-clear-actions .prj-btn { min-height: 44px; }
}

/* v25.1 — backdated AP numbers: the inquiry-date row in the
   "+ New Project" picker (injected by projects.js under the
   reserved-number line). The label reuses the picker's own
   .picker-label style; the input is 16px Lora so iPhones do
   not zoom on tap, full width with no overflow at phone
   widths. Same layout in dark and light mode, only the colours
   change. */
.prj-inquiry-row { margin: 0 0 14px; min-width: 0; }
#pickerInquiryDate { display: block; width: 100%; box-sizing: border-box; min-width: 0; font-family: "Lora", Georgia, serif; font-size: 16px; color: #1d2d44; background: #fff; border: 1px solid #c9d2de; border-radius: 6px; padding: 10px 12px; }
.prj-inquiry-error { margin: 4px 0 0; font-size: 13px; color: #b3261e; font-family: "Lora", Georgia, serif; }
html[data-theme="dark"] #pickerInquiryDate { color: #eef1f6; background: #232a35; border-color: rgba(255, 255, 255, .22); color-scheme: dark; }
html[data-theme="dark"] .prj-inquiry-error { color: #ff8a80; }
/* v25.1 — the inquiry-date line in Project Details is read-only:
   its title and value box never act as buttons, so the pointer
   cursor from the tappable field rules is turned off. */
.prj-list .prj-ws-field-title.prj-ws-field-title--static { cursor: default; }
.prj-ws-value-box.prj-ws-value-box--static { cursor: default; }
