/* Pro Tech Office: design system.
   Navy chrome, cyan for actions, orange for attention, white cards. Base 17px / 1.5.
   The motif is the logo's shield and signal arcs: faint arcs in the sidebar, page header and empty states,
   and a thin cyan-to-orange accent rule.

   Rules this file keeps:
   - Every colour, size, radius, shadow and duration comes from the tokens in :root.
   - Content is fully visible with no animation running. Entry animations move (transform) only; a keyframe
     that touches opacity on page content starts at 0.6 or more. Keyframes named deco-* are for aria-hidden
     decoration only (tests/test_shell.py checks this).
   - State changes take 150-250 ms. Everything moving is switched off under prefers-reduced-motion.
   - No inline styles anywhere (CSP style-src 'self'): every look lives in this file. */

/* =========================================================================================================
   1. Tokens
   ========================================================================================================= */
:root {
  /* navy: the chrome */
  --navy-50: #eef4f8;
  --navy-100: #d8e4ed;
  --navy-200: #b0c6d6;
  --navy-300: #86a4ba;
  --navy-400: #5b7f99;
  --navy-500: #3a6482;
  --navy-600: #24506c;
  --navy-700: #1a3d54;
  --navy-800: #133042;
  --navy-900: #0e2230;      /* brand navy */
  --navy-950: #071520;
  --navy: var(--navy-900);
  --navy-line: rgba(255, 255, 255, .08);
  --navy-line-strong: rgba(255, 255, 255, .14);

  /* cyan: actions, links on dark, focus */
  --cyan-50: #f0fbfe;
  --cyan-100: #dff6fd;
  --cyan-200: #b8ebf9;
  --cyan-300: #7adbf5;
  --cyan-400: #2cc6ef;      /* brand cyan */
  --cyan-500: #47d0f3;      /* hover on cyan buttons (lighter, keeps navy text legible) */
  --cyan-700: #0a6f8f;      /* cyan as text on white: 5.7:1 */
  --cyan-800: #075a74;
  --cyan: var(--cyan-400);
  --cyan-ink: var(--cyan-700);

  /* orange: attention, overdue, highlights */
  --orange-50: #fff5ee;
  --orange-100: #ffe8d7;
  --orange-200: #ffcfae;
  --orange-300: #ffad78;    /* orange as text on navy: 8.1:1 */
  --orange-400: #ff8a3d;    /* brand orange */
  --orange-500: #ff9a57;    /* hover on orange buttons */
  --orange-700: #b4500f;    /* orange as text on white: 5.1:1 */
  --orange: var(--orange-400);
  --orange-ink: var(--orange-700);

  /* success and danger */
  --green-50: #effaf5;
  --green-100: #dcf5ea;
  --green-400: #1fa971;
  --green-700: #13734c;     /* 5.6:1 on white */
  --green: var(--green-400);
  --green-ink: var(--green-700);
  --red-50: #fffafa;
  --red-100: #fde4e4;
  --red-200: #f2b9b9;
  --red-300: #f9d3d3;
  --red-400: #d64545;
  --red-700: #a72d2d;       /* 6.6:1 on white */
  --red: var(--red-400);
  --red-ink: var(--red-700);

  /* neutrals */
  --white: #ffffff;
  --gray-25: #f9fbfc;
  --gray-50: #f6f8fa;
  --gray-100: #eef2f5;
  --gray-150: #e6ecf0;
  --gray-200: #dfe5ea;
  --gray-300: #c6d0d8;
  --gray-400: #9fb0bd;
  --gray-450: #a3b0ba;
  --gray-600: #51606b;      /* muted text: 6.5:1 on white, 5.8:1 on canvas */
  --gray-700: #3a4a56;
  --gray-900: #14222c;      /* body text: 15.9:1 on white */

  /* roles */
  --ink: var(--gray-900);
  --ink-2: var(--gray-700);
  --muted: var(--gray-600);
  --line: var(--gray-200);
  --line-strong: var(--gray-300);
  --surface: var(--white);
  --surface-2: var(--gray-25);
  --canvas: var(--gray-100);
  --canvas-2: var(--gray-150);
  --on-navy: #e9f1f6;
  --on-navy-muted: #9db3c3; /* 7.3:1 on navy */
  --hairline: rgba(14, 34, 48, .06);
  --accent-rule: linear-gradient(90deg, var(--cyan) 0%, #2fd6b4 48%, var(--orange) 100%);

  /* type */
  --font: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, "Helvetica Neue", Roboto, Arial, sans-serif;
  --font-display: Bahnschrift, "DIN Alternate", "Segoe UI Variable Display", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "Cascadia Mono", "SF Mono", Menlo, Consolas, monospace;
  --text-2xs: .68rem;
  --text-xs: .78rem;
  --text-sm: .88rem;
  --text-md: .94rem;
  --text-base: 1rem;
  --text-lg: 1.15rem;
  --text-xl: 1.35rem;
  --text-2xl: clamp(1.6rem, 1.2rem + 1.2vw, 2.1rem);
  --text-figure: clamp(1.9rem, 1.4rem + 1.6vw, 2.6rem);
  --text-kpi: clamp(1.7rem, 1.3rem + 1.2vw, 2.3rem);
  --text-hero: clamp(2rem, 1.5rem + 1.6vw, 2.75rem);
  --tracking-caps: .08em;

  /* space */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-7: 32px;
  --sp-8: 44px;
  --gutter: clamp(18px, 3vw, 44px);

  /* shape */
  --r-xs: 6px;
  --r-sm: 8px;
  --r-md: 11px;
  --r: 12px;
  --r-lg: 18px;
  --r-xl: 22px;
  --r-pill: 999px;

  /* depth */
  --shadow-1: 0 1px 2px rgba(14, 34, 48, .06), 0 1px 1px rgba(14, 34, 48, .04);
  --shadow-2: 0 2px 4px rgba(14, 34, 48, .05), 0 8px 24px -6px rgba(14, 34, 48, .12);
  --shadow-3: 0 4px 8px rgba(14, 34, 48, .06), 0 20px 48px -12px rgba(14, 34, 48, .28);
  --shadow-cyan: 0 1px 2px rgba(10, 111, 143, .25), 0 6px 16px -6px rgba(44, 198, 239, .7);
  --shadow-cyan-hi: 0 2px 4px rgba(10, 111, 143, .25), 0 10px 22px -6px rgba(44, 198, 239, .8);
  --shadow-navy: 0 6px 16px -8px rgba(14, 34, 48, .6);
  --ring: 0 0 0 3px var(--surface), 0 0 0 6px var(--cyan-ink);
  --ring-soft: 0 0 0 4px rgba(44, 198, 239, .28);

  /* motion */
  --fast: 150ms;
  --med: 220ms;
  --slow: 250ms;
  --enter: 320ms;
  --ease: cubic-bezier(.2, .7, .2, 1);
  --spring: cubic-bezier(.34, 1.56, .64, 1);

  /* layout */
  --sidebar-w: 256px;
  --tap: 48px;
  --page-max: 1280px;

  /* the signal-arc motif: four arcs from the bottom-left corner, cyan fading into orange */
  --arcs: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 240 240' fill='none' stroke-linecap='round'%3E%3Cpath d='M0 180a60 60 0 0 1 60 60' stroke='%232cc6ef' stroke-width='7'/%3E%3Cpath d='M0 130a110 110 0 0 1 110 110' stroke='%232cc6ef' stroke-width='6' stroke-opacity='.7'/%3E%3Cpath d='M0 80a160 160 0 0 1 160 160' stroke='%232cc6ef' stroke-width='5' stroke-opacity='.45'/%3E%3Cpath d='M0 30a210 210 0 0 1 210 210' stroke='%23ff8a3d' stroke-width='4' stroke-opacity='.6'/%3E%3C/svg%3E");
  --arcs-soft: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 240 240' fill='none' stroke-linecap='round'%3E%3Cpath d='M0 180a60 60 0 0 1 60 60' stroke='%232cc6ef' stroke-width='6' stroke-opacity='.4'/%3E%3Cpath d='M0 130a110 110 0 0 1 110 110' stroke='%232cc6ef' stroke-width='5' stroke-opacity='.28'/%3E%3Cpath d='M0 80a160 160 0 0 1 160 160' stroke='%232cc6ef' stroke-width='4' stroke-opacity='.18'/%3E%3Cpath d='M0 30a210 210 0 0 1 210 210' stroke='%23ff8a3d' stroke-width='3.5' stroke-opacity='.3'/%3E%3C/svg%3E");
  --arcs-top-right: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 240 240' fill='none' stroke-linecap='round'%3E%3Cpath d='M240 60A60 60 0 0 1 180 0' stroke='%232cc6ef' stroke-width='5' stroke-opacity='.5'/%3E%3Cpath d='M240 110A110 110 0 0 1 130 0' stroke='%232cc6ef' stroke-width='4' stroke-opacity='.35'/%3E%3Cpath d='M240 160A160 160 0 0 1 80 0' stroke='%232cc6ef' stroke-width='3.5' stroke-opacity='.22'/%3E%3Cpath d='M240 210A210 210 0 0 1 30 0' stroke='%23ff8a3d' stroke-width='3' stroke-opacity='.4'/%3E%3C/svg%3E");
  --grid-lines: linear-gradient(rgba(255, 255, 255, .035) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, .035) 1px, transparent 1px);
  --select-arrow: linear-gradient(45deg, transparent 50%, var(--ink-2) 50%), linear-gradient(-45deg, transparent 50%, var(--ink-2) 50%);
}

/* =========================================================================================================
   2. Reset and base
   ========================================================================================================= */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  font: 400 17px/1.5 var(--font);
  color: var(--ink);
  background: var(--canvas);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img, svg { display: block; max-width: 100%; }
h1, h2, h3, h4 { margin: 0; line-height: 1.2; font-family: var(--font-display); font-weight: 600; letter-spacing: -.005em; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.06rem; }
p { margin: 0 0 .75em; }
p:last-child { margin-bottom: 0; }
a { color: var(--cyan-ink); text-underline-offset: .18em; text-decoration-thickness: 1px; transition: color var(--fast) var(--ease); }
a:hover { text-decoration-thickness: 2px; }
strong { font-weight: 650; }
code, .mono { font-family: var(--font-mono); font-size: .9em; }
pre { margin: 0; }
ul, ol { padding-left: 1.25em; }
button, input, select, textarea { font: inherit; color: inherit; }
::selection { background: var(--cyan-100); color: var(--navy); }
[hidden] { display: none !important; }

:focus { outline: none; }
:focus-visible { outline: 3px solid var(--cyan-ink); outline-offset: 2px; border-radius: 4px; }
.sidebar :focus-visible, .auth-brand :focus-visible, .dash-group--hero :focus-visible { outline-color: var(--cyan); }

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: var(--sp-3); top: -60px; z-index: 100;
  background: var(--cyan); color: var(--navy); font-weight: 650;
  padding: 10px var(--sp-4); border-radius: var(--r-sm); text-decoration: none;
  transition: top var(--fast) var(--ease);
}
.skip-link:focus { top: var(--sp-3); }

.muted { color: var(--muted); }
.small { font-size: var(--text-sm); }
.lede { color: var(--ink-2); font-size: 1.02rem; }
.nowrap { white-space: nowrap; }
.clip { max-width: 46ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--text-sm); }
.num, .money { font-variant-numeric: tabular-nums lining-nums; white-space: nowrap; }
td.num, th.num { text-align: right; }
.neg { color: var(--red-ink); font-weight: 650; }
.figure {
  font-family: var(--font-display);
  font-size: var(--text-figure);
  font-weight: 600; line-height: 1.05; letter-spacing: -.02em;
  font-variant-numeric: tabular-nums lining-nums;
}
.figure--attention { color: var(--orange-ink); }
.eyebrow {
  margin: 0 0 var(--sp-1); font-size: var(--text-xs); font-weight: 650; letter-spacing: .09em; text-transform: uppercase;
  color: var(--muted);
}
.eyebrow a { color: var(--cyan-ink); text-decoration: none; }
.eyebrow a:hover { text-decoration: underline; }

/* =========================================================================================================
   3. Motion primitives (transform-only entries; see the rules at the top)
   ========================================================================================================= */
@keyframes rise { from { transform: translateY(8px); } to { transform: none; } }
@keyframes rise-sm { from { transform: translateY(5px); } to { transform: none; } }
@keyframes drop-in { from { transform: translateY(-6px) scale(.985); } to { transform: none; } }
@keyframes pop-in { from { transform: translateY(12px) scale(.97); } to { transform: none; } }
@keyframes nudge { 0% { transform: translateX(0); } 25% { transform: translateX(-4px); } 50% { transform: translateX(3px); } 75% { transform: translateX(-1px); } 100% { transform: none; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(8px); } }
@keyframes deco-signal { 0% { opacity: 0; transform: scale(.6); } 40% { opacity: 1; } 100% { opacity: 0; transform: scale(1.25); } }
@keyframes deco-sweep { from { background-position: -120% 0; } to { background-position: 220% 0; } }
@keyframes deco-drift { from { transform: translate(0, 0) scale(1); } to { transform: translate(90px, 60px) scale(1.15); } }

.reveal { animation: drop-in var(--enter) var(--spring); }
.fx-enter { animation: rise-sm var(--med) var(--ease); }

/* =========================================================================================================
   4. Top loading bar (any htmx request in flight)
   ========================================================================================================= */
