/* SiteFactory, the new interface: tokens, base, the one layout and the shared blocks.

   Built to design/DESIGN-SPEC.md and the four mock-ups in design/mockups/.
   Colours live only in :root below, each named for what it means (a test
   checks no colour is written anywhere else in this file or in css/). A new
   need gets a new token here, never a colour typed into a rule.
   Each area of the app has its own stylesheet in css/; this one is shared. */

/* ---- fonts: self-hosted, SIL Open Font License (licences in /static/fonts/) ---- */
@font-face { font-family: "Atkinson Hyperlegible Next"; font-style: normal; font-weight: 400; font-display: swap; src: url("/static/fonts/atkinson-hyperlegible-next-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Atkinson Hyperlegible Next"; font-style: normal; font-weight: 600; font-display: swap; src: url("/static/fonts/atkinson-hyperlegible-next-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Atkinson Hyperlegible Next"; font-style: normal; font-weight: 800; font-display: swap; src: url("/static/fonts/atkinson-hyperlegible-next-latin-800-normal.woff2") format("woff2"); }
@font-face { font-family: "Atkinson Hyperlegible Mono"; font-style: normal; font-weight: 400; font-display: swap; src: url("/static/fonts/atkinson-hyperlegible-mono-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Atkinson Hyperlegible Mono"; font-style: normal; font-weight: 600; font-display: swap; src: url("/static/fonts/atkinson-hyperlegible-mono-latin-600-normal.woff2") format("woff2"); }

/* ---- tokens ------------------------------------------------------------------ */
:root {
  /* DESIGN-SPEC tokens, verbatim (design/mockups/today.html) */
  --ground: #EEF1EF;   /* the page */
  --surface: #FFFFFF;  /* cards */
  --ink: #13201B;      /* text */
  --muted: #56645D;    /* secondary text (6.2:1 on white) */
  --line: #D7DED9;     /* dividers */
  --go: #146C55;       /* the main action: call, save */
  --go-ink: #FFFFFF;
  --go-soft: #E3F1EC;
  --now: #F5C000;      /* the brand dot: only for "now" */
  --late: #B4410E;     /* overdue, blocked */
  --late-soft: #FBEDE6;
  --client: #2B5C8A;   /* a paying client, and an inbound lead (decision 9) */
  --client-soft: #E6EEF6;
  --r: 10px;
  --font: "Atkinson Hyperlegible Next", system-ui, sans-serif;
  --mono: "Atkinson Hyperlegible Mono", ui-monospace, monospace;
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px;
  /* DESIGN-SPEC's field border (3.6:1), named */
  --field: #7C8983;
  /* Values the approved mock-ups use directly, named for their meaning */
  --go-hover: #0F5845;      /* a main button under the pointer */
  --on-ink: #E8EEEA;        /* text on the dark rail and bars */
  --on-ink-muted: #C9D3CE;  /* quieter text on dark */
  --on-ink-faint: #9FB0A8;  /* the quietest text on dark (7.4:1) */
  --ink-raised: #26372F;    /* a count or rule on dark */
  --ink-hover: #1E2E27;     /* a link under the pointer on dark */
  --idle: #9AA8A1;          /* not yet: the ring's resting dot */
  --late-line: #E9C7B6;     /* the border of a late box */
  --go-line: #BFDCD0;       /* the border of a done box */
  --dash: #AEBBB4;          /* dashed outlines */
  --tip-line: #8A9891;      /* the dotted underline of a term with a tooltip */
  --row-tint: #F7F8F7;      /* a faintly marked row */
  --late-faint: #FFFBF9;    /* a field that needs fixing */
  --late-on-ink: #FFB38F;   /* late, on dark */
  --go-on-ink: #5CC49F;     /* done, on dark (7.9:1 on --ink) */
  --client-on-ink: #7FB2E5; /* a client or inbound lead, on dark (7.5:1 on --ink) */
  /* The other values the new-client and call-screen mock-ups use, named here so
     their area stylesheets need no colour of their own */
  --band-dash: #A9B5AF;     /* the dashed rule either side of a band's words (call-phone) */
  --step-hover: #F7F9F8;    /* a step's summary under the pointer (new-client) */
  --row-blank: #FAFBFA;     /* a row still to fill in (new-client) */
  --marker: #8B9A93;        /* the clock's markers and the gap bullets (new-client) */
  /* The monthly report's paper: the client's document keeps its own print colours (lib/reportpage.mjs) */
  --paper: #FFFFFF;
  --paper-ink: #1D1D1F;
  --paper-head: #111111;
  --paper-sub: #555555;
  --paper-faint: #666666;
  --paper-line: #E3E3E3;
  --paper-rule: #DDDDDD;
  --paper-row: #F0F0F0;
  --paper-note: #FAFAFA;
  --paper-mark: #F2C200;
  --paper-up: #1F7A3A;
  --paper-down: #9A3412;
}

/* ---- base ---------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
body { margin: 0; background: var(--ground); color: var(--ink); font: 400 16px/1.45 var(--font); }
h1, h2, h3, h4, p, ul, ol, dl, figure { margin: 0; }
a { color: var(--go); }
a:hover { color: var(--go-hover); }
img, svg { max-width: 100%; }
:focus-visible { outline: 3px solid var(--go); outline-offset: 2px; border-radius: 6px; }
/* On the dark rail and bars the green ring is under 3:1, too faint to find: white there (16.8:1). */
.rail :focus-visible, .tabbar :focus-visible, .callbar :focus-visible, .topbar.full :focus-visible { outline-color: var(--surface); }
.num, code, kbd { font-family: var(--mono); font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
.i { width: 18px; height: 18px; flex: none; vertical-align: -3px; }
.muted { color: var(--muted); }
b, strong { font-weight: 800; }

/* The skip link: hidden until a keyboard reaches it, then the first thing on the page. */
.skip { position: absolute; left: var(--s3); top: -100px; z-index: 20; padding: var(--s3) var(--s4); min-height: 44px; border-radius: 8px; background: var(--surface); color: var(--go); font-weight: 800; border: 2px solid var(--go); }
.skip:focus { top: var(--s3); }

/* ---- the one layout --------------------------------------------------------------- */
.shell { display: grid; grid-template-columns: 240px minmax(0, 1fr); min-height: 100vh; }
.rail { background: var(--ink); color: var(--on-ink); padding: var(--s5) var(--s3); display: flex; flex-direction: column; gap: var(--s1); position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: 0 var(--s3) var(--s5); font-weight: 800; font-size: 18px; letter-spacing: -0.01em; text-decoration: none; color: inherit; min-height: 44px; }
.brand svg { width: 34px; height: 34px; flex: none; }
.rail .brand { color: var(--surface); }
.rail .brand:hover { color: var(--surface); }
.rail .nav a { display: flex; align-items: center; justify-content: space-between; gap: var(--s2); min-height: 44px; padding: 0 var(--s3); border-radius: 8px; text-decoration: none; font-weight: 600; color: var(--on-ink-muted); }
.rail .nav { display: flex; flex-direction: column; gap: var(--s1); }
.rail .nav a:hover { background: var(--ink-hover); color: var(--surface); }
.rail .nav a[aria-current="page"] { background: var(--surface); color: var(--ink); }
/* Home is the logo; this plain link above Clients is for newcomers, so it is quieter than the jobs. */
.rail .nav a.home { font-weight: 500; font-size: 14px; }
.rail .count { font-family: var(--mono); font-size: 13px; min-width: 24px; text-align: center; padding: 1px 7px; border-radius: 99px; background: var(--ink-raised); color: var(--on-ink); }
.rail .nav a[aria-current="page"] .count { background: var(--now); color: var(--ink); }
.rail .count.late { background: var(--late); color: var(--surface); }
/* Late calls stay red on their own page too: yellow means "now", and the pipeline is where they are rung. */
.rail .nav a[aria-current="page"] .count.late { background: var(--late); color: var(--surface); }
.rail .sep { height: 1px; background: var(--ink-raised); margin: var(--s3); }
.rail .who { margin-top: auto; padding: var(--s3); font-size: 13px; color: var(--on-ink-faint); display: grid; gap: var(--s2); }
.rail .who form { margin: 0; }
.rail .who .btn { width: 100%; background: transparent; color: var(--on-ink); border-color: var(--ink-raised); }
.rail .who .btn:hover { background: var(--ink-hover); color: var(--surface); }
.local { display: inline-block; font: 800 11px/1 var(--font); letter-spacing: .06em; text-transform: uppercase; padding: 4px 7px; border-radius: 6px; background: var(--late); color: var(--surface); cursor: help; justify-self: start; }

main { padding: var(--s6) clamp(16px, 3vw, 48px) 96px; min-width: 0; }
main:focus { outline: none; }
.head { margin-bottom: var(--s5); }
.head h1 { margin: 0; font-size: 30px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.2; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; overflow-wrap: anywhere; }
.head h1 span { color: var(--muted); font-weight: 400; }
.crumb { font-size: 14px; color: var(--muted); margin-bottom: var(--s2); }
.crumb a { color: var(--go); font-weight: 600; text-decoration: none; }
.meta { margin-top: 4px; color: var(--muted); }
.meta b { color: var(--ink); font-weight: 600; }
.purpose { margin-top: var(--s2); font-size: 15px; color: var(--ink); border-left: 3px solid var(--go); padding-left: 10px; max-width: 80ch; }

/* One line that scrolls sideways (a client's thirteen tabs wrapped at 1280, leaving two alone on a second line).
   The rule under it is a shadow, not a border, so the current tab's underline sits on it without spilling out
   of the scrolling box. */
.subnav { display: flex; flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden; scrollbar-width: thin; gap: var(--s1) var(--s2); margin: calc(-1 * var(--s2)) 0 var(--s5); box-shadow: inset 0 -1px 0 var(--line); }
.subnav a { display: inline-flex; flex: none; align-items: center; min-height: 44px; padding: 0 var(--s3); color: var(--muted); font-weight: 600; text-decoration: none; border-bottom: 3px solid transparent; white-space: nowrap; }
.subnav a:hover { color: var(--ink); }
.subnav a[aria-current="page"], .subnav a[aria-current="true"] { color: var(--ink); border-bottom-color: var(--go); }

/* The phone's top bar, tab bar and call bar: hidden on wider screens. */
.topbar, .tabbar, .callbar { display: none; }

/* Pages without the job navigation: the sign-in, and errors before it. */
.bare .shell { grid-template-columns: minmax(0, 1fr); }
.bare main { max-width: 420px; margin: 0 auto; padding-top: 12vh; } /* the sign-in card's width, so heading, line and card share one edge */
.bare .brand { color: var(--ink); padding: 0 0 var(--s5); }

@media (max-width: 760px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .rail { display: none; }
  main { padding: var(--s4) var(--s4) 104px; }
  .has-callbar main { padding-bottom: 112px; }
  .bare main { padding-bottom: var(--s6); padding-top: var(--s6); }
  .topbar { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); margin-bottom: var(--s4); }
  .topbar .brand { padding: 0; font-size: 16px; color: var(--ink); }
  .topbar .brand svg { width: 30px; height: 30px; }
  .head h1 { font-size: 26px; }
  .crumb { display: none; }

  .tabbar { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); position: fixed; left: 0; right: 0; bottom: 0; background: var(--ink); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); z-index: 5; }
  .tabbar > a, .tabbar summary { display: flex; flex-direction: column; align-items: center; gap: 2px; min-height: 52px; justify-content: center; color: var(--on-ink-muted); text-decoration: none; font-size: 12px; font-weight: 600; border-radius: 8px; position: relative; cursor: pointer; list-style: none; }
  .tabbar summary::-webkit-details-marker { display: none; }
  .tabbar > a[aria-current="page"], .tabbar .more[open] summary, .tabbar .more.on summary { color: var(--surface); background: var(--ink-hover); }
  .tabbar svg { width: 22px; height: 22px; }
  /* The count sits on the icon's top-right corner and grows outward, so two or three digits never hide the icon. */
  .tabbar .dot { position: absolute; top: 4px; left: calc(50% + 6px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 99px; background: var(--now); color: var(--ink); font: 600 11px/18px var(--mono); }
  .tabbar .dot.late { background: var(--late); color: var(--surface); }
  .tabbar .more { position: relative; }
  .tabbar .more .menu { position: absolute; right: 0; bottom: calc(100% + 10px); min-width: 220px; background: var(--ink); border-radius: var(--r); padding: var(--s2); display: grid; gap: 2px; box-shadow: 0 -4px 0 var(--ink-raised); }
  .tabbar .more .menu a, .tabbar .more .menu button { display: flex; align-items: center; min-height: 44px; padding: 0 var(--s3); border-radius: 8px; color: var(--on-ink); text-decoration: none; font: 600 15px var(--font); background: transparent; border: 0; width: 100%; text-align: left; cursor: pointer; }
  .tabbar .more .menu a:hover, .tabbar .more .menu button:hover, .tabbar .more .menu a[aria-current="page"] { background: var(--ink-hover); color: var(--surface); }
  .tabbar .more .menu form { margin: 0; }
  .tabbar .more .menu hr { border: 0; height: 1px; background: var(--ink-raised); margin: var(--s1) var(--s2); }

  .callbar { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: var(--s3); align-items: center; position: fixed; left: 0; right: 0; bottom: 0; z-index: 5; background: var(--ink); color: var(--surface); padding: 10px var(--s4) calc(10px + env(safe-area-inset-bottom)); }
  .callbar div b { display: block; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .callbar div span { display: block; font-size: 13px; color: var(--on-ink-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .callbar .btn { background: var(--now); border-color: var(--now); color: var(--ink); min-height: 48px; padding: 0 14px; font-size: 15px; }
}
@media (min-width: 2200px) {
  main { padding-left: 56px; padding-right: 56px; }
  /* On an ultrawide screen a simple page keeps a readable width. A job page laid
     out in columns for that width passes bodyClass 'wide' to opt out. */
  .ui-new:not(.wide):not(.full) main > * { max-width: 1600px; }
}
@media (pointer: coarse) {
  .crumb a, .hint a:not(.btn), .notice a:not(.btn), .card p a:not(.btn), td a:not(.btn) { padding: 13px 4px; margin: -13px -4px; display: inline-block; }
}

/* The explorer's variant: the map fills the screen under a thin strip. */
.full .shell { grid-template-columns: minmax(0, 1fr); }
.full .rail { display: none; }
.full main { padding: 0; }
.full .topbar.full { display: flex; align-items: center; gap: var(--s3); height: 48px; padding: 0 var(--s4); margin: 0; background: var(--ink); color: var(--on-ink); }
.full .topbar.full .brand { color: var(--surface); padding: 0; font-size: 16px; min-height: 0; }
.full .topbar.full .brand svg { width: 26px; height: 26px; }
.full .topbar.full a { color: var(--on-ink-muted); font-weight: 600; text-decoration: none; }
.full .topbar.full nav { display: flex; gap: var(--s3); margin-left: auto; }

/* ---- the ring: urgency, from the logo ----------------------------------------------- */
.ring { position: relative; width: 28px; height: 28px; flex: none; display: inline-grid; place-items: center; vertical-align: middle; }
.ring i { width: 10px; height: 10px; border-radius: 50%; background: var(--idle); }
.ring::before, .ring::after { content: ""; position: absolute; border-radius: 50%; border: 2px solid transparent; }
.ring::before { inset: 6px; } .ring::after { inset: 1px; }
.ring.soon i { background: var(--ink); } .ring.soon::before { border-color: var(--ink); }
.ring.now i { background: var(--now); } .ring.now::before, .ring.now::after { border-color: var(--ink); }
.ring.late i { background: var(--late); } .ring.late::before { border-color: var(--late); }
.ring.done i { background: var(--go); } .ring.done::before { border-color: var(--go); }
.ring.client i { background: var(--client); }
.ring.on-dark.now::before, .ring.on-dark.now::after, .ring.on-dark.soon::before { border-color: var(--surface); }
.ring.on-dark.soon i { background: var(--surface); }
.ring.on-dark.late i { background: var(--late-on-ink); } .ring.on-dark.late::before { border-color: var(--late-on-ink); }
.ring.on-dark.done i { background: var(--go-on-ink); } .ring.on-dark.done::before { border-color: var(--go-on-ink); }
.ring.on-dark.client i { background: var(--client-on-ink); }
.ring.md { width: 44px; height: 44px; } .ring.md i { width: 16px; height: 16px; }
.ring.md::before { inset: 10px; border-width: 3px; } .ring.md::after { inset: 2px; border-width: 3px; }
.ring.lg { width: 56px; height: 56px; } .ring.lg i { width: 20px; height: 20px; }
.ring.lg::before { inset: 12px; border-width: 3px; } .ring.lg::after { inset: 2px; border-width: 3px; }
@media (prefers-reduced-motion: no-preference) {
  .ring.now::after { animation: ring 1.6s ease-out infinite; }
  @keyframes ring { 0% { opacity: 1; transform: scale(.85); } 100% { opacity: 0; transform: scale(1.25); } }
}

/* ---- cards ---------------------------------------------------------------------------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: var(--s4); min-width: 0; }
.card + .card { margin-top: var(--s4); }
.card > h2, .sec-h { margin: 0 0 var(--s3); font-size: 17px; font-weight: 800; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.card > h2 .sub, .sec-h .sub { font-size: 14px; font-weight: 400; color: var(--muted); }
.card > h2 .end { margin-left: auto; }
h3.sub-h { margin: var(--s4) 0 var(--s2); font-size: 15px; font-weight: 800; display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; }
.card p + p, .card p + ul, .card ul + p { margin-top: var(--s2); }
.hint { font-size: 14px; color: var(--muted); margin-top: var(--s2); }
.hint b { color: var(--ink); }
.hint.warn { color: var(--late); }
.blurb { font-size: 15px; max-width: 80ch; }
.grid { display: grid; gap: var(--s4); grid-template-columns: minmax(0, 1fr); align-items: start; }
.grid > .card + .card { margin-top: 0; }
@media (min-width: 1100px) { .grid.two { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
@media (min-width: 2200px) { .grid.two.wide3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

/* Today's list card: a heading row with its link, then rows. */
.lane { background: var(--surface); border-radius: var(--r); border: 1px solid var(--line); min-width: 0; }
.lane > header { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); padding: var(--s4) var(--s4) var(--s3); border-bottom: 1px solid var(--line); }
.lane h2, .lane h3 { margin: 0; font-size: 17px; font-weight: 800; }
.lane h2 .num, .lane h3 .num { color: var(--muted); font-weight: 400; margin-left: 6px; }
.lane > header a { font-size: 14px; font-weight: 600; color: var(--go); display: inline-flex; align-items: center; min-height: 44px; }
.lane .why { margin: 0; padding: var(--s3) var(--s4) 0; font-size: 14px; color: var(--muted); }
.lane.blocked { border-color: var(--late-line); }
.lane.blocked > header { background: var(--late-soft); border-radius: var(--r) var(--r) 0 0; }
ul.rows { list-style: none; margin: 0; padding: var(--s1) 0; }
.rows li { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; gap: var(--s3); align-items: center; padding: var(--s3) var(--s4); }
.rows li + li { border-top: 1px solid var(--line); }
.rows .what b { display: block; font-weight: 600; overflow-wrap: anywhere; }
.rows .what span { display: block; font-size: 14px; color: var(--muted); }
.rows .what span.late { color: var(--late); font-weight: 600; }
.rows .what .tag { display: inline-block; }
.rows .side { display: flex; align-items: center; gap: var(--s3); flex-wrap: wrap; justify-content: flex-end; }
.rows time { font-size: 14px; color: var(--muted); }
@media (max-width: 760px) {
  .rows li { grid-template-columns: 28px minmax(0, 1fr); }
  .rows .side { grid-column: 2; justify-content: space-between; }
}

/* ---- buttons and their risk marks ------------------------------------------------------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 22px; border-radius: 10px; border: 2px solid var(--go); background: var(--go); color: var(--go-ink); font: 800 16px var(--font); text-decoration: none; cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--go-hover); border-color: var(--go-hover); color: var(--go-ink); }
.btn.quiet { background: var(--surface); color: var(--go); }
.btn.quiet:hover { background: var(--go-soft); color: var(--go); }
.btn.plain { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn.plain:hover { background: var(--ground); color: var(--ink); }
.btn.stop { background: var(--surface); color: var(--late); border-color: var(--late); }
.btn.stop:hover { background: var(--late-soft); color: var(--late); }
.btn.sm { min-height: 44px; padding: 0 16px; font-size: 15px; }
/* A button that cannot be pressed now (its setting is missing, a job is running) looks it as well as being disabled. */
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.wrap { white-space: normal; line-height: 1.2; text-align: center; padding-top: 6px; padding-bottom: 6px; }
.btn svg { width: 18px; height: 18px; flex: none; }
.acts { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2) var(--s3); margin-top: var(--s3); }
.acts form { margin: 0; }
button { font-family: inherit; }

.risk { display: inline-flex; align-items: center; gap: 5px; font: 600 12px/1 var(--font); letter-spacing: .02em; padding: 4px 8px; border-radius: 6px; border: 1px solid var(--line); background: var(--surface); color: var(--muted); white-space: nowrap; cursor: help; }
.risk::before { content: ""; width: 8px; height: 8px; border-radius: 2px; background: currentColor; flex: none; }
.risk.logs { color: var(--ink); }
.risk.logs::before { background: transparent; border: 2px solid currentColor; width: 9px; height: 9px; border-radius: 50%; }
.risk.cost { color: var(--ink); border-color: var(--ink); }
.risk.cost::before { border-radius: 50%; }
.risk.change { color: var(--surface); background: var(--ink); border-color: var(--ink); }
/* Contacts the customer: an email or text leaves the building (decision 3). */
.risk.contact { color: var(--client); background: var(--client-soft); border-color: var(--client); }
.risk.contact::before { width: 10px; height: 7px; border-radius: 1px; background: transparent; border: 2px solid currentColor; }
.risk.perm { color: var(--surface); background: var(--late); border-color: var(--late); }
.risk.perm::before { background: var(--surface); transform: rotate(45deg); }

/* ---- tags and status pills -------------------------------------------------------------- */
.tag { display: inline-block; font-size: 12px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; padding: 2px 8px; border-radius: 99px; background: var(--go-soft); color: var(--go); vertical-align: 2px; white-space: nowrap; cursor: help; }
.tag.late { background: var(--late-soft); color: var(--late); }
.tag.client, .tag.lead { background: var(--client-soft); color: var(--client); }
.tag.plain { background: var(--ground); color: var(--ink); }
.tag.tier { background: var(--ink); color: var(--surface); font-size: 13px; }
.tag.tier .num { font-weight: 400; margin-left: 4px; }

/* ---- fields ------------------------------------------------------------------------------ */
.f { margin-top: var(--s4); min-width: 0; }
.f > label, .f > .lab { display: block; font-weight: 600; margin-bottom: 6px; }
.f > label .req { color: var(--late); }
input:not([type]), input[type=text], input[type=date], input[type=time], input[type=number], input[type=email], input[type=password],
input[type=url], input[type=search], input[type=tel], input[type=datetime-local], input[type=month], select, textarea {
  width: 100%; min-height: 48px; padding: 10px 12px; border: 1px solid var(--field); border-radius: 8px; background: var(--surface); color: var(--ink); font: 400 16px var(--font); }
textarea { min-height: 96px; resize: vertical; line-height: 1.4; }
input:hover, textarea:hover, select:hover { border-color: var(--muted); }
input[aria-invalid="true"], textarea[aria-invalid="true"], select[aria-invalid="true"] { border-color: var(--late); background: var(--late-faint); }
input:disabled, textarea:disabled, select:disabled { background: var(--ground); border-style: dashed; color: var(--muted); }
input.num { font-family: var(--mono); }
.f .err { color: var(--late); font-size: 14px; font-weight: 600; margin-top: 4px; }
.pair { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: var(--s2); }
.trio { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: var(--s2); }
.fgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); gap: 0 var(--s4); }
.fgrid .full { grid-column: 1 / -1; }
.check { display: flex; align-items: flex-start; gap: 12px; min-height: 44px; padding: 8px 0; }
/* A yes/no box or a radio is drawn 24px, but the input itself is 44 by 44 so a thumb finds it: a clear
   10px border makes the room and the negative margin gives it back, so nothing on the page moves.
   The browser's own box cannot be drawn smaller than the input, so this one is drawn here. */
.check input[type=checkbox], .check input[type=radio] {
  appearance: none; -webkit-appearance: none; box-sizing: border-box; width: 44px; height: 44px; margin: -10px; padding: 0; flex: none;
  border: 10px solid transparent; border-radius: 14px; background: var(--surface); background-clip: padding-box;
  box-shadow: inset 0 0 0 2px var(--field); color: var(--go-ink); cursor: pointer; display: inline-grid; place-content: center; }
.check input[type=radio] { border-radius: 50%; }
.check input[type=checkbox]:hover, .check input[type=radio]:hover { box-shadow: inset 0 0 0 2px var(--ink); }
.check input[type=checkbox]:checked { background-color: var(--go); box-shadow: inset 0 0 0 2px var(--go); }
/* The tick: two sides of a rotated box, in white on the green. */
.check input[type=checkbox]:checked::after { content: ""; width: 6px; height: 12px; margin-top: -3px; border: solid currentColor; border-width: 0 3px 3px 0; transform: rotate(45deg); }
/* A chosen radio: a green ring with a green dot in it. */
.check input[type=radio]:checked { background-color: var(--go); box-shadow: inset 0 0 0 2px var(--go), inset 0 0 0 6px var(--surface); }
.check input[type=checkbox]:disabled, .check input[type=radio]:disabled { background-color: var(--ground); box-shadow: inset 0 0 0 2px var(--dash); cursor: default; }
.check input[type=checkbox]:checked:disabled { background-color: var(--muted); box-shadow: inset 0 0 0 2px var(--muted); }
.check input[type=radio]:checked:disabled { background-color: var(--muted); box-shadow: inset 0 0 0 2px var(--muted), inset 0 0 0 6px var(--ground); }
/* The usual 3px ring, pulled in to sit 2px outside the drawn box rather than round the clear border. */
.check input[type=checkbox]:focus-visible, .check input[type=radio]:focus-visible { outline-offset: -8px; }
/* High-contrast mode drops box shadows, which would leave no box at all: the browser's own then, at 24px. */
@media (forced-colors: active) {
  .check input[type=checkbox], .check input[type=radio] { appearance: auto; -webkit-appearance: auto; width: 24px; height: 24px; margin: 0; border: 0; }
}
.check label { font-weight: 600; cursor: pointer; padding-top: 1px; }
.check .hint { margin-top: 2px; font-weight: 400; }
details.help { margin-top: var(--s2); font-size: 14px; }
details.help > summary { cursor: pointer; color: var(--go); font-weight: 600; min-height: 44px; display: inline-flex; align-items: center; }
details.help[open] { background: var(--ground); border-radius: 8px; padding: var(--s2) var(--s3) var(--s3); }
details.help p + p { margin-top: var(--s2); }
details.fold { margin-top: var(--s4); border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
details.fold > summary { min-height: 48px; display: flex; align-items: flex-start; padding: 12px; cursor: pointer; font-weight: 600; list-style: none; }
details.fold > summary::-webkit-details-marker { display: none; }
details.fold > summary::before { content: "+"; font: 600 18px/1.3 var(--mono); width: 22px; color: var(--go); flex: none; }
details.fold[open] > summary::before { content: "\2212"; }
details.fold > summary span { font-weight: 400; color: var(--muted); }
details.fold > .in { padding: 0 12px 12px; }

/* A term that needs explaining: underlined, its meaning shown on hover and on keyboard focus. */
.tip { position: relative; text-decoration: underline dotted var(--tip-line); text-underline-offset: 3px; cursor: help; }
.tip:hover::after, .tip:focus::after { content: attr(data-tip); position: absolute; left: 0; top: calc(100% + 6px); z-index: 10; width: max-content; max-width: min(340px, 80vw); padding: var(--s2) var(--s3); background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: var(--r); box-shadow: 0 4px 0 var(--line); font: 400 14px/1.4 var(--font); white-space: normal; text-transform: none; letter-spacing: normal; }

/* ---- the table that becomes cards on a phone ---------------------------------------------- */
.tablewrap { min-width: 0; }
table.t { width: 100%; border-collapse: collapse; font-size: 15px; background: var(--surface); }
table.t caption { text-align: left; font-weight: 800; font-size: 17px; padding: 0 0 var(--s3); }
table.t th { text-align: left; font-size: 12px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); padding: var(--s2) var(--s3); border-bottom: 2px solid var(--ink); white-space: nowrap; }
table.t td { padding: var(--s3); border-bottom: 1px solid var(--line); vertical-align: top; overflow-wrap: anywhere; }
table.t tr:last-child td { border-bottom: 0; }
table.t .num, table.t th.num { text-align: right; font-family: var(--mono); }
table.t tr.late td { background: var(--late-soft); }
table.t tr.tint td { background: var(--row-tint); }
.card > table.t { margin: 0; }
@media (max-width: 760px) {
  table.t, table.t tbody, table.t tr, table.t td { display: block; width: 100%; }
  /* As a block, so its overflow clips the headings: a table-header-group ignores it and widens the page. */
  table.t thead { display: block; position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); }
  table.t { background: transparent; }
  table.t tr { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: var(--s2) var(--s3); }
  table.t tr + tr { margin-top: var(--s2); }
  table.t td { border: 0; padding: 6px 0; display: grid; grid-template-columns: minmax(96px, 38%) minmax(0, 1fr); gap: var(--s3); }
  table.t td::before { content: attr(data-label); font-size: 12px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); padding-top: 2px; }
  table.t td.num { text-align: left; }
  table.t .hide-phone { display: none; }
  .card > table.t tr { border-color: var(--line); }
}

