/* =====================================================================================================
   Takteam design system  —  devhub/static/style.css
   Contract for every page template: see devhub/static/DESIGN.md and the live kit at /styleguide.

   Sections
     1. Tokens              6. Buttons              11. Lists, tabs, breadcrumb, KV
     2. Base & typography   7. Forms                12. Dropdown menus & toasts
     3. App shell           8. Cards & stats        13. Empty / loading / progress
     4. Page header         9. Tables               14. Details editors, Gantt, misc
     5. Layout helpers     10. Badges & banners     15. Responsive
   Every class name that existed before the redesign still works; the old colour names
   (--navy, --card, --line, --green, ...) are kept as aliases of the new tokens.
   ===================================================================================================== */

/* ---------- 1. Tokens ------------------------------------------------------------------------------ */
:root {
  /* brand: charcoal and bronze (Takteam). Charcoal does the structural work, bronze is the accent and stays scarce. */
  --brand: #222426;          /* charcoal: top bar, primary buttons, active nav */
  --brand-700: #0f1011;      /* hover */
  --brand-100: #e4e1da;
  --brand-50: #f3f0ea;       /* the cream of the logo board */
  --accent: #96672f;         /* bronze: ONE accent, used sparingly for the critical path (Award, Upload these, Create +) */
  --accent-600: #7d5526;
  --accent-100: #ecdcc7;
  --accent-50: #f7f0e6;
  --brand-bronze: #96672f;   /* the bronze of the lock-up on light surfaces; #c48f58 on dark (see .topbar) */
  --brand-ink: #222426;      /* the charcoal of the lock-up on light surfaces */
  --link: var(--text);       /* text links are charcoal with a hairline underline; bronze only when pointed at */
  --link-line: #8a847a;      /* that underline: 3.7:1 on white, 3.3:1 on the page, so it is a visible cue */

  /* neutrals, warmed a little towards the cream */
  --bg: #f5f3ee;             /* page background */
  --surface: #ffffff;        /* cards, sidebar, menus */
  --surface-2: #faf8f4;      /* table heads, inset panels */
  --surface-3: #f0ede6;      /* pressed / hover on surface-2 */
  --line: #e7e3da;           /* hairline borders */
  --line-strong: #cfc9bc;    /* input borders */
  --text: #222426;
  --text-2: #45474a;         /* secondary labels */
  --muted: #6e6b65;          /* help text, meta */
  --text-faint: #7a756c;     /* placeholders, disabled (4.6:1 on white) */

  /* semantic (solid, background tint, readable foreground on tint) */
  --green: #1f8a4c;  --green-bg: #e4f4ea;  --green-fg: #15633a;
  --red: #c43d2f;    --red-bg: #fcebe8;    --red-fg: #9a2d22;
  --amber: #b7791f;  --amber-bg: #fdf3dc;  --amber-fg: #845511;
  --orange: #c2570c; --orange-bg: #fde8d4; --orange-fg: #8f3d08;   /* the step between amber and red (a high risk); not the accent */
  --blue: #2f6fd1;   --blue-bg: #e8f0fc;   --blue-fg: #214f93;
  /* person colours: a person's round initials (.avatar.tone-N) take one of these eight, given in turn to the people
     of a project in the order they first sent an email there (views/projects.people_tones), so the first eight never
     share one. Muted like the kit, none of them the brand's bronze or the blue of an automatic notice, every pair 14
     or more apart in CIEDE2000 (under about 12 two small circles look alike), and in an order where neighbours differ
     most. Each keeps white initials at 5.1:1 or more; never a meaning (status uses the semantic colours above). A
     project's dot is not one of these: it is the bronze, the blue or the green of the approved drawings (.dot.proj-N) */
  --tone-1: #126178; --tone-2: #953e39; --tone-3: #20713f; --tone-4: #8a5b9c;
  --tone-5: #506015; --tone-6: #50577e; --tone-7: #266e67; --tone-8: #8d5969;
  --on-tone: #ffffff;
  /* phase colours: the segments of the progress bar (.pbar, section 13) take these by the phase's place in the
     checklist, the first phase the first colour, starting over after the eighth. Solid = the part done, -bg = the
     pale tint of the part still to do. Never a meaning (a phase in green is not "good", one in amber is no
     warning), and none is red. Dark and medium take turns (L* 29, 56, 28, 54, 28, 53, 32, 54), so two neighbours
     differ in lightness and still differ printed in grey. For a person who does not see red and green apart
     (deuteranopia and protanopia, simulated) every pair stays 24 or more apart in CIE76, where two thin bars start
     to look alike under about 12. Each solid is 3.6:1 or more on white and 3:1 or more on its own tint.
     tests/test_progress_segments.py measures all of it from this file. The second is the kit's amber. */
  --phase-1: #113f95; --phase-1-bg: #d2daeb;   /* deep blue */
  --phase-2: var(--amber); --phase-2-bg: #f4eadb;   /* amber */
  --phase-3: #6c2860; --phase-3-bg: #e3d6e1;   /* plum */
  --phase-4: #279255; --phase-4-bg: #d2e8dc;   /* green */
  --phase-5: #523e31; --phase-5-bg: #ddd9d7;   /* brown */
  --phase-6: #1a85c6; --phase-6-bg: #d1e6f4;   /* sky blue */
  --phase-7: #485100; --phase-7-bg: #dadbcb;   /* olive */
  --phase-8: #907995; --phase-8-bg: #e7e1e8;   /* lavender grey */

  /* shape, elevation, motion */
  --radius: 10px; --radius-sm: 6px; --radius-xs: 4px;
  --shadow-1: 0 1px 2px rgba(16, 24, 40, .06);
  --shadow-2: 0 4px 14px rgba(16, 24, 40, .08), 0 1px 2px rgba(16, 24, 40, .04);
  --shadow-3: 0 12px 32px rgba(16, 24, 40, .16), 0 2px 6px rgba(16, 24, 40, .08);
  --focus: 0 0 0 2px var(--surface), 0 0 0 4px #96672f;   /* a bronze ring with a gap: visible on any surface */
  --ease: cubic-bezier(.2, .7, .3, 1);
  --t-fast: 120ms; --t: 160ms; --t-slow: 240ms;

  /* type scale (base 15px) */
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --mono: ui-monospace, "Cascadia Mono", Consolas, "SF Mono", Menlo, monospace;
  --fs-xs: 12px; --fs-sm: 13px; --fs: 15px; --fs-lg: 17px; --fs-h3: 16px; --fs-h2: 19px; --fs-h1: 24px; --fs-display: 30px;

  /* spacing: 4px grid */
  --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px; --s-5: 20px; --s-6: 24px; --s-8: 32px; --s-10: 40px;

  /* shell */
  --topbar-h: 52px; --sidebar-w: 240px; --content-max: 1360px; --tabbar-h: 58px;

  /* legacy aliases (older per-feature CSS files use these) */
  --navy: var(--brand); --navy-dark: var(--brand-700); --card: var(--surface); --brand-orange: var(--brand-bronze);
}

/* ---------- 2. Base & typography ------------------------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg); color: var(--text); font-family: var(--font); font-size: var(--fs); line-height: 1.5;
  -webkit-font-smoothing: antialiased; min-height: 100vh; display: flex; flex-direction: column;
}
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
/* A plain link in the page (no class of its own) is charcoal like the text around it, so a hairline underline says
   it is a link and bronze answers the pointer. Component links (buttons, tabs, nav, cards) carry a class or are
   reset just below, and style themselves. :where() keeps this rule as weak as a one-class selector. */
:where(main, .auth, .share-shell, .help-panel) a:is(:not([class]), [class=""], [class="small"], [class="small nowrap"], [class="small muted num"]) {
  text-decoration: underline; text-decoration-color: var(--link-line); text-decoration-thickness: 1px; text-underline-offset: 3px;
}
:where(main, .auth, .share-shell, .help-panel) a:is(:not([class]), [class=""], [class="small"], [class="small nowrap"], [class="small muted num"]):hover { color: var(--accent-600); text-decoration-color: var(--accent); }
:where(main, .auth, .share-shell) :is(td:first-child, th:first-child, strong) > a:not([class]) { font-weight: 600; }
.crumbs a, .tabs a, .shortcuts a, .vw-links a, .rk-heat td a, .insp-photos a, .pm-photos a, .sf-item-photos a, .msg-attachments a,
.loc-thumb > a, .sg-toc a, .article-side .list a, main a:not([class]):has(> img), main a:not([class]):has(> svg:only-child),
main :is(h1, h2, h3) > a:not([class]) { text-decoration: none; }
.article-side .list a:hover { color: var(--accent-600); text-decoration: underline; text-decoration-color: var(--accent); }
.article-side .list a.current { font-weight: 600; }
h1, h2, h3, h4 { margin: 0 0 var(--s-2); line-height: 1.25; color: var(--text); font-weight: 650; letter-spacing: -.01em; }
h1 { font-size: var(--fs-h1); }
h2 { font-size: var(--fs-h2); }
h3 { font-size: var(--fs-h3); }
h4 { font-size: var(--fs-sm); text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; }
p { margin: 0 0 var(--s-3); }
strong { font-weight: 600; }
hr { border: 0; border-top: 1px solid var(--line); margin: var(--s-4) 0; }
code, pre { font-family: var(--mono); font-size: .9em; }
pre { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: var(--s-3) var(--s-4); overflow: auto; }
svg.icon { display: inline-block; vertical-align: -.18em; flex-shrink: 0; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: var(--radius-xs); }
::placeholder { color: var(--text-faint); }
::selection { background: var(--brand-100); }

/* text helpers (existing names kept) */
.muted { color: var(--muted); }
.small { font-size: var(--fs-sm); }
.xs { font-size: var(--fs-xs); }
.right { text-align: right; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.pre { white-space: pre-wrap; }
/* a web address made a link inside a text someone wrote (textlinks.links: an email, a conversation message): a long
   one breaks anywhere, so it wraps inside its box and never makes a phone page scroll sideways. Unlike the page's
   own links it is dark bronze with a bronze underline, so an address in a block of text plainly reads as something
   to tap (a phone shows no pointer): 5.7:1 or more on white, the cream and the grey panels; charcoal under the pointer */
a.text-link { overflow-wrap: anywhere; word-break: break-word; color: var(--accent-600); text-decoration: underline; text-decoration-color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a.text-link:hover { color: var(--text); text-decoration-thickness: 2px; }
.mt { margin-top: var(--s-4); }
.mb { margin-bottom: var(--s-4); }
.mt-sm { margin-top: var(--s-2); }
.mb-sm { margin-bottom: var(--s-2); }
.num, .tabular { font-variant-numeric: tabular-nums; }
.text-success { color: var(--green-fg); }
.text-danger { color: var(--red-fg); }
.text-warning { color: var(--amber-fg); }
.text-info { color: var(--blue-fg); }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); border: 0; }

/* ---------- 3. App shell -------------------------------------------------------------------------- */
/* .topbar (sticky, charcoal) > .nav-toggle | .brand | nav.topnav | search | .create-menu | .icon-btn (bell) | .user-menu
   .shell > aside.sidebar (project modules, grouped) + main
   On <=900px the sidebar is an off-canvas drawer (body.nav-open) and a .tabbar shows on phones inside a project. */
.topbar {
  position: sticky; top: 0; z-index: 40; height: var(--topbar-h); flex-shrink: 0;
  background: var(--brand); color: #fff; display: flex; align-items: center; gap: var(--s-2); padding: 0 var(--s-4);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .06), var(--shadow-1);
}
/* brand lock-up: {{ brand() }} from _brand.html = .brand-mark (inline SVG: the two t stems = currentColor, the bar
   they share = --brand-bronze) + .brand-word (the "takteam" wordmark as an image, in two colourways: .on-light and
   .on-dark; CSS shows the one for the surface). Sizes hang off --mark, the height of the mark: the wordmark is
   0.709 of it and sits 0.41 of it to the right, as on the logo board.
   Wrap it in .brand: the topbar link (26px mark, cream on charcoal), .auth and .share-shell (40px mark, charcoal on light). */
