/* ============================================================
   SprinklerCRM Online: shared styles for every public page.
   Plain CSS, no framework. The design rules behind these values are in the vault note
   "Design Guidelines 2026-11" (!-01-Reference Files/Planning/), with every color pair's contrast.

   Colors: red, black and white, with neutral greys between them, and nothing else in the chrome.
   Dark is the look everyone starts in (:root); the light look redefines the same tokens below.
   look.js puts each person's Settings on <html>: data-theme="dark" or "light", and data-text-size,
   which sets --text-scale. Every font size is its size at Normal times --text-scale,
   written calc(13px * var(--text-scale)).
   Map pins and drawing colors are data, not chrome, so they keep their own colors (crm.js), as do the
   Bids list's tags (--tag-*).
   ============================================================ */

/* ==== TOKENS ==== */
:root {
  color-scheme: dark;
  /* surfaces, from the page up */
  --bg: #0a0a0a;              /* the page */
  --surface: #141414;         /* cards, menus, the drawer */
  --raise: #1f1f1f;           /* a row or button under the pointer; a panel inside a card */
  --field: #0f0f0f;           /* inside inputs */
  --overlay: rgba(0, 0, 0, .6);   /* behind a dialog */
  /* words */
  --ink: #f5f5f5;             /* body text: 15:1 on --raise */
  --muted: #a3a3a3;           /* hints, labels, table heads: 6.5:1 on --raise */
  --ink-invert: #0a0a0a;      /* words on an --ink fill (a won badge, a toast) */
  /* lines */
  --line: #2a2a2a;            /* card edges and dividers: decoration only */
  --line-soft: #1c1c1c;       /* between table rows */
  --control-line: #737373;    /* the edge of an input or button: 3:1 or better on every surface (WCAG 1.4.11) */
  /* red */
  --accent: #dc1f36;          /* filled red: the primary button, the brand mark; white words on it are 4.9:1 */
  --accent-hover: #e0263c;    /* still 4.6:1 with white words */
  --accent-press: #c4102b;
  --accent-ink: #ffffff;      /* words on filled red */
  --accent-text: #ff5a64;     /* red words on a dark surface: 5.4:1 on --raise */
  --accent-soft: #2a0e12;     /* a red-tinted chip or selected row */
  /* Bids list tags (FTR-0019, approved 2026-11-06): data with hues of their own; past due is the accent red */
  --tag-amber: #f2b441;
  --tag-amber-soft: #2b2108;
  --tag-green: #5fcf8b;
  --tag-green-soft: #0b2416;
  --tag-blue: #7db4ff;
  --tag-blue-soft: #0d1d33;
  --tag-violet: #c9a8ff;
  --tag-violet-soft: #20163a;
  --focus: #ffffff;           /* the keyboard focus ring: the strongest color against the page */
  /* the top bar is black in both looks */
  --bar: #000000;
  --bar-ink: #ffffff;
  --bar-muted: #c2c2c2;       /* 12:1 on the bar */
  --bar-hover: rgba(255, 255, 255, .1);
  --bar-line: #262626;        /* separates the bar from a near-black page */
  --map-bg: #1a1a1a;
  --accent-glow: rgba(220, 31, 54, .35);   /* the halo behind the sign-in mark */
  --shadow: 0 1px 0 rgba(255, 255, 255, .03) inset;   /* dark surfaces rise by getting lighter, not by shadow */
  --shadow-lift: 0 12px 32px rgba(0, 0, 0, .55);
  --shadow-panel: -12px 0 32px rgba(0, 0, 0, .6);
  /* shape and size */
  --radius: 14px;             /* cards and panels */
  --radius-control: 10px;     /* inputs */
  --radius-pill: 999px;       /* buttons, badges, chips */
  --control-h: 44px;          /* a button or input: phone-first, 44 on touch (Apple's minimum; WCAG 2.5.8 asks 24) */
  --control-h-small: 44px;    /* with a mouse or trackpad these drop to 40 and 32 (below) */
  --control-h-large: 52px;
  /* motion: short and eased; prefers-reduced-motion turns it off (end of this section) */
  --ease: cubic-bezier(.2, 0, 0, 1);       /* things arriving or responding */
  --ease-exit: cubic-bezier(.3, 0, 1, 1);  /* things leaving */
  --dur-press: 90ms;
  --dur-quick: 150ms;
  --dur-enter: 220ms;
  --ui: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, Menlo, Consolas, monospace;
  --text-scale: 1;
  /* Steps for new rules (TKT-0801); older rules still carry their own numbers and move over as they are touched.
     Space between and inside things: */
  --space-1: 4px; --space-2: 8px; --space-3: 12px; --space-4: 16px; --space-5: 24px; --space-6: 32px;
  /* Word sizes at Normal. Use them as calc(var(--type-2) * var(--text-scale)), so Settings and field mode still scale them:
     1 labels and badges, 2 hints and table heads, 3 body, 4 a card's heading, 5 a number tile, 6 the page's heading. */
  --type-1: 12px; --type-2: 13px; --type-3: 15px; --type-4: 19px; --type-5: 24px; --type-6: 28px;
  --edge: 20px;               /* between the window's side and the page; a phone's top bar uses less */
}

/* Text size (Settings): Small, Normal, Large, Extra large. */
:root[data-text-size="small"] { --text-scale: .9; }
:root[data-text-size="large"] { --text-scale: 1.15; }
:root[data-text-size="xlarge"] { --text-scale: 1.3; }

/* The light look (Settings > Colors): the same tokens, made for a white page. */
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f5f5f5;
  --surface: #ffffff;
  --raise: #f0f0f0;
  --field: #ffffff;
  --overlay: rgba(0, 0, 0, .4);
  --ink: #0a0a0a;
  --muted: #525252;           /* 6.8:1 on --raise */
  --ink-invert: #ffffff;
  --line: #e0e0e0;
  --line-soft: #ededed;
  --control-line: #858585;    /* 3.4:1 on --bg, 3.7:1 on white */
  --accent: #c4102b;          /* white words on it are 6.1:1 */
  --accent-hover: #ad0e26;
  --accent-press: #960c21;
  --accent-ink: #ffffff;
  --accent-text: #b0102a;     /* 7.1:1 on white */
  --accent-soft: #fbe9eb;
  --tag-amber: #8a5300;
  --tag-amber-soft: #fcefd6;
  --tag-green: #17653a;
  --tag-green-soft: #e1f3e8;
  --tag-blue: #1553a8;
  --tag-blue-soft: #e4eefc;
  --tag-violet: #6a3db5;
  --tag-violet-soft: #efe7fb;
  --focus: #0a0a0a;
  --bar: #000000;
  --bar-ink: #ffffff;
  --bar-muted: #c2c2c2;
  --bar-hover: rgba(255, 255, 255, .1);
  --bar-line: #000000;
  --map-bg: #e8e8e8;
  --accent-glow: rgba(196, 16, 43, .22);
  --shadow: 0 1px 2px rgba(0, 0, 0, .05), 0 1px 3px rgba(0, 0, 0, .07);
  --shadow-lift: 0 10px 28px rgba(0, 0, 0, .12);
  --shadow-panel: -12px 0 32px rgba(0, 0, 0, .14);
}

/* Phone-first: the sizes above are for fingers. A mouse or trackpad gets the denser desktop sizes. */
@media (pointer: fine) { :root { --control-h: 40px; --control-h-small: 32px; --control-h-large: 48px; } }

