/* Mobile-first. 16px base, 48px touch targets. Pair colour with shape/text. */
*, *::before, *::after { box-sizing: border-box; }

:root {
  --bg: #f4f6f8;
  --card: #ffffff;
  --ink: #11141a;
  --ink-soft: #555c66;
  --line: #d8dde3;
  --accent: #006aac; /* CRM theme — rgb(0,106,172) */
  --accent-ink: #ffffff;
  --warn: #b54708;
  --good: #117a3a;
  --pill: #eef2f6;
  --pill-ink: #2c3340;
  --shadow: 0 1px 3px rgba(17, 20, 26, .08), 0 4px 12px rgba(17, 20, 26, .04);
  --radius: 12px;
}

/* GHL renders its UI in Inter — self-host it so the iframe matches natively.
 * Byte-identical to the InterVariable.woff2 already shipped by the Scheduler,
 * EMT, ETAS, Onboarding Browser and Xero Bridge (SHA-256 693b77d4f32ee9b8…);
 * Client Finder was the only tool in the fleet still falling back to the system
 * stack, which meant it rendered in Segoe UI on Windows while everything beside
 * it in GHL rendered in Inter. Self-hosted rather than fetched from Google so
 * there is no third-party request from inside the GHL iframe. */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('/fonts/InterVariable.5696fc84.woff2') format('woff2');
}

html, body { margin: 0; padding: 0; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.45;
  color: var(--ink);
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
}

.wrap {
  max-width: 720px;
  margin: 0 auto;
  padding: 16px;
  padding-bottom: 120px; /* room for sticky search button */
}

header.app {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0 16px;
}
header.app h1 {
  font-size: 20px;
  margin: 0;
  font-weight: 700;
  letter-spacing: -0.01em;
}
header.app .who {
  font-size: 13px;
  color: var(--ink-soft);
}

/* Quick-nav pills (My Dashboard / My Portal) — small, under the header. */
.pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 14px;
}
.nav-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  min-height: 36px;
  border: 1.5px solid var(--accent);
  border-radius: 999px;
  background: var(--card);
  color: var(--accent);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
}
.nav-pill:active { background: var(--accent); color: var(--accent-ink); }

/* Floating "↑ Top" — appears on long lists. Sits clear of the sticky
   search bar on mobile; high-contrast so it reads regardless of colour. */
.back-to-top {
  position: fixed;
  right: 16px;
  bottom: calc(84px + env(safe-area-inset-bottom));
  z-index: 20;
  min-height: 44px;
  padding: 10px 16px;
  border-radius: 999px;
  border: 2.5px solid var(--ink);
  background: var(--card);
  color: var(--ink);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: var(--shadow);
}
.back-to-top:active { background: var(--ink); color: #fff; }
@media (min-width: 720px) {
  .back-to-top { bottom: 24px; }
}

/* ── Forms ────────────────────────────────────────────────────────── */
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
}
.field label {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-soft);
}
.field input {
  width: 100%;
  min-height: 48px;
  padding: 12px 14px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  font-size: 17px;
  font-family: inherit;
  color: var(--ink);
  -webkit-appearance: none;
  appearance: none;
}
.field input:focus {
  outline: 3px solid color-mix(in srgb, var(--accent) 30%, transparent);
  border-color: var(--accent);
}

/* Buttons — 48px minimum, full-width on mobile. */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 52px;
  padding: 12px 18px;
  border-radius: var(--radius);
  border: 1.5px solid var(--line);
  background: var(--card);
  color: var(--ink);
  font-size: 17px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
}
/* Very subtle alternating row bands on the secondary action buttons.
   Decorative rhythm only — no meaning is carried by colour. Differs by
   lightness as well as hue so the alternation still reads if the faint
   blue is imperceptible. New Enquiry (.btn-primary) is exempt.
   Outlines sit a step darker than the fill so each button's edge reads
   clearly against the white card (Allan, 19 Oct). */
.btn.band-a { background: #f5f6f8; border-color: #c3cad4; }
.btn.band-b { background: #e9edf3; border-color: #b4bdca; }
.btn-block { width: 100%; }
.btn-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-top: 8px;
}
@media (min-width: 600px) {
  .btn-row.cols-2 { grid-template-columns: 1fr 1fr; }
}
/* Force a button to span the full row inside a 2-col grid (e.g. New Enquiry). */
.btn-row .span-2 { grid-column: 1 / -1; }
/* Subtle group sub-header inside the button grid (e.g. "Update status").
   A thin rule above + quiet uppercase label does the separating, no box. */
.btn-row .group-head {
  margin: 4px 0 0;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

/* Search button — inline above results on every viewport. */
.sticky-search {
  margin-top: 12px;
}

/* ── Cards ────────────────────────────────────────────────────────── */
.cards { display: flex; flex-direction: column; gap: 12px; margin-top: 16px; }

.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  border: 1.5px solid transparent;
  cursor: pointer;
  position: relative;        /* anchor for the absolute pin-toggle */
  /* When scrollIntoView lands on a card, leave room above it for the
     nav pills + "Contact Search" h1 — so the user keeps that context
     instead of the card slamming flush to the iframe top. 128px clears
     the pill row (~39px) + its margin + h1 + h1's padding with a small
     gap at the very top. */
  scroll-margin-top: 128px;
}
.card:focus-within, .card.is-selected { border-color: var(--accent); }

/* Sticky top block — when a card is open, keep the name / address / Last
   quote+job / "Go To Full Contact" pinned while the action sections scroll
   underneath. Only on an open card (collapsed list rows are untouched). The
   negative margin lets the block span the card's 16px padding so its
   background fully covers scrolling content + the rounded top corners. */
/* Pin the top block — name, address, contact details, Last quote+job (and on
   desktop the Go To Full Contact button) — while the action sections scroll
   underneath. The block's parent is the whole card, so it stays stuck for the
   full scroll (a sticky element only holds while its parent is on screen). */
.card.is-selected .card-sticky {
  position: sticky;
  top: 0;
  z-index: 6;
  background: var(--card);
  margin: -16px -16px 0;
  padding: 16px 16px 8px;
  border-radius: var(--radius) var(--radius) 0 0;
  box-shadow: 0 6px 8px -7px rgba(0, 0, 0, 0.3);
}
/* The two "open this contact elsewhere" links, pinned as one row: Open Contact
   Record (ours, left — the everyday click) and Go To Full Contact (GHL, right —
   the escape hatch). One row instead of two, and both stay put while the action
   sections scroll underneath.
   FLEX, not a 2-col grid, on purpose: tier gating can delete Go To Full
   Contact (.go-to-contact), and a lone survivor should fill the row rather
   than sit at half width next to a hole. */
.card.is-selected .card-sticky .top-links {
  display: flex;
  gap: 10px;
  margin-top: 10px;
}
.card.is-selected .card-sticky .top-links > .btn {
  flex: 1 1 0;
  min-width: 0;          /* let a long label wrap instead of forcing the row wide */
  margin: 0;
}
/* Emphasis sits on OUR screen. Allan, 2026-09-03: "make the focus be on the
   Open Contact Record, and lighten it on the Go To Full Contact Online."
   The heavy high-contrast border + bold label is the loud treatment — it moves
   here from .go-to-contact. WEIGHT and BORDER carry it, not colour: nothing in
   this pair is distinguishable by hue alone. The 👤 in the label is the third
   cue. No underline — inside a heavy box it read as a text link, not a button. */
.card.is-selected .card-sticky .top-links [data-act-record] {
  border: 3px solid var(--ink);
  color: var(--ink);
  font-weight: 700;
  text-decoration: none;
}
.card.is-selected .card-sticky .top-links [data-act-record]:active {
  background: var(--ink);
  color: #fff;
}
/* …and GHL's deep link is a plain quiet button at the BOTTOM of the card, just
   above Delete (moved out of this row 29 Nov 2026 — Allan: "the header space is
   more important"). It keeps its ↗ so "this leaves the portal" is still
   signalled by shape, not by colour. Delete's own 18px top margin keeps the two
   apart, so this one needs none below. */
.card [data-actions] .go-to-contact {
  margin: 14px 0 0;
  border: 1.5px solid var(--line);
  color: var(--ink-soft);
  font-weight: 600;
}
.card [data-actions] .go-to-contact:active {
  background: #f5f6f8;
  color: var(--ink);
}
/* Gating can empty it — don't leave 10px of dead space behind. */
.card.is-selected .card-sticky .top-links:empty { display: none; }

/* ── the same pair, as a shortcut on every RESULT card ────────────────────── */
/* Allan, 2026-09-05: "At the moment we have to open then click to go to the
   full new contact. Can we add a button here please." One click instead of two.
   FLEX for the same reason as .top-links above: a location with no LOCATION_ID
   draws no native link, and the survivor should fill the row rather than sit at
   half width beside a hole. */
.card .card-links {
  display: flex;
  gap: 10px;
  margin: 10px 0 4px;
}
.card .card-links > .btn {
  flex: 1 1 0;
  min-width: 0;          /* let a long label wrap instead of forcing the row wide */
  margin: 0;
  /* A TABLET reaches these with a finger, so they keep the 44px floor. */
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}
/* Emphasis sits on OUR screen, exactly as in the pinned pair — the record is
   the everyday click, GHL is the escape hatch. 👁 WEIGHT and BORDER carry that,
   never hue: nothing in this pair is distinguishable by colour alone, and the
   👤 / ↗ shapes are the third cue. */
.card-links .card-link-record {
  border: 3px solid var(--ink);
  color: var(--ink);
  font-weight: 700;
  text-decoration: none;
}
.card-links .card-link-record:active { background: var(--ink); color: #fff; }
/* …and GHL's own page steps back to a plain quiet button. */
.card-links .card-link-native {
  border: 1.5px solid var(--line);
  color: var(--ink-soft);
  font-weight: 600;
  text-decoration: none;
}
.card-links .card-link-native:active { background: #f5f6f8; color: var(--ink); }
/* 🔴 THE ARROW IS NOT INHERITED. The pinned copy gets its ↗ from
   `.card .go-to-contact::after`; this link is deliberately a different class
   (placeTopLinks() deletes .go-to-contact out of .card-sticky, and this row
   lives there), so it gets none of that for free. Without this line the "you
   are leaving the portal" cue silently goes missing — and it is a SHAPE cue,
   which is the one that survives colourblindness. */
.card-link-native::after { content: " \2197"; font-weight: 700; }
/* The OPEN card already carries this pair, pinned at the top. Showing both
   would be four links to two destinations. */
.card.is-selected .card-links { display: none; }
/* In focus mode the PINNED badge sits just above this block — don't let the
   negative top margin pull the block up and overlap it. */
body.is-pinned .card.is-selected .card-sticky { margin-top: 0; }
/* 📵 NEITHER link on a PHONE. Allan, 2026-09-03: "I don't think either of those
   links should be on a phone — a tablet yes, but a phone no, they are not
   usable on a phone." Both open a full desktop-width screen (GHL's contact
   detail, or our Contact Record); on a 390px viewport they are a trap, and
   they were costing the pinned block a whole row of the little space it has.
   display:none — not [hidden] — also takes them out of the tab order and the
   accessibility tree, so a phone cannot reach them at all.
   PHONE means: narrow, OR short-and-landscape (a phone on its side is ~840px
   WIDE, so width alone would call it a tablet). `pointer: coarse` keeps that
   second clause on touch devices — otherwise a desktop browser squashed short,
   or a short GHL iframe, would silently lose both links. */
@media (max-width: 767px), (orientation: landscape) and (max-height: 600px) and (pointer: coarse) {
  .card.is-selected .card-sticky .top-links { display: none; }
  /* Full Contact Native, now above Delete, stays off a phone too — same rule,
     it opens GHL's full desktop-width contact page. */
  .card [data-actions] .go-to-contact { display: none; }
  /* …and the result-card shortcut goes with it. Allan, 2026-09-05: "This is
     desktop and tablet only not the phone." Same reasoning as the pinned pair
     it shortcuts — both ends open a full desktop-width screen. */
  .card .card-links { display: none; }
}
/* Landscape PHONES only (short viewport — excludes desktop monitors, which are
   tall and keep the full sticky header). Vertical space is tight in landscape,
   so pin ONLY the identity lines (name + assignee + address) and let the
   contact details / custom fields / buttons scroll underneath. We un-stick the
   whole .card-sticky block and move the stickiness to the inner .card-pinhead. */
@media (orientation: landscape) and (max-height: 600px) {
  .card.is-selected .card-sticky {
    position: static;
    box-shadow: none;
  }
  .card.is-selected .card-pinhead {
    position: sticky;
    top: 0;
    z-index: 6;
    background: var(--card);
    /* span the card's 16px side padding so scrolling content can't peek past
       the pinned identity block at the edges */
    margin: 0 -16px;
    padding: 4px 16px 6px;
    box-shadow: 0 6px 8px -7px rgba(0, 0, 0, 0.3);
  }
}

/* Pin tickbox / badge sit above the sticky background. */
.card .pin-toggle, .card .pin-badge { z-index: 7; }

/* ── Pin tickbox ──────────────────────────────────────────────────────
   Top-right of an EXPANDED card only — hidden when the card is collapsed
   in the search results, otherwise it'd clutter every row. Tick = focus
   mode (body.is-pinned hides search form + other cards). */
.card .pin-toggle {
  position: absolute;
  top: 12px;
  right: 12px;
  display: none;             /* shown when card is expanded — see below */
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 8px;
  background: rgba(255,255,255,0.85);
  cursor: pointer;
  user-select: none;
  z-index: 2;
}
.card.is-selected .pin-toggle { display: inline-flex; }
.card .pin-toggle .pin-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);          /* full ink — admin contrast rule applies here too */
  white-space: nowrap;
}
/* Custom square checkbox — same recipe as the admin form's tag checkbox
   so the visual language is consistent. Bypasses native rectangular
   rendering on Chrome/Windows. */
.card .pin-toggle input[type="checkbox"] {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  min-width: 20px;
  min-height: 20px;
  flex-shrink: 0;
  margin: 0;
  padding: 0;
  /* Darker border + subtle shadow — at-rest visibility for Allan's
     dyslexia + colourblind needs. The default --line (#d8dde3) was almost
     invisible against the white card. #7a828c reads clearly at rest. */
  border: 1.5px solid #7a828c;
  border-radius: 4px;
  background: #fff;
  cursor: pointer;
  position: relative;
  box-sizing: border-box;
  box-shadow: 0 1px 2px rgba(10, 20, 40, 0.12);
  transition: background 0.12s ease, border-color 0.12s ease, box-shadow 0.12s ease;
}
.card .pin-toggle input[type="checkbox"]:hover {
  border-color: var(--ink-soft);
  box-shadow: 0 1px 3px rgba(10, 20, 40, 0.18);
}
.card .pin-toggle input[type="checkbox"]:checked {
  background: var(--accent);
  border-color: var(--accent);
}
.card .pin-toggle input[type="checkbox"]:checked::after {
  content: '';
  position: absolute;
  left: 5px;
  top: 1px;
  width: 6px;
  height: 11px;
  border: solid #fff;
  border-width: 0 2.5px 2.5px 0;
  transform: rotate(45deg);
}
.card .pin-toggle input[type="checkbox"]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* "Pinned" badge — small accent chip that sits in its OWN row above the
   card header when pinned, so it never collides with the contact name.
   In-flow (not absolute) so the card-head reflows down to make room
   when the badge appears, then back up when it leaves. */
.card .pin-badge {
  display: none;
  width: fit-content;
  padding: 4px 10px;
  margin-bottom: 10px;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-radius: 999px;
  box-shadow: 0 1px 2px rgba(10, 20, 40, 0.18);
}
body.is-pinned .card.is-selected .pin-badge { display: inline-flex; }

/* "← Back to search" pill — sits in the existing nav-pill row alongside
   My Dashboard / My Portal. Only shown when pinned, so the row stays
   tidy in normal search mode. Native button styled to match the nav-pill. */
.nav-pill--back {
  display: none;
  cursor: pointer;
  font-family: inherit;
}
body.is-pinned .nav-pill--back { display: inline-flex; }

/* Focus mode — when body.is-pinned, fade out + hide the search form and
   any card that isn't the selected/pinned one. Uses transition-behavior:
   allow-discrete so display:none can be transitioned (modern Chromium /
   Safari 17.4+). Falls back to instant hide on older browsers. */
#searchForm,
#results .card {
  transition: opacity 220ms ease, display 220ms ease allow-discrete;
}
/* Scoped to mobile/tablet: at >=1024px the two-pane layout already isolates
   the selected client in the right pane, so we must NOT hide the form or the
   other cards (they live in the left rail and stay useful). */
@media (max-width: 1023px) {
  body.is-pinned #searchForm,
  body.is-pinned #results .card:not(.is-selected) {
    opacity: 0;
    display: none;
  }
}
/* Also hide the floating "back to top" arrow while pinned — nothing to
   scroll back to, would just look like noise. */
body.is-pinned .back-to-top { display: none !important; }

/* Focus ("fixed") mode must size the card identically at EVERY width. Inside
   the GHL iframe a scrollbar can dip the width just under 1024px; if the focus
   layout were gated only on @media(min-width:1024) (as it is further down) the
   card would collapse to a narrow column the instant that happens. So also
   drive the focus layout off the focused card actually living in the detail
   pane — that condition is width-independent, so the card stays put. The
   mobile case (card never relocated, so #detailPane is empty) is unaffected. */
/* Driven by a JS-set class (syncFocusPane) rather than :has() — :has() didn't
   re-evaluate reliably on DOM changes, so focus width drifted (860 ↔ narrow).
   cf-focus-pane is set whenever the focused card is living in the detail pane,
   at any width, so the card holds a stable width. */
body.cf-focus-pane .cf-left { display: none; }
body.cf-focus-pane .cf-grid { grid-template-columns: 1fr; }
/* width:100% is essential: in a grid track, `margin: 0 auto` cancels the
   default stretch, so the pane would otherwise shrink to its content width
   (narrow when sections are closed, wide only when long tag names are shown).
   width:100% makes it fill the column.
   No max-width: the card runs the full width of the title and tabs above it
   (Allan, 19 Oct 2026 — it used to stop at 860px, leaving a gap either side). */
body.cf-focus-pane #detailPane { width: 100%; max-width: none; margin: 0 auto; }
body.cf-focus-pane #detailPane .card { width: 100%; }

.card .card-head { margin-bottom: 4px; }
.card .name {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0 0 6px;
  word-break: break-word;
}
.card .assignee {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-soft);
  margin: 0 0 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.card .assignee .assignee-dot { color: var(--good); font-size: 10px; }

.card .address {
  font-size: 17.5px;
  color: var(--ink);
  margin: 0 0 8px;
  line-height: 1.4;
  word-break: break-word;
}
/* padding + text-align: this also matches the global `.empty` rule, which is for
   "nothing found" boxes. Without the reset "— No address on file" sat centred
   and took 85px instead of 20px of the pinned block (Allan, 3 Nov 2026). */
.card .address.empty { color: var(--ink-soft); font-style: italic; font-size: 15px; padding: 0; text-align: left; }

/* Phone + email on ONE line. */
.card .contact-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px;
  margin-top: 2px;
}
/* 🔁 "Work phone is the same number as X's mobile" — under the phones in the
   header, and under ✏️'s Work phone box. Words + icon; never colour alone. */