.loadbar {
  position: fixed; inset: 0 0 auto 0; height: 3px; z-index: 90; pointer-events: none;
  background: linear-gradient(90deg, transparent, var(--cyan) 30%, var(--orange) 70%, transparent);
  background-size: 50% 100%; background-repeat: no-repeat;
  opacity: 0; transition: opacity var(--med) var(--ease);
}
html.is-busy .loadbar { opacity: 1; animation: loadbar 1.1s linear infinite; }
@keyframes loadbar { from { background-position: -50% 0; } to { background-position: 150% 0; } }

/* =========================================================================================================
   5. Shell: navy sidebar, header band, page
   ========================================================================================================= */
.shell { min-height: 100vh; min-height: 100dvh; display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); }

.sidebar {
  position: sticky; top: 0; height: 100vh; height: 100dvh; z-index: 30;
  display: flex; flex-direction: column; gap: 6px;
  padding: 18px 14px 14px;
  color: var(--on-navy);
  background:
    var(--arcs-soft) left -34px bottom 64px / 230px 230px no-repeat,
    radial-gradient(120% 60% at 0% 0%, rgba(44, 198, 239, .10), transparent 60%),
    radial-gradient(90% 40% at 100% 100%, rgba(255, 138, 61, .08), transparent 60%),
    var(--navy);
  box-shadow: inset -1px 0 0 var(--navy-line);
  overflow-y: auto;
}
.sidebar::after {             /* thin accent rule down the inner edge */
  content: ""; position: absolute; top: 0; right: 0; bottom: 0; width: 2px; pointer-events: none;
  background: linear-gradient(180deg, var(--cyan), rgba(44, 198, 239, .1) 40%, rgba(255, 138, 61, .1) 70%, var(--orange));
  opacity: .55;
}

.brand {
  position: relative; display: flex; align-items: center; gap: 10px;
  padding: 6px 8px 16px; margin-bottom: 6px;
  color: var(--white); text-decoration: none;
  border-bottom: 1px solid var(--navy-line);
}
.brand-mark { position: relative; flex: none; display: grid; place-items: center; }
/* The logo is drawn on black; "lighten" lets the navy show through the black.
   Show only the shield: crop off the wordmark under it (the name is set in type beside it). */
.brand-logo { width: 46px; height: 32px; object-fit: cover; object-position: 50% 4%; mix-blend-mode: lighten; transition: transform var(--med) var(--spring); }
.brand:hover .brand-logo { transform: rotate(-6deg) scale(1.06); }
.brand-signal {               /* signal arcs that ripple off the shield now and then */
  position: absolute; right: -10px; top: -8px; width: 26px; height: 26px; pointer-events: none;
  background: var(--arcs) center / contain no-repeat; transform-origin: 0 100%;
  animation: deco-signal 3.6s var(--ease) 1.2s infinite;
}
.brand-name { font-family: var(--font-display); font-size: 1.12rem; font-weight: 600; letter-spacing: .02em; line-height: 1.1; }
.brand-accent { color: var(--cyan); }

.nav-toggle { display: none; }
.nav-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.nav-link {
  position: relative; display: flex; align-items: center; gap: var(--sp-3);
  min-height: var(--tap); padding: 10px var(--sp-3);
  border-radius: var(--r);
  color: var(--on-navy-muted); text-decoration: none; font-weight: 550;
  transition: background-color var(--fast) var(--ease), color var(--fast) var(--ease);
}
.nav-icon { width: 22px; height: 22px; flex: none; transition: transform var(--med) var(--spring), color var(--fast) var(--ease); }
.nav-link::before {      /* active indicator bar */
  content: ""; position: absolute; left: -14px; top: 10px; bottom: 10px; width: 4px;
  border-radius: 0 4px 4px 0; background: var(--cyan);
  box-shadow: 0 0 12px rgba(44, 198, 239, .7);
  transform: scaleY(0); transition: transform var(--med) var(--spring);
}
.nav-link:hover { color: var(--white); background: rgba(255, 255, 255, .06); }
.nav-link:hover .nav-icon { transform: translateX(2px); }
.nav-link[aria-current="page"] {
  color: var(--white);
  background: linear-gradient(90deg, rgba(44, 198, 239, .20), rgba(44, 198, 239, .04));
  box-shadow: inset 0 0 0 1px rgba(44, 198, 239, .22);
}
.nav-link[aria-current="page"]::before { transform: scaleY(1); }
.nav-link[aria-current="page"] .nav-icon { color: var(--cyan); }

.nav-tools {
  margin-top: auto; padding-top: var(--sp-3); border-top: 1px solid var(--navy-line);
  display: grid; gap: 2px;
}
.tool-link {
  display: flex; align-items: center; gap: 10px; min-height: 40px; padding: var(--sp-2) var(--sp-3);
  border-radius: var(--r-sm); color: var(--on-navy-muted); text-decoration: none; font-size: .92rem;
  transition: background-color var(--fast) var(--ease), color var(--fast) var(--ease);
}
.tool-link .icon { width: 18px; height: 18px; }
.tool-link:hover, .tool-link[aria-current="page"] { color: var(--white); background: rgba(255, 255, 255, .06); }

.me {
  display: flex; align-items: center; gap: 10px;
  margin-top: var(--sp-2); padding: 10px; border-radius: var(--r);
  background: rgba(0, 0, 0, .18); box-shadow: inset 0 0 0 1px var(--navy-line);
}
.shell--contractor .nav-tools + .me, .shell--contractor .me { margin-top: auto; }
.me-avatar {
  flex: none; display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%;
  font-family: var(--font-display); font-weight: 600; font-size: .95rem; color: var(--navy);
  background: linear-gradient(135deg, var(--orange), var(--orange-300));
  box-shadow: 0 0 0 2px var(--navy), 0 0 0 4px rgba(255, 138, 61, .45);
}
.me-text { min-width: 0; display: grid; line-height: 1.25; }
.me-name { color: var(--white); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-role { color: var(--on-navy-muted); font-size: .82rem; }
.me-out { margin-left: auto; }
.btn-icon {
  display: grid; place-items: center; width: 40px; height: 40px; border: 0; border-radius: 10px;
  background: transparent; color: var(--on-navy-muted); cursor: pointer;
  transition: background-color var(--fast) var(--ease), color var(--fast) var(--ease), transform var(--fast) var(--ease);
}
.btn-icon .icon { width: 20px; height: 20px; }
.btn-icon:hover { color: var(--orange); background: rgba(255, 138, 61, .12); }
.btn-icon:active { transform: scale(.94); }

/* main column and the page header band */
.main-col { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: relative; isolation: isolate;
  display: flex; align-items: flex-end; justify-content: space-between; gap: var(--sp-4); flex-wrap: wrap;
  margin-bottom: var(--sp-6);
  padding: 30px var(--gutter) 20px;
  background:
    var(--arcs-top-right) right -24px top -36px / 170px 170px no-repeat,
    linear-gradient(180deg, var(--surface), var(--surface-2));
  box-shadow: 0 1px 0 var(--hairline);
}
.topbar::after {             /* the cyan-to-orange accent rule under the header */
  content: ""; position: absolute; left: var(--gutter); bottom: -1px; width: min(280px, 40%); height: 3px;
  border-radius: 3px; background: var(--accent-rule);
}
.topbar-title { min-width: 0; }
.topbar .eyebrow { color: var(--cyan-ink); }
.page-title { font-size: var(--text-2xl); font-weight: 600; letter-spacing: -.015em; color: var(--navy); }
.topbar-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.page {
  flex: 1; width: 100%; max-width: var(--page-max);
  padding: 0 var(--gutter) 48px;
  display: flex; flex-direction: column; gap: var(--sp-5);
  animation: rise var(--enter) var(--ease);
}
.page:focus { outline: none; }

/* =========================================================================================================
   6. Cards and KPI cards
   ========================================================================================================= */
.card {
  position: relative; background: var(--surface); border-radius: var(--r-lg);
  box-shadow: var(--shadow-2); border: 1px solid var(--hairline);
  transition: box-shadow var(--med) var(--ease), transform var(--med) var(--ease);
}
.card-head { padding: var(--sp-5) var(--sp-6) 0; }
.card-title { font-size: var(--text-lg); font-weight: 600; font-family: var(--font-display); margin-bottom: 2px; color: var(--navy); }
.card-sub { color: var(--muted); font-size: var(--text-md); margin: 2px 0 0; }
.card-body { padding: 18px var(--sp-6) 22px; }
.card-head + .card-body { padding-top: 14px; }
.card--attention { box-shadow: var(--shadow-2), inset 4px 0 0 var(--orange); background: linear-gradient(90deg, var(--orange-50), var(--surface) 40%); }
.card--quiet { box-shadow: none; background: transparent; border: 1px dashed var(--line-strong); }
.card--link:hover { transform: translateY(-2px); box-shadow: var(--shadow-3); }
.page > .card + .card, .job-main > .card + .card, .job-side > .card + .card,
.week-form > .card + .card, .week-side > * + * { margin-top: var(--sp-5); }

.stats { display: grid; gap: var(--sp-4); grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.stat { padding: 18px 22px; }
.stat-label { color: var(--muted); font-size: .9rem; font-weight: 550; margin-bottom: 6px; }

/* =========================================================================================================
   7. Buttons
   ========================================================================================================= */
.btn {
  --bg: var(--surface); --fg: var(--ink); --bd: var(--line-strong);
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
  min-height: 44px; padding: 9px 18px;
  border: 1px solid var(--bd); border-radius: var(--r-md);
  background: var(--bg); color: var(--fg);
  font-weight: 600; line-height: 1.2; text-decoration: none; white-space: nowrap; cursor: pointer;
  box-shadow: var(--shadow-1);
  transition: transform var(--fast) var(--ease), box-shadow var(--fast) var(--ease),
              background-color var(--fast) var(--ease), border-color var(--fast) var(--ease), color var(--fast) var(--ease);
}
.btn .icon { width: 19px; height: 19px; flex: none; transition: transform var(--med) var(--spring); }
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-2); text-decoration: none; }
.btn:hover .icon:last-child:not(:first-child) { transform: translateX(3px); }
.btn:active { transform: translateY(0) scale(.98); box-shadow: var(--shadow-1); }
.btn:focus-visible { outline: none; box-shadow: var(--ring); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .6; cursor: not-allowed; transform: none; box-shadow: none; }
.btn--primary { --bg: var(--cyan); --fg: var(--navy); --bd: transparent; box-shadow: var(--shadow-cyan); }
.btn--primary:hover { --bg: var(--cyan-500); box-shadow: var(--shadow-cyan-hi); }
.btn--secondary { --bg: var(--navy); --fg: var(--on-navy); --bd: transparent; box-shadow: var(--shadow-navy); }
.btn--secondary:hover { --bg: var(--navy-700); }
.btn--attention { --bg: var(--orange); --fg: var(--navy); --bd: transparent; }
.btn--attention:hover { --bg: var(--orange-500); }
.btn--danger { --bg: var(--surface); --fg: var(--red-ink); --bd: var(--red-200); }
.btn--danger:hover { --bg: var(--red-100); }
.btn--danger-quiet { --bg: transparent; --fg: var(--red-ink); --bd: transparent; box-shadow: none; }
.btn--danger-quiet:hover { --bg: var(--red-100); box-shadow: none; }
.btn--quiet { --bg: var(--surface); --fg: var(--ink); }
.btn--quiet:hover { --bd: var(--cyan-ink); }
.btn--ghost { --bg: transparent; --fg: var(--cyan-ink); --bd: transparent; box-shadow: none; }
.btn--ghost:hover { --bg: var(--cyan-50); box-shadow: none; }
.btn--sm { min-height: 36px; padding: 6px var(--sp-3); font-size: .92rem; border-radius: 9px; }
.btn--lg { min-height: 54px; padding: var(--sp-3) 22px; font-size: 1.06rem; }
.btn--block { width: 100%; }

/* loading: a plain form while it posts (app.js adds .is-busy), an htmx form whose button htmx disabled for the
   request (hx-disabled-elt), or a button that made the request itself. A live preview (the week form) never spins. */
.btn.is-busy, form.htmx-request .btn[type="submit"][disabled], .btn.htmx-request { pointer-events: none; }
.btn.is-busy::after, form.htmx-request .btn[type="submit"][disabled]::after, .btn.htmx-request::after {
  content: ""; width: 16px; height: 16px; flex: none; border-radius: 50%;
  border: 2px solid currentColor; border-right-color: transparent;
  animation: spin .7s linear infinite;
}
form.htmx-request .btn[type="submit"][disabled] { opacity: .85; }

.link-button {
  border: 0; background: none; padding: var(--sp-2) 0; cursor: pointer; color: var(--cyan-ink);
  text-decoration: underline; text-underline-offset: .18em; min-height: 44px;
}
.btn-ghost {
  display: inline-grid; place-items: center; width: 32px; height: 32px; flex: none; border: 0; border-radius: var(--r-sm);
  background: transparent; color: var(--muted); cursor: pointer; opacity: .6;
  transition: opacity var(--fast) var(--ease), background-color var(--fast) var(--ease), color var(--fast) var(--ease);
}
.btn-ghost .icon { width: 18px; height: 18px; }
.btn-ghost:hover { background: var(--canvas); color: var(--ink); opacity: 1; }
.btn-ghost:focus-visible { opacity: 1; }
.button-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.inline-form { display: inline; margin: 0; }
.row-actions { text-align: right; white-space: nowrap; }
.row-actions .inline-form + .inline-form { margin-left: 6px; }

/* =========================================================================================================
   8. Forms: inputs, selects, textareas, dates, money with the $ prefix, chips and segmented controls
   ========================================================================================================= */
