/* ============================================================
   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).
   ============================================================ */

/* ==== 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 */
  --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;
}

/* 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;
  --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; }
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; }
: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:hover, .topbar .avatar[aria-expanded="true"] { 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"]:hover, .profile-menu [role="menuitem"]:focus-visible { 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 { 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 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); }
.env-banner { display: none; background: var(--accent-soft); color: var(--accent-text); 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; }
.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); }
.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): role pickers, view switches ====
   <div class="segmented" role="radiogroup" aria-label="Role">
     <label><input type="radio" name="role" value="pm"><span>PM</span></label> ... </div> */
.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: when the site is busy and a request waits to be sent again ====
   <div class="busy-note" role="status"><span class="spinner" aria-hidden="true"></span>
     <span>Busy right now. Trying again in 5 seconds.</span><button type="button" class="small">Try now</button></div>
   Also .spinner on its own, anywhere a wait needs showing. It keeps turning (slowly) under reduced motion. */
.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:hover .icon, .tile:focus-visible .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
     attention  red-tinted: sent, new, waiting on someone
     pending  dashed outline: draft, on hold, later
     closed   grey: lost, complete, void, sample */
.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(--accent-soft); border-color: transparent; color: var(--accent-text); }
.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); }

/* ---- 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); }
@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, td .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 { display: block; margin-top: 4px; }
  .card-tools input { max-width: none; }
}

/* ==== TABLES ==== */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: calc(14px * var(--text-scale)); }
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:hover td, tr.clickable:focus-within 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; }

/* ---- 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); }

/* ---- 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)); } }

/* Lists from the roles work (#101): a foreman's checklist, RFIs and change orders (ul.field-list, on a
   field-mode page, so rows are big for gloves), and a project's crew (ul.crew-list). */
ul.field-list, ul.crew-list { list-style: none; margin: 0; padding: 0; }
ul.field-list > li, ul.crew-list > li { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; padding: 12px 0; border-bottom: 1px solid var(--line-soft); }
.field-mode ul.field-list > li { min-height: var(--control-h); padding: 14px 0; }
/* An executive's project page reads, it doesn't edit: fields that can't change look like text. */
body.read-only input:disabled, body.read-only select:disabled, body.read-only textarea:disabled { background: transparent; border-color: var(--line); color: var(--ink); cursor: default; }

/* the checklist */
.progress { height: 6px; background: var(--raise); border-radius: var(--radius-pill); overflow: hidden; margin-bottom: 14px; }
.progress span { display: block; height: 100%; background: var(--ink); border-radius: var(--radius-pill); }
ul.checklist { list-style: none; margin: 0; padding: 0; }
ul.checklist li { display: grid; grid-template-columns: auto minmax(0, 1fr) 150px auto; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line-soft); }
ul.checklist li input[type="checkbox"] { width: 20px; height: 20px; }
ul.checklist .checklist-text input { border-color: transparent; background: transparent; padding: 6px 8px; }
ul.checklist .checklist-text input:hover, ul.checklist .checklist-text input:focus { border-color: var(--control-line); }
ul.checklist li.done .checklist-text input { color: var(--muted); text-decoration: line-through; }
ul.checklist .checklist-text .hint { display: block; padding-left: 9px; margin: 0; }
ul.checklist .due { display: flex; align-items: center; gap: 6px; margin: 0; font-weight: 400; color: var(--muted); }
ul.checklist .due input { min-height: var(--control-h-small); padding: 4px 8px; }
.row-tools { display: flex; gap: 2px; }
.checklist-add { display: flex; gap: 8px; margin-top: 14px; }
@media (max-width: 640px) { ul.checklist li { grid-template-columns: auto minmax(0, 1fr); } ul.checklist .due, ul.checklist .row-tools { grid-column: 2; } }

/* the drafting area: the document drawn on the project letterhead. The sheet is paper, so it keeps
   its light colors in the dark look too. */