.topbar { --brand-bronze: #c48f58; }
.topbar .brand { display: inline-flex; align-items: center; color: #f3f0ea; white-space: nowrap; margin-right: var(--s-2); }
.topbar .brand:hover { text-decoration: none; }
.brand .brand-mark, .brand .brand-word { --mark: 26px; }
.brand .brand-mark-lg, .brand .brand-word-lg { --mark: 40px; }
.brand .brand-mark { height: var(--mark); width: calc(var(--mark) * 273 / 261); display: inline-flex; flex-shrink: 0; background: none; border-radius: 0; color: inherit; }
.brand .brand-mark svg { width: 100%; height: 100%; display: block; overflow: visible; }
.brand .brand-word { display: inline-flex; align-items: center; margin-left: calc(var(--mark) * .41); line-height: 0; }
.brand .brand-word img { height: calc(var(--mark) * .709); width: auto; display: block; }
.brand .brand-word .on-dark, .topbar .brand-word .on-light, .surface-dark .brand-word .on-light { display: none; }
.topbar .brand-word .on-dark, .surface-dark .brand-word .on-dark { display: block; }
.brand .brand-tenant { margin-left: var(--s-3); }
.surface-dark { background: var(--brand-ink); color: #f3f0ea; --brand-bronze: #c48f58; }
/* the phase colours on the dark surface: the same eight, lighter (5.2:1 or more on the charcoal), each tint a dim one */
.surface-dark {
  --phase-1: #8590e3; --phase-1-bg: #393d51; --phase-2: #f9ba6f; --phase-2-bg: #5c4d3a;
  --phase-3: #c182b3; --phase-3-bg: #473a46; --phase-4: #85d89f; --phase-4-bg: #3d5547;
  --phase-5: #a79285; --phase-5-bg: #413d3c; --phase-6: #8eccff; --phase-6-bg: #3f5261;
  --phase-7: #969a58; --phase-7-bg: #3d3f32; --phase-8: #d5c0d9; --phase-8-bg: #524e56;
}
.surface-dark .brand { color: #f3f0ea; }
/* The top links never sit under the search box or the buttons, and are never cut mid-word. Three things see to it,
   in this order as the window narrows (section 15 has the widths):
   1. the bar gives: the search box shrinks towards its icon and the project / organization switchers shorten;
   2. the last links fold into "More" (.topnav-more, a kit dropdown that base.html prints right after the links
      with the same links in it): the bar shows the first eight, then the first six, then the first four, and the
      menu shows the rest;
   3. the links move into the drawer (<=900px, or <=1200px inside a project).
   A person with few links never sees "More". Should a link still not fit (a longer label than today's), it drops
   out whole rather than slide under the search box: the nav is one row high and what wraps is clipped. */
.topbar nav, .topnav { display: flex; align-items: center; gap: var(--s-4) 2px; flex: 0 1 auto; min-width: 0; flex-wrap: wrap; height: 36px; overflow: hidden; overflow: clip; }
/* a few pixels of give at the end of the row: the bar shrinks by a fraction of a pixel before the search box has
   given all it can, and without this the last link would drop out for it */
.topnav::after { content: ""; flex: 0 0 6px; }
.topbar nav a {
  color: rgba(255, 255, 255, .82); padding: 6px 10px; border-radius: var(--radius-sm); font-size: 14px; font-weight: 500;
  white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.topbar nav a:hover { background: rgba(255, 255, 255, .1); color: #fff; text-decoration: none; }
.topbar nav a.active { background: rgba(255, 255, 255, .16); color: #fff; }
.topbar .user { font-size: var(--fs-sm); color: #d8d4cc; display: flex; align-items: center; gap: var(--s-3); }
.topbar .user a { color: #fff; }
.topbar .spacer { flex: 1; }
/* on the charcoal bar the focus ring is the lighter bronze (the default ring's gap is white) */
.topbar :focus-visible { box-shadow: 0 0 0 2px #c48f58; outline: none; }
.topbar nav a:focus-visible { box-shadow: inset 0 0 0 2px var(--brand-bronze); }   /* inside the link: the one-row nav clips what is drawn outside it */
/* "More": the top links that the bar has no room for.
   <div class="menu-wrap topnav-more" data-menu><button type="button" data-menu-btn aria-haspopup="true" aria-expanded="false">More {chevron}</button>
     <div class="menu left">…the same links as the bar, as menu rows…</div></div>
   Hidden until a width in section 15 folds links away; the menu then lists exactly the links the bar left out. */
.topbar .topnav-more { display: none; flex-shrink: 0; }   /* .topbar: outranks .menu-wrap's inline-flex */
.topnav-more > button { position: relative; display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 10px; border: 0; border-radius: var(--radius-sm); background: transparent; color: rgba(255, 255, 255, .82); font: inherit; font-size: 14px; font-weight: 500; white-space: nowrap; cursor: pointer; transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease); }
.topnav-more > button:hover, .topnav-more.open > button { background: rgba(255, 255, 255, .1); color: #fff; }
.topnav-more .menu a.active { background: var(--accent-50); color: var(--brand); font-weight: 600; }
.topnav-more .menu a .label { flex: 1; }
/* the right-hand group takes the room that is left and gives it back first: its search box shrinks to the icon */
.topbar-right { display: flex; align-items: center; justify-content: flex-end; gap: var(--s-1); margin-left: auto; flex: 1 1000 auto; }
.topbar-right > * { flex-shrink: 0; }
.topbar .topbar-search { --search-open: 280px; flex: 0 1 220px; min-width: 36px; height: 34px; }
.topbar .topbar-search input { width: 100%; min-width: 0; text-overflow: ellipsis; }
/* to type in, the box opens to the left over the bar (white, on top of the links) and nothing in the bar moves */
.topbar .topbar-search input:focus { position: absolute; top: 0; right: 0; width: var(--search-open); }
.topbar .topbar-search:focus-within .icon { left: auto; right: calc(var(--search-open) - 26px); z-index: 1; }
.portal-badge { background: rgba(255, 255, 255, .14); color: #fff; font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 999px; text-transform: uppercase; letter-spacing: .05em; white-space: nowrap; }

/* icon-only buttons in the top bar (bell, hamburger) */
.icon-btn {
  position: relative; width: 36px; height: 36px; border-radius: var(--radius-sm); border: 0; background: transparent; color: #fff;
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer; padding: 0; font: inherit;
  transition: background var(--t-fast) var(--ease);
}
.icon-btn:hover { background: rgba(255, 255, 255, .12); text-decoration: none; color: #fff; }
.icon-btn .nav-count { position: absolute; top: 3px; right: 2px; }
.nav-toggle { display: none; }

/* nav badge counts (markup must stay exactly <span class="nav-count">N</span>) */
.nav-count { display: inline-block; min-width: 18px; height: 18px; line-height: 18px; padding: 0 5px; border-radius: 999px; background: var(--accent-100); color: var(--accent-600); font-size: 11px; font-weight: 700; text-align: center; vertical-align: 1px; font-variant-numeric: tabular-nums; }

/* user menu */
.user-menu > button { display: inline-flex; align-items: center; gap: var(--s-2); height: 36px; padding: 0 var(--s-2) 0 var(--s-1); border: 0; border-radius: var(--radius-sm); background: transparent; color: #fff; cursor: pointer; font: inherit; font-size: 14px; }
.user-menu > button:hover { background: rgba(255, 255, 255, .12); }
.avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--brand-100); color: var(--brand); font-size: 12px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; letter-spacing: .02em; flex-shrink: 0; }
.avatar.lg { width: 40px; height: 40px; font-size: 15px; }
/* a person's own colour (views/projects.people_tones: the same for that person on every row, in the pane and in the
   contacts list of the project); white initials */
.avatar[class*="tone-"] { color: var(--on-tone); }
.avatar.tone-1 { background: var(--tone-1); }
.avatar.tone-2 { background: var(--tone-2); }
.avatar.tone-3 { background: var(--tone-3); }
.avatar.tone-4 { background: var(--tone-4); }
.avatar.tone-5 { background: var(--tone-5); }
.avatar.tone-6 { background: var(--tone-6); }
.avatar.tone-7 { background: var(--tone-7); }
.avatar.tone-8 { background: var(--tone-8); }
/* a project's dot (views/projects.project_tone): the bronze, the blue and the green of the approved drawings, in turn */
.dot.proj-1, .badge .dot.proj-1 { background: var(--accent); }
.dot.proj-2, .badge .dot.proj-2 { background: var(--blue); }
.dot.proj-3, .badge .dot.proj-3 { background: var(--green); }
.user-menu .menu { min-width: 230px; }
.user-menu .menu .who { padding: var(--s-2) var(--s-3) var(--s-3); border-bottom: 1px solid var(--line); margin-bottom: var(--s-1); }
.user-menu .menu .who strong { display: block; font-size: 14px; }
.user-menu .menu .who .small { display: block; }

/* project switcher (top bar, inside a project) */
.proj-switch > button { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 10px; border: 1px solid rgba(255, 255, 255, .22); border-radius: var(--radius-sm); background: rgba(255, 255, 255, .08); color: #fff; font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; max-width: 260px; }
.proj-switch > button:hover { background: rgba(255, 255, 255, .14); }
.proj-switch > button .truncate { max-width: 200px; }
/* a switcher shortens its name (the ellipsis is already there) before a top link would lose its place */
.topbar .proj-switch { flex: 0 50 auto; min-width: 72px; }
.topbar .proj-switch > button { min-width: 0; }
.topbar .proj-switch > button .truncate { min-width: 0; }
.proj-switch .menu { min-width: min(260px, calc(100vw - 16px)); }
.topbar .proj-switch .menu { max-height: 60vh; max-height: min(60vh, var(--menu-room, 60dvh)); }   /* .topbar: outranks the shared rule further down */
.proj-switch .menu a.current { background: var(--accent-50); color: var(--brand); font-weight: 600; }

.shell { display: flex; flex: 1; align-items: stretch; min-height: calc(100vh - var(--topbar-h)); }
.sidebar {
  width: var(--sidebar-w); flex-shrink: 0; background: var(--surface); border-right: 1px solid var(--line);
  position: sticky; top: var(--topbar-h); height: calc(100vh - var(--topbar-h)); overflow-y: auto; padding: var(--s-3) var(--s-3) var(--s-6);
}
.sidebar.drawer-only { display: none; }
.sidebar .proj { padding: var(--s-2) var(--s-3) var(--s-3); border-bottom: 1px solid var(--line); margin-bottom: var(--s-2); }
.sidebar .proj strong { display: block; font-size: 15px; line-height: 1.3; }
.sidebar .proj .small { display: block; margin-top: 2px; }
.sidebar .section { padding: var(--s-4) var(--s-3) var(--s-1); font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 600; }
.sidebar a.item {
  display: flex; align-items: center; gap: 10px; padding: 8px var(--s-3); min-height: 36px; border-radius: var(--radius-sm); color: var(--text-2);
  font-size: 14px; font-weight: 500; line-height: 1.3; border-left: 0; transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.sidebar a.item .icon { color: var(--muted); transition: color var(--t-fast) var(--ease); }
.sidebar a.item .label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar a.item:hover { background: var(--surface-3); color: var(--text); text-decoration: none; }
.sidebar a.item:hover .icon { color: var(--text-2); }
.sidebar a.item.active { background: var(--accent-50); color: var(--brand); font-weight: 600; }
.sidebar a.item.active .icon { color: var(--accent); }
/* Menu sections. base.html prints one <details class="nav-group" data-nav-group="plan"> for each section of
   permissions.NAV_GROUPS in which this person has two or more pages (a single page is printed on its own, an empty
   section prints nothing):
     <details class="nav-group has-current" data-nav-group="build" data-nav-current open>
       <summary><span class="nav-group-name">Build</span>{{ icon('chevron-right', 14, 'nav-chev') }}</summary>
       <div class="nav-group-pages"><a class="item active" aria-current="page" …>…</a>…</div></details>
   The summary is the header row: it opens and closes the pages with no script, and the chevron turns when open.
   The section that holds the current page arrives open; app.js remembers the others per person on the device and
   shows .nav-all, the quiet "Open all / Close all" button in .nav-tools. */
.sidebar .nav-tools { display: flex; justify-content: flex-end; }
.sidebar .nav-all { min-height: 28px; padding: 2px var(--s-3); border: 0; border-radius: var(--radius-xs); background: none; font: inherit; font-size: var(--fs-xs); color: var(--muted); cursor: pointer; }
.sidebar .nav-all:hover { color: var(--text); text-decoration: underline; }
.sidebar .nav-all[hidden] { display: none; }
.nav-group > summary {
  display: flex; align-items: center; gap: var(--s-2); min-height: 36px; margin-top: 2px; padding: 0 var(--s-3); border-radius: var(--radius-sm);
  list-style: none; cursor: pointer; user-select: none; -webkit-user-select: none; font-size: 11px; text-transform: uppercase; letter-spacing: .07em;
  color: var(--muted); font-weight: 600; transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.nav-group > summary::-webkit-details-marker { display: none; }
.nav-group > summary:hover { background: var(--surface-3); color: var(--text); }
.nav-group > summary .nav-group-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-group > summary .nav-chev { color: var(--muted); transition: transform var(--t) var(--ease); }
.nav-group[open] > summary { color: var(--text-2); }
.nav-group[open] > summary .nav-chev { transform: rotate(90deg); }
/* closed while you are on one of its pages: the name darkens and a bronze dot says "you are in here" */
.nav-group.has-current:not([open]) > summary { color: var(--brand); }
.nav-group.has-current:not([open]) > summary .nav-group-name::after { content: ""; display: inline-block; width: 6px; height: 6px; margin-left: 8px; border-radius: 50%; background: var(--accent); vertical-align: 1px; }
/* a section's pages hang off a hairline, so a page printed on its own after an open section does not read as part of it */
.nav-group-pages { margin: 0 0 var(--s-1) var(--s-3); padding-left: var(--s-1); border-left: 1px solid var(--line); }
.sidebar .mobile-only { display: none; }
.nav-backdrop { display: none; position: fixed; inset: var(--topbar-h) 0 0 0; background: rgba(16, 24, 40, .4); z-index: 44; opacity: 0; transition: opacity var(--t) var(--ease); }

main { flex: 1; min-width: 0; width: 100%; max-width: var(--content-max); margin: 0 auto; padding: var(--s-6) var(--s-8) var(--s-10); }
body.anon main { max-width: none; padding: 0; display: flex; flex-direction: column; }

/* bottom tab bar (phones, inside a project) */
.tabbar { display: none; }

/* Fill screen (static/fill.js): body.fill-screen = a drawing or a document takes the whole window. The site's own
   bars go (the top bar, the project menu and its backdrop, the breadcrumb, the bottom tab bar) and the page keeps
   its own tools. This one rule set hides every piece of page chrome; a page lays out its own content under the
   same class in its own stylesheet (viewer.css, documents.css). --topbar-h and --tabbar-h become 0, so everything
   sized by them (the viewer's height, toasts, the help panel, drawers) follows without a rule of its own.
   Two buttons, both kit buttons:
   <button type="button" class="btn secondary sm fill-on" data-fill="on" title="Fill screen: hide the site's bars">{expand icon} <span class="lbl">Fill screen</span></button>
   <button type="button" class="btn sm fill-off" data-fill="off" title="Exit fill screen (Esc)">{collapse icon} Exit</button>
   .fill-on shows while the page is not filled, .fill-off ("Exit", the one filled button of a filled page) while it
   is. The rules that keep it safe:
   - there is always a way back: .fill-off stands in a bar that is on screen at every size, never inside a panel
     that folds away, and nothing may cover it: fill.js keeps that bar's height in --fill-bar-h, and what opens
     over the page (toasts, the help panel, a page's own drawer) starts under it. Escape leaves too;
   - only a page that carries .fill-off gets the class (fill.js takes it off a page without one), and the choice is
     remembered for the browser session only;
   - .fill-hide marks a control a filled page leaves out (it is back with Exit);
   - screens only: print is the same with or without the mode, and neither button is printed. */
.btn.fill-on, .btn.fill-off { display: none; flex-shrink: 0; }   /* they need the script: shown once fill.js has run (body.fill-ready) */
@media screen {
  body.fill-ready:not(.fill-screen) .btn.fill-on { display: inline-flex; }
  body.fill-screen .btn.fill-off { display: inline-flex; }   /* .btn too: it outranks a bar that hides its other buttons on a phone */
  body.fill-screen { --topbar-h: 0px; --tabbar-h: 0px; }
  body.fill-screen .topbar, body.fill-screen .sidebar, body.fill-screen .nav-backdrop, body.fill-screen .tabbar, body.fill-screen .crumbs { display: none !important; }
  body.fill-screen .fill-hide { display: none !important; }
  body.fill-screen main { max-width: none; padding: 0; }
  body.fill-screen .toasts { top: calc(var(--fill-bar-h, 0px) + 12px); }
  body.fill-screen .help-panel { top: var(--fill-bar-h, 0px); }
}

/* ---------- 4. Page header & breadcrumb ----------------------------------------------------------- */
/* <nav class="crumbs">Portfolio › Project › Module</nav>
   <div class="page-head"><div><h1>Title</h1><span class="muted">One-line description.</span></div><div class="actions">…buttons…</div></div> */
.crumbs { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 6px; font-size: var(--fs-sm); color: var(--muted); margin: -6px 0 var(--s-3); min-height: 20px; }
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--accent-600); }
.crumbs .sep { color: var(--text-faint); display: inline-flex; }
.crumbs .current { color: var(--text-2); font-weight: 500; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--s-3) var(--s-4); margin-bottom: var(--s-5); flex-wrap: wrap; }
.page-head > div:first-child { min-width: 0; flex: 1 1 320px; }
.page-head h1 { margin-bottom: 2px; display: flex; align-items: center; gap: var(--s-2); flex-wrap: wrap; }
.page-head h1 .badge { font-size: var(--fs-xs); vertical-align: middle; }
.page-head > div:first-child > .muted, .page-head .desc { display: block; font-size: 14px; color: var(--muted); max-width: 72ch; }
.page-head .actions { display: flex; gap: var(--s-2); flex-wrap: wrap; align-items: center; margin-left: auto; }
.page-head .actions form { display: inline; }
.back-link { display: inline-flex; align-items: center; gap: 4px; font-size: var(--fs-sm); color: var(--muted); margin-bottom: var(--s-2); }
.back-link:hover { color: var(--accent-600); }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); margin: var(--s-6) 0 var(--s-3); flex-wrap: wrap; }
.section-head h2, .section-head h3 { margin: 0; }

/* ---------- 5. Layout helpers --------------------------------------------------------------------- */
.grid { display: grid; gap: var(--s-4); }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.auto { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.stack { display: flex; flex-direction: column; gap: var(--s-3); }
.cluster { display: flex; align-items: center; gap: var(--s-2); flex-wrap: wrap; }
.split { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--s-3); flex-wrap: wrap; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.narrow { max-width: 720px; }

/* ---------- 6. Buttons ---------------------------------------------------------------------------- */
/* .btn (primary charcoal) | .btn.secondary | .btn.ghost | .btn.danger | .btn.accent (critical path only) | .btn.link
   sizes: .sm | (md default) ; .icon = square icon-only ; states: [disabled], .loading, [aria-busy=true]
   <a class="btn secondary sm">{{ icon('download', 16) }} Export</a> */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 36px; padding: 0 14px;
  border-radius: var(--radius-sm); border: 1px solid var(--brand); background: var(--brand); color: #fff;
  font: inherit; font-size: 14px; font-weight: 600; line-height: 1; cursor: pointer; text-decoration: none; white-space: nowrap;
  vertical-align: middle; position: relative; box-shadow: var(--shadow-1);
  transition: background var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease), transform var(--t-fast) var(--ease);
}
.btn:hover { background: var(--brand-700); border-color: var(--brand-700); color: #fff; text-decoration: none; }
.btn:active { transform: translateY(1px); box-shadow: none; }
.btn:focus-visible { box-shadow: var(--focus); }
.btn .icon { margin: 0 -2px; }
.btn.secondary { background: var(--surface); color: var(--text); border-color: var(--line-strong); }
.btn.secondary:hover { background: var(--surface-2); border-color: #b3ad9f; color: var(--text); }
.btn.ghost { background: transparent; color: var(--text-2); border-color: transparent; box-shadow: none; }
.btn.ghost:hover { background: var(--surface-3); color: var(--text); }
.btn.accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.accent:hover { background: var(--accent-600); border-color: var(--accent-600); }
.btn.danger { background: var(--surface); color: var(--red); border-color: #e4b4ad; }
.btn.danger:hover { background: var(--red-bg); border-color: var(--red); color: var(--red-fg); }
.btn.danger.solid { background: var(--red); border-color: var(--red); color: #fff; }
.btn.success { background: var(--green); border-color: var(--green); }
.btn.sm { height: 30px; padding: 0 10px; font-size: var(--fs-sm); border-radius: var(--radius-sm); }
.btn.lg { height: 42px; padding: 0 18px; font-size: 15px; }
.btn.icon { width: 36px; padding: 0; }
.btn.icon.sm { width: 30px; }
.btn.block { display: flex; width: 100%; }
.btn.link { background: none; border: 0; color: var(--link); padding: 0; height: auto; font-weight: 500; text-decoration: underline; text-decoration-color: var(--link-line); text-underline-offset: 3px; box-shadow: none; }
.btn.link:hover { color: var(--accent-600); text-decoration-color: var(--accent); background: none; }
.btn.link.small { font-size: var(--fs-sm); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; pointer-events: none; }
.btn.loading, .btn[aria-busy="true"] { color: transparent !important; pointer-events: none; }
.btn.loading::after, .btn[aria-busy="true"]::after {
  content: ""; position: absolute; width: 16px; height: 16px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, .35); border-top-color: #fff;
  animation: spin .7s linear infinite;
}
.btn.secondary.loading::after, .btn.ghost.loading::after, .btn.danger.loading::after { border-color: var(--line-strong); border-top-color: var(--text-2); }
.btn-group { display: inline-flex; }
.btn-group .btn { border-radius: 0; margin-left: -1px; }
.btn-group .btn:first-child { border-radius: var(--radius-sm) 0 0 var(--radius-sm); margin-left: 0; }
.btn-group .btn:last-child { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- 7. Forms ------------------------------------------------------------------------------ */
/* <div class="field"><label for="x">Label</label><input id="x"><div class="help">Help text.</div></div>
   error: <div class="field error">…<div class="error-text">Why.</div></div>
   <div class="row"> stacks .field side by side; .wide takes double; stacks on phones. */
form { margin: 0; }
label { display: block; font-size: var(--fs-sm); font-weight: 600; color: var(--text-2); margin-bottom: 5px; }
label .req { color: var(--red); margin-left: 2px; }
label .muted { font-weight: 400; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=datetime-local], input[type=time],
input[type=url], input[type=tel], input[type=search], input[type=file], select, textarea, .input {
  width: 100%; height: 36px; padding: 0 var(--s-3); border: 1px solid var(--line-strong); border-radius: var(--radius-sm); font: inherit; font-size: 14px;
  background: var(--surface); color: var(--text); transition: border-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
}
input[type=file] { padding: 6px var(--s-3); font-size: var(--fs-sm); }
select { appearance: none; -webkit-appearance: none; padding-right: 32px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236e6b65' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; cursor: pointer; }
select[multiple] { height: auto; padding: 6px; background-image: none; }
select[multiple] option { padding: 4px 6px; border-radius: var(--radius-xs); }
textarea { min-height: 96px; height: auto; padding: var(--s-2) var(--s-3); resize: vertical; line-height: 1.45; }
input:hover, select:hover, textarea:hover { border-color: #aeb9c7; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(150, 103, 47, .28); }
input[disabled], select[disabled], textarea[disabled], input[readonly] { background: var(--surface-2); color: var(--muted); cursor: not-allowed; }
input[type=checkbox], input[type=radio] { width: 16px; height: 16px; accent-color: var(--brand); margin: 0; flex-shrink: 0; cursor: pointer; }
input[type=range] { width: 100%; height: auto; border: 0; padding: 0; accent-color: var(--brand); }
.field { margin-bottom: var(--s-4); min-width: 0; }
.field .help, .help { font-size: var(--fs-xs); color: var(--muted); margin-top: 4px; line-height: 1.4; }
.field.error input, .field.error select, .field.error textarea, input.invalid, select.invalid, textarea.invalid { border-color: var(--red); }
.field.error label { color: var(--red-fg); }
.field .error-text, .error-text { font-size: var(--fs-xs); color: var(--red-fg); margin-top: 4px; display: flex; align-items: center; gap: 4px; }
.row { display: flex; gap: var(--s-3) var(--s-4); flex-wrap: wrap; align-items: flex-start; }
.row > .field { flex: 1 1 160px; margin-bottom: var(--s-4); }
.row > .field.wide { flex: 2 1 280px; }
.row > .field.auto { flex: 0 0 auto; }
.row.tight > .field { margin-bottom: 0; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 500; color: var(--text); font-size: 14px; margin-bottom: 6px; cursor: pointer; }
.check input { width: 16px; height: 16px; }
.check.off { color: var(--muted); font-weight: 400; }
.checks { display: flex; flex-direction: column; gap: 2px; }
.checks.inline { flex-direction: row; flex-wrap: wrap; gap: 4px 16px; }
.inline-form { display: inline; }
.form-actions { display: flex; gap: var(--s-2); align-items: center; margin-top: var(--s-3); flex-wrap: wrap; }
.form-actions .small { margin-left: var(--s-1); }
.input-group { display: flex; }
.input-group > input { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.input-group > .btn { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; margin-left: -1px; }
.search-input { position: relative; }
.search-input .icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--text-faint); pointer-events: none; }
.search-input input { padding-left: 34px; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: var(--s-3) var(--s-4); margin: 0 0 var(--s-4); }
legend { font-size: var(--fs-sm); font-weight: 600; color: var(--text-2); padding: 0 6px; }
.dropzone { border: 2px dashed var(--line-strong); border-radius: var(--radius); padding: var(--s-6) var(--s-4); text-align: center; color: var(--muted); background: var(--surface-2); cursor: pointer; transition: border-color var(--t-fast), background var(--t-fast); }
.dropzone:hover, .dropzone.over { border-color: var(--accent); background: var(--accent-50); color: var(--text); }

/* ---------- 8. Cards & stats ---------------------------------------------------------------------- */
/* <div class="card"><div class="card-head"><h3>Title</h3><div class="actions">…</div></div> body <div class="card-foot">…</div></div>
   .card.flush removes body padding (for an edge-to-edge table); .card.clickable for a whole-card link.
   <div class="stat"><div class="label">Budget</div><div class="value">$1.2M</div><div class="sub">…</div></div> (.stat.warn turns the value red) */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: var(--s-4) var(--s-5); margin-bottom: var(--s-4); box-shadow: var(--shadow-1); min-width: 0; }
.card > :last-child { margin-bottom: 0; }
.card h2, .card h3 { margin-bottom: var(--s-3); }
.card h3 .small, .card h2 .small { font-weight: 400; }
.card h3 a.small { font-weight: 500; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); padding-bottom: var(--s-3); margin-bottom: var(--s-3); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.card-head h2, .card-head h3 { margin: 0; }
.card-head .actions { display: flex; flex-wrap: wrap; gap: var(--s-2); align-items: center; margin-left: auto; }   /* buttons wrap on a phone, never past its edge */
.card-foot { display: flex; align-items: center; gap: var(--s-2); justify-content: flex-end; padding-top: var(--s-3); margin-top: var(--s-4); border-top: 1px solid var(--line); flex-wrap: wrap; }
.card.flush { padding: 0; }
.card.flush .card-head { padding: var(--s-3) var(--s-5); margin: 0; }
/* A long page in parts that fold (the Drawings register, Documents): each part is a card whose heading opens and
   closes it with one tap, with no script, so the page reads as a short list of headings to pick from.
   <details class="card fold" id="…" data-fold="drawings-12-architectural" open>
     <summary class="card-head"><h3>Architectural <span class="small muted">40 current</span> <span class="badge amber">2 not found</span></h3></summary>
     …the part…</details>
   Closed, the card is its heading alone. app.js remembers on the device what a person opened or closed (data-fold;
   data-fold-keep: the server opened it because it holds what the person came for, and it stays open) and opens
   every part to print. A link to a row inside a closed part opens it (app.js, and Chrome by itself; so does find in
   page there). */
details.fold > summary { list-style: none; cursor: pointer; min-height: 44px; }
details.fold > summary::-webkit-details-marker { display: none; }
details.fold > summary.card-head { flex-wrap: nowrap; }   /* a long name wraps inside the heading; the arrow stays on its right */
details.fold > summary > :first-child { flex: 1 1 auto; min-width: 0; }
details.fold > summary::after { content: ""; flex-shrink: 0; width: 8px; height: 8px; margin: -4px 4px 0 auto; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); transition: transform var(--t) var(--ease); }
details.fold[open] > summary::after { transform: rotate(-135deg); margin-top: 4px; }
details.fold > summary:hover h2, details.fold > summary:hover h3 { color: var(--brand); }
details.fold:not([open]) > summary.card-head { padding-bottom: 0; margin-bottom: 0; border-bottom: 0; }
details.fold.flush > summary.card-head, details.fold.flush:not([open]) > summary.card-head { padding: var(--s-3) var(--s-5); margin: 0; }
details.fold.flush[open] > summary.card-head { border-bottom: 1px solid var(--line); }
details.fold > summary .badge { vertical-align: 1px; }
details.fold > .fold-actions { display: flex; flex-wrap: wrap; gap: var(--s-2); justify-content: flex-end; margin-bottom: var(--s-3); }
/* A row or part a link lands on (#sheet-12, ?sheet= with its anchor, a search hit) stops below the sticky top bar,
   not under it: the browser's own jump and app.js's scrollIntoView both keep this much room above it. */
main [id] { scroll-margin-top: calc(var(--topbar-h) + var(--s-3)); }
.card.flush .table-wrap { border: 0; border-radius: 0 0 var(--radius) var(--radius); }
.card.flush table th:first-child, .card.flush table td:first-child { padding-left: var(--s-5); }
.card.flush table th:last-child, .card.flush table td:last-child { padding-right: var(--s-5); }
.card.clickable, a.card { display: block; color: inherit; text-decoration: none; transition: box-shadow var(--t) var(--ease), border-color var(--t) var(--ease), transform var(--t) var(--ease); }
.card.clickable:hover, a.card:hover { box-shadow: var(--shadow-2); border-color: var(--line-strong); text-decoration: none; transform: translateY(-1px); }
/* a card that is one link holds the Tab stop: the ring shows on it (.card sets its own shadow after the general rule) */
.card.clickable:focus-visible, a.card:focus-visible, a.card:hover:focus-visible { box-shadow: var(--focus); border-radius: var(--radius); }
.card.subtle { background: var(--surface-2); box-shadow: none; }
.card.accent-top { border-top: 3px solid var(--accent); }
.grid > .card { margin-bottom: 0; }
.grid + .card, .grid + .banner, .grid + form.card { margin-top: var(--s-4); }

.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: var(--s-3) var(--s-4); box-shadow: var(--shadow-1); min-width: 0; }
.stat .label { font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; display: flex; align-items: center; gap: 6px; }
.stat .value { font-size: 26px; font-weight: 700; margin-top: 2px; letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; }
.stat .sub { font-size: var(--fs-sm); color: var(--muted); margin-top: 2px; }
.stat.warn .value { color: var(--red); }
.stat.good .value { color: var(--green); }
.stat.accent { border-top: 3px solid var(--accent); }
.stat.compact { padding: var(--s-2) var(--s-3); }
.stat.compact .value { font-size: 20px; }
a.stat { display: block; color: inherit; }
a.stat:hover { border-color: var(--line-strong); box-shadow: var(--shadow-2); text-decoration: none; }

/* project card (home) */
.project-card { display: flex; flex-direction: column; gap: var(--s-2); }
.project-card .title { display: flex; justify-content: space-between; gap: var(--s-2); align-items: flex-start; }
.project-card .title h3 { margin: 0; font-size: 16px; }
.project-card .meta { font-size: var(--fs-sm); color: var(--muted); }
.project-card .phase { display: flex; justify-content: space-between; align-items: baseline; font-size: var(--fs-sm); margin-top: var(--s-1); }
.project-card .phase strong { color: var(--text); }

/* ---------- 9. Tables ----------------------------------------------------------------------------- */
/* <div class="table-wrap"><table>…</table></div>  th/td.num right-aligns numbers; table.compact tightens;
   .table-wrap.tall scrolls vertically (max 70vh) with a sticky header; tr.selected / tr.muted-row; td.actions right-aligns buttons. */
table { width: 100%; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; background: var(--surface-2); white-space: nowrap; position: sticky; top: 0; z-index: 1; }
thead th:first-child { border-top-left-radius: var(--radius-sm); }
thead th:last-child { border-top-right-radius: var(--radius-sm); }
tbody tr { transition: background var(--t-fast) var(--ease); }
tbody tr:hover > td { background: var(--surface-2); }
tbody tr:last-child > td { border-bottom: 0; }
td.num, th.num { text-align: right; }
td.actions, th.actions { text-align: right; white-space: nowrap; }
td .btn + .btn { margin-left: 4px; }
tfoot td { font-weight: 600; background: var(--surface-2); border-top: 1px solid var(--line-strong); border-bottom: 0; }
tr.selected > td, tr.active-row > td { background: var(--accent-50); }
tr.muted-row > td { color: var(--muted); }
table.compact th, table.compact td { padding: 6px 10px; font-size: var(--fs-sm); }
table.borderless td, table.borderless th { border: 0; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); -webkit-overflow-scrolling: touch; }
.table-wrap table { min-width: 100%; }
.table-wrap.tall { max-height: 70vh; overflow-y: auto; }
.card > .table-wrap, .card > form > .table-wrap { border: 0; border-radius: 0; margin: 0 calc(-1 * var(--s-5)); width: auto; }
.card > .table-wrap:last-child, .card > form > .table-wrap:last-child { margin-bottom: calc(-1 * var(--s-4)); }
.card > .table-wrap th:first-child, .card > .table-wrap td:first-child, .card > form > .table-wrap th:first-child, .card > form > .table-wrap td:first-child { padding-left: var(--s-5); }
.card > .table-wrap th:last-child, .card > .table-wrap td:last-child, .card > form > .table-wrap th:last-child, .card > form > .table-wrap td:last-child { padding-right: var(--s-5); }
td .small.muted, td .muted { font-size: var(--fs-sm); }
td.empty, td.muted { color: var(--muted); }
td details > summary { cursor: pointer; color: var(--link); font-size: var(--fs-sm); font-weight: 500; text-decoration: underline; text-decoration-color: var(--link-line); text-underline-offset: 3px; }
/* table.phone-rows: a list that is a table on a computer and one block per row on a phone (the Notifications page).
   On a phone (700px and under, or on its side: up to 932px wide and 500px high), columns squeezed into the width
   would wrap the main text to a word or two a line, so there: the first cell takes the full width; the cells marked
   td.meta follow as one quieter line of text, a dot between them and an empty one left out (a long one wraps like
   words, and the dot stays at the end of the line it ends, never at the start of the next); td.actions comes last,
   on its own line, its buttons finger-sized (44px). The header row is hidden from sight but still read out, so a
   screen reader still names each cell's column. tr.selected and tr.active-row keep their tint on the whole block,
   and inside a .card the blocks line up with the card's padding. Elsewhere it is an ordinary table.
   <table class="phone-rows"><tbody><tr><td>main text</td><td class="small meta">project</td>
     <td class="small nowrap meta">when</td><td class="actions"><button class="btn secondary sm">Open</button></td></tr></tbody></table> */
@media (max-width: 700px), (max-width: 932px) and (max-height: 500px) {
  table.phone-rows, table.phone-rows > tbody { display: block; }
  table.phone-rows { position: relative; }  /* the containing block of the hidden header row below */
  table.phone-rows > thead { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); border: 0; }
  table.phone-rows > tbody > tr { display: block; padding: var(--s-3); border-bottom: 1px solid var(--line); }
  table.phone-rows > tbody > tr:last-child { border-bottom: 0; }
  table.phone-rows > tbody > tr.selected, table.phone-rows > tbody > tr.active-row { background: var(--accent-50); }
  table.phone-rows > tbody > tr > td { display: block; padding: 0; border: 0; background: none; }
  .card > .table-wrap table.phone-rows > tbody > tr > td, .card > form > .table-wrap table.phone-rows > tbody > tr > td { padding: 0; }
  .card > .table-wrap table.phone-rows > tbody > tr, .card > form > .table-wrap table.phone-rows > tbody > tr { padding-left: var(--s-5); padding-right: var(--s-5); }
  table.phone-rows > tbody > tr > td:first-child { margin-bottom: var(--s-1); overflow-wrap: anywhere; }
  table.phone-rows > tbody > tr > td.meta { display: inline; color: var(--muted); font-size: var(--fs-sm); overflow-wrap: anywhere; }
  table.phone-rows > tbody > tr > td.meta:empty { display: none; }
  /* the dot: a no-break space ties it to the word before it, an ordinary space after it is where the line may break
     (written \0020: a plain space after an escape such as \00b7 would be read as the end of the escape and dropped) */
  table.phone-rows > tbody > tr > td.meta:not(:empty):has(~ td.meta:not(:empty))::after { content: "\00a0\00b7\0020"; }
  table.phone-rows > tbody > tr > td.actions { margin-top: var(--s-2); text-align: right; white-space: normal; }
  table.phone-rows > tbody > tr > td.actions .btn { min-height: 44px; padding-left: var(--s-4); padding-right: var(--s-4); }
}

/* ---------- 10. Badges, status pills & banners ---------------------------------------------------- */
/* Colour classes: .badge (neutral charcoal) .grey .green .amber .red .blue .accent
   Status vocabulary (use these names, they map to the colours): draft · open · pending · submitted · approved · awarded
   · done · closed · declined · overdue · superseded · error · new · active · prequalified · do-not-use  (see DESIGN.md) */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 999px; font-size: var(--fs-xs); font-weight: 600; line-height: 18px; background: var(--brand-50); color: var(--brand); white-space: nowrap; vertical-align: middle; text-transform: lowercase; letter-spacing: .01em; }
.badge.caps { text-transform: none; }
.badge.green, .badge.success, .badge.approved, .badge.awarded, .badge.done, .badge.complete, .badge.active, .badge.sent, .badge.submitted { background: var(--green-bg); color: var(--green-fg); }
.badge.red, .badge.danger, .badge.overdue, .badge.superseded, .badge.error, .badge.failed, .badge.declined, .badge.do-not-use, .badge.rejected { background: var(--red-bg); color: var(--red-fg); }
.badge.amber, .badge.warning, .badge.pending, .badge.in-progress, .badge.answered, .badge.viewed, .badge.prequalified, .badge.expiring { background: var(--amber-bg); color: var(--amber-fg); }
.badge.blue, .badge.info, .badge.open, .badge.new { background: var(--blue-bg); color: var(--blue-fg); }
.badge.grey, .badge.neutral, .badge.draft, .badge.closed, .badge.n-a, .badge.not-started, .badge.inactive { background: var(--surface-3); color: var(--text-2); }
.badge.accent, .badge.critical, .badge.reviewed { background: var(--accent-100); color: var(--accent-600); }
.badge.outline { background: transparent; box-shadow: inset 0 0 0 1px currentColor; }
.badge .dot, .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; display: inline-block; flex-shrink: 0; }
.status-dot { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-sm); }
.status-dot::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--text-faint); }
.status-dot.green::before { background: var(--green); } .status-dot.red::before { background: var(--red); } .status-dot.amber::before { background: var(--amber); } .status-dot.blue::before { background: var(--blue); }

/* banners / callouts: .banner.info|success|warning|danger (+ legacy .notice = warning tint, .banner.superseded = danger) */
.banner, .notice { display: flex; gap: var(--s-3); align-items: flex-start; padding: var(--s-3) var(--s-4); border-radius: var(--radius-sm); margin-bottom: var(--s-4); border: 1px solid; font-size: 14px; font-weight: 500; line-height: 1.45; }
.banner .icon, .notice .icon { flex-shrink: 0; margin-top: 2px; }
.banner > div, .notice > div { flex: 1; min-width: 0; }
.banner .actions { margin-left: auto; display: flex; gap: var(--s-2); align-items: center; }
.banner strong { font-weight: 650; }
.banner[hidden], .notice[hidden] { display: none; }   /* a banner a script hides stays hidden: display:flex above would show it */
.banner.info { background: var(--blue-bg); border-color: #c5d8f5; color: var(--blue-fg); }
.banner.success { background: var(--green-bg); border-color: #b9e0c8; color: var(--green-fg); }
.banner.warning, .notice { background: var(--amber-bg); border-color: #f0dba8; color: var(--amber-fg); }
.banner.danger, .banner.error, .banner.superseded { background: var(--red-bg); border-color: #f0bdb6; color: var(--red-fg); }
.banner a, .notice a { color: inherit; text-decoration: underline; font-weight: 600; }
.banner a:hover, .notice a:hover { color: inherit; text-decoration-color: currentColor; }
.banner.superseded { font-weight: 600; }
.banner.plain { background: var(--surface-2); border-color: var(--line); color: var(--text-2); font-weight: 400; }
/* a Word file that still holds tracked changes or comments, named before it is sent (documents/_word_warning.html):
   a line for each file, and a long file name wraps instead of pushing the box off a phone's screen */
.word-warning-row, .word-warning-again { overflow-wrap: anywhere; }
.word-warning-row + .word-warning-row, .word-warning-again { margin-top: var(--s-2); }

/* ---------- 11. Lists, tabs, breadcrumbs, key/value ----------------------------------------------- */
.list { list-style: none; padding: 0; margin: 0; }
.list li { padding: 9px 0; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; gap: var(--s-3); align-items: baseline; font-size: 14px; }
.list li:last-child { border-bottom: 0; }
.list li > span:first-child { min-width: 0; }
.list.plain li { border: 0; padding: 4px 0; }
.list.dense li { padding: 5px 0; }
.list .kind { display: inline-block; min-width: 3.4rem; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; }
.timeline { list-style: none; padding: 0; margin: 0; position: relative; }
.timeline li { position: relative; padding: 6px 0 10px 22px; font-size: 14px; display: flex; justify-content: space-between; gap: var(--s-3); }
.timeline li::before { content: ""; position: absolute; left: 4px; top: 13px; width: 8px; height: 8px; border-radius: 50%; background: var(--line-strong); }
.timeline li::after { content: ""; position: absolute; left: 7px; top: 24px; bottom: -6px; width: 2px; background: var(--line); }
.timeline li:last-child::after { display: none; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: var(--s-4); flex-wrap: wrap; }
.tabs a, .tabs button { padding: 8px 12px; margin-bottom: -1px; text-decoration: none; color: var(--muted); border: 0; border-bottom: 2px solid transparent; font: inherit; font-size: 14px; font-weight: 500; background: none; cursor: pointer; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; transition: color var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease); }
.tabs a:hover, .tabs button:hover { color: var(--text); text-decoration: none; }
.tabs a.active, .tabs button.active { color: var(--brand); border-bottom-color: var(--accent); font-weight: 600; }
.tabs .nav-count { margin-left: 2px; }
.tabs.pills { border: 0; gap: 4px; }
.tabs.pills a { border: 1px solid transparent; border-radius: 999px; padding: 5px 12px; margin: 0; }
.tabs.pills a.active { background: var(--brand-50); border-color: var(--brand-100); }
.shortcuts { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: var(--s-4); }
.shortcuts a { background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 5px 12px; font-size: var(--fs-sm); font-weight: 500; color: var(--text-2); transition: border-color var(--t-fast), color var(--t-fast); }
.shortcuts a:hover { border-color: var(--brand); color: var(--brand); text-decoration: none; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px var(--s-4); font-size: 14px; margin: 0; }
.kv dt { color: var(--muted); font-weight: 500; }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
code.link { background: var(--surface-3); padding: 2px 6px; border-radius: var(--radius-xs); font-size: var(--fs-xs); word-break: break-all; }
.issue { border-left: 3px solid var(--line-strong); padding: var(--s-2) var(--s-3); margin-bottom: var(--s-2); background: var(--surface-2); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; font-size: 14px; }
.issue.high { border-left-color: var(--red); }
.issue.medium { border-left-color: var(--amber); }
.issue.low { border-left-color: var(--green); }
.pagination { display: flex; gap: 4px; align-items: center; justify-content: flex-end; margin-top: var(--s-3); font-size: var(--fs-sm); }

/* ---------- 12. Dropdown menus & toasts ----------------------------------------------------------- */
/* <div class="menu-wrap" data-menu><button data-menu-btn aria-expanded="false">…</button><div class="menu" role="menu"><a role="menuitem">…</a></div></div>
   app.js toggles .open; Escape / outside click closes. .menu.left opens leftwards-aligned. */
.menu-wrap { position: relative; display: inline-flex; }
.menu-wrap .menu, .create-menu .menu { display: none; position: absolute; right: 0; top: calc(100% + 6px); min-width: 210px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-3); padding: 6px; z-index: 60; color: var(--text); text-align: left; }
.menu-wrap .menu.left { right: auto; left: 0; }
.menu-wrap.open > .menu, .create-menu.open > .menu { display: block; animation: pop var(--t) var(--ease); }
.menu a, .menu button { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; padding: 8px 10px; border-radius: var(--radius-sm); color: var(--text); text-decoration: none; font: inherit; font-size: 14px; background: none; border: 0; cursor: pointer; white-space: nowrap; }
.menu a .icon, .menu button .icon { color: var(--muted); }
.menu a:hover, .menu button:hover, .menu a:focus-visible, .menu button:focus-visible { background: var(--surface-3); text-decoration: none; box-shadow: none; }
.menu .sep { border-top: 1px solid var(--line); margin: 6px 0; }
.menu .menu-head { padding: 6px 10px 4px; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-faint); font-weight: 600; }
.menu a.danger, .menu button.danger { color: var(--red-fg); }
/* Every menu fits what is seen. A long one (the Create menu holds twenty rows and more for a builder-team admin)
   ends above the phone's tab bar, or above the bottom of the screen and its safe area, and scrolls inside itself; a
   drag in it never moves the page behind (overscroll contained). app.js fitMenu() measures each menu as it opens and
   when the screen changes (the address bar, the phone turned, the larger text setting) and sets --menu-room, its
   height, cut through a row so that the half row shows there is more; .more-below and .more-above shade the edge
   where more is hidden. It also keeps the menu inside the screen's width (--menu-shift), and lets its rows wrap
   (.wrap-rows) when they are wider than the screen. The values below are only for the moment before it has measured.
   A menu that fits is left exactly as it was: nothing is set on it. Only menus in a bar that stays put (the top bar)
   get a measured height; one in the page itself is reached by scrolling the page, as before. */
.menu-wrap .menu, .create-menu .menu {
  max-width: calc(100vw - 16px); overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
  max-height: calc(100vh - var(--topbar-h) - var(--tabbar-h) - 16px);
  max-height: var(--menu-room, calc(100dvh - var(--topbar-h) - var(--tabbar-h) - 16px));
  margin-left: var(--menu-shift, 0px); margin-right: calc(-1 * var(--menu-shift, 0px));
}
.menu.more-below { background: radial-gradient(farthest-side at 50% 100%, rgba(16, 24, 40, .2), transparent) center bottom / 100% 12px no-repeat scroll, var(--surface); }
.menu.more-above { background: radial-gradient(farthest-side at 50% 0, rgba(16, 24, 40, .2), transparent) center top / 100% 12px no-repeat scroll, var(--surface); }
.menu.more-above.more-below { background: radial-gradient(farthest-side at 50% 0, rgba(16, 24, 40, .2), transparent) center top / 100% 12px no-repeat scroll, radial-gradient(farthest-side at 50% 100%, rgba(16, 24, 40, .2), transparent) center bottom / 100% 12px no-repeat scroll, var(--surface); }
.menu.wrap-rows a, .menu.wrap-rows button { white-space: normal; overflow-wrap: anywhere; }
.menu a .truncate, .menu button .truncate { min-width: 0; }
@keyframes pop { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

/* toasts: flashes render in <div class="toasts"> as .toast.success|error|warning|info; app.js auto-dismisses */
.toasts { position: fixed; top: calc(var(--topbar-h) + 12px); right: var(--s-4); z-index: 80; display: flex; flex-direction: column; gap: var(--s-2); width: min(400px, calc(100vw - 32px)); pointer-events: none; }
body.anon .toasts { top: var(--s-4); }
.toast, .flash { pointer-events: auto; display: flex; gap: 10px; align-items: flex-start; padding: 12px 10px 12px 14px; background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--blue); border-radius: var(--radius); box-shadow: var(--shadow-3); font-size: 14px; line-height: 1.4; color: var(--text); animation: toast-in var(--t-slow) var(--ease); transition: opacity var(--t) var(--ease), transform var(--t) var(--ease); }
.toast .icon { flex-shrink: 0; margin-top: 1px; color: var(--blue); }
.toast .msg { flex: 1; min-width: 0; padding-top: 1px; }
.toast .close { flex-shrink: 0; width: 26px; height: 26px; border: 0; background: none; border-radius: var(--radius-xs); color: var(--muted); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; margin: -4px -2px -4px 0; }
.toast .close:hover { background: var(--surface-3); color: var(--text); }
.toast.success, .flash.success { border-left-color: var(--green); } .toast.success .icon { color: var(--green); }
.toast.error, .flash.error, .toast.danger { border-left-color: var(--red); } .toast.error .icon, .toast.danger .icon { color: var(--red); }
.toast.warning, .flash.warning { border-left-color: var(--amber); } .toast.warning .icon { color: var(--amber); }
.toast.hide { opacity: 0; transform: translateX(12px); }
@keyframes toast-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
/* a flash rendered inline (e.g. the login card) rather than as a toast */
.flash.inline { position: static; box-shadow: none; animation: none; margin-bottom: var(--s-4); }
.flash.inline.error { background: var(--red-bg); border-color: #f0bdb6; color: var(--red-fg); }
.flash.inline.success { background: var(--green-bg); border-color: #b9e0c8; color: var(--green-fg); }
.flash.inline.info { background: var(--blue-bg); border-color: #c5d8f5; color: var(--blue-fg); }

/* ---------- 13. Empty states, loading, progress --------------------------------------------------- */
/* <div class="empty">{{ icon('folder', 28) }}<h3>No documents yet</h3><p>Upload the first set…</p><a class="btn">Upload</a></div>
   .empty.compact for inside a card; .empty.row for table placeholders: <td colspan=n><div class="empty compact">… */
.empty { text-align: center; padding: var(--s-10) var(--s-6); color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: var(--s-2); }
.empty .icon, .empty > svg { width: 44px; height: 44px; padding: 10px; border-radius: 12px; background: var(--surface-3); color: var(--text-faint); margin-bottom: var(--s-1); }
.empty h3 { margin: 0; color: var(--text); font-size: 16px; }
.empty p { margin: 0; max-width: 46ch; font-size: 14px; }
.empty .btn { margin-top: var(--s-2); }
.empty.compact { padding: var(--s-6) var(--s-4); }
.empty.compact .icon, .empty.compact > svg { width: 36px; height: 36px; padding: 8px; }
.progress { height: 8px; background: var(--surface-3); border-radius: 999px; overflow: hidden; }
.progress span { display: block; height: 100%; background: var(--green); border-radius: 999px; transition: width var(--t-slow) var(--ease); }
.progress.thin { height: 5px; }
.progress.brand span { background: var(--brand); }
.progress.warn span { background: var(--amber); }
.progress.danger span { background: var(--red); }
.progress.accent span { background: var(--accent); }
.progress-row { display: flex; align-items: center; gap: var(--s-2); font-size: var(--fs-sm); color: var(--muted); }
.progress-row .progress { flex: 1; }
/* Progress by phase: one line, one segment a phase, in the phases' order. The macros of templates/_progress.html
   draw it from devhub/phase_progress.py, and no page writes this markup itself: phase_bar(bar), with legend=true
   for the legend under it and static=true for paper and for a table cell, and item_bar(percent, colour) for one
   phase's own line.
   .pbar is the line. A .pbar-seg is as wide as the phase's share of the bar (flex-grow, from the server), never
   under 6px, with a 2px gap to the next. Inside it .pbar-track is the pale tint of the phase's colour and
   .pbar-fill, the part done, the solid colour (.pbar-c1 ... .pbar-c8 give both). The colour is never the only
   sign: the gaps, the order and the words carry it too.
   A segment is a button. Pointing at it, tapping it (app.js adds .open) or reaching it with the keyboard (Tab to
   the bar, the arrow keys along it) shows .pbar-tip: one line under the bar, never wider than the bar, so it cannot
   push a phone sideways. The button is taller than the 10px line it draws (24px, 44px on a phone) and gives the
   extra back with a negative margin, so the line stays where it is.
   .pbar-picture is the bar on a project card, where the whole card is the link (a.card): the same line with no
   buttons, so there is nothing to tap, no line of words and no taller target, and it needs no rule of its own.
   .pbar-static has no buttons and outlines each segment, which keeps the segments on paper printed without colours
   or backgrounds; .pbar-words is its line of text. .pbar-legend names each phase under the bar with its colour dot
   and its count, and wraps. What the bar needs on paper is in the kit's print block (section 15). */
.pbar-box { position: relative; z-index: 1; min-width: 0; }
.pbar { position: relative; display: flex; align-items: center; gap: 2px; height: 10px; }
.pbar-seg { flex: 1 1 0; min-width: 6px; height: 10px; display: flex; align-items: center; }
button.pbar-seg { height: 24px; margin: -7px 0; padding: 0; border: 0; background: none; font: inherit; color: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.pbar-track { display: block; flex: 1; min-width: 0; height: 10px; border-radius: 2px; background: var(--pbar-bg, var(--surface-3)); overflow: hidden; }
.pbar-seg:first-child .pbar-track { border-top-left-radius: 5px; border-bottom-left-radius: 5px; }
.pbar-seg:last-child .pbar-track { border-top-right-radius: 5px; border-bottom-right-radius: 5px; }
.pbar-fill { display: block; height: 100%; background: var(--pbar, var(--green)); }
.pbar-c1 { --pbar: var(--phase-1); --pbar-bg: var(--phase-1-bg); }
.pbar-c2 { --pbar: var(--phase-2); --pbar-bg: var(--phase-2-bg); }
.pbar-c3 { --pbar: var(--phase-3); --pbar-bg: var(--phase-3-bg); }
.pbar-c4 { --pbar: var(--phase-4); --pbar-bg: var(--phase-4-bg); }
.pbar-c5 { --pbar: var(--phase-5); --pbar-bg: var(--phase-5-bg); }
.pbar-c6 { --pbar: var(--phase-6); --pbar-bg: var(--phase-6-bg); }
.pbar-c7 { --pbar: var(--phase-7); --pbar-bg: var(--phase-7-bg); }
.pbar-c8 { --pbar: var(--phase-8); --pbar-bg: var(--phase-8-bg); }
button.pbar-seg:focus-visible { box-shadow: none; }
button.pbar-seg:focus-visible .pbar-track { position: relative; z-index: 1; box-shadow: var(--focus); }
.pbar-tip { display: none; position: absolute; left: 0; top: calc(100% + 8px); z-index: 30; box-sizing: border-box; width: max-content; max-width: 100%; padding: 6px 10px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); box-shadow: var(--shadow-3); font-size: var(--fs-sm); font-weight: 400; line-height: 1.4; text-align: left; white-space: normal; overflow-wrap: anywhere; pointer-events: none; }
.pbar-seg:focus-visible .pbar-tip, .pbar-seg.open .pbar-tip { display: block; }
@media (hover: hover) {
  .pbar-seg:hover .pbar-tip { display: block; }
  .pbar:hover .pbar-seg:not(:hover) .pbar-tip { display: none; }   /* one line at a time: the one pointed at */
}
.pbar .pbar-seg.shut .pbar-tip { display: none; }   /* put away by a second tap or Escape (app.js) */
.pbar-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--pbar, var(--muted)); margin-right: 6px; flex: 0 0 auto; }
.pbar-legend { list-style: none; display: flex; flex-wrap: wrap; gap: 2px var(--s-4); margin: var(--s-3) 0 0; padding: 0; font-size: var(--fs-sm); color: var(--text-2); }
.pbar-legend li { display: inline-flex; align-items: baseline; min-width: 0; max-width: 100%; }
.pbar-legend .pbar-name { min-width: 0; overflow-wrap: anywhere; }
.pbar-legend .pbar-count { margin-left: 6px; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.pbar-static .pbar-track { border: 1px solid var(--pbar, var(--line-strong)); box-sizing: border-box; }
.pbar-words { margin: 4px 0 0; font-size: var(--fs-xs); color: var(--muted); }
.pbar-note { margin: var(--s-3) 0 0; }
.project-card .pbar-box { margin: 6px 0; }
@media (max-width: 700px), (max-width: 932px) and (max-height: 500px) {
  button.pbar-seg { height: 44px; margin: -17px 0; }   /* a finger-sized target around the same 10px line */
}
.skeleton { position: relative; overflow: hidden; background: var(--surface-3); border-radius: var(--radius-sm); color: transparent !important; min-height: 1em; }
.skeleton::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .7), transparent); animation: shimmer 1.4s infinite; }
.skeleton.text { height: 14px; margin: 6px 0; }
.skeleton.title { height: 22px; width: 40%; margin-bottom: var(--s-3); }
.skeleton.block { height: 120px; }
.skeleton.circle { border-radius: 50%; width: 36px; height: 36px; }
@keyframes shimmer { to { transform: translateX(100%); } }
.spinner { display: inline-block; width: 18px; height: 18px; border: 2px solid var(--line-strong); border-top-color: var(--brand); border-radius: 50%; animation: spin .7s linear infinite; vertical-align: middle; }
.spinner.sm { width: 14px; height: 14px; }
.loading-bar { height: 3px; background: linear-gradient(90deg, var(--accent), var(--brand)); background-size: 200% 100%; animation: shimmer-bar 1.2s linear infinite; border-radius: 2px; }
@keyframes shimmer-bar { from { background-position: 200% 0; } to { background-position: -200% 0; } }
/* The loading mark, the one sign for "wait, this is working": {{ loader() }} from _brand.html in a template, or a
   copy of <template id="tt-loader"> (base.html) in a script (window.ttLoader in app.js makes one).
     <span class="tt-loader" role="status"><svg viewBox="0 0 273 261">stems + bar</svg><span class="sr-only">Loading</span></span>
   The Takteam mark stands still (stems in currentColor) and its bronze bar (--brand-bronze) draws itself across the
   two stems, holds, fades and starts again. Size hangs off --mark like the lock-up: 20px beside text, .sm 14px
   beside small text, .lg 48px when a whole panel or stage is waiting. With prefers-reduced-motion the bar stays
   drawn and pulses gently instead (the block after the reduced-motion rule in section 16).
   .spinner above is the older plain ring; it stays for the pages not moved yet and inside a busy .btn. */
.tt-loader { --mark: 20px; display: inline-flex; flex-shrink: 0; height: var(--mark); width: calc(var(--mark) * 273 / 261); vertical-align: middle; }
.tt-loader.sm { --mark: 14px; }
.tt-loader.lg { --mark: 48px; }
.tt-loader svg { display: block; width: 100%; height: 100%; overflow: visible; }
/* the bar is 234 long; the gap is longer than the bar so that, pushed back by 260, nothing of it shows (not even
   the round end) before it starts to draw */
.tt-loader .tt-loader-bar { stroke-dasharray: 234 300; animation: tt-loader-draw 1.6s cubic-bezier(.45, 0, .25, 1) infinite; }
@keyframes tt-loader-draw {
  0% { stroke-dashoffset: 260; opacity: 1; }
  55%, 82% { stroke-dashoffset: 0; opacity: 1; }
  100% { stroke-dashoffset: 0; opacity: 0; }
}
@keyframes tt-loader-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
.banner .tt-loader, .notice .tt-loader { margin-top: 1px; }

/* ---------- 14. Details editors, tooltips, Gantt, auth, misc -------------------------------------- */
/* <details class="editor"><summary><span class="badge">…</span><span class="grow">Title</span><span class="small muted">meta</span></summary><div class="body">form</div></details> */
details.editor { border: 1px solid var(--line); border-radius: var(--radius-sm); margin-bottom: 6px; background: var(--surface); transition: border-color var(--t-fast); }
details.editor:hover { border-color: var(--line-strong); }
details.editor summary { padding: 9px 12px; cursor: pointer; display: flex; gap: var(--s-3); align-items: center; list-style: none; font-size: 14px; border-radius: var(--radius-sm); }
details.editor summary::-webkit-details-marker { display: none; }
details.editor summary::after { content: ""; width: 7px; height: 7px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); margin: -3px 4px 0; flex-shrink: 0; transition: transform var(--t) var(--ease); }
details.editor[open] summary::after { transform: rotate(-135deg); margin-top: 3px; }
details.editor summary .grow { flex: 1; min-width: 0; }
details.editor[open] { border-color: var(--line-strong); box-shadow: var(--shadow-1); }
details.editor[open] summary { border-bottom: 1px solid var(--line); background: var(--surface-2); border-radius: var(--radius-sm) var(--radius-sm) 0 0; }
/* .body resets alignment/wrapping so an editor inside td.actions (right-aligned, nowrap) still lays out as a form */
details.editor .body { padding: var(--s-4); text-align: left; white-space: normal; }
.done summary .grow { text-decoration: line-through; color: var(--muted); }
details > summary { cursor: pointer; }
details.plain summary { color: var(--link); font-size: var(--fs-sm); font-weight: 500; text-decoration: underline; text-decoration-color: var(--link-line); text-underline-offset: 3px; }
summary:focus-visible { box-shadow: var(--focus); }

/* tooltip: title="" works everywhere; data-tip="" shows a styled tip on hover/focus */
[data-tip] { position: relative; }
[data-tip]::after { content: attr(data-tip); position: absolute; left: 50%; bottom: calc(100% + 6px); transform: translateX(-50%) translateY(2px); background: var(--text); color: #fff; font-size: var(--fs-xs); font-weight: 500; padding: 4px 8px; border-radius: var(--radius-xs); white-space: nowrap; opacity: 0; pointer-events: none; transition: opacity var(--t-fast) var(--ease), transform var(--t-fast) var(--ease); z-index: 70; }
[data-tip]:hover::after, [data-tip]:focus-visible::after { opacity: 1; transform: translateX(-50%); }

/* Gantt (projects/schedule.html) */
.gantt { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.gantt-inner { min-width: 900px; }
.gantt-months { display: flex; position: relative; height: 28px; border-bottom: 1px solid var(--line); margin-left: 320px; font-size: var(--fs-xs); color: var(--muted); background: var(--surface-2); }
.gantt-months div { position: absolute; top: 0; border-left: 1px solid var(--line); padding: 6px 6px; white-space: nowrap; height: 100%; font-weight: 600; letter-spacing: .02em; }
.gantt-row { display: flex; align-items: center; height: 32px; border-bottom: 1px solid var(--line); font-size: var(--fs-sm); transition: background var(--t-fast); }
.gantt-row:hover { background: var(--surface-2); }
.gantt-row .label { width: 320px; flex-shrink: 0; padding: 0 var(--s-3); display: flex; gap: var(--s-2); align-items: center; min-width: 0; position: sticky; left: 0; background: inherit; z-index: 1; background-color: var(--surface); border-right: 1px solid var(--line); height: 100%; }
.gantt-row:hover .label { background-color: var(--surface-2); }
.gantt-row .label .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; font-weight: 500; }
.gantt-row .label .ref { color: var(--muted); font-size: 11px; width: 22px; text-align: right; font-variant-numeric: tabular-nums; }
.gantt-row .track { flex: 1; position: relative; height: 100%; background-image: linear-gradient(90deg, var(--line) 1px, transparent 1px); background-size: 72px 100%; background-position: -1px 0; }
.gantt-row .bar { position: absolute; top: 8px; height: 16px; background: #b9b3a6; border-radius: 4px; min-width: 3px; box-shadow: inset 0 0 0 1px rgba(34, 36, 38, .35); transition: filter var(--t-fast); }
.gantt-row .bar:hover { filter: brightness(.95); }
.gantt-row .bar .fill { height: 100%; background: var(--brand); border-radius: 4px 0 0 4px; }
.gantt-row .bar.critical { background: #d9bc97; box-shadow: inset 0 0 0 1px rgba(150, 103, 47, .55); }
.gantt-row .bar.critical .fill { background: var(--accent); }
.gantt-row .bar.milestone { width: 14px !important; height: 14px; top: 9px; transform: rotate(45deg) translateX(-2px); background: var(--brand); border-radius: 3px; box-shadow: none; }
.gantt-row .bar.milestone.critical { background: var(--accent); }
.gantt-row .bar.milestone .fill { display: none; }
.today-line { position: absolute; top: 0; bottom: 0; border-left: 2px dashed var(--red); z-index: 1; opacity: .8; }
.gantt-group { background: var(--surface-2); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 6px var(--s-3); border-bottom: 1px solid var(--line); position: sticky; left: 0; }
.gantt-legend { display: flex; gap: var(--s-4); font-size: var(--fs-xs); color: var(--muted); align-items: center; flex-wrap: wrap; }
.gantt-legend .sw { display: inline-block; width: 18px; height: 8px; border-radius: 3px; background: #b9b3a6; vertical-align: middle; margin-right: 4px; }
.gantt-legend .sw.critical { background: var(--accent); }
.gantt-legend .sw.today { width: 0; height: 12px; border-left: 2px dashed var(--red); }

/* auth / anonymous pages (login, reset, invite, errors) */
.auth { width: 100%; max-width: 440px; margin: auto; padding: var(--s-8) var(--s-4); }
.auth .card { padding: var(--s-8) var(--s-8) var(--s-6); box-shadow: var(--shadow-2); }
.auth .brand { display: flex; align-items: center; color: var(--brand-ink); margin-bottom: var(--s-3); }
body .share-shell .brand { display: flex; align-items: center; color: var(--brand-ink); }
.auth h1 { font-size: 22px; margin-bottom: var(--s-1); }
.auth .lede { color: var(--muted); font-size: 14px; margin-bottom: var(--s-5); }
.auth .form-actions { justify-content: space-between; margin-top: var(--s-4); }
.auth .foot { text-align: center; font-size: var(--fs-xs); color: var(--muted); margin-top: var(--s-5); }
.auth-bg { background: radial-gradient(1200px 500px at 50% -10%, var(--brand-50), transparent 70%); }

/* misc existing names */
.customise { margin-bottom: var(--s-4); }
.customise summary { cursor: pointer; font-size: var(--fs-sm); color: var(--muted); display: inline-flex; align-items: center; gap: 4px; text-decoration: underline; text-decoration-color: var(--link-line); text-underline-offset: 3px; }
.customise summary:hover { color: var(--accent-600); text-decoration-color: var(--accent); }
.customise .body { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: var(--s-4) var(--s-5); margin-top: var(--s-2); }
.queue li .kind { min-width: 3.6rem; }
.preview-box { border: 2px solid var(--brand); border-radius: var(--radius); padding: var(--s-4) var(--s-5); background: var(--surface); }
.lvl, .matrix .lvl { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: var(--fs-xs); font-weight: 600; }
.lvl.view { background: var(--blue-bg); color: var(--blue-fg); }
.lvl.edit { background: var(--green-bg); color: var(--green-fg); }
.lvl.none { background: var(--surface-3); color: var(--muted); }
.email-preview { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: var(--s-3) var(--s-4); font-family: var(--mono); font-size: var(--fs-xs); white-space: pre-wrap; }
.help-banner { font-size: var(--fs-sm); color: var(--muted); background: var(--surface-2); border: 1px dashed var(--line-strong); border-radius: var(--radius-sm); padding: var(--s-2) var(--s-3); margin-bottom: var(--s-4); }
kbd { font-family: var(--mono); font-size: 11px; background: var(--surface-3); border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 4px; padding: 1px 5px; }

/* ---------- 14b. Compact controls (additive; used by the project pages) ---------------------------- */
/* A select or input that sits in a card head, table row or section head next to .btn.sm:
   <select class="sm" name="status">…</select>   <input class="sm" type="text">   — 30px tall, auto width. */
select.sm, input.sm { height: 30px; width: auto; font-size: var(--fs-sm); padding: 0 var(--s-2); }
select.sm { padding-right: 28px; background-position: right 8px center; }
/* label + control inline (for a status switcher): <label class="inline-control"><span>Phase</span><select class="sm">…</select></label> */
.inline-control { display: inline-flex; align-items: center; gap: var(--s-2); margin: 0; font-size: var(--fs-sm); font-weight: 500; color: var(--muted); }
/* the checklist's Phase status: what choosing complete does, under the card head */
.phase-help { margin: calc(-1 * var(--s-2)) 0 var(--s-3); }
@media (max-width: 700px), (max-width: 932px) and (max-height: 500px) {
  /* on a phone: a 44px tap target with 16px text (no zoom on focus), the label and its select on one full line */
  .card-head .actions:has(> .phase-status) { flex-wrap: wrap; width: 100%; margin-left: 0; }
  .phase-status, .phase-status .inline-control { display: flex; width: 100%; }
  .phase-status select.sm { height: 44px; font-size: 16px; flex: 1; }
  .phase-status .btn.sm { min-height: 44px; }
}
/* a taller textarea for message bodies and long descriptions: <textarea class="tall"> */
textarea.tall { min-height: 220px; }
/* an icon inside an empty state's button is a button icon, not the big tile icon */
.empty .btn .icon { width: auto; height: auto; padding: 0; margin: 0 -2px; background: none; color: inherit; border-radius: 0; }
/* on phones a details.editor summary wraps its meta under the title instead of squeezing the title */
@media (max-width: 700px) {
  details.editor summary { flex-wrap: wrap; row-gap: 4px; }
  details.editor summary .grow { flex: 1 1 60%; min-width: 180px; }
}

/* ---------- 15. Responsive ------------------------------------------------------------------------ */
/* Top links that fold into "More" (section 3 has the pieces). The widths come from the longest bar there is: a
   builder-team admin's nine links (757px wide), the Inbox and Access counts showing, the waiting-to-send badge,
   the search box down to its icon and each switcher shortened to its 72px. Measured with no count or badge
   showing, that bar has 89px to spare at 901px and 148px or more at the narrow end of the other two blocks; the
   counts, the badge and a scroll bar take about 100px of that at the most. Each block is the same five rules for
   "the first N": the bar drops the links after N, the menu drops the first N, More shows only for a person who
   has more than N links, looks current when the page you are on is in its menu, and carries a dot when a link in
   its menu has a count. A browser without :has() shows More at these widths for everyone, which is harmless.
   When a link is added to the top bar or a label grows, measure again (1024, 1200, 1366, 1440) and move the
   widths. The eight-link steps came with the Calendar link: with it a builder-team admin has eleven links, and
   the last ones no longer fit under 1700px (2000px inside a project) with the wider letters of Linux
   (tests/test_calendar_browser.py measures that no link is lost, at both letter spacings). */
@media (min-width: 901px) and (max-width: 1140px) {
  /* outside a project, a narrow window: the first four */
  body:not(.in-project) .topnav > a:nth-of-type(n+5), body:not(.in-project) .topnav-more .menu > a:nth-of-type(-n+4) { display: none; }
  body:not(.in-project) .topnav-more { display: inline-flex; }
  body:not(.in-project) .topnav-more:not(:has(.menu > a:nth-of-type(5))) { display: none; }
  body:not(.in-project) .topnav-more:has(.menu > a.active:nth-of-type(n+5)) > button { background: rgba(255, 255, 255, .16); color: #fff; }
  body:not(.in-project) .topnav-more:has(.menu > a:nth-of-type(n+5) .nav-count) > button::after { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--brand-bronze); }
}
@media (min-width: 1141px) and (max-width: 1350px) {
  /* outside a project: the first six */
  body:not(.in-project) .topnav > a:nth-of-type(n+7), body:not(.in-project) .topnav-more .menu > a:nth-of-type(-n+6) { display: none; }
  body:not(.in-project) .topnav-more { display: inline-flex; }
  body:not(.in-project) .topnav-more:not(:has(.menu > a:nth-of-type(7))) { display: none; }
  body:not(.in-project) .topnav-more:has(.menu > a.active:nth-of-type(n+7)) > button { background: rgba(255, 255, 255, .16); color: #fff; }
  body:not(.in-project) .topnav-more:has(.menu > a:nth-of-type(n+7) .nav-count) > button::after { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--brand-bronze); }
}
@media (min-width: 1351px) and (max-width: 1699px) {
  /* outside a project, a laptop: the first eight */
  body:not(.in-project) .topnav > a:nth-of-type(n+9), body:not(.in-project) .topnav-more .menu > a:nth-of-type(-n+8) { display: none; }
  body:not(.in-project) .topnav-more { display: inline-flex; }
  body:not(.in-project) .topnav-more:not(:has(.menu > a:nth-of-type(9))) { display: none; }
  body:not(.in-project) .topnav-more:has(.menu > a.active:nth-of-type(n+9)) > button { background: rgba(255, 255, 255, .16); color: #fff; }
  body:not(.in-project) .topnav-more:has(.menu > a:nth-of-type(n+9) .nav-count) > button::after { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--brand-bronze); }
}
@media (min-width: 1461px) and (max-width: 1999px) {
  /* inside a project, a wide window: the first eight */
  body.in-project .topnav > a:nth-of-type(n+9), body.in-project .topnav-more .menu > a:nth-of-type(-n+8) { display: none; }
  body.in-project .topnav-more { display: inline-flex; }
  body.in-project .topnav-more:not(:has(.menu > a:nth-of-type(9))) { display: none; }
  body.in-project .topnav-more:has(.menu > a.active:nth-of-type(n+9)) > button { background: rgba(255, 255, 255, .16); color: #fff; }
  body.in-project .topnav-more:has(.menu > a:nth-of-type(n+9) .nav-count) > button::after { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--brand-bronze); }
}
@media (min-width: 1201px) and (max-width: 1460px) {
  /* inside a project the switcher takes room too: the first six (at 1200px and under the links are in the drawer) */
  body.in-project .topnav > a:nth-of-type(n+7), body.in-project .topnav-more .menu > a:nth-of-type(-n+6) { display: none; }
  body.in-project .topnav-more { display: inline-flex; }
  body.in-project .topnav-more:not(:has(.menu > a:nth-of-type(7))) { display: none; }
  body.in-project .topnav-more:has(.menu > a.active:nth-of-type(n+7)) > button { background: rgba(255, 255, 255, .16); color: #fff; }
  body.in-project .topnav-more:has(.menu > a:nth-of-type(n+7) .nav-count) > button::after { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--brand-bronze); }
}
@media (max-width: 1400px) {
  /* inside a project the switcher takes the room the top links need: slim the right-hand controls first (the search
     box shrinks by itself, see .topbar-search in section 3)… */
  body.in-project .user-menu > button .name { display: none; }
  body.in-project .proj-switch > button { max-width: 190px; }
  body.in-project .proj-switch > button .truncate { max-width: 140px; }
}
@media (max-width: 1200px) {
  /* …then collapse the links into the drawer (same drawer rules as the 900px block below) before they could
     clip; non-project pages keep their links until 900px. */
  body.in-project .nav-toggle { display: inline-flex; }
  body.in-project .topbar nav.topnav { display: none; }
  body.in-project .topbar .portal-badge { display: none; }
  body.in-project .sidebar, body.in-project .sidebar.drawer-only { display: block; position: fixed; top: var(--topbar-h); left: 0; bottom: 0; height: auto; z-index: 45; transform: translateX(-104%); transition: transform var(--t-slow) var(--ease); box-shadow: var(--shadow-3); width: min(300px, 86vw); }
  body.in-project.nav-open .sidebar { transform: none; }
  body.in-project.nav-open .nav-backdrop { display: block; opacity: 1; }
  body.in-project .sidebar .mobile-only, body.in-project .sidebar .mobile-only.section { display: block; }
}
@media (min-width: 901px) and (max-width: 1200px) {
  /* on the sheet viewer the menu narrows to a 56px strip of icons (viewer.css, body.viewer-page). The strip shows
     every page's icon, one tap away, as it did before the menu had sections: app.js opens every section while the
     strip is shown and puts them back afterwards, and nothing opens or closes there. A section's header is then
     only a thin divider (the name stays for screen readers and as the tooltip), nothing is indented and the Open
     all button is left out. So is the drawer's own search box: 56px cut it down to one letter, and the search box
     of the top bar is still there at this width. The strip is longer than most screens are tall, so where the
     scroll bar takes room (a mouse) it is the thin one */
  body.viewer-page .sidebar { scrollbar-width: thin; }
  body.viewer-page .sidebar .nav-tools, body.viewer-page .sidebar .mobile-search { display: none; }
  body.viewer-page .sidebar .nav-group > summary { min-height: 0; height: 13px; margin: 0; padding: 0; border-radius: 0; cursor: default; background: linear-gradient(var(--line), var(--line)) center / 100% 1px no-repeat; }
  body.viewer-page .sidebar .nav-group > summary .nav-chev { display: none; }
  body.viewer-page .sidebar .nav-group-name { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  body.viewer-page .sidebar .nav-group-pages { margin: 0; padding-left: 0; border-left: 0; }
}
@media (max-width: 1100px) {
  .grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  main { padding: var(--s-5) var(--s-5) var(--s-10); }
  /* non-project pages keep their first links down to 900px; the bar slims so they never clip or sit under the
     search box (the box itself shrinks as the links need the room: .topbar-search in section 3) */
  .user-menu > button .name { display: none; }
  .topbar nav a { padding: 6px 8px; }
}
@media (max-width: 1000px) {
  /* a person who has the organization switcher too: the mark stands without the wordmark, as it does on a phone */
  .topbar:has(.org-switch) .brand .brand-word { display: none; }
  /* the search box is an icon-only pill that opens on focus (.topbar prefix outranks access.css) */
  .topbar .topbar-search { --search-open: 200px; flex-basis: 36px; }
  .topbar .topbar-search input { padding-right: 0; }
  .topbar .topbar-search input:not(:focus)::placeholder { color: transparent; }
  .topbar .topbar-search input:focus { padding-right: 12px; }
}
@media (max-width: 900px) {
  /* tablet: sidebar becomes an off-canvas drawer; top links move into it */
  .nav-toggle { display: inline-flex; }
  .topbar nav.topnav { display: none; }
  .topbar .portal-badge { display: none; }
  .sidebar, .sidebar.drawer-only { display: block; position: fixed; top: var(--topbar-h); left: 0; bottom: 0; height: auto; z-index: 45; transform: translateX(-104%); transition: transform var(--t-slow) var(--ease); box-shadow: var(--shadow-3); width: min(300px, 86vw); }
  body.nav-open .sidebar { transform: none; }
  body.nav-open .nav-backdrop { display: block; opacity: 1; }
  .sidebar .mobile-only { display: block; }
  .sidebar .mobile-only.section { display: block; }
  .nav-group > summary { min-height: 40px; }   /* a finger-sized header row in the drawer */
  .grid.cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .user-menu > button .name { display: none; }
}
@media (max-width: 700px) {
  :root { --fs-h1: 21px; }
  main { padding: var(--s-4) var(--s-4) calc(var(--tabbar-h) + var(--s-6)); }
  body.no-tabbar main, body.anon main { padding-bottom: var(--s-6); }
  .grid.cols-2, .grid.cols-3, .grid.cols-4 { grid-template-columns: 1fr; }
  .grid.cols-3.stats, .grid.cols-4.stats, .grid.kpis, .grid:has(> .stat) { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-2); }
  .row > .field, .row > .field.wide { flex-basis: 100%; }
  .card { padding: var(--s-4); }
  .card > .table-wrap, .card > form > .table-wrap { margin-left: calc(-1 * var(--s-4)); margin-right: calc(-1 * var(--s-4)); }
  .page-head .actions { width: 100%; margin-left: 0; }
  .topbar { padding: 0 var(--s-2) 0 var(--s-1); gap: 2px; }
  .topbar .brand .brand-word { display: none; }
  .topbar-search { display: none; }
  /* phone top bar inside a project: nothing may push the bar past the viewport (checked: scrollWidth == 375) */
  .nav-toggle { flex-shrink: 0; width: 36px; }
  .topbar-right { flex-shrink: 0; gap: 0; }
  .proj-switch > button { max-width: 128px; padding: 0 6px; }
  .proj-switch > button .truncate { max-width: 120px; }
  .topbar .icon-btn[data-help-toggle] { display: none; }   /* Help is in the drawer */
  .toasts { right: var(--s-2); top: calc(var(--topbar-h) + 8px); }
  th, td { padding: 8px 10px; }
  .stat .value { font-size: 22px; }
  .auth .card { padding: var(--s-6) var(--s-5); }
  /* bottom tab bar inside a project */
  .tabbar { display: flex; position: fixed; left: 0; right: 0; bottom: 0; height: var(--tabbar-h); background: var(--surface); border-top: 1px solid var(--line); z-index: 40; padding-bottom: env(safe-area-inset-bottom); box-shadow: 0 -2px 10px rgba(16, 24, 40, .06); }
  .tabbar a, .tabbar button { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font: inherit; font-size: 10.5px; font-weight: 600; color: var(--muted); background: none; border: 0; text-decoration: none; padding: 6px 2px 4px; letter-spacing: .01em; cursor: pointer; min-width: 0; }
  .tabbar a span, .tabbar button span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .tabbar a.active { color: var(--brand); }
  .tabbar a.active .icon { color: var(--accent); }
  .gantt-row .label { width: 200px; }
  .gantt-months { margin-left: 200px; }
}
/* ---------- 16. Additive: segmented toggle state ---------------------------------------------------- */
/* .btn-group buttons that act as a view switcher (Overlay | Side by side | Diff) mark the chosen one with .active;
   JS toggles the class. Demonstrated under "Buttons" in the style guide. */
.btn-group .btn.active, .btn.secondary.active { background: var(--brand-50); border-color: var(--brand); color: var(--brand); position: relative; z-index: 1; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  /* the one exception: nothing moves in the loading mark, but its bar keeps a slow, gentle pulse so that a wait
     still reads as a wait (a stronger selector than the rule above, so its !important wins) */
  .tt-loader .tt-loader-bar { stroke-dasharray: none; animation: tt-loader-pulse 2.4s ease-in-out infinite !important; }
}
@media print {
  .topbar, .sidebar, .tabbar, .toasts, .page-head .actions, .create-menu, .customise { display: none !important; }
  main { padding: 0; max-width: none; }
  .card, .stat { box-shadow: none; break-inside: avoid; }
  a { color: inherit; }
  details.fold > summary::after { display: none; }
  /* the progress bar by phase (section 13) on paper: no line of words left open, its colours printed even when the
     browser leaves backgrounds out, and each segment outlined so the segments still show without them */
  .pbar-tip { display: none !important; }
  .pbar, .pbar *, .pbar-dot { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .pbar-track { border: 1px solid var(--pbar, var(--line-strong)); box-sizing: border-box; }
}

/* ---------- 16. Additions: short fields, textarea sizes, main+side grid, scroll lists, Q&A ---------- */
/* Generic pieces first needed by the Procure pages (directory, bids, vendor portal). Demonstrated in /styleguide
   under "Forms" and "Pickers and Q&A". */
/* .narrow.lg — the width cap for multi-column forms (.narrow is 720px, enough for a single column) */
.narrow.lg { max-width: 980px; }
/* .row > .field.short — a field that should stay narrow (state, zip, quantity) instead of stretching like its neighbours */
.row > .field.short { flex: 0 1 120px; }
/* textarea.short for a note of a few lines, textarea.tall for long-form text such as a scope of work */
textarea.short { min-height: 64px; }
textarea.tall { min-height: 160px; }
/* .grid.main-side — a wide main column and a narrower aside (list + summary, content + form); stacks at 900px */
.grid.main-side { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); align-items: start; }
/* .scroll-list — a bounded, scrolling list of .check rows for pickers (companies to add, recipients, files).
   <div class="scroll-list">{% for … %}<label class="check"><input type="checkbox"> <span>…</span></label>{% endfor %}</div>
   .check.off dims rows that are already chosen elsewhere or cannot be picked. */
.scroll-list { max-height: 360px; overflow: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 0 var(--s-3); background: var(--surface); }
.scroll-list .check { padding: 8px 0; margin: 0; border-bottom: 1px solid var(--line); align-items: flex-start; }
.scroll-list .check > input { margin-top: 3px; }
.scroll-list .check:last-child { border-bottom: 0; }
.scroll-list .check.off { opacity: .6; }
.scroll-list .empty { padding: var(--s-5) var(--s-3); }
/* Q&A thread (bidder questions, clarifications):
   <div class="qa open" id="q-12"><div class="who"><strong>Who asked</strong><span class="small muted">when</span></div><p class="pre">Question</p>
     <div class="answer"><div class="who"><strong>Answer</strong><span class="small muted">who · when</span></div><p class="pre">Answer</p></div></div>
   .qa.open (no answer yet) gets an amber edge; answered threads a green one. */
.qa { border: 1px solid var(--line); border-left: 3px solid var(--green); border-radius: var(--radius-sm); padding: var(--s-3) var(--s-4); margin-bottom: var(--s-3); background: var(--surface); font-size: 14px; }
.qa.open { border-left-color: var(--amber); }
.qa .who { display: flex; justify-content: space-between; gap: var(--s-1) var(--s-3); flex-wrap: wrap; align-items: baseline; margin-bottom: 4px; }
.qa p { margin-bottom: 0; }
.qa .answer { margin-top: var(--s-3); padding: var(--s-2) var(--s-3); background: var(--accent-50); border-radius: var(--radius-sm); }
.qa form { margin-top: var(--s-3); }
@media (max-width: 900px) {
  .grid.main-side { grid-template-columns: 1fr; }
}

/* ------------------------------------------------------------------------------------------------
   SmartSearch & help (shell components). Typeahead under the topbar box, the slide-over help panel,
   search-result lists, AI answer block, article prose. Documented in DESIGN.md §3 "Search & help".
   ------------------------------------------------------------------------------------------------ */
.topbar-search, .mobile-search { position: relative; }
.typeahead { position: absolute; top: calc(100% + 6px); right: 0; width: min(520px, 92vw); background: var(--surface); color: var(--text); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-3); padding: 6px; z-index: 70; max-height: 70vh; overflow: auto; text-align: left; animation: pop var(--t) var(--ease); }
.mobile-search .typeahead { left: 0; right: 0; width: auto; }
.ta-group { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; padding: 8px 10px 4px; }
.ta-item { display: flex; justify-content: space-between; gap: var(--s-3); align-items: baseline; padding: 7px 10px; border-radius: var(--radius-sm); color: var(--text); font-size: 14px; }
.ta-item:hover, .ta-item.active { background: var(--brand-50); text-decoration: none; color: var(--brand); }
.ta-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ta-meta { font-size: var(--fs-xs); color: var(--muted); white-space: nowrap; }
.ta-all { border-top: 1px solid var(--line); margin-top: 4px; padding-top: 10px; color: var(--brand); font-weight: 500; border-radius: 0; }
.ta-empty { padding: 12px 10px; font-size: var(--fs-sm); color: var(--muted); }

.search-page-form { display: flex; gap: var(--s-2); align-items: center; margin-bottom: var(--s-3); max-width: 760px; }
.search-page-form .search-input { flex: 1; min-width: 0; }
.search-page-form .search-input input { width: 100%; }
.search-input.lg input { height: 44px; font-size: 16px; padding-left: 38px; }
.search-input.lg .icon { left: 12px; }
.search-filters { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); flex-wrap: wrap; margin-bottom: var(--s-4); }
.result-block { margin-bottom: var(--s-6); }
.result-block .section-head { margin-top: 0; }
.list.hits li { align-items: flex-start; }
.list.hits .snippet { margin-top: 2px; line-height: 1.45; }
.list.hits mark, .prose mark, .snippet mark { background: var(--amber-bg); color: var(--amber-fg); padding: 0 2px; border-radius: 2px; }
.list.plain li { border: 0; padding: 6px 0; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--text); font-size: var(--fs-sm); cursor: pointer; font-family: inherit; }
.chip:hover { border-color: var(--brand); color: var(--brand); text-decoration: none; background: var(--brand-50); }
kbd { display: inline-block; min-width: 18px; padding: 0 5px; border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 4px; background: var(--surface-2); font-family: var(--mono); font-size: 11px; line-height: 16px; text-align: center; color: var(--text-2); }

/* Ask / answer */
.ask-card { border-color: var(--brand-100); }
.ask-row { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); flex-wrap: wrap; }
.ask-result:empty { display: none; }
.ask-result { margin-top: var(--s-3); }
.thinking { display: flex; align-items: center; gap: var(--s-2); color: var(--muted); font-size: var(--fs-sm); padding: var(--s-2) 0; }
.answer { border-top: 1px solid var(--line); padding-top: var(--s-3); }
.answer-q { margin-bottom: var(--s-2); display: flex; gap: 6px; align-items: center; }
.answer-sources ol { margin: 4px 0 0; padding-left: 22px; font-size: var(--fs-sm); }
.answer-sources li { margin: 2px 0; }
.answer-foot { display: flex; align-items: center; gap: var(--s-2); flex-wrap: wrap; margin-top: var(--s-3); }
.answer .chips { margin-top: var(--s-3); }

/* Help panel (slide-over) */
.help-panel { position: fixed; top: var(--topbar-h); right: 0; bottom: 0; width: min(400px, 100vw); background: var(--surface); border-left: 1px solid var(--line); box-shadow: var(--shadow-3); z-index: 65; display: flex; flex-direction: column; transform: translateX(100%); transition: transform var(--t-slow) var(--ease); }
.help-panel.open { transform: none; }
.help-panel[hidden] { display: none; }
.help-panel .head { display: flex; align-items: center; justify-content: space-between; gap: var(--s-2); padding: var(--s-3) var(--s-4); border-bottom: 1px solid var(--line); }
.help-panel .head h2 { margin: 0; font-size: 16px; display: flex; align-items: center; gap: 8px; }
.help-panel .body { padding: var(--s-4); overflow: auto; flex: 1; }
.help-panel .search-input { margin-bottom: var(--s-4); }
.panel-section { margin-bottom: var(--s-5); }
.panel-title { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; margin-bottom: var(--s-2); display: flex; justify-content: space-between; align-items: baseline; }
.panel-section .list li { padding: 7px 0; }
.panel-foot { margin-top: var(--s-3); }
.help-panel .article-title { font-size: 18px; margin: 4px 0 var(--s-3); }
.help-panel .back-link { margin-bottom: var(--s-2); }
.help-panel .editor summary { padding: 8px 10px; }
.topbar .icon-btn[aria-expanded="true"] { background: rgba(255, 255, 255, .16); }
@media (min-width: 1200px) { body.help-open main { padding-right: calc(400px + var(--s-4)); } }

/* Article prose (help articles, AI answers) */
.article-layout { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: var(--s-5); align-items: start; }
.article h1 { margin: 4px 0 var(--s-4); }
.prose { line-height: 1.6; font-size: 15px; max-width: 72ch; }
.prose h2 { font-size: 17px; margin: var(--s-6) 0 var(--s-2); }
.prose h3 { font-size: 15px; margin: var(--s-5) 0 var(--s-2); }
.prose p, .prose ul, .prose ol { margin: 0 0 var(--s-3); }
.prose li { margin: 4px 0; }
.prose ol, .prose ul { padding-left: 22px; }
.prose code { font-family: var(--mono); font-size: 13px; background: var(--surface-2); padding: 1px 5px; border-radius: 4px; }
.prose table { width: 100%; border-collapse: collapse; margin: var(--s-3) 0; font-size: var(--fs-sm); }
.prose th, .prose td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.prose th { background: var(--surface-2); font-weight: 600; }
.prose blockquote { margin: 0 0 var(--s-3); padding: var(--s-2) var(--s-4); border-left: 3px solid var(--brand-100); color: var(--text-2); background: var(--surface-2); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.help-panel .prose { font-size: 14px; }
.help-sections .card h3 { margin-bottom: var(--s-2); }
.good { color: var(--green-fg); }
.danger-text { color: var(--red-fg); }
@media (max-width: 900px) { .article-layout { grid-template-columns: 1fr; } }
@media (max-width: 700px) { .search-page-form { flex-wrap: wrap; } .search-page-form .btn { width: 100%; } .help-panel { top: 0; } }
.result-more { margin-top: var(--s-2); }
.search-note { margin-bottom: var(--s-4); }
/* Search on a phone: the first result high on the screen (no intro once there is a query, the filter pills on one
   row that scrolls inside itself, the page never sideways) and every link a finger can hit (44px). */
@media (max-width: 700px) {
  .page-head.search-head.has-q { margin-bottom: var(--s-2); }
  .page-head.search-head.has-q h1 { font-size: 20px; margin-bottom: 0; }
  .page-head.search-head.has-q > div:first-child > .search-intro { display: none; }
  .search-page-form { flex-wrap: nowrap; margin-bottom: var(--s-2); }
  .search-page-form .btn { width: auto; height: 44px; flex: 0 0 auto; }
  .search-filters { gap: var(--s-2); margin-bottom: var(--s-3); }
  .search-filters .tabs.pills { flex-wrap: nowrap; overflow-x: auto; max-width: 100%; scrollbar-width: none; }
  .search-filters .tabs.pills a { min-height: 44px; display: inline-flex; align-items: center; flex: 0 0 auto; }
  .result-block .section-head .btn.sm, .result-block .list.hits .btn.sm { height: 44px; }
  .result-block .list.hits a:not(.btn), .result-more .more-link, .search-filters .small a { display: inline-flex; align-items: center; min-height: 44px; }
  .result-block .list.hits li { flex-wrap: wrap; gap: var(--s-2); }
  .result-block .chips .chip { min-height: 44px; }
}
/* "Type out N scanned pages" on a file's page and a report's page, with what it costs said beside it */
.type-out-form { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2); }
@media (max-width: 700px) { .type-out-form .type-out-btn { min-height: 44px; } }
.help-panel .icon-btn { color: var(--muted); }
.help-panel .icon-btn:hover { background: var(--surface-3); color: var(--text); }
.help-panel .head .actions { display: flex; align-items: center; gap: 4px; }

/* ---------- 17. Test copy band (sitecopy.py, templates/_test_band.html) ----------------------------------------- */
/* Only the test copy (Azure's staging slot) carries body.test-copy and the band; the real site has neither, so
   nothing here applies to it. The band is fixed at the top of the window, above the top bar, and the page starts
   under it: --band-h is its height, and --topbar-h grows by it, so everything that is placed under the top bar (the
   drawers, the help panel, toasts, the drawing viewer's height, sticky headers) moves down with no rule of its own.
   In fill screen and in a pop-out window, where there is no top bar, --topbar-h is the band alone. Screens only:
   a printed page has no band. 52px below is the top bar's own height (--topbar-h in :root). */
.test-band { display: none; }
body.test-copy { --band-h: 40px; --topbar-h: calc(52px + var(--band-h)); padding-top: var(--band-h); }
body.test-copy .test-band {
  display: flex; align-items: center; justify-content: center; gap: var(--s-3); position: fixed; top: 0; left: 0; right: 0;
  height: var(--band-h); z-index: 79; padding: 0 var(--s-4); overflow: hidden;
  background: #ffd84d; color: #1f1a00; border-bottom: 2px solid #a67c00; font-size: var(--fs-sm); line-height: 1.3;
}
.test-band-text { margin: 0; min-width: 0; }
.test-band-short { display: none; }
.test-band .test-band-link {
  flex-shrink: 0; display: inline-flex; align-items: center; min-height: 30px; padding: 0 var(--s-3); border-radius: 999px;
  background: #1f1a00; color: #fff; font-weight: 600; white-space: nowrap; text-decoration: none;
}
.test-band .test-band-link:hover { background: #000; color: #fff; text-decoration: underline; }
.test-band .test-band-link:focus-visible { outline: 2px solid #1f1a00; outline-offset: 2px; }
body.test-copy .topbar { top: var(--band-h); height: calc(var(--topbar-h) - var(--band-h)); }
body.test-copy.anon .toasts { top: calc(var(--band-h) + var(--s-4)); }
body.test-copy .lightbox { top: var(--band-h); }
body.test-copy[data-popout], body.test-copy[data-linked] { --topbar-h: var(--band-h); }
@media screen {
  body.test-copy.fill-screen { --topbar-h: var(--band-h); }
}
@media (max-width: 700px) {
  body.test-copy { --band-h: 52px; }
  body.test-copy .test-band { justify-content: space-between; padding: 0 var(--s-3); font-size: 12.5px; }
  .test-band-long { display: none; }
  .test-band-short { display: inline; }
  .test-band .test-band-link { min-height: 36px; }
  body.test-copy:not(.fill-screen) .help-panel { top: var(--band-h); }   /* the phone's help panel fills the screen */
}
@media print {
  body.test-copy { padding-top: 0; }
  body.test-copy .test-band { display: none !important; }
}
.auth .test-copy-note { display: flex; align-items: flex-start; gap: var(--s-2); margin: var(--s-4) 0 0; padding: var(--s-2) var(--s-3); border: 1px solid #a67c00; border-radius: var(--radius-sm); background: #fff4c2; color: #1f1a00; font-size: var(--fs-sm); line-height: 1.4; }
.auth .test-copy-note .icon { flex-shrink: 0; margin-top: 1px; }

/* ---------- 18. Run bar and places (AI takeoff, DESIGN.md "Run bar" and "Places") ------------------------------ */
/* .run-bar: the one line under a form that starts a long or paid job. It says what will happen before it starts
   (how many things are ticked, what it will cost, why it cannot start yet) and holds the one button that starts it.
   <div class="run-bar"><div class="run-bar-text"><span class="run-bar-count">6 sheets ticked</span>
     <span class="run-bar-cost">About $5 to $9 (about 1 to 2 hours)</span><span class="run-bar-why"></span></div>
     <label class="check run-bar-confirm">…a tick the run needs…</label><button class="btn accent">Run</button></div>
   At the foot of the form on a computer; on a phone it stays on screen above the tab bar while the form is in view
   (sticky, so it never covers the page below the form), and the count is the first thing read. .run-bar-why says
   in words why the button is disabled; it is empty (and takes no room) when nothing stops the run. */
.run-bar { display: flex; align-items: center; flex-wrap: wrap; gap: var(--s-2) var(--s-4); margin-top: var(--s-4); padding: var(--s-3) var(--s-4); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-1); }
.run-bar-text { flex: 1 1 260px; min-width: 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px var(--s-3); }
.run-bar-count { font-weight: 650; font-variant-numeric: tabular-nums; color: var(--text); }
.run-bar-cost { font-size: var(--fs-sm); color: var(--text-2); font-variant-numeric: tabular-nums; }
.run-bar-why { flex-basis: 100%; font-size: var(--fs-sm); color: var(--amber-fg); }
.run-bar-why:empty { display: none; }
.run-bar-confirm { margin: 0; font-size: var(--fs-sm); }
.run-bar-confirm[hidden] { display: none; }
.run-bar > .btn { flex: 0 0 auto; margin-left: auto; }
@media (max-width: 700px) {
  .run-bar { position: sticky; bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + var(--s-2)); z-index: 30; box-shadow: var(--shadow-3); padding: var(--s-2) var(--s-3); gap: var(--s-2); }
  body.no-tabbar .run-bar, body.anon .run-bar { bottom: var(--s-2); }
  .run-bar-text { flex-basis: 0; flex-grow: 1; flex-direction: column; align-items: flex-start; gap: 0; }
  .run-bar-count { font-size: 16px; }
  .run-bar > .btn { min-height: 44px; }
  .run-bar-confirm { flex-basis: 100%; order: 3; }
}
/* .places: where a number was read, one row per place. A sheet place is a link that opens the viewer zoomed to it
   (?box=); a document place opens the document at its page in a new tab, with the words read quoted under it; a
   place the reader may not open is named in muted text with no link. More than two fold into a details.plain.
   <ul class="places"><li><a href="…?mode=takeoff&box=…">{pin icon} SH1</a></li>
     <li><a href="…/view?page=4" target="_blank" rel="noopener">{file icon} Topographic survey, page 4</a> <q>EX. GRADE 142.80</q></li></ul> */
.places { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; font-size: var(--fs-sm); }
.places li { min-width: 0; overflow-wrap: anywhere; }
.places a { display: inline-flex; align-items: center; gap: 4px; min-height: 24px; }
.places q { display: block; color: var(--muted); font-style: italic; quotes: "\201C" "\201D"; }
.places-more > summary { font-size: var(--fs-xs); }
@media (max-width: 700px) { .places a { min-height: 36px; } }

/* 19. Building / series (series.py; the Drawings register and the Documents list)
   The filter: <form class="series-filter"><label for="series-pick">Building / series</label>
     <select id="series-pick" name="series" data-autosubmit>…</select><noscript><button class="btn secondary sm">Show</button></noscript>
     <p class="small muted series-note">Showing Building B only. 12 other sheets are hidden. <a>Show all</a></p></form>
   A group inside a part that folds: <details class="plain series-group" data-fold="…"><summary><span class="series-name">Building A</span>
     <span class="small muted">24 sheets</span></summary><div class="table-wrap">…</div></details>
   <p class="small muted series-also">Also here: links to the groups</p> above a long list of rows with no series. */
.series-filter { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2) var(--s-3); margin: var(--s-4) 0 var(--s-3); }
.series-filter label { margin: 0; font-weight: 600; }
.series-filter select { width: auto; min-width: 9rem; max-width: 100%; flex: 0 1 auto; }
.series-filter .series-note { margin: 0; flex: 1 1 14rem; min-width: 0; overflow-wrap: anywhere; }
.series-group { margin-top: var(--s-3); }
.card.flush > .series-group { margin: var(--s-3) var(--s-5); }
.series-group > summary { cursor: pointer; padding: 6px 0; overflow-wrap: anywhere; }
.series-group > summary .series-name { font-weight: 600; }
.series-group > .table-wrap { margin-top: var(--s-2); }
.series-also { overflow-wrap: anywhere; }
@media (max-width: 700px) {
  .series-group > summary { min-height: 44px; display: flex; align-items: center; gap: 6px; }
  .series-also a, .series-filter .series-note a { display: inline-flex; align-items: center; min-height: 44px; }
  .series-filter .btn { min-height: 44px; }
  .series-filter select { min-height: 44px; font-size: 16px; flex: 1 1 100%; width: 100%; }
  /* the Drawing register card of a file's page: Keep as record copy, Put back in the register */
  #drawing-register .btn { min-height: 44px; height: auto; white-space: normal; text-align: left; }
}