.form { display: grid; gap: var(--sp-4); }
.form--grid { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); align-items: start; }
.form--filters { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); align-items: end; }
.form-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; min-height: 100%; }
.form--grid .form-actions { grid-column: 1 / -1; }
.form--filters .form-actions { min-height: 0; }
.form-foot { margin-top: 10px; text-align: center; }
.field { display: grid; gap: 6px; min-width: 0; align-content: start; }
.field--wide { grid-column: 1 / -1; }
.field-label { font-weight: 600; font-size: .95rem; color: var(--ink-2); }
.field-hint { margin: 0; font-size: var(--text-sm); color: var(--muted); }
.field-error { margin: 0; display: flex; align-items: flex-start; gap: 6px; font-size: .92rem; font-weight: 550; color: var(--red-ink); animation: nudge var(--enter) var(--ease); }
.field-error .icon { width: 18px; height: 18px; flex: none; margin-top: 2px; }
.input {
  width: 100%; min-height: 48px; padding: 10px 14px;
  border: 1.5px solid var(--line-strong); border-radius: var(--r-md);
  background: var(--surface); color: var(--ink);
  transition: border-color var(--fast) var(--ease), box-shadow var(--fast) var(--ease), background-color var(--fast) var(--ease);
}
.input::placeholder { color: #6b7883; }   /* 4.6:1 on white */
.input:hover { border-color: var(--gray-400); }
.input:focus, .input:focus-visible { outline: none; border-color: var(--cyan-ink); box-shadow: var(--ring-soft); }
.input[aria-invalid="true"] { border-color: var(--red); background: var(--red-50); }
.input[aria-invalid="true"]:focus { box-shadow: 0 0 0 4px rgba(214, 69, 69, .2); }
.input[disabled], .input[readonly] { background: var(--canvas); color: var(--ink-2); }
select.input {
  appearance: none; padding-right: 42px; cursor: pointer;
  background-image: var(--select-arrow);
  background-position: right 20px center, right 14px center; background-size: 6px 6px; background-repeat: no-repeat;
}
.input--date { font-variant-numeric: tabular-nums; }
.input--date::-webkit-calendar-picker-indicator { cursor: pointer; opacity: .7; transition: opacity var(--fast) var(--ease); }
.input--date:hover::-webkit-calendar-picker-indicator { opacity: 1; }
input[type="file"].input { padding: 9px 10px; }
input[type="file"].input::file-selector-button {
  margin-right: var(--sp-3); padding: 6px 12px; border: 0; border-radius: var(--r-sm);
  background: var(--navy); color: var(--on-navy); font-weight: 600; cursor: pointer;
}
.input--code { font-family: var(--font-mono); font-size: 1.25rem; letter-spacing: .2em; text-align: center; }
.textarea { min-height: 0; resize: vertical; line-height: 1.45; }
.textarea--big { font-size: 1.05rem; min-height: 180px; }

.money-box { position: relative; }
.money-prefix {
  position: absolute; left: 1.5px; top: 1.5px; bottom: 1.5px; width: 40px;
  display: grid; place-items: center; border-radius: 9.5px 0 0 9.5px;
  color: var(--muted); font-weight: 650; background: var(--canvas); border-right: 1.5px solid var(--line);
  pointer-events: none; transition: color var(--fast) var(--ease), background-color var(--fast) var(--ease), border-color var(--fast) var(--ease);
}
.input--money { padding-left: 52px; text-align: right; font-variant-numeric: tabular-nums lining-nums; font-size: 1.08rem; font-weight: 600; }
.money-box:focus-within .money-prefix { color: var(--cyan-ink); background: var(--cyan-50); border-right-color: var(--cyan-200); }

.check-row { display: flex; align-items: center; gap: 10px; min-height: 48px; grid-column: 1 / -1; font-weight: 550; }
.check-row input, .check-label input, .field--check input { width: 20px; height: 20px; accent-color: var(--cyan-ink); }
.check-label { display: flex; align-items: center; gap: 10px; min-height: 44px; }

/* chips: one-of-many links (period on the dashboard) */
.chips { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.chip {
  display: inline-flex; align-items: center; min-height: 40px; padding: 6px var(--sp-4); border-radius: var(--r-pill);
  background: var(--canvas); color: var(--ink-2); font-weight: 600; text-decoration: none;
  box-shadow: inset 0 0 0 1px transparent;
  transition: background-color var(--fast) var(--ease), color var(--fast) var(--ease), box-shadow var(--fast) var(--ease), transform var(--med) var(--spring);
}
.chip:hover { background: var(--cyan-100); color: var(--ink); text-decoration: none; transform: translateY(-1px); }
.chip.is-active { background: var(--navy); color: var(--on-navy); box-shadow: var(--shadow-navy); }
.chip.is-active::before { content: ""; width: 7px; height: 7px; margin-right: 8px; border-radius: 50%; background: var(--cyan); }

/* segmented: radio buttons drawn as one control */
.segmented { border: 0; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.segmented legend { margin-bottom: var(--sp-2); padding: 0; }
.segment { position: relative; }
.segment input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.segment span {
  display: inline-flex; align-items: center; min-height: 44px; padding: var(--sp-2) var(--sp-4); border-radius: var(--r-pill);
  border: 1.5px solid var(--line-strong); background: var(--surface); font-weight: 550;
  transition: background-color var(--fast) var(--ease), border-color var(--fast) var(--ease), color var(--fast) var(--ease), transform var(--fast) var(--spring);
}
.segment:hover span { border-color: var(--cyan-ink); }
.segment input:checked + span { background: var(--navy); border-color: var(--navy); color: var(--on-navy); transform: scale(1.04); }
.segment input:checked + span::before { content: ""; width: 7px; height: 7px; margin-right: 8px; border-radius: 50%; background: var(--cyan); }
.segment input:focus-visible + span { box-shadow: var(--ring); }

/* sub navigation (Money tabs) */
.subnav {
  display: flex; gap: 6px; margin: 0 0 18px; padding: var(--sp-1); border-radius: 14px; background: var(--surface);
  box-shadow: var(--shadow-1); width: fit-content; max-width: 100%; overflow-x: auto; scrollbar-width: none;
}
.subnav::-webkit-scrollbar { display: none; }
.subnav-link {
  display: inline-flex; align-items: center; min-height: 40px; padding: 6px var(--sp-4); border-radius: 10px; white-space: nowrap;
  font-weight: 600; color: var(--muted); text-decoration: none;
  transition: background-color var(--fast) var(--ease), color var(--fast) var(--ease);
}
.subnav-link:hover { color: var(--ink); background: var(--canvas); text-decoration: none; }
.subnav-link.is-active { background: var(--navy); color: var(--on-navy); box-shadow: inset 0 -2px 0 var(--cyan); }

/* "more" disclosure */
.more { margin-top: var(--sp-1); }
.more-toggle {
  display: inline-flex; align-items: center; gap: var(--sp-2); min-height: 44px; cursor: pointer; list-style: none;
  color: var(--cyan-ink); font-weight: 600; border-radius: var(--r-sm);
}
.more-toggle:hover { text-decoration: underline; text-underline-offset: .18em; }
.more-toggle::-webkit-details-marker { display: none; }
.more-toggle .icon { width: 20px; height: 20px; transition: transform var(--med) var(--spring); }
.more[open] > .more-toggle .icon { transform: rotate(45deg); }
.more[open] > :not(summary) { animation: rise-sm var(--med) var(--ease); margin-top: var(--sp-3); }

/* =========================================================================================================
   9. Status pills: colour plus a shape for each state, so colour is never the only cue
   ========================================================================================================= */
.pill {
  --pbg: var(--canvas-2); --pfg: var(--ink-2); --pdot: var(--muted);
  display: inline-flex; align-items: center; gap: 7px; padding: 3px 11px 3px 8px;
  border-radius: var(--r-pill); background: var(--pbg); color: var(--pfg);
  font-size: .84rem; font-weight: 650; line-height: 1.5; white-space: nowrap; vertical-align: middle;
}
.pill-dot {
  position: relative; flex: none; width: 10px; height: 10px; border-radius: 50%;
  background: var(--pdot) center / 100% 100% no-repeat;
}
/* plain tones */
.pill--neutral { --pdot: var(--gray-600); }
.pill--info { --pbg: var(--cyan-100); --pfg: var(--cyan-800); --pdot: var(--cyan-ink); }
.pill--ok { --pbg: var(--green-100); --pfg: var(--green-ink); --pdot: var(--green); }
.pill--due { --pbg: var(--orange-50); --pfg: var(--orange-ink); --pdot: var(--orange); box-shadow: inset 0 0 0 1px var(--orange-100); }
.pill--muted { --pbg: var(--canvas); --pfg: var(--muted); --pdot: var(--gray-450); }

/* draft: an empty ring, dashed outline */
.pill--draft { --pbg: transparent; --pfg: var(--muted); box-shadow: inset 0 0 0 1.5px var(--line-strong); }
.pill--draft .pill-dot { background: transparent; box-shadow: inset 0 0 0 2px var(--gray-450); }
/* accepted: a solid cyan dot with a halo */
.pill--accepted { --pbg: var(--cyan-100); --pfg: var(--cyan-800); --pdot: var(--cyan-ink); }
.pill--accepted .pill-dot { box-shadow: 0 0 0 2.5px rgba(10, 111, 143, .2); }
/* confirmed: navy with a tick */
.pill--confirmed { --pbg: var(--navy-50); --pfg: var(--navy-800); --pdot: var(--navy-700); box-shadow: inset 0 0 0 1px var(--navy-100); }
/* issued: sent, an arrow */
.pill--issued { --pbg: var(--cyan-50); --pfg: var(--cyan-800); --pdot: var(--cyan-ink); box-shadow: inset 0 0 0 1px var(--cyan-200); }
/* submitted (bills waiting to be paid): a clock */
.pill--submitted { --pbg: var(--orange-50); --pfg: var(--orange-ink); --pdot: var(--orange-ink); box-shadow: inset 0 0 0 1px var(--orange-100); }
/* partly paid: a half-filled dot */
.pill--partly { --pbg: var(--cyan-100); --pfg: var(--cyan-800); }
.pill--partly .pill-dot { background: linear-gradient(90deg, var(--green) 50%, transparent 50%); box-shadow: inset 0 0 0 2px var(--green); }
/* paid: green with a tick */
.pill--paid { --pbg: var(--green-100); --pfg: var(--green-ink); --pdot: var(--green-ink); }
/* overdue: solid orange, an exclamation mark, a slow pulse */
.pill--overdue { --pbg: var(--orange); --pfg: var(--navy); --pdot: var(--navy); }
.pill--overdue .pill-dot { animation: pulse 1.8s var(--ease) infinite; }
/* void: a struck-through circle, struck-through label */
.pill--void { --pbg: var(--canvas); --pfg: var(--muted); --pdot: var(--gray-600); text-decoration: line-through; text-decoration-color: rgba(81, 96, 107, .55); }
/* provisional: striped dot, dashed orange outline */
.pill--provisional { --pbg: var(--orange-50); --pfg: var(--orange-ink); box-shadow: inset 0 0 0 1.5px var(--orange-200); }
.pill--provisional .pill-dot { background: repeating-linear-gradient(135deg, var(--orange-ink) 0 2px, transparent 2px 4px); box-shadow: inset 0 0 0 1.5px var(--orange-ink); }

/* glyphs inside the dot, drawn as small white SVGs */
.pill--confirmed .pill-dot, .pill--paid .pill-dot, .pill--ok .pill-dot { width: 14px; height: 14px; background-size: 10px 10px; }
.pill--confirmed .pill-dot, .pill--paid .pill-dot {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' fill='none' stroke='%23fff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2.5 6.3l2.3 2.3 4.7-5'/%3E%3C/svg%3E");
}
.pill--issued .pill-dot, .pill--submitted .pill-dot, .pill--overdue .pill-dot, .pill--void .pill-dot { width: 14px; height: 14px; background-size: 10px 10px; }
.pill--issued .pill-dot {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' fill='none' stroke='%23fff' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2.5 6h6.5M6.5 3.3L9.2 6 6.5 8.7'/%3E%3C/svg%3E");
}
.pill--submitted .pill-dot {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' fill='none' stroke='%23fff' stroke-width='1.7' stroke-linecap='round'%3E%3Cpath d='M6 3v3.2l2 1.3'/%3E%3C/svg%3E");
}
.pill--overdue .pill-dot {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' fill='none' stroke='%23ff8a3d' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M6 2.6v4M6 9.2v.1'/%3E%3C/svg%3E");
}
.pill--void .pill-dot {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' fill='none' stroke='%23fff' stroke-width='1.8' stroke-linecap='round'%3E%3Cpath d='M3 9l6-6'/%3E%3C/svg%3E");
}
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(14, 34, 48, .55); } 70% { box-shadow: 0 0 0 7px rgba(14, 34, 48, 0); } 100% { box-shadow: 0 0 0 0 rgba(14, 34, 48, 0); } }

.tag {
  display: inline-flex; align-items: center; gap: 5px; padding: 1px var(--sp-2); border-radius: var(--r-pill);
  font-size: .76rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; vertical-align: 1px;
}
.tag--provisional { background: var(--orange-100); color: var(--orange-ink); box-shadow: inset 0 0 0 1px rgba(255, 138, 61, .35); }
.tag--provisional::before {
  content: ""; width: 8px; height: 8px; border-radius: 50%;
  background: repeating-linear-gradient(135deg, var(--orange-ink) 0 2px, transparent 2px 4px); box-shadow: inset 0 0 0 1.5px var(--orange-ink);
}
.tag--tiny { font-size: var(--text-2xs); padding: 0 6px; }

/* =========================================================================================================
   10. Tables: sticky header, quiet zebra, hover, numbers right, stacked cards on phones (app.js labels cells)
   ========================================================================================================= */
.table-wrap { overflow-x: auto; margin: 0 calc(var(--sp-6) * -1); padding: 0 var(--sp-6); -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: .98rem; }
.table th {
  text-align: left; font-size: var(--text-xs); font-weight: 700; letter-spacing: .07em; text-transform: uppercase;
  color: var(--muted); padding: var(--sp-2) var(--sp-3) 10px; border-bottom: 1.5px solid var(--line); white-space: nowrap;
  background: var(--surface);
}
.table td { padding: var(--sp-3); border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr { transition: background-color var(--fast) var(--ease); }
.table tbody tr:nth-child(even) { background: var(--surface-2); }
.table tbody tr:hover { background: var(--cyan-50); }
.table tbody tr:last-child td { border-bottom: 0; }
.table th:first-child, .table td:first-child { padding-left: var(--sp-2); }
.table th:last-child, .table td:last-child { padding-right: var(--sp-2); }
.table .num { text-align: right; }
.table td.money { font-weight: 600; }
.table td a:not(.btn) { font-weight: 600; }
.table--dense td { padding: var(--sp-2) 10px; font-size: .9rem; vertical-align: top; }
.row--muted td { color: var(--muted); }
.table tbody tr.row--overdue { background: var(--orange-50); }
.row--overdue td:first-child { box-shadow: inset 3px 0 0 var(--orange); }
.row-link { cursor: pointer; }
.json { font-family: var(--font-mono); font-size: var(--text-xs); max-width: 340px; white-space: pre-wrap; word-break: break-word; color: var(--ink-2); }
.table-note { margin-top: var(--sp-3); font-size: .9rem; }

/* On wide screens the header sticks to the top of the window while a long list scrolls. */
@media (min-width: 1100px) {
  .table-wrap:not(:has(.table--dense)) { overflow: visible; }
  .table-wrap:not(:has(.table--dense)) .table thead th { position: sticky; top: 0; z-index: 2; box-shadow: 0 1.5px 0 var(--line); }
}

/* Phones: each row becomes a small card; app.js copies the column name into data-label. */
@media (max-width: 640px) {
  .table-wrap:has(.table.is-labelled) { overflow: visible; margin: 0; padding: 0; }
  .table.is-labelled thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .table.is-labelled, .table.is-labelled tbody { display: block; }
  .table.is-labelled tbody { display: grid; gap: 10px; }
  .table.is-labelled tbody tr {
    display: grid; gap: 2px; padding: 10px 14px; border-radius: var(--r); background: var(--surface);
    box-shadow: inset 0 0 0 1px var(--line);
  }
  .table.is-labelled tbody tr:nth-child(even) { background: var(--surface); }
  .table.is-labelled tbody td {
    display: flex; justify-content: space-between; align-items: baseline; gap: var(--sp-3);
    padding: 5px 0; border-bottom: 1px dashed var(--line); text-align: right; min-width: 0;
  }
  .table.is-labelled tbody td:last-child { border-bottom: 0; }
  .table.is-labelled tbody td::before {
    content: attr(data-label); flex: 0 0 auto; text-align: left; padding-right: var(--sp-2);
    font-size: var(--text-xs); font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted);
  }
  .table.is-labelled tbody td[data-label=""]::before { content: none; }
  .table.is-labelled tbody td:first-child { padding-top: 0; font-size: 1.02rem; }
  .table.is-labelled .row-actions { justify-content: flex-end; flex-wrap: wrap; white-space: normal; }
  .table.is-labelled .json { max-width: 100%; }
}

/* =========================================================================================================
   11. Alerts, flashes, toasts, confirm dialog
   ========================================================================================================= */
.alert {
  display: flex; gap: var(--sp-3); align-items: flex-start; padding: 14px 18px;
  border-radius: var(--r); border: 1px solid; animation: drop-in var(--enter) var(--spring);
}
.alert--error { background: var(--red-100); border-color: var(--red-200); color: var(--red-ink); }
.alert--lock { background: var(--orange-50); border-color: var(--orange-100); color: var(--ink); margin-bottom: var(--sp-4); box-shadow: inset 4px 0 0 var(--orange); }
.alert--lock .alert-icon { color: var(--orange-ink); }
.alert--lock p { margin: 0; }
.alert-icon { width: 22px; height: 22px; flex: none; margin-top: 1px; }
.alert-title { font-weight: 650; margin: 0 0 2px; }
.alert-list { margin: 0; padding-left: 1.1em; }

.flash {
  display: flex; align-items: center; gap: var(--sp-2); padding: 10px var(--sp-4); border-radius: var(--r); margin: 0 0 var(--sp-4);
  font-weight: 600;
}
.flash .icon { width: 20px; height: 20px; }
.flash--ok { background: var(--green-100); color: var(--green-ink); box-shadow: inset 4px 0 0 var(--green); }

.toasts {
  position: fixed; z-index: 80; right: var(--sp-5); bottom: var(--sp-5); display: grid; gap: 10px;
  width: min(420px, calc(100vw - 32px)); pointer-events: none;
}
.toast {
  pointer-events: auto; display: flex; gap: var(--sp-3); align-items: flex-start;
  padding: 14px var(--sp-4); border-radius: var(--r);
  background: var(--navy); color: var(--on-navy); box-shadow: var(--shadow-3);
  border-left: 4px solid var(--cyan);
  animation: pop-in var(--med) var(--spring);
}
.toast--error { border-left-color: var(--orange); }
.toast.is-leaving { animation: toast-out var(--med) var(--ease) both; }
.toast ul { margin: 0; padding-left: 1.1em; }

/* the confirm dialog app.js opens for data-confirm and hx-confirm (window.confirm when <dialog> is missing) */
.modal {
  width: min(440px, calc(100vw - 32px)); padding: 0; border: 0; border-radius: var(--r-lg);
  background: var(--surface); color: var(--ink); box-shadow: var(--shadow-3), 0 0 0 1px var(--hairline);
  overflow: hidden;
}
.modal[open] { animation: pop-in var(--med) var(--spring); }
.modal::backdrop { background: rgba(7, 21, 32, .55); backdrop-filter: blur(2px); }
.modal-band { height: 4px; background: var(--accent-rule); }
.modal--danger .modal-band { background: linear-gradient(90deg, var(--red), var(--orange)); }
.modal-body { display: grid; gap: var(--sp-3); padding: 22px var(--sp-6) var(--sp-5); }
.modal-icon {
  display: grid; place-items: center; width: 44px; height: 44px; border-radius: 14px;
  color: var(--cyan-ink); background: var(--cyan-100);
}
.modal--danger .modal-icon { color: var(--red-ink); background: var(--red-100); }
.modal-icon .icon { width: 24px; height: 24px; }
.modal-text { margin: 0; font-size: 1.08rem; font-weight: 600; color: var(--navy); }
.modal-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; padding: 0 var(--sp-6) 22px; }
.modal-actions .btn { min-width: 120px; min-height: var(--tap); }