/* ---- messages ------------------------------------------------------------------------------ */
.notices { display: grid; gap: var(--s2); margin-bottom: var(--s5); }
.notice { display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: var(--s3); align-items: start; padding: var(--s3) var(--s4); border-radius: var(--r); background: var(--surface); border: 1px solid var(--line); font-size: 15px; }
.notice > svg { width: 22px; height: 22px; margin-top: 1px; }
.notice b { font-weight: 800; }
.notice a { color: var(--go); font-weight: 600; }
.notice ul { margin: var(--s1) 0 0; padding-left: 20px; }
.notice.info > svg { color: var(--client); }
.notice.ok { background: var(--go-soft); border-color: var(--go-line); }
.notice.ok > svg { color: var(--go); }
.notice.warn > svg, .notice.warn b { color: var(--late); }
.notice.bad { background: var(--late-soft); border-color: var(--late-line); }
.notice.bad > svg, .notice.bad b { color: var(--late); }

/* ---- confirmation: a tick, then the button; never a pop-up -------------------------------------- */
.confirm { border: 2px solid var(--late); border-radius: var(--r); padding: var(--s3) var(--s4) var(--s4); background: var(--late-soft); }
.confirm .blurb { margin-bottom: var(--s2); }
.confirm .check label { color: var(--ink); }

