/* Apex Pro Cabinets — Estimate / Invoice page (staff only).
   Layout follows AP_invoice_template__simple.html: 14px top/bottom
   bars (#4b5a6a), content padding 35px 45px, 26px document title,
   4-column line-item table, 320px totals table on the right,
   signature block, warranty at the end of the last page.
   Money is whole dollars only — no cents anywhere. */

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

/* v7.2 — fixed light chrome, always: this page declares
   color-scheme: light and never inherits the site/OS dark theme.
   Without this, dark mode rendered native controls (date, number)
   as dark boxes and left unstyled toolbar text dark-on-black.
   Every native control on this page is forced to render light. */
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); the document itself stays paper-white in light
   mode and soft grey in dark mode. Print is always white. */
body { background: #e9e9e9; color: var(--est-text); }
.est-wrap input, .est-wrap select, .est-wrap textarea { box-sizing: border-box; }

.est-wrap { max-width: 850px; margin: 0 auto; padding: 24px 16px 60px; font-family: Georgia, 'Times New Roman', serif; color: var(--est-text); }
/* v7.17 — the old white top bar (.est-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. */

/* ---------- Start screen ---------- */
.est-start { font-family: "Lora", Georgia, serif; background: #fff; border: 1px solid var(--est-border); border-radius: 8px; padding: 28px 24px; box-shadow: 0 0 12px rgba(0,0,0,.08); }
.est-start h1 { font-size: 22px; color: var(--est-ink); margin: 0 0 6px; font-family: "Cinzel", Georgia, serif; }
/* v23 (item 28 refinement, Igor, 2026-11-27) — the big in-page
   "Customers" / "Projects" heading (#startTitle) is GONE: the
   page title lives in the header (#staffHeaderTitle) now, so
   its rule goes with it. */
.est-start-sub { font-size: 13.5px; color: #555; margin: 0 0 18px; }
/* v7.4 — visible load error (start screen): if init() fails, the page
   says so in plain language instead of leaving dead buttons. Fixed
   light colours, so it reads in either site theme. */
.est-load-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; }
.est-start-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 26px; }
/* Buttons round (Igor, 2026-11-24): buttons in a row share the row
   equally — same width even when the labels are different lengths.
   Rows marked .est-actions--equal get equal-width buttons (the
   Customers/Estimates/Invoices top rows, the customer Save row and
   the "Create for this customer" row); capped at 300px so a pair
   does not stretch the whole desktop width, centred when capped.
   The "Saved …" timestamp takes its own line under the buttons so
   it can never push a button off the row. */
.est-start-actions.est-actions--equal { justify-content: center; }
.est-start-actions.est-actions--equal .est-btn { flex: 1 1 0; min-width: 0; max-width: 300px; }
.est-start-actions .est-saved-at { flex: 1 1 100%; order: 10; }
.est-start h2 { font-size: 15px; color: var(--est-ink); margin: 0 0 8px; }
.est-saved-status { font-size: 13px; color: #555; }
.est-saved-list { list-style: none; margin: 10px 0 0; padding: 0; }
.est-saved-list li { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; border: 1px solid var(--est-border); border-radius: 6px; padding: 10px 12px; margin-bottom: 8px; font-size: 13px; }
/* v14 (Igor, item 13) — on the customer profile, an estimate /
   invoice row sits UNDER its project: the whole row (with its
   Open button) moves slightly right — the same 16px indent the
   expanded customer box already uses for its nested rows. */
.est-saved-list li.cust-linked-doc { margin-left: 16px; }
.est-saved-list .doc-no { font-weight: bold; color: var(--est-ink); }
.est-saved-list .doc-client { flex: 1 1 160px; min-width: 0; overflow-wrap: anywhere; }
.est-saved-list .doc-total { font-weight: bold; }
.est-saved-list .doc-status { color: #555; font-size: 12px; }
/* v7.19 — LIST-ROW BUTTONS (Igor): the Open/Delete buttons were
   38px tall against a ~19px text line, so they towered over the
   project/estimate/invoice number. Row buttons are compact now —
   28px, aligned with the number/text line — on all four lists
   (Customers / Projects / Estimates / Invoices), mobile and
   desktop. Colours unchanged (navy stays navy, white stays
   white); the 38px buttons elsewhere (toolbar, actions) are NOT
   touched. */
.est-saved-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; }
.est-saved-list button:hover { background: #324357; border-color: #324357; }
/* 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. */
.est-saved-list button.secondary { background: #fff; color: #1f2d3a; border: 1px solid #1f2d3a; }

/* ---------- Toolbar / options (v7.2) ----------
   One button SIZE (v7.15): every action 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" /
   "Create invoice from this" / "Delete" in size. Colours are
   UNCHANGED: navy filled primary, white outlined secondary — the
   same two-colour scheme as before. Groups wrap cleanly and never
   overflow. */
.est-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(--est-border); border-radius: 8px; padding: 10px 12px; }
/* FIX F2 — the group GROWS to fill the toolbar at every width:
   with the group content-sized (as before), Cancel Estimate's
   margin-left: auto could only push it to the group's own right
   edge, which sat 4px short of the toolbar's content edge once
   the Lora buttons made the row slightly narrower (v23's Arial
   buttons happened to fill it exactly). The buttons keep their
   content sizes (flex-shrink: 0, no flex-grow on the buttons),
   so the extra space is absorbed by Cancel's auto margin and it
   lands exactly on the toolbar's right edge. */
.est-toolbar-group { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; min-width: 0; flex: 1 1 220px; }
/* v7.15 — visible divider between the toolbar groups (Navigate |
   Document actions | Drive). Hidden on narrow screens, where the
   groups stack — a divider on its own line would be a stray line. */
.est-toolbar-sep { width: 1px; align-self: stretch; background: var(--est-border); margin: 2px 4px; flex-shrink: 0; }
@media (max-width: 760px) { .est-toolbar-sep { display: none; } }
/* 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 (that was the 58px-tall start-screen buttons on a
   phone). Groups wrap as units. */
.est-btn, .est-saved-list 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). */
.est-saved-list li > button:last-child { margin-left: auto; }
.est-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: <a> buttons are content-box by default
     (unlike <button>, which the UA sizes border-box), so without
     this the 38px min-height + padding + border rendered as 58px. */
  box-sizing: border-box;
}
.est-btn:hover { background: #324357; border-color: #324357; }
.est-btn--primary { background: #1d2d44; color: #fff; border: 1px solid #1d2d44; }
.est-btn--secondary, .est-btn.secondary { background: #fff; color: #1f2d3a; border: 1px solid #1f2d3a; }
.est-btn--secondary:hover, .est-btn.secondary:hover { background: #f2f2f2; border-color: #1f2d3a; }
.est-btn:focus-visible { outline: 2px solid #516f9d; outline-offset: 2px; }
/* Back-compat: bare .secondary on a toolbar button (old markup). */
.est-toolbar button.secondary { background: #fff; color: #1f2d3a; border: 1px solid #1f2d3a; }
/* v7.15 — the start-screen buttons are the same size as every other
   button now (the old 48px --big size is gone). Colours unchanged. */
.est-btn--big { min-height: 38px; padding: 9px 16px; font-size: 13px; }
.est-save-status { font-size: 13px; color: #2e7d32; margin-left: auto; }
/* 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. */
.est-autosave { font-size: 13px; color: #555; font-family: "Lora", Georgia, serif; }
.est-autosave.error { color: #c0392b; font-weight: bold; }
/* FIX F2 (continued) — the empty autosave span still sat on the
   toolbar's first row and reserved a 12px gap next to the group,
   so Cancel Estimate landed 12px short even with the group
   growing (the group filled 780 of the 792px row: 792 − 12 gap
   − 0-width span). When empty it takes no space at all now, so
   the group fills the row and Cancel lands on the toolbar's
   right edge. When it HAS text (a "Saving…" / error message) it
   shows inline next to the buttons, as designed. */
.est-toolbar > .est-autosave:empty { display: none; }

/* v18 (item 1) — the Save button saves the inputs directly
   (see saveDoc in estimate.js). The v7.3 format menu
   is DELETED, with its rules and its dark-mode rules below.
   The Save button's wrap stays: it is the flex/grid child
   that gives the button its equal share in the toolbar row. */
.est-save-wrap { position: relative; display: inline-flex; flex-direction: column; }
/* v14 (Igor, post-v13 item 16, corrected) — the save time stamp
   ("15:04", Chicago) sits directly UNDER the Saved button in
   TINY TEXT, not on the button itself. The button flips to
   "Saved"; the time shows under it. The v12 item-3 removal of
   the separate doubled "Today, HH:MM" line stands — this is
   time-only, tiny, and attached to the button.
   v16 — this under-button span now serves the CUSTOMER form
   only (custSaveTime); the doc form's stamp moved INSIDE its
   Save button (see .est-btn-time), and the doc form's span is
   gone from the HTML. */
.est-save-time { display: block; font-size: 13px; line-height: 1.3; color: #555; text-align: center; margin-top: 2px; }
.est-save-time[hidden] { display: none; }
html[data-theme="dark"] .est-save-time { color: #9aa3b2; }
/* The Save button's wrap is the flex child in the equal-width
   rows, so it takes the button's equal share and the button
   fills it — the tiny time then sits under the button without
   breaking the row's equal widths. */
.est-start-actions.est-actions--equal .est-save-wrap { flex: 1 1 0; min-width: 0; max-width: 300px; }
.est-start-actions.est-actions--equal .est-save-wrap .est-btn { width: 100%; }
.est-save-status.error { color: #c0392b; }
/* v8 fix — the backup result is mirrored into the list views'
   status lines (see setSaveStatus); errors there are red too. */
.est-saved-status.error { color: #c0392b; }

/* v7.2 — options row on a fixed white surface: every label is
   dark text on white in both light and dark site themes.
   v13 (Igor, items 6 + 9) — the old single options box is
   split in two: .est-ids-box (the number + status box) and
   .est-presets ("Estimate pre-settings" / "Invoice
   pre-settings"). Both keep the same white surface. */
.est-ids-box, .est-presets { font-family: "Lora", Georgia, serif; font-size: 13px; margin: 12px 0; display: flex; flex-wrap: wrap; gap: 6px 18px; align-items: center; background: #fff; border: 1px solid var(--est-border); border-radius: 8px; padding: 10px 12px; color: #1f2d3a; }
.est-presets label { display: inline-flex; gap: 6px; align-items: center; white-space: nowrap; color: #1f2d3a; }
.est-presets input[type="checkbox"] { accent-color: #1d2d44; width: 16px; height: 16px; flex-shrink: 0; }
/* v15 (Igor, item 6) — ALL staff fields are 30% shorter now
   (new height = 70% of the old one): the vertical padding and
   any fixed height/min-height are scaled down, the font size
   stays the same and the text stays vertically centered. The
   deposit % field keeps its v13 19px (already half-height by
   Igor's earlier decision — 30% off 19px would clip its 13px
   text), and the borderless line-item inputs keep their 2px
   padding (already the shortest fields; 30% off would clip
   their 12.5px text). */
.est-presets input[type="number"] { width: 56px; height: 28px; box-sizing: border-box; padding: 1px 6px; line-height: 1; border: 1px solid #9fb3c8; border-radius: 4px; font-size: 16px; text-align: right; font-family: "Lora", Georgia, serif; background: #fff; color: #1f2d3a; }
.est-presets select { height: 28px; box-sizing: border-box; padding: 1px 6px; line-height: 1; border: 1px solid #9fb3c8; border-radius: 4px; font-size: 16px; font-family: "Lora", Georgia, serif; background: #fff; color: #1f2d3a; }
/* Notes field in the pre-settings box (Igor, item 4): its own
   full row under the other options; the textarea fills the row
   when open. */
.est-presets .est-notes-field { flex: 1 1 100%; }
.est-presets .est-notes-field .notes-label-row label { white-space: normal; }
.est-presets .est-notes-field textarea { display: block; width: 100%; box-sizing: border-box; margin-top: 4px; padding: 4px 10px; min-height: 27px; border: 1px solid #9fb3c8; border-radius: 6px; font-size: 16px; font-family: "Lora", Georgia, serif; background: #fff; color: #1f2d3a; }
/* v13 (Igor, item 9) — the pre-settings box title, centred
   with a button-like border like the project-form section
   names (v11, item 2). */
.est-presets-title { flex: 1 1 100%; text-align: center; font-size: 13px; font-weight: bold; text-transform: uppercase; letter-spacing: .5px; color: #1f2d3a; border: 1px solid #9fb3c8; border-radius: 6px; padding: 6px 8px; }
/* v13 (Igor, item 10) — the Expiration date field, styled like
   the website's fields (Lora, 14px radius, navy-tinted border,
   3px focus ring — the --staff-input-* tokens), NOT a generic
   browser control. The field follows the box theme (dark in
   dark mode, light in light mode); color-scheme follows it
   too, so the native calendar icon stays readable. The paper's
   own date fields are untouched — they print as the document. */
.est-presets input[type="date"] { 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; min-width: 0; color-scheme: light; transition: border-color 0.2s ease, box-shadow 0.2s ease; }
.est-presets input[type="date"]:focus { outline: none; border-color: var(--staff-input-focus); box-shadow: 0 0 0 3px var(--staff-focus-ring); }
/* v12 (items 1, 4) — the top of the options box: two corners.
   Left: the EST / INV number with its status chip below it.
   Right: the PRJ number (a button — tap it to open the project)
   with its status chip below it. The numbers are the same 12px
   size as the document-number input above. The associated
   documents sit under the document status, each number with its
   own status chip below it. v13 (item 6): this is now its OWN
   box (.est-ids-box), so the divider border is gone. */
.est-ids { flex: 1 1 100%; display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.est-id-cell { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.est-id-cell--right { align-items: flex-end; text-align: right; }
.est-id-label { font-size: 11px; font-weight: bold; text-transform: uppercase; letter-spacing: .5px; color: #1f2d3a; }
.est-id-num { font-size: 12px; font-weight: bold; color: #1f2d3a; }
button.est-id-num { background: none; border: none; padding: 0; cursor: pointer; font-family: "Lora", Georgia, serif; font-size: 12px; font-weight: bold; text-decoration: underline; color: #1d2d44; }
/* v13 (Igor, item 7) — the status chip is AS WIDE as the
   number text above it: the status column stretches to the
   cell width, and the chip stretches to the column. The cell
   is as wide as the wider of the two — the number, or the chip
   text when it is longer — so a short chip ("Sent") matches
   the number's width and a long one ("Converted to invoice
   INV-261124-01") grows the cell to fit. The associated
   documents below keep their shrink-to-fit chips. */
.est-id-status { display: flex; flex-direction: column; gap: 2px; align-items: stretch; }
.est-id-cell--right .est-id-status { align-self: stretch; }
.est-id-status .st-chip { text-align: center; }
.est-id-linked { display: flex; flex-direction: column; gap: 6px; }
.est-id-linked-row { display: flex; flex-direction: column; gap: 2px; align-items: flex-start; font-size: 12.5px; }
.est-id-linked-num { background: none; border: none; padding: 0; cursor: pointer; font-family: "Lora", Georgia, serif; font-size: 12.5px; color: #1d2d44; text-decoration: underline; }
.est-id-linked-ts { font-size: 13px; color: #555; }
/* v12 (item 1) — the plain "Project No." line under the EST /
   INV number in the document head: same size as the number
   input, non-editable. v13 (item 11) — its value is ALIGNED
   with the Estimate / Invoice No. value above it: same width
   (160px) and right-aligned, so both share the same right
   edge. At phone width the meta rows stack and the value goes
   full-width like the input (see the <=520px block). */
.est-meta-num { font-size: 12px; font-weight: bold; color: #1f2d3a; width: 160px; text-align: right; box-sizing: border-box; }
/* v13 (item 10) — Warranty shows ONLY the current value: one
   tappable control that toggles Yes <-> No. It is the SAME
   SIZE as the Deposit % field (half height — 19px, the old
   38px halved), so the two sit evenly in the pre-settings row.
   Pressed (Yes) is navy with white text, like the old pair. */
/* v17 (item 6) — FIXED WIDTH: the toggle used to size itself to
   its text, so "Yes" was wider than "No" and the box (and its
   navy background) shifted on every toggle. Measured with an
   Arial-metric font (Liberation Sans) at 13px: "Yes" is 21.2px
   wide. Padding is 10px each side + 1px border each side = 22px,
   so 46px total leaves 24px of content width — 2.8px of slack
   around "Yes", and "No" (16.6px) renders in the identical box.
   flex: none stops the flex row stretching or shrinking it;
   text-align: center keeps both words centred. Height (19px)
   and colours are unchanged. The dark rules below only change
   colours, so this one rule covers both themes. */
.est-warranty-toggle { flex: none; width: 46px; min-width: 46px; text-align: center; height: 19px; min-height: 19px; padding: 1px 10px; font-size: 13px; font-family: "Lora", Georgia, serif; background: #fff; color: #1f2d3a; border: 1px solid #1f2d3a; border-radius: 4px; cursor: pointer; box-sizing: border-box; }
.est-warranty-toggle[aria-pressed="true"] { background: #1d2d44; color: #fff; }
.est-opt-row { flex: 1 1 100%; display: flex; flex-wrap: wrap; gap: 6px 18px; align-items: center; }
.est-warranty-line { display: inline-flex; gap: 6px; align-items: center; white-space: nowrap; color: #1f2d3a; }
/* v17 — DOCUMENT SECTION TITLE + PROJECT OVERVIEW BOX + ONE-LINE
   BARS. The section title (#docSectionTitle, "Estimate" /
   "Invoice") is Cinzel, centered, full-length — the same
   treatment as the old "Customers" / "Projects" heading
   (Cinzel, centered, 22px; the heading itself is gone in
   v23 item 28 — the title lives in the header now). The
   Project Overview box replaces the
   deleted .est-ids-box (v13 item 6) and keeps its visual
   language: white box, 1px border, 8px radius, 13px Arial. Its
   bar is a full-length navy row — PRJ left, customer name right,
   13px bold like the project-list rows (.prj-list li, .prj-id) —
   and expands to a two-column body: status chips (newest-first
   history under the current chip) left, phone / email / street
   right-aligned right. The phone link uses the navy accent; the
   email button reads as plain text. The compose panel matches
   the site's form fields (Lora, 14px radius, --staff-input-*
   tokens, like the Expiration date field above). The two
   one-line bars (#invoiceLineTop / #estimateLineBottom,
   .doc-linked-line, and #estCollapsedLine / #invoiceCollapsedLine,
   .est-collapsed-line) are filled by JS (number + status chip +
   timestamp + button) and share the overview box's border
   treatment; a button inside one sits at the far right. Light
   and dark differ only by corresponding colours (dark overrides
   below, next to the other dark box rules). At phone width the
   body stacks and the right column left-aligns, so nothing
   overflows at 402px.
   v18 (items 2–3) — the bars are MINIMIZED BARS now, not
   one-line rows: a full-length clickable bar, column layout,
   everything centered — the title ("Estimate - $XXX" /
   "Invoice - $XXX", Cinzel like the section title) on top,
   the sent / approved date-and-time stamp under it, then one
   row with the document number, the (tappable) status chip,
   the "Converted …" info with its invoice button, and the
   Convert button when it lives in the bar. The number and
   invoice buttons read as plain underlined text, not native
   buttons. Tapping the bar outside its chip and buttons
   expands / contracts the section. */
.doc-section-title { font-family: "Cinzel", Georgia, serif; font-size: 22px; font-weight: 600; text-align: center; letter-spacing: .04em; color: #1f2d3a; margin: 12px 0; }
/* v19 (item 2, GAP-B) — the CONTRACT BAR: a slim full-width bar
   docked at the top of an expanded sent form, above the section
   title, that taps the form back down to its minimized bar. Same
   navy bar treatment as the Project Overview bar in both themes
   (navy in light and dark, white text), slim (6px vertical
   padding) so it reads as a bar, not a button row, and full
   width at 402px portrait with no overflow (box-sizing). */
.doc-contract-bar { display: block; width: 100%; box-sizing: border-box; padding: 6px 12px; margin: 0 0 8px; background: #1d2d44; color: #fff; border: none; border-radius: 8px; cursor: pointer; font-family: "Lora", Georgia, serif; font-size: 13px; text-align: center; appearance: none; -webkit-appearance: none; }
.doc-contract-bar:hover { background: #324357; }
.doc-contract-bar:focus-visible { outline: 2px solid #516f9d; outline-offset: -2px; }
/* v19 (item 6) — the SAVE-LOCK plain-text look: while a section
   is save-locked its fields read as plain text — no borders, no
   field background — with the value in the normal ink colour at
   full opacity (a disabled control's greyed look would not read
   as plain text). The line-item delete buttons and the "+ Add
   Line" button hide while locked (nothing to delete or add);
   the warranty toggle keeps its value visible, borderless. The
   saved-time stamp next to the Save button is small grey text. */
.doc-saved-locked .est-presets input, .doc-saved-locked .est-presets textarea,
.doc-saved-locked .est-page input, .doc-saved-locked .est-page textarea { border-color: transparent !important; background: transparent !important; box-shadow: none !important; }
.doc-saved-locked .est-page input:disabled, .doc-saved-locked .est-page textarea:disabled,
.doc-saved-locked .est-presets input:disabled, .doc-saved-locked .est-presets textarea:disabled { color: #1f2d3a; opacity: 1; -webkit-text-fill-color: #1f2d3a; }
.doc-saved-locked .est-page .est-add, .doc-saved-locked #itemsBody button { display: none; }
.doc-saved-locked .est-warranty-toggle { border-color: transparent; background: transparent; }
/* The saved-time stamp next to Save reuses the existing
   .est-saved-at rules (11px muted text, full-row on phones) —
   no new rule needed for it. */
.proj-overview { font-family: "Lora", Georgia, serif; font-size: 13px; margin: 12px 0; background: #fff; border: 1px solid var(--est-border); border-radius: 8px; color: #1f2d3a; overflow: hidden; }
.proj-overview-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; width: 100%; box-sizing: border-box; padding: 10px 12px; background: #1d2d44; 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; }
.proj-overview-bar:hover { background: #324357; }
.proj-overview-bar:focus-visible { outline: 2px solid #516f9d; outline-offset: -2px; }
.proj-overview-prj { flex-shrink: 0; white-space: nowrap; }
.proj-overview-customer { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: right; }
.proj-overview-body { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; padding: 10px 12px; }
/* Collapsed by default: the bar's aria-expanded flips to true
   when JS opens the box. The BODY stays visible while collapsed
   (current status chip left; phone / email / street right) —
   only the history (#projOverviewHistory) and the rest of the
   address (#projOverviewRest) hide, via their [hidden]
   attribute, which JS toggles. v17 fix (probe, 2026-11-26):
   the old rule hid the whole body while collapsed, which
   contradicted the spec. */
.proj-overview-col { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.proj-overview-col--left { align-items: flex-start; }
.proj-overview-col--right { align-items: flex-end; text-align: right; margin-left: auto; }
.proj-overview-history { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }
.proj-overview-history .st-chip { text-align: center; }
/* v24 (item 13) — the doc overview's 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. No text-align here,
   so the column (left / right) governs it, as before. */
.proj-overview-phone, .proj-overview-email, .proj-overview-street, .proj-overview-rest { background: none; border: none; padding: 0; font-family: "Lora", Georgia, serif; font-size: 13px; font-weight: 400; color: #555; text-decoration: none; overflow-wrap: anywhere; }
.proj-overview-phone, .proj-overview-email { cursor: pointer; }
.proj-overview-compose { border-top: 1px solid var(--est-border); padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; }
.proj-overview-compose input[type="text"], .proj-overview-compose textarea { width: 100%; 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; padding: 4px 10px; min-height: 27px; color-scheme: light; transition: border-color 0.2s ease, box-shadow 0.2s ease; }
.proj-overview-compose textarea { resize: vertical; line-height: 1.4; }
.proj-overview-compose input[type="text"]:focus, .proj-overview-compose textarea:focus { outline: none; border-color: var(--staff-input-focus); box-shadow: 0 0 0 3px var(--staff-focus-ring); }
.proj-overview-compose-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.proj-overview-compose-status { font-size: 12.5px; color: #555; }
.proj-overview-compose-status:empty { display: none; }
.doc-linked-line, .est-collapsed-line { font-family: "Lora", Georgia, serif; font-size: 13px; margin: 12px 0; display: flex; flex-direction: column; flex-wrap: wrap; gap: 4px; align-items: center; text-align: center; background: #fff; border: 1px solid var(--est-border); border-radius: 8px; padding: 10px 12px; color: #1f2d3a; cursor: pointer; }
.doc-linked-line .est-btn, .est-collapsed-line .est-btn { margin-left: 0; }
/* v18 — minimized-bar parts: the centered title, the
   date/time stamp under it, and the row with number + chip +
   converted info (+ Convert when it lives in the bar). */
.v18-bar-title { font-family: "Cinzel", Georgia, serif; font-size: 16px; font-weight: 600; letter-spacing: .04em; }
.v18-bar-stamp { font-size: 13px; color: #555; }
.v18-bar-row { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; justify-content: center; }
button.v17-line-num, button.v17-line-inv { background: none; border: none; padding: 0; cursor: pointer; font-family: "Lora", Georgia, serif; font-size: 13px; color: #1d2d44; text-decoration: underline; }
.v17-line-converted { font-size: 13px; }
@media (max-width: 520px) {
  .proj-overview-body { flex-direction: column; }
  .proj-overview-col--right { align-items: flex-start; text-align: left; margin-left: 0; }
}
@media (max-width: 520px) {
  /* Buttons round (Igor, 2026-11-24): on a phone each toolbar
     group takes its own full row and its buttons share it equally
     — v10 (item 28): the document toolbar is ONE group now, so its
     four buttons read as a 2x2 grid, all exactly the same size:
     Save / New, Convert / PDF (Archive/Delete join the grid when
     they show on a saved document). The group grows to fill the
     toolbar at every width now (FIX F2: the base rule carries
     flex: 1 1 220px, so Cancel Estimate lands on the toolbar's
     right edge); the phone-width concern below is about the
     group's INTERNAL grid layout, not about the group stretching.
     The Save button's wrapper shares the row with New; the
     "Saved …" time drops to its own line under the buttons. */
  .est-toolbar-group { flex: 1 1 220px; }
  /* Buttons round (Igor, 2026-11-24): at phone width each group
     is a 2-column grid, so its two buttons are EXACTLY equal.
     Flex could not do this for the Save group: the Save button
     lives inside a wrapper span, and the pair measured 161/175
     with identical computed flex (the button's effective flex
     base is its padding+border, the bare span's is 0 — a 14px
     split no flex-basis spelling fixed). Grid 1fr/1fr has no
     such quirk. The hidden file input takes no track. */
  .est-toolbar-group { display: grid; grid-template-columns: 1fr 1fr; }
  .est-toolbar-group .est-btn { min-width: 0; padding: 9px 6px; font-size: 11px; }
  /* v16 — the in-button timestamp shrinks with the button at
     phone width so it still fits inside the border. */
  .est-toolbar-group .est-btn .est-btn-time { font-size: 13px; }
  .est-toolbar-group .est-save-wrap { min-width: 0; }
  .est-toolbar-group .est-save-wrap .est-btn { width: 100%; }
  .est-toolbar-group .est-saved-at { grid-column: 1 / -1; order: 10; }
  /* The save/autosave status spans take their own row, so they
     can never share the Save group's row and unbalance it. */
  .est-toolbar > .est-save-status, .est-toolbar > .est-autosave { flex: 1 1 100%; }
}
.est-drive-status { font-size: 12.5px; color: #555; }

/* ---------- Document (template-exact) ---------- */
.est-page { background: #fff; box-shadow: 0 0 12px rgba(0,0,0,.15); width: 100%; max-width: 850px; min-width: 0; box-sizing: border-box; }
.est-wrap { box-sizing: border-box; }
.est-bar { height: 14px; background: var(--est-bar); }
.est-content { padding: 35px 45px; }
.est-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 30px; }
.est-brand { display: flex; align-items: center; gap: 10px; }
.est-company { font-size: 22px; font-weight: bold; letter-spacing: 1px; color: var(--est-ink); }
.est-company-sub { font-size: 11px; color: #555; font-family: Arial, sans-serif; margin-top: 2px; }
.est-doc-title { font-size: 26px; letter-spacing: 2px; font-family: Arial, sans-serif; color: var(--est-ink); text-align: right; }
.est-meta { font-family: Arial, sans-serif; font-size: 12px; margin-top: 14px; text-align: right; }
/* v7.3 — Date / Estimate No. alignment audit: the two labels ("Date"
   vs "Estimate No.") have different widths, so with plain inline
   layout the two inputs started at different x positions. Each row
   is now a flex row with a fixed-width label column, so both inputs
   share one left edge, one right edge (same 160px width) and one
   baseline, at the same row height. */
.est-meta label { font-weight: bold; color: var(--est-ink); text-transform: uppercase; font-size: 11px; flex: 0 0 120px; text-align: left; margin-right: 0; }
/* v7.2 — Date / Estimate No. match every other field on the
   document: white background, dark text, same border and type.
   (Previously they rendered as dark boxes in dark mode because
   native date/number controls follow color-scheme.) */
.est-meta input { background: #fff; color: #1f2d3a; border: 1px solid var(--est-border); border-radius: 4px; height: 28px; box-sizing: border-box; padding: 1px 6px; line-height: 1; font-size: 16px; font-family: "Lora", Georgia, serif; text-align: right; width: 160px; }
.est-meta input:hover, .est-meta input:focus { border-color: #9fb3c8; background: #f7fbff; outline: none; }
.est-meta .row { display: flex; align-items: center; justify-content: flex-end; padding: 4px 0; border-bottom: 1px solid var(--est-border); }

.est-linked-note { font-family: Arial, sans-serif; font-size: 12.5px; color: var(--est-ink); background: #f2f6f9; border: 1px solid var(--est-border); border-radius: 4px; padding: 8px 10px; margin: 0 0 14px; }
/* v7.15 — "Project: PRJ-…" on the document, next to the number.
   It prints, like the linked-estimate note above it. */
.est-project-line { font-family: Arial, sans-serif; font-size: 12.5px; color: var(--est-ink); background: #f2f6f9; border: 1px solid var(--est-border); border-radius: 4px; padding: 8px 10px; margin: 0 0 14px; }
.est-saved-list .doc-project { color: var(--est-ink); font-size: 12px; font-weight: bold; }
.est-saved-list select.doc-assign { padding: 6px 8px; border: 1px solid #9fb3c8; border-radius: 6px; font-size: 16px; font-family: "Lora", Georgia, serif; background: #fff; color: #1f2d3a; max-width: 220px; }

/* v7.3 — Bill To alignment audit (verified, no change needed):
   Client Name / Project Address are full-width fields and Client
   Email / Client Phone sit in one 2-column grid (.est-grid2, equal
   1fr columns, 12px gap); all four share one label style (11px
   bold uppercase, 2px below-label gap) and one input style (13px,
   4px 2px padding, bottom border only, 8px field gap), so labels,
   inputs and underlines all sit on the same baselines and the
   email/phone pair is level side by side. */
.est-fields { font-family: Arial, sans-serif; font-size: 13px; margin: 25px 0 15px; }
/* v13 (Igor, item 14) — the .bill-to-label rule is gone with
   the heading it styled. */
.est-fields .field { margin-bottom: 8px; }
.est-fields label { display: block; font-size: 11px; font-weight: bold; color: var(--est-ink); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 2px; }
.est-fields input { width: 100%; border: none; border-bottom: 1px solid var(--est-border); padding: 1px 2px; line-height: 1.15; font-size: 16px; font-family: "Lora", Georgia, serif; background: transparent; }
.est-fields input:focus { outline: 1px dashed #9fb3c8; background: #f7fbff; }
.est-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. */
.est-grid2 > * { min-width: 0; }
/* Notes fields (v15, Igor, item 7): a notes field is always
   visible at single-field height and grows IN PLACE as text
   outgrows it — never resizable by hand (the field grows
   itself) and no scrollbar inside the field. The "+" toggle
   is GONE. */
textarea.notes-autogrow { resize: none; overflow: hidden; }
.notes-label-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.notes-label-row label { margin-bottom: 0; }

/* Line-item table: exactly 4 columns + screen-only remove column.
   Description takes the remaining width; Qty / Unit Price / Total
   are fixed at 88px each via colgroup.
   v7.3 — items-table alignment audit (verified, no change needed):
   all header cells share one padding (9px 10px) and the three
   numeric headers are right-aligned; all body cells share one
   padding (8px 10px) with vertical-align: top, so Qty / Unit Price
   / Total inputs and the line-total span all start on one top
   baseline in every row; the × button is 22px in its fixed 36px
   column, top-aligned with the row. Row heights grow together
   when a description wraps. */
table.est-items { width: 100%; border-collapse: collapse; margin-top: 20px; font-family: Arial, sans-serif; font-size: 12.5px; table-layout: fixed; }
table.est-items col.col-num { width: 88px; }
table.est-items col.col-x { width: 36px; }
table.est-items thead th { background: var(--est-bar); color: #fff; text-transform: uppercase; font-size: 11px; letter-spacing: .5px; padding: 9px 10px; text-align: left; font-weight: 600; }
table.est-items thead th.num { text-align: right; }
table.est-items tbody td { border: 1px solid var(--est-border); padding: 8px 10px; vertical-align: top; }
table.est-items tbody tr:nth-child(even) { background: var(--est-stripe); }
table.est-items tr, table.est-items td { break-inside: avoid; page-break-inside: avoid; }
.est-items input, .est-items select { width: 100%; border: none; background: transparent; font-family: "Lora", Georgia, serif; font-size: 16px; padding: 2px; }
.est-items input:focus, .est-items select:focus { outline: 1px dashed #9fb3c8; background: #f7fbff; }
.est-items .num input { text-align: right; }
.est-items .num .line-total { display: block; text-align: right; padding: 2px; }
/* v13 (Igor, item 13) — the description combobox: ONE field.
   The wrapper is position: relative so the dropdown list hangs
   below the text field; the list is site-styled (white card,
   navy border), scrollable, full-width of the cell, works at
   402px. The chevron on the text field is the same SVG the old
   service dropdown used — tapping the field opens the list.
   The list stays white in both themes: it hangs over the
   document paper, which is light in dark mode too. */
.desc-combo { position: relative; }
.desc-combo .desc-text { padding-right: 22px; 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 4px center; }
.desc-text::placeholder { color: #888; }
.desc-combo-list { position: absolute; top: 100%; left: 0; right: 0; z-index: 20; max-height: 180px; overflow-y: auto; background: #fff; color: #1f2d3a; border: 1px solid #1d2d44; border-radius: 6px; box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2); padding: 2px; box-sizing: border-box; }
.desc-combo-item { display: block; width: 100%; box-sizing: border-box; text-align: left; background: none; border: none; padding: 8px 10px; font-family: "Lora", Georgia, serif; font-size: 13px; color: #1f2d3a; cursor: pointer; border-radius: 4px; }
.desc-combo-item:hover, .desc-combo-item--active { background: #e8f0fe; }
.desc-text { display: block; width: 100%; min-height: 20px; resize: none; overflow: hidden; border: none; background: transparent; font-family: "Lora", Georgia, serif; font-size: 16px; line-height: 1.45; padding: 2px; }
.desc-text:focus { outline: 1px dashed #9fb3c8; background: #f7fbff; }
.est-remove { background: #c0392b; color: #fff; border: none; border-radius: 3px; width: 22px; height: 22px; cursor: pointer; font-size: 13px; line-height: 1; }
.est-add { background: #1d2d44; color: #fff; border: 1px solid #1d2d44; min-height: 38px; padding: 9px 16px; border-radius: 6px; cursor: pointer; font-size: 13px; font-family: "Lora", Georgia, serif; margin-top: 10px; }
.est-add:hover { background: #324357; border-color: #324357; }

.est-end { /* v7.9 — NO break-inside:avoid here: this wrapper holds
   totals + signature + warranty (~5-6in together). With avoid, the
   browser pushed the WHOLE block to page 2 whenever it did not fit
   in the space left on page 1, so even a 1-line estimate printed
   on 2 pages. Each block below keeps its own avoid instead, so
   totals stay on page 1 and the rest flows after them. */ }
.est-totals { margin-top: 22px; display: flex; justify-content: flex-end; }
.est-totals table { font-family: Arial, sans-serif; font-size: 13px; width: 360px; }
.est-totals td { padding: 6px 4px; vertical-align: middle; }
.est-totals tr.line td { border-top: 1px solid #333; }
.est-totals td.tlabel { font-weight: bold; color: var(--est-ink); white-space: nowrap; }
.est-totals td.tval { text-align: right; white-space: nowrap; }
.est-totals td.tnote { font-size: 10.5px; color: #666; text-align: right; padding-top: 0; }
/* v7.3 — totals alignment audit: the Deposit row held a bordered
   input (~28px tall) while Quote Total / Remaining Balance held
   plain text, so the rows had different heights and the amounts
   sat on different baselines. Every amount cell now uses the same
   28px line, and the inputs are fixed to 28px (border-box) and
   vertically centred against the "$", so all three amount rows
   are the same height with labels and amounts on one baseline.
   The note rows (.tnote) are untouched — small text, own rows. */
.est-totals td.tlabel, .est-totals td.tval { line-height: 28px; }
.est-totals td.tval input { vertical-align: middle; }
/* v7.2 — Deposit amount (and Deposit Paid) use the same light
   field as the other totals: white background, dark text, same
   13px Arial, right-aligned, one line, no dark box. */
.est-totals input { width: 110px; height: 28px; box-sizing: border-box; text-align: right; background: #fff; color: #1f2d3a; border: 1px solid var(--est-border); border-radius: 4px; padding: 1px 6px; line-height: 1; font-size: 16px; font-family: "Lora", Georgia, serif; }
.est-totals input:hover, .est-totals input:focus { border-color: #9fb3c8; background: #f7fbff; outline: none; }
.est-sig { margin-top: 70px; font-family: Arial, sans-serif; font-size: 13px; break-inside: avoid; page-break-inside: avoid; }
.est-sig .label { font-weight: bold; color: var(--est-ink); margin-bottom: 26px; display: block; }
.est-sig-line { border-bottom: 1px solid #333; width: 320px; margin-bottom: 22px; padding-bottom: 4px; font-size: 11px; color: var(--est-ink); font-weight: bold; }

.est-warranty { margin-top: 22px; font-family: Arial, sans-serif; font-size: 12px; line-height: 1.55; break-inside: avoid; page-break-inside: avoid; }
.est-warranty h2 { font-size: 13px; color: var(--est-ink); text-transform: uppercase; letter-spacing: .5px; margin: 0 0 6px; }
.est-warranty p { margin: 0 0 8px; }
.est-warranty textarea { width: 100%; min-height: 36px; font-family: Arial, sans-serif; font-size: 12px; line-height: 1.5; border: 1px dashed transparent; padding: 4px; }
.est-warranty textarea:hover, .est-warranty textarea:focus { border-color: #9fb3c8; background: #f7fbff; outline: none; }

/* ---------- Print: Letter, fit short docs on one page ---------- */
/* v12 (item 10) — printed PDF: the browser's own print header
   (the page URL on the left, date + "Page X of Y" on the right)
   is one unit — it only exists inside the @page margins. The top
   margin is 0, so there is no room for the browser header at all;
   the bottom margin (0.6in) holds ONLY the page's own page number,
   drawn by an @page margin box. Chrome evaluates counter(page) /
   counter(pages) ONLY inside @page margin boxes — in a fixed
   element's ::after they come out "Page 0 of 0" — so the number
   lives in @bottom-right, not in a footer div. And @page :first
   has margin 0: Chromium suppresses its own headers/footers
   document-wide when the first page has no room for them, so the
   URL stays gone even though later pages have a bottom margin.
   Trade-off (CSS limitation, not a bug): page 1 carries no page
   number — its margins are 0. Pages 2+ show "Page X of Y". The
   PDF-button PDF (item 9) numbers every page including page 1. */
@page {
  size: Letter;
  margin: 0 0 0.6in 0;
  @bottom-right {
    content: "Page " counter(page) " of " counter(pages);
    font-family: Arial, sans-serif;
    font-size: 10px;
    color: #555;
  }
}
@page :first { margin: 0; }
@media print {
  body { background: #fff !important; margin: 0; padding: 0; }
  .no-print { display: none !important; }
  .est-wrap { max-width: none; margin: 0; padding: 0; }
  .est-page { box-shadow: none; background: #fff !important; }
  .est-content { background: #fff !important; }
  .est-content { padding: 0.5in; }
  .est-remove { display: none !important; }
  table.est-items thead { display: table-header-group; }
  /* FIX F1 — the doc-editor fields are 16px Lora ON SCREEN only:
     printed output keeps the current 12–13px Arial (and the
     meta/totals inputs keep their printed heights). */
  .est-meta input { font-size: 12px; font-family: Arial, sans-serif; height: 17px; }
  .est-fields input { font-size: 13px; font-family: Arial, sans-serif; }
  .est-items input, .est-items select, .desc-text { font-size: 12.5px; font-family: Arial, sans-serif; }
  .est-totals input { font-size: 13px; font-family: Arial, sans-serif; height: 20px; }
  table.est-items tr, table.est-items td, .est-warranty, .est-sig, .est-totals { break-inside: avoid; page-break-inside: avoid; }
  /* v7.9 — print tightening so a short doc fits on one Letter page:
     .est-end is NOT in the avoid list above (see its note); the
     signature gap and section margins are cut in print only. */
  .est-head { margin-bottom: 20px; }
  .est-fields { margin: 16px 0 10px; }
  table.est-items { margin-top: 12px; }
  .est-totals { margin-top: 14px; }
  .est-sig { margin-top: 30px; }
  .est-warranty { margin-top: 14px; }
  input, select, textarea { border: none !important; background: transparent !important; }
  /* Full wrapped description text must show in print. */
  .desc-text { overflow: visible !important; height: auto !important; }
  #conditionsText { overflow: visible !important; height: auto !important; }
  a { text-decoration: none; color: inherit; }
}

/* === v7.13 — Mobile portrait (iPhone 18 Pro, 402px) ===
   Root causes of the portrait overflow Igor reported: .est-content
   kept its 45px side padding on a ~370px-wide page (only ~280px
   left for the document), while the items table needs 300px of
   fixed columns and the totals table is a fixed 360px — so the
   table, totals and signature line all pushed the page wider than
   the screen, and the header, meta rows and options labels clipped.
   Fixes: tighter content padding on small screens; the document
   header stacks; the items table scrolls inside its own wrapper
   (the page itself never scrolls sideways); totals go full-width
   up to 360px; the signature line caps at 100%; options labels may
   wrap; Bill To email/phone stack. Print is unaffected: the page
   is Letter width there, and the wrapper is forced visible. */
.est-items-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
@media (max-width: 520px) {
  .est-wrap { padding: 16px 10px 48px; }
  /* Buttons round (Igor, item 1): the project-box bottom row only
     gets a 66px equal share when the outer card keeps 16px side
     padding — the chain is .est-start (16px) > .prj-card (10px) >
     .prj-list li (12px), and "Reopen project" needs ~77px at 11px
     (~70px at 10px). 8px here + 8px on the card + 8px on the box
     frees ~32px of container, ~8px of share, so the row fits. */
  .est-start { padding: 18px 8px; }
  .est-toolbar { padding: 10px; }
  .est-presets label { white-space: normal; }
  .est-content { padding: 24px 16px; }
  .est-head { flex-direction: column; gap: 12px; }
  .est-brand img { width: 48px; height: 48px; }
  .est-company { font-size: 18px; }
  .est-doc-title { font-size: 22px; text-align: left; }
  .est-meta { text-align: left; }
  .est-meta .row { justify-content: flex-start; }
  .est-meta label { flex: 0 0 100px; }
  .est-meta input { width: 140px; }
  .est-grid2 { grid-template-columns: minmax(0, 1fr); }
  /* v7.15 — STACKED CARD ROWS (replaces the 480px scrolling table).
     The v7.13 wrapper let the table scroll sideways inside the
     document, but on Igor's iPhone the table still came out wider
     than the screen — Qty was crushed/missing and the whole
     document read as cut off on the right. A 480px fixed table
     simply cannot fit a 402px (or 360px) phone, whatever wraps it.
     At <=520px each line item is now a card: Description on top,
     then Qty / Unit Price / Total in one row below it (each with
     its small label above the input, from the data-label set in
     addRow), with the red x in the card's top-right corner. Every
     field is visible without scrolling anything sideways, and the
     page itself never moves. Print is untouched: the media query
     is screen-only, so the printed/PDF document keeps the
     4-column table. */
  .est-items-scroll { overflow: visible; }
  table.est-items { min-width: 0; width: 100%; table-layout: auto; }
  table.est-items thead { display: none; }
  table.est-items, table.est-items tbody { display: block; }
  table.est-items tbody tr { display: grid; grid-template-columns: 1fr 1fr 1fr; column-gap: 10px; position: relative; border: 1px solid var(--est-border); border-radius: 6px; margin-bottom: 10px; padding: 12px 12px 10px; background: #fff; }
  table.est-items tbody tr:nth-child(even) { background: #f8f8f8; }
  table.est-items tbody td { display: block; border: none; padding: 2px 0; }
  table.est-items tbody td.desc-cell { grid-column: 1 / -1; }
  table.est-items tbody td.num::before { content: attr(data-label); display: block; font-size: 11px; font-weight: bold; text-transform: uppercase; letter-spacing: .5px; color: var(--est-ink); margin-bottom: 2px; }
  table.est-items tbody td.num input { text-align: left; }
  table.est-items tbody td.num .line-total { text-align: left; }
  table.est-items tbody td.no-print { position: absolute; top: 8px; right: 8px; padding: 0; }
  .est-remove { width: 30px; height: 30px; font-size: 16px; }
  /* v7.15 — meta rows stack: label above the input, input full
     width. The fixed 120px label + 160px input no longer applies
     on a phone, so Date / Estimate No. can never be cut off. */
  .est-meta .row { flex-direction: column; align-items: stretch; }
  .est-meta label { flex: none; text-align: left; }
  .est-meta input { width: 100%; }
  /* v13 (item 11) — the Project No. value stacks full-width
     with the input above it, right-aligned like it. */
  .est-meta .est-meta-num { width: 100%; }
  .est-saved-list select.doc-assign { width: auto; max-width: 100%; flex: 1 1 180px; }
  /* v7.17 — the Project assign select in the options row: its
     longest option (client + long address) sets its min-content
     width, and flex items default to min-width:auto, so without
     min-width:0 the select (and its label) forced the whole
     document wider than the phone — the page came out 433px wide
     at a 402px viewport. min-width:0 on both lets them shrink
     to the space available. */
  .est-presets label { min-width: 0; }
  .est-totals table { width: 100%; max-width: 360px; }
  .est-totals input { width: 100px; }
  .est-sig-line { width: 100%; max-width: 320px; }
}
@media (max-width: 360px) {
  .est-content { padding: 20px 12px; }
  /* v7.15 — meta rows stay stacked here too (label above input,
     input full width); the old fixed 84px/120px sizes are gone. */
}
@media print {
  .est-items-scroll { overflow: visible !important; }
  table.est-items { min-width: 0 !important; }
}

/* ================================================================
   v7.15 — staff-page background, Light/Dark,
   project picker, mobile reflow fixes
   (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. */

/* --- Project picker dialog --- */
.est-picker-overlay {
  position: fixed; inset: 0; z-index: 50; background: rgba(0, 0, 0, 0.55);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 40px 16px; overflow-y: auto;
}
.est-picker-overlay[hidden] { display: none; }
.est-picker {
  background: #fff; border: 1px solid var(--est-border); border-radius: 10px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3); padding: 24px 22px;
  width: 100%; max-width: 520px; font-family: "Lora", Georgia, serif;
}
.est-picker h2 { font-size: 18px; color: var(--est-ink); margin: 0 0 6px; font-family: "Cinzel", Georgia, serif; }
.est-picker-sub { font-size: 13.5px; color: #555; margin: 0 0 14px; line-height: 1.5; }
/* v14 (Igor, item 20) — the reserved PRJ number under the
   "+ New Project" title: same size and spacing as the subtitle
   it replaces, number in bold. Alignment is PER STEP (Igor,
   2026-11-25 17:32 CST, clarifying items 20 vs 21): on the
   CHOICE step (new / returning) the title AND the number are
   CENTERED (the picker-title-centered class on the overlay);
   on the FORM steps (new-customer form, returning search,
   job address) both are ALIGNED LEFT, like everything else
   in the picker. */
.picker-prj-no { font-size: 14px; margin: 0 0 14px; line-height: 1.5; }
#projectPicker.picker-title-centered #projectPickerTitle { text-align: center; }
#projectPicker.picker-title-centered .picker-prj-no { text-align: center; }
/* v14 (Igor, item 21) — the "same as billing" checkbox row
   under the Project address label: the caption is TWICE
   SMALLER than the label text (0.5em — the same "twice
   smaller" pattern as the status date stamps); the checkbox
   itself is the site's navy 16px box (accent-color #1d2d44,
   like the other checkboxes). Tapping the caption toggles
   the box (it is a <label>). */
.picker-same-row { display: flex; align-items: center; gap: 6px; font-size: 11px; margin: 0 0 6px; }
.picker-same-row input[type="checkbox"] { margin: 0; flex: 0 0 auto; width: 16px; height: 16px; accent-color: #1d2d44; }
/* v15 (Igor, item 2) — the caption is 75% of the PROJECT
   ADDRESS label's font size: the row and the label are both
   11px, so 0.75em = 8.25px. */
.picker-same-text { font-size: 0.75em; line-height: 1.3; cursor: pointer; }
/* v15 (Igor, item 3) — the gap above the BILLING ADDRESS label
   (when the billing block appears) matches the 12px spacing
   between the popup's fields. */
#pickerNCBillAddressBlock { margin-top: 12px; }
/* v14 (Igor, item 20) — Cancel sits ONE ROW BELOW the actions
   row, ALIGNED CENTER, HALF THE SIZE it was (half the row
   width; same height and text size as before). */
.picker-cancel-row { display: flex; justify-content: center; margin-top: 10px; }
.picker-cancel-row .est-btn { flex: 0 0 50%; max-width: 50%; }
/* v23 (Igor, item 44) — the job-address step's buttons stack ONE
   ON TOP OF THE OTHER, CENTERED horizontally (Create project on
   top, Cancel below), both the same width as the shared Cancel
   row above. Same layout in both modes; the disabled Create
   (no address chosen yet) reads inactive in both modes too. */
.picker-jobaddr-actions { flex-direction: column; align-items: center; margin-top: 12px; }
.picker-jobaddr-actions .est-btn { flex: 0 0 50%; max-width: 50%; }
.picker-jobaddr-actions .est-btn:disabled { background: #e8ebee; color: #aab2bb; border-color: #d5d9de; cursor: not-allowed; }
html[data-theme="dark"] .picker-jobaddr-actions .est-btn:disabled { background: #2a313c; color: #6b7686; border-color: #3a4454; }
/* v14 (Igor, item 22) — on the new-customer step the Save
   button sits LEFT and Cancel sits RIGHT in the SAME row
   (the shared Cancel row above is hidden on that step). */
#pickerNCCancelBtn { margin-left: auto; }
.est-picker-list { list-style: none; margin: 0 0 16px; padding: 0; }
.est-picker-list li { margin-bottom: 6px; }
.est-picker-project {
  display: block; width: 100%; text-align: left; padding: 9px 14px;
  background: #fff; color: #1f2d3a; border: 1px solid #1f2d3a; border-radius: 6px;
  cursor: pointer; font-size: 13px; font-family: "Lora", Georgia, serif; min-height: 38px; box-sizing: border-box;
}
.est-picker-project:hover { background: #f2f6f9; }
.est-picker-empty { font-size: 13px; color: #555; }
/* v8 fix — PICKER, STANDARDIZED: one clear order — (1) pick an
   existing project, (2) create a new project, (3) continue
   without one. The two steps are visually separated under
   small-caps section titles; the new-project form only shows
   when "+ Create a new project" is chosen (or from the start in
   "+ New Project" mode). ONE label style (.picker-label: 11px
   bold uppercase, .5px) and ONE field style (main-site
   contact-form tokens: Lora 15px, 14px radius) everywhere, with
   consistent 12px spacing. Dates sit side by side on desktop,
   stacked on mobile. */
.picker-section-title { font-size: 11px; font-weight: bold; color: var(--est-ink); text-transform: uppercase; letter-spacing: .5px; margin: 0 0 8px; font-family: "Lora", Georgia, serif; }
#pickerListSection { margin-bottom: 16px; }
#pickerNewSection { border-top: 1px solid var(--est-border); padding-top: 14px; margin-bottom: 14px; }
#pickerShowNewBtn { margin-bottom: 12px; }
.est-picker-new { padding-top: 2px; }
.picker-field { margin-bottom: 12px; }
.picker-label { display: block; font-size: 11px; font-weight: bold; color: var(--est-ink); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 4px; font-family: "Lora", Georgia, serif; }
.picker-field input, .picker-field textarea, .picker-field select { display: block; width: 100%; box-sizing: border-box; }
.picker-dates { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; min-width: 0; }
/* Dates round (Igor, item 5): same grid-blowout guard as
   .est-grid2 / .prj-grid2 — a date input's intrinsic minimum
   width must not push its column past the picker edge. */
.picker-dates > * { min-width: 0; }
@media (max-width: 520px) { .picker-dates { grid-template-columns: minmax(0, 1fr); } }
.est-picker-actions { display: flex; flex-wrap: wrap; gap: 10px; }
/* v8 one-page (Igor, step 4) — the New/Returning choice row: two
   equal primary buttons in one row (the .est-actions--equal
   equal-width rule applies); tighter bottom margin inside the
   picker so the choice sits close to the picker edge. */
.picker-choice-row { margin-bottom: 8px; }
.picker-choice-row .est-btn { min-width: 0; }
.est-picker-status { font-size: 13px; color: #555; margin: 12px 0 0; min-height: 18px; }

/* --- Dark mode: the whole chrome goes dark; the paper does not ---
   Cards, toolbars, list, forms, buttons and the options row use the
   site's dark tokens (#10121a / #1a1f26 surfaces, #eef1f6 text,
   #5b729f primary). The estimate/invoice DOCUMENT stays a light
   paper sheet — soft grey (#dcdcdc) in dark mode instead of stark
   white, so it is easy on the eyes but the dark text on it stays
   clearly readable. Print forces the paper back to white (above). */
html[data-theme="dark"] .est-start,
html[data-theme="dark"] .est-toolbar,
html[data-theme="dark"] .est-ids-box,
html[data-theme="dark"] .est-presets,
html[data-theme="dark"] .est-picker { background: #161b24; border-color: rgba(255, 255, 255, 0.14); color: #eef1f6; }
html[data-theme="dark"] .est-start h1,
html[data-theme="dark"] .est-start h2,
html[data-theme="dark"] .est-picker h2 { color: #eef1f6; }
html[data-theme="dark"] .est-start-sub,
html[data-theme="dark"] .est-saved-status,
html[data-theme="dark"] .est-drive-status,
html[data-theme="dark"] .est-picker-sub,
html[data-theme="dark"] .est-picker-empty,
html[data-theme="dark"] .est-picker-status { color: #c0c7d6; }
html[data-theme="dark"] .est-saved-list li { background: #1a1f26; border-color: rgba(255, 255, 255, 0.14); }
html[data-theme="dark"] .est-saved-list .doc-no,
html[data-theme="dark"] .est-saved-list .doc-total,
html[data-theme="dark"] .est-saved-list .doc-project { color: #eef1f6; }
html[data-theme="dark"] .est-saved-list .doc-status,
html[data-theme="dark"] .est-saved-list .doc-client { color: #c0c7d6; }
html[data-theme="dark"] .est-btn--primary,
html[data-theme="dark"] .est-saved-list button,
html[data-theme="dark"] .est-add { background: #5b729f; border-color: #5b729f; }
html[data-theme="dark"] .est-btn--primary:hover,
html[data-theme="dark"] .est-saved-list button:hover,
html[data-theme="dark"] .est-add:hover { background: #4a628f; border-color: #4a628f; }
html[data-theme="dark"] .est-btn--secondary,
html[data-theme="dark"] .est-toolbar button.secondary,
html[data-theme="dark"] .est-saved-list button.secondary { background: #1a1f26; color: #eef1f6; border-color: rgba(255, 255, 255, 0.22); }
html[data-theme="dark"] .est-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, not
   from a page-theme override. (Old dark .theme-toggle rules
   deleted.) */
html[data-theme="dark"] .est-ids-box,
html[data-theme="dark"] .est-presets { color: #eef1f6; }
html[data-theme="dark"] .est-ids-box label,
html[data-theme="dark"] .est-presets label { color: #eef1f6; }
/* v13 (Igor, item 15 — dark mode) — the number + status box
   had NO dark overrides: the EST / INV / PRJ numbers and
   their labels were dark navy (#1f2d3a) on the dark box
   (#161b24), nearly invisible. The linked numbers use the
   dark link blue, the timestamp the muted grey. */
html[data-theme="dark"] .est-id-num,
html[data-theme="dark"] .est-id-label { color: #eef1f6; }
html[data-theme="dark"] button.est-id-num,
html[data-theme="dark"] .est-id-linked-num { color: #9db8e8; }
html[data-theme="dark"] .est-id-linked-ts { color: #c0c7d6; }
html[data-theme="dark"] .est-presets-title { color: #eef1f6; border-color: rgba(255, 255, 255, 0.22); }
html[data-theme="dark"] .est-warranty-line { color: #eef1f6; }
html[data-theme="dark"] .est-warranty-toggle { background: #1a1f26; color: #eef1f6; border-color: rgba(255, 255, 255, 0.22); }
html[data-theme="dark"] .est-warranty-toggle[aria-pressed="true"] { background: #1d2d44; color: #fff; }
/* v17 — Project Overview box, section title and one-line bars:
   same layout, corresponding dark colours only. The navy bar
   keeps the site's navy in both themes, like the staff header. */
html[data-theme="dark"] .doc-section-title { color: #eef1f6; }
/* v19 (item 2) — the contract bar keeps the navy bar in dark
   mode too, like the Project Overview bar (same layout,
   corresponding colours only). v19 (item 6) — the save-lock
   plain-text fields stay readable on the paper in dark mode:
   the document paper is light in both themes, so the locked
   values stay dark ink. */
html[data-theme="dark"] .doc-contract-bar { background: #1d2d44; color: #fff; }
html[data-theme="dark"] .doc-contract-bar:hover { background: #324357; }
html[data-theme="dark"] .proj-overview,
html[data-theme="dark"] .doc-linked-line,
html[data-theme="dark"] .est-collapsed-line { background: #161b24; border-color: rgba(255, 255, 255, 0.14); color: #eef1f6; }
html[data-theme="dark"] .v18-bar-stamp { color: #c0c7d6; }
html[data-theme="dark"] button.v17-line-num,
html[data-theme="dark"] button.v17-line-inv { color: #9db8e8; }
/* v24 (item 13) — the doc overview's contact block shares one
   secondary colour in dark mode too. */
html[data-theme="dark"] .proj-overview-phone,
html[data-theme="dark"] .proj-overview-email,
html[data-theme="dark"] .proj-overview-street,
html[data-theme="dark"] .proj-overview-rest { color: #c0c7d6; }
html[data-theme="dark"] .proj-overview-compose { border-top-color: rgba(255, 255, 255, 0.14); }
html[data-theme="dark"] .proj-overview-compose input[type="text"],
html[data-theme="dark"] .proj-overview-compose textarea { color-scheme: dark; }
html[data-theme="dark"] .proj-overview-compose-status { color: #c0c7d6; }
html[data-theme="dark"] .est-presets input[type="date"] { color-scheme: dark; }
/* v8 fix — DARK-MODE LABELS (Igor): the customer-form labels
   (Customer Name, Phone, Email, Company, Source, Billing
   address, Notes, Addresses, Unassigned project/document) use
   .est-fields label — dark navy with no dark override — so in
   dark mode they were nearly invisible on the dark page. The
   Bill To labels on the light document paper must STAY dark, so
   the override is scoped to the off-paper customer forms only
   (.cust-fields, .cust-assign), light mode unchanged. */
html[data-theme="dark"] .est-fields.cust-fields label,
html[data-theme="dark"] .est-fields.cust-assign label { color: #eef1f6; }
html[data-theme="dark"] .est-presets input[type="number"],
html[data-theme="dark"] .est-saved-list select.doc-assign,
html[data-theme="dark"] .est-picker-new input,
html[data-theme="dark"] .est-picker-project { background: #1a1f26; color: #eef1f6; border-color: rgba(255, 255, 255, 0.22); }
html[data-theme="dark"] .est-picker-project:hover { background: #232a36; }
html[data-theme="dark"] .picker-label, html[data-theme="dark"] .picker-section-title { color: #eef1f6; }
html[data-theme="dark"] .est-save-status { color: #81c995; }
html[data-theme="dark"] .est-save-status.error { color: #ff8a80; }
html[data-theme="dark"] .est-saved-status.error { color: #ff8a80; }
html[data-theme="dark"] .est-autosave { color: #b9bec7; }
html[data-theme="dark"] .est-autosave.error { color: #ff8a80; }
/* Paper in dark mode: soft grey, not stark white (screen only). */
html[data-theme="dark"] .est-page { background: #dcdcdc; box-shadow: 0 0 16px rgba(0, 0, 0, 0.5); }
/* The paper stays LIGHT in dark mode, so everything printed on it
   keeps dark text. Without this, color-scheme: dark makes the
   browser render native inputs white-on-transparent — white text
   on the grey paper (contrast 1.37, unreadable) for the Bill To
   fields and the line-item inputs, which use a transparent
   background. The meta/totals inputs already set their own colours
   and are unaffected. */
html[data-theme="dark"] .est-page input,
html[data-theme="dark"] .est-page select,
html[data-theme="dark"] .est-page textarea { color: #1f2d3a; color-scheme: light; }
@media screen and (max-width: 520px) {
  html[data-theme="dark"] table.est-items tbody tr { background: #dcdcdc; border-color: #b9b9b9; }
  html[data-theme="dark"] table.est-items tbody tr:nth-child(even) { background: #d2d2d2; }
}

/* ================================================================
   v7.17 — staff header (logo-only, like the main site header),
   uniform 38px buttons, main-site form controls, Projects-first
   start screen. 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).
   The invoice DOCUMENT's own paper fields are NOT restyled here
   — they print as the invoice template. Only the tool chrome
   (options row, picker, assign select, tabs) gets the main-site
   treatment. */
: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);
}

/* --- 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 projects.css. */
.staff-drawer a[hidden] { display: none; }
/* v8 one-page (Igor, step 2) — GLOBAL SEARCH BAR: one full-width
   search field right below the header (under the header, above
   the start screen). The field itself reuses .prj-search-wrap
   (projects.css: magnifier, clear ×, main-site form tokens); this
   only sizes the bar to the page. Visible whenever the start
   screen is visible; hidden on detail/document screens
   (estimate.js syncGlobalSearch). */
#globalSearchWrap { width: 100%; max-width: 850px; margin: 0 auto 8px; flex: none; }
#globalSearchWrap[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; }
}

/* --- Main-site form controls on the tool chrome ---
   Same tokens as above (Lora stack, 14px radius, navy-tinted
   border, navy focus border + 3px ring). Compact size here
   (38px min-height, 13px) so the options row and the assign
   select sit neatly next to the 38px buttons. */
.est-saved-list select.doc-assign {
  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 30px 4px 10px; min-height: 27px; box-sizing: border-box;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  /* v7.19 — no generic browser dropdown: a proper chevron, same
     as the main site's fields would show. appearance:none hides
     the native arrow; the SVG is the replacement. */
  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 10px center;
}
.est-saved-list select.doc-assign:focus {
  outline: none; border-color: var(--staff-input-focus);
  box-shadow: 0 0 0 3px var(--staff-focus-ring);
}
/* v13 (Igor, item 10) — the Deposit % input is TWICE SMALLER
   vertically than the old 38px field: 19px high, same width.
   It keeps the pre-settings box's plain white styling (the
   box is a fixed white surface in both themes); only the
   height changes. */
.est-presets #depositPct {
  height: 28px; min-height: 28px; padding: 1px 6px; box-sizing: border-box;
}
.est-presets #depositPct:focus {
  outline: none; border-color: #1d2d44;
  box-shadow: 0 0 0 3px rgba(29, 45, 68, 0.45);
}
/* Picker fields: full main-site size (12px padding, 15px Lora)
   — standalone fields, not inline next to buttons. The Work
   type select uses the same styled-select treatment as the other
   staff selects (appearance:none + SVG chevron — no generic
   browser dropdown). */
.est-picker-new input,
.est-picker-new textarea {
  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;
}
.est-picker-new 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: 5px 30px 5px 12px; min-height: 34px; box-sizing: border-box;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  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 10px center;
}
.est-picker-new input:focus,
.est-picker-new textarea:focus,
.est-picker-new select:focus {
  outline: none; border-color: var(--staff-input-focus);
  box-shadow: 0 0 0 3px var(--staff-focus-ring);
}
.est-picker-new input::placeholder { color: var(--staff-input-placeholder); }
html[data-theme="dark"] .est-picker-new input,
html[data-theme="dark"] .est-picker-new textarea,
html[data-theme="dark"] .est-picker-new select,
html[data-theme="dark"] .est-presets input[type="number"] {
  background-color: var(--staff-input-bg); color: var(--staff-input-text);
  border-color: var(--staff-input-border);
}
html[data-theme="dark"] .est-picker-new 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");
  background-repeat: no-repeat; background-position: right 10px center;
}
/* v7.19 — dark chevron (background-color, NOT the background
   shorthand, so the SVG chevron above survives). */
html[data-theme="dark"] .est-saved-list select.doc-assign {
  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");
}

/* --- Customers view (v7.18) ---
   v14 (Igor, item 19, 16:58 CST) — NO "+ New Customer" button
   any more (the .cust-top-row button row is gone): the search
   bar with Sort/Period sits directly under the "Customers"
   heading, first inside #startCustomersView; the customer list
   below reuses the .est-saved-list rows. */
/* v13 (Igor, items 19+21) — the count lines at the very bottom of
   each list ("N customers" / "N projects", no dot) sit CENTERED
   under the "Download backup" button. */
.cust-count { text-align: center; margin: 10px 0 0; }
.prj-total-count { font-size: 13px; color: #555; text-align: center; margin: 10px 0 0; }
html[data-theme="dark"] .prj-total-count { color: #c0c7d6; }
.cust-search { flex: 1 1 160px; min-width: 120px; }
.cust-search input { width: 100%; }
/* Customer detail: the address list (each address with its own
   remove button) and the add-address row, plus the assign rows. */
/* v7.19 — DARK-MODE INPUTS FIX (Igor: typing in the customer
   name/phone/email showed invisible text in dark mode, fine in
   light mode). ROOT CAUSE: the customer form reuses the
   document-paper rule .est-fields input — transparent background,
   no color of its own, and :focus sets background #f7fbff
   (near-white). On the dark page background the text inherits
   light (#eef1f6), so the moment the field is focused the text is
   light-on-near-white — invisible. The document's own Bill To
   fields sit on the light paper and are covered by the
   .est-page dark rule, so they are NOT touched here. The customer
   fields get the full main-site form
   treatment instead: token background + token text in BOTH themes,
   so typed text is readable focused or not, light or dark. */
.est-fields.cust-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;
}
.est-fields.cust-fields input::placeholder { color: var(--staff-input-placeholder); }
.est-fields.cust-fields input:focus {
  outline: none; border-color: var(--staff-input-focus);
  box-shadow: 0 0 0 3px var(--staff-focus-ring);
  background: var(--staff-input-bg);
}
/* v14 (Igor, item 9) — LOCKED fields: the editable control
   disappears into a read-only display of the value (label above
   stays, value stays as plain text). Locked text inputs lose
   their border and field background and read as text; tapping /
   clicking the value (or Enter / Space on it) unlocks it again.
   All colours come from the site tokens, so locked values read
   in light and dark alike. (v23 item 31 — the Source-select
   locked display and the additional-address locked inputs are
   gone with the profile page; the box has text inputs only.) */
.est-fields.cust-fields input.cust-locked-input { border-color: transparent; background: transparent; box-shadow: none; cursor: pointer; }
.est-fields.cust-fields input.cust-locked-input:focus { outline: none; border-color: transparent; box-shadow: none; }
.est-fields.cust-fields input.cust-locked-input:focus-visible { outline: 2px solid #516f9d; outline-offset: 2px; }

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

/* --- Three-view filter bars (v7.17) ---
   The same filter bar as the projects page (projects.css):
   styled search with icon + clear, compact sort, period with
   month / year / tax-year / custom-range wraps. Shared by all
   three views on this page; the wrap ids differ per view
   (vProj… / vEst… / vInv…), so the wrap rules match by id
   suffix. Search is main-site size (15px Lora, 12px padding);
   sort / period stay compact 38px. */
/* v23 (item 30) — the .prj-filter-bar container is GONE (its
   sub-fields moved INTO the search row's dropdown row,
   #projFilterRow — see the .global-search-row block). The
   shared field rules below stay: they are what the row's
   controls build on. */
.est-start .prj-filter-field {
  display: block; font-size: 11px; font-weight: bold; color: var(--est-ink);
  text-transform: uppercase; letter-spacing: .5px; font-family: "Lora", Georgia, serif;
  min-width: 0;
}
.est-start .prj-filter-field select,
.est-start .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;
  /* v14 (Igor, item 5) — background-color, NOT the background
     shorthand: the shorthand would reset background-repeat and
     background-position (the chevron tiling hazard the dark rules
     below guard against). Behaviour-identical here — the chevron
     image / repeat / position come from the ID-scoped rules. */
}
#projListScreen .prj-filter-field select {
  /* v7.19 — proper chevron, no native arrow.
     v9 fix — this rule must outrank the #projListScreen select ID
     rule (padding 12px, font 15px), or the Sort/Period dropdowns
     render 46px tall instead of half height. Full padding shorthand
     so it beats the ID rule's shorthand. */
  appearance: none; -webkit-appearance: none;
  padding: 4px 30px 4px 10px; min-height: 19px; font-size: 16px; 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;
}
.est-start .prj-filter-field select:focus,
.est-start .prj-filter-field input:focus {
  outline: none; border-color: var(--staff-input-focus);
  box-shadow: 0 0 0 3px var(--staff-focus-ring);
}
.est-start .prj-filter-field select::placeholder,
.est-start .prj-filter-field input::placeholder { color: var(--staff-input-placeholder); }
.est-start .prj-filter-sort { flex: 0 1 auto; }
/* v23 (item 30) — the sort select fills its equal grid column
   (the old content-sized `width: auto; min-width: 132px` is
   gone with the stacked layout; the row rule governs it). */
.est-start .prj-filter-sort select { width: 100%; min-width: 0; }
.est-start .prj-search-wrap {
  position: relative; flex: 1 1 220px; min-width: 0;
  display: flex; align-items: center;
}
.est-start .prj-search-wrap input[type="search"] {
  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;
}
.est-start .prj-search-wrap input[type="search"]::-webkit-search-cancel-button { display: none; }
.est-start .prj-search-wrap input[type="search"]::placeholder { color: var(--staff-input-placeholder); }
.est-start .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);
}
.est-start .prj-search-icon {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  color: #6c757d; pointer-events: none; flex-shrink: 0;
}
.est-start .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;
}
.est-start .prj-search-clear:hover { background: rgba(29, 45, 68, 0.08); color: #1f2d3a; }
.est-start .prj-search-clear:focus-visible { outline: 2px solid #516f9d; outline-offset: 1px; }
.est-start .prj-search-clear[hidden] { display: none; }
/* v23 (item 30) — the old `display: inline-flex` range-wrap
   rule is GONE with the filter bar: #projFilterRangeWrap is
   `display: contents` inside the dropdown row now (see the
   .global-search-row block), so its two labels are grid items. */
.est-start [id$="FilterRangeWrap"][hidden] { display: none; }
.est-start [id$="FilterMonthWrap"][hidden], .est-start [id$="FilterYearWrap"][hidden], .est-start [id$="FilterTaxWrap"][hidden] { display: none; }
.est-start .prj-date-wrap { position: relative; display: flex; align-items: center; margin-top: 2px; }
.est-start .prj-date-wrap input[type="date"] { padding-left: 32px; width: 100%; }
.est-start .prj-date-icon {
  position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
  color: #6c757d; pointer-events: none; flex-shrink: 0;
}
@media (max-width: 520px) {
  /* 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. */
}
html[data-theme="dark"] .est-start .prj-filter-field { color: #eef1f6; }
html[data-theme="dark"] .est-start .prj-filter-field input,
html[data-theme="dark"] .est-start .prj-search-wrap input[type="search"] {
  background: var(--staff-input-bg); color: var(--staff-input-text);
  border-color: var(--staff-input-border);
}
/* v7.19 — dark chevron on the view selects (background-color so
   the SVG survives). v14 (Igor, item 5) — this rule re-declares
   background-repeat and background-position too, so the dark
   chevron is self-contained: it must never depend on the light
   rules' repeat/position surviving some other dark `background:`
   shorthand. v23 (item 30) — the Year / Tax-year selects moved
   INTO the dropdown row, so the row's own dark rule (1,3,2, in
   the .global-search-row block) governs their chevron now; this
   rule stays for any other .est-start select. */
html[data-theme="dark"] .est-start .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 10px center;
}
html[data-theme="dark"] .est-start .prj-search-icon,
html[data-theme="dark"] .est-start .prj-date-icon { color: #73777d; }
html[data-theme="dark"] .est-start .prj-search-clear { color: #c0c7d6; }
html[data-theme="dark"] .est-start .prj-search-clear:hover { background: rgba(214, 223, 243, 0.12); color: #eef1f6; }

/* --- 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. */
.est-btn--primary.is-saved,
.est-btn--primary.is-sent {
  background: #fff;
  color: #1f2d3a;
  border-color: #1f2d3a;
}
/* v16 (Igor, post-v15 item 8) — the Saved colour in light mode
   matches .est-btn--secondary EXACTLY (white background, dark
   #1f2d3a text, bordered — the deleted "New Estimate" button's
   look). The old #1d2d44 text/border was a shade off secondary;
   fixed here. Dark mode already matched dark secondary
   (#1a1f26 / #eef1f6 / rgba(255,255,255,0.22)) — verified,
   unchanged. .is-sent is the same inverted treatment for the
   "Estimate Sent" button (item 9). */
/* v16 (Igor, post-v15 items 8–9) — the timestamp lives INSIDE
   the button border, under the label: the button content is two
   spans (.est-btn-label + .est-btn-time). The stamp reads ~12px
   — a bit bigger than the tiny customer-form timestamp — and the
   saved/sent button tightens its line-height/padding so "Saved"
   shifts up a tiny bit to make room, still inside the 38px
   button. Same layout in light and dark mode (colours only
   differ, per the standing rule). */
.est-btn .est-btn-label { display: block; }
.est-btn .est-btn-time { display: block; font-size: 13px; line-height: 1.15; white-space: nowrap; }
.est-btn .est-btn-time[hidden] { display: none; }
.est-btn--primary.is-saved,
.est-btn--primary.is-sent { flex-direction: column; justify-content: center; line-height: 1.1; padding-top: 3px; padding-bottom: 3px; }
.est-saved-at {
  font-family: "Lora", Georgia, serif;
  font-size: 13px;
  color: #555;
  white-space: nowrap;
  align-self: center;
}
.est-saved-at[hidden] { display: none; }
html[data-theme="dark"] .est-btn--primary.is-saved,
html[data-theme="dark"] .est-btn--primary.is-sent {
  background: #1a1f26;
  color: #eef1f6;
  border-color: rgba(255, 255, 255, 0.22);
}
html[data-theme="dark"] .est-saved-at { color: #9aa3b2; }

/* --- Split project lists: Open / Closed headings (v7.17) --- */
.est-section-title {
  font: 700 12px/1.4 "Cinzel", Georgia, serif;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #6c757d;
  margin: 14px 0 6px;
}
.est-saved-empty { color: #6c757d; font-size: 13px; padding: 6px 2px; list-style: none; }
html[data-theme="dark"] .est-section-title,
html[data-theme="dark"] .est-saved-empty { 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(--est-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: 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
   (linked estimates on a document, the project line, the linked
   lines on a project). Same 28px height as the list-row
   buttons. Screen-only: the rows that hold them carry
   .no-print, so Print/PDF stays clean. */
.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; }
.est-doc-open-row { display: flex; flex-wrap: wrap; gap: 6px; margin: -8px 0 14px; }
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; }

/* v13 (Igor, item 13) — the line-category select is gone: the
   category now lives as data on the row. These rules are
   removed with it. */
/* v8 Stage 1 — document payments (invoices only, screen-only). */
.est-doc-payments { margin: 12px 0; border: 1px solid var(--est-border); border-radius: 8px; padding: 10px 12px; font-family: "Lora", Georgia, serif; font-size: 13px; }
.est-doc-payments h3 { margin: 0 0 8px; font-size: 13px; }
.est-doc-payments h3:not(:first-child) { margin-top: 12px; }
/* v18 (item 4) — the derived figures row: Invoice / Paid /
   Balance / Profit, updated by updateDerivedStatusLabel so a
   recorded payment lowers Balance and an added expense lowers
   Profit. */
.doc-pay-figures { display: flex; flex-wrap: wrap; gap: 4px 18px; font-weight: bold; margin: 8px 0 0; }
/* v18 (item 3) — when the sent invoice is minimized the section
   is moved OUT of the document paper (see
   placeDocPaymentsSection), so it needs its own surface: white
   in light mode, the dark box surface in dark mode (same
   treatment as .est-presets). Inside the paper it stays
   transparent on the paper, as before. */
.est-doc-payments--outside { background: #fff; color: #1f2d3a; }
html[data-theme="dark"] .est-doc-payments--outside { background: #161b24; border-color: rgba(255, 255, 255, 0.14); color: #eef1f6; }
.est-payments-list { list-style: none; margin: 0 0 8px; padding: 0; }
.est-payments-list li { display: flex; gap: 10px; align-items: center; justify-content: space-between; padding: 4px 0; border-bottom: 1px solid var(--est-border); }
.est-payments-form { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: flex-end; }
.est-payments-form label { display: inline-flex; flex-direction: column; gap: 2px; font-size: 11px; font-weight: bold; text-transform: uppercase; letter-spacing: .5px; }
.est-payments-form input, .est-payments-form select { padding: 2px 8px; border: 1px solid #9fb3c8; border-radius: 4px; font-size: 16px; font-family: "Lora", Georgia, serif; background: #fff; color: #1f2d3a; }
.est-pay-balance { font-weight: bold; margin: 8px 0 0; }
.est-derived-status { font-weight: bold; color: #1d2d44; }
.est-show-archived { display: inline-flex; gap: 6px; align-items: center; font-size: 13px; font-family: "Lora", Georgia, serif; margin: 0 0 8px; }
.est-show-archived input { width: 16px; height: 16px; accent-color: #1d2d44; }
/* v8 fix — the document Notes textarea in the pre-settings box
   gets the same main-site tokens as the other options fields
   (it was a plain white box while its neighbours went dark in
   dark mode). The warranty/conditions textareas ON the light
   paper are untouched. v13: retargeted from .est-options. */
.est-presets textarea {
  padding: 4px 10px; border: 1px solid var(--staff-input-border); border-radius: 14px;
  font-size: 16px; font-family: "Lora", Georgia, serif;
  background: var(--staff-input-bg); color: var(--staff-input-text);
  min-height: 27px; box-sizing: border-box;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.est-presets textarea:focus {
  outline: none; border-color: var(--staff-input-focus);
  box-shadow: 0 0 0 3px var(--staff-focus-ring);
}
.est-presets textarea::placeholder { color: var(--staff-input-placeholder); }
.est-picker-new textarea { width: 100%; box-sizing: border-box; }

/* ================================================================
   v8 next — confirmed 8-item list (Igor, 2026-11-24): status
   chips, label-above-amount figures, one-row action rows,
   uniform customer box with copyable email/phone.
   ================================================================ */

/* --- 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. --- */
.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; }
/* v13 (Igor, items 4+5) — delete confirmation pop-up (site-styled,
   no native confirm()): an overlay + a centered dialog that LISTS
   what else will be deleted, with Delete and Cancel buttons.
   Used by the project delete (projects.js) and the document
   delete (estimate.js). */
.del-confirm-overlay { position: fixed; inset: 0; z-index: 70; background: rgba(0, 0, 0, 0.55); display: flex; align-items: flex-start; justify-content: center; padding: 40px 16px; overflow-y: auto; box-sizing: border-box; }
.del-confirm { background: #fff; color: #1f2d3a; border: 1px solid #b9c4d6; border-radius: 10px; box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3); padding: 20px; width: 100%; max-width: 480px; font-family: "Lora", Georgia, serif; box-sizing: border-box; }
.del-confirm h3 { margin: 0 0 8px; font-size: 16px; }
.del-confirm p { margin: 0 0 8px; font-size: 13px; line-height: 1.5; }
.del-confirm ul { margin: 0 0 12px; padding-left: 18px; font-size: 13px; line-height: 1.6; }
.del-confirm-actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.del-confirm-actions button { min-height: 38px; padding: 9px 16px; border-radius: 6px; cursor: pointer; font-size: 13px; font-family: "Lora", Georgia, serif; box-sizing: border-box; }
.del-confirm .del-btn { background: #c0392b; border: 1px solid #c0392b; color: #fff; }
.del-confirm .del-btn:hover { background: #a93226; }
.del-confirm .del-cancel { background: #fff; border: 1px solid #1f2d3a; color: #1f2d3a; }
.del-confirm .del-cancel:hover { background: #f2f2f2; }
/* v24 (item 12, send warning) — the warning dialog's two
   buttons, on the same overlay as the delete confirm: "Fill in
   the address" is the navy primary, "Send anyway" the white
   outline (the delete confirm's Cancel treatment). */
.del-confirm .warn-primary { background: #1d2d44; border: 1px solid #1d2d44; color: #fff; }
.del-confirm .warn-primary:hover { background: #324357; }
.del-confirm .warn-secondary { background: #fff; border: 1px solid #1f2d3a; color: #1f2d3a; }
.del-confirm .warn-secondary:hover { background: #f2f2f2; }
html[data-theme="dark"] .del-confirm .warn-primary { background: #5b729f; border-color: #5b729f; color: #fff; }
html[data-theme="dark"] .del-confirm .warn-primary:hover { background: #4a628f; }
html[data-theme="dark"] .del-confirm .warn-secondary { background: #1a1f26; color: #eef1f6; border-color: rgba(255, 255, 255, 0.22); }
html[data-theme="dark"] .del-confirm .warn-secondary:hover { background: #232a36; }
html[data-theme="dark"] .del-confirm { background: #1a1f26; color: #eef1f6; border-color: rgba(255, 255, 255, 0.22); }
html[data-theme="dark"] .del-confirm .del-cancel { background: #1a1f26; color: #eef1f6; border-color: rgba(255, 255, 255, 0.22); }
html[data-theme="dark"] .del-confirm .del-cancel:hover { background: #232a36; }
/* v13 (Igor, item 9) — the expiry notice banner under the
   header: amber like the Partial chip family, so it
   reads as "needs attention" without shouting. The document
   numbers inside are tappable buttons. */
.expiry-notice { display: flex; align-items: flex-start; gap: 10px; margin: 8px 0; padding: 10px 12px; background: #fef7e0; border: 1px solid #e6c87a; border-radius: 8px; color: #5f4300; font-family: "Lora", Georgia, serif; font-size: 13px; line-height: 1.5; }
.expiry-notice span { flex: 1 1 auto; min-width: 0; }
.expiry-notice-doc { background: none; border: none; padding: 0; cursor: pointer; font-family: "Lora", Georgia, serif; font-size: 13px; color: #174ea6; text-decoration: underline; }
#expiryNoticeClose { flex: 0 0 auto; background: none; border: none; padding: 0 2px; cursor: pointer; font-size: 18px; line-height: 1; color: #5f4300; }
html[data-theme="dark"] .expiry-notice { background: #3a2f10; border-color: #8a6d00; color: #f5e6b8; }
html[data-theme="dark"] .expiry-notice-doc { color: #9db8e8; }
html[data-theme="dark"] #expiryNoticeClose { color: #f5e6b8; }
/* v13 (Igor, item 8) — the converted-estimate LOCK watermark:
   a diagonal banner across the on-screen document form, over
   the content but under clicks (pointer-events: none), so the
   invoice link and the page's own controls still work. Screen
   only — .no-print keeps it off the printed / PDF document,
   and the export / PDF builders never include it. */
.doc-locked-wrap { position: relative; }
.doc-lock-watermark { position: absolute; inset: 0; z-index: 5; display: flex; align-items: center; justify-content: center; pointer-events: none; overflow: hidden; }
.doc-lock-watermark span { display: block; text-align: center; font-family: Arial, sans-serif; font-size: 26px; font-weight: bold; color: rgba(192, 57, 43, 0.28); transform: rotate(-18deg); max-width: 90%; padding: 8px 24px; border: 3px solid rgba(192, 57, 43, 0.28); border-radius: 10px; }
@media (max-width: 520px) { .doc-lock-watermark span { font-size: 18px; } }
.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 (items 4, 8): one figure per
   column, label on top of its dollar amount. --- */
.doc-figures { display: flex; flex-wrap: wrap; gap: 6px 22px; flex-basis: 100%; }
.doc-figure { display: flex; flex-direction: column; gap: 1px; }
.doc-figure-label { font-size: 11px; font-weight: bold; text-transform: uppercase; letter-spacing: .5px; color: #555; line-height: 1.2; }
.doc-figure-value { font-weight: bold; font-size: 14px; color: var(--est-ink); line-height: 1.2; }
html[data-theme="dark"] .doc-figure-label { color: #c0c7d6; }
html[data-theme="dark"] .doc-figure-value { color: #eef1f6; }

/* --- One-row action rows (items 5, 8): the buttons sit in
   their own full-width row under the summary, all the same
   compact 28px size as Open. Buttons round (Igor, 2026-11-24):
   the row's buttons share the row equally — same width even
   when the labels differ ("Convert to Invoice" is the longest);
   a fourth button (Assign) wraps to its own full-width row. --- */
.doc-row-actions { display: flex; flex-wrap: wrap; gap: 8px; flex-basis: 100%; margin-top: 2px; }
.doc-row-actions button { flex: 1 1 0; min-width: 0; }
/* The "Based on estimate" line takes its own row, under the
   summary and above the actions. */
.est-saved-list .doc-linked { flex-basis: 100%; color: #555; font-size: 12px; }
html[data-theme="dark"] .est-saved-list .doc-linked { color: #c0c7d6; }

/* --- Uniform customer box (v8 merge, items 1+2): the head is
   NAME (left) | CONTACT column (phone, email, address stacked,
   left-aligned). Email and phone are plain selectable text —
   tap-and-hold / select to copy — the Copy button is gone.
   v23 (item 31) — the OPEN button is gone too, and the separate
   customer profile page with it: the expanded box holds the
   editable fields itself now. On a narrow phone (≤520px) the
   contact column drops UNDER the name: nothing overlaps,
   nothing clips. The expanded content (edit fields, then the
   associated docs list, then the totals) sits full-width below
   the head. --- */
.est-saved-list li.cust-box { flex-direction: column; align-items: stretch; gap: 0; }
/* v13 (Igor, 2026-11-25, item 2 bug — live screenshot of the
   Elina Ava box) — the head is a COLUMN: the name row, the
   address line and the contact lines each get their OWN
   full-width line, stacked. It used to be a wrapping ROW flex,
   so the address flowed INLINE next to the name whenever it
   fit, and one line read "Elina Ava 352 Burton Ave Highland
   Park, IL 60035". The name must NEVER appear next to / after
   the address. */
.cust-box-head { display: flex; flex-direction: column; align-items: stretch; gap: 2px; }
.cust-name { flex: 1 1 120px; min-width: 0; overflow-wrap: anywhere; font-weight: bold; color: var(--est-ink); font-size: 14px; }
/* v23 (item 43) — PHONE + EMAIL share ONE line below the
   address, in the customer box as in the picker rows (same
   customer display everywhere): a wrapping row, so a long
   email drops under the phone at 402px instead of clipping. */
.cust-contact { display: flex; flex-direction: row; flex-wrap: wrap; align-items: flex-start; gap: 1px 10px; flex: 0 1 auto; min-width: 0; }
.cust-contact > span, .cust-contact > a { overflow-wrap: anywhere; }
/* v24 (item 13) — the Customers-list phone and email share ONE
   secondary style with the address (same size, weight and
   colour, subdued next to the bold name): no dotted underlines
   any more, the tap actions stay. The 0,2,0 scope beats
   .cust-copyable (0,1,0) for the underline; the hover cue is
   the same for both tappable lines. */
.cust-contact .cust-phone, .cust-contact .cust-email { font-size: 13px; font-weight: 400; color: #555; text-decoration: none; }
.cust-contact .cust-phone:hover, .cust-contact .cust-email:hover { color: var(--est-ink); }
.cust-no-email { color: #888; font-size: 12px; }
.cust-copyable { cursor: pointer; text-decoration: underline dotted; text-underline-offset: 2px; }
.cust-copyable:hover { color: var(--est-ink); }
.cust-copyable:focus-visible { outline: 2px solid #516f9d; outline-offset: 2px; }
.cust-addr { color: #555; font-size: 12.5px; overflow-wrap: anywhere; }
.cust-archived { color: #888; font-size: 12px; margin-top: 6px; }
/* v23 (item 31) — the customer edit form lives INSIDE the
   expanded box now (the separate profile page is gone): the
   fields reuse the old profile form (.est-fields.cust-fields),
   the Save / Archive / Delete row reuses the shared
   equal-width action row (11px at ≤520px, so the longest
   labels still fit at 402px), and the status line sits above
   the buttons like the profile's counts line did. */
.cust-box-edit { margin: 10px 0 0; padding-top: 10px; border-top: 1px solid var(--est-border); }
.cust-box-edit-status { text-align: center; margin: 8px 0 0; font-size: 13px; color: var(--est-text); min-height: 0; }
.cust-box-edit-status:empty { display: none; }
.cust-box-edit-actions { margin-top: 10px; margin-bottom: 0; }
html[data-theme="dark"] .cust-box-edit { border-top-color: rgba(255, 255, 255, 0.14); }
.cust-box-docs { list-style: none; margin: 6px 0 0; padding: 8px 0 0; border-top: 1px solid var(--est-border); display: flex; flex-direction: column; gap: 4px; }
.cust-box-docs-empty { color: #888; font-size: 12.5px; }
/* Associated rows are plain rows, not navy buttons: full-width,
   number left, status right. */
.est-saved-list button.cust-box-doc-btn {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  width: 100%; box-sizing: border-box; text-align: left;
  background: transparent; color: var(--est-text); border: 1px solid var(--est-border);
  min-height: 30px; padding: 4px 10px; font-size: 13px; font-weight: normal;
  white-space: normal;
}
.est-saved-list button.cust-box-doc-btn:hover { background: #f2f2f2; border-color: #1f2d3a; }
.cust-box-doc-no { font-weight: bold; color: var(--est-ink); overflow-wrap: anywhere; }
.cust-box-doc-status { color: #555; font-size: 12px; }
html[data-theme="dark"] .cust-name { color: #eef1f6; }
html[data-theme="dark"] .cust-phone,
html[data-theme="dark"] .cust-email { color: #c0c7d6; }
html[data-theme="dark"] .cust-addr,
html[data-theme="dark"] .cust-box-doc-status { color: #c0c7d6; }
html[data-theme="dark"] .cust-copyable:hover { color: #eef1f6; }
html[data-theme="dark"] .est-saved-list button.cust-box-doc-btn { color: #c0c7d6; border-color: rgba(255, 255, 255, 0.14); }
html[data-theme="dark"] .est-saved-list button.cust-box-doc-btn:hover { background: #232a36; border-color: rgba(255, 255, 255, 0.22); }
html[data-theme="dark"] .cust-box-doc-no { color: #eef1f6; }
html[data-theme="dark"] .cust-box-docs { border-top-color: rgba(255, 255, 255, 0.14); }

@media (max-width: 520px) {
  /* Buttons round (Igor, 2026-11-24): the equal action rows
     drop to 11px so the longest labels ("Archive Customer",
     "Convert to Invoice", "Assign to project…") still fit their
     equal share at 402px without clipping. (The nav links have
     their own <=800px rule: 12px, 4px padding.) */
  .est-start-actions.est-actions--equal .est-btn { padding: 9px 6px; font-size: 11px; }
  /* The three named buttons fit one row at 402px with the
     tighter gap/padding; a fourth (Assign) wraps below them. */
  .doc-row-actions { gap: 4px; }
  .doc-row-actions button { padding: 5px 3px; font-size: 11px; }
  /* v13 (Igor, item 2 bug) — the phone-width overrides below
     are OBSOLETE: the customer-box head is a column at every
     width now (see .cust-box-head above), so the name row, the
     address line and the contact lines already stack, left-
     aligned, at 402px. The old `flex: 1 1 100%` on .cust-contact
     would have stretched it in a column layout, so it is gone. */
  .cust-box-head { gap: 2px; }
}

/* v14, item 14 — the #unassignedDocsSection rule is gone with
   the section itself. */

/* ================================================================
   v22 — post-v21 items 6–19 (doc side only).
   ALL v22 CSS lives in this one appended block (later rules with
   equal specificity win), so the earlier rules are untouched.
   ================================================================ */

/* --- Item 7 — the green PDF message: LEFT-aligned, its own row
   under the toolbar buttons (the old margin-left: auto pushed it
   right). It disappears after 3 seconds in JS (see setSaveStatus);
   the CSS only places it. --- */
.est-toolbar > .est-save-status { flex: 1 1 100%; order: 10; margin-left: 0; text-align: left; }

/* --- Item 9 — Send button inactive vs active. There was NO
   disabled rule, so a disabled Send looked identical to an
   enabled one. Inactive is now muted grey in both themes; the
   saved/sent inverted looks are excluded so they keep their own
   treatment. --- */
.est-toolbar-group .est-btn:disabled:not(.is-sent):not(.is-saved) { background: #e8ebee; color: #aab2bb; border-color: #d5d9de; cursor: not-allowed; }
html[data-theme="dark"] .est-toolbar-group .est-btn:disabled:not(.is-sent):not(.is-saved) { background: #2a313c; color: #6b7686; border-color: #3a4454; }
/* Active Send (class is-active, set in syncSendButton once the
   document is saved): navy in light mode, #5b729f in dark mode —
   the primary colour in each theme, so the change from the muted
   inactive grey is visible in both. */
#sendBtn.is-active { background: #1d2d44; border-color: #1d2d44; color: #fff; }
html[data-theme="dark"] #sendBtn.is-active { background: #5b729f; border-color: #5b729f; color: #fff; }

/* --- Item 8c — "Cancel Estimate": aligned RIGHT in the toolbar
   row at desktop (margin-left: auto pushes it to the row's right
   end); at phone width the group is a 2-column grid, so it takes
   the right-hand track. --- */
#cancelEstimateBtn { margin-left: auto; }
@media (max-width: 520px) {
  #cancelEstimateBtn { margin-left: 0; grid-column: 2; }
}

/* --- Item 15 — Save (and Send) keep ONE FIXED SIZE in both
   states ("Save Estimate" and "Estimate saved" + timestamp):
   38px high like the other buttons, 140px wide at desktop so the
   timestamp fits inside at 12px without growing the button.
   At phone width the grid tracks already fix the width, so the
   fixed width is desktop-only. --- */
#saveBtn, #sendBtn { height: 38px; box-sizing: border-box; }
@media (min-width: 521px) {
  #saveBtn, #sendBtn { width: 140px; }
}

/* --- Item 14 — warranty Yes/No toggle: ONE FIXED background in
   both states and both themes (navy #1d2d44, white text, navy
   border) — only the Yes/No text changes, so the background
   neither moves nor loses contrast when clicked. Width is
   already fixed at 46px (v17). The locked-state transparent
   override (line ~335) still wins when the form is locked. --- */
.est-warranty-toggle, .est-warranty-toggle[aria-pressed="true"] { background: #1d2d44; color: #fff; border-color: #1d2d44; }
html[data-theme="dark"] .est-warranty-toggle, html[data-theme="dark"] .est-warranty-toggle[aria-pressed="true"], html[data-theme="dark"] .est-warranty-toggle[aria-pressed="false"] { background: #1d2d44; color: #fff; border-color: #1d2d44; }

/* --- Item 10 — description dropdown: the list is positioned
   FIXED against the viewport in JS (see comboPositionList), so it
   is never clipped by the scroll container. Backstop here: a
   taller cap (was 180px) and a higher z-index, so the maximum
   number of choices shows. --- */
.desc-combo-list { max-height: 480px; z-index: 60; }

/* --- Item 11 — square "+" add-line button: 22px square, navy,
   showing only "+" — the same size and shape as the "×" delete
   button on the right (dark mode #5b729f, like the other primary
   buttons). It lives in the first column (col-add, 30px wide) of
   the line rows; JS moves the single button to the last row.
   Locked-state CSS already hides every #itemsBody button. --- */
table.est-items col.col-add { width: 30px; }
.est-add-line-btn { background: #1d2d44; color: #fff; border: 1px solid #1d2d44; border-radius: 3px; width: 22px; height: 22px; min-width: 22px; min-height: 22px; padding: 0; cursor: pointer; font-size: 14px; line-height: 1; font-family: "Lora", Georgia, serif; box-sizing: border-box; }
.est-add-line-btn:hover { background: #324357; border-color: #324357; }
html[data-theme="dark"] .est-add-line-btn { background: #5b729f; border-color: #5b729f; }
html[data-theme="dark"] .est-add-line-btn:hover { background: #4a628f; border-color: #4a628f; }
table.est-items td.add-cell { width: 30px; padding: 8px 2px 8px 10px; vertical-align: top; text-align: left; }
@media (max-width: 520px) {
  /* The card layout pins every td.no-print to the card's top
     right (over the × button) — the add cell must NOT be pinned:
     it stays in flow, so grid auto-placement puts "+" on the
     card's first row and the description below it. */
  table.est-items tbody td.add-cell { position: static; padding: 0; }
  .est-add-line-btn { width: 30px; height: 30px; min-width: 30px; min-height: 30px; font-size: 16px; }
}

/* --- Item 16 — document text stays DARK in dark mode (the paper
   is always light). Root cause: in dark mode the paper inherits
   light text from the dark page/list ancestors (and --est-ink can
   be redefined light by the embedding list), so plain text —
   warranty heading/body, totals amounts — went white-on-light.
   Fix: re-scope the paper's own ink variables to dark inside
   .est-page, and set the paper's text colour explicitly, so every
   descendant that does not set its own colour is dark. Elements
   with their own colours (thead th: white on navy; inputs: the
   existing dark-mode input rule) are untouched. --- */
html[data-theme="dark"] .est-page { color: #1f2d3a; --est-ink: #1f2d3a; --est-text: #2b2b2b; }
html[data-theme="dark"] .est-page .est-warranty h2,
html[data-theme="dark"] .est-page .est-warranty p,
html[data-theme="dark"] .est-page .est-conditions-text,
html[data-theme="dark"] .est-page .est-totals td,
html[data-theme="dark"] .est-page .line-total,
html[data-theme="dark"] .est-page .est-sig,
html[data-theme="dark"] .est-page .est-sig-line,
html[data-theme="dark"] .est-page .est-company,
html[data-theme="dark"] .est-page .est-doc-title,
html[data-theme="dark"] .est-page .est-fields label,
html[data-theme="dark"] .est-page .est-fields span,
html[data-theme="dark"] .est-page .est-items td,
html[data-theme="dark"] .est-page .est-meta label,
html[data-theme="dark"] .est-page .est-project-line,
html[data-theme="dark"] .est-page .est-linked-note,
html[data-theme="dark"] .est-page .est-warranty-line,
html[data-theme="dark"] .est-page .est-doc-status { color: #1f2d3a; }

/* --- Item 17 — the "Estimate valid …" line is plain text now
   (a <p>, not a textarea): same type as the warranty body, no
   resize handle, no border. --- */
.est-conditions-text { margin: 0 0 8px; font-family: "Lora", Georgia, serif; font-size: 12px; line-height: 1.5; color: #2b2b2b; }

/* ================================================================
   v23 — post-v22 items, doc-page side only.
   ALL v23 CSS lives in this one appended block (later rules with
   equal specificity win), so the earlier rules are untouched.
   ================================================================ */

/* --- Item 20 — status history reads LEFT TO RIGHT, wrapping TOP
   TO BOTTOM (not a vertical stack): oldest first (the order is
   set in JS — projectStatusHistory reversed at the render site),
   current status last, no duplicate of the current chip (v21). --- */
.proj-overview-history { flex-direction: row; flex-wrap: wrap; align-content: flex-start; }
/* --- Item 10 — the chip date span, defined here too (not only
   in projects.css) so the doc page carries it on its own. The
   .st-chip .st-chip-date selector (0,2,0) also outranks the
   projects.css rule below 480px, where the stamp floor applies. --- */
.st-chip .st-chip-date { font-size: 12px; line-height: 1.2; font-weight: 400; opacity: .92; }

/* --- Item 22 — SORT / PERIOD dropdowns float: ROOT CAUSE (kept
   as the record — the FIX itself is superseded by item 30). The
   row's own rule was beaten inside #projListScreen by TWO
   different ID-scoped rules that disagreed with it AND with each
   other, so the same dropdowns rendered at a different height,
   padding and font depending on which container the row had been
   moved into. Item 30 replaces the stacked layout AND this
   (2,1,1) override with ONE authoritative row rule (1,2,1) in
   the .global-search-row block above, covering both homes and
   all the row's dropdowns (including the Year / Tax-year
   selects, which moved INTO the row). The rule below is
   deleted with it; the "Item 22, continued" audit after it
   still stands. --- */

/* --- Item 22, continued — the other doc-page dropdowns, audited:
   - Description combo (.desc-combo-list): positioned FIXED in JS
     from the field's own bounding rect on every open, re-measured
     from its real height, and closed on any scroll/resize — it is
     anchored to its field at every size; no CSS fix needed.
   - Payments method / expense category (.est-payments-form
     select): plain in-flow selects inside their labels; the
     labels are flex columns, so each select stays with its own
     label. box-sizing + min-width: 0 added here so a long option
     can never push the form wider than the phone.
   - Customer Source (.est-fields.cust-fields select) and the
     picker selects: block, width 100% of their own field wrapper,
     styled chevron, no competing ID rule — anchored already.
   - .est-presets select: NO select exists in the pre-settings
     box (warranty is a toggle, deposit is a number, expiration
     is a date) — the old rule is dead and is left untouched. --- */
.est-payments-form select { box-sizing: border-box; min-width: 0; max-width: 100%; }

/* --- Doc-page dark-mode label/field visibility (item 8 is
   POB-side, but the same defect lived here): the Payments +
   Expenses section moves OUT of the light paper when the invoice
   is minimized (.est-doc-payments--outside, dark surface in dark
   mode), yet its inputs/selects kept a hardcoded white
   background AND its derived-status line kept navy #1d2d44 text
   — navy on the dark surface is invisible. Scoped to the
   --outside state only, so the same fields inside the light
   paper keep their light treatment in both themes. --- */
html[data-theme="dark"] .est-doc-payments--outside .est-payments-form input,
html[data-theme="dark"] .est-doc-payments--outside .est-payments-form select { background: #1a1f26; color: #eef1f6; border-color: rgba(255, 255, 255, 0.22); }
html[data-theme="dark"] .est-doc-payments--outside .est-derived-status { color: #9db8e8; }

/* --- Item 1 — the blocked-change error popover reads like the
   status picker (same navy/site styling, no generic controls):
   the message is the server's own words (what must happen
   first), in the body text size. --- */
.st-status-pop.st-status-error { border-color: #c0392b; }
.st-status-pop .st-status-error-msg { margin: 2px 4px 10px; font-size: 13px; line-height: 1.5; }
html[data-theme="dark"] .st-status-pop.st-status-error { border-color: #ff8a80; }

/* --- Item 21 — mobile rules, DOC-PAGE side (480px and below):
   every button at least 44px tall; the doc toolbar and fields
   full-width (the pairs that stay 50/50 live on the POB side —
   Start/End dates — none of the doc-page pairs do); text sizes
   titles 15px / body 14px / chips 12px / stamps 12px (the stamp
   floor: the in-chip stamp is 0.5em on desktop, but nothing goes
   below 12px on a phone, so on a phone it reads at 12px like the
   chip text instead of shrinking to 6px); one column, no
   horizontal scrolling at 402px. --- */
@media (max-width: 480px) {
  /* Tap targets: 44px minimum on every doc-page button. */
  .est-toolbar-group .est-btn, .est-toolbar .est-btn,
  .proj-overview-compose-actions button,
  .st-status-pop button, .del-confirm-actions button,
  .doc-contract-bar { min-height: 44px; }
  /* v24 (step 3) — buttons v23 missed at <=480px: the
     "Download backup" button on Customers, the customer /
     document row buttons, 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). */
  .est-start-actions.est-btn, .est-picker.est-btn,
  .est-saved-list button, .est-picker-project,
  #expiryNoticeClose { 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; }
  #saveBtn, #sendBtn { height: auto; min-height: 44px; }
  .proj-overview-bar { min-height: 44px; }
  /* Toolbar: one full-width button per row (the 2-column grid
     from the <=520px rule is replaced here); Cancel Estimate
     takes its own full row too, not the right-hand track. */
  .est-toolbar-group { grid-template-columns: 1fr; }
  #cancelEstimateBtn { grid-column: 1; margin-left: 0; }
  .est-toolbar-group .est-btn { width: 100%; }
  /* Fields full-width: pre-settings stack, payments fields take
     their own row, compose actions stack. The line-item cards
     keep their own layout (Qty / Unit Price / Total share one
     row by design). */
  .est-presets { flex-direction: column; align-items: stretch; }
  .est-presets label { flex: 1 1 100%; }
  .est-presets input[type="date"] { flex: 1 1 auto; width: 100%; }
  .est-payments-form label { flex: 1 1 100%; }
  .est-payments-form input, .est-payments-form select { width: 100%; }
  .proj-overview-compose-actions button { flex: 1 1 100%; }
  /* Text sizes: titles 15px, body 14px, chips 12px, stamps 12px;
     nothing below 12px — the 11px rules (toolbar buttons,
     in-button timestamps, row-action buttons, small labels)
     are raised to 12px here. */
  .doc-section-title { font-size: 15px; }
  .proj-overview, .est-presets, .est-toolbar,
  .doc-linked-line, .est-collapsed-line { font-size: 14px; }
  .est-toolbar-group .est-btn { font-size: 12px; }
  .est-toolbar-group .est-btn .est-btn-time { font-size: 13px; }
  .doc-row-actions button { font-size: 12px; }
  .st-chip { font-size: 12px; }
  .st-chip .st-chip-date { font-size: 12px; }
  .est-fields label, .est-meta label, .est-id-label,
  table.est-items tbody td.num::before,
  .est-company-sub { font-size: 12px; }
  /* One column, no horizontal scrolling at 402px: the wrapper
     clips any stray overflow (the description combo list is
     position: fixed, so it is not clipped by this). */
  .est-wrap { overflow-x: hidden; }
  .est-page, .proj-overview { max-width: 100%; }
}