/* =========================================================================================================
   12. Empty states (signal arcs behind a floating icon), skeletons, htmx states
   ========================================================================================================= */
.empty { position: relative; display: grid; justify-items: center; text-align: center; gap: 6px; padding: 30px var(--sp-4) 22px; }
.empty-art {
  position: relative; display: grid; place-items: center; width: 84px; height: 84px; margin-bottom: 10px;
  border-radius: 26px; color: var(--cyan-ink);
  background: linear-gradient(145deg, var(--cyan-100), var(--cyan-50));
  box-shadow: inset 0 0 0 1px rgba(10, 111, 143, .12), var(--shadow-1);
  animation: float 5s ease-in-out infinite;
}
.empty-art::before {        /* signal arcs radiating from the icon */
  content: ""; position: absolute; left: 58px; bottom: 54px; width: 58px; height: 58px; pointer-events: none;
  background: var(--arcs) center / contain no-repeat; transform-origin: 0 100%;
  animation: deco-signal 3.2s var(--ease) infinite;
}
.empty-art::after {
  content: ""; position: absolute; right: -5px; top: -5px; width: 16px; height: 16px; border-radius: 50%;
  background: var(--orange); box-shadow: 0 0 0 4px var(--surface);
}
.empty-art .icon { width: 38px; height: 38px; }
.empty-title { font-family: var(--font-display); font-size: 1.2rem; font-weight: 600; margin: 0; color: var(--navy); }
.empty-text { color: var(--muted); max-width: 46ch; margin: 0 0 10px; }

.skeleton { display: grid; gap: var(--sp-3); padding: 6px 0; }
.skeleton-line {
  display: block; height: 16px; border-radius: var(--r-xs);
  background: linear-gradient(90deg, var(--canvas-2) 0%, var(--gray-50) 40%, var(--canvas-2) 80%);
  background-size: 300% 100%;
  animation: shimmer 1.3s linear infinite;
}
.skeleton-line:nth-child(3n+1) { width: 92%; }
.skeleton-line:nth-child(3n+2) { width: 74%; }
.skeleton-line:nth-child(3n) { width: 58%; }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -50% 0; } }

/* includeIndicatorStyles is off (CSP), so the indicator rules live here. */
.htmx-indicator { opacity: 0; transition: opacity var(--fast) var(--ease); }
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { opacity: 1; }
.htmx-request.is-dimmed, .htmx-request .is-dimmed { opacity: .6; transition: opacity var(--fast) var(--ease); }
.htmx-swapping { opacity: .6; transition: opacity var(--fast) var(--ease); }

/* =========================================================================================================
   13. Checklist step and the done-burst
   ========================================================================================================= */
.check {
  position: relative; display: inline-grid; place-items: center; flex: none;
  width: 32px; height: 32px; border-radius: 50%;
  border: 2px solid var(--line-strong); background: var(--surface);
  transition: background-color var(--med) var(--ease), border-color var(--med) var(--ease), transform var(--med) var(--spring);
}
.check svg { width: 20px; height: 20px; }
.check-tick { stroke: var(--white); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 22; stroke-dashoffset: 22; transition: stroke-dashoffset var(--med) var(--ease) 60ms; }
.check.is-done, .done-burst .check, .check.done-burst { background: var(--green); border-color: var(--green); }
.check.is-done .check-tick, .done-burst .check-tick { stroke-dashoffset: 0; }
.check-burst { position: absolute; inset: -2px; border-radius: 50%; pointer-events: none; }
/* The burst: a pop, a ring and eight sparks. Plays whenever .done-burst appears (class added or swapped in).
   The tick and the green fill are the resting state, so a frozen animation still shows "done". */
.done-burst .check, .check.done-burst { animation: check-pop 420ms var(--spring); }
.done-burst .check-tick, .check.done-burst .check-tick { animation: tick-draw 300ms var(--ease); }
.done-burst .check-burst, .check.done-burst .check-burst { animation: burst-ring 520ms var(--ease) both; }
.done-burst .check-burst::before, .check.done-burst .check-burst::before,
.done-burst .check-burst::after, .check.done-burst .check-burst::after {
  content: ""; position: absolute; left: 50%; top: 50%; width: 6px; height: 6px; margin: -3px; border-radius: 50%;
  background: transparent; opacity: 0;
  box-shadow: 0 -22px 0 var(--cyan), 0 22px 0 var(--orange), 22px 0 0 var(--orange), -22px 0 0 var(--cyan);
  animation: deco-sparks 560ms var(--ease);
}
.done-burst .check-burst::after, .check.done-burst .check-burst::after {
  transform: rotate(45deg);
  box-shadow: 0 -20px 0 var(--orange), 0 20px 0 var(--cyan), 20px 0 0 var(--cyan), -20px 0 0 var(--green);
  animation-name: deco-sparks-45;
}
.done-burst .step-text { color: var(--muted); text-decoration: line-through; text-decoration-color: rgba(81, 96, 107, .5); transition: color var(--med) var(--ease); }
@keyframes check-pop { 0% { transform: scale(.7); } 55% { transform: scale(1.18); } 100% { transform: scale(1); } }
@keyframes tick-draw { from { stroke-dashoffset: 22; } to { stroke-dashoffset: 0; } }
@keyframes burst-ring { 0% { box-shadow: 0 0 0 0 rgba(31, 169, 113, .55); } 100% { box-shadow: 0 0 0 16px rgba(31, 169, 113, 0); } }
@keyframes deco-sparks { 0% { opacity: 1; transform: scale(.3); } 70% { opacity: 1; } 100% { opacity: 0; transform: scale(1.25); } }
@keyframes deco-sparks-45 { 0% { opacity: 1; transform: rotate(45deg) scale(.3); } 70% { opacity: 1; } 100% { opacity: 0; transform: rotate(45deg) scale(1.2); } }

.steps-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.step {
  display: flex; align-items: center; gap: 14px; min-height: 56px; padding: 10px var(--sp-3); border-radius: var(--r);
  transition: background-color var(--fast) var(--ease);
}
.step:hover { background: var(--cyan-50); }
.step--overdue { box-shadow: inset 3px 0 0 var(--orange); background: linear-gradient(90deg, var(--orange-50), transparent 45%); }
.step-body { display: grid; gap: 2px; min-width: 0; }
.step-text { font-weight: 600; }
.step-detail { font-size: var(--text-sm); }
.step--missing .step-text { color: var(--orange-ink); }

/* =========================================================================================================
   14. Today: Mom's checklist
   ========================================================================================================= */