/* ---- the empty state ----------------------------------------------------------------------- */
.empty { text-align: center; padding: var(--s6) var(--s4); color: var(--muted); }
/* A block a later piece of work fills in: dashed, so it reads as a place kept, not a broken card. */
.card.slot, .lane.slot { border-style: dashed; }
.slot-note { color: var(--muted); }
.empty .ring { margin-bottom: var(--s3); }
.empty p { max-width: 60ch; margin: 0 auto; }
.empty .btn { margin-top: var(--s4); }

/* ---- the dial: a POST form, so the check runs before every call ----------------------------------- */
.dialform { margin: 0; }
.dialbtn { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 12px; width: 100%; min-height: 64px; padding: 8px 18px; border-radius: 12px; border: 2px solid var(--go); background: var(--go); color: var(--go-ink); cursor: pointer; text-align: left; font-family: var(--font); }
.dialbtn:hover { background: var(--go-hover); border-color: var(--go-hover); }
.dialbtn svg { width: 26px; height: 26px; }
.dialbtn span { display: block; font: 800 13px/1.2 var(--font); letter-spacing: .04em; text-transform: uppercase; }
.dialbtn strong { display: block; font: 600 26px/1.15 var(--mono); letter-spacing: -0.01em; overflow-wrap: anywhere; }
.dialbtn.small { display: inline-grid; width: auto; min-height: 44px; padding: 4px 14px; gap: 8px; }
.dialbtn.small svg { width: 18px; height: 18px; }
.dialbtn.small strong { font-size: 16px; }
.riskrow { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; margin-top: var(--s2); }