.drafting-tools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.drafting-tools .hint { margin: 0; }
.sheet { position: relative; width: 100%; aspect-ratio: 612 / 792; background: #fff center top / 100% 100% no-repeat; border: 1px solid var(--line); box-shadow: 0 2px 10px rgba(0, 0, 0, .12); overflow: hidden; container-type: inline-size; }
.sheet.no-letterhead { background-image: repeating-linear-gradient(0deg, transparent, transparent 23px, #f6f7f9 24px); }
.sheet-body { position: absolute; overflow: hidden; color: #1c1f26; font-size: 1.62cqw; line-height: 1.35; font-family: Helvetica, Arial, sans-serif; }
.sheet-title { color: #b1261f; font-weight: 700; font-size: 2.45cqw; margin-bottom: 1.4cqw; }
.sheet-fields div { display: grid; grid-template-columns: 19.6cqw 1fr; margin-bottom: .5cqw; }
.sheet-fields b { color: #616673; font-size: 1.47cqw; }
.sheet-fields { margin-bottom: 1.2cqw; }
.sheet-heading { color: #b1261f; font-weight: 700; text-transform: uppercase; border-bottom: 1px solid #d9dbe0; margin: 1.6cqw 0 .8cqw; padding-bottom: .3cqw; }
.sheet-paragraph { white-space: pre-wrap; margin-bottom: 1cqw; }
.sheet-price { display: flex; justify-content: space-between; background: #f5f5f7; border: 1px solid #d9dbe0; padding: 1.2cqw 1.6cqw; margin: 1.6cqw 0; font-weight: 700; }
.sheet-signature div { border-bottom: 1px solid #616673; padding-top: 2.6cqw; color: #616673; font-weight: 700; font-size: 1.47cqw; }

/* change order cost lines and totals */
.cost-group { margin-top: 14px; }
table.line-table { width: 100%; border-collapse: collapse; font-size: calc(14px * var(--text-scale)); }
table.line-table th, table.line-table td { padding: 4px 6px; border-bottom: 1px solid var(--line); text-align: left; }
table.line-table th.num, table.line-table td.num { width: 110px; }
table.line-table td.money, table.line-table th.money { text-align: right; white-space: nowrap; width: 110px; }
table.line-table input { min-height: var(--control-h-small); padding: 4px 8px; }
table.line-table tfoot td { border-bottom: 0; font-weight: 700; }
table.line-table tr.section-row td { background: var(--raise); font-weight: 700; }
dl.totals { display: grid; grid-template-columns: 1fr auto; gap: 4px 16px; margin: 18px 0 0; padding: 12px 14px; background: var(--raise); border: 1px solid var(--line); border-radius: var(--radius-control); font-size: calc(14px * var(--text-scale)); }
dl.totals dt, dl.totals dd { margin: 0; }
dl.totals dd { text-align: right; font-variant-numeric: tabular-nums; }
dl.totals .strong { font-weight: 700; border-top: 1px solid var(--line); padding-top: 4px; }
dl.totals .sell { font-weight: 800; font-size: calc(16px * var(--text-scale)); color: var(--accent-text); border-top: 2px solid var(--ink); padding-top: 6px; }
tfoot td { font-weight: 700; }

/* the Submittal Builder inside the project page */
.tool-card { padding: 0; overflow: hidden; }
.tool-frame { display: block; width: 100%; height: 88vh; min-height: 640px; border: 0; }
#submittals-frame { margin-top: 16px; }   /* kept after the tab panel, once per project page (TKT-0016) */
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; }

/* ---- the Feature Roadmap ---- */
.roadmap-intro { padding: 16px 0 12px; max-width: 900px; }
.roadmap-intro h1 { font-size: calc(36px * var(--text-scale)); }
.roadmap-lede { font-size: calc(20px * var(--text-scale)); line-height: 1.4; margin: 10px 0 20px; color: var(--muted); }
.roadmap-stages { display: flex; flex-wrap: wrap; gap: 6px 0; list-style: none; margin: 0 0 16px; padding: 0; }
.roadmap-stages li { display: flex; align-items: center; font-weight: 600; font-size: calc(14px * var(--text-scale)); }
.roadmap-stages li + li::before { content: ""; width: 22px; height: 2px; margin: 0 8px; background: var(--accent); }
.roadmap-group { margin-top: 32px; padding-top: 20px; border-top: 2px solid var(--ink); }
.roadmap-group-head { margin-bottom: 16px; }
.roadmap-group-head h2 { font-size: calc(24px * var(--text-scale)); }
.roadmap-group-head p { margin: 4px 0 0; color: var(--muted); }
.roadmap-items { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
@media (max-width: 760px) { .roadmap-items { grid-template-columns: minmax(0, 1fr); } }
.roadmap-item + .roadmap-item { margin-top: 0; }
.roadmap-item h3 { font-size: calc(17px * var(--text-scale)); }
.roadmap-item .feedback-head { margin-bottom: 8px; }
.roadmap-item p { margin: 6px 0 0; }
.roadmap-item ul { margin: 10px 0 0; padding-left: 18px; }
.roadmap-item li { margin: 3px 0; }
/* a featured item runs the full width above the group's other items */
.roadmap-item.featured { grid-column: 1 / -1; order: -1; }
.roadmap-item.featured h3 { font-size: calc(22px * var(--text-scale)); }
.roadmap-story { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.roadmap-story > p { margin: 0; max-width: 78ch; }
.roadmap-story-columns { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 16px 32px; margin-top: 16px; }
@media (max-width: 760px) { .roadmap-story-columns { grid-template-columns: minmax(0, 1fr); } }
.roadmap-story h4 { margin: 0 0 8px; font-size: calc(12px * var(--text-scale)); font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.roadmap-story ul { margin: 0; }
.roadmap-foundations { display: grid; grid-template-columns: minmax(0, 13em) minmax(0, 1fr); gap: 8px 16px; margin: 0; }
.roadmap-foundations dt { font-weight: 600; }
.roadmap-foundations dd { margin: 0; }
@media (max-width: 480px) { .roadmap-foundations { grid-template-columns: minmax(0, 1fr); gap: 2px; } .roadmap-foundations dd { margin-bottom: 8px; } }
.roadmap-thread { margin-top: 12px; padding-top: 6px; border-top: 1px solid var(--line); }
.comment { padding: 8px 0; border-bottom: 1px solid var(--line-soft); }
.comment .hint { margin: 0; }
.comment-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.comment-form { display: flex; gap: 8px; align-items: flex-start; margin-top: 10px; }
.comment-form textarea { flex: 1 1 auto; min-width: 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)); }

/* ---- the Consultant (/consultant, a demo) ---- */
.consult { max-width: 980px; }
.consult-bar { display: flex; align-items: center; gap: 12px 18px; flex-wrap: wrap; padding: 14px 18px; margin-bottom: 16px; }
.consult-project { display: flex; align-items: center; gap: 10px; margin: 0; font-weight: 600; font-size: calc(14px * var(--text-scale)); flex: 1 1 340px; }
.consult-project select { flex: 1; min-width: 0; }
.small-link { font-size: calc(14px * var(--text-scale)); }
.consult-usage { font-size: calc(13px * var(--text-scale)); color: var(--muted); margin-left: auto; }
.consult-chat { display: flex; flex-direction: column; gap: 12px; padding: 16px; }
.consult-log { display: flex; flex-direction: column; gap: 14px; min-height: 280px; max-height: calc(100vh - 380px); overflow-y: auto; padding: 4px 2px; }
.consult-log .empty { color: var(--muted); margin: auto; text-align: center; max-width: 420px; }
.turn { display: flex; flex-direction: column; gap: 6px; max-width: 100%; }
.turn.user { align-items: flex-end; }
.turn.user .bubble { background: var(--raise); color: var(--ink); border: 1px solid var(--line); border-radius: 16px 16px 4px 16px; padding: 10px 14px; max-width: min(640px, 90%); white-space: pre-wrap; overflow-wrap: anywhere; }
.consult-opened { font-size: calc(12px * var(--text-scale)); color: var(--muted); }
.turn.assistant { align-items: stretch; }
.activity { font-size: calc(12px * var(--text-scale)); color: var(--muted); padding-left: 10px; border-left: 2px solid var(--line); }
.activity.warn { color: var(--accent-text); border-left-color: var(--accent); }
.prose { overflow-wrap: anywhere; }
.prose > :first-child { margin-top: 0; }
.prose p, .prose ul, .prose ol { margin: 0 0 10px; }
.prose ul, .prose ol { padding-left: 22px; }
.prose li + li { margin-top: 3px; }
.prose h3 { font-size: calc(16px * var(--text-scale)); margin: 14px 0 6px; }
.prose h4 { font-size: calc(14px * var(--text-scale)); margin: 12px 0 4px; }
.prose code { font-family: var(--mono); font-size: calc(13px * var(--text-scale)); background: var(--raise); border: 1px solid var(--line); border-radius: 4px; padding: 0 4px; }
.prose pre { background: var(--raise); border: 1px solid var(--line); border-radius: var(--radius-control); padding: 10px; overflow-x: auto; }
.prose pre code { border: 0; padding: 0; background: none; }
.prose .table-wrap { margin: 0 0 10px; }
.consult-working { display: flex; align-items: center; gap: 8px; font-size: calc(13px * var(--text-scale)); color: var(--muted); }
.consult-working .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); animation: consult-pulse 1s ease-in-out infinite; }
@keyframes consult-pulse { 50% { opacity: .25; } }
@media (prefers-reduced-motion: reduce) { .consult-working .dot { animation: none; } }
.consult-suggestions { display: flex; flex-wrap: wrap; gap: 8px; }
.consult-suggestions button { white-space: normal; text-align: left; max-width: 100%; height: auto; }
.consult-suggestions:empty { display: none; }
.consult-composer { display: flex; gap: 10px; align-items: flex-end; }
.consult-composer textarea { resize: vertical; min-height: 64px; }
.rfi-card { border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: var(--radius); background: var(--raise); padding: 14px 16px; }
.rfi-card .kicker { font-size: calc(12px * var(--text-scale)); font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); }
.rfi-card h3 { margin: 2px 0 8px; font-size: calc(16px * var(--text-scale)); }
.rfi-card h4 { font-size: calc(12px * var(--text-scale)); text-transform: uppercase; letter-spacing: .5px; color: var(--muted); margin: 12px 0 4px; }
.rfi-card p, .rfi-card ul, .rfi-card ol { margin: 0 0 6px; overflow-wrap: anywhere; }
.rfi-card ul, .rfi-card ol { padding-left: 22px; }
.rfi-row { display: flex; gap: 8px; font-size: calc(14px * var(--text-scale)); }
.rfi-row .label { color: var(--muted); min-width: 96px; }
.rfi-impacts { display: flex; flex-wrap: wrap; gap: 6px 22px; margin-top: 10px; font-size: calc(14px * var(--text-scale)); }
.rfi-card .actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 12px; }
@media (max-width: 640px) {
  .consult-usage { margin-left: 0; }
  .consult-composer { flex-direction: column; align-items: stretch; }
  .consult-log { max-height: none; }
  .rfi-row { flex-direction: column; gap: 0; }
}

/* ==== 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);
  }
}