.today { display: grid; gap: var(--sp-5); }
.task-group + .task-group { margin-top: 22px; }
.task-group-head {
  position: relative; display: flex; align-items: center; gap: 10px; margin: 0 0 var(--sp-2); padding: 0 var(--sp-3) var(--sp-2);
  border-bottom: 1px solid var(--line);
}
.task-group-head::before { content: ""; width: 8px; height: 8px; border-radius: 2px; background: var(--cyan); transform: rotate(45deg); }
.task-group-title {
  margin: 0; font-family: var(--font-display); font-size: .82rem; font-weight: 700; letter-spacing: var(--tracking-caps);
  text-transform: uppercase; color: var(--ink-2);
}
.task-group-count {
  display: inline-grid; place-items: center; min-width: 24px; height: 24px; padding: 0 7px; border-radius: var(--r-pill);
  background: var(--cyan-100); color: var(--cyan-800); font-size: .8rem; font-weight: 700; font-variant-numeric: tabular-nums;
}
.task-group--past_due .task-group-head::before { background: var(--orange); }
.task-group--past_due .task-group-count { background: var(--orange); color: var(--navy); }
.task-group--past_due .task-group-title { color: var(--orange-ink); }
.task-group--owners .task-group-head::before { background: var(--navy); }
.task-list .task { align-items: flex-start; flex-wrap: wrap; padding: 14px var(--sp-3); animation: rise-sm var(--med) var(--ease) backwards; }
.task-list .task + .task { border-top: 1px solid var(--gray-150); border-radius: 0; }
.task-list .task:hover { border-radius: var(--r); }
.task-list .task:nth-child(2) { animation-delay: 40ms; }
.task-list .task:nth-child(3) { animation-delay: 80ms; }
.task-list .task:nth-child(n+4) { animation-delay: 120ms; }
.task-body { flex: 1 1 260px; min-width: 0; }
.task-body .step-text { font-size: 1.04rem; }
.task-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.task-tag {
  display: inline-flex; align-items: center; gap: var(--sp-1); padding: 2px 9px; border-radius: var(--r-pill);
  background: var(--canvas); color: var(--ink-2); font-size: .82rem; font-weight: 600;
}
.task-tag .icon { width: 14px; height: 14px; }
.task-tag--job { background: var(--navy); color: var(--on-navy); }
.task-tag--owner { background: var(--surface); box-shadow: inset 0 0 0 1px var(--line-strong); }
.task-tag--late { background: var(--orange-100); color: var(--orange-ink); }
.task-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); margin-left: auto; }
.task-actions .btn .icon { width: 18px; height: 18px; }
.task-actions .btn--primary.btn--sm { min-height: 40px; padding-inline: 14px; }
.task-snooze .more-toggle { min-height: 36px; font-size: .92rem; color: var(--muted); }
.task-snooze .more-toggle:hover { color: var(--cyan-ink); }
.task-snooze-form { display: flex; gap: var(--sp-2); align-items: center; }
.task-snooze-form .input { min-height: 36px; }
.task.done-burst { background: var(--green-50); }
.task.done-burst .step-text { color: var(--muted); }
@media (max-width: 560px) { .task-actions { margin-left: 46px; } }

/* =========================================================================================================
   15. Dashboard: hero KPI row, KPI cards, SVG bars
   ========================================================================================================= */
.dash { display: grid; gap: var(--sp-6); }
.dash-filters { margin-bottom: 2px; }
.dash-filters .form { margin-top: 14px; }
.dash-filter-note { margin: var(--sp-3) 0 0; font-size: .92rem; }
.dash-group-title {
  display: flex; align-items: center; gap: 10px;
  margin: 0 0 var(--sp-3); font-family: var(--font-display); font-size: .82rem; font-weight: 700; letter-spacing: var(--tracking-caps);
  text-transform: uppercase; color: var(--ink-2);
}
.dash-group-title::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, var(--line-strong), transparent); }
.dash-grid { display: grid; gap: var(--sp-4); grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.dash-card {
  position: relative; display: flex; flex-direction: column; gap: 6px; padding: 18px var(--sp-5) var(--sp-4); overflow: hidden;
  background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow-2); border: 1px solid var(--hairline);
  animation: rise var(--enter) var(--spring) backwards;
  transition: transform var(--med) var(--ease), box-shadow var(--med) var(--ease);
}
.dash-card::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--cyan); }
.dash-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-3); }
/* staggered reveal: each card waits for its place in the row plus its group's place on the page */
.dash-card { animation-delay: calc(var(--group-delay, 0ms) + var(--card-delay, 0ms)); }
.dash-card:nth-child(2) { --card-delay: 60ms; }
.dash-card:nth-child(3) { --card-delay: 120ms; }
.dash-card:nth-child(n+4) { --card-delay: 180ms; }
.dash-group--2 { --group-delay: 120ms; }
.dash-group--3 { --group-delay: 220ms; }
.dash-card.is-provisional::before { background: repeating-linear-gradient(180deg, var(--orange) 0 8px, transparent 8px 14px); }
.dash-card.is-alert::before { background: var(--orange); }
.dash-card.is-alert { background: linear-gradient(160deg, var(--orange-50), var(--surface) 55%); }
.dash-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--sp-2); }
.dash-label { margin: 0; font-size: .98rem; font-weight: 650; color: var(--ink-2); }
.dash-asof { display: block; font-size: var(--text-xs); font-weight: 550; color: var(--muted); }
.dash-figure {
  font-family: var(--font-display); font-size: var(--text-kpi); font-weight: 650;
  letter-spacing: -.02em; line-height: 1.1; color: var(--navy); text-decoration: none;
  font-variant-numeric: tabular-nums lining-nums;
}
.dash-figure:hover { color: var(--cyan-ink); text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 5px; }
.dash-figure.is-negative, td.is-negative { color: var(--red-ink); }
.dash-provisional, .dash-note { margin: 0; font-size: var(--text-sm); color: var(--orange-ink); }
.dash-note { color: var(--muted); }
.dash-explain { margin: 0; font-size: .86rem; color: var(--muted); }
.dash-more { margin-top: auto; padding-top: 6px; display: inline-flex; align-items: center; gap: 6px; font-size: .9rem; font-weight: 600; color: var(--cyan-ink); }
.dash-more .icon { width: 16px; height: 16px; transition: transform var(--med) var(--spring); }
.dash-more:hover .icon { transform: translateX(4px); }
.dash-card:hover .btn-ghost { opacity: 1; }
.dash-hide { margin: 0; }

/* hero row: the first group (Money in, unless hidden) on navy, figures large */
.dash-group--hero .dash-card {
  color: var(--on-navy); border-color: transparent;
  background:
    var(--arcs-soft) right -70px bottom -80px / 170px 170px no-repeat,
    radial-gradient(120% 90% at 0% 0%, var(--navy-700), var(--navy) 60%);
  box-shadow: var(--shadow-3);
}
.dash-group--hero .dash-card::before { width: auto; inset: 0 0 auto 0; height: 3px; background: var(--accent-rule); }
.dash-group--hero .dash-card.is-alert::before { background: var(--orange); height: 4px; }
.dash-group--hero .dash-card.is-provisional::before { background: repeating-linear-gradient(90deg, var(--orange) 0 10px, transparent 10px 16px); }
.dash-group--hero .dash-label { color: var(--white); }
.dash-group--hero .dash-asof, .dash-group--hero .dash-explain, .dash-group--hero .dash-note { color: var(--on-navy-muted); }
.dash-group--hero .dash-figure { color: var(--white); font-size: var(--text-hero); }
.dash-group--hero .dash-card.is-alert .dash-figure { color: var(--orange-300); }
.dash-group--hero .dash-figure:hover { color: var(--cyan-300); }
.dash-group--hero .dash-figure.is-negative { color: var(--orange-300); }
.dash-group--hero .dash-provisional { color: var(--orange-300); }
.dash-group--hero .dash-more { color: var(--cyan-300); }
.dash-group--hero .btn-ghost { color: var(--on-navy-muted); }
.dash-group--hero .btn-ghost:hover { background: rgba(255, 255, 255, .1); color: var(--white); }
.dash-group--hero :focus-visible { outline-color: var(--cyan); }

.dash-hidden { padding: 6px 0; }
.dash-hidden-list { list-style: none; margin: 10px 0; padding: 0; display: grid; gap: var(--sp-2); max-width: 420px; }
.dash-hidden-list li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 6px var(--sp-3); border-radius: var(--r-sm); background: var(--surface); box-shadow: var(--shadow-1); }

.glance { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--sp-3); }
.glance-row { display: grid; grid-template-columns: 160px minmax(0, 1fr) auto; gap: 14px; align-items: center; }
.glance-label { font-weight: 600; color: var(--ink-2); text-decoration: none; }
.glance-label:hover { color: var(--cyan-ink); text-decoration: underline; }
.glance-bar { width: 100%; height: 16px; border-radius: var(--r-sm); overflow: hidden; display: block; }
.glance-track { fill: var(--canvas); }
.glance-fill { fill: var(--cyan); animation: glance-grow 700ms var(--spring) backwards; transform-origin: left center; transform-box: fill-box; }
.glance-row--overhead .glance-fill, .glance-row--bills_paid .glance-fill { fill: var(--navy-600); }
.glance-row--job_profit .glance-fill, .glance-row--operating_profit .glance-fill { fill: var(--green); }
.glance-row--overdue .glance-fill, .glance-row.is-negative .glance-fill { fill: var(--orange); }
.glance-row.is-negative .glance-value { color: var(--red-ink); }
.glance-row:nth-child(2) .glance-fill { animation-delay: 60ms; }
.glance-row:nth-child(3) .glance-fill { animation-delay: 120ms; }
.glance-row:nth-child(n+4) .glance-fill { animation-delay: 180ms; }
@keyframes glance-grow { from { transform: scaleX(.5); } }   /* starts at half length: a stalled timeline still shows honest proportions */
.glance-value { font-weight: 650; font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
@media (max-width: 560px) {
  .glance-row { grid-template-columns: minmax(0, 1fr) auto; }
  .glance-bar { grid-column: 1 / -1; order: 3; }
}

.records .lede { margin-top: 0; }
.records-total th, .records-total td { border-top: 2px solid var(--navy); font-weight: 700; font-size: 1.05rem; background: var(--navy-50); }
.records-row.is-provisional td:first-child { box-shadow: inset 3px 0 0 var(--orange); padding-left: 10px; }

/* =========================================================================================================
   16. Jobs, weeks, crew lines and the economics panel
   ========================================================================================================= */
.card--intake { border-top: 4px solid var(--cyan); }
.notes {
  white-space: pre-wrap; background: var(--canvas); border-radius: var(--r); padding: 14px var(--sp-4); font-size: .98rem; line-height: 1.5;
  box-shadow: inset 3px 0 0 var(--cyan);
}
.job-grid, .week-grid { display: grid; gap: var(--sp-5); align-items: start; }
@media (min-width: 1100px) {
  .job-grid { grid-template-columns: minmax(0, 1.7fr) minmax(300px, 1fr); }
  .week-grid { grid-template-columns: minmax(0, 1.8fr) minmax(320px, 1fr); }
  .week-side { position: sticky; top: var(--sp-5); }
}
.deal-list .step { align-items: flex-start; min-height: 0; }
.timeline { list-style: none; margin: 0 0 var(--sp-2); padding: 0 0 0 22px; position: relative; }
.timeline::before { content: ""; position: absolute; left: 6px; top: 6px; bottom: 6px; width: 2px; border-radius: 2px; background: linear-gradient(var(--cyan), var(--orange)); }
.timeline-item { position: relative; padding: 0 0 14px; }
.timeline-dot { position: absolute; left: -22px; top: 4px; width: 14px; height: 14px; border-radius: 50%; background: var(--surface); border: 3px solid var(--cyan); }
.timeline-item:last-child .timeline-dot { border-color: var(--orange); }
.timeline-what { margin: 0; font-weight: 600; }
.timeline-item p { margin: 0; }
.questions { list-style: none; margin: 0 0 var(--sp-4); padding: 0; display: grid; gap: var(--sp-3); }
.question { padding: var(--sp-3) 14px; border-radius: var(--r); background: var(--orange-50); box-shadow: inset 3px 0 0 var(--orange); }
.question.is-answered { background: var(--canvas); box-shadow: inset 3px 0 0 var(--green); }
.question p { margin: 0; }
.question-text { font-weight: 600; }
.question-answer { display: flex; gap: 6px; align-items: center; color: var(--green-ink); margin-top: 6px !important; }
.question-answer .icon { width: 18px; height: 18px; }
.answer-row { display: flex; gap: var(--sp-2); margin-top: var(--sp-2); align-items: center; }
.answer-row .input { min-height: 40px; }

.basis-group { display: contents; }
.basis-note { grid-column: 1 / -1; }
.crew-lines { display: grid; gap: var(--sp-3); counter-reset: crew; }
.crew-line {
  position: relative; display: grid; gap: 10px var(--sp-3); padding: 14px 52px 14px 18px; border-radius: var(--r);
  background: var(--canvas); grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); align-items: start;
  box-shadow: inset 3px 0 0 var(--line-strong);
  transition: box-shadow var(--fast) var(--ease), background-color var(--fast) var(--ease), transform var(--med) var(--ease);
}
.crew-line::before {        /* line number badge */
  counter-increment: crew; content: counter(crew);
  position: absolute; left: -9px; top: 12px; display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%;
  background: var(--navy); color: var(--on-navy); font-size: var(--text-xs); font-weight: 700; font-variant-numeric: tabular-nums;
  box-shadow: 0 0 0 3px var(--surface);
}
.crew-line:focus-within { background: var(--cyan-50); box-shadow: inset 3px 0 0 var(--cyan); }
.crew-line:focus-within::before { background: var(--cyan); color: var(--navy); }
.crew-line-remove { position: absolute; top: 10px; right: var(--sp-2); color: var(--muted); }
.crew-line-remove:hover { color: var(--red-ink); background: var(--red-100); }
.crew-line.is-leaving { transform: translateX(16px) scale(.98); background: var(--red-100); }
.sticky-actions {
  position: sticky; bottom: 0; z-index: 5; display: flex; flex-wrap: wrap; gap: 10px; margin-top: var(--sp-5); padding: 14px 0;
  background: linear-gradient(transparent, var(--canvas) 30%);
}