.card .phone-shared {
  margin: 3px 0 0;
  font-size: 12.5px;
  line-height: 1.35;
  color: var(--ink-soft, #5a6472);
}
.card .edit-form .phone-shared { margin: -4px 0 8px; }
.card .contact-link {
  font-size: 15px;
  color: var(--ink-soft);
  text-decoration: none;
  word-break: break-all;
}
.card .contact-link:active { color: var(--accent); }
.card .contact-sep { color: var(--line); font-weight: 700; }

/* "Go To Contact…" — sits below the dates line. Heavy, high-contrast border
   (not faint colour) so it reads clearly for colour-blind eyes; arrow gives a
   shape cue too. */
.card .go-to-contact {
  margin: 4px 0 14px;
  text-decoration: none;
  border: 3px solid var(--ink);
  font-weight: 700;
  color: var(--ink);
}
.card .go-to-contact::after { content: " \2197"; font-weight: 700; }
.card .go-to-contact:active { background: var(--ink); color: #fff; }
.card .meta {
  font-size: 15px;
  color: var(--ink-soft);
  margin: 2px 0;
  word-break: break-word;
}
.card a.meta-link { color: var(--ink-soft); text-decoration: none; }
.card a.meta-link:active { color: var(--accent); }

/* Dates + total: one line, sitting close under the header. */
.card .activity {
  margin-top: 6px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
  font-size: 15px;
}
.card .activity-line {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 18px;
}
.card .activity-line .ai { white-space: nowrap; }
.card .activity-line .ai-lbl { color: var(--ink-soft); font-weight: 600; }
.card .activity-line .ai-val { color: var(--ink); font-weight: 600; }
.card .activity-line .ai-val.empty { color: var(--ink-soft); font-style: italic; font-weight: 400; }
/* legacy stacked rows (loading / fallback) */
.card .activity .row { display: flex; gap: 6px; align-items: baseline; }
.card .activity .row .val.empty { color: var(--ink-soft); font-style: italic; }

.tags-block { margin-top: 14px; }
.tags-head {
  margin: 0 0 6px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--pill);
  color: var(--pill-ink);
}
.tag.dnd { background: #fce8e3; color: #9a2a14; }

/* Expanded / selected card actions. */
.actions { margin-top: 14px; }
.actions h3 {
  margin: 4px 0 10px;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.empty, .loading, .error {
  text-align: center;
  padding: 32px 16px;
  color: var(--ink-soft);
  font-size: 15px;
}
.error { color: var(--warn); }

/* ── PIN screen ───────────────────────────────────────────────────── */
.pin-wrap {
  min-height: 100dvh;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.pin-card {
  width: 100%; max-width: 360px;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
}
.pin-card h1 { margin: 0 0 4px; font-size: 22px; }
.pin-card p { color: var(--ink-soft); margin: 0 0 20px; font-size: 15px; }
.pin-input {
  width: 100%;
  font-size: 28px;
  letter-spacing: 14px;
  text-align: center;
  padding: 16px;
  min-height: 64px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  font-family: inherit;
  font-weight: 700;
}
.pin-msg { margin-top: 12px; font-size: 14px; min-height: 20px; }
.pin-msg.ok { color: var(--good); }
.pin-msg.err { color: var(--warn); }

/* ── Action group accordions (What next? / Update status / Useful Tools / Quotes & Jobs) ── */
.action-group {
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  overflow: hidden;
}
.action-group.is-open {
  border-color: var(--accent);
  box-shadow: 0 1px 3px rgba(0, 106, 172, 0.10);
}
.group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 14px 16px;
  background: var(--pill);
  border: 0;
  border-bottom: 1px solid var(--line);
  font: inherit;
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  min-height: 52px;
}
.action-group:not(.is-open) .group-header { border-bottom-color: transparent; }
.action-group.is-open .group-header {
  background: rgba(0, 106, 172, 0.10);
  border-bottom-color: var(--accent);
}
.group-title { letter-spacing: -0.01em; }
.group-caret {
  font-size: 22px;
  line-height: 1;
  color: var(--accent);
  font-weight: 700;
  margin-left: 12px;
}
.group-body { padding: 12px; }
.group-body[hidden] { display: none; }

/* ── Billing rows (native Estimates / Invoices list) ─────────────────────── */
.billing-slot { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.billing-slot:empty { display: none; }

/* ── "Options We Sent" — what we OFFERED, not what they chose ──────────
   Reads as one family with the billing rows above it (same zebra bands, same
   panel head), because a user flicking between "View Quotes" and this should
   not feel like two different tools. */
.price-options-slot { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.price-options-slot:empty { display: none; }
.po-row {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius, 10px);
}
.po-row-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 10px;
  margin-bottom: 4px;
}
.po-row-head strong { font-size: 14px; }
/* Status carries an ICON AND WORDS. Never colour alone — this has to read for
   a colourblind user, and it is the field people scan first. */
.po-status { font-size: 12px; font-weight: 700; color: var(--ink-soft); white-space: nowrap; }
.po-meta { font-size: 12px; color: var(--ink-soft); line-height: 1.45; }
.po-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}
.po-btn {
  flex: 1 1 auto;
  /* 44px floor: staff use this stood in someone's hallway, on a phone. */
  min-height: 44px;
  font-size: 13px;
}

.billing-panel .notes-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.billing-refresh {
  background: #fff;
  border: 1px solid var(--line);
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: 6px;
  cursor: pointer;
  min-height: 32px;
}
.billing-refresh:hover { background: var(--pill); border-color: var(--accent); color: var(--accent); }
.billing-refresh:disabled { opacity: 0.6; cursor: default; }

.billing-row-head {
  /* Tighter 2-column layout — date on left, name + meta on right */
  grid-template-columns: auto 1fr auto;
}
.billing-row-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow: hidden;
}
.billing-row-name {
  font-weight: 600;
  font-size: 15px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.billing-row-meta {
  font-size: 13px;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.billing-row-body { font-size: 14px; }
.billing-row-body > div { padding: 2px 0; }

.billing-status {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  border: 1px solid currentColor;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
/* Status colours — ALWAYS paired with text label so colourblind users
   (per user_allan-colourblind memory) never rely on hue alone. */
.status-sent      { color: #b54708; background: #fff5e6; }   /* amber */
.status-pending   { color: #b54708; background: #fff5e6; }
.status-draft     { color: #555c66; background: #eef2f6; }   /* grey */
.status-accepted  { color: #117a3a; background: #e6f7ec; }   /* green */
.status-paid      { color: #117a3a; background: #e6f7ec; }
.status-declined  { color: #9b1c1c; background: #fdecec; }   /* red */
.status-void      { color: #9b1c1c; background: #fdecec; }
.status-overdue   { color: #9b1c1c; background: #fdecec; }
.status-unknown   { color: #555c66; background: #eef2f6; }
/* 🧾 An invoice's own words (6 Nov 2026): part paid is still owed, a payment
   clearing is on its way — each says so in its word, the colour only helps. */
.status-part      { color: #b54708; background: #fff5e6; }
.status-clearing  { color: #555c66; background: #eef2f6; }

.billing-items { margin: 6px 0; }
.billing-items-toggle {
  background: none;
  border: 0;
  font: inherit;
  font-size: 14px;
  color: var(--ink);
  cursor: pointer;
  padding: 6px 0;
  text-align: left;
  min-height: 36px;
}
.billing-items-caret {
  color: var(--accent);
  font-size: 16px;
  font-weight: 700;
  margin-left: 4px;
}
.billing-items-list {
  margin-top: 4px;
  padding: 8px 10px;
  background: var(--pill);
  border-radius: 8px;
  border: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.billing-item {
  padding: 6px 0;
  border-bottom: 1px dashed var(--line);
}
.billing-item:last-child { border-bottom: 0; }
.billing-item-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 14px;
  font-weight: 600;
}
.billing-item-name { color: var(--ink); }
.billing-item-total { font-variant-numeric: tabular-nums; }
.billing-item-meta {
  font-size: 13px;
  color: var(--ink);
  margin-top: 2px;
}
.billing-items-empty { font-size: 13px; color: var(--ink); padding: 4px 0; }

/* 🛠 An open job on the card (View Jobs). The items ARE the Quotes list's
   .billing-item rows (renderLineItems); these rules are only the parts a job
   has and a quote does not. */
.job-row .billing-row-name {
  /* Two lines of the job's own words, rather than one line cut short. */
  white-space: normal;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
/* "13th January 2027": every job's date the same width, so the titles line
   up down the list. The widest, "23rd September 2026", measured 158.5px. */
.job-row .notes-row-date, .quote-row .notes-row-date, .invoice-row .notes-row-date { box-sizing: border-box; width: 160px; text-align: center; }
@media (max-width: 480px) {
  /* On a phone the date sits on its own line above the job's words, which
     then get the full width — beside them, the written-out date left the
     words a third of the row. Quotes and invoices the same (6 Nov 2026). */
  .job-row .notes-row-head, .quote-row .notes-row-head, .invoice-row .notes-row-head { grid-template-columns: 1fr auto; row-gap: 6px; }
  .job-row .notes-row-date, .quote-row .notes-row-date, .invoice-row .notes-row-date { grid-column: 1; grid-row: 1; justify-self: start; width: auto; }
  .job-row .billing-row-main, .quote-row .billing-row-main, .invoice-row .billing-row-main { grid-column: 1; grid-row: 2; }
  .job-row .notes-row-caret, .quote-row .notes-row-caret, .invoice-row .notes-row-caret { grid-column: 2; grid-row: 1 / span 2; }
  /* "Quoted by" on its own line under the price and pill (Allan, 5 Nov 2026). */
  .quote-row .quote-row-by { display: block; margin-top: 2px; }
  .quote-row .quote-row-dot { display: none; }
}
.job-scope-head { font-size: 14px; padding: 4px 0 2px; }
.job-scope-text { white-space: pre-wrap; word-break: break-word; }
.job-facts { margin-top: 4px; }
.job-facts > div { padding: 2px 0; }
/* ⚠ and ✖ carry the meaning; the weight only makes them easier to spot. */
.job-fact--warn { font-weight: 700; }
.job-fact--muted { font-style: italic; }
/* An office note keeps the line breaks it was typed with. */
.job-fact--pre { white-space: pre-wrap; word-break: break-word; }
/* The diary links sit in the same row as 🖨 Print. */
.job-diary-links { display: contents; }
/* 🖨 Print — the same size as .appt-goto-diary beside it (font, padding,
   border, radius), outlined, so "Go to Diary" stays the one filled button. */
.job-print-btn {
  display: inline-block; font-size: 13px; font-weight: 600;
  padding: 6px 12px; border: 1.5px solid #006aac; border-radius: 4px;
  background: #fff; color: #006aac; cursor: pointer;
}
.job-print-btn:hover { background: #eef5fb; }
.job-note-conflict { margin-top: 8px; }
/* The Jobs panel's header as a row: "Jobs" on the left, ⓘ How it works and
   ↻ Refresh on the right — they used to sit glued to the word "Jobs". */
.jobs-panel .notes-panel-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.jobs-help, .quotes-help { margin-left: auto; font-size: 13px; font-weight: 600; color: var(--accent); }
.job-fact-retry { margin-left: 6px; min-height: 32px; padding: 4px 10px; }
.job-notes:empty { display: none; }
.job-note { margin-top: 10px; padding-top: 8px; border-top: 1px dashed var(--line); }
.job-note-head { display: block; font-size: 14px; font-weight: 700; margin-bottom: 4px; }
.job-note-text { white-space: pre-wrap; word-break: break-word; margin-bottom: 6px; }
.job-note-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.job-note-msg { font-size: 13px; font-weight: 600; }
.job-note .note-edit-text { min-height: 96px; box-sizing: border-box; }
.job-note .note-edit-actions { margin-top: 8px; }

.billing-row-inline-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 6px;
}
.billing-open-link, .billing-preview-link {
  text-decoration: none;
  font-weight: 700;
  font-size: 14px;
  padding: 8px 14px;
  border-radius: 8px;
  min-height: 36px;
  display: inline-flex;
  align-items: center;
}
.billing-open-link {
  background: var(--accent);
  color: var(--accent-ink);
}
.billing-preview-link {
  background: #fff;
  color: var(--accent);
  border: 1.5px solid var(--accent);
}
.billing-open-link:hover, .billing-preview-link:hover { filter: brightness(1.05); }

/* Copy Quote — outline style, matches the preview link but distinct enough to
   read as its own action. */
.billing-copy-quote-btn {
  font-weight: 700;
  font-size: 14px;
  padding: 8px 14px;
  border-radius: 8px;
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  background: #fff;
  color: var(--accent);
  border: 1.5px solid var(--accent);
  cursor: pointer;
}
.billing-copy-quote-btn:hover { filter: brightness(1.05); }
.billing-copy-quote-btn:disabled { opacity: 0.6; cursor: default; }

/* 🔗 Use on a booked job — the reverse of Book Job. Same outline treatment as
   Copy Quote: both re-use an existing quote rather than starting something. */
.billing-attach-quote-btn {
  font-weight: 700;
  font-size: 14px;
  padding: 8px 14px;
  border-radius: 8px;
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  background: #fff;
  color: var(--accent);
  border: 1.5px solid var(--accent);
  cursor: pointer;
}
.billing-attach-quote-btn:hover { filter: brightness(1.05); }
.billing-attach-quote-btn:disabled { opacity: 0.6; cursor: default; }

/* 💬 Text Simple Quote — same outline treatment as Copy Quote and Use on a
   booked job: all three take an existing quote and do something else with it,
   so they should read as one family. */
.billing-text-quote-btn {
  font-weight: 700;
  font-size: 14px;
  padding: 8px 14px;
  border-radius: 8px;
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  background: #fff;
  color: var(--accent);
  border: 1.5px solid var(--accent);
  cursor: pointer;
}
.billing-text-quote-btn:hover { filter: brightness(1.05); }
.billing-text-quote-btn:disabled { opacity: 0.6; cursor: default; }

/* 📤 Resend Quote and 📅 Book Job — the same outline treatment as the rest of
   the row, so it reads as one set of controls rather than some plus a stray.
   Book Job had gone without a rule since it was added; Allan spotted it the
   moment a second unstyled button appeared beside it (2026-08-28).

   🪤 There is NO fallback rule for a button in .billing-row-inline-actions:
   that container sets the flex and the gap and nothing else. A button added
   without its own rule here renders as a raw grey browser default beside the
   matching pills — it works perfectly and looks broken, which is the worst
   combination to ship. Add the rule in the SAME change as the button.
   ✉️ See the email we sent and 📋 Copy to another site or person fell into
   exactly that trap — both shipped with no rule and showed as small grey
   browser pills (spotted in Allan's phone screenshot, 27 Nov 2026). */
.billing-book-job-btn,
.billing-edit-quote-btn,
.billing-sent-email-btn,
.billing-copy-to-btn,
.billing-resend-quote-btn,
.billing-resend-invoice-btn {
  font-weight: 700;
  font-size: 14px;
  padding: 8px 14px;
  border-radius: 8px;
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  background: #fff;
  color: var(--accent);
  border: 1.5px solid var(--accent);
  cursor: pointer;
}
.billing-book-job-btn:hover,
.billing-edit-quote-btn:hover,
.billing-sent-email-btn:hover,
.billing-copy-to-btn:hover,
.billing-resend-quote-btn:hover,
.billing-resend-invoice-btn:hover { filter: brightness(1.05); }
.billing-book-job-btn:disabled,
.billing-edit-quote-btn:disabled,
.billing-sent-email-btn:disabled,
.billing-copy-to-btn:disabled,
.billing-resend-quote-btn:disabled,
.billing-resend-invoice-btn:disabled { opacity: 0.6; cursor: default; }

/* 🧾 Reference / PO on an invoice (19 Oct 2026, Your Business Here while on
   test). The same outline pill as the row's other controls, a size down
   because it sits inline after the PO itself. Its own rule, per the note above. */
.billing-po-btn {
  font-weight: 700;
  font-size: 13px;
  padding: 4px 10px;
  border-radius: 8px;
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  margin-left: 6px;
  background: #fff;
  color: var(--accent);
  border: 1.5px solid var(--accent);
  cursor: pointer;
}
.billing-po-btn.is-primary { background: var(--accent); color: var(--accent-ink); }
.billing-po-btn:hover { filter: brightness(1.05); }
.billing-po-btn:disabled { opacity: 0.6; cursor: default; }
@media (pointer: coarse) { .billing-po-btn { min-height: 44px; } }

/* 🛠 Which job(s) an invoice was for, each with Open job (6 Nov 2026). The
   button is the PO's outline pill, so the open invoice has one kind of control. */
.billing-invjobs { display: grid; gap: 4px; margin: 6px 0; }
.billing-invjobs:empty { display: none; }
.billing-invjob { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; }
.billing-invjob-open {
  font-weight: 700;
  font-size: 13px;
  padding: 4px 10px;
  border-radius: 8px;
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  background: #fff;
  color: var(--accent);
  border: 1.5px solid var(--accent);
  cursor: pointer;
}
.billing-invjob-open:hover { filter: brightness(1.05); }
@media (pointer: coarse) { .billing-invjob-open { min-height: 44px; } }
.billing-invjobs-wait { color: #555c66; }
.billing-invjobs-warn { color: #92400e; font-weight: 600; }
/* 🛠 Open job's pop-up over an invoice (Allan, 6 Nov 2026: "Could we just open
   this in a pop up modal?") — the card's (.cf-jobpop) and the Full Contact
   Record's (.rec-jobpop, record.css). Wider than a notice on a desktop, the
   whole screen on a phone. The job scrolls inside; the title and ✕ Close /
   Go to job stay put. */
.mobile-notice-overlay .mobile-notice-dialog.job-popup { width: min(100% - 32px, 720px); }
.mobile-notice-overlay .mobile-notice-dialog.job-popup.rec-jobpop { width: min(100% - 32px, 960px); }
@media (max-width: 640px) {
  .mobile-notice-overlay .mobile-notice-dialog.job-popup,
  .mobile-notice-overlay .mobile-notice-dialog.job-popup.rec-jobpop {
    width: 100%; margin: 0; border-radius: 0; padding: 16px 12px 14px;
    height: 100vh; height: 100dvh; max-height: none;
  }
}
.cf-jobpop-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; font-size: 14px; color: var(--ink); }
.cf-jobpop-head { display: flex; flex-direction: column; gap: 2px; padding-bottom: 8px; margin-bottom: 6px; border-bottom: 1px solid var(--line); }
.cf-jobpop-date { font-weight: 700; font-size: 15px; }
.cf-jobpop-title { font-weight: 600; font-size: 15px; }
/* 📅 A quick look's title and ← Back, on the card, the record and the Company
   Record: the DATE first and bold, then what it is a little lighter (Allan, 6 Nov
   2026: "make sure the Quick views etc all have the DATE first BOLD"). */
.ql-head-date { font-weight: 700; font-variant-numeric: tabular-nums; }
.ql-head-what { font-weight: 500; }
/* 🔎 Inside the quick look: "← Back to the job" when one look led to another,
   and the invoice's way into GetBookedUp's own screen at the foot. */
.cf-qlback { margin: 0 0 8px; }
/* ⓘ A guide in a panel down the right (guide-panel.js; Allan, 6 Nov 2026: "read
   the guide while you work, then close it"). Not a dialog: the page beside it
   keeps working, and on a wide screen it moves over to make room. The whole
   screen on a phone. Below the pop-ups (9999), so a confirm still shows over it. */
.guide-panel {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 9000;
  width: min(560px, 46vw); display: flex; flex-direction: column;
  background: var(--card, #fff); border-left: 1px solid var(--line); box-shadow: -8px 0 24px rgba(17, 24, 39, .12);
}
.guide-panel[hidden] { display: none; }
.guide-panel__head { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.guide-panel__title { flex: 1 1 auto; margin: 0; font-size: 16px; font-weight: 700; color: var(--ink); min-width: 0; }
.guide-panel__tab { font-size: 13px; font-weight: 600; color: var(--accent, #006aac); white-space: nowrap; }
.guide-panel__close { font: inherit; font-size: 14px; font-weight: 600; white-space: nowrap; padding: 6px 12px; min-height: 36px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink); cursor: pointer; }
.guide-panel__msg { margin: 12px; font-size: 14px; font-weight: 600; color: #92400e; }
.guide-panel__frame { flex: 1 1 auto; width: 100%; border: 0; background: #fff; }
@media (min-width: 1100px) {
  html.guide-panel-open body { margin-right: min(560px, 46vw); }
}
@media (max-width: 700px) {
  .guide-panel { width: 100%; border-left: 0; box-shadow: none; }
}
@media (pointer: coarse) { .guide-panel__close { min-height: 44px; } }
/* 🔎 An opportunity's linked quotes, jobs and visits, each one press from a look. */
.opp-looks { display: flex; flex-wrap: wrap; gap: 6px; margin: 2px 0 10px; }
.cf-jobpop-open { margin: 10px 0 0; font-weight: 600; }
/* "← Back to INV-000046" at the top of the job Go to job opened. */
.job-row-back { margin: 0 0 8px; }
/* 🛠 …and on the CLOSED invoice row, under the price and pill: words only. */
.billing-row-jobs { display: block; font-size: 13px; color: var(--ink); white-space: normal; }
.billing-row-jobs:empty { display: none; }
/* The job Open job landed on, ringed for a moment so the eye finds it. */
.job-row-found { outline: 3px solid var(--accent); outline-offset: 2px; }
.billing-po-edit { margin-top: 8px; }
.billing-po-edit label { display: block; font-weight: 600; font-size: 13px; margin-bottom: 3px; }
.billing-po-edit input {
  width: 100%;
  max-width: 300px;
  box-sizing: border-box;
  font: inherit;
  font-size: 15px;
  padding: 8px 10px;
  border: 1.5px solid var(--line);
  border-radius: 8px;
  min-height: 44px;
}
.billing-po-help { font-size: 13px; color: var(--ink); margin-top: 4px; line-height: 1.45; max-width: 460px; }
.billing-po-help.warn { color: #92400e; }
.billing-po-actions { display: flex; gap: 8px; margin-top: 6px; flex-wrap: wrap; }
.billing-po-actions .billing-po-btn { margin-left: 0; }

/* 🗑 Delete Quote — the same size and shape as its neighbours so the row stays
   one set of controls, but a RED outline rather than the accent, because it is
   the only button here that destroys something.
   👁 The colour is not carrying that on its own: the button says 🗑 and the word
   "Delete", and the sheet it opens spells out what will happen before anything
   is touched. Colour is the third signal, never the only one. */
.billing-delete-quote-btn {
  font-weight: 700;
  font-size: 14px;
  padding: 8px 14px;
  border-radius: 8px;
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  background: #fff;
  color: var(--warn, #c0392b);
  border: 1.5px solid var(--warn, #c0392b);
  cursor: pointer;
}
.billing-delete-quote-btn:hover { background: #fdecea; }
.billing-delete-quote-btn:disabled { opacity: 0.6; cursor: default; }

/* 📅 Change expiry date — same size and shape as its neighbours, outlined in
   the GHL blue: it changes the quote but destroys nothing. 🔀 Move to a site or
   person is the same kind of button: it moves the quote, it deletes nothing. */
.billing-expiry-quote-btn,
.billing-move-quote-btn {
  font-weight: 700;
  font-size: 14px;
  padding: 8px 14px;
  border-radius: 8px;
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  background: #fff;
  color: #006aac;
  border: 1.5px solid #006aac;
  cursor: pointer;
}
.billing-expiry-quote-btn:hover,
.billing-move-quote-btn:hover { background: #e8f2f9; }
/* An expired quote says so in words (⌛ Expired); the colour is the second signal. */
.billing-expired { color: var(--warn, #c0392b); }

/* The composer drops in below the button row, full width — a pre-filled quote
   is a dozen lines and must not be squeezed into the inline-actions flex row. */
.billing-sms-slot:empty { display: none; }
.billing-sms-slot { display: block; width: 100%; margin-top: 8px; }

/* 🧾 Xero. ONE flex item, so its status line and its button stay together and
   the row can never split them across the gap.
   📏 It used to take the whole row (flex-basis: 100%), which put a lone
   "📤 Send to Xero" on a line of its own under Preview / Open in Main system.
   Allan, 22 Oct 2026: "make these all on one line". Now it sits beside them
   when it fits; a long ⚠ note is wide enough to wrap to its own line, and on
   a phone the row wraps as before. Empty (no Xero here, or still asking) it
   takes no room — not even the row's gap. */
.billing-xero-slot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}
.billing-xero-slot:empty { display: none; }

/* 📱 On a PHONE, an open quote's or invoice's buttons are laid out like an app:
   full width, words centred, 44px tall for a thumb — rather than a cluster of
   pills hugging the right edge (Allan, 27 Nov 2026). Two sit side by side ONLY
   where they are the same kind of action, and the order runs top to bottom the
   way the job does (his words: "the order must make sense"):
     👁 Preview | ✉️ See the email we sent     — what the customer has
     📅 Book Job, 🔗 Use on a booked job        — the next step
     📤 Resend | 💬 Text Simple Quote          — send it again, email or text
     ✏️ Edit | 📋 Copy Quote                   — both open it in the quoting tool
     Copy to a site · Move · Change expiry      — the rarer ones
     Open in Main system ↗                      — leaving the app
     🗑 Delete                                   — always last, out of a stray thumb's way
   Invoices: Preview, 📤 Resend Invoice, Xero, Open in Main system.
   The order is `order`, so the markup (and the computer's one-line row, as he
   asked on 22 Oct) is untouched. PHONE = the same test as the card's sticky
   header above: narrow, or a phone on its side. */
@media (max-width: 767px), (orientation: landscape) and (max-height: 600px) and (pointer: coarse) {
  .billing-row-inline-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }
  .billing-row-inline-actions > * { grid-column: 1 / -1; order: 60; }
  .billing-row-inline-actions > a,
  .billing-row-inline-actions > button,
  .billing-row-inline-actions .billing-xero-btn {
    width: 100%;
    box-sizing: border-box;
    justify-content: center;
    text-align: center;
    min-height: 44px;
  }
  .billing-row-inline-actions > .billing-preview-link      { order: 10; }
  .billing-row-inline-actions > .billing-sent-email-btn    { order: 11; }
  .billing-row-inline-actions > .billing-book-job-btn      { order: 20; }
  .billing-row-inline-actions > .billing-attach-quote-btn  { order: 21; }
  .billing-row-inline-actions > .billing-resend-quote-btn  { order: 30; }
  .billing-row-inline-actions > .billing-text-quote-btn    { order: 31; }
  .billing-row-inline-actions > .billing-resend-invoice-btn { order: 32; }
  .billing-row-inline-actions > .billing-xero-slot         { order: 33; }
  .billing-row-inline-actions > .billing-edit-quote-btn    { order: 40; }
  .billing-row-inline-actions > .billing-copy-quote-btn    { order: 41; }
  .billing-row-inline-actions > .billing-copy-to-btn       { order: 50; }
  .billing-row-inline-actions > .billing-move-quote-btn    { order: 51; }
  .billing-row-inline-actions > .billing-expiry-quote-btn  { order: 52; }
  .billing-row-inline-actions > .billing-open-link         { order: 90; }
  .billing-row-inline-actions > .billing-delete-quote-btn  { order: 99; }
  /* The three pairs: half the width each… */
  .billing-row-inline-actions > .billing-preview-link,
  .billing-row-inline-actions > .billing-sent-email-btn,
  .billing-row-inline-actions > .billing-resend-quote-btn,
  .billing-row-inline-actions > .billing-text-quote-btn,
  .billing-row-inline-actions > .billing-edit-quote-btn,
  .billing-row-inline-actions > .billing-copy-quote-btn { grid-column: auto; padding-left: 6px; padding-right: 6px; }
  /* …unless its partner isn't drawn (a draft has no sent email, an invoiced
     quote has no Resend or Edit, an invoice has no partner for Preview): then
     it takes the whole line rather than leaving half of it empty. */
  .billing-row-inline-actions:not(:has(> .billing-sent-email-btn)) > .billing-preview-link,
  .billing-row-inline-actions:not(:has(> .billing-preview-link)) > .billing-sent-email-btn,
  .billing-row-inline-actions:not(:has(> .billing-text-quote-btn)) > .billing-resend-quote-btn,
  .billing-row-inline-actions:not(:has(> .billing-resend-quote-btn)) > .billing-text-quote-btn,
  .billing-row-inline-actions:not(:has(> .billing-copy-quote-btn)) > .billing-edit-quote-btn,
  .billing-row-inline-actions:not(:has(> .billing-edit-quote-btn)) > .billing-copy-quote-btn { grid-column: 1 / -1; }
  /* Xero's status words sit centred above its button rather than off to the right. */
  .billing-row-inline-actions .billing-xero-slot { justify-content: center; text-align: center; }
}
.billing-xero-btn {
  font-weight: 700;
  font-size: 14px;
  padding: 8px 14px;
  border-radius: 8px;
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  background: #fff;
  color: var(--accent);
  border: 1.5px solid var(--accent);
  cursor: pointer;
}
.billing-xero-btn:hover { filter: brightness(1.05); }
.billing-xero-btn:disabled { opacity: 0.6; cursor: default; }
/* Icon AND words carry the meaning — never colour alone. */
.billing-xero-done {
  font-size: 13px;
  font-weight: 700;
  color: #1f7a44;
  display: inline-flex;
  align-items: center;
}
.billing-xero-note {
  font-size: 13px;
  color: var(--ink);
  opacity: .85;
  text-align: right;
}
/* An edit made after the invoice reached the accounts. Bordered rather than a
   line of coloured text, because this is the one thing here that a bookkeeper
   has to act on. */
.billing-xero-warn {
  flex-basis: 100%;
  font-size: 12.5px;
  line-height: 1.45;
  color: #78350f;
  background: #fffbeb;
  border: 1px solid #f59e0b;
  border-radius: 8px;
  padding: 8px 10px;
  text-align: left;
}

/* The "which booking is this quote for?" picker. Rows get 44px because this
   reaches a phone: the portal iframes /app.html, which is how sign-off and
   take-payment got onto one without a second implementation. */
/* The dialog scrolls, not a box inside it (2026-09-15): an opened booking's
   buttons sat below a second, inner scrollbar — the same thing Allan turned
   off in the diary's quote picker. */
.attach-quote-dialog { max-width: 520px; overflow-y: auto; }
.attach-quote-sub { font-size: 13px; color: #64748b; line-height: 1.45; margin: 0 0 10px; }
.attach-quote-list {
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  text-align: left;
}
.attach-quote-empty { padding: 14px; font-size: 13px; color: #64748b; line-height: 1.45; }
.attach-quote-row {
  display: flex;
  flex-direction: column;
  gap: 3px;
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 0;
  border-bottom: 1px solid #f1f5f9;
  background: #fff;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.attach-quote-row:hover { background: #f8fafc; }
.attach-quote-row:disabled { opacity: 0.6; cursor: default; }
.attach-quote-when { font-size: 13px; font-weight: 700; color: #0f172a; }
.attach-quote-title { font-size: 12.5px; color: #334155; }
/* Icon AND words on the chip — colour is never the only carrier of meaning. */
.attach-quote-chip {
  align-self: flex-start;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 999px;
  background: #f1f5f9;
  color: #334155;
}
.attach-quote-chip.has { background: #fef3c7; color: #78350f; }
.attach-quote-chip.this { background: #e6f2fa; color: #004f80; }

/* PREVIEW AND UNLINK (2026-09-15). A booking OPENS to show what is on it; only
   its buttons change anything. An opened one is a CARD — thick dark outline,
   bolder heading — so it stands out by outline and weight, not colour (Allan is
   colourblind; the diary's picker uses the same look, which he chose). */
.attach-quote-item { border-bottom: 1px solid #e2e8f0; }
.attach-quote-item .attach-quote-row { border-bottom: 0; flex-direction: row; align-items: center; gap: 10px; }
.aq-head { display: flex; flex-direction: column; gap: 3px; flex: 1; min-width: 0; }
.aq-chev {
  flex: none;
  border: 1.5px solid #94a3b8;
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 12px;
  font-weight: 600;
  color: #334155;
  white-space: nowrap;
}
.attach-quote-item.is-open {
  margin: 8px;
  border: 2px solid #334155;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.16);
}
.attach-quote-item.is-open .attach-quote-when { font-weight: 800; }
.aq-body {
  padding: 10px 12px 12px;
  background: #f1f5f9;
  border-top: 1px solid #cbd5e1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 13px;
  color: #334155;
}
/* 🪤 The display:flex above silently beats the hidden attribute, and this file
   has no global [hidden] rule — without this every booking shows its details
   and "Show / Hide" only toggles the outline. Caught in the mockup by Allan. */
.aq-body[hidden] { display: none; }
.aq-note { font-size: 12.5px; color: #475569; line-height: 1.45; }
.aq-from { display: flex; justify-content: space-between; gap: 10px; font-weight: 600; color: #0f172a; }
.aq-lines { display: grid; grid-template-columns: 1fr auto; gap: 3px 12px; font-size: 13px; }
.aq-lines .m { text-align: right; font-variant-numeric: tabular-nums; color: #0f172a; white-space: nowrap; }
.aq-lines .d { grid-column: 1; font-size: 12px; color: #64748b; margin-top: -2px; }
.aq-qty { font-size: 12px; color: #64748b; white-space: nowrap; }
.aq-quoted { font-size: 12.5px; white-space: pre-line; }
.aq-total {
  display: flex;
  justify-content: space-between;
  border-top: 1px solid #cbd5e1;
  padding-top: 6px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.aq-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.aq-actions .btn { min-height: 44px; }

/* 🗑 DELETE QUOTE sheet. It is a reading sheet, not a form: the warnings, the
   chase tick boxes and the pipeline-card tick all have to be taken in BEFORE
   the red button is pressed, so everything is sized to be read rather than
   skimmed, and the button row stays pinned at the bottom. */
.delete-quote-dialog { max-width: 520px; overflow-y: auto; }
.delete-quote-body { display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; }
.delete-quote-loading { margin: 0; font-size: 13px; color: #64748b; }
.delete-quote-lead { margin: 0; font-size: 14px; line-height: 1.5; color: #0f172a; }
.delete-quote-note { margin: 0; font-size: 12.5px; line-height: 1.45; color: #64748b; }
.delete-quote-sub { font-size: 12px; color: #64748b; font-weight: 400; }
/* A warning is the thing most worth not missing here — "they have accepted
   this", "it is on a booked job". Left bar + ⚠️ + amber, so it reads as a
   warning by shape and word as well as by colour. */
.delete-quote-warn {
  margin: 0;
  font-size: 13px;
  line-height: 1.45;
  color: #78350f;
  background: #fef3c7;
  border-left: 4px solid #b45309;
  border-radius: 6px;
  padding: 8px 10px;
}
.delete-quote-error { margin: 0; font-size: 13.5px; line-height: 1.45; color: var(--warn, #c0392b); }
.delete-quote-chase {
  display: flex;
  flex-direction: column;
  gap: 8px;
  border: 1.5px solid #cbd5e1;
  border-radius: 10px;
  padding: 10px 12px;
  background: #f8fafc;
}
.delete-quote-chase-title { margin: 0; font-size: 13px; font-weight: 800; color: #0f172a; }
/* Each tick is its own tap target — these are the boxes staff are deciding
   about one at a time, and a 44px row is the difference between ticking what
   you meant and ticking the line below it on a phone. */
.delete-quote-tick {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  font-size: 13px;
  line-height: 1.45;
  color: #0f172a;
  min-height: 44px;
  cursor: pointer;
}
.delete-quote-tick input { margin-top: 2px; width: 18px; height: 18px; flex: none; }
.delete-quote-steps { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 5px; font-size: 13px; line-height: 1.45; color: #0f172a; }
.delete-quote-cancel {
  background: var(--card, #fff);
  border: 1.5px solid var(--ink, #11141a);
  color: var(--ink, #11141a);
}
/* The one button on the card that destroys something: filled red, not an
   outline, so it never gets pressed in passing. */
.delete-quote-go {
  background: var(--warn, #c0392b);
  border: 1.5px solid var(--warn, #c0392b);
  color: #fff;
  font-weight: 800;
}
.delete-quote-go:hover { filter: brightness(1.05); }
.delete-quote-go:disabled { opacity: 0.6; cursor: default; }

.billing-load-more {
  display: flex;
  justify-content: center;
  padding: 6px 0 2px;
}

/* ── Quotes & Jobs notes (per-card slot below the action buttons) ──────── */
.notes-slot { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.notes-slot:empty { display: none; }

/* 🫥 THE SHEETS ROWS ARE HIDDEN BY ATTRIBUTE, AND THIS IS WHAT MAKES THAT WORK.
   Both carry a `display:` of their own — .btn-row is a grid, .notes-slot a flex
   column — and a `display:` rule silently beats the `hidden` attribute. This
   stylesheet has no global [hidden] rule (see .group-body[hidden], .aq-body
   [hidden], .contact-details[hidden]: they are fixed one at a time), so without
   this line the Sheets would render on every tier and nothing would look wrong
   in the markup. Scoped to [data-sheets] rather than added globally: a
   fleet-wide [hidden] rule is the better fix, but not one to slip into a
   feature deploy. */
[data-sheets][hidden] { display: none !important; }

.notes-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  overflow: hidden;
}
.notes-panel-head {
  padding: 8px 12px;
  font-weight: 700;
  font-size: 14px;
  color: var(--ink);
  background: var(--pill);
  border-bottom: 1px solid var(--line);
}
.notes-panel-body { padding: 4px 0; }
.notes-loading, .notes-empty, .notes-error {
  padding: 12px;
  font-size: 14px;
  color: var(--ink);
}
.notes-error { color: var(--warn); }
.notes-retry {
  margin-left: 8px;
  background: none;
  border: 1px solid var(--warn);
  color: var(--warn);
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
}

.notes-panel-body { padding: 8px; display: flex; flex-direction: column; gap: 6px; }
.notes-row {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card);
  overflow: hidden;
}
.notes-row.band-a { background: var(--card); }
.notes-row.band-b { background: #f7fafc; }
.notes-row.is-open {
  border-color: var(--accent);
  box-shadow: 0 1px 4px rgba(0, 106, 172, 0.12);
}
.notes-row-head {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 14px;
  background: var(--pill);
  border: 0;
  border-bottom: 1px solid var(--line);
  font: inherit;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  min-height: 48px;
}
.notes-row.is-open .notes-row-head {
  background: rgba(0, 106, 172, 0.10);
  border-bottom-color: var(--accent);
}
.notes-row-date {
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 3px 8px;
}
.notes-row-preview {
  font-size: 15px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.notes-row-caret {
  font-size: 22px;
  line-height: 1;
  color: var(--accent);
  width: 24px;
  text-align: center;
  font-weight: 700;
}
.notes-row.is-open .notes-row-caret { color: var(--accent); }
.notes-row-body {
  border-top: 1px dashed var(--line);
  padding: 8px 12px 10px;
}
.notes-row-text {
  margin: 0 0 6px;
  /* Restated rather than inherited because a note may render inside a <pre>-ish
     context; keep it on Inter with the body's own fallback chain, or this one
     block drops back to Segoe UI while everything around it is Inter. */
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, system-ui, sans-serif;
  font-size: 14px;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--ink);
}
.notes-row-inline-actions {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.notes-row-edit, .notes-row-tojob, .notes-row-delete {
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  min-height: 36px;
  background: #fff;
}
.notes-row-edit { border: 1px solid var(--line, #d8dde4); color: var(--ink, #11141a); }
.notes-row-tojob { border: 1px solid var(--accent, #006AAC); color: var(--accent, #006AAC); }
.notes-row-tojob:hover { background: var(--accent, #006AAC); color: #fff; }
.notes-row-delete { border: 1px solid var(--warn); color: var(--warn); }
.notes-row-delete:hover { background: var(--warn); color: #fff; }
.notes-row-delete:disabled { opacity: 0.6; cursor: default; }

/* Inline note editor */
.note-edit { margin-bottom: 8px; display: grid; gap: 8px; }
.note-edit-text {
  width: 100%;
  font: inherit;
  font-size: 15px;
  padding: 9px 10px;
  border: 1.5px solid var(--line, #d8dde4);
  border-radius: 6px;
  min-height: 120px;
  background: var(--card, #fff);
  color: var(--ink, #11141a);
}
.note-edit-actions { display: flex; gap: 8px; }
.note-edit-save { background: var(--accent, #006AAC); color: #fff; border: 1.5px solid var(--accent, #006AAC); }
.note-edit-cancel { background: var(--card, #fff); border: 1.5px solid var(--ink, #11141a); color: var(--ink, #11141a); }
.note-edit-msg { font-size: 13px; min-height: 1em; }
.photos-upload-msg { font-size: 13px; line-height: 1.4; margin: 6px 0; min-height: 1em; }
/* 📝 "What is this photo of?" after an upload (the diary pop-up's question, on the card). */
.photos-ask { display: grid; gap: 6px; margin: 4px 0 10px; }
.photos-ask[hidden], .photos-said[hidden], .photos-ask__err[hidden] { display: none; }
.photos-ask__label { font-weight: 600; font-size: 14px; }
.photos-ask__box {
  width: 100%;
  box-sizing: border-box;
  font: inherit;
  font-size: 15px;
  padding: 9px 10px;
  border: 1.5px solid var(--line, #d8dde4);
  border-radius: 6px;
  background: var(--card, #fff);
  color: var(--ink, #11141a);
  resize: vertical;
}
.photos-ask__hint { font-size: 13px; color: var(--ink-soft); }
.photos-ask__actions { display: flex; gap: 8px; flex-wrap: wrap; }
.photos-ask__err { font-size: 13px; color: var(--warn); }
.photos-said { font-size: 13px; color: var(--good); margin: 0 0 8px; }

.notes-collapse-bar {
  display: flex;
  justify-content: flex-end;
  padding: 4px 0;
}
.btn-link {
  background: none;
  border: 0;
  color: var(--accent);
  font: inherit;
  font-weight: 600;
  text-decoration: underline;
  cursor: pointer;
  padding: 8px 12px;
  min-height: 44px;
}

/* Add-note inline form */
.note-add {
  border: 1.5px solid var(--accent);
  border-radius: var(--radius);
  background: var(--card);
  padding: 12px;
}
.note-add-head {
  font-weight: 700;
  font-size: 14px;
  margin-bottom: 8px;
}
.note-add-preview {
  font-size: 13px;
  color: var(--ink);
  background: var(--pill);
  border-radius: 8px;
  padding: 8px 10px;
  margin-bottom: 8px;
  line-height: 1.4;
}
.note-add-preview-line { font-variant-numeric: tabular-nums; }
.note-add-text {
  width: 100%;
  min-height: 7rem;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  font: inherit;
  color: var(--ink);
  background: #fff;
}
.note-add-text:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
/* Date picker row on the add-note panel — label + native date input, plus the
   "Visit?" tick box pushed to the end of the line. */
.note-add-daterow { display: flex; align-items: center; gap: 10px; margin: 8px 0 2px; }
.note-add-datefield { display: inline-flex; align-items: center; gap: 10px; }
.note-add-datelabel { font-size: 13px; font-weight: 600; color: var(--ink, #11141a); }
/* "Visit?" sits at the end of the date row; ticking reveals Time + Arrival. */
.note-visit { display: inline-flex; align-items: center; gap: 6px; margin-left: auto; font-size: 13px; font-weight: 600; color: var(--ink, #11141a); cursor: pointer; }
.note-visit input { width: 18px; height: 18px; flex: 0 0 auto; cursor: pointer; }
.note-add-date {
  font: inherit;
  font-size: 16px;            /* 16px+ stops iOS zooming in on focus */
  padding: 7px 10px;
  border: 1px solid var(--line, #d7dbe2);
  border-radius: 8px;
  background: #fff;
  color: var(--ink, #11141a);
}
.note-add-date:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
/* Job price row (jobs only) — totals in Reports → Jobs by Date. */
.note-add-pricerow { display: flex; align-items: center; gap: 10px; margin: 8px 0 2px; flex-wrap: wrap; }
.note-add-pricefield { display: inline-flex; align-items: center; gap: 10px; }
.note-add-price {
  font: inherit; font-size: 16px;   /* 16px+ stops iOS zoom on focus */
  padding: 7px 10px; width: 120px;
  border: 1px solid var(--line, #d7dbe2); border-radius: 8px;
  background: #fff; color: var(--ink, #11141a);
}
.note-add-price:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.note-add-pricehint { font-size: 12px; color: var(--ink-soft, #5a6472); }
/* Job time row + arrival Fixed/Flexible toggle on the add-note panel. */
.note-add-timerow, .note-add-arrivalrow { display: flex; align-items: center; gap: 10px; margin: 8px 0 2px; flex-wrap: wrap; }
.note-add-to { color: var(--ink-soft, #5a6472); font-size: 13px; }
/* Time = Hour + Minute selects (the minute list is only 00/15/30/45, so iOS
   physically can't land on an off-step minute — unlike <input type=time>,
   which ignores `step` on the native wheel). */
.note-time { display: inline-flex; align-items: center; gap: 2px; min-width: 0; }
.note-time-colon { color: var(--ink, #11141a); font-weight: 700; }
.note-time select {
  font: inherit; font-size: 16px; /* 16px stops iOS zoom-on-focus */
  padding: 7px 8px; border: 1px solid var(--line, #d7dbe2); border-radius: 8px;
  background: #fff; color: var(--ink, #11141a);
  min-width: 0;
  /* Drop the native dropdown chevron — it eats ~18px per box, and the wheel
     that opens on tap makes the affordance obvious. Lets all four fit one row. */
  -webkit-appearance: none; -moz-appearance: none; appearance: none;
  text-align: center; text-align-last: center;
}
.note-time select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
/* Keep the whole start–end range on ONE line on phones: no wrap + tight gaps. */
.note-add-timerow { flex-wrap: nowrap; gap: 6px; }
.note-add-timerow .note-add-datelabel { flex: 0 0 auto; }
.note-add-timerow .note-add-to { flex: 0 0 auto; }
.note-arr-toggle { display: inline-flex; border: 1px solid var(--line, #d7dbe2); border-radius: 8px; overflow: hidden; }
.note-arr-btn {
  font: inherit; font-size: 14px; font-weight: 600; padding: 7px 18px;
  background: #fff; color: var(--ink-soft, #5a6472); border: 0; border-left: 1px solid var(--line, #d7dbe2); cursor: pointer;
}
.note-arr-btn:first-child { border-left: 0; }
.note-arr-btn.is-active { background: var(--accent, #006AAC); color: #fff; }
/* When "Visit?" is unticked, grey out + lock the Time + Arrival rows. The inputs
   also carry `disabled` (set in JS), which keeps them out of tab order. */
.note-add.no-visit .note-add-timerow,
.note-add.no-visit .note-add-arrivalrow,
.note-edit.no-visit .note-add-timerow,
.note-edit.no-visit .note-add-arrivalrow { opacity: .45; pointer-events: none; }
.note-add-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 8px;
}
.note-add-msg { font-size: 13px; min-height: 18px; margin-top: 6px; }

/* "Open" state on the View / Add buttons — subtle ring so user sees what's open.
   📋 Tasks joins them: doTasksAction has always set .is-open on it, but nothing
   styled it, so the one button on this card that toggles gave no sign it had. */
.btn[data-act^="notes-"].is-open,
.btn[data-act="tasks"].is-open {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

/* ── Embedded funnel form modal ─────────────────────────────────────────── */
.form-embed-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
}
.form-embed-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(17, 20, 26, 0.55);
}
.form-embed-dialog {
  position: relative;
  z-index: 1;
  width: min(100%, 720px);
  height: min(100%, 92vh);
  margin: 16px;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Wide popups (e.g. the GHL email editor — options left, live preview right).
   Only on big screens, so it never overrides the phone full-screen rule below. */
@media (min-width: 1024px) {
  .form-embed-dialog.is-wide {
    width: min(96vw, 1320px);
    height: min(100%, 94vh);
  }
}
.form-embed-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: var(--pill);
  border-bottom: 1px solid var(--line);
}
.form-embed-title {
  flex: 1;
  font-weight: 700;
  font-size: 15px;
  color: var(--ink);
}
.form-embed-popout {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  font-size: 18px;
  font-weight: 700;
  color: var(--accent);
  text-decoration: none;
  border-radius: 6px;
}
.form-embed-popout:hover { background: rgba(0, 106, 172, 0.10); }
.form-embed-close {
  background: none;
  border: 0;
  font: inherit;
  font-size: 20px;
  color: var(--ink);
  cursor: pointer;
  width: 36px;
  height: 36px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.form-embed-close:hover { background: rgba(255, 0, 0, 0.06); color: var(--warn); }
.form-embed-submitted-strip {
  background: #117a3a;
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  padding: 8px 14px;
  text-align: center;
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}
.form-embed-iframe {
  flex: 1;
  width: 100%;
  border: 0;
  display: block;
  background: #fff;
}
@media (max-width: 480px) {
  .form-embed-dialog { margin: 0; height: 100vh; width: 100vw; border-radius: 0; }
}

/* ── Mobile-only popup notice ─────────────────────────────────────────────
   Reuses .form-embed-modal for the fixed-position centred overlay (it
   handles backdrop + flex centring). The dialog itself is a smaller, more
   alert-styled box than the full embed dialog. */
.mobile-notice-overlay .mobile-notice-dialog {
  position: relative;
  z-index: 1;
  width: min(100%, 440px);
  margin: 16px;
  background: var(--card, #fff);
  border-radius: var(--radius, 8px);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
  padding: 22px 24px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  /* 🔴 A DIALOG TALLER THAN THE SCREEN IS UNREACHABLE, NOT MERELY UGLY. This
     box grew with its message and nothing capped it: the overlay is
     position:fixed, so the page does not scroll to reach what hangs off the
     edge. Measured 2026-09-02 with a six-line quote in the SMS confirm at
     1094×570 (the record inside GHL on a 1366 laptop): 594px tall, top edge at
     y=-12 with the title already cut off, and one more line would have put
     Send below the fold with no way to scroll to it or read what was being
     sent. The card hits the same thing on a phone.
     dvh second so it wins where supported — a phone's address bar is exactly
     the difference between "just fits" and "Send is under it". */
  max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 32px);
}
.mobile-notice-title {
  font-size: 18px;
  font-weight: 700;
  margin: 0;
  color: var(--ink, #11141a);
  flex: none;             /* the message gives, never the heading */
}
.mobile-notice-body {
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink, #11141a);
  margin: 0;
  /* 🪤 min-height:0 IS LOAD-BEARING. A flex child's default min-height is
     `auto` — its full content height — so overflow-y alone does nothing and the
     box goes on growing past max-height as if neither were set. Same shape as
     the crushed-display bug: a flex child does not behave until its floor is
     stated. */
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;   /* scrolling the quote must not scroll the page behind */
}
.mobile-notice-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 4px;
  flex: none;             /* Cancel and the action stay put and stay reachable */
}
.mobile-notice-actions .btn {
  padding: 10px 18px;
  font-size: 15px;
  font-weight: 600;
  min-height: 44px;
}
/* ☑ showChoose — pick one, as a tick list (2026-10-09). The list scrolls; the
   buttons below it stay put (min-height:0, same reason as .mobile-notice-body).
   A ticked row says so by its border and fill AND the filled radio — never
   colour alone. */
.cf-choose-list { display: grid; gap: 6px; margin: 2px 0 6px; overflow-y: auto; min-height: 0; max-height: 50vh; }
.cf-choose-opt {
  display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 6px 10px;
  border: 1px solid var(--line, #e3e8ef); border-radius: 8px; cursor: pointer;
  font-size: 15px; color: var(--ink, #11141a); background: #fff;
}
.cf-choose-opt:has(input:checked) { border: 2px solid var(--accent, #006aac); background: var(--pill, #eef4fb); }
.cf-choose-opt input { width: 18px; height: 18px; flex-shrink: 0; margin: 0; }
.cf-choose-opt > span { min-width: 0; overflow-wrap: anywhere; }
.mobile-notice-dialog .cf-confirm-ok:disabled,
.mobile-notice-dialog [data-rec-confirm="ok"]:disabled { opacity: .5; cursor: not-allowed; }
/* 🗑 "Type DELETE to confirm" — GHL's own guard on an irreversible delete
   (Allan, 2026-10-21). 16px so iOS does not zoom the page on focus; 44px tall
   to tap. The OK button stays greyed (above) until the word is typed. */
.mobile-notice-typed {
  display: grid; gap: 6px; flex: none;
  font-size: 15px; color: var(--ink, #11141a);
}
.mobile-notice-typed-input {
  font: inherit; font-size: 16px; min-height: 44px; padding: 8px 10px;
  border: 1.5px solid var(--ink-soft, #5b6575); border-radius: 8px; background: #fff;
  color: var(--ink, #11141a); letter-spacing: .04em;
}
.mobile-notice-typed-input:focus { outline: 3px solid var(--accent, #006aac); outline-offset: 1px; }
.mobile-notice-ok {
  background: var(--card, #fff);
  border: 1.5px solid var(--ink, #11141a);
  color: var(--ink, #11141a);
}
.mobile-notice-open {
  background: var(--ink, #11141a);
  color: #fff;
  border: 1.5px solid var(--ink, #11141a);
}

/* ── Loud action-failure popup ────────────────────────────────────────────
   Same scaffolding as the mobile notice, but unmissable: a warn-coloured
   accent bar + title so a misconfigured button can never silently "flash and
   do nothing" again. Help text is full --ink (smaller, not lighter) so it
   stays readable. */
.action-error-overlay .mobile-notice-dialog {
  border-top: 5px solid var(--warn, #c0392b);
}
.action-error-title { color: var(--warn, #c0392b); }
.action-error-help {
  font-size: 13px;
  line-height: 1.45;
  color: var(--ink, #11141a);
  margin: 0;
}
.action-error-ok {
  background: var(--ink, #11141a);
  color: #fff;
  border: 1.5px solid var(--ink, #11141a);
}

/* ── Teased (locked) features + upgrade modal ──────────────────────────────
   A locked button stays visible but dimmed with a 🔒; tapping it opens the
   upgrade modal instead of running its real action. */
/* Teased ELEMENT buttons go clearly lighter/grey so they read as "not on your
   plan". The section header you tap to GET to them is deliberately excluded
   (:not(.group-header)) — it stays normal so people click in and explore. */
.btn.is-locked:not(.group-header),
button.is-locked:not(.group-header) {
  opacity: 0.45;
  filter: grayscale(100%);
  cursor: pointer;           /* still tappable — it opens the upsell */
}
.is-locked .lock-ico { font-weight: 700; }
.upgrade-overlay .mobile-notice-dialog { border-top: 5px solid var(--accent, #006AAC); }
.upgrade-title { color: var(--accent, #006AAC); }
.upgrade-help {
  font-size: 13px;
  line-height: 1.45;
  color: var(--ink, #11141a);
  margin: 0;
}
.upgrade-book {
  background: var(--accent, #006AAC);
  color: #fff;
  border: 1.5px solid var(--accent, #006AAC);
  text-decoration: none;
  /* Stack: calendar icon on top, label centred below it, with breathing room. */
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 14px 16px;
  text-align: center;
  line-height: 1.35;
}
.upgrade-book .ub-ico { flex: 0 0 auto; font-size: 22px; line-height: 1; }
.upgrade-book .ub-txt { text-align: center; }
/* "Try it free" — the primary call to action in the upgrade modal. */
.upgrade-trial {
  background: var(--good, #1a7f4b);
  color: #fff;
  border: none;
  font-weight: 800;
}
.upgrade-trial:hover { filter: brightness(1.05); }
.upgrade-trial:disabled { opacity: .7; }

/* Delete Contact — low-emphasis red outline, set apart at the very bottom of the
   card so it's deliberate, never sitting next to the everyday buttons. */
.delete-contact {
  margin-top: 18px;
  background: #fff;
  color: var(--warn, #c0392b);
  border: 1.5px solid var(--warn, #c0392b);
  font-weight: 600;
}
.delete-contact:hover { background: #fdecea; }
.delete-contact:disabled { opacity: .6; }
/* Shown instead of the button to anyone who is not an admin — says why, in
   words with a 🔒, never a greyed button to guess at (Allan, 2026-10-21). */
.delete-contact-note {
  margin: 18px 0 0; font-size: 14px; line-height: 1.45; color: var(--ink, #11141a);
}
.upgrade-close {
  background: var(--card, #fff);
  border: 1.5px solid var(--ink, #11141a);
  color: var(--ink, #11141a);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

/* ── Read-only (lapsed subscription) banner ─────────────────────────────── */
.readonly-banner {
  position: sticky;
  top: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 10px 14px;
  background: #8a1c1c;            /* deep red — clearly "attention", not error-spam */
  color: #fff;
  font-weight: 600;
  line-height: 1.35;
  box-shadow: 0 2px 6px rgba(0,0,0,.18);
}
.readonly-banner__msg { flex: 1 1 240px; }
.readonly-banner__btn {
  flex: 0 0 auto;
  background: #fff;
  color: #8a1c1c;
  border: none;
  font-weight: 800;
  padding: 8px 18px;
  text-decoration: none;
}
.readonly-banner__btn:hover { background: #ffe9e9; }

/* ── Trial countdown chip ───────────────────────────────────────────────── */
.trial-chip {
  position: fixed;
  right: 12px;
  bottom: 12px;
  z-index: 55;
  background: var(--accent, #006AAC);
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  padding: 7px 13px;
  border-radius: 999px;
  box-shadow: 0 2px 8px rgba(0,0,0,.2);
}
.trial-chip--soon { background: #b5651d; }  /* amber/brown when ≤7 days */
/* Inline demo video in the upgrade popup (16:9, responsive). */
.upgrade-video {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 8px;
  overflow: hidden;
  background: #000;
}
.upgrade-video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.upgrade-watch {
  display: inline-block;
  font-weight: 700;
  color: var(--accent, #006AAC);
  text-decoration: none;
  padding: 4px 0;
}

/* ── Card "all details" block (Basic tier = app is the only interface) ─────── */
.cd-toggle {
  margin-top: 8px;
  background: none;
  border: 0;
  padding: 4px 0;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent, #006AAC);
  cursor: pointer;
}
.contact-details {
  margin-top: 8px;
  border-top: 1px solid var(--line, #e6e9ee);
  padding-top: 8px;
  display: grid;
  gap: 10px;
}
/* Rows live in a nested wrapper (so "Show all fields" can swap them) — keep the
   same row spacing as the grid would have given them directly. */
.contact-details [data-cd-rows] { display: grid; gap: 10px; }
/* "Show all fields" one-off reveal — subtler than the main details toggle. */
.cd-allfields {
  margin-top: 4px;
  background: none;
  border: 0;
  padding: 4px 0;
  font: inherit;
  font-size: 12.5px;
  color: var(--ink-soft, #5a6472);
  text-decoration: underline;
  cursor: pointer;
}
/* The [hidden] attribute must beat `display: grid` for the toggle to work. */
.contact-details[hidden] { display: none; }
/* Stack: field name on top, value on its own line below, right-aligned —
   long values no longer get crushed against a right-aligned column. */
.cd-row {
  display: block;
  font-size: 13px;
  line-height: 1.4;
}
.cd-label { display: block; color: var(--ink-soft, #5a6472); font-weight: 600; }
.cd-val { display: block; color: var(--ink, #11141a); text-align: left; word-break: break-word; }
/* Unreliable values (e.g. Total Spend — we can't total what we don't capture). */
.cd-row--muted .cd-label,
.cd-row--muted .cd-val { color: var(--ink-soft, #9aa3af); opacity: 0.65; }
/* Bold the postcode in the header address (key field for sat-nav). */
.address strong, .addr-postcode { font-weight: 700; }
/* Coaching hint above the note box (set Last Quote/Job date from line 1). */
.note-add-hint { font-size: 12px; color: var(--ink-soft, #5a6472); margin: 6px 0; line-height: 1.4; }
.note-add-hint strong { color: var(--ink, #11141a); }

/* ── Inline contact edit (Basic tier writes back to GHL) ──────────────────── */
.edit-contact {
  margin-top: 8px;
  background: none;
  border: 0;
  padding: 4px 0;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent, #006AAC);
  cursor: pointer;
}
.edit-form {
  margin-top: 10px;
  border-top: 1px solid var(--line, #e6e9ee);
  padding-top: 10px;
  display: grid;
  gap: 8px;
}
/* ✏️ While Edit details is open the name block lets go and scrolls away with
   the card. Allan, 2026-10-15: pinned, it kept ~380px on screen and left a
   1440x900 laptop in Focus 135px for the form — one or two boxes. The form
   opens with the name boxes anyway. It pins again on Save or Cancel (app.js
   adds .ef-open in openEditForm and removes it in closeForm). One class more
   specific than the pinning rules (.card.is-selected …), so it wins wherever
   they sit — including the short-screen rule that pins only .card-pinhead. */
.card.is-selected.ef-open .card-sticky,
.card.is-selected.ef-open .card-head,
.card.is-selected.ef-open .card-pinhead {
  position: static;
  box-shadow: none;
}
.ef-field { display: grid; gap: 3px; font-size: 12px; }
.ef-field > span { font-weight: 600; color: var(--ink-soft, #5a6472); }
.ef-field input {
  font: inherit;
  font-size: 15px;            /* 16px-ish avoids iOS zoom-on-focus */
  padding: 9px 10px;
  border: 1.5px solid var(--line, #d8dde4);
  border-radius: 6px;
  background: var(--card, #fff);
  color: var(--ink, #11141a);
  min-height: 44px;
}
.ef-actions { display: flex; gap: 8px; margin-top: 2px; }
.ef-save {
  background: var(--accent, #006AAC);
  color: #fff;
  border: 1.5px solid var(--accent, #006AAC);
}
.ef-cancel {
  background: var(--card, #fff);
  border: 1.5px solid var(--ink, #11141a);
  color: var(--ink, #11141a);
}
.ef-msg { font-size: 13px; min-height: 1em; }

/* ── 👁 Somebody else has this record open ────────────────────────────────────
   FOUR independent signals, so this reads with no colour vision at all:
     1. the icon      👁 viewing / ✏️ editing
     2. the words     "also has this open" vs "is editing right now"
     3. the shape     3px left border, and bold when editing
     4. colour        LAST, never on its own
   Nothing animates — there is deliberately nothing for prefers-reduced-motion
   to reduce. */
.card-presence {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin: 6px 0 0;
  padding: 6px 8px;
  border-left: 3px solid var(--ink-soft, #5a6472);
  border-radius: 0 4px 4px 0;
  background: #f4f6f8;
  color: var(--ink-soft, #5a6472);
  font-size: 12.5px;
  line-height: 1.35;
}
/* 🫥 `display: flex` above beat the [hidden] attribute (no global rule here), so
   the EMPTY slot drew as a grey strip with a "|" under every card's address —
   Allan spotted it on a company card, Cotswold, 2026-10-09. */
.card-presence[hidden] { display: none; }
.card-presence-icon { flex: 0 0 auto; }
.card-presence.is-editing {
  border-left-color: var(--warn, #b54708);
  background: #fff8f1;
  color: var(--warn, #b54708);
  font-weight: 600;
}

/* ── Save conflict: somebody else changed a box while this form was open ──────
   Colour is the LAST signal, never the only one — the ⚠ glyph, the word
   "Conflict" and the heavy left border each carry the state on their own, so
   this still reads with no colour vision at all. Nothing animates. */
.ef-conflict {
  border: 1.5px solid var(--warn, #b54708);
  border-left-width: 4px;
  border-radius: 6px;
  background: #fff8f1;
  padding: 10px;
  display: grid;
  gap: 8px;
  font-size: 13px;
}
.ef-conflict-head { margin: 0; color: var(--warn, #b54708); line-height: 1.4; }
.ef-conflict-row {
  display: grid;
  gap: 2px;
  padding-top: 8px;
  border-top: 1px solid var(--line, #e6e9ee);
}
.ef-conflict-field { font-weight: 700; color: var(--ink, #11141a); }
.ef-conflict-val {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: baseline;
  color: var(--ink, #11141a);
}
.ef-conflict-key { color: var(--ink-soft, #5a6472); min-width: 11em; }
.ef-conflict-acts { display: flex; flex-wrap: wrap; gap: 8px; }
.note-conflict-pre {
  margin: 6px 0 0;
  padding: 8px;
  max-height: 200px;
  overflow: auto;
  background: var(--card, #fff);
  border: 1px solid var(--line, #e6e9ee);
  border-radius: 4px;
  white-space: pre-wrap;
  word-break: break-word;
  font: inherit;
  font-size: 12.5px;
}
.ef-conflict-row > summary { cursor: pointer; font-weight: 600; }
.ef-conflict-acts .btn {
  background: var(--card, #fff);
  border: 1.5px solid var(--ink, #11141a);
  color: var(--ink, #11141a);
}

/* ── Demo toggle (snapshot/agency only — flip Starter ↔ Full for prospects) ──
   Small, in-flow at the very top so it scrolls away and never covers the card. */
.demo-toggle {
  display: flex;
  width: fit-content;
  align-items: center;
  gap: 6px;
  margin: 0 auto 8px;
  padding: 3px 4px 3px 10px;
  background: var(--ink, #11141a);
  color: #fff;
  border-radius: 999px;
}
.demo-toggle__lbl {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  opacity: 0.8;
}
.demo-toggle__btn {
  font: inherit;
  font-size: 11px;
  font-weight: 700;
  border: 0;
  border-radius: 999px;
  padding: 4px 11px;
  min-height: 26px;
  cursor: pointer;
  background: #fff;
  color: var(--ink, #11141a);
}
.demo-toggle.is-basic .demo-toggle__btn { background: var(--accent, #006AAC); color: #fff; }
/* YBH's Lite / Plus / Full switch (11 Oct 2026): the CURRENT edition is the white
   one AND carries a ✓ — never colour alone (Allan is colourblind). */
.demo-toggle--editions .demo-toggle__btn {
  background: transparent;
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.4);
}
.demo-toggle--editions .demo-toggle__btn.is-active {
  background: #fff;
  color: var(--ink, #11141a);
  box-shadow: none;
}
.demo-toggle--editions .demo-toggle__btn:disabled { opacity: 0.65; cursor: progress; }

/* ── Appointments panel (in Quotes + Jobs sections) ─────────────────────
   Reuses the .notes-panel shell; adds row-level visuals tuned for the
   appointments rhythm — date pill + title + status badge. */
.appointments-panel .appt-section + .appt-section { margin-top: 10px; }
.appointments-panel .appt-section-head {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-soft, #555c66);
  padding: 6px 4px;
}
.appt-row {
  border: 1px solid var(--border, #d8dde4);
  border-radius: 6px;
  padding: 10px 12px;
  margin: 6px 0;
  background: #fff;
  cursor: pointer;
}
.appt-row:hover { border-color: #b6bdc7; }
.appt-row.is-expanded { background: #fafbfd; }
.appt-row-head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.appt-pill {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12.5px;
  background: #eef2f7;
  padding: 3px 8px;
  border-radius: 4px;
  white-space: nowrap;
}
/* Wraps, never "…" — Allan, 28 Nov 2026: the whole title must show. */
.appt-title {
  font-weight: 600;
  font-size: 14px;
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
}
.appt-status {
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 999px;
  background: #eef2f7;
  color: var(--ink-soft, #555c66);
  white-space: nowrap;
}
.appt-status-confirmed { background: #e8f6ee; color: #146c2e; }
.appt-status-showed    { background: #e8f6ee; color: #146c2e; }
.appt-status-cancelled { background: #fdecec; color: #8a1f1f; }
.appt-status-noshow    { background: #fdecec; color: #8a1f1f; }
.appt-status-invalid   { background: #fdecec; color: #8a1f1f; }
/* Line 2: the status pill (under the date), then time · team member. */
.appt-row-sub {
  margin-top: 6px;
  font-size: 13px;
  color: var(--ink-soft, #555c66);
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 8px;
}
/* Diary "extras" chips on the card's appointment rows — mirrors the mobile
   Appointments page. Colourblind-safe: every chip pairs an icon/text with its
   colour, never colour alone. */
.appt-row-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.appt-row-chips > span {
  padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 700;
  line-height: 1.7; white-space: nowrap;
}
.appt-row__jobstatus { background: #eef2f7; color: #334155; }
.appt-row__jobstatus--provisional { background: #fef9c3; color: #854d0e; }
.appt-row__jobstatus--booked      { background: #dbeafe; color: #1e40af; }
.appt-row__jobstatus--in-progress { background: #ede9fe; color: #5b21b6; }
.appt-row__jobstatus--completed   { background: #dcfce7; color: #166534; }
.appt-row__jobstatus--invoiced    { background: #cffafe; color: #155e75; }
.appt-row__style  { background: #f1f5f9; color: #334155; }
.appt-row__marker { background: #f8fafc; color: #334155; border-radius: 4px; }
.appt-row__cal    { font-weight: 600; }
.appt-details {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border, #d8dde4);
  font-size: 13.5px;
}
.appt-dl-row {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 10px;
  padding: 4px 0;
}
.appt-dl-k { font-weight: 600; color: var(--ink-soft, #555c66); }
.appt-dl-v { word-break: break-word; }
.appt-actions { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
/* Primary action on an appointment — jump to it on the GBU Scheduler diary. */
.appt-goto-diary {
  display: inline-block;
  font-size: 13px;
  font-weight: 600;
  padding: 6px 12px;
  border: 1.5px solid #006aac;
  border-radius: 4px;
  background: #006aac;
  color: #fff;
  cursor: pointer;
}
.appt-goto-diary:hover { background: #005a92; border-color: #005a92; }
/* 💷 Take payment — the second secondary action on an appointment row.
   These values are copied from .appt-signoff-btn in signoff-ui.css (which owns
   that button because the sheet ships with it) rather than invented: the two sit
   side by side, and measuring them in a browser is how a 33px button beside a
   38px one gets noticed. If sign-off's padding changes there, change it here.
   Outlined, so "Go to on Diary" stays the one filled button in the row, and
   carrying its own 💷 glyph, so nothing depends on colour alone. */
.appt-payment-btn {
  padding: 8px 12px; border-radius: 8px; border: 1px solid #d9e0e6;
  background: #fff; font: inherit; font-weight: 600; cursor: pointer;
}
.appt-signoff-btn:hover,
.appt-payment-btn:hover { background: #f0f6fb; }
.appt-open-ghl {
  display: inline-block;
  font-size: 13px;
  font-weight: 600;
  padding: 6px 12px;
  border: 1.5px solid var(--ink, #11141a);
  border-radius: 4px;
  color: var(--ink, #11141a);
  text-decoration: none;
}
.appt-open-ghl:hover { background: #f5f5f5; }

/* 📱 On a PHONE, an open appointment's and an open job's buttons go full width,
   words centred, 44px tall — the same app feel as the quote buttons (Allan,
   27 Nov 2026). Order, top to bottom: 📅 Go to on Diary, ✍ sign-off,
   📝 Record a payment | 💷 Take payment (the one pair: both are the money),
   Open in Main system ↗ last. A job: its 📅 Go to Diary button(s), then 🖨 Print.
   `order` only, so the markup and the computer's one-line row are untouched.
   PHONE = the same test as the quote buttons and the card's sticky header. */
@media (max-width: 767px), (orientation: landscape) and (max-height: 600px) and (pointer: coarse) {
  .appt-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    align-items: stretch;
  }
  .appt-actions > *,
  .appt-actions > .job-diary-links > * { grid-column: 1 / -1; }
  .appt-actions > button,
  .appt-actions > a,
  .appt-actions > .job-diary-links > button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    box-sizing: border-box;
    text-align: center;
    min-height: 44px;
  }
  .appt-actions > .appt-goto-diary  { order: 10; }
  .appt-actions > .appt-signoff-btn { order: 20; }
  .appt-actions > [data-recordpay]  { order: 30; }
  .appt-actions > [data-payment]    { order: 31; }
  .appt-actions > .appt-open-ghl    { order: 90; }
  /* The money pair: half each, unless only one of them is drawn. */
  .appt-actions > [data-recordpay],
  .appt-actions > [data-payment] { grid-column: auto; padding-left: 6px; padding-right: 6px; }
  .appt-actions:not(:has(> [data-payment])) > [data-recordpay],
  .appt-actions:not(:has(> [data-recordpay])) > [data-payment] { grid-column: 1 / -1; }
}
.appt-refresh {
  font-size: 13px;
  padding: 4px 10px;
  border-radius: 4px;
  border: 1px solid var(--border, #d8dde4);
  background: #fff;
  cursor: pointer;
}
.appt-retry {
  font-size: 13px;
  padding: 4px 10px;
  border-radius: 4px;
  border: 1px solid var(--border, #d8dde4);
  background: #fff;
  cursor: pointer;
  margin-left: 4px;
}

/* ── Tasks panel (its own Tasks section) ────────────────────────────────
   Reuses .notes-panel scaffolding. Full inline CRUD: list, click-to-edit,
   delete, quick complete-toggle via the checkbox. */
.tasks-panel { padding-top: 4px; }
/* Header row: the count on the left, the two buttons pushed to the right.
   🪤 The base .notes-panel-head is `display: block` — it sets padding and a
   background and nothing else. So the `gap`, `align-items` and
   `margin-right: auto` that used to live here did NOTHING: the count and both
   buttons sat jammed against the left on 4px of collapsed whitespace, with
   340px of empty header beside them, all three on the text baseline at three
   different heights. Measured, not guessed.
   .billing-panel does the same opt-in a few hundred lines up; this follows it. */
.tasks-panel .notes-panel-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 10px 14px;
}
.tasks-panel .tasks-count { margin-right: auto; }   /* needs the flex above to work */
/* One height for both buttons, so they read as a pair rather than two
   different controls that happen to be adjacent. */
.tasks-panel .notes-panel-head .task-add-btn,
.tasks-panel .notes-panel-head .appt-refresh,
.tasks-panel .notes-panel-head .tasks-close {
  margin-left: 0;
  min-height: 34px;
  display: inline-flex;
  align-items: center;
}
/* ✕ CLOSE. The panel's own way out — see closeTasksPanel() in app.js. The
   overdue-tasks pill can open this panel but never closes it, by design, so
   without this there was no close at all for anyone who arrived that way.
   Word AND glyph, never the glyph alone: a bare ✕ is a guess. */
.tasks-close {
  font-size: 13px;
  padding: 4px 10px;
  border-radius: 4px;
  border: 1px solid var(--border, #d8dde4);
  background: #fff;
  color: var(--ink-soft, #555c66);
  cursor: pointer;
  font-weight: 600;
}
.tasks-close:hover { background: #f4f6f8; }
/* Brand blue, per the standing rule that buttons default to #006aac — this was
   near-black, which is the one colour the rest of the CRM does not use for a
   primary action. */
.task-add-btn {
  font-size: 13px;
  padding: 6px 14px;
  border-radius: 6px;
  border: 1.5px solid var(--accent);
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  font-weight: 700;
}
.task-add-btn:hover { opacity: 0.9; }
.task-add-slot { padding: 10px 4px 4px; }

.task-row {
  border: 1px solid var(--border, #d8dde4);
  border-radius: 8px;
  padding: 12px 14px;
  margin: 10px 0;
  background: #fff;
}
.task-row.is-complete { background: #f8f9fb; }
.task-row.is-complete .task-title { text-decoration: line-through; color: var(--ink-soft, #555c66); }
.task-row.is-expanded { background: #fafbfd; }
/* 🔴 TWO ROWS: the title, then the due date and who it is for.
   It was one flex line with an ellipsised title, so on a phone a due chip and
   a name left "Have ..." — Allan's whole list read identically. The checkbox
   holds column one across both rows; the title takes column two and WRAPS,
   because a task title is the task and half of one is no use. */
.task-row-head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-areas:
    "check title"
    "check meta";
  align-items: start;
  column-gap: 12px;
  row-gap: 2px;
  cursor: pointer;
  padding: 2px 0;
}
.task-row-head .task-check-wrap { grid-area: check; align-self: center; }
.task-row-head .task-title { grid-area: title; }
.task-row-head .task-row-meta {
  grid-area: meta;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.task-check-wrap {
  display: inline-flex;
  align-items: center;
  cursor: pointer;
}
.task-check {
  width: 20px;
  height: 20px;
  cursor: pointer;
}
/* WRAPS. It used to be nowrap + ellipsis, which on a narrow screen turned
   every row into "Have ..." — see the note on .task-row-head. */
.task-title {
  font-weight: 600;
  font-size: 14px;
  min-width: 0;
  line-height: 1.35;
  overflow-wrap: anywhere;
}
.task-due {
  font-size: 12px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 4px;
  background: #eef2f7;
  color: var(--ink-soft, #555c66);
  white-space: nowrap;
}
.task-due.is-overdue { background: #fdecec; color: #8a1f1f; }
.task-assignee {
  font-size: 12.5px;
  color: var(--ink-soft, #555c66);
  white-space: nowrap;
}

.task-details {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border, #d8dde4);
}

/* 🔴 RECLAIM THE WIDTH ON A PHONE. Allan, opening a task on a contact from a
   handset: "the card is squashed by padding?" It was — measured at 250px of
   390, with SIX nested paddings above it: .wrap 16, .card 16, .group-body 12,
   .notes-panel-body 8, .task-row 14, and the card's own 10.

   The outer three are the whole app's chrome and are not ours to change for
   one panel. The two nearest ones are, so they are cancelled here with a
   negative margin — the same trick the phone portal's task list uses.

   Coarse pointers only: a desktop contact card has the room and the indent
   reads as deliberate there. */
@media (pointer: coarse) {
  .task-details { margin-inline: -14px; }
  .tasks-panel .notes-panel-body { padding-inline: 2px; }
}
/* Give the form room to breathe.
   Allan, on the live panel: "the spacing is a bit cramped". It was — the fields
   were stacked tight enough that Title, Description, WHEN and Assigned to read
   as one block rather than four separate questions, and the whole thing sat
   hard against the panel edge. */
.task-form { display: flex; flex-direction: column; gap: 20px; padding: 16px 14px 14px; }
/* The Add-Task slot sits directly under the header; without this the first
   label butts straight up against the header's bottom border. */
.tasks-panel .task-add-slot:not([hidden]) { border-bottom: 1px solid var(--line); }
/* (The header-row rules that used to be duplicated here now live in ONE place,
   with the .tasks-panel block above. Two rules for the same selector meant the
   later one silently won and the earlier one looked correct while doing
   nothing — the reason the cramped header survived a fix that "worked".) */
.task-field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.task-field > span { font-weight: 600; color: var(--ink-soft, #555c66); font-size: 12.5px; }
.task-input {
  font-size: 14px;
  padding: 8px 10px;
  border: 1.5px solid var(--border, #d8dde4);
  border-radius: 5px;
  box-sizing: border-box;
  font-family: inherit;
  background: #fff;
}
.task-input:focus { border-color: var(--ink, #11141a); outline: none; }
.task-row-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 600px) {
  .task-row-fields { grid-template-columns: 1fr; }
}
/* "📋 2 open tasks" on the contact header — so you know to go looking.
   Appears ONLY when something is outstanding: a pill reading "0 tasks" on every
   contact is furniture, and furniture stops being read.
   Word AND glyph, never colour alone — the same rule the diary bars follow.
   It is a button because it does something: it opens the Tasks panel. */
.task-flag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-left: 10px;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid #bfdbfe;
  background: #eff6ff;
  color: #1e3a5f;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}
.task-flag:hover { filter: brightness(0.97); }
.task-flag.is-overdue { border-color: #fde68a; background: #fef3c7; color: #92400e; }

/* "🟢 Quote Fri 22 · 🔵 Job Tue 26" — where this customer is in the process,
   readable without opening anything. Same pill shape as .task-flag so the
   header line reads as one row of flags rather than three unrelated widgets.
   Shown ONLY for a visit booked today or later: a pill for last month's quote
   says the opposite of what it appears to say, and it is precisely the
   customers with nothing booked who need chasing.
   Each carries its own WORD and GLYPH — the tint is reinforcement, never the
   carrier, because these three are told apart by colour at a glance. */
.visit-flag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  /* No margin-left: .activity-line is a flex row with `gap: 6px 18px`, so a
     margin STACKS on top of that gap. Measured at 26px, which read as three
     unrelated widgets rather than one row of flags. 18px matches the spacing
     between "Last quote" and "Last job" beside them. */
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid #d7dee7;
  background: #f4f7fa;
  color: #24313f;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}
.visit-flag:hover { filter: brightness(0.97); }
.visit-flag--quote { border-color: #bbf7d0; background: #f0fdf4; color: #14532d; }
.visit-flag--job   { border-color: #bfdbfe; background: #eff6ff; color: #1e3a5f; }
.visit-flag--rug   { border-color: #e9d5ff; background: #faf5ff; color: #4c1d95; }

/* WHEN — two equal routes, side by side under the description.
   Allan: "two buttons… Set Date & Time, and Choose Slot on Diary. That feels
   more in keeping with other functions." Both are brand blue per the standing
   rule; the diary one is outlined because setting a date is the commoner path,
   not because it matters less. 44px — check:touch measures these for real. */
/* WHEN is its own decision, so it gets air above and below rather than sitting
   in the run of fields. */
.task-when { margin: 2px 0; }
.task-when-btns { display: flex; gap: 12px; flex-wrap: wrap; }
.task-set-when,
.task-pick-slot {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 10px 16px;
  border-radius: 8px;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  text-align: left;
}
.task-set-when { background: var(--accent); color: #fff; border: 1.5px solid var(--accent); }
.task-set-when:hover { filter: brightness(1.08); }
.task-pick-slot { background: #fff; color: var(--accent); border: 1.5px solid var(--accent); }
.task-pick-slot:hover { background: #f0f7fc; }
.task-pick-slot[disabled] { opacity: .55; cursor: default; }
/* The chosen value, as a sentence rather than another control. */
.task-when-value { margin-top: 12px; font-size: 13.5px; font-weight: 600; color: var(--ink, #11141a); }
.task-when-none { font-weight: 400; color: #6b7280; font-style: italic; }

/* Inside the picker modal: date box + hour + minute.
   `min-width:0` is load-bearing — without it a flex child refuses to shrink
   below its content and the row overflows on a narrow dialog. */
.task-due-dialog .task-due-pair { margin: 4px 0 2px; }
.task-due-dialog .task-due-date { flex: 1 1 auto; min-width: 0; }
.task-due-msg { min-height: 18px; margin-top: 6px; font-size: 12.5px; color: #a44; }
.task-due-pair { display: flex; gap: 6px; align-items: center; }
.task-due-pair .task-due-date { flex: 1 1 auto; min-width: 0; }
.task-due-pair .task-due-hour,
.task-due-pair .task-due-min { flex: 0 0 auto; width: auto; min-width: 64px; }
.task-due-sep { flex: 0 0 auto; opacity: .6; font-weight: 700; }


/* Task saved, but something secondary did not — e.g. it could not be placed on
   the diary. Amber, not red: the task exists and nothing was lost. */
.task-panel-note {
  margin: 0 0 10px;
  padding: 9px 11px;
  border: 1px solid #fde68a;
  background: #fef3c7;
  color: #78350f;
  border-radius: 8px;
  font-size: 13px;
}
.task-form-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 4px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.task-form-actions .btn { padding: 8px 16px; font-size: 14px; min-height: 40px; }
/* Brand blue, not near-black: this is the primary action on the panel and it
   should look like the rest of the CRM. */
.task-save-btn { background: var(--accent); color: #fff; border-color: var(--accent); }
.task-save-btn:hover { filter: brightness(1.08); }

/* "or choose a slot on the diary" — the OTHER answer to "when?", so it sits
   beside the date rather than in the button row, where it would compete with
   Save for the same job.
   BRAND-OUTLINED, per the standing rule: buttons default to brand blue, solid
   for primary and outlined for secondary. Same recipe as
   .billing-copy-quote-btn so it is recognisably the same kind of control.
   44px because check:touch measures it in a real browser. */
.task-pick-slot {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  margin-top: 6px;
  padding: 8px 14px;
  border-radius: 8px;
  background: #fff;
  color: var(--accent);
  border: 1.5px solid var(--accent);
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  text-align: left;
}
.task-pick-slot:hover { background: #f0f7fc; }
.task-pick-slot[disabled] { opacity: .55; cursor: default; }
.task-cancel-btn { background: #fff; }
.task-delete-btn { background: #fff; border-color: #a44; color: #a44; }
.task-open-ghl {
  font-size: 13px;
  font-weight: 600;
  padding: 6px 12px;
  border: 1.5px solid var(--ink, #11141a);
  border-radius: 4px;
  color: var(--ink, #11141a);
  text-decoration: none;
}
.task-form-msg { font-size: 13px; margin-left: auto; color: var(--ink-soft, #555c66); }
.task-form-msg.err { color: #8a1f1f; font-weight: 600; }
.task-retry {
  font-size: 13px; padding: 4px 10px; border-radius: 4px;
  border: 1px solid var(--border, #d8dde4); background: #fff; cursor: pointer; margin-left: 4px;
}

/* ── Opportunities section ──────────────────────────────────────────────
   Dedicated accordion. Auto-loads on first open. List of opps, each row
   click-to-expand into ETAS-style action cards (Move to Stage, Close).
   Pipelines are loaded once and used for the cascading dropdown. */
.opp-count-header { font-weight: 600; color: var(--ink-soft, #555c66); font-size: 14px; margin-left: 4px; }
.opp-section-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}
.opp-section-actions .opp-add-btn { flex: 1; }
.opp-help { align-self: center; font-size: 13px; font-weight: 600; color: var(--accent); white-space: nowrap; }
@media (max-width: 480px) {
  /* On a phone the link squeezed "+ Add Opportunity" and Refresh onto two
     lines each, so it takes its own line under them instead. */
  .opp-section-actions { flex-wrap: wrap; }
  .opp-help { order: 3; flex-basis: 100%; text-align: right; }
}
.opp-refresh-btn {
  font-size: 13px;
  padding: 6px 12px;
  border-radius: 4px;
  border: 1px solid var(--border, #d8dde4);
  background: #fff;
  cursor: pointer;
}
.opp-add-slot { padding: 6px 0 10px; }

.opp-row {
  border: 1px solid var(--border, #d8dde4);
  border-radius: 6px;
  padding: 10px 12px;
  margin: 6px 0;
  background: #fff;
  cursor: pointer;
}
.opp-row:hover { border-color: #b6bdc7; }
.opp-row.is-expanded { background: #fafbfd; }
.opp-row-head {
  display: flex;
  /* baseline, not centre: a headline that wraps keeps the pill and the
     price level with its first line. */
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}
.opp-status {
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 999px;
  background: #eef2f7;
  color: var(--ink-soft, #555c66);
  white-space: nowrap;
}
.opp-status-open      { background: #e6eff9; color: #1b4a85; }
.opp-status-won       { background: #e8f6ee; color: #146c2e; }
.opp-status-lost      { background: #fdecec; color: #8a1f1f; }
.opp-status-abandoned { background: #f0eef2; color: #555c66; }
/* The headline: Pipeline › Stage. Wraps rather than cuts off, because the
   stage is the part that matters and GHL stage names run long. */
.opp-title {
  flex: 1;
  min-width: 0;
  font-size: 14.5px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}
.opp-pipe { font-weight: 700; color: var(--ink, #11141a); }
.opp-sep { margin: 0 6px; color: var(--ink-soft, #555c66); font-weight: 600; }
.opp-stage { font-weight: 700; color: var(--ink, #11141a); }
.opp-money {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}
.opp-caret { color: var(--ink-soft, #555c66); font-size: 14px; }
.opp-row-sub {
  margin-top: 6px;
  font-size: 13px;
  color: var(--ink-soft, #555c66);
}
.opp-row-links {
  margin-top: 3px;
  font-size: 13px;
  color: var(--ink-soft, #555c66);
}

/* Closed ones fold under one line below the open ones. */
.opp-closed { margin-top: 8px; }
.opp-closed-head {
  list-style: none;
  cursor: pointer;
  user-select: none;
  padding: 9px 12px;
  border: 1px dashed #b4bdca;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-soft, #555c66);
}
.opp-closed-head::-webkit-details-marker { display: none; }
.opp-closed-head::before { content: '▸ '; }
.opp-closed[open] > .opp-closed-head::before { content: '▾ '; }
.opp-closed-head:hover { border-color: #006aac; color: var(--ink, #11141a); }
.opp-none-open, .opp-more {
  margin: 8px 2px;
  font-size: 13px;
  color: var(--ink-soft, #555c66);
}
.opp-more a { color: #006aac; font-weight: 600; }

/* The facts behind the row. */
.opp-facts {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 4px 14px;
  margin: 0 0 10px;
  font-size: 13.5px;
}
.opp-facts dt { color: var(--ink-soft, #555c66); }
.opp-facts dd { margin: 0; color: var(--ink, #11141a); overflow-wrap: anywhere; }
@media (max-width: 480px) {
  /* A phone stacks each fact under its label. */
  .opp-facts { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .opp-facts dd { margin-bottom: 6px; }
}

.opp-actions {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border, #d8dde4);
}

/* ETAS-style action cards inside an expanded opp row. Each card is a
   header + collapsible body — Move to Stage, Close (won/lost/abandoned). */
.opp-action-card {
  border: 1px solid var(--border, #d8dde4);
  border-radius: 6px;
  margin: 6px 0;
  background: #eef4fc;
  overflow: hidden;
}
.opp-action-card[data-card="close"] { background: #f8f4ee; }
.opp-action-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  cursor: pointer;
  user-select: none;
}
.opp-action-head:hover { filter: brightness(0.97); }
.opp-action-icon { font-size: 16px; }
.opp-action-title { font-weight: 600; font-size: 14px; flex: 1; }
.opp-action-caret { color: var(--ink-soft, #555c66); font-size: 14px; }
.opp-action-body {
  padding: 10px 12px 12px;
  background: #fff;
  border-top: 1px solid var(--border, #d8dde4);
}
.opp-action-footer {
  margin-top: 10px;
  text-align: right;
}
.opp-open-ghl {
  display: inline-block;
  font-size: 13px;
  font-weight: 600;
  padding: 6px 12px;
  border: 1.5px solid var(--ink, #11141a);
  border-radius: 4px;
  color: var(--ink, #11141a);
  text-decoration: none;
}
.opp-open-ghl:hover { background: #f5f5f5; }

.opp-form { display: flex; flex-direction: column; gap: 10px; }
.opp-status-radios {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.opp-status-radio {
  flex: 1;
  min-width: 110px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border: 1.5px solid var(--border, #d8dde4);
  border-radius: 5px;
  background: #fff;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
}
.opp-status-radio input { cursor: pointer; }
.opp-status-radio:has(input:checked) {
  border-color: var(--ink, #11141a);
  background: #f5f7fa;
}

.opp-retry {
  font-size: 13px; padding: 4px 10px; border-radius: 4px;
  border: 1px solid var(--border, #d8dde4); background: #fff; cursor: pointer; margin-left: 4px;
}

/* ── New Enquiry / New Contact CTA ──────────────────────────────────────
   Renders inside the no-match empty state ("Want to add as a new client?").
   Search-first UX: the button only appears after a search returns no
   results, so it's invitation not clutter. */
.new-enquiry-cta,
.new-company-cta {
  font-size: 16px;
  padding: 14px 18px;
  min-height: 52px;
  letter-spacing: 0.01em;
}
/* 🏢 New Company under it (29 Oct 2026) — two full-width buttons, not touching. */
.no-match .btn-block + .btn-block { margin-top: 8px; }

/* 🔎 The no-match box, straight under Search (Allan, 27 Oct 2026: "make the
   no match message larger and bold"). The words and the button carry it —
   no colour is doing the telling. */
.no-match {
  text-align: center;
  padding: 18px 0 4px;   /* no side padding: the button lines up with Search */
  margin-bottom: 12px;
}
.no-match__line {
  font-size: 22px;
  font-weight: 800;
  line-height: 1.3;
  color: var(--ink);
}
/* A search that FAILED (to-do #50, 29 Oct 2026) — the words start with ⚠ and say
   so; the warning colour #status used to give it is the last signal, not the only one. */
.no-match--error .no-match__line { color: var(--warn); }
.no-match__ask {
  margin: 12px 0 10px;
  font-size: 16px;
  font-weight: 600;
  color: var(--ink);
}

/* 🔎 "Not one of these?" — on top of every set of search results (Allan,
   29 Oct 2026): ➕ New Enquiry / 🏢 New Company, filled in from the search. An
   everyday offer, so plain and calm; the words and icons carry it, the blue
   edge is only the last signal. After ➕ New Enquiry pressed first, its ⚠ line
   says "Already on file?" — that one line is the warning, in words. */
.new-enquiry-check {
  border: 1.5px solid var(--border, #d8dde4);
  border-left: 4px solid var(--accent, #006aac);
  border-radius: 6px;
  background: #f3f8fc;
  padding: 10px 12px;
  margin-bottom: 10px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
}
.new-enquiry-check__warn { flex-basis: 100%; margin: 0; font-weight: 700; color: var(--warn, #b54708); }
.new-enquiry-check__say { margin: 0; flex: 1 1 auto; font-weight: 600; color: var(--ink); white-space: pre-line; }
.new-enquiry-check__buttons { display: flex; flex-wrap: wrap; gap: 8px; }
.new-enquiry-check .btn { min-height: 44px; padding: 8px 14px; font-size: 14px; }
.new-enquiry-check__help { font-size: 13px; font-weight: 600; color: var(--accent, #006aac); white-space: nowrap; }
/* A phone: the two buttons share the width, each still a full thumb's height. */
@media (max-width: 420px) {
  .new-enquiry-check__buttons { flex: 1 1 100%; }
  .new-enquiry-check__buttons .btn { flex: 1 1 0; }
}
/* The phone portal's New Enquiry tile lands on the search with this line on top.
   The ➕ and the words carry it; the blue edge is only the last signal. */
.new-enquiry-hint {
  margin: 0 0 12px;
  padding: 10px 12px;
  border: 1.5px solid var(--accent, #006aac);
  border-left-width: 4px;
  border-radius: 6px;
  background: #f0f6fb;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.4;
}

/* Skeleton search-result cards — painted instantly on search submit so the
   page never feels frozen while the GHL roundtrip is in flight. Real cards
   replace them when the response arrives. */
.card-skel { pointer-events: none; }
.card-skel .skel-line {
  height: 14px;
  border-radius: 6px;
  margin: 8px 0;
  background: linear-gradient(90deg, #e8eaf0 0%, #f3f5f9 50%, #e8eaf0 100%);
  background-size: 200% 100%;
  animation: skel-shimmer 1.2s ease-in-out infinite;
}
.card-skel .skel-line-name { width: 55%; height: 20px; margin-top: 0; }
.card-skel .skel-line-sub  { width: 35%; height: 12px; }
.card-skel .skel-line-addr { width: 80%; height: 14px; }
@keyframes skel-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* A11y — respect reduced motion. */
@media (prefers-reduced-motion: reduce) {
  .btn:active { transform: none; }
  .card-skel .skel-line { animation: none; background: #e8eaf0; }
  body.is-pinned #detailPane .card { animation: none; }
}

/* ── Workflows panel (contact card inline) ─────────────────────── */
.workflows-slot:empty { display: none; }
/* Override the base .notes-panel overflow:hidden — it clips the
   absolutely-positioned typeahead dropdown so only 1-2 rows show. We need
   the dropdown to be able to extend below the panel box. */
.workflows-panel { margin-top: 6px; overflow: visible; }
.workflows-head { font-weight: 700; color: var(--ink); }
.workflows-disclaimer {
  padding: 6px 12px; font-size: 12px; color: var(--ink-soft);
  background: #fff8e6; border-bottom: 1px solid var(--line);
}
.workflows-picker { padding: 10px 12px; position: relative; }
.workflows-picker-label {
  display: block; font-size: 12px; font-weight: 700; color: var(--ink);
  text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 6px;
}
.workflows-search-wrap {
  position: relative; cursor: text;
}
.workflows-search {
  width: 100%; padding: 12px 36px 12px 14px;
  border: 2px solid var(--accent, #006aac); border-radius: 10px;
  font: inherit; font-size: 15px; background: #fff;
  box-sizing: border-box;
}
.workflows-search:focus {
  outline: none; box-shadow: 0 0 0 3px rgba(23,115,176,0.15);
}
.workflows-search-chevron {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  color: var(--accent, #006aac); font-size: 18px; pointer-events: none;
}
.workflows-options {
  position: absolute; left: 12px; right: 12px; top: calc(100% - 4px);
  /* Show 6+ rows at default row height (~42px each = ~260px). Capped
     to 60vh so very long lists don't run off a small phone. */
  max-height: min(60vh, 360px); overflow-y: auto;
  background: #fff; border: 2px solid var(--accent, #006aac); border-top: 0;
  border-radius: 0 0 10px 10px;
  box-shadow: 0 8px 20px rgba(0,0,0,0.12); z-index: 50;
  display: flex; flex-direction: column;
}
.workflows-option { padding: 10px 14px; font-size: 14px; }
.workflows-option {
  text-align: left; padding: 8px 12px; background: #fff;
  border: 0; border-bottom: 1px solid var(--line);
  font: inherit; cursor: pointer;
}
.workflows-option:last-child { border-bottom: 0; }
.workflows-option:hover { background: #f4f6f8; }
.workflows-option--empty { color: var(--ink-soft); cursor: default; }
.workflows-log {
  display: flex; flex-direction: column; gap: 4px;
  padding: 4px 12px 12px;
}
.workflow-row {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px;
  background: #f4f6f8; border-radius: 6px;
}
.workflow-row__main { flex: 1 1 auto; min-width: 0; }
.workflow-row__name { font-weight: 600; color: var(--ink); }
.workflow-row__meta { font-size: 12px; color: var(--ink-soft); margin-top: 1px; }
.workflow-row__remove {
  flex: 0 0 auto;
  background: transparent; border: 0; color: var(--ink-soft);
  font-size: 20px; line-height: 1; cursor: pointer; padding: 4px 8px;
  border-radius: 4px;
}
.workflow-row__remove:hover { background: #fee2e2; color: #991b1b; }

/* ── Tags picker (Add Tag / Remove Tag — mirrors the workflows picker) ── */
.tags-slot:empty { display: none; }
.tags-panel { margin-top: 6px; overflow: visible; }
/* .action-group has overflow:hidden (to clip its rounded corners), which crops
   the absolutely-positioned picker dropdown when the panel is short — the tags
   panel has no log below it to give the box height, so the list gets cut off.
   Let the dropdown escape the box while it's open (covers workflows too). */
.action-group:has(.tags-options:not([hidden])),
.action-group:has(.workflows-options:not([hidden])),
.action-group:has(.reqdet-options:not([hidden])) {
  overflow: visible;
}
.tags-picker { padding: 10px 12px 18px; position: relative; }
.tags-picker-label {
  display: block; font-size: 12px; font-weight: 700; color: var(--ink);
  text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 6px;
}
.tags-search-wrap { position: relative; cursor: text; }
.tags-search {
  width: 100%; padding: 12px 36px 12px 14px;
  border: 2px solid var(--accent, #006aac); border-radius: 10px;
  font: inherit; font-size: 15px; background: #fff;
  box-sizing: border-box;
}
.tags-search:focus {
  outline: none; box-shadow: 0 0 0 3px rgba(23,115,176,0.15);
}
.tags-search-chevron {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  color: var(--accent, #006aac); font-size: 18px; pointer-events: none;
}
.tags-options {
  position: absolute; left: 12px; right: 12px; top: calc(100% - 4px);
  max-height: min(60vh, 360px); overflow-y: auto;
  background: #fff; border: 2px solid var(--accent, #006aac); border-top: 0;
  border-radius: 0 0 10px 10px;
  box-shadow: 0 8px 20px rgba(0,0,0,0.12); z-index: 50;
  display: flex; flex-direction: column;
}
.tags-option {
  text-align: left; padding: 8px 12px; background: #fff;
  border: 0; border-bottom: 1px solid var(--line);
  font: inherit; font-size: 14px; cursor: pointer;
}
.tags-option:last-child { border-bottom: 0; }
.tags-option:hover { background: #f4f6f8; }
.tags-option--empty { color: var(--ink-soft); cursor: default; }
.tags-status { padding: 4px 12px 10px; }
.tags-done { font-size: 14px; color: var(--good, #117a3a); font-weight: 600; }

/* ── Request More Details panel (mirrors the workflows/tags picker) ───── */
.reqdet-slot:empty { display: none; }
/* Same overflow override as the other pickers — the base .notes-panel clips
   the absolutely-positioned dropdown. */
.reqdet-panel { margin-top: 6px; overflow: visible; }
.reqdet-head { font-weight: 700; color: var(--ink); }
.reqdet-body {
  padding: 10px 12px 14px;
  display: flex; flex-direction: column; gap: 8px;
}
.reqdet-picker { position: relative; padding: 2px 0 10px; }
.reqdet-picker-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 8px; margin-bottom: 6px;
}
.reqdet-picker-label {
  display: block; font-size: 12px; font-weight: 700; color: var(--ink);
  text-transform: uppercase; letter-spacing: 0.04em;
}
/* Text + ✕, never colour alone, so the way out is unmistakable. */
.reqdet-picker-close {
  flex: 0 0 auto; background: transparent; border: 0;
  font: inherit; font-size: 13px; font-weight: 600;
  color: var(--ink-soft); cursor: pointer;
  padding: 4px 8px; border-radius: 6px;
}
.reqdet-picker-close:hover { background: #f4f6f8; color: var(--ink); }
.reqdet-search-wrap { position: relative; cursor: text; }
.reqdet-search {
  width: 100%; padding: 12px 36px 12px 14px;
  border: 2px solid var(--accent, #006aac); border-radius: 10px;
  font: inherit; font-size: 15px; background: #fff;
  box-sizing: border-box;
}
.reqdet-search:focus {
  outline: none; box-shadow: 0 0 0 3px rgba(23,115,176,0.15);
}
/* A tappable button, not decoration — it toggles the list shut. Sized for a
   finger (44px) so it's reachable on a phone without hitting the input. */
.reqdet-search-chevron {
  position: absolute; right: 2px; top: 50%; transform: translateY(-50%);
  display: flex; align-items: center; justify-content: center;
  width: 40px; height: 40px;
  background: transparent; border: 0; border-radius: 8px;
  color: var(--accent, #006aac); font: inherit; font-size: 18px; line-height: 1;
  cursor: pointer;
}
.reqdet-search-chevron:hover { background: #f4f6f8; }
/* left/right 0 (not 12px like the others) — .reqdet-body already supplies
   the horizontal padding, so the dropdown lines up with the input. */
.reqdet-options {
  position: absolute; left: 0; right: 0; top: calc(100% - 4px);
  max-height: min(60vh, 360px); overflow-y: auto;
  background: #fff; border: 2px solid var(--accent, #006aac); border-top: 0;
  border-radius: 0 0 10px 10px;
  box-shadow: 0 8px 20px rgba(0,0,0,0.12); z-index: 50;
  display: flex; flex-direction: column;
}
.reqdet-option {
  text-align: left; padding: 8px 12px; background: #fff;
  border: 0; border-bottom: 1px solid var(--line);
  font: inherit; font-size: 14px; cursor: pointer;
}
.reqdet-option:last-child { border-bottom: 0; }
.reqdet-option:hover { background: #f4f6f8; }
.reqdet-option--empty { color: var(--ink-soft); cursor: default; }
.reqdet-wf-msg:empty { display: none; }
.reqdet-wf-msg { font-size: 13px; color: var(--good, #117a3a); font-weight: 600; }
.reqdet-wf-msg--warn { color: var(--warn, #b42318); }
/* The hidden sink enrolWorkflow() writes its log into — see app.js. */
.reqdet-panel .workflows-log { display: none; }

/* Photos panel — uploaded images from contact.website_uploaded_images.
   Reuses .notes-panel shell; adds the thumbnail grid + lightbox styles. */
.photos-panel .notes-panel-head { /* same head treatment as appointments */ }
/* ── Simple SMS compose (inline panel in the Messages section) ──────────── */
.sms-compose {
  margin-top: 8px; padding: 10px;
  border: 1px solid var(--line, #e6e9ee); border-radius: 8px;
  background: var(--card, #fff);
  display: flex; flex-direction: column; gap: 8px;
}
.sms-to { font-size: 13px; color: var(--ink-soft, #5a6472); }
.sms-to--warn { color: var(--warn, #b42318); font-weight: 600; }
/* A caveat about the pre-filled message, not a failure — it reads BEFORE the
   send, so it sits above the box. Carries the ⚠ glyph as well as the colour. */
.sms-notice {
  font-size: 13px; line-height: 1.45; font-weight: 600;
  color: var(--warn, #b42318);
  background: #fdf1e7;
  border: 1px solid var(--warn, #b42318);
  border-radius: 8px;
  padding: 8px 10px;
}
.sms-text {
  width: 100%; font: inherit; padding: 10px;
  border: 1.5px solid var(--line, #e6e9ee); border-radius: 8px;
  resize: vertical; box-sizing: border-box;
}
.sms-preview {
  font-size: 14px; line-height: 1.45; white-space: pre-wrap;
  background: rgba(0,0,0,0.04); border-radius: 6px; padding: 8px 10px;
  color: var(--ink, #11141a);
}
.sms-meta { font-size: 12px; color: var(--ink-soft, #5a6472); text-align: right; }
.sms-actions { display: flex; }
.sms-actions .sms-send { width: 100%; }
.sms-msg { font-size: 13px; min-height: 1em; }
.sms-sent { font-size: 15px; color: var(--good, #117a3a); font-weight: 600; padding: 6px 2px; }

.images-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 8px;
  padding: 8px;
}
.images-cell {
  position: relative;
  padding: 0; border: 0; background: transparent;
  border-radius: 6px; overflow: hidden; aspect-ratio: 1;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.08);
}
.images-cell:hover { box-shadow: 0 0 0 2px var(--accent, #2563eb); }
.images-cell img {
  width: 100%; height: 100%; object-fit: cover; display: block; cursor: zoom-in;
}

/* Delete affordance overlaid on each photo (and at the end of each file row).
   Always visible on touch — there's no hover on a phone, and this app is
   mobile-first. Big enough for a thumb (32px) without dominating the thumbnail. */
.img-del {
  position: absolute; top: 4px; right: 4px;
  width: 32px; height: 32px; padding: 0;
  border: 0; border-radius: 50%;
  background: rgba(0,0,0,0.55); color: #fff;
  font-size: 15px; line-height: 1; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 1px 3px rgba(0,0,0,0.4);
}
.img-del:hover { background: rgba(220,38,38,0.92); }
.img-del:disabled { opacity: 0.6; cursor: default; }
.img-del.file-del { position: static; flex: 0 0 auto; }

/* Lightbox overlay — fixed full-viewport, dim backdrop, image + arrows. */
.images-lightbox {
  position: fixed; inset: 0; z-index: 9999;
  background: rgba(0,0,0,0.88);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.images-lightbox[hidden] { display: none; }
.images-lightbox .lb-img {
  max-width: 95%; max-height: 90%; object-fit: contain;
  border-radius: 4px; background: #111;
}
.images-lightbox .lb-close,
.images-lightbox .lb-prev,
.images-lightbox .lb-next {
  position: absolute; background: rgba(255,255,255,0.12); color: #fff;
  border: 0; cursor: pointer; font-size: 28px; line-height: 1;
  width: 44px; height: 44px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}
.images-lightbox .lb-close:hover,
.images-lightbox .lb-prev:hover,
.images-lightbox .lb-next:hover { background: rgba(255,255,255,0.25); }
.images-lightbox .lb-close { top: 16px; right: 16px; }
.images-lightbox .lb-prev  { left: 16px; top: 50%; transform: translateY(-50%); }
.images-lightbox .lb-next  { right: 16px; top: 50%; transform: translateY(-50%); }
.images-lightbox .lb-caption {
  position: absolute; bottom: 16px; left: 50%; transform: translateX(-50%);
  color: #fff; font-size: 14px; background: rgba(0,0,0,0.5);
  padding: 6px 12px; border-radius: 4px;
}
.images-lightbox .lb-del {
  position: absolute; bottom: 14px; right: 16px;
  background: rgba(0,0,0,0.55); color: #fff; border: 0;
  font-size: 14px; line-height: 1; cursor: pointer;
  padding: 10px 14px; border-radius: 6px;
}
.images-lightbox .lb-del:hover { background: rgba(220,38,38,0.92); }
.images-lightbox .lb-del:disabled { opacity: 0.6; cursor: default; }
.images-lightbox .lb-del[hidden] { display: none; }

/* Non-image attachments inside the Photos & Files panel. */
.files-head {
  font-size: 13px; color: var(--ink-soft, #6b7280);
  margin: 12px 8px 4px; padding-top: 8px;
  border-top: 1px solid rgba(0,0,0,0.08);
}
.files-list { display: flex; flex-direction: column; gap: 4px; padding: 0 8px 8px; }
/* Row is a flex wrapper: the open button takes the space, delete sits at the end. */
.files-row {
  display: flex; align-items: center; gap: 6px;
  border-radius: 6px; background: rgba(0,0,0,0.03);
}
.files-row:hover { background: rgba(0,0,0,0.07); }
.files-open-btn {
  flex: 1 1 auto; display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border: 0; background: transparent;
  cursor: pointer; font: inherit; text-align: left; color: inherit;
}
.files-icon { font-size: 20px; flex: 0 0 auto; }
.files-name { flex: 1 1 auto; word-break: break-word; font-size: 14px; }
.files-open { font-size: 12px; color: var(--accent, #2563eb); flex: 0 0 auto; }

/* File viewer overlay — same dim backdrop as image lightbox, but with
   a toolbar at top and a full-height iframe for the file. */
.file-viewer { padding: 0; flex-direction: column; }
.file-viewer .fv-toolbar {
  width: 100%; display: flex; align-items: center; gap: 12px;
  padding: 10px 16px; background: rgba(0,0,0,0.55); color: #fff;
  box-sizing: border-box;
}
.file-viewer .fv-name {
  flex: 1 1 auto; font-size: 14px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.file-viewer .fv-download {
  color: #fff; text-decoration: none;
  background: rgba(255,255,255,0.15); padding: 6px 12px;
  border-radius: 4px; font-size: 13px;
}
.file-viewer .fv-download:hover { background: rgba(255,255,255,0.28); }
.file-viewer .fv-close {
  background: rgba(255,255,255,0.15); border: 0; color: #fff;
  width: 32px; height: 32px; border-radius: 50%; font-size: 20px;
  line-height: 1; cursor: pointer;
}
.file-viewer .fv-close:hover { background: rgba(255,255,255,0.28); }
.file-viewer .fv-frame {
  flex: 1 1 auto; width: 100%; border: 0; background: #fff;
}

/* ════════════════════════════════════════════════════════════════════
   Two-pane desktop/tablet layout (>=1024px)
   --------------------------------------------------------------------
   Mobile/tablet (<1024px) is UNCHANGED: .cf-grid is a plain block, the
   detail pane is hidden, and everything flows single-column exactly as
   before. At >=1024px the .cf-grid becomes a two-column CRM: the search
   form + results list sit in the left rail, and app.js relocates the
   selected client's card (with its full inline detail/actions) into
   #detailPane on the right.
   ════════════════════════════════════════════════════════════════════ */

/* Base (all widths): no layout change on mobile, detail pane hidden. */
.cf-grid { display: block; }
.detail-pane { display: none; }

/* Desktop-only Focus button (shown at >=1024px on the selected card). */
.focus-btn { display: none; }
.focus-btn .focus-off { display: none; }
/* Desktop-only Print button (shown at >=1024px on the selected card). */
.print-btn { display: none; }
/* Desktop-only keyboard hint line. */
.kbd-hints { display: none; }

/* Recently-viewed strip — hidden by default (all widths); shown only at
   >=1024px AND only when it has content (:not([hidden])), so an empty strip
   never displays. */
.recent-actions { display: none; }

/* Results count / "Searching…" hint — desktop-only, same [hidden] idiom. */
.results-count { display: none; }

@keyframes cf-focus-in {
  from { opacity: 0.4; transform: translateY(4px); }
  to   { opacity: 1; transform: none; }
}

@media (min-width: 1024px) {
  /* Give the two panes room to breathe. */
  .wrap { max-width: 1180px; }

  .cf-grid {
    display: grid;
    grid-template-columns: minmax(320px, 380px) 1fr;
    gap: 24px;
    align-items: start;
  }

  /* Left rail holds the search form + results list. */
  .cf-left { min-width: 0; }

  /* Right pane shows the selected client's full detail/actions. */
  .detail-pane {
    display: block;
    min-width: 0;
  }
  /* Empty state — shown only while nothing is selected (no whitespace
     inside the <aside>, so :empty matches until a card is moved in). */
  #detailPane:empty::before {
    content: "Select a contact to see their details and actions here.";
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    min-height: 220px;
    padding: 24px;
    color: var(--ink-soft);
    background: var(--card);
    border: 1.5px dashed var(--line);
    border-radius: var(--radius, 12px);
    font-size: 15px;
  }
  /* The relocated card fills the right pane comfortably. */
  #detailPane .card { width: 100%; }

  /* Gently scale the mobile-tuned (touch) typography down for pointer use.
     Kept INSIDE this media query so mobile sizes are byte-identical. */
  .field input, .btn { font-size: clamp(14px, 1.1vw, 16px); }
  .card .name { font-size: clamp(16px, 1.4vw, 19px); }
  .card .address { font-size: clamp(14px, 1.1vw, 16px); }

  /* Pin/focus mode is unnecessary at this width (the layout already
     isolates the selected client), so hide the per-card pin toggle. */
  .card .pin-toggle { display: none; }

  /* "⤢ Focus" button — visible only on the selected (detail-pane) card.
     It is the desktop trigger for focus mode (proxies the hidden pin box). */
  .card.is-selected .focus-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 10px;
    padding: 8px 14px;
    border: 1.5px solid var(--accent);
    border-radius: 999px;
    background: var(--card);
    color: var(--accent);
    font: inherit;
    font-weight: 700;
    cursor: pointer;
  }
  .card.is-selected .focus-btn:hover { background: #f0f6fb; }
  /* Print button — secondary (muted) so Focus stays the primary action. */
  .card.is-selected .print-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 10px;
    margin-left: 8px;
    padding: 8px 14px;
    border: 1.5px solid var(--line);
    border-radius: 999px;
    background: var(--card);
    color: var(--ink-soft);
    font: inherit;
    font-weight: 700;
    cursor: pointer;
  }
  .card.is-selected .print-btn:hover { border-color: var(--accent); color: var(--accent); }
  /* Label swaps to "✕ Exit focus" while focused. */
  body.is-pinned .focus-btn .focus-on { display: none; }
  body.is-pinned .focus-btn .focus-off { display: inline; }

  /* Focus mode — hide the search rail, single column, the client as wide as
     the title and tabs (no 860px cap since 19 Oct 2026). */
  body.is-pinned .cf-left { display: none; }
  body.is-pinned .cf-grid { grid-template-columns: 1fr; }
  body.is-pinned #detailPane { max-width: none; margin: 0 auto; }
  body.is-pinned #detailPane .card { animation: cf-focus-in 180ms ease both; }

  /* ── Recent lists (under the search box): Latest Added / Recently Opened ── */
  .recent-actions:not([hidden]) {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin: 0 0 14px;
  }
  .recent-action {
    font: inherit;
    font-weight: 600;
    font-size: 13px;
    padding: 7px 14px;
    border: 1.5px solid var(--line);
    border-radius: 8px;
    background: var(--card);
    color: var(--ink);
    cursor: pointer;
  }
  .recent-action:hover { border-color: var(--accent); color: var(--accent); }
  /* Active = the list currently shown. Colour + fill (not colour alone). */
  .recent-action.is-active {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
  }

  /* ── Keyboard highlight on a result card (outline = colour, ▸ = shape, so
        it reads for colourblind users too) ── */
  .card.is-kbd { outline: 2px solid var(--accent); outline-offset: 2px; }
  .card.is-kbd .name::before { content: "▸ "; color: var(--accent); font-weight: 700; }

  /* ── Sticky client identity header on the OPEN card ── */
  .card.is-selected .card-head {
    position: sticky;
    top: 0;
    z-index: 5;
    background: var(--card);
    padding-top: 8px;
    border-bottom: 1px solid var(--line);
  }

  /* ── Results count line ── */
  .results-count:not([hidden]) {
    display: block;
    font-size: 13px;
    font-weight: 700;
    color: var(--ink-soft);
    margin: 0 0 8px;
  }

  /* ── Denser, hover-aware result rows (UNSELECTED list cards only). The
        relocated detail card lives in #detailPane so it's naturally excluded;
        the :not(.is-selected) guard also covers the brief pre-relocate frame. ── */
  #results .card:not(.is-selected) { padding: 12px 14px; }
  #results .card:not(.is-selected) .name { font-size: clamp(15px, 1.2vw, 17px); margin-bottom: 2px; }
  #results .card:not(.is-selected) .address { font-size: 13.5px; margin-bottom: 4px; }
  #results .card:not(.is-selected) .assignee { margin-bottom: 4px; }
  #results .card:not(.is-selected):hover {
    border-color: var(--accent);
    background: #f0f6fb;
  }

  /* ── Keyboard hint line + key-caps (GHL-native, muted) ── */
  .kbd-hints {
    display: block;
    font-size: 12px;
    color: var(--ink-soft);
    line-height: 1.9;
    margin: 8px 0 12px;
  }
  .kbd-hints kbd,
  .kbd-cheatsheet kbd {
    font: inherit;
    font-size: 11px;
    padding: 1px 6px;
    margin: 0 1px;
    border: 1px solid var(--line);
    border-bottom-width: 2px;
    border-radius: 5px;
    background: #f4f6f9;
    color: var(--ink);
  }
}

/* Keyboard shortcuts cheatsheet (opened with "?"). Centred modal; only ever
   triggered on desktop (the "?" handler is gated on IS_WIDE_QUERY). */
.kbd-cheatsheet-overlay {
  position: fixed; inset: 0; z-index: 1000;
  display: flex; align-items: center; justify-content: center;
}
.kbd-cheatsheet-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.35); }
.kbd-cheatsheet {
  position: relative; z-index: 1;
  width: min(92vw, 420px);
  background: var(--card);
  border-radius: var(--radius, 12px);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
  padding: 16px 18px;
}
.kbd-cheatsheet-head {
  display: flex; align-items: center; justify-content: space-between;
  font-weight: 700; font-size: 16px; margin-bottom: 12px;
}
.kbd-cheatsheet-close {
  border: 0; background: transparent; font-size: 18px;
  cursor: pointer; color: var(--ink-soft); line-height: 1;
}
.kbd-cheatsheet-list {
  display: grid; grid-template-columns: auto 1fr; gap: 8px 14px;
  margin: 0; align-items: center;
}
.kbd-cheatsheet-list dt { text-align: right; margin: 0; white-space: nowrap; }
.kbd-cheatsheet-list dd { margin: 0; color: var(--ink); font-size: 14px; }
.kbd-cheatsheet-list kbd {
  font: inherit; font-size: 12px; padding: 2px 7px; margin: 0 1px;
  border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px;
  background: #f4f6f9; color: var(--ink);
}

/* The open card scrolls on its own, beside the results list. Allan,
   2026-10-08: the whole page was one scroll, so a long results list had to be
   scrolled past before the card's lower half (e.g. the Edit details form)
   could be reached. Sticky keeps the card on screen while the list scrolls;
   max-height + overflow gives the card its own scrollbar.
   - screen only: in print the card is position:absolute, and a sticky pane
     would become its containing block and clip the printout to one screen.
   - not in Focus mode (is-pinned): Focus has its own rule, just below.
   - .card-sticky inside the card now sticks to this pane instead of the page,
     so name/address stay pinned while the card scrolls. */
@media screen and (min-width: 1024px) {
  body:not(.is-pinned) .detail-pane {
    position: sticky;
    top: 12px;
    max-height: calc(100vh - 24px);
    max-height: calc(100dvh - 24px);
    overflow-y: auto;
  }
}

/* ⤢ Focus mode: the open card scrolls on its own, like a pop-up. Allan,
   2026-10-15: "This modal does not scroll independently of the page." In Focus
   the whole page was one long scroll — the card had no scrollbar of its own and
   the title and tabs scrolled away with it. Now the page is held to the frame's
   exact height, so the title and tabs stay put, and the card's pane takes all
   the height that is left, with its own scrollbar.
   - FITTED, not sticky like the two-pane rule above: a sticky pane as tall as
     the screen starts with its bottom under the fold, so the card scrolls,
     stops, and then the PAGE has to scroll before the last fields show.
   - min-height: in a very short frame the page scrolls instead, rather than
     squeezing the card to nothing (a scroll box with no floor is unreachable).
   - Clients tab only: Focus stays on while another tab is showing (the card
     waits in #detailPane), and those tabs keep the normal page scroll.
   - padding-bottom: .wrap's 120px is room for the PHONE's sticky Search
     button; here it would be dead space inside the fitted page.
   - .card-sticky (name/address) pins to the top of this pane, as in two-pane. */
@media screen and (min-width: 1024px) {
  body.cf-focus-pane:is(:not([data-cf-tab]), [data-cf-tab="clients"]) .wrap {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    min-height: 560px;
    padding-bottom: 16px;
  }
  body.cf-focus-pane:is(:not([data-cf-tab]), [data-cf-tab="clients"]) .cf-grid {
    flex: 1 1 0;
    min-height: 0;
    grid-template-rows: minmax(0, 1fr);
  }
  body.cf-focus-pane:is(:not([data-cf-tab]), [data-cf-tab="clients"]) #detailPane {
    align-self: stretch;
    min-height: 0;
    overflow-y: auto;
  }

  /* ⤢ Focus card buttons: as many on a line as fit, so an open accordion takes
     fewer lines (Allan, 19 Oct 2026 — What next? went from 4 lines to 2). Only
     the wide Focus card: desktop and iPad sideways. A phone, an iPad upright
     and the two-pane card keep their two-up grid.
     Wrapping rows, NOT a wider grid: a grid leaves empty cells wherever a row
     is one button short, and New Enquiry spanning the row stops auto-fit
     closing them. Here every line shares its width out evenly, so a pair of
     buttons still fills the line and there is never a gap. */
  body.cf-focus-pane .action-group .btn-row.cols-2 {
    display: flex;
    flex-wrap: wrap;
  }
  body.cf-focus-pane .action-group .btn-row.cols-2 > * { flex: 1 1 170px; }
  body.cf-focus-pane .action-group .btn-row.cols-2 > .span-2 { flex-basis: 100%; }
  /* "Ask for a review" spans the row only to stop it sitting alone in the
     two-up grid when 📍 What3Words is shown. Here it simply joins the line. */
  body.cf-focus-pane .action-group .btn-row.cols-2 > .span-2[data-act="send-review"] { flex-basis: 170px; }
}

/* ════════════════════════════════════════════════════════════════════
   Print — clean single-client sheet (🖨 Print button on the open card).
   Blanks everything except the selected client's card, lifts it to the page
   origin, hides interactive chrome, and force-expands collapsed details.
   Width-agnostic: `.card.is-selected` is the open card in two-pane, focus,
   and mobile alike.
   ════════════════════════════════════════════════════════════════════ */
@media print {
  body * { visibility: hidden !important; }
  .card.is-selected, .card.is-selected * { visibility: visible !important; }
  .card.is-selected {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    margin: 0;
    box-shadow: none;
    border: none;
  }
  /* Identity header must not float when printed. */
  .card.is-selected .card-head { position: static; border-bottom: 1px solid #ccc; }
  /* Expand any collapsed "Show all details" so nothing is clipped. */
  .card.is-selected .contact-details[hidden] { display: block !important; }
  /* Hide interactive-only controls inside the printed card. */
  .card.is-selected .actions,
  .card.is-selected .print-btn,
  .card.is-selected .focus-btn,
  .card.is-selected .head-toggle,
  .card.is-selected .edit-contact,
  .card.is-selected .pin-toggle,
  .card.is-selected .pin-badge,
  .card.is-selected .cd-toggle,
  .card.is-selected .cd-allfields { display: none !important; }
  @page { margin: 12mm; }
}

/* 🖨 One job's sheet (View Jobs › an open job › 🖨 Print, Allan, 6 Nov 2026).
   printJobRow() puts a COPY of the open job at the end of <body> under the
   customer's name and address, and prints only that — the rest of the page is
   taken out altogether, so it cannot add blank pages. Never seen on screen. */
.cf-jobsheet { display: none; }
.cf-jobsheet-head { margin: 0 0 12px; padding-bottom: 10px; border-bottom: 2px solid var(--accent); }
.cf-jobsheet-title { margin: 0 0 4px; font-size: 13px; font-weight: 700; color: var(--accent); }
.cf-jobsheet-who { margin: 0 0 2px; font-size: 16px; font-weight: 700; color: var(--ink); }
.cf-jobsheet-line { margin: 0; font-size: 13px; color: var(--ink); }
@media print {
  body.cf-printing-job > *:not(.cf-jobsheet) { display: none !important; }
  body.cf-printing-job .cf-jobsheet { display: block; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  body.cf-printing-job .cf-jobsheet,
  body.cf-printing-job .cf-jobsheet * { visibility: visible !important; }
  body.cf-printing-job .cf-jobsheet .notes-row-body[hidden] { display: block !important; }
  /* Paper cannot be pressed: every button, the row's ▾ and the ⓘ links go —
     but not the row's head, a <button> that carries the job's date and words. */
  body.cf-printing-job .cf-jobsheet button:not(.notes-row-head),
  body.cf-printing-job .cf-jobsheet .notes-row-caret,
  body.cf-printing-job .cf-jobsheet .job-actions,
  body.cf-printing-job .cf-jobsheet textarea,
  body.cf-printing-job .cf-jobsheet a[href^="/guides/"] { display: none !important; }
}

/* ── 🏢 Company — commercial customers with people and sites ───────────────
   Allan is colourblind, so every state here is carried by an ICON or a WORD,
   never by colour alone: 🏢 company, 📍 site, 👤 person.
   Touch targets stay >= 44px (npm run check:touch measures this in a real
   browser, and a LATER duplicate rule silently wins — so keep these together
   and at the end of the file). */

/* Declared ONCE, here. There used to be a second `.company-line` rule at the
   very end of this file adding the flex layout, which meant the two halves of
   one component sat 250 lines apart and the file's own warning about a later
   duplicate silently winning applied to it. */
.company-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin: 2px 0 6px;
}

.company-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;              /* real tap target, not a decorative pill */
  padding: 6px 12px;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
  background: var(--pill);
  border: 1px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
  text-align: left;
}
.company-chip:hover { background: #e4ebf2; }
.company-chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.company-muted { color: var(--ink-soft); font-size: 13px; }

.company-head {
  padding: 10px 12px;
  background: var(--pill);
  border-radius: 8px;
  margin-bottom: 12px;
}
.company-name { font-weight: 700; font-size: 16px; color: var(--ink); }
/* The company name in a contact's Company section opens the company's own card. */
.company-open-card {
  display: flex; align-items: center; gap: 8px; width: 100%; min-height: 44px; padding: 0;
  background: none; border: 0; font: inherit; font-weight: 700; font-size: 16px; color: var(--ink);
  text-align: left; cursor: pointer;
}
.company-open-card:hover .company-open-hint { text-decoration: underline; }
.company-open-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.company-open-hint { margin-left: auto; font-size: 13px; font-weight: 600; color: #006aac; white-space: nowrap; }
.company-addr { font-size: 14px; color: var(--ink-soft); margin-top: 2px; }
.company-contact { font-size: 14px; margin-top: 4px; }

.company-list { margin-bottom: 14px; }
.company-list-title {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .03em;
  color: var(--ink-soft);
  margin-bottom: 6px;
}
/* ⓘ Guide — the Company customers guide, on the Sites heading. Floated, not a
   flex row: flex would swallow the spaces in "📍 Sites (2)". Icon AND the word,
   and a real link (works on a tap, no hover needed); the title= is the hover. */
.company-guide-link {
  float: right;
  font-size: 13px;
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0;
  color: var(--accent);
  text-decoration: none;
  padding: 2px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
}
.company-guide-link:hover, .company-guide-link:focus-visible,
.search-guide-link:hover, .search-guide-link:focus-visible { text-decoration: underline; }
/* ⓘ How to search — the same pill, on its own line at the top of the search
   form. */
.search-guide { display: flex; justify-content: flex-end; margin: 0 0 8px; }
.search-guide-link {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
  padding: 2px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
}
.company-rows { list-style: none; margin: 0; padding: 0; }
.company-row + .company-row { border-top: 1px solid var(--line); }
.company-row--empty { padding: 8px 2px; }

/* The whole row is the target — a 44px-tall button, not a small link. */
.company-row-open {
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: 100%;
  min-height: 44px;
  padding: 10px 8px;
  font: inherit;
  text-align: left;
  background: none;
  border: 0;
  border-radius: 6px;
  cursor: pointer;
}
.company-row-open:hover { background: var(--pill); }
.company-row-open:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
/* A site's name on the left, its small ⭐ Make Head Office on the right.
   The name always keeps 60% of the row; on a phone the button's words wrap
   onto two lines instead of squeezing the name and address into a sliver.
   🪤 Two classes on purpose: .sc-mini (its look) comes LATER in this file and
   says nowrap — one class here would lose to it and the button would run off
   the edge of the card on a phone. */
.company-row-line { display: flex; align-items: center; gap: 8px; }
.company-row-line > .company-row-open { flex: 1 1 0; min-width: 60%; }
.company-row-line > .company-ho-make { flex: 0 1 auto; margin-right: 4px; white-space: normal; text-align: center; }
.company-row-name { font-size: 15px; font-weight: 600; color: var(--ink); }
.company-row-sub { font-size: 13px; color: var(--ink-soft); }

.company-truncated { margin: -4px 0 10px; }
.company-actions { margin-top: 4px; }
.company-msg { margin-top: 8px; font-size: 14px; color: var(--ink-soft); }

.company-assign .company-search-field { margin: 10px 0 6px; }
.company-results { list-style: none; margin: 0 0 8px; padding: 0; }
.company-results li + li { border-top: 1px solid var(--line); }
.company-pick {
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: 100%;
  min-height: 44px;
  padding: 10px 8px;
  font: inherit;
  text-align: left;
  background: none;
  border: 0;
  border-radius: 6px;
  cursor: pointer;
}
.company-pick:hover { background: var(--pill); }
.company-pick:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.company-create { margin-top: 4px; }
.company-create-btn { width: 100%; min-height: 44px; }
/* 🧭 Hop between related records (2026-10-09): chips under the name, and
   "← Back" after a hop. Icon + words on every chip — never colour alone. */
.hop-strip { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 6px 0 2px; }
.hop-strip-lbl { font-size: 12px; color: #4b5563; margin-right: 2px; }
.hop-chip {
  min-height: 32px; padding: 4px 10px; border: 1px solid #cfe0ef; border-radius: 999px;
  background: #f8fafc; color: #006aac; font: inherit; font-size: 13px; cursor: pointer;
}
.hop-chip:hover { background: #eef4fb; }
.hop-chip:focus-visible, .hop-back:focus-visible { outline: 2px solid #006aac; outline-offset: 2px; }
@media (hover: none) { .hop-chip { min-height: 44px; } }
/* As wide as its words, never the full card: the Pin box sits top-right. */
.hop-back {
  display: block; width: auto; max-width: calc(100% - 90px); min-height: 44px; margin: 0 0 8px; padding: 8px 12px; text-align: left;
  border: 1px solid #cfe0ef; border-radius: 8px; background: #eef4fb; color: #006aac;
  font: inherit; font-weight: 600; cursor: pointer;
}
/* The company's own people / sites, offered above the Site contacts search. */
.sc-suggest { margin-bottom: 12px; }
.sc-suggest .sc-suggest-title { display: block; margin-bottom: 6px; }
/* ☑ already linked (words too, never colour alone) · ☐ one tap to add. */
.sc-tick-box { display: inline-block; width: 1.2em; font-size: 16px; }
.sc-tick.is-linked { cursor: default; opacity: .75; }
.sc-all-linked { padding: 6px 2px; }
/* "+ Create company" at the foot of a company search (2026-10-09). */
.company-create-tile { display: grid; gap: 6px; margin: 12px 0; }
.company-create-new { width: 100%; min-height: 44px; }
.company-create-tile p { margin: 0; }

/* Company search results: a card that lists the company, then its sites and
   people inline. Reuses .card so it inherits the result-list look exactly. */
.company-card .company-inline { padding: 0 14px 12px; }
.company-card .company-list { margin-bottom: 10px; }

/* 💷 Invoicing rule + 📣 group actions inside the Company panel. */
.company-billing, .company-group {
  margin: 14px 0;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.company-billing-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 6px; }
.company-billing-lbl { font-size: 14px; font-weight: 600; color: var(--ink); display: block; margin-bottom: 4px; }
.company-billing-choice { display: flex; gap: 8px; flex: 1; }
.company-bill-opt { flex: 1; min-height: 44px; }
/* Selected state carries a BORDER and a tint, never colour alone — Allan is
   colourblind, so the chosen option must be distinguishable by shape too. */
.company-bill-opt.is-on {
  border: 2px solid var(--accent);
  background: var(--pill);
  font-weight: 700;
}
.company-billing-contact { margin-top: 8px; }
.company-bill-to { width: 100%; min-height: 44px; font: inherit; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.company-billing-note { margin-top: 6px; }
/* 💷 "<name> has no email of their own…" under Send invoices to. The ⚠, the
   words and the left border each carry it — never colour alone. */
.company-billing-warn {
  margin-top: 6px;
  padding: 6px 8px;
  border-left: 3px solid var(--warn, #b54708);
  border-radius: 0 4px 4px 0;
  background: #fff8f1;
  color: var(--warn, #b54708);
  font-size: 13px;
  line-height: 1.4;
}

/* 💷 A Company's own price list — the same frame as Invoicing above it. */
.company-pricelist { margin: 14px 0; padding-top: 12px; border-top: 1px solid var(--line); }
.company-pricelist-on, .company-pricelist-off, .company-pricelist-help, .company-pricelist-howto,
.company-pricelist-msg, .company-pricelist-saving { font-size: 14px; line-height: 1.45; color: var(--ink); }
.company-pricelist-on, .company-pricelist-off { margin-bottom: 8px; }
.company-pricelist-help { margin: 8px 0; }
.company-pricelist-howto { margin-top: 8px; }
.company-pricelist-msg:empty, .company-pricelist-saving:empty { display: none; }
.company-pricelist-msg, .company-pricelist-saving { margin-top: 6px; font-weight: 600; }
.company-pricelist-opts { display: flex; flex-direction: column; gap: 8px; margin: 8px 0; }
.company-pricelist-opt {
  display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; align-items: start;
  padding: 10px; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; background: #fff;
}
.company-pricelist-opt input { width: 20px; height: 20px; margin: 2px 0 0; grid-row: span 6; }
/* Ticked carries a thicker BORDER and a tint, never colour alone (Allan is colourblind). */
.company-pricelist-opt:has(input:checked) { border: 2px solid var(--accent); background: var(--pill); }
.company-pricelist-name { font-weight: 700; color: var(--ink); overflow-wrap: anywhere; }
.company-pricelist-products { font-size: 13px; color: var(--ink); overflow-wrap: anywhere; }
.company-pricelist-opt .company-billing-warn, .company-pricelist-dupes .company-billing-warn { display: block; }
.company-pricelist-opt .company-billing-warn { grid-column: 2; }

.company-group-slot { margin-top: 10px; }
.company-confirm { padding: 10px; background: var(--pill); border-radius: 8px; }
.company-group-msg, .company-group-tag {
  width: 100%; min-height: 44px; font: inherit; padding: 8px 10px;
  border: 1px solid var(--line); border-radius: 8px; background: #fff;
  margin-bottom: 8px;
}
.company-confirm-list { margin-bottom: 10px; }
.company-row--plain { padding: 6px 2px; font-size: 14px; }
.company-excluded { margin-top: 6px; }
.company-group-result { margin-top: 8px; font-size: 14px; }
.company-group-summary { font-weight: 600; margin-bottom: 4px; }

/* A company in the results list: a summary that OPENS, like every other result
   in this app. The first version rendered the whole company inline here, which
   on desktop squashed it into the ~380px left rail and left the detail pane
   empty — while still showing a pointer cursor, so it looked clickable and
   wasn't. */
.company-card .company-tile-open {
  margin: 6px 0 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
}
/* An OPEN company card hides its own call-to-action — you are already in it. */
.company-card.is-selected .company-tile-open { display: none; }

/* The opened company card. On desktop it lives in the right-hand detail pane;
   on a phone it drops in under the tile that opened it. */
.company-card .company-card-body { padding: 0 14px 14px; }
.company-card .company-list:first-child { margin-top: 4px; }

/* + Adding a site or a person to a company. */
.company-add-btn { width: 100%; min-height: 44px; margin-top: 8px; }
.company-add { margin-top: 10px; padding: 10px; background: var(--pill); border-radius: 8px; }
.company-add .field { margin-bottom: 8px; }
/* 📍 "Looks after <site>" on + Add a person (2026-10-10). A real 44px target. */
.company-new-looks { display: flex; align-items: center; gap: 8px; min-height: 44px; margin: 0 0 8px; font-size: 15px; cursor: pointer; }
.company-new-looks input { width: 20px; height: 20px; margin: 0; accent-color: var(--accent); }
/* 📍👤 "Make a proper site" — under a site named after a person. */
.company-split-offer { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding: 0 8px 10px; font-size: 14px; }
.company-split-slot { flex-basis: 100%; }
.company-split-form { padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; }
.company-split-form p { margin: 0 0 8px; }
.company-split-list { margin: 0 0 10px; padding-left: 4px; list-style: none; display: grid; gap: 6px; }
.company-split-list label { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.company-split-name { min-height: 40px; min-width: 0; width: min(100%, 320px); font: inherit; padding: 6px 8px; }
.company-split-msg { margin-top: 8px; font-size: 14px; }
.company-add-hits { list-style: none; margin: 0 0 8px; padding: 0; }
.company-add-hits li + li { border-top: 1px solid var(--line); }
.company-add-hit {
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: 100%;
  min-height: 44px;
  padding: 10px 8px;
  font: inherit;
  text-align: left;
  background: none;
  border: 0;
  border-radius: 6px;
  cursor: pointer;
}
.company-add-hit:hover { background: #fff; }
.company-add-hit:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
/* A contact belongs to ONE company, so adding somebody already at another firm
   MOVES them. Warn on the row itself, before the tap — and carry it with an
   icon and words, never colour alone. */
.company-add-warn { font-size: 12px; font-weight: 600; color: var(--warn); }
.company-add-or {
  margin: 10px 0 8px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .03em;
  color: var(--ink-soft);
  text-align: center;
}
.company-add-create { width: 100%; min-height: 44px; }
.company-add-msg { margin-top: 8px; font-size: 14px; color: var(--ink-soft); }

/* ✏️ Editing the company's own details. */
.company-actions-edit { margin-top: 12px; }
.company-actions-edit .btn { width: 100%; min-height: 44px; }
.company-edit .btn { min-height: 44px; }

/* 🔗 Site contacts — who looks after which site. */
.sc-row { display: flex; align-items: flex-start; gap: 8px; }
.sc-row .company-row-open { flex: 1; }
.sc-position { font-weight: 600; color: var(--accent); }
.sc-row-actions { display: flex; flex-direction: column; gap: 4px; padding: 6px 0; }
.sc-mini {
  min-height: 44px;
  padding: 6px 10px;
  font: inherit;
  font-size: 13px;
  white-space: nowrap;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  cursor: pointer;
}
.sc-mini:hover { background: var(--pill); }
.sc-mini:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
/* ⭐ The first-call contact carries a STAR and the word, plus a border — never
   colour alone. */
.sc-primary.is-on {
  border: 2px solid var(--accent);
  background: var(--pill);
  font-weight: 700;
  color: var(--accent);
}
.sc-unlink { color: var(--warn); }
/* ⚠️ A primary contact left behind by an unlink made before that was fixed.
   Warning sign AND the words carry the meaning — never the colour alone. */
.sc-stranded {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 8px 0;
  padding: 10px;
  font-size: 14px;
  background: var(--pill);
  border: 1px solid var(--warn);
  border-radius: 8px;
}
.sc-stranded span { flex: 1 1 220px; }
.sc-position-edit { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.sc-position-input {
  width: 100%;
  min-height: 44px;
  padding: 8px 10px;
  font: inherit;
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-bottom: 8px;
}
.sc-position-save { width: 100%; min-height: 44px; }

/* 📍 Site / 👤 Person / 👤 Contact — what this record IS, beside the company it belongs to.
   Allan is colourblind, so the distinction is carried by an ICON and a WORD;
   the tint is decoration only and nothing depends on telling the two apart by
   colour. */
/* .company-line's layout moved up beside its margin — one rule, one place. */
.company-kind {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  font-size: 13px;
  font-weight: 700;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--pill);
  color: var(--pill-ink);
  white-space: nowrap;
}
.company-kind--site { border-color: rgba(0, 106, 172, .45); }
.company-kind--person { border-color: var(--line); }
.company-kind--contact { border-color: var(--line); }
.company-kind--company { border-color: rgba(0, 106, 172, .45); }
/* 🧾 "PO required" (28 Oct 2026) — meant to be noticed before a job is booked:
   amber, bold, and its icon + words carry it (Allan is colourblind). */
.po-required {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  font-size: 13px;
  font-weight: 800;
  border-radius: 999px;
  border: 1.5px solid var(--warn);
  background: #fff4e5;
  color: #7a2e00;
  white-space: nowrap;
}
.card-nameline .po-required { flex: 0 0 auto; }
/* "Looks after 📍 Thorne" — a PERSON'S site, not a site. Quieter than the
   badges above on purpose: it qualifies the record rather than classifying it,
   and it is the one of these that can carry a long branch name. Not
   white-space:nowrap for that reason — it wraps rather than pushing the card
   sideways. */
.company-kind--looks {
  font-weight: 600;
  color: var(--ink-soft);
  background: transparent;
  border-style: dashed;
  white-space: normal;
}

/* ── The result-card identity block ───────────────────────────────────────
   Three parts, and the ORDER is the feature (2026-09-05). A commercial client
   can have several sites with the SAME name — "Weldricks, Thorne" and
   "WHSmith, Thorne" — so the company is read BEFORE the name, or every card in
   the list says the same word.

       .company-eyebrow   🏢 WELDRICKS PHARMACY   whose this is
       .card-kindline     📍 SITE                 what it is (Company / Site / Person)
       .card-nameline     Thorne                  what it is called
       .company-line      Looks after 📍 Thorne   (people only, filled in later)

   28 Nov 2026 (Allan): the kind moved from BESIDE the name to its own line
   ABOVE it, so it is obvious straight away. A plain 👤 Contact still sits
   beside the name — that is the domestic customer and he wanted it unchanged.

   All of it is hidden on tiers without Companies — see FEATURE_SELECTORS in
   app.js, which lists every one of these classes. */
.company-eyebrow {
  margin: 0 0 2px;
  /* The chip inside is a 44px tap target, which is right for a control but too
     tall for a heading line, so the eyebrow reins it back in. Still >=44px on
     touch — the padding is what shrinks, not the hit area, because the row
     itself is the remaining space. */
  line-height: 1;
}
.company-eyebrow .company-chip {
  /* 🔴 SMALLER TO LOOK AT, AND THEREFORE SMALLER TO HIT. Dropping min-height
     makes this an 18px target — measured in a real browser at 320px — for a
     button that opens the whole Company panel, against a file-wide floor of
     44px. That is only acceptable with a mouse; the (hover: none) block below
     puts the 44px back for touch. If you restyle this, re-measure that. */
  min-height: 0;
  padding: 2px 10px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  background: transparent;
  border-color: transparent;
  color: var(--ink-soft);
}
/* 🖐 ON A FINGER, IT GOES BACK TO 44px. No cleverness: an ::after hit-pad was
   tried first and MEASURED FAILING in a real browser at 320px — later siblings
   paint over an un-stacked pseudo-element, so four of five chips hit-tested to
   something else entirely. A media query cannot half-work in that way.
   The compact eyebrow is therefore a MOUSE affordance only. On a phone the row
   is taller, and that is the correct trade: a company chip that cannot be
   tapped is not a smaller feature, it is a broken one. */
@media (hover: none) {
  .company-eyebrow .company-chip {
    min-height: 44px;
    padding: 6px 10px;
  }
}
.company-eyebrow .company-chip:hover {
  background: var(--pill);
  border-color: var(--line);
  color: var(--accent);
}

/* Name and badge on one row. The badge is pushed to the trailing edge so it
   lands in the same place on every card and the eye can run down the column
   instead of hunting for it after names of different lengths. */
.card-nameline {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}
/* 🪤 `.card .name` sets a bottom margin for the old stacked layout. Inside the
   flex row that margin would push the badge's baseline out of line with the
   name, so it is moved to the ROW. */
.card-nameline .name { margin-bottom: 0; }
.card-nameline { margin: 0 0 6px; }
/* The name takes the space and wraps; the badge never shrinks or splits. A
   long trading name must not squeeze "📍 SITE" into two lines. */
.card-nameline .name { flex: 1 1 auto; min-width: 0; }
.card-nameline .company-kind { flex: 0 0 auto; }

/* 🏢 / 📍 / 👤 on their own line straight above the name. Wraps (Company +
   🧾 PO required) rather than pushing a phone card sideways. */
.card-kindline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin: 2px 0 4px;
}
/* A tier without Companies drops the badge itself; don't leave an empty gap. */
.card-kindline:not(:has(.company-kind, .po-required)) { display: none; }

/* ▲▼ Hide details / Show details (Allan, 3 Nov 2026) — on the name line of the
   OPEN card only, so it stays in the same spot whichever state it is in and a
   second press needs no mouse movement. Words + arrow, never colour alone. */
.head-toggle { display: none; }
.head-toggle .head-show { display: none; }
body.cf-head-slim .head-toggle .head-hide { display: none; }
body.cf-head-slim .head-toggle .head-show { display: inline; }
.card.is-selected .head-toggle {
  display: inline-flex;
  flex: 0 0 auto;
  /* Last on the row, past any badge: where the hidden layout below has to put it,
     or a card with a badge would move the button out from under the mouse. */
  order: 1;
  align-items: center;
  justify-content: center;
  margin-left: auto;
  padding: 4px 12px;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
}
.card.is-selected .head-toggle:hover { border-color: var(--accent); color: var(--accent); }
/* A finger needs the 44px floor. */
@media (max-width: 1023px), (pointer: coarse) {
  .card.is-selected .head-toggle { min-height: 44px; }
}
/* What stays pinned (Allan's choice): the name line, the main phone/email row,
   the Full Contact buttons (.top-links, outside these rules) and the "someone
   else has this open" banner. ⤢ Focus stays too until you are IN Focus: the
   choice is remembered, so every card would otherwise open with only the F key
   as the way in. Screen only, so 🖨 Print still prints the whole record
   whichever way the toggle is set. */
@media screen {
  body.cf-head-slim .card.is-selected .card-pinhead > :not(.company-eyebrow, .card-kindline, .card-nameline, .address:not(.empty)),
  body.cf-head-slim .card.is-selected .card-head > :not(.card-pinhead, .card-presence, [data-contact-row], .focus-btn),
  body.cf-head-slim.is-pinned .card.is-selected .card-head > .focus-btn,
  body.cf-head-slim .card.is-selected .card-sticky > .activity { display: none; }
}
/* While hidden the address sits beside the name (Allan, 4 Nov 2026). The SAME <p>,
   not a copy, so everything that redraws it after a save keeps working. Name and
   address run as one line of text that wraps round the button. "No address on
   file" stays under ▼ Show details.
   📱 WIDE SCREENS ONLY (Allan, 9 Nov 2026, Weldricks on his phone). The badges
   float right of the name, which only works when the name AND every badge fit on
   ONE line. On a phone they don't (🏢 Company + 🧾 PO required + ▼ Show details is
   ~320px on its own), so each badge dropped to the next line with room, they
   staggered, and the address was squeezed between them ("Weldric / ks"). Under
   1024px the name line keeps its normal row, as with details shown, and the
   address is its own line underneath. */
@media screen and (min-width: 1024px) {
  body.cf-head-slim .card.is-selected .card-pinhead { display: flow-root; margin-bottom: 6px; }
  body.cf-head-slim .card.is-selected .card-nameline { display: contents; }
  body.cf-head-slim .card.is-selected .card-nameline > :not(.name) { float: right; margin-left: 8px; }
  /* The gap belongs to the name: on the address it would indent a wrapped line. */
  body.cf-head-slim .card.is-selected .card-nameline > .name { display: inline; margin-right: 10px; }
  body.cf-head-slim .card.is-selected .card-pinhead > .address:not(.empty) { display: inline; }
}

/* 💼 Position — the person's job title, straight under their name (2026-10-09).
   Pulled up into the name's own margin so it reads as part of who they are,
   not as one more detail line. No `display` here: `[hidden]` must win. */
.card-position {
  margin: -4px 0 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft);
  overflow-wrap: anywhere;
}

/* 🏷️ The contact's own Business name, under the name (2026-10-11). Same rhythm
   as the Position line. No `display` here: `[hidden]` must win. */
.card-business {
  margin: -4px 0 6px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  overflow-wrap: anywhere;
}
.card-business:not([hidden]) + .card-position { margin-top: -2px; }

/* 🏢 "… isn't set up as a company yet → ✅ Set it up" (2026-10-11). The icon
   and the words carry it; the tint only groups it. `[hidden]` must win, so
   the display rule is on the not-hidden state only. */
.company-nudge:not([hidden]) {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px;
  margin: 2px 0 8px; padding: 8px 10px;
  border: 1px solid #b9d5e8; border-radius: 8px; background: #f2f7fb;
  font-size: 14px; color: var(--ink);
}
.company-nudge__say { overflow-wrap: anywhere; }
.company-nudge__go, .company-nudge__keep { min-height: 40px; }
.company-nudge__how { color: var(--ink-soft); font-size: 13px; }
.company-nudge__help { font-size: 13px; font-weight: 600; color: var(--accent); white-space: nowrap; }

/* ── The archived quote email ─────────────────────────────────────────
   Reuses .form-embed-modal / .form-embed-backdrop for the scrim, so it
   layers exactly like every other overlay in the app.

   The body is a REAL customer email in a sandboxed iframe: it brings its own
   fonts, tables and inline styles, so this styles the frame around it and
   nothing inside. White ground, because that is what an email client gives it
   and a dark one would make half of them unreadable. */
.sent-email-dialog {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  width: min(760px, 94vw);
  /* 🪤 A px cap as well as vh — this can open inside GHL's iframe, where the
     available height is not the screen's. #sent-email-body scrolls within it. */
  max-height: min(88vh, 760px);
  margin: auto;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, .3);
  overflow: hidden;
}
.sent-email-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid #e5e7eb;
}
.sent-email-headings { min-width: 0; }   /* or a long subject stops the × shrinking */
.sent-email-title {
  margin: 0;
  font-size: 1rem;
  color: #1f2937;
  /* Subjects run long. Wrap rather than clip — it names which email this is. */
  overflow-wrap: anywhere;
}
.sent-email-meta { margin: 2px 0 0; font-size: .78rem; color: #6b7280; }
.sent-email-close {
  margin-left: auto;
  flex: none;
  border: 0;
  background: none;
  font-size: 1.4rem;
  line-height: 1;
  color: #6b7280;
  cursor: pointer;
  /* Thumb-sized: this is pressed on a phone in the back of a van. */
  min-width: 44px;
  min-height: 44px;
}
/* Uncertain match. Text AND an icon — never colour alone. */
.sent-email-warn {
  margin: 0;
  padding: 10px 18px;
  background: #fdf0d5;
  color: #8a5a00;
  font-size: .82rem;
  border-bottom: 1px solid #f0dcb0;
}
.sent-email-body {
  flex: 1 1 auto;
  min-height: 0;          /* 🪤 without this the frame refuses to shrink and the
                             dialog grows past its own max-height */
  width: 100%;
  border: 0;
  background: #fff;
}

/* ── 🧾🧾 Invoice jobs together (public/invoice-jobs.js, 20 Oct 2026) ─────────
   One pop-up for the card, the Company card and the Contact Record. Its own
   class, not .form-embed-modal: a backdrop tap there means Cancel, and this
   holds ticked jobs and typed prices — the back button asks first instead. */
.ij-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(17, 20, 26, 0.55);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  overflow-y: auto;
  padding: 24px 16px;
}
.ij-dialog {
  background: var(--card);
  color: var(--ink);
  border-radius: var(--radius);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
  width: 100%;
  max-width: 780px;
  display: flex;
  flex-direction: column;
  outline: none;
}
.ij-head { display: flex; align-items: center; gap: 8px; padding: 16px 18px 0; }
.ij-head h2 { font-size: 18px; margin: 0; flex: 1; }
.ij-x { min-width: 44px; min-height: 44px; }
.ij-sub { padding: 2px 18px 0; color: var(--ink-soft); font-size: 14px; }
.ij-body { padding: 12px 18px; display: grid; gap: 12px; min-width: 0; }
.ij-wait, .ij-empty { color: var(--ink-soft); margin: 8px 0; }
.ij-muted { color: var(--ink-soft); font-size: 13px; }
.ij-alert {
  border: 1px solid var(--warn);
  background: #fffbeb;
  color: #78350f;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 14px;
}
.ij-scope { border: 0; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 16px; }
.ij-scope legend { font-weight: 600; margin-bottom: 4px; }
.ij-scope label, .ij-tools label, .ij-due label { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; }
.ij-tools { display: flex; flex-wrap: wrap; gap: 8px 18px; align-items: center; }
.ij-tools select { min-height: 36px; font: inherit; padding: 4px 8px; border: 1px solid var(--line); border-radius: 6px; }
.ij-list { border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
/* "Show: Not invoiced · Not done yet · Already invoiced" — any combination. */
.ij-show { display: flex; flex-wrap: wrap; align-items: center; gap: 0 14px; }
.ij-show > b { font-weight: 600; }
/* An action, not a fourth filter — set apart at the row's end. */
.ij-tools .ij-tickall { margin-left: auto; font-weight: 600; }
/* A heading over each month, so the year turning over reads as a new month. */
.ij-monthhead {
  padding: 6px 12px;
  background: var(--pill);
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--line);
}
.ij-row {
  display: grid;
  grid-template-columns: auto 172px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  min-height: 44px;
}
.ij-row:last-child { border-bottom: 0; }
.ij-row input[type="checkbox"] { width: 20px; height: 20px; }
.ij-row.is-off { cursor: default; color: var(--ink-soft); background: #f8fafc; }
/* The date with the job's state under it ("✓ Already on…", "📅 Not done yet"). */
.ij-row__date { display: grid; gap: 4px; justify-items: start; min-width: 0; }
.ij-row__day { font-variant-numeric: tabular-nums; white-space: nowrap; }
.ij-row__date .ij-tag { margin-left: 0; }
.ij-row__what { min-width: 0; overflow-wrap: anywhere; }
.ij-row__price { font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; }
.ij-po, .ij-tag {
  display: inline-block;
  font-size: 12px;
  border-radius: 999px;
  padding: 1px 8px;
  margin-left: 4px;
  background: var(--pill);
  color: var(--pill-ink);
  white-space: nowrap;
}
/* "✓ Already on INV-…" — a light green pill (Allan, 20 Oct 2026). The ✓ and the
   words carry the meaning; the green only backs them up. */
.ij-tag--done { color: var(--good); background: #e6f4ea; border: 1px solid #b7dfc3; font-weight: 600; }
/* "📅 Not done yet" — tickable, but worth a second look before billing it: bold
   words in amber under the date, NOT a pill (Allan, 20 Oct 2026, look "A"). */
.ij-tag--future { background: none; border: 0; padding: 0; margin-left: 8px; color: var(--warn); font-weight: 700; font-size: 13px; }
.ij-tag--warn { color: var(--warn); white-space: normal; }
.ij-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 12px 18px 16px;
  border-top: 1px solid var(--line);
}
.ij-foot .btn { min-height: 44px; }
/* 💻 The buttons are PINNED on the computer too (Allan, 25 Nov 2026, q29: "yes"):
   at 1280x900 Next sat 174px below the screen and Create & send 1,387px. The
   overlay is what scrolls, and a sticky bar is held inside its CONTENT box, so
   bottom is MINUS the overlay's 24px bottom padding — the bar sits on the
   screen's own bottom edge, nothing showing under it. Once the card's end
   scrolls into view the bar rests at the card's foot again, so its bottom
   corners are rounded to match the card's (the card itself does not clip).
   The phone's own rule is in the @media (max-width: 600px) block below. */
@media (min-width: 600.02px) {
  .ij-foot {
    position: sticky; bottom: -24px; z-index: 1; background: var(--card);
    border-radius: 0 0 var(--radius) var(--radius);
  }
}
.ij-count { flex: 1 1 220px; }
.ij-spacer { flex: 1; }
.ij-to { display: grid; gap: 4px; }
.ij-to select { min-height: 40px; font: inherit; padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; max-width: 100%; }
.ij-due { border: 0; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 14px; }
.ij-due legend { font-weight: 600; margin-bottom: 2px; }
.ij-job { border: 1px solid var(--line); border-radius: 8px; padding: 10px; display: grid; gap: 8px; min-width: 0; }
.ij-job__head { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; }
.ij-job__foot { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.ij-off { color: var(--good); font-size: 13px; }
.ij-line { border: 1px solid var(--line); border-radius: 8px; padding: 8px; display: grid; gap: 6px; }
.ij-line.is-ask { border-color: var(--warn); border-width: 2px; }
/* ✅ A line NOT ticked as done (Allan, 6 Nov 2026): switched off, dashed, said in
   words + icon, with the one button that puts it back on. */
.ij-line--off { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; border-style: dashed; background: #f8fafc; color: var(--ink-soft); }
.ij-notdone { font-weight: 700; color: var(--warn); white-space: nowrap; }
.ij-line__offname { flex: 1 1 200px; min-width: 0; overflow-wrap: anywhere; }
.ij-backon { min-height: 44px; flex: none; }
.ij-line__main { display: flex; flex-wrap: wrap; gap: 6px; align-items: flex-end; }
.ij-f { display: grid; gap: 2px; font-size: 12px; color: var(--ink-soft); min-width: 0; }
.ij-f input {
  font: inherit;
  font-size: 15px;
  color: var(--ink);
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  min-height: 38px;
  width: 100%;
  box-sizing: border-box;
}
.ij-f--name { flex: 1 1 200px; }
.ij-f--qty { flex: 0 0 72px; }
.ij-f--amt { flex: 0 0 110px; }
.ij-f--desc input { font-size: 13px; }
.ij-line__total { min-width: 84px; text-align: right; font-weight: 600; padding-bottom: 10px; font-variant-numeric: tabular-nums; }
.ij-del { min-width: 44px; min-height: 38px; }
.ij-vatrow { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 13px; }
.ij-vatrow .btn { min-height: 36px; font-size: 13px; }
.ij-ask { color: var(--warn); font-weight: 700; }
.ij-totals { display: grid; gap: 4px; justify-items: stretch; border-top: 1px solid var(--line); padding-top: 10px; }
.ij-trow { display: flex; justify-content: space-between; gap: 12px; font-variant-numeric: tabular-nums; }
.ij-trow--total { font-size: 17px; }
.ij-msg { min-height: 1em; font-size: 14px; }
.ij-msg.is-bad { color: var(--warn); font-weight: 600; }
.ij-pick { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; width: 100%; }
.ij-pick > b { flex-basis: 100%; }
.ij-done { border: 1px solid var(--good); background: #f0fdf4; border-radius: 8px; padding: 12px; display: grid; gap: 4px; }
.ij-done__big { font-size: 17px; font-weight: 700; }
@media (max-width: 600px) {
  .ij-overlay { padding: 0; }
  .ij-dialog { border-radius: 0; min-height: 100%; }
  /* The buttons are PINNED to the bottom of the screen (Allan, 25 Nov 2026): a
     list of jobs, or the review with its lines, is taller than a phone, and
     Next / Create & send sat at the end of the scroll, off the bottom. The
     overlay is what scrolls, and here it has no padding, so bottom:0 is the
     screen's own bottom edge. The card's colour behind it, so nothing shows
     through underneath. */
  .ij-foot {
    position: sticky; bottom: 0; z-index: 1; background: var(--card);
    padding-bottom: calc(16px + env(safe-area-inset-bottom));
  }
  .ij-row { grid-template-columns: auto 1fr auto; }
  .ij-row__date { grid-column: 2; }
  .ij-row__what { grid-column: 2 / 4; }
  .ij-row__price { grid-row: 1; grid-column: 3; }
}

/* The second "Not one of these?" strip, at the foot of a long list of results: a little air above it. */
.new-enquiry-check--foot { margin-top: 12px; }

/* After a search the results are scrolled to the top of the screen: stop a little below the very edge. */
#resultsCount, #results { scroll-margin-top: 10px; }
/* …and below the wide layout the page has to be TALL ENOUGH to get them there. Two short
   results on a tall phone (430 × 932) left the page 68px too short to scroll, so the foot
   of the Search button stayed on screen (measured 24 Nov 2026). A list that has anything
   in it is at least one screen tall; an empty one adds nothing. */
@media (max-width: 1023.98px) {
  #results:not(:empty) { min-height: calc(100vh - 10px); min-height: calc(100dvh - 10px); }
}