/* ---- the job log (the live log of a running job; ids kept for its poller) ------------------------ */
.card.job h2 .pill { font-size: 12px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; padding: 2px 8px; border-radius: 99px; }
.card.job .pill.on { background: var(--go-soft); color: var(--go); }
.card.job .pill.off { background: var(--late-soft); color: var(--late); }
.card.job .pulse { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--now); box-shadow: 0 0 0 2px var(--ink); }
.card.job .sub { color: var(--muted); font-size: 14px; }
.card.job .st { display: flex; flex-wrap: wrap; gap: 6px; margin: var(--s3) 0; }
.card.job .st span { font-size: 13px; font-weight: 600; padding: 3px 10px; border-radius: 99px; background: var(--ground); color: var(--muted); }
.card.job .st span.running { background: var(--ink); color: var(--surface); }
.card.job .st span.done { background: var(--go-soft); color: var(--go); }
.card.job .st span.failed { background: var(--late-soft); color: var(--late); }
.card.job .log { background: var(--ground); border-radius: 8px; padding: var(--s3); max-height: 360px; overflow: auto; font: 13px/1.55 var(--mono); white-space: pre-wrap; overflow-wrap: anywhere; }
.card.job .log .err { color: var(--late); }
.card.job .log .step { font-weight: 600; margin-top: 6px; }

/* ---- the sign-in page ---------------------------------------------------------------------- */
.signin { max-width: 420px; }
.signin .btn { width: 100%; margin-top: var(--s4); }
.f.first { margin-top: 0; }

/* ---- print: the page without the app around it ------------------------------------------------ */
@media print {
  .rail, .topbar, .tabbar, .callbar, .subnav, .skip, .noprint { display: none !important; }
  .shell { display: block; }
  main { padding: 0; }
  body { background: var(--surface); }
}

/* A card's "go there" link on its own line (the redesign's hubs and frames): a 44px target with a mouse too. */
.go a, p.more a { display: inline-flex; align-items: center; min-height: 44px; }