/* live economics: remaining and profit are the big numbers; below zero turns orange */
.econ { border-top: 4px solid var(--green); overflow: hidden; }
.econ--provisional { border-top-color: var(--orange); }
.econ .card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.econ-rows { margin: 0; display: grid; }
.econ-row { display: flex; justify-content: space-between; align-items: baseline; gap: var(--sp-3); padding: 7px 0; border-bottom: 1px dashed var(--line); }
.econ-row dt { color: var(--ink-2); }
.econ-row dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; }
.econ-row--total {
  margin: 6px calc(var(--sp-3) * -1); padding: var(--sp-3); border: 0; border-radius: var(--r);
  background: var(--green-50); box-shadow: inset 0 0 0 1px var(--green-100);
}
.econ--provisional .econ-row--total { background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line); }
.econ-row--total dt { font-weight: 650; color: var(--ink); }
.econ-row--total .figure { font-size: 1.75rem; color: var(--navy); }
.econ-row--total:has(.figure--attention) { background: var(--orange-50); box-shadow: inset 0 0 0 1.5px var(--orange-200), inset 4px 0 0 var(--orange); }
.econ-row--total .figure.figure--attention { color: var(--orange-ink); }
.econ-row--note { border-bottom: 0; padding-top: 0; }
.econ-row--note dd { font-weight: 500; font-size: var(--text-sm); color: var(--cyan-ink); }
.econ-rows--small .econ-row { padding: var(--sp-1) 0; font-size: .92rem; }
.econ-missing { margin-top: 14px; padding: 10px 14px; border-radius: var(--r); background: var(--orange-50); box-shadow: inset 3px 0 0 var(--orange); }
.econ-missing-title { display: flex; align-items: center; gap: 6px; margin: 0 0 var(--sp-1); font-weight: 650; color: var(--orange-ink); }
.econ-missing-title .icon { width: 18px; height: 18px; }
.econ-missing ul { margin: 0; padding-left: 1.2em; font-size: .92rem; }
.econ-sub { margin: var(--sp-4) 0 var(--sp-1); font-weight: 650; font-size: .9rem; color: var(--muted); }
#economics.fx-enter .figure, #quote-check.fx-enter .figure { animation: figure-pop var(--enter) var(--spring); }
@keyframes figure-pop { from { transform: scale(.94); } to { transform: none; } }

/* lodging and expenses */
.alloc-rows { display: grid; gap: var(--sp-3); margin-top: var(--sp-3); }
.alloc-row { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: var(--sp-3); align-items: end; }
.mileage-amount { margin-top: var(--sp-3); }
.quote-flag {
  display: flex; gap: var(--sp-2); align-items: center; color: var(--orange-ink); font-weight: 600; margin: 10px 0;
  padding: var(--sp-2) var(--sp-3); border-radius: var(--r-sm); background: var(--orange-50);
}
.quote-flag .icon { width: 20px; height: 20px; flex: none; }
.quote-check .card-head { position: relative; }
.stay { padding: 10px 0; border-bottom: 1px dashed var(--line); }
.stay:last-of-type { border-bottom: 0; }
.stay p { margin: var(--sp-1) 0; }
.place-form { display: grid; gap: 6px; margin-top: 6px; }

/* =========================================================================================================
   17. Contractor pages (phones first): My bills, My weeks, My availability, home tiles
   ========================================================================================================= */
.mine { display: grid; gap: 22px; max-width: 560px; }
.mine-section { display: grid; gap: var(--sp-3); }
.mine-heading { font-family: var(--font-display); font-size: 1.1rem; margin: 0; display: flex; align-items: center; gap: var(--sp-2); color: var(--navy); }
.mine-heading::before { content: ""; width: 4px; height: 1.1em; border-radius: 2px; background: var(--accent-rule); }
.mine-count { display: inline-grid; place-items: center; min-width: 26px; height: 26px; padding: 0 var(--sp-2); border-radius: var(--r-pill); background: var(--orange); color: var(--navy); font-size: .9rem; }
.bill-card {
  display: grid; gap: var(--sp-3); padding: 18px 18px var(--sp-4) 22px; border-radius: var(--r-lg); background: var(--surface);
  box-shadow: var(--shadow-2), inset 4px 0 0 var(--cyan); border: 1px solid var(--hairline);
}
.bill-card--waiting { box-shadow: var(--shadow-1), inset 4px 0 0 var(--line-strong); background: var(--surface-2); }
.bill-card p, .bill-card ul { margin: 0; }
.bill-card-head { display: grid; gap: var(--sp-1); }
.bill-site { font-weight: 700; font-size: 1.05rem; color: var(--navy); }
.bill-lines { list-style: none; padding: 0; display: grid; gap: 6px; }
.bill-lines li, .bill-total { display: flex; justify-content: space-between; gap: var(--sp-3); align-items: baseline; }
.bill-total { padding-top: 10px; border-top: 2px dashed var(--line-strong); font-weight: 700; font-size: 1.2rem; }
.bill-total .money { font-family: var(--font-display); font-size: 1.45rem; color: var(--navy); }
.bill-flag { display: flex; gap: var(--sp-2); align-items: flex-start; color: var(--orange-ink); font-weight: 550; }
.bill-flag .icon { width: 20px; height: 20px; flex: none; }
.bill-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; margin: 0; }
.bill-facts dt { font-size: .82rem; color: var(--muted); }
.bill-facts dd { margin: 0; font-weight: 600; }
.bill-row {
  display: flex; justify-content: space-between; gap: var(--sp-3); align-items: center; min-height: var(--tap);
  padding: 14px var(--sp-4) 14px 18px; border-radius: var(--r); background: var(--surface); box-shadow: var(--shadow-2), inset 4px 0 0 var(--orange);
  color: inherit; text-decoration: none; transition: transform var(--med) var(--ease), box-shadow var(--med) var(--ease);
}
.bill-row:hover { transform: translateY(-2px); box-shadow: var(--shadow-3), inset 4px 0 0 var(--orange); text-decoration: none; }
.bill-row-main, .bill-row-side { display: grid; gap: var(--sp-1); }
.bill-row-side { justify-items: end; text-align: right; }
.bill-row-side .money { font-weight: 700; font-size: 1.08rem; }
.bill-row--paid, .bill-row--paid:hover { box-shadow: var(--shadow-2), inset 4px 0 0 var(--green); }
.bill-due { font-weight: 600; color: var(--orange-ink); }
.page-mine .btn, .page-mine .input, .page-mine .more-toggle { min-height: var(--tap); }
.week-card { box-shadow: var(--shadow-2), inset 4px 0 0 var(--navy); }
.mine-section > p > a { display: inline-flex; align-items: center; gap: 6px; min-height: var(--tap); font-weight: 600; }
.mine-section > p > a .icon { width: 18px; height: 18px; transition: transform var(--med) var(--spring); }
.mine-section > p > a:hover .icon { transform: translateX(3px); }
.avail-card { display: grid; gap: 6px; }
.avail-card--past { box-shadow: var(--shadow-1), inset 4px 0 0 var(--line-strong); background: var(--surface-2); color: var(--ink-2); }

.tiles { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.tile {
  position: relative; overflow: hidden;
  display: flex; align-items: center; gap: var(--sp-4); min-height: 84px; padding: 18px var(--sp-5);
  border-radius: var(--r-lg); background: var(--surface); color: var(--ink); text-decoration: none;
  font-family: var(--font-display); font-size: 1.2rem; font-weight: 600;
  box-shadow: var(--shadow-2); border: 1px solid var(--hairline);
  transition: transform var(--med) var(--ease), box-shadow var(--med) var(--ease);
}
.tile::after {
  content: ""; position: absolute; right: -40px; bottom: -46px; width: 120px; height: 120px; pointer-events: none;
  background: var(--arcs) center / contain no-repeat; opacity: .35; transition: transform var(--med) var(--ease);
}
.tile-icon { width: 44px; height: 44px; padding: 10px; border-radius: 14px; flex: none; color: var(--navy); background: var(--cyan); }
.tiles li:nth-child(2) .tile-icon { background: var(--orange); }
.tiles li:nth-child(3) .tile-icon { background: var(--navy); color: var(--cyan); }
.tile-arrow { margin-left: auto; width: 22px; height: 22px; color: var(--muted); transition: transform var(--med) var(--spring), color var(--fast) var(--ease); }
.tile:hover { transform: translateY(-2px); box-shadow: var(--shadow-3); text-decoration: none; }
.tile:hover::after { transform: scale(1.08); }
.tile:hover .tile-arrow { transform: translateX(4px); color: var(--cyan-ink); }

/* =========================================================================================================
   18. Bills, invoices, payments
   ========================================================================================================= */
.inv-layout { display: grid; gap: 22px; grid-template-columns: minmax(0, 1fr); align-items: start; }
@media (min-width: 1100px) { .inv-layout { grid-template-columns: minmax(0, 1fr) 340px; } }
.inv-side { display: grid; gap: 18px; }
.inv-preview { display: grid; gap: 10px; }
.inv-preview-tag { display: flex; align-items: center; gap: var(--sp-2); margin: 0; color: var(--cyan-ink); font-weight: 600; font-size: .9rem; }
.inv-preview-tag .icon { width: 18px; height: 18px; }
/* the on-screen copy of the PDF: a sheet of paper on the canvas */
.inv-doc {
  position: relative; overflow: hidden; background: var(--surface); border-radius: var(--r-sm); padding: 34px 36px 30px;
  box-shadow: 0 1px 1px rgba(14, 34, 48, .08), 0 18px 40px -18px rgba(14, 34, 48, .35); border: 1px solid var(--hairline);
  animation: rise var(--enter) var(--ease);
}
.inv-doc::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 6px; background: var(--navy); }
.inv-doc::after {           /* faint arcs in the top-right corner, as on the PDF */
  content: ""; position: absolute; right: 0; top: 6px; width: 150px; height: 150px; pointer-events: none;
  background: var(--arcs-top-right) right top / contain no-repeat; opacity: .35;
}
.inv-doc p { margin: 0; }
.inv-top { position: relative; z-index: 1; display: flex; justify-content: space-between; gap: 18px; flex-wrap: wrap; align-items: flex-start; }
.inv-brand { display: flex; gap: 14px; align-items: center; }
.inv-brand img { width: 64px; height: auto; border-radius: 10px; background: #000; padding: 4px; }
.inv-supplier { font-family: var(--font-display); font-weight: 700; font-size: 1.15rem; color: var(--navy); }
.inv-title { text-align: right; }
.inv-word { font-family: var(--font-display); font-size: 2rem; font-weight: 700; color: var(--navy); line-height: 1; text-transform: uppercase; letter-spacing: .04em; }
.inv-num { margin-top: 6px !important; font-weight: 700; color: var(--orange-ink); font-variant-numeric: tabular-nums; }
.inv-kind { color: var(--cyan-ink); font-weight: 600; font-size: .9rem; }
.inv-band { height: 6px; margin: 18px 0 20px; border-radius: 3px; background: linear-gradient(90deg, var(--navy) 0 58%, var(--cyan) 58% 86%, var(--orange) 86%); }
.inv-grid { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.inv-box { border: 1px solid var(--line); border-left: 4px solid var(--cyan); border-radius: var(--r-sm); padding: var(--sp-3) 14px; }
.inv-label { font-size: .75rem; font-weight: 700; letter-spacing: var(--tracking-caps); text-transform: uppercase; color: var(--cyan-ink); margin-bottom: 6px !important; }
.inv-pre { white-space: pre-line; }
.inv-meta, .inv-project { margin: 0; display: grid; gap: 0; }
.inv-meta > div, .inv-project > div { display: flex; justify-content: space-between; gap: var(--sp-3); padding: 6px 0; border-bottom: 1px solid var(--line); }
.inv-meta dt, .inv-project dt { color: var(--muted); }
.inv-meta dd, .inv-project dd { margin: 0; font-weight: 600; text-align: right; }
.inv-project { margin: 18px 0; }
.inv-lines thead th { background: var(--navy); color: var(--on-navy); }
.inv-lines tbody tr:nth-child(even), .inv-lines tbody tr:hover { background: transparent; }
.inv-total {
  display: flex; justify-content: flex-end; align-items: baseline; gap: 28px; padding: var(--sp-3) var(--sp-2) 0; margin-bottom: var(--sp-4) !important;
  font-family: var(--font-display); font-weight: 700; font-size: 1.35rem; color: var(--navy); border-top: 2px solid var(--navy);
  font-variant-numeric: tabular-nums;
}
.inv-crew { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.inv-crew li { padding: var(--sp-1) var(--sp-3); border-radius: var(--r-pill); background: var(--canvas); font-weight: 600; }
.inv-stamp {   /* visible at rest; the stamp-in only scales it */
  position: absolute; top: 38%; left: 50%; z-index: 2; transform: translate(-50%, -50%) rotate(-22deg); pointer-events: none;
  font-family: var(--font-display); font-size: clamp(3.5rem, 12vw, 7rem); font-weight: 800; letter-spacing: .1em;
  color: rgba(214, 69, 69, .3); border: 6px solid rgba(214, 69, 69, .3); border-radius: 18px; padding: 0 var(--sp-6);
  animation: inv-stamp var(--enter) var(--spring);
}
@keyframes inv-stamp { from { transform: translate(-50%, -50%) rotate(-22deg) scale(1.5); } }
.inv-next { margin: var(--sp-1) 0 var(--sp-3); font-size: 1.05rem; }
.inv-next strong { color: var(--orange-ink); font-variant-numeric: tabular-nums; }
.inv-history { list-style: none; padding: 0; margin: 0; display: grid; gap: var(--sp-2); }
.inv-history li { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); }
@media (max-width: 480px) { .inv-doc { padding: 24px var(--sp-4) 20px; } .inv-title { text-align: left; } }

.pay-note { margin: 0 0 14px; }
.pay-grid { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); margin-bottom: 18px; }
.pay-list { list-style: none; padding: 0; margin: 0; display: grid; gap: var(--sp-2); }
.pay-list li { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; padding: 6px 0; border-bottom: 1px dashed var(--line); }
.pay-list li:last-child { border-bottom: 0; }
.pay-list .money { margin-left: auto; font-weight: 650; }
.pick-list { list-style: none; padding: 0; margin: 10px 0 0; display: grid; gap: 10px; }
.pick-row {
  display: grid; gap: 10px; grid-template-columns: minmax(0, 1fr) minmax(140px, 200px); align-items: end;
  padding: 10px 14px; border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--surface);
  transition: border-color var(--fast) var(--ease), box-shadow var(--med) var(--ease), transform var(--med) var(--ease), background-color var(--fast) var(--ease);
}
.pick-row.is-picked, .pick-row:has(input[type="checkbox"]:checked) { border-color: var(--cyan); background: var(--cyan-50); box-shadow: inset 4px 0 0 var(--cyan); }
.pick-row:has(input[type="checkbox"]:checked) { transform: translateX(2px); }
.pick-check { align-self: center; }
.pick-check input { width: 22px; height: 22px; flex: none; accent-color: var(--cyan-ink); }
.pick-meta { display: block; font-size: .9rem; }
@media (max-width: 560px) { .pick-row { grid-template-columns: minmax(0, 1fr); } }