/* Field mode, for pages used on job sites (gloves, glare, a phone in one hand): bigger targets, bigger
   words, and grey words pushed nearer to the text color. Put class="field-mode" on <body>. It is the
   default for those pages, not a setting. */
.field-mode { --control-h: 56px; --control-h-small: 48px; --control-h-large: 64px; --text-scale: 1.15; --muted: #c7c7c7; }
:root[data-theme="light"] .field-mode { --muted: #333333; }
:root[data-text-size="large"] .field-mode { --text-scale: 1.3; }
:root[data-text-size="xlarge"] .field-mode { --text-scale: 1.45; }

/* Animation: on phones only transform and opacity ever animate; hover colors ease in on pointer screens (end of file). */

/* Reduced motion (the computer's setting): no movement, only instant changes. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* ==== PAGE TO PAGE (TKT-0009) ====
   Moving between the site's pages cross-fades the content while the top bar and the branch line stay put
   (View Transitions; Chrome and Edge 126+, Safari 18.2+). Other browsers, and the tools, just change page.
   Off under reduced motion. */
@view-transition { navigation: auto; }
.topbar { view-transition-name: topbar; }
.branch-bar, #branch-bar-slot { view-transition-name: branch-bar; }
::view-transition-old(root) { animation: fade-out var(--dur-quick) var(--ease-exit) both; }
::view-transition-new(root) { animation: rise-in var(--dur-enter) var(--ease) both; }
::view-transition-old(topbar), ::view-transition-new(topbar), ::view-transition-old(branch-bar), ::view-transition-new(branch-bar) { animation: none; }
@media (prefers-reduced-motion: reduce) { ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; } }

/* ==== BASE ==== */
* { box-sizing: border-box; }
html, body { margin: 0; }
/* On a touch screen (TKT-0802): no grey flash on a tap (each control shows its own press), no wait for a second tap
   before the first one counts, and words that stay their size when a phone is turned on its side. */
html { -webkit-tap-highlight-color: transparent; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
a, button, .button, select, summary, label, input[type="checkbox"], input[type="radio"] { touch-action: manipulation; }
/* 100dvh is the part of a phone's screen the browser's own bars leave free; 100vh stays for older browsers. */
body { background: var(--bg); color: var(--ink); font-family: var(--ui); font-size: calc(15px * var(--text-scale)); line-height: 1.5; min-height: 100vh; min-height: 100dvh; }
:root:not([data-theme="light"]) body { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
::selection { background: var(--accent); color: var(--accent-ink); }
/* Links are the text color, underlined: red is kept for actions and warnings. */
a { color: var(--ink); text-decoration-line: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; text-decoration-color: color-mix(in srgb, currentColor 50%, transparent); }
@media (hover: hover) { a:hover { text-decoration-color: currentColor; } }
h1, h2, h3 { line-height: 1.2; margin: 0; letter-spacing: -.01em; }
h1 { font-size: calc(28px * var(--text-scale)); letter-spacing: -.02em; }
h2 { font-size: calc(19px * var(--text-scale)); }
h3 { font-size: calc(15px * var(--text-scale)); }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* Keyboard focus: a 2 px ring in the strongest color, 2 px off the edge, on everything you can reach. */
/* Skip to the page (TKT-0025): the first thing Tab reaches on every page, shown only while it has focus. */
.skip-link { position: absolute; left: 12px; top: -80px; z-index: 1300; padding: 10px 16px; border-radius: var(--radius-pill); background: var(--ink); color: var(--ink-invert);
  font-weight: 600; text-decoration: none; }
.skip-link:focus { top: 8px; }
main:focus { outline: none; }   /* the skip link's target takes focus without a ring around the whole page */
/* A row's name as a button (TKT-0025): reads as the row's name, works with the keyboard. */
button.row-button, .button.row-button { min-height: 0; padding: 2px 0; text-align: left; white-space: normal; text-decoration: none; font-weight: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* ==== TOP BAR (black in both looks) ==== */
.topbar { position: sticky; top: 0; z-index: 1100; display: flex; align-items: center; gap: 18px; padding: 0 20px; height: 56px;
  background: var(--bar); color: var(--bar-ink); border-bottom: 1px solid var(--bar-line); }
.topbar .brand { display: flex; align-items: center; gap: 10px; color: var(--bar-ink); text-decoration: none; font-weight: 700; letter-spacing: .1px; }
.brand-mark { width: 28px; height: 28px; border-radius: 8px; background: var(--accent); display: grid; place-items: center; }
.brand-mark svg { width: 16px; height: 16px; }
.topbar nav { display: flex; gap: 2px; flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.topbar nav a { position: relative; color: var(--bar-muted); text-decoration: none; padding: 8px 12px; border-radius: 8px; font-size: calc(14px * var(--text-scale)); font-weight: 500; white-space: nowrap;
}
@media (hover: hover) { .topbar nav a:hover { color: var(--bar-ink); background: var(--bar-hover); } }
/* the page you are on: white words and a red bar under them */
.topbar nav a[aria-current="page"] { color: var(--bar-ink); font-weight: 600; }
.topbar nav a[aria-current="page"]::after { content: ""; position: absolute; left: 12px; right: 12px; bottom: 2px; height: 2px; border-radius: 2px; background: var(--accent); }
.topbar :focus-visible { outline-color: #ffffff; }
.topbar .who { display: flex; align-items: center; gap: 10px; font-size: calc(13px * var(--text-scale)); color: var(--bar-muted); white-space: nowrap; }
/* Feedback and Report a bug: red buttons with bold white text */
.topbar .sfb-buttons button { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 700; }
@media (hover: hover) { .topbar .sfb-buttons button:hover { background: var(--accent-hover); border-color: var(--accent-hover); } }
.topbar .sfb-buttons { display: flex; gap: 6px; }
/* The profile card: your initials in a red circle (profile-card.js), and the menu under it. */
.profile-card { position: relative; }
.topbar .avatar { width: 36px; height: 36px; min-height: 0; padding: 0; border-radius: 50%; background: var(--accent); color: var(--accent-ink);
  border: 2px solid rgba(255, 255, 255, .7); font-weight: 700; font-size: calc(13px * var(--text-scale)); letter-spacing: .5px; }
.topbar .avatar[aria-expanded="true"] { background: var(--accent-hover); border-color: #ffffff; }
@media (hover: hover) { .topbar .avatar:hover { background: var(--accent-hover); border-color: #ffffff; } }
.profile-menu { position: absolute; top: calc(100% + 8px); right: 0; z-index: 1200; min-width: 220px; padding: 6px; white-space: normal;
  background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-lift);
  animation: rise-in var(--dur-enter) var(--ease); }
.profile-menu-head { padding: 8px 10px 10px; margin-bottom: 4px; border-bottom: 1px solid var(--line); }
.profile-menu-head b { display: block; font-size: calc(14px * var(--text-scale)); }
.profile-menu-head span { display: block; color: var(--muted); overflow-wrap: anywhere; }
.profile-menu [role="menuitem"] { display: flex; width: 100%; justify-content: flex-start; min-height: 40px; padding: 8px 10px; border: 0; border-radius: 8px;
  background: none; color: var(--ink); font-size: calc(14px * var(--text-scale)); font-weight: 500; text-decoration: none; }
.profile-menu [role="menuitem"]:focus-visible { background: var(--raise); }
@media (hover: hover) { .profile-menu [role="menuitem"]:hover { background: var(--raise); } }
.profile-menu .sign-out { margin-top: 4px; border-top: 1px solid var(--line); border-radius: 0 0 8px 8px; color: var(--accent-text); font-weight: 600; }
/* phones: the brand and section links on one row, the buttons on the next, so nothing runs off the screen */
@media (max-width: 640px) { .topbar { --edge: 12px; flex-wrap: wrap; height: auto; padding: 6px 12px; gap: 6px 12px; } .topbar .who { flex: 1 0 100%; min-height: var(--control-h-small); } .drawer { top: 0; z-index: 1101; } }
/* ==== THE TOP BAR ON A NARROW WINDOW (TKT-0803) ====
   Under 1024 px (a tablet held upright, a phone) the row of sections and the two report buttons do not fit, and
   the row used to be cut off mid-word. They fold into one Menu, which shell.js builds from this person's sections
   and hides with an inline style; the rule below shows it. A phone's own bar sizes are in phone.css. */
.phone-menu { position: relative; flex: none; }
.phone-menu summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 14px;
  border: 1px solid var(--bar-line); border-radius: var(--radius-control); color: var(--bar-ink); font-weight: 600; }
.phone-menu summary::-webkit-details-marker { display: none; }
.phone-menu summary::after { content: ""; width: 7px; height: 7px; margin-top: -4px; border: solid currentColor; border-width: 0 2px 2px 0; transform: rotate(45deg); }
.phone-menu[open] summary::after { margin-top: 4px; transform: rotate(-135deg); }
.phone-menu-list { position: absolute; right: 0; top: calc(100% + 8px); width: min(260px, calc(100vw - 24px)); display: flex; flex-direction: column;
  padding: 6px; background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-lift); z-index: 1200; }
.phone-menu-list a { display: block; padding: 12px; border-radius: var(--radius-control); color: var(--ink); text-decoration: none; font-weight: 500; }
.phone-menu-list a[aria-current="page"] { background: var(--raise); font-weight: 700; box-shadow: inset 3px 0 0 var(--accent); }
.phone-menu-list .sfb-buttons { display: flex; gap: 8px; margin-top: 6px; padding: 10px 4px 4px; border-top: 1px solid var(--line); }
.phone-menu-list .sfb-buttons button { flex: 1; }
@media (max-width: 1023px) {
  .topbar .phone-menu { display: revert !important; }
  .topbar nav, .topbar .who .sfb-buttons { display: none; }
  .topbar .brand { flex: 1 1 auto; min-width: 0; }
}
/* The branch line's place, held while it loads for someone who had it last time (look.js, shell.js). */
:root[data-branch-bar="1"] #branch-bar-slot { min-height: 40px; background: var(--surface); border-bottom: 1px solid var(--line); }
/* "TEST: test site, test data": a caution, so amber, not the red of something wrong (TKT-0806) */
.env-banner { display: none; background: var(--tag-amber-soft); color: var(--tag-amber); text-align: center; font-size: calc(13px * var(--text-scale)); font-weight: 600; padding: 4px; }
.env-banner.show { display: block; }

/* ==== LAYOUT ==== */
.wrap { max-width: 1240px; margin: 0 auto; padding: 28px 20px 48px; }
.wrap.narrow { max-width: 440px; padding-top: 8vh; }
/* A page that is mostly a list or a table (Bids, Projects, the CRM) uses a wide window (TKT-0815): at 1240 px names
   wrapped onto three lines while a third of a large screen stood empty. Pages that are read stay at 1240. */
.wrap.wide { max-width: 1600px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head p { margin: 6px 0 0; color: var(--muted); }
.page-head-actions { display: inline-flex; gap: 8px; flex-wrap: wrap; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; }
.card + .card { margin-top: 16px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.grid-2 > .card + .card { margin-top: 0; }
@media (max-width: 860px) { .grid-2 { grid-template-columns: minmax(0, 1fr); } }

/* ==== FORMS ==== */
label { display: block; font-size: calc(13px * var(--text-scale)); font-weight: 600; margin: 12px 0 4px; }
input, select, textarea { font: inherit; width: 100%; min-height: var(--control-h); padding: 8px 12px; border: 1px solid var(--control-line); border-radius: var(--radius-control);
  background: var(--field); color: var(--ink); }
textarea { line-height: 1.45; }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 1; }
@media (hover: hover) { input:hover, select:hover, textarea:hover { border-color: var(--ink); } }
/* an input shows focus however it was reached: the edge turns to the text color, with the ring around it */
input:focus, select:focus, textarea:focus { outline: 2px solid var(--focus); outline-offset: 1px; border-color: var(--ink); }
/* a select draws its own arrow, so it matches in both looks */
select { appearance: none; padding-right: 34px; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: right 17px center, right 12px center; background-size: 5px 5px; background-repeat: no-repeat; }
select[multiple] { background-image: none; padding-right: 12px; }
input[type="checkbox"], input[type="radio"] { width: 18px; height: 18px; min-height: 0; margin: 0; padding: 0; accent-color: var(--accent); cursor: pointer; }
input:disabled, select:disabled, textarea:disabled { color: var(--muted); background: var(--raise); cursor: not-allowed; }
input.code { font-family: var(--mono); font-size: calc(26px * var(--text-scale)); letter-spacing: 8px; text-align: center; }

/* ==== BUTTONS ====
   Four kinds, in order of weight. One primary per view: the one thing the page is for.
     (plain)   secondary: an outlined pill, for everything else
     .primary  filled red with white words
     .quiet    no edge until the pointer is on it, for toolbars and table rows
     .danger   red words; fills red under the pointer; a second click arms it (.armed)
   .link looks like a link; .small and .large change the height (32 and 48 px).
   States: hover lightens (pointer screens only), press sinks to 97%, focus shows the ring,
   disabled fades to half, aria-busy="true" swaps the words for a spinner and keeps the width. */
button, .button { --btn-ink: var(--ink);
  font: inherit; font-size: calc(14px * var(--text-scale)); font-weight: 600; line-height: 1.2;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; position: relative;
  min-height: var(--control-h); padding: 6px 18px; border-radius: var(--radius-pill);
  border: 1px solid var(--control-line); background: transparent; color: var(--btn-ink);
  cursor: pointer; text-decoration: none; white-space: nowrap; user-select: none; -webkit-tap-highlight-color: transparent;
  transition: transform var(--dur-press) var(--ease); }
@media (hover: hover) { button:hover, .button:hover { background: var(--raise); border-color: var(--ink); } }
button:active, .button:active { transform: scale(.97); }
button.primary, .button.primary { --btn-ink: var(--accent-ink); background: var(--accent); border-color: var(--accent); }
@media (hover: hover) { button.primary:hover, .button.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); } }
button.primary:active, .button.primary:active { background: var(--accent-press); border-color: var(--accent-press); }
button.quiet, .button.quiet { border-color: transparent; }
button.link, .button.link { --btn-ink: var(--ink); min-height: 0; border: 0; background: none; padding: 6px 0; border-radius: 4px; font-weight: 500;
  text-decoration: underline; text-underline-offset: 3px; text-decoration-color: color-mix(in srgb, currentColor 50%, transparent); }
@media (hover: hover) { button.link:hover, .button.link:hover { background: none; text-decoration-color: currentColor; } }
button.link:active, .button.link:active { transform: none; }
button.danger, .button.danger { --btn-ink: var(--accent-text); }
@media (hover: hover) { button.danger:hover, .button.danger:hover { --btn-ink: var(--accent-ink); background: var(--accent); border-color: var(--accent); } }
button.armed, .button.armed { --btn-ink: var(--accent-ink); background: var(--accent); border-color: var(--accent); }
button.small, .button.small { min-height: var(--control-h-small); padding: 4px 12px; font-size: calc(13px * var(--text-scale)); gap: 6px; }
button.large, .button.large { min-height: var(--control-h-large); padding: 8px 24px; font-size: calc(15px * var(--text-scale)); }
button:disabled, button[aria-disabled="true"], .button[aria-disabled="true"] { opacity: .5; cursor: not-allowed; transform: none; }
@media (hover: hover) { button:disabled:hover { background: transparent; border-color: var(--control-line); } button.primary:disabled:hover { background: var(--accent); border-color: var(--accent); } }
/* loading: the words go clear (so the width holds) and a spinner turns in the middle */
button[aria-busy="true"], .button[aria-busy="true"] { color: transparent; pointer-events: none; }
button[aria-busy="true"]::after, .button[aria-busy="true"]::after { content: ""; position: absolute; inset: 0; margin: auto; width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid var(--btn-ink); border-right-color: transparent; animation: spin .7s linear infinite; }
@media (prefers-reduced-motion: reduce) { button[aria-busy="true"]::after, .button[aria-busy="true"]::after { animation: spin 1.6s linear infinite !important; } }

.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 18px; }
.hint { font-size: calc(13px * var(--text-scale)); color: var(--muted); margin: 6px 0 0; }
.msg { min-height: 1.2em; font-size: calc(14px * var(--text-scale)); margin: 12px 0 0; }
.msg.error { color: var(--accent-text); font-weight: 600; }
.msg.ok { color: var(--ink); font-weight: 600; }
.msg.ok:not(:empty)::before { content: "\2713\00a0"; }

/* ==== SEGMENTED CHOICE (a row of pills, one picked): .segmented[role=radiogroup] > label > input[type=radio] + span ==== */
.segmented { display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 3px; border: 1px solid var(--control-line); border-radius: var(--radius-pill); background: var(--field); }
.segmented label { margin: 0; font-weight: 600; }
.segmented input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.segmented span { display: inline-flex; align-items: center; min-height: calc(var(--control-h) - 8px); padding: 4px 14px; border-radius: var(--radius-pill); color: var(--muted); cursor: pointer; }
@media (hover: hover) { .segmented span:hover { color: var(--ink); background: var(--raise); } }
.segmented input:checked + span { background: var(--ink); color: var(--ink-invert); }
.segmented input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: 2px; }
.segmented input:disabled + span { opacity: .5; cursor: not-allowed; }

/* ==== TOASTS (toast.js): a short note at the bottom of the screen that leaves on its own ==== */
.toast-region { position: fixed; z-index: 1300; left: 50%; bottom: 24px; transform: translateX(-50%); display: grid; gap: 8px; width: min(440px, calc(100vw - 32px)); pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 12px; padding: 12px 14px 12px 18px; border-radius: 14px; background: var(--ink); color: var(--ink-invert);
  font-size: calc(14px * var(--text-scale)); font-weight: 500; box-shadow: var(--shadow-lift); animation: rise-in var(--dur-enter) var(--ease); }
.toast span { flex: 1; }
.toast.error { background: var(--accent); color: var(--accent-ink); }
.toast button { --btn-ink: currentColor; min-height: 32px; padding: 4px 10px; border-color: transparent; }
@media (hover: hover) { .toast button:hover { background: rgba(128, 128, 128, .2); border-color: transparent; } }
.toast.leaving { animation: fade-out var(--dur-quick) var(--ease-exit) forwards; }

/* ==== UPDATING: beside a page's heading while it shows the last-known list and fetches a fresh one (TKT-0007).
   <span id="updating-note" class="updating-note" role="status">Updating…</span>, added to .page-head by the page. */
.updating-note { display: inline-flex; align-items: center; gap: 8px; align-self: center; font-size: calc(13px * var(--text-scale)); color: var(--muted); }
.updating-note::before { content: ""; flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); animation: pulse 1.4s ease-in-out infinite; }

/* ==== LOADING SKELETONS: grey bars where words are on their way (aria-busy on the list around them) ==== */
.skeleton { display: block; height: .9em; margin: .3em 0; border-radius: 6px; background: var(--line); animation: pulse 1.4s ease-in-out infinite; }
.skeleton.short { width: 40%; }
.skeleton.mid { width: 70%; }
/* Skeleton rows sit in a list in the page's HTML until its real rows arrive. Lists that add rows rather than
   replace them hide the skeletons as soon as one real row is there. */
.skeleton-row td { border-bottom-color: transparent; }
tbody:has(> tr:not(.skeleton-row)) > .skeleton-row, .stats:has(> :not(.skeleton-block)) > .skeleton-block { display: none; }
.stat.skeleton-block { min-height: 88px; }
.stat.skeleton-block .skeleton:first-child { height: 26px; width: 55%; margin-bottom: 10px; }

/* ==== BUSY, TRYING AGAIN: .busy-note (role="status") holds a .spinner, the words, and a Try now button (api.js).
   .spinner also works alone; under reduced motion it turns slowly. */
.spinner { display: inline-block; flex: none; width: 16px; height: 16px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite; }
@media (prefers-reduced-motion: reduce) { .spinner { animation: spin 1.6s linear infinite !important; } }
.busy-note { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 16px; margin: 12px 0; border: 1px dashed var(--control-line); border-radius: var(--radius-control); background: var(--raise); color: var(--ink); font-size: calc(14px * var(--text-scale)); }
.busy-note > span:not(.spinner) { flex: 1 1 200px; }
.busy-note.failed { border-style: solid; border-color: var(--accent); background: var(--accent-soft); }
.busy-note.failed .spinner { display: none; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes rise-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes fade-out { to { opacity: 0; transform: translateY(4px); } }
@keyframes pulse { 50% { opacity: .45; } }
@keyframes slide-in { from { transform: translateX(24px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---- sign-in ---- */
.signin-brand { text-align: center; margin-bottom: 24px; }
.signin-brand h1 { font-size: calc(32px * var(--text-scale)); }
/* the mark sits in a soft red halo: decoration only, behind no words */
.signin-brand .brand-mark { width: 56px; height: 56px; border-radius: 16px; margin: 0 auto 16px; box-shadow: 0 0 0 6px var(--accent-soft), 0 14px 40px var(--accent-glow); }
.signin-brand .brand-mark svg { width: 28px; height: 28px; }
.signin-brand p { color: var(--muted); margin: 6px 0 0; }
.signin .card { padding: 24px; }
.signin .actions .primary { flex: 1 1 100%; min-height: var(--control-h-large); font-size: calc(15px * var(--text-scale)); }
.signin .actions .link { margin: 0 auto; }
.foot { text-align: center; font-size: calc(12px * var(--text-scale)); color: var(--muted); margin-top: 24px; }

/* ---- home: the big buttons ---- */
.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 760px) { .tiles { grid-template-columns: 1fr; } }
.tile { position: relative; display: flex; gap: 18px; align-items: flex-start; padding: 24px; min-height: 160px; text-decoration: none; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); transition: transform var(--dur-press) var(--ease); }
@media (hover: hover) { .tile:hover { transform: translateY(-2px); border-color: var(--control-line); box-shadow: var(--shadow-lift); } }
.tile:active { transform: scale(.99); }
.tile .icon { flex: none; width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center; }
.tile .icon svg { width: 26px; height: 26px; }
/* the icon turns red under the pointer or the keyboard */
.tile:focus-visible .icon { background: var(--accent); color: var(--accent-ink); }
@media (hover: hover) { .tile:hover .icon { background: var(--accent); color: var(--accent-ink); } }
.tile h2 { font-size: calc(21px * var(--text-scale)); margin-top: 2px; }
.tile .kicker { font-size: calc(12px * var(--text-scale)); font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: 4px; }
.tile p { margin: 8px 0 0; color: var(--muted); }
.tile .badge { position: absolute; top: 16px; right: 16px; }
/* icon colors from before the red, black and white look all draw the same now */
.icon.red, .icon.blue, .icon.green, .icon.amber, .icon.slate { background: var(--raise); color: var(--ink); }

/* ==== BADGES AND CHIPS ====
   Four looks carry every status, so meaning never rests on hue alone (the words say it too):
     strong   filled with the text color: done, won, active, approved
     waiting  blue-tinted: sent, new, in someone else's hands
     pending  dashed outline: draft, on hold, later
     closed   grey: lost, complete, void, sample
   Red has one meaning in a status (TKT-0806, Jonathan 2026-11-23): something is wrong, such as past due. It is
   drawn as red words on a red tint, never as a filled red pill, which is how the page's one main button looks. */
.badge { display: inline-block; font-size: calc(11px * var(--text-scale)); font-weight: 700; letter-spacing: .06em; text-transform: uppercase; line-height: 1.3; padding: 3px 9px; border-radius: var(--radius-pill);
  background: transparent; border: 1px solid var(--control-line); color: var(--ink); vertical-align: middle; }
.badge.won, .badge.active, .badge.rfi-answered, .badge.co-approved, .badge.status-fixed, .badge.status-greenlit { background: var(--ink); border-color: var(--ink); color: var(--ink-invert); }
.badge.sent, .badge.rfi-sent, .badge.co-sent, .badge.status-new { background: var(--tag-blue-soft); border-color: transparent; color: var(--tag-blue); }
.badge.draft, .badge.on_hold, .badge.later, .badge.rfi-draft, .badge.co-draft, .badge.status-investigating, .badge.status-later { border-style: dashed; color: var(--ink); }
.badge.sample, .badge.lost, .badge.complete, .badge.rfi-closed, .badge.co-rejected, .badge.co-void, .badge.status-revoked, .badge.status-not_a_bug { background: var(--raise); border-color: transparent; color: var(--muted); }
/* Roles (People page, profile menu): admin is the account permission, so it alone is red. */
.badge.role-admin { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.badge.role-executive { background: var(--ink); border-color: var(--ink); color: var(--ink-invert); }
.badge.role-pm { background: var(--accent-soft); border-color: transparent; color: var(--accent-text); }
.badge.role-member, .badge.role-field { border-color: var(--control-line); color: var(--ink); }
.badge.role-field { border-style: dashed; }
.badge.role-student { background: var(--raise); border-color: transparent; color: var(--muted); }
.toggles { display: flex; gap: 8px; flex-wrap: wrap; }
.toggle { border-radius: var(--radius-pill); padding: 6px 14px; }
.toggle .dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
/* a toggle that is off: grey words, a faint edge, a faded dot */
.toggle[aria-pressed="false"] { --btn-ink: var(--muted); border-color: var(--line); font-weight: 500; }
.toggle[aria-pressed="false"] .dot { opacity: .35; }
.toggle[aria-pressed="true"] { border-color: var(--ink); background: var(--raise); }
/* Key clients (FTR-0024): a star beside a customer or a person; red when it is one of yours. */
button.star { --btn-ink: var(--muted); min-height: 32px; min-width: 32px; padding: 2px 6px; border: 0; background: none; box-shadow: none; font-size: calc(18px * var(--text-scale)); line-height: 1; vertical-align: -1px; }
button.star[aria-pressed="true"] { --btn-ink: var(--accent-text); }
@media (hover: hover) { button.star:hover { --btn-ink: var(--accent-text); background: none; } }
button.star:active { transform: none; }
.toggle .star-mark { color: var(--accent-text); }
.star-name { display: inline-flex; align-items: flex-start; gap: 2px; }
.drawer .close + div h2 { padding-right: 76px; }   /* a long name stays clear of Close */
/* Home: the bids this person starred (2026-11-06), above the buttons */
.card.watched { margin-bottom: 16px; }
.watched-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
td .sub.watch-overdue { color: var(--accent-text); font-weight: 600; }
td .sub.watch-soon { color: var(--ink); font-weight: 600; }
.toggle[aria-pressed="false"] .star-mark { opacity: .45; }

/* ---- stats ---- */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 16px; }
@media (max-width: 860px) { .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); }
.stat b { display: block; font-size: calc(24px * var(--text-scale)); letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat span { font-size: calc(13px * var(--text-scale)); color: var(--muted); }

/* ---- map ---- */
.map-card { padding: 0; overflow: hidden; position: relative; }
.map-tools { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 14px; border-bottom: 1px solid var(--line); }
#map { height: 520px; background: var(--map-bg); }
/* The map behind its button (crm.js): closed, the card is the row of choices and the client-list line. */
.map-closed #map, .map-closed .legend { display: none; }
.map-closed .client-source { border-bottom: 0; }
#map-toggle { margin-left: auto; }
@media (max-width: 760px) { #map { height: 380px; } }
.leaflet-popup-content { font-family: var(--ui); font-size: calc(13px * var(--text-scale)); line-height: 1.45; min-width: 220px; }
.leaflet-popup-content h3 { font-size: calc(14px * var(--text-scale)); margin: 0 0 4px; }
.leaflet-popup-content p { margin: 4px 0; }
.client-source { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 8px 14px; border-bottom: 1px solid var(--line); font-size: calc(13px * var(--text-scale)); color: var(--muted); background: var(--raise); }
.client-source span { flex: 1 1 260px; }
.leaflet-popup-content ul { margin: 4px 0; padding-left: 16px; }
.legend { display: flex; gap: 14px; font-size: calc(12px * var(--text-scale)); color: var(--muted); flex-wrap: wrap; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 5px; vertical-align: -1px; }

/* ---- list cards that fold, and the phone's swipe row (CRM, cards.js) ---- */
.list-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; margin-top: 16px; }
.list-cards > .card + .card { margin-top: 0; }
.list-cards > #gcs-card { grid-column: 1 / -1; }
.card-fold { --btn-ink: inherit; min-height: 0; border: 0; background: none; padding: 0; font: inherit; font-weight: 700; color: inherit; gap: 8px; white-space: normal; text-align: left; border-radius: 4px; }
@media (hover: hover) { .card-fold:hover { background: none; } }
.card-fold:active { transform: none; }
.card-fold .chevron { width: 8px; height: 8px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); margin: 0 4px 4px 2px; transition: transform var(--dur-quick) var(--ease); }
.card.collapsed .card-fold .chevron { transform: rotate(-45deg); margin-bottom: 0; }
.card.collapsed .card-body { display: none; }
.card-tools { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.card-tools input { max-width: 280px; }
.pager { display: none; }
/* .narrow-only shows only where a column was dropped for room (under 860 px, below). "td .sub.narrow-only" is here
   because "td .sub { display: block }" comes later with the same weight and used to show it everywhere: the CRM's
   bid rows said Draft twice (TKT-0809). */
.narrow-only, td .narrow-only, td .sub.narrow-only { display: none; }
@media (max-width: 860px) {
  .list-cards { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; gap: 12px; margin: 8px -20px 0; padding: 0 20px 4px;
    scroll-padding: 0 20px; overscroll-behavior-x: contain; scrollbar-width: none; }
  .list-cards::-webkit-scrollbar { display: none; }
  .list-cards > .card { flex: 0 0 calc(100% - 24px); min-width: 0; scroll-snap-align: start; }
  .list-cards > .card { padding: 14px; }
  .list-cards th, .list-cards td { padding: 8px 5px; font-size: calc(13px * var(--text-scale)); overflow-wrap: break-word; }
  .list-cards th { font-size: calc(11px * var(--text-scale)); letter-spacing: 0; }
  .pager { display: flex; gap: 6px; margin-top: 16px; }
  .pager-dot { padding: 5px 12px; font-size: calc(13px * var(--text-scale)); }
  .pager-dot[aria-current="true"] { --btn-ink: var(--ink-invert); background: var(--ink); border-color: var(--ink); }
  .wide-only { display: none; }
  .narrow-only, td .narrow-only, td .sub.narrow-only { display: block; margin-top: 4px; }
  .card-tools input { max-width: none; }
}

/* A tablet held on its side (TKT-0808): two list cards side by side are too narrow for their tables, so they stack. */
@media (min-width: 861px) and (max-width: 1100px) { .list-cards { grid-template-columns: minmax(0, 1fr); } }

/* ==== TABLES ==== */
.table-wrap { overflow-x: auto; }
/* Equal-width digits (TKT-0807): money, counts, dates and ids line up down a column and do not jitter as they change. */
table { width: 100%; border-collapse: collapse; font-size: calc(14px * var(--text-scale)); font-variant-numeric: tabular-nums; }
th { text-align: left; font-size: calc(11.5px * var(--text-scale)); text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; padding: 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 11px 10px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
tr.clickable { cursor: pointer; }
tr.clickable:focus-within td { background: var(--raise); }
@media (hover: hover) { tr.clickable:hover td { background: var(--raise); } }
td.money, th.money { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
td .sub { display: block; font-size: calc(12px * var(--text-scale)); color: var(--muted); }
td select { width: auto; min-height: var(--control-h-small); padding: 4px 30px 4px 10px; font-size: calc(13px * var(--text-scale)); }
td a { font-weight: 600; }
.empty { padding: 24px; text-align: center; color: var(--muted); }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.filters input { max-width: 280px; }

/* A wide table on a tablet held upright (TKT-0808): .table-wrap.stacks lays each row out as a card from 860 px down,
   four fields across, the way phone.css does for every table under 640 px. shell.js labels each cell with its
   column's heading. Without it the Bids and Projects tables ran off the side and their row buttons were out of sight. */
@media (min-width: 641px) and (max-width: 860px) {
  .table-wrap.stacks { overflow: visible; }
  .table-wrap.stacks table, .table-wrap.stacks tbody, .table-wrap.stacks td { display: block; width: 100%; }
  .table-wrap.stacks thead { display: none; }
  .table-wrap.stacks tr { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px 16px; padding: 12px 0; border-bottom: 1px solid var(--line); }
  .table-wrap.stacks td:first-child, .table-wrap.stacks td:last-child, .table-wrap.stacks tr > td:only-child { grid-column: 1 / -1; }
  .table-wrap.stacks td { border: 0; padding: 4px 0; text-align: left; white-space: normal; }
  .table-wrap.stacks td:empty { display: none; }
  .table-wrap.stacks td[data-label]:not([data-label=""]):not(:first-child)::before { content: attr(data-label); display: block; margin-bottom: 1px;
    font-size: calc(11px * var(--text-scale)); font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
}

/* ---- a row's buttons, and More: its lesser actions under one button (more-menu.js, TKT-0808) ---- */
td.row-buttons { white-space: nowrap; }
.more-menu { display: inline-block; }
.more-menu summary { list-style: none; }
.more-menu summary::-webkit-details-marker { display: none; }
.more-menu summary::after { content: ""; width: 6px; height: 6px; margin: -3px 0 0 2px; border: solid currentColor; border-width: 0 2px 2px 0; transform: rotate(45deg); }
.more-menu-list { position: fixed; z-index: 1000; display: flex; flex-direction: column; gap: 2px; min-width: 190px; padding: 6px; background: var(--surface);
  border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-lift); animation: rise-in var(--dur-quick) var(--ease); white-space: nowrap; }
.more-menu-list button, .more-menu-list .button { justify-content: flex-start; width: 100%; border-color: transparent; border-radius: 8px; }

/* ---- list row tags (FTR-0019): red-tinted past due, amber due soon, green yours, blue someone else's, violet follow up
     (dashed: still ahead), grey last followed up ---- */
.tags { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; margin-top: 6px; }
.tag { display: inline-flex; align-items: center; min-height: 22px; padding: 1px 9px; border: 1px solid transparent; border-radius: var(--radius-pill);
  font-size: calc(12px * var(--text-scale)); font-weight: 600; line-height: 1.3; white-space: nowrap; font-variant-numeric: tabular-nums; }
.tag.red { background: var(--accent-soft); color: var(--accent-text); border-color: color-mix(in srgb, var(--accent-text) 45%, transparent); }
.tag.amber { background: var(--tag-amber-soft); color: var(--tag-amber); }
.tag.green { background: var(--tag-green-soft); color: var(--tag-green); }
.tag.blue { background: var(--tag-blue-soft); color: var(--tag-blue); }
.tag.violet { background: var(--tag-violet-soft); color: var(--tag-violet); }
.tag.violet.later { background: transparent; border-color: var(--tag-violet); border-style: dashed; }
.tag.grey { background: var(--raise); color: var(--muted); border-color: var(--line); }
button.tag-edit { min-height: 24px; padding: 1px 6px; font-size: calc(12px * var(--text-scale)); color: var(--muted); }
td .due-overdue, td .due-soon { display: inline-block; padding: 0 8px; border-radius: var(--radius-pill); font-weight: 700; white-space: nowrap; }
td .due-overdue { background: var(--accent-soft); color: var(--accent-text); }
td .due-soon { background: var(--tag-amber-soft); color: var(--tag-amber); }
.toggles .toggle .count { color: var(--muted); font-weight: 500; }
.filters label.assigned-filter { display: flex; align-items: center; gap: 8px; margin: 0; }
.filters label.assigned-filter span { white-space: nowrap; }
.filters label.assigned-filter select { flex: 1 1 auto; width: auto; min-width: 0; max-width: 220px; min-height: var(--control-h-small); }
/* a bid's tag editor row */
tr.organize-row td { background: var(--raise); }
.organize { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 14px; }
.organize label { display: flex; flex-direction: column; gap: 4px; margin: 0; }
.organize label select, .organize label input { width: auto; min-width: 200px; }
.organize .quick { display: flex; flex-wrap: wrap; gap: 6px; }

/* ---- dialog: Follow Up email ---- */
dialog.panel { width: min(640px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); padding: 20px; overflow: auto;
  background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-lift); }
dialog.panel::backdrop { background: var(--overlay); }
dialog.panel [hidden] { display: none !important; }   /* flex would show it anyway */
dialog.panel h2 { margin: 0 32px 2px 0; }
dialog.panel .sub { margin: 0 0 4px; color: var(--muted); font-size: calc(13px * var(--text-scale)); }
dialog.panel .close { position: absolute; top: 12px; right: 12px; }
dialog.panel .pickers { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 0 12px; }
dialog.panel textarea { min-height: 240px; resize: vertical; }
dialog.panel .notes { margin: 10px 0 0; padding-left: 20px; color: var(--muted); font-size: calc(13px * var(--text-scale)); }
dialog.panel .actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 14px; }
/* phone: the table scrolls sideways; the controls stay in view */
@media (max-width: 640px) { dialog.panel { padding: 16px; } .organize { position: sticky; left: 0; width: calc(100vw - 104px); }
  .organize label select, .organize label input { min-width: 0; width: 100%; } .organize label { flex: 1 1 100%; } }

/* ---- notices: a bar down the left side, red for a warning ---- */
.notice { display: flex; gap: 14px; align-items: flex-start; background: var(--raise); color: var(--ink); border-left: 3px solid var(--ink); border-radius: 0 var(--radius) var(--radius) 0; padding: 14px 18px; margin-bottom: 16px; }
.notice b { display: block; margin-bottom: 2px; }
.notice.warn { background: var(--accent-soft); border-left-color: var(--accent); }
.notice.warn b { color: var(--accent-text); }
/* A new invite code with its link and Copy (FTR-0018): the link box takes the room, Copy sits beside it. */
.invite-made { margin: 12px 0 0; }
.invite-made > div { flex: 1; min-width: 0; }
.invite-made .hint { margin: 4px 0 8px; }
.copy-row { display: flex; gap: 8px; align-items: center; }
.copy-row input { flex: 1; min-width: 0; }

/* ---- record detail ---- */
dl.record { display: grid; grid-template-columns: max-content 1fr; gap: 8px 18px; margin: 0; font-size: calc(14px * var(--text-scale)); }
dl.record dt { color: var(--muted); font-weight: 600; }
dl.record dd { margin: 0; }
.drawer { position: fixed; top: 56px; right: 0; bottom: 0; width: min(460px, 100vw); background: var(--surface); border-left: 1px solid var(--line);
  box-shadow: var(--shadow-panel); padding: 22px; overflow: auto; z-index: 900; animation: slide-in var(--dur-enter) var(--ease); }
.drawer .close { position: absolute; top: 14px; right: 14px; }

/* ---- feedback (admins) ---- */
.feedback-item .feedback-head { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.feedback-details { white-space: pre-wrap; margin: 8px 0; }
.feedback-decide { display: grid; grid-template-columns: 180px minmax(0, 1fr) auto; gap: 8px; align-items: start; margin-top: 10px; }
@media (max-width: 760px) { .feedback-decide { grid-template-columns: 1fr; } }
@media print { .topbar, .env-banner, .no-print { display: none !important; } body { background: #fff; color: #000; } .card { box-shadow: none; border: 0; } }

/* ---- footer and license page ---- */
.site-foot { max-width: 1240px; margin: 0 auto; padding: 8px 20px 28px; font-size: calc(12px * var(--text-scale)); color: var(--muted); text-align: center; }
.site-foot a { color: var(--muted); }
.legal-text { white-space: pre-wrap; font: calc(12.5px * var(--text-scale))/1.5 var(--mono); max-height: 70vh; overflow: auto; background: var(--raise); border: 1px solid var(--line); border-radius: var(--radius-control); padding: 14px; margin: 10px 0 0; }
@media print { .site-foot { display: none; } }

/* ---- one customer's panel on the CRM page: contacts, edits, moves (2026-10-22) ---- */
.contact { border: 1px solid var(--line); border-radius: var(--radius-control); padding: 10px 12px; margin: 8px 0; background: var(--raise); }
.contact .hint { margin-top: 2px; }
.contact .row-actions { margin-top: 6px; }
.contact-form label { margin-top: 6px; }
.contact-form .grid-2 { gap: 8px; }

/* ---- the project page (the Projects module, 2026-10-22) ---- */
.crumbs { margin: 0 0 8px; font-size: calc(14px * var(--text-scale)); }
.head-actions { display: flex; align-items: center; gap: 10px; }
.save-state { font-size: calc(13px * var(--text-scale)); color: var(--muted); }
.save-state:empty { display: none; }
.head-actions { flex-wrap: wrap; }
.project-bids { margin: 4px 0 0; font-size: calc(14px * var(--text-scale)); }
.project-bids .from-bid { display: inline-block; margin-right: 14px; }
#stats { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }   /* as many tiles as fit; the project page has six */
.stat b { overflow-wrap: anywhere; }
td .badge { margin-left: 4px; }
/* ==== TABS: words in a row, the chosen one in the text color with a red bar under it ==== */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: 4px 0 16px; overflow-x: auto; scrollbar-width: none; }
.tabs button { --btn-ink: var(--muted); min-height: 44px; border: 0; border-bottom: 3px solid transparent; border-radius: 0; background: none; padding: 10px 14px; font-weight: 600; white-space: nowrap; box-shadow: none; }
@media (hover: hover) { .tabs button:hover { --btn-ink: var(--ink); background: none; border-bottom-color: var(--control-line); } }
.tabs button:active { transform: none; }
.tabs button:focus-visible { outline-offset: -2px; border-radius: 6px 6px 0 0; }
.tabs button[aria-selected="true"] { --btn-ink: var(--ink); border-bottom-color: var(--accent); }
#panel > * + * { margin-top: 16px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
tr.selected td { background: var(--raise); }
tr.selected td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
.grid-2.tight, .grid-3.tight { gap: 10px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.field { font-weight: 400; margin: 10px 0 0; }
.field-label { display: block; font-size: calc(13px * var(--text-scale)); font-weight: 600; margin-bottom: 4px; }
label.check { display: inline-flex; align-items: center; gap: 8px; font-weight: 400; margin: 6px 16px 0 0; }
.checks { display: flex; flex-wrap: wrap; margin-top: 8px; }
.stack > * + * { margin-top: 6px; }
.section-title { margin: 22px 0 4px; padding-top: 14px; border-top: 1px solid var(--line); }
fieldset.answer { border: 1px solid var(--line); border-radius: var(--radius-control); margin: 14px 0 0; padding: 4px 12px 12px; }
fieldset.answer legend { font-size: calc(13px * var(--text-scale)); font-weight: 700; padding: 0 4px; }
.editor { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.sticky-card { position: sticky; top: 72px; }
@media (max-width: 1000px) { .editor { grid-template-columns: minmax(0, 1fr); } .sticky-card { position: static; } #stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* Table footers, and a row opened under another: shared by more than the project page */
tfoot td { font-weight: 700; }
tr.details > td { background: var(--raise); }

/* won bids waiting to move to Projects */
#waiting ul.waiting-list { margin: 8px 0 0; padding-left: 18px; }
#waiting li { margin: 4px 0; }
.page-head > div:first-child { flex: 1 1 420px; min-width: 0; }
.editor > .card:last-child { position: sticky; top: 72px; }
@media (max-width: 1000px) { .editor > .card:last-child { position: static; } }
.archive-zone { margin-top: 28px; padding-top: 16px; border-top: 1px solid var(--line); }
.archive-zone .hint { margin: 6px 0 10px; }

/* ---- branches (2026-11-02) ---- */
/* The line under the top bar: which branch and division you are working in. */
.branch-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 18px; min-height: 40px; padding: 4px 20px; font-size: calc(13px * var(--text-scale)); color: var(--muted); background: var(--surface); border-bottom: 1px solid var(--line); }
.branch-bar label { display: inline-flex; align-items: center; gap: 6px; margin: 0; font-weight: 400; }
.branch-bar select { width: auto; min-height: 30px; padding: 3px 30px 3px 10px; font-size: calc(13px * var(--text-scale)); }
.branch-bar b { color: var(--ink); }
.branch-bar-link { margin-left: auto; color: var(--muted); }
.branch-details:not(:empty) { margin-top: 14px; padding-top: 4px; border-top: 1px solid var(--line); }
.branch-details h3 { margin: 16px 0 8px; }
.branch-details h4 { margin: 14px 0 4px; font-size: calc(13px * var(--text-scale)); }
.branch-map { height: 220px; border-radius: var(--radius-control); border: 1px solid var(--line); margin-top: 8px; background: var(--map-bg); }
.branch-map-row { margin-top: 8px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 8px; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 4px 2px 12px; border-radius: var(--radius-pill); background: var(--raise); border: 1px solid var(--line); color: var(--ink); font-size: calc(13px * var(--text-scale)); }
.chip-x { --btn-ink: inherit; min-height: 24px; min-width: 24px; border: 0; background: none; padding: 0 6px; font-size: calc(15px * var(--text-scale)); line-height: 1; cursor: pointer; }
.county-add { display: flex; gap: 8px; align-items: center; margin-top: 8px; }
.county-add input { flex: 1 1 auto; min-width: 0; }
.plain-list { list-style: none; margin: 6px 0; padding: 0; }
.plain-list li { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 4px 0; }

/* Settings */
.settings { max-width: 640px; }
.setting fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
.setting + .setting { margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--line); }
.setting legend { padding: 0; margin-bottom: 6px; font-weight: 700; font-size: calc(15px * var(--text-scale)); }
label.choice { display: inline-flex; align-items: center; gap: 8px; min-height: 32px; margin: 6px 18px 6px 0; font-weight: 400; font-size: calc(15px * var(--text-scale)); cursor: pointer; }
label.choice input { margin: 0; }

/* What the site borrows: the map (Leaflet) and the Feedback dialog (feedback-widget.js, which brings its own
   light styles; :root makes these win in both looks). In the dark look the map's streets are drawn turned
   to dark; the bid and project dots keep their colors. */
:root:not([data-theme="light"]) .leaflet-tile-pane { filter: invert(1) hue-rotate(180deg) grayscale(.6) brightness(.85) contrast(.9); }
:root .leaflet-popup-content-wrapper, :root .leaflet-popup-tip { background: var(--surface); color: var(--ink); border-radius: 12px; }
:root .leaflet-bar a { background: var(--surface); color: var(--ink); border-bottom-color: var(--line); }
:root .leaflet-control-attribution { background: color-mix(in srgb, var(--surface) 85%, transparent); color: var(--muted); }
:root .leaflet-container a { color: var(--ink); }
:root .leaflet-container a.leaflet-popup-close-button { color: var(--muted); }
:root .sfb-dialog { background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 16px; }
:root .sfb-dialog::backdrop { background: var(--overlay); }
:root .sfb-dialog h2 { color: var(--ink); }
:root .sfb-dialog .sfb-where { background: var(--raise); color: var(--muted); }
:root .sfb-dialog label { color: var(--muted); }
:root .sfb-dialog input, :root .sfb-dialog textarea { background: var(--field); color: var(--ink); border-color: var(--control-line); border-radius: var(--radius-control); }
:root .sfb-dialog button:not(.sfb-send) { background: transparent; color: var(--ink); border-color: var(--control-line); border-radius: var(--radius-pill); }
:root .sfb-dialog button.sfb-send { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); border-radius: var(--radius-pill); }
:root .sfb-dialog .sfb-msg.bad { color: var(--accent-text); }
:root .sfb-dialog .sfb-msg.good { color: var(--ink); }

/* My profile */
.profile-form { display: grid; gap: 14px; max-width: 480px; }
.profile-form label { display: grid; gap: 4px; font-weight: 600; font-size: calc(13px * var(--text-scale)); }

/* Projects list: the pending report's boxes and button */
.pick-cell { width: 36px; text-align: center; }
.pick-cell input { width: 18px; height: 18px; margin: 0; cursor: pointer; }
.report-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 0 0 12px; }
.report-bar .muted { flex: 1 1 260px; }

/* ==== FINGERS (TKT-0802): what changes when the screen is touched, not clicked ==== */
@media (pointer: coarse) {
  /* An iPhone zooms the page on a field whose words are under 16 px, and does not zoom back out. */
  input, select, textarea, td select, .branch-bar select { font-size: max(16px, calc(15px * var(--text-scale))); }
  /* 44 px to press (TKT-0804). What is drawn as a full control grows to 44: */
  .topbar .avatar { width: 44px; height: 44px; }
  .phone-menu summary, .profile-menu [role="menuitem"], label.choice, .branch-bar select, .toast button { min-height: 44px; }
  input[type="checkbox"], input[type="radio"], .pick-cell input { width: 24px; height: 24px; }
  /* What is drawn small on purpose (a star, a tag's pencil, a link in a row) keeps its size and gets an unseen
     44 px area laid over its middle. A busy button is left out: its ::after is the spinner. */
  button.star:not([aria-busy="true"])::after, button.tag-edit:not([aria-busy="true"])::after, .chip-x:not([aria-busy="true"])::after,
  button.link:not([aria-busy="true"])::after, .button.link:not([aria-busy="true"])::after, .card-fold:not([aria-busy="true"])::after,
  button.row-button:not([aria-busy="true"])::after {
    content: ""; position: absolute; left: 50%; top: 50%; width: max(100%, 44px); height: max(100%, 44px); transform: translate(-50%, -50%); }
}

/* ==== THE NOTCH AND THE HOME BAR (TKT-0802) ====
   Every page asks for the whole screen (viewport-fit=cover in its head), and what touches an edge stays clear of
   a phone's notch, rounded corners and home bar. On a screen with none of those these are the same paddings as above. */
.topbar, .branch-bar, .wrap, .site-foot { padding-left: max(var(--edge), env(safe-area-inset-left, 0px)); padding-right: max(var(--edge), env(safe-area-inset-right, 0px)); }
.toast-region { bottom: calc(24px + env(safe-area-inset-bottom, 0px)); }
.drawer { padding-bottom: calc(22px + env(safe-area-inset-bottom, 0px)); }

/* ==== ANIMATION ON POINTER SCREENS (last, so it wins over the rules above) ====
   On phones only transform and opacity ever animate, which a mid-range phone draws cheaply. With a mouse
   or trackpad, hover colors also ease in. */
@media (hover: hover) and (pointer: fine) {
  button, .button, .topbar nav a, input, select, textarea, .segmented span, .tile, .tile .icon, tr.clickable td {
    transition: background-color var(--dur-quick) var(--ease), border-color var(--dur-quick) var(--ease), color var(--dur-quick) var(--ease),
      box-shadow var(--dur-quick) var(--ease), transform var(--dur-press) var(--ease);
  }
}