/* =========================================================================================================
   19. Calendar and crew board
   ========================================================================================================= */
.cal-nav { display: flex; gap: 6px; flex-wrap: wrap; }
.cal-legend { list-style: none; margin: 0 0 14px; padding: 0; display: flex; flex-wrap: wrap; gap: var(--sp-2) 18px; font-size: .9rem; color: var(--ink-2); }
.cal-legend li { display: inline-flex; align-items: center; gap: 6px; }
.cal-dot, .board-key { width: 12px; height: 12px; border-radius: var(--r-xs); display: inline-block; }
.cal-card { padding: 10px; overflow-x: auto; }
.cal { width: 100%; border-collapse: separate; border-spacing: 4px; table-layout: fixed; min-width: 720px; }
.cal th { font-size: var(--text-xs); font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); padding: var(--sp-1); }
.cal-day { vertical-align: top; height: 112px; padding: 6px; border-radius: 10px; background: var(--canvas); transition: background-color var(--fast) var(--ease), box-shadow var(--fast) var(--ease); }
.cal-day:hover { background: var(--cyan-50); }
.cal-day.is-weekend { background: var(--canvas-2); }
.cal-day.is-other { background: transparent; color: var(--gray-600); }
.cal-day.is-other .cal-num { font-weight: 500; }
.cal-day.is-today { box-shadow: inset 0 0 0 2px var(--cyan); background: var(--cyan-50); }
.cal-num { display: inline-grid; place-items: center; min-width: 26px; height: 26px; font-weight: 700; font-variant-numeric: tabular-nums; }
.is-today .cal-num { border-radius: 50%; background: var(--cyan); color: var(--navy); }
.cal-events { list-style: none; margin: var(--sp-1) 0 0; padding: 0; display: grid; gap: 3px; }
.cal-ev {
  font-size: var(--text-xs); line-height: 1.25; padding: 2px 6px; border-radius: var(--r-xs); overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap; animation: rise-sm var(--med) var(--ease);
}
.cal-ev a { color: inherit; text-decoration: none; }
.cal-ev a:hover { text-decoration: underline; }
.cal-ev--job_week, .cal-dot--job_week { background: var(--navy); color: var(--on-navy); }
.cal-ev--overlap, .cal-dot--overlap { background: var(--orange); color: var(--navy); font-weight: 700; }
.cal-ev--blocked, .cal-dot--blocked { background: repeating-linear-gradient(135deg, var(--red-100) 0 6px, var(--red-300) 6px 12px); color: var(--red-ink); }
.cal-ev--invoice_due, .cal-dot--invoice_due { background: var(--cyan-100); color: var(--cyan-800); }
.cal-ev--bill_due, .cal-dot--bill_due { background: var(--orange-50); color: var(--orange-ink); box-shadow: inset 0 0 0 1px var(--orange-100); }
.cal-ev--follow_up, .cal-dot--follow_up { background: var(--green-100); color: var(--green-ink); }
.cal-agenda { display: none; gap: var(--sp-3); }
.cal-agenda-day { padding: var(--sp-3) var(--sp-4); border-radius: var(--r); background: var(--surface); box-shadow: var(--shadow-1); }
.cal-agenda-day.is-today { box-shadow: var(--shadow-1), inset 4px 0 0 var(--cyan); }
.cal-agenda-date { margin: 0; font-size: 1rem; font-family: var(--font-display); }
.cal-agenda .cal-ev { white-space: normal; font-size: .92rem; padding: 6px 10px; }
@media (max-width: 760px) { .cal-card { display: none; } .cal-agenda { display: grid; } }

.crew-gap { margin-bottom: var(--sp-4); }
.crew-gap-text { margin: 0; font-family: var(--font-display); font-size: 1.4rem; font-weight: 650; color: var(--navy); }
.crew-gap--open { box-shadow: var(--shadow-2), inset 4px 0 0 var(--green); background: linear-gradient(90deg, var(--green-100), var(--surface) 45%); }
.board { border-collapse: separate; border-spacing: 3px; min-width: 860px; }
.board th { font-size: var(--text-xs); color: var(--muted); font-weight: 700; padding: var(--sp-1); text-align: center; }
.board-day span { display: block; }
.board-date { font-weight: 550; font-variant-numeric: tabular-nums; }
.board-day.is-today { color: var(--cyan-ink); }
.board .board-who { position: sticky; left: 0; z-index: 1; background: var(--surface); text-align: left; font-size: .95rem; color: var(--ink); white-space: nowrap; padding-right: 10px; }
.board-cell { height: 44px; min-width: 52px; border-radius: var(--r-sm); font-size: .72rem; line-height: 1.15; padding: var(--sp-1); vertical-align: middle; text-align: center; transition: transform var(--fast) var(--ease); }
.board-cell:hover { transform: scale(1.04); }
.board-label { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.board-cell--committed, .board-key--committed { background: var(--navy); color: var(--on-navy); }
.board-cell--blocked, .board-key--blocked { background: repeating-linear-gradient(135deg, var(--red-100) 0 6px, var(--red-300) 6px 12px); color: var(--red-ink); }
.board-cell--open, .board-key--open { background: var(--green-100); box-shadow: inset 0 0 0 1px rgba(31, 169, 113, .25); }
.board-cell.is-weekend { background-color: var(--canvas); background-blend-mode: multiply; }
.board-cell--open.is-weekend { background: var(--canvas); box-shadow: inset 0 0 0 1px var(--line); }
.board-cell.is-clash { box-shadow: inset 0 0 0 3px var(--orange); }

/* =========================================================================================================
   20. Settings, accounts and one-off pieces
   ========================================================================================================= */
.copy-row { display: flex; gap: 10px; margin-top: var(--sp-3); }
.reset-link {
  flex: 1; min-width: 0; min-height: 44px; padding: var(--sp-2) var(--sp-3); border-radius: 10px;
  border: 1.5px solid var(--line-strong); background: var(--canvas); font-family: var(--font-mono); font-size: var(--text-sm);
}
.is-copied { --bg: var(--green) !important; --fg: var(--white) !important; }
.recovery-codes {
  list-style: none; padding: var(--sp-4); margin: 14px 0 0; border-radius: var(--r);
  display: grid; grid-template-columns: 1fr 1fr; gap: 6px var(--sp-4);
  background: var(--navy) var(--arcs-soft) right -60px bottom -60px / 150px 150px no-repeat; color: var(--cyan-300); font-family: var(--font-mono); font-size: 1rem;
}
.steps { margin: 0 0 var(--sp-4); padding-left: 1.3em; color: var(--ink-2); display: grid; gap: var(--sp-1); }
.qr { display: grid; place-items: center; padding: var(--sp-3); margin: 0 auto var(--sp-2); width: max-content; border-radius: var(--r); background: var(--white); box-shadow: inset 0 0 0 1px var(--line); }
.key-line { text-align: center; color: var(--muted); font-size: .92rem; word-break: break-all; }
.totp-secret { color: var(--ink); font-weight: 600; letter-spacing: .06em; }

/* =========================================================================================================
   21. Sign-in pages
   ========================================================================================================= */
body.auth-page { background: var(--navy-950); }
.auth {
  position: relative; min-height: 100vh; min-height: 100dvh; overflow: hidden;
  display: grid; place-items: center; align-content: center; gap: var(--sp-5); padding: 40px var(--sp-4);
  background: radial-gradient(130% 90% at 50% 0%, var(--navy-700), var(--navy) 45%, var(--navy-950));
}
.auth-sky { position: absolute; inset: 0; pointer-events: none; }
.auth-sky::before {          /* big signal arcs behind the card */
  content: ""; position: absolute; left: -80px; bottom: -80px; width: min(620px, 90vw); height: min(620px, 90vw);
  background: var(--arcs) left bottom / contain no-repeat; opacity: .22;
}
.orb { position: absolute; border-radius: 50%; filter: blur(70px); }
.orb--cyan { width: 480px; height: 480px; left: -140px; top: -120px; background: var(--cyan); opacity: .28; animation: deco-drift 22s ease-in-out infinite alternate; }
.orb--orange { width: 380px; height: 380px; right: -120px; bottom: -140px; background: var(--orange); opacity: .22; animation: deco-drift 26s ease-in-out infinite alternate-reverse; }
.grid-lines {
  position: absolute; inset: 0; opacity: .5;
  background-image: var(--grid-lines);
  background-size: 44px 44px;
  -webkit-mask-image: radial-gradient(70% 60% at 50% 40%, #000, transparent);
  mask-image: radial-gradient(70% 60% at 50% 40%, #000, transparent);
}
.auth-card {
  position: relative; z-index: 1; width: min(440px, 100%);
  border-radius: var(--r-xl); overflow: hidden; background: var(--surface);
  box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .6), 0 0 0 1px rgba(255, 255, 255, .06);
  animation: pop-in 520ms var(--spring);
}
.auth-card:focus { outline: none; }
.auth-brand {
  position: relative; overflow: hidden; display: grid; justify-items: center; padding: 26px var(--sp-6) 18px;
  background: radial-gradient(80% 120% at 50% 0%, var(--navy-700), var(--navy));
}
.auth-brand::before {        /* a slow light sweep across the brand band */
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(100deg, transparent 30%, rgba(44, 198, 239, .16) 50%, transparent 70%) no-repeat;
  background-size: 60% 100%;
  animation: deco-sweep 5.5s var(--ease) 1s infinite;
}
.auth-brand::after {   /* cyan-to-orange edge, like the logo's swooshes */
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 4px;
  background: var(--accent-rule);
}
.auth-logo { position: relative; width: 132px; height: auto; mix-blend-mode: lighten; animation: logo-in 700ms var(--spring) 120ms backwards; }
@keyframes logo-in { from { transform: translateY(-6px) scale(.9) rotate(-4deg); } to { transform: none; } }
.auth-product {
  position: relative; margin: 2px 0 0; font-family: var(--font-display); font-size: .82rem; font-weight: 600;
  letter-spacing: .5em; text-indent: .5em; text-transform: uppercase; color: var(--on-navy-muted);
}
.auth-body { padding: 26px 28px 28px; display: grid; gap: 14px; }
.auth-title { font-size: 1.55rem; color: var(--navy); }
.auth-foot { position: relative; z-index: 1; margin: 0; color: var(--on-navy-muted); font-size: .85rem; }

/* =========================================================================================================
   22. Responsive shell: staff get a collapsible menu on phones, contractors a bottom tab bar
   ========================================================================================================= */
@media (max-width: 900px) {
  .shell { display: block; }
  .sidebar {
    position: sticky; top: 0; z-index: 40; height: auto; padding: var(--sp-2) var(--sp-3);
    display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 0 var(--sp-2); overflow: visible;
    background: var(--arcs-soft) left -60px top -40px / 140px 140px no-repeat, var(--navy);
    box-shadow: 0 6px 20px -10px rgba(7, 21, 32, .7);
  }
  .sidebar::after { inset: auto 0 0 0; width: auto; height: 2px; background: var(--accent-rule); opacity: .8; }
  .brand { padding: var(--sp-1); margin: 0; border: 0; }
  .brand-logo { width: 40px; height: 28px; }
  .me, .shell--contractor .me { grid-column: 3; grid-row: 1; margin: 0; padding: 0; background: none; box-shadow: none; }
  .me-text { display: none; }
  .me-avatar { width: 34px; height: 34px; font-size: .85rem; }
  .topbar { padding: 20px var(--sp-4) var(--sp-4); margin-bottom: var(--sp-4); background-size: 150px 150px, auto; }
  .topbar::after { left: var(--sp-4); }
  .page { padding: 0 var(--sp-4) 40px; gap: var(--sp-4); }
  .card-head { padding: 18px 18px 0; }
  .card-body { padding: var(--sp-4) 18px 18px; }
  .table-wrap { margin: 0 -18px; padding: 0 18px; }
  .recovery-codes { grid-template-columns: 1fr; }
  .toasts { right: var(--sp-4); left: var(--sp-4); width: auto; bottom: var(--sp-4); }

  /* staff: a Menu button opens the nav (and the admin links) as a panel under the bar.
     Without JavaScript the button is a link to #main-nav and :target opens it. */
  .shell--staff .nav-toggle {
    grid-column: 2; grid-row: 1;
    display: inline-flex; align-items: center; gap: var(--sp-2); min-height: 44px; padding: 6px 14px;
    border: 1px solid var(--navy-line-strong); border-radius: var(--r-pill); background: rgba(255, 255, 255, .06);
    color: var(--on-navy); font-weight: 600; text-decoration: none; cursor: pointer;
    transition: background-color var(--fast) var(--ease), border-color var(--fast) var(--ease);
  }
  .shell--staff .nav-toggle:hover { background: rgba(255, 255, 255, .12); }
  .shell--staff .nav-toggle .icon { width: 20px; height: 20px; transition: transform var(--med) var(--spring); }
  .shell--staff .nav-toggle-current { color: var(--cyan); }

  .shell--staff.nav-open .nav-toggle { background: var(--cyan); border-color: var(--cyan); color: var(--navy); }
  .shell--staff.nav-open .nav-toggle-current { color: var(--navy); }
  .shell--staff.nav-open .nav-toggle .icon { transform: rotate(90deg); }
  .shell--staff .nav, .shell--staff .nav-tools { display: none; grid-column: 1 / -1; }
  .shell--staff.nav-open .nav, .shell--staff .nav:target,
  .shell--staff.nav-open .nav-tools, .shell--staff:has(.nav:target) .nav-tools { display: block; }
  .shell--staff.nav-open .nav, .shell--staff .nav:target { padding: var(--sp-3) 0 var(--sp-1); animation: rise-sm var(--med) var(--ease); }
  .shell--staff .nav-list { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
  .shell--staff .nav-link { background: rgba(255, 255, 255, .05); }
  .shell--staff .nav-link::before { left: 0; top: 10px; bottom: 10px; }
  .shell--staff .nav-tools { margin: 0 0 var(--sp-3); padding-top: var(--sp-2); }
  .shell--staff.nav-open .nav-tools, .shell--staff:has(.nav:target) .nav-tools { display: flex; flex-wrap: wrap; gap: 6px; }
  .shell--staff .tool-link { min-height: 44px; }
  .shell--contractor .nav-tools { display: none; }
}

/* contractor pages: 48px touch targets at every width (they are mostly on phones, sometimes a desk) */
.shell--contractor .btn, .shell--contractor .btn--sm, .shell--contractor .input,
.shell--contractor .link-button, .shell--contractor .btn-icon, .shell--contractor .more-toggle { min-height: var(--tap); }
.shell--contractor .btn-icon { min-width: var(--tap); }

/* contractors on a phone: single column, bottom tab bar */
@media (max-width: 900px) {
  .shell--contractor .sidebar { grid-template-columns: 1fr auto; }
  .shell--contractor .me { grid-column: 2; }
  .shell--contractor .page { padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
  .shell--contractor .nav {
    position: fixed; z-index: 50; left: 0; right: 0; bottom: 0;
    padding: 6px var(--sp-2) calc(6px + env(safe-area-inset-bottom));
    background: rgba(14, 34, 48, .97); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 -8px 24px -12px rgba(7, 21, 32, .6), inset 0 1px 0 var(--navy-line);
  }
  .shell--contractor .nav::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 2px; background: var(--accent-rule); opacity: .8; }
  .shell--contractor .nav-list { grid-auto-flow: column; grid-auto-columns: 1fr; gap: var(--sp-1); }
  .shell--contractor .nav-link {
    flex-direction: column; justify-content: center; gap: 3px; min-height: 60px; padding: 6px var(--sp-1);
    font-size: .8rem; text-align: center; line-height: 1.15;
  }
  .shell--contractor .nav-link::before { left: 30%; right: 30%; top: -6px; bottom: auto; width: auto; height: 3px; border-radius: 0 0 3px 3px; transform: scaleX(0); }
  .shell--contractor .nav-link[aria-current="page"]::before { transform: scaleX(1); }
  .shell--contractor .nav-link[aria-current="page"] { background: rgba(44, 198, 239, .14); box-shadow: none; }
  .shell--contractor .nav-icon { width: 24px; height: 24px; }
  .shell--contractor .nav-link:hover .nav-icon { transform: none; }
  .shell--contractor .toasts { bottom: calc(86px + env(safe-area-inset-bottom)); }
  .shell--contractor .tiles { grid-template-columns: 1fr; }
}

@media (max-width: 380px) { .visually-hidden-narrow { display: none; } }
@media (max-width: 480px) {
  .auth { padding: var(--sp-6) var(--sp-3); align-content: start; padding-top: 6vh; }
  .auth-body { padding: 22px var(--sp-5) var(--sp-6); }
  .copy-row { flex-direction: column; }
  .topbar-actions { width: 100%; }
  .modal-actions .btn { flex: 1; }
}

/* =========================================================================================================
   22b. Crew home, badges, account menu, preview as crew
   ========================================================================================================= */
.nav-link { position: relative; }
.nav-badge {
  display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; margin-left: auto;
  border-radius: var(--r-pill); background: var(--orange); color: var(--navy); font-size: .74rem; font-weight: 700;
  box-shadow: 0 0 0 2px var(--navy);
}
.crew-alert {
  display: flex; align-items: center; gap: var(--sp-3); padding: 16px 18px; border-radius: var(--r-lg);
  background: linear-gradient(135deg, var(--orange), var(--orange-300)); color: var(--navy); text-decoration: none;
  box-shadow: var(--shadow-2), 0 10px 24px -12px rgba(255, 138, 61, .9);
  transition: transform var(--med) var(--ease), box-shadow var(--med) var(--ease);
}
.crew-alert:hover { transform: translateY(-2px); text-decoration: none; box-shadow: var(--shadow-3); }
.crew-alert-icon { width: 40px; height: 40px; padding: 8px; flex: none; border-radius: 12px; background: var(--navy); color: var(--orange); }
.crew-alert-text { display: grid; gap: 2px; min-width: 0; }
.crew-alert-text strong { font-size: 1.05rem; }
.crew-alert-text span { font-size: .9rem; overflow: hidden; text-overflow: ellipsis; }
.crew-alert-go { margin-left: auto; display: inline-flex; align-items: center; gap: 4px; font-weight: 700; white-space: nowrap; }
.crew-alert-go .icon { width: 18px; height: 18px; }
.crew-quiet { margin: 0; }
.week-card--now { box-shadow: var(--shadow-2), inset 4px 0 0 var(--cyan); background: linear-gradient(180deg, var(--cyan-50), var(--surface) 60%); }
.map-link { display: inline-flex; align-items: flex-start; gap: 6px; min-height: 32px; color: var(--cyan-ink); font-weight: 600; }
.map-link .icon { width: 18px; height: 18px; flex: none; margin-top: 2px; }
.bill-row-side > .icon { width: 20px; height: 20px; color: var(--muted); }

.me--menu { position: relative; padding: 0; }
.me-summary {
  display: flex; align-items: center; gap: 10px; padding: 10px; list-style: none; cursor: pointer; border-radius: var(--r);
  min-height: var(--tap);
}
.me-summary::-webkit-details-marker { display: none; }
.me-summary:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
.me-pop {
  position: absolute; z-index: 60; right: 0; bottom: calc(100% + 8px); min-width: 220px; padding: var(--sp-3);
  display: grid; gap: var(--sp-2); border-radius: var(--r); background: var(--surface); color: var(--ink); box-shadow: var(--shadow-3);
}
.me-pop-name { margin: 0; font-weight: 700; color: var(--navy); }

.preview-bar {
  position: sticky; top: 0; z-index: 45; display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap;
  padding: 10px var(--sp-4); background: var(--orange-50); color: var(--orange-ink); font-size: .92rem;
  box-shadow: inset 0 -2px 0 var(--orange);
}
.preview-bar > .icon { width: 20px; height: 20px; flex: none; }
.preview-bar-back { margin-left: auto; }
.next-step {
  display: flex; align-items: center; gap: var(--sp-3); flex-wrap: wrap; padding: 14px 18px; border-radius: var(--r-lg);
  background: var(--surface); box-shadow: var(--shadow-2), inset 4px 0 0 var(--cyan); border: 1px solid var(--hairline);
}
.next-step-tag {
  flex: none; padding: 3px 10px; border-radius: var(--r-pill); background: var(--navy); color: var(--cyan);
  font-size: .74rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
}
.next-step-text { flex: 1 1 260px; font-weight: 600; color: var(--navy); }
.cell-note { display: block; margin-top: 2px; font-family: var(--font-body, inherit); font-size: .76rem; font-weight: 500; color: var(--orange-ink); white-space: normal; line-height: 1.3; }
.date-hints { display: grid; gap: var(--sp-2); margin-bottom: var(--sp-4); padding: 12px 14px; border-radius: var(--r); background: var(--cyan-50); }
.date-hints-title { margin: 0; font-size: .8rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--cyan-ink); }
.date-hints-list { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.date-hint { border: 0; cursor: pointer; font: inherit; }
.date-hint .icon { width: 16px; height: 16px; }
.date-hint[aria-pressed="true"] { background: var(--navy); color: var(--on-navy); box-shadow: var(--shadow-navy); }
.lodging-budget {
  display: grid; gap: 4px; margin-bottom: var(--sp-4); padding: 14px 16px; border-radius: var(--r);
  background: linear-gradient(135deg, var(--cyan-50), var(--surface)); box-shadow: inset 4px 0 0 var(--cyan), 0 0 0 1px var(--hairline);
}
.lodging-budget p { margin: 0; }
.lodging-budget-title { display: flex; align-items: center; gap: 6px; font-size: .8rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--cyan-ink); }
.lodging-budget-title .icon { width: 16px; height: 16px; }
.lodging-budget-figure { font-family: var(--font-display); font-size: 1.7rem; font-weight: 700; color: var(--navy); }
.lodging-budget-line { font-size: .9rem; }
.lodging-budget--none { background: var(--orange-50); box-shadow: inset 4px 0 0 var(--orange), 0 0 0 1px var(--hairline); }
.lodging-budget--none .lodging-budget-figure { color: var(--orange-ink); }
.access-ready { display: grid; gap: var(--sp-3); }
.access-ready p { margin: 0; }
.access-text { font-size: .88rem; color: var(--ink-2); background: var(--surface-2); }
.link-person { display: inline-flex; gap: 6px; align-items: center; }
.input--sm { min-height: 34px; padding: 4px 8px; font-size: .88rem; width: auto; }
.preview-lock { display: contents; border: 0; margin: 0; padding: 0; min-width: 0; }
.preview-lock button:disabled, .preview-lock input:disabled, .preview-lock textarea:disabled { cursor: not-allowed; opacity: .55; }

@media (max-width: 900px) {
  .me-pop { bottom: auto; top: calc(100% + 8px); }
  .me-summary { padding: 0; }
  .shell--contractor .nav-badge { position: absolute; top: 4px; right: calc(50% - 26px); margin: 0; }
  .preview-bar { top: 0; }
  .shell--preview .sidebar { position: relative; }
}

/* =========================================================================================================
   23. Motion off when asked
   ========================================================================================================= */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important; animation-iteration-count: 1 !important; animation-delay: 0ms !important;
    transition-duration: .01ms !important; transition-delay: 0ms !important; scroll-behavior: auto !important;
  }
  .skeleton-line { animation: none !important; background: var(--canvas-2); }
  .orb, .empty-art, .empty-art::before, .brand-signal, .auth-brand::before, .pill--overdue .pill-dot,
  .page, .dash-card, .glance-fill, .cal-ev, .task-list .task, .reveal, .fx-enter, .alert, .inv-doc, .inv-stamp { animation: none !important; }
  html.is-busy .loadbar { animation: none !important; background: var(--cyan); background-size: 100% 100%; }
  .dash-card:hover, .chip:hover, .card--link:hover, .tile:hover, .bill-row:hover, .btn:hover, .board-cell:hover { transform: none; }
  .pick-row { transition: none; transform: none !important; }
}

/* =========================================================================================================
   24. Print
   ========================================================================================================= */
@media print {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .sidebar, .loadbar, .toasts, .skip-link, .topbar-actions, .nav-toggle, .sticky-actions, .modal { display: none !important; }
  .shell { display: block; }
  body { background: var(--white); }
  .topbar { background: none; box-shadow: none; padding: 0 0 12px; }
  .card { box-shadow: none; border: 1px solid var(--gray-300); break-inside: avoid; }
  .dash-group--hero .dash-card { background: var(--white); color: var(--ink); }
  .dash-group--hero .dash-figure, .dash-group--hero .dash-label { color: var(--ink); }
  .inv-side, .inv-preview-tag { display: none !important; }
  .inv-doc { box-shadow: none; border: 0; }
}
