/* A&I Workforce — "Precision Construct" design system.
   Light white/grey canvas, hairline borders, dark-navy ink, brand red accent.
   Fonts: Hanken Grotesk (body), JetBrains Mono (eyebrows/labels/badges/nums).
   No cream, anywhere. Status colours (green/amber/blue) are status only. */

:root {
  --bg: #f6f7f9;            /* cool light-grey canvas */
  --surface: #ffffff;      /* white cards + white sidebar surfaces */
  --surface2: #f1f3f5;
  --surface3: #e7ebef;     /* subtle button hover */
  --skeleton-hi: #e9edf1;  /* skeleton shimmer highlight */
  --weekend-bg: #fbfcfd;   /* barely-there weekend column tint */
  --panel-head: #eef2f7;   /* faint blue-grey table header */
  --border: #e5e8ec;
  --border-strong: #cfd6dd;/* hairline hover / stronger edge */
  --hairline: #eef1f5;
  --text: #15181d;
  --muted: #5b636e;
  --ink: #1b2532;          /* dark navy: active chips, avatar squares, dark buttons */
  --ink-2: #33414f;
  --ink-hover: #10202f;    /* dark-button hover */

  --red: #c8312c;          /* BRAND: accent, active nav, totals row */
  --red-dark: #8f1f1b;
  --red-light: #fcefee;
  --red-border: #f3c9c6;   /* tinted stat-card edge */
  --red-soft: #c98c88;     /* muted red text on absent cells */

  --present: #14a04c; --present-bg: #e7f6ec;   /* on-site cell (white text) */
  --present-text: #0a7a3a;                     /* darker green for small text on --present-bg (WCAG AA) */
  --present-strong: #0a6e34;                   /* dark green for WHITE text on a solid green fill (WCAG AA) */
  --present-solid: #0a7a3a;                    /* brightest green that still clears WCAG AA under white cell numbers */
  --absent-bg: #fdecea;                        /* absent / weekend / today tint */
  --amber: #b45309; --amber-bg: #fdf1e3;
  --blue: #37496b; --blue-bg: #eef2f9;

  --sidebar: #1e1210;      /* dark admin side panel */
  --sidebar-2: #2a1b18;
  --sidebar-text: #d9cfcb;

  --radius: 12px; --radius-sm: 8px; --radius-lg: 16px;
  --shadow: 0 1px 2px rgba(21, 24, 29, .04), 0 4px 16px rgba(21, 24, 29, .05);
  --shadow-lg: 0 12px 40px rgba(21, 24, 29, .14);

  --font: 'Hanken Grotesk', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  line-height: 1.45;
}

/* ---- typography ---- */
h1, h2, h3 { margin: 0; font-weight: 800; letter-spacing: -.015em; line-height: 1.15; color: var(--text); }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 .5rem; color: var(--ink-2); }
a { color: var(--red); }

.eyebrow {
  font-family: var(--mono); text-transform: uppercase; letter-spacing: .1em;
  font-size: .66rem; font-weight: 700; color: var(--muted);
}
.mono { font-family: var(--mono); }
.muted { color: var(--muted); }
.small { font-size: .82rem; }
.num, .tnum { font-variant-numeric: tabular-nums; font-feature-settings: 'tnum' 1; }

/* ---- wordmark ---- */
.wordmark { display: inline-flex; align-items: center; gap: .55rem; text-decoration: none; color: var(--text); }
.wordmark img { width: 30px; height: 30px; display: block; }
.wordmark .name { font-weight: 800; font-size: 1.12rem; letter-spacing: -.015em; }
.wordmark .name .amp { color: var(--red); }

/* ---- layout ---- */
.app { min-height: 100%; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: .7rem 1rem; background: rgba(255, 255, 255, .9);
  backdrop-filter: saturate(1.3) blur(8px); border-bottom: 1px solid var(--border);
}
.topbar .who { display: flex; align-items: center; gap: .6rem; font-size: .85rem; }
.container { width: 100%; max-width: 1120px; margin: 0 auto; padding: 1rem; flex: 1; }
.container.narrow { max-width: 460px; }
/* the worker PWA is phone-first — keep it a comfortable centered column on desktop,
   not stretched edge-to-edge. The signed-out auth screen is capped narrower still. */
.app .container { max-width: 600px; }
/* room for the fixed bottom nav, so the last card scrolls fully clear of it */
.app main.container { padding-bottom: calc(4.4rem + env(safe-area-inset-bottom)); }
.auth-shell { max-width: 440px; margin-inline: auto; }
.stack > * + * { margin-top: 1rem; }
.grid { display: grid; gap: 1rem; }
/* four-stat rows go 2×2 on a phone — a single stacked column of big number
   cards pushed everything else below the fold */
.grid.cols-4 { grid-template-columns: 1fr 1fr; }
@media (min-width: 720px) { .grid.cols-2 { grid-template-columns: 1fr 1fr; } .grid.cols-3 { grid-template-columns: repeat(3, 1fr); } .grid.cols-4 { grid-template-columns: repeat(4, 1fr); } }
.row { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.spacer { flex: 1; }
.hidden { display: none !important; }

/* ---- cards ---- */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.15rem;
}
/* wrap whole units on tight screens — an eyebrow must not break mid-phrase
   ("ACTION QUEUE · 0 / ITEMS") just because a timestamp shares the row */
.card-head { display: flex; align-items: center; justify-content: space-between; gap: .3rem .6rem; margin-bottom: .9rem; flex-wrap: wrap; }
.card-head .eyebrow, .card-head > .mono { white-space: nowrap; }

/* ---- buttons ---- */
.btn {
  appearance: none; cursor: pointer;
  font-family: var(--font); font-weight: 700; font-size: .95rem;
  border-radius: var(--radius-sm); border: 1px solid transparent; padding: .68rem 1.05rem;
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  transition: transform .04s ease, background .15s ease, border-color .15s ease, opacity .15s;
  text-decoration: none; line-height: 1; color: var(--text);
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--red); color: #fff; }
.btn.primary:hover:not(:disabled) { background: var(--red-dark); }
.btn.dark { background: var(--ink); color: #fff; }
.btn.dark:hover:not(:disabled) { background: var(--ink-hover); }
.btn.ghost { background: #fff; color: var(--text); border-color: var(--border); }
.btn.ghost:hover:not(:disabled) { background: var(--surface2); border-color: var(--border-strong); }
.btn.subtle { background: var(--surface2); color: var(--text); }
.btn.subtle:hover:not(:disabled) { background: var(--surface3); }
.btn.danger { background: #fff; color: var(--red); border-color: var(--red); }
.btn.danger:hover:not(:disabled) { background: var(--red-light); }
.btn.block { width: 100%; }
.btn.sm { padding: .42rem .7rem; font-size: .82rem; }

/* ---- forms ---- */
label.field { display: block; margin-bottom: .8rem; }
label.field > span { display: block; font-size: .82rem; font-weight: 600; color: var(--ink-2); margin-bottom: .3rem; }
input, select, textarea {
  width: 100%; font-family: var(--font); font-size: .95rem; color: var(--text);
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .62rem .7rem;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--red); box-shadow: 0 0 0 3px var(--red-light); }

/* signature pad (worker signs a form before sending) */
.sigpad-lbl { display: flex; align-items: center; justify-content: space-between; font-size: .82rem; font-weight: 600; color: var(--ink-2); margin-bottom: .3rem; }
.sigpad {
  display: block; width: 100%; height: 170px; box-sizing: border-box;
  background: #fff; border: 1px dashed var(--border); border-radius: var(--radius-sm);
  touch-action: none; cursor: crosshair;
}

/* terms/privacy agreement checkbox on sign-up */
.agree { display: flex; align-items: flex-start; gap: .5rem; font-size: .82rem; color: var(--muted); line-height: 1.45; margin: -.2rem 0 .2rem; }
.agree input { width: auto; flex: none; margin-top: .12rem; padding: 0; box-shadow: none; }
.agree a { color: var(--red); font-weight: 600; }

/* ---- tabs (interim admin nav; replaced by sidebar) ---- */
.tabs { display: flex; gap: .3rem; background: var(--surface2); padding: .3rem; border-radius: var(--radius-sm); }
.tabs button {
  flex: 1; appearance: none; cursor: pointer; border: 0; background: transparent;
  font-family: var(--font); font-weight: 700; font-size: .88rem; color: var(--ink-2);
  padding: .5rem .6rem; border-radius: 6px;
}
.tabs button.active { background: #fff; color: var(--text); box-shadow: var(--shadow); }

/* ---- chips (range/filter chips) ---- */
.chip {
  appearance: none; cursor: pointer; font-family: var(--mono); font-weight: 700;
  font-size: .68rem; letter-spacing: .06em; text-transform: uppercase;
  padding: .45rem .7rem; border-radius: 999px; border: 1px solid var(--border);
  background: #fff; color: var(--ink-2);
}
.chip.active { background: var(--ink); color: #fff; border-color: var(--ink); }

/* ---- badges / status ---- */
.badge {
  display: inline-flex; align-items: center; gap: .35rem;
  font-family: var(--mono); font-size: .66rem; font-weight: 700; letter-spacing: .04em;
  text-transform: uppercase; padding: .24rem .5rem; border-radius: 999px; border: 1px solid transparent;
}
.badge .dot { width: .5rem; height: .5rem; border-radius: 999px; background: currentColor; }
.badge.present { color: var(--present-text); background: var(--present-bg); }
.badge.warn { color: var(--amber); background: var(--amber-bg); }
.badge.danger { color: var(--red); background: var(--red-light); }
.badge.info { color: var(--blue); background: var(--blue-bg); }
.badge.neutral { color: var(--ink-2); background: var(--surface2); }
.badge.role { color: var(--ink-2); background: var(--surface2); }
.pulse { animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .35; } }

/* ---- tables ---- */
/* contain:paint keeps a too-wide table's overflow from leaking into the PAGE's
   scroll width (Chrome quirk) — without it the whole page pans sideways on a
   phone instead of the table scrolling inside its card. */
.table-wrap { overflow-x: auto; contain: paint; border: 1px solid var(--border); border-radius: var(--radius); background: #fff; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; background: #fff; }
th, td { text-align: left; padding: .65rem .8rem; border-bottom: 1px solid var(--hairline); white-space: nowrap; }
th { font-family: var(--mono); font-size: .66rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; background: var(--panel-head); }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--surface2); }
td.num { font-family: var(--mono); font-variant-numeric: tabular-nums; }
/* phone: pin the first column while a wide table scrolls, so you keep the row's
   identity while swiping right to reach Approve / Edit / etc. */
@media (max-width: 640px) {
  .table-wrap table th:first-child, .table-wrap table td:first-child { position: sticky; left: 0; z-index: 1; box-shadow: 6px 0 6px -5px rgba(0,0,0,.18); }
  .table-wrap table td:first-child { background: var(--surface); }
  .table-wrap table th:first-child { background: var(--panel-head); }
}
/* small "swipe →" cue shown under action tables on phone only */
.swipe-hint { display: none; }
@media (max-width: 640px) {
  .swipe-hint { display: block; text-align: right; margin-top: .45rem; font-family: var(--mono); font-size: .58rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
}

/* ---- clock (worker hero) ---- */
.clock-hero { text-align: center; padding: 1.4rem 1rem 1.8rem; }
.clock-state { font-family: var(--mono); text-transform: uppercase; letter-spacing: .12em; font-size: .7rem; font-weight: 700; color: var(--muted); }
.clock-since { font-size: 2.4rem; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -.02em; margin: .2rem 0 .1rem; }
.clock-btn {
  --c: var(--red);
  width: 208px; height: 208px; border-radius: 999px; border: 0; cursor: pointer;
  margin: 1rem auto; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .3rem;
  color: #fff; background: var(--c);
  box-shadow: 0 12px 30px color-mix(in srgb, var(--c) 38%, transparent);
  font-family: var(--font); transition: transform .06s ease, filter .15s ease;
}
.clock-btn:active { transform: scale(.97); }
.clock-btn:disabled { filter: grayscale(.3) opacity(.7); cursor: not-allowed; }
.clock-btn .big { font-size: 1.5rem; font-weight: 800; }
.clock-btn .sub { font-family: var(--mono); font-size: .68rem; letter-spacing: .08em; text-transform: uppercase; opacity: .92; }
.clock-btn.out { --c: #fff; color: var(--red); box-shadow: 0 12px 30px rgba(0,0,0,.18); }
/* on-site card is red */
.card.onsite { background: var(--red); color: #fff; border-color: var(--red-dark); }
.card.onsite .clock-state, .card.onsite .muted { color: rgba(255,255,255,.85); }
.card.onsite .clock-since { color: #fff; }

/* ---- misc ---- */
.pill-list { display: flex; flex-direction: column; gap: .5rem; }
.list-item { display: flex; align-items: center; justify-content: space-between; gap: .8rem; padding: .7rem .2rem; border-bottom: 1px solid var(--hairline); }
.list-item:last-child { border-bottom: 0; }
.avatar { width: 34px; height: 34px; border-radius: var(--radius-sm); background: var(--ink); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: .82rem; flex: none; }
.empty { text-align: center; padding: 2rem 1rem; color: var(--muted); }
.empty .mark { width: 44px; height: 44px; opacity: .45; margin: 0 auto .6rem; display: block; }

.banner { border-radius: var(--radius-sm); padding: .7rem .9rem; font-size: .88rem; display: flex; gap: .5rem; align-items: center; }
.banner.info { background: var(--blue-bg); color: var(--blue); }
.banner.warn { background: var(--amber-bg); color: var(--amber); }
.banner.danger { background: var(--red-light); color: var(--red-dark); }
.banner.ok { background: var(--present-bg); color: var(--present-text); }

.toast-wrap { position: fixed; left: 0; right: 0; bottom: 1rem; display: flex; flex-direction: column; align-items: center; gap: .5rem; z-index: 60; pointer-events: none; }
/* on worker pages the bottom nav owns the bottom edge — lift toasts above it */
body:has(.bottom-nav) .toast-wrap { bottom: calc(4.4rem + env(safe-area-inset-bottom)); }
/* Non-interactive: a transient toast must never intercept a tap on a control beneath it. */
.toast { pointer-events: none; background: var(--ink); color: #fff; padding: .6rem .9rem; border-radius: 999px; font-size: .85rem; box-shadow: var(--shadow-lg); max-width: 92vw; }
.toast.err { background: var(--red); }
.toast.ok { background: var(--present-strong); }

.stat { text-align: center; }
.stat .n { font-size: 1.9rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.stat .l { font-family: var(--mono); font-size: .64rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; }

/* ---- owner console (owner.html) ---- */
.owner-top { display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: .9rem 1.1rem; background: var(--surface); border-bottom: 1px solid var(--border); }
.owner-top .brand { display: flex; align-items: center; gap: .6rem; }
.owner-top .brand img { width: 30px; height: 30px; }
.owner-top .brand .name { font-weight: 800; letter-spacing: -.01em; }
.owner-top .brand .amp { color: var(--red); }
.owner-top .brand .sub { font-family: var(--mono); font-size: .6rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); font-weight: 700; }
.owner-kpis { display: grid; gap: 1rem; grid-template-columns: repeat(2, 1fr); }
@media (min-width: 720px) { .owner-kpis { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1000px) { .owner-kpis { grid-template-columns: repeat(6, 1fr); } }

.code-box { font-family: var(--mono); font-size: .8rem; background: var(--surface2); border: 1px dashed var(--border); border-radius: var(--radius-sm); padding: .6rem .7rem; word-break: break-all; }

.spinner { width: 18px; height: 18px; border-radius: 999px; border: 2px solid rgba(255,255,255,.4); border-top-color: #fff; animation: spin .7s linear infinite; }
.center-load { display: grid; place-items: center; min-height: 60vh; text-align: center; padding: 0 1.5rem; }
.center-load .spinner { width: 30px; height: 30px; border-color: var(--border); border-top-color: var(--red); }
@keyframes spin { to { transform: rotate(360deg); } }
/* Shown by js/boot-watchdog.js if the app is still on its initial load after a
   few seconds — replaces a silently-stuck spinner with an honest message. */
.boot-msg { max-width: 320px; color: var(--muted); font-size: .92rem; line-height: 1.5; }

/* skeleton loaders */
.skeleton { background: linear-gradient(90deg, var(--surface2) 25%, var(--skeleton-hi) 37%, var(--surface2) 63%); background-size: 400% 100%; animation: shimmer 1.3s ease infinite; border-radius: 6px; }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }

.foot { text-align: center; color: var(--muted); font-size: .74rem; padding: 1.4rem 1rem; }
.foot .mono { font-size: .7rem; }

/* ---- worker bottom nav ---- */
.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: flex; justify-content: center; background: rgba(255,255,255,.95); backdrop-filter: blur(8px);
  border-top: 1px solid var(--border); padding: .3rem .3rem calc(.3rem + env(safe-area-inset-bottom));
}
.bottom-nav button {
  flex: 1; appearance: none; border: 0; background: transparent; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: .15rem; padding: .5rem;
  font-size: 1.15rem; color: var(--muted); border-radius: var(--radius-sm);
  /* cap so the tabs hug the app's centered column on desktop instead of
     spreading to the screen corners; no effect on phones (flex:1 < cap) */
  max-width: 9.5rem;
}
.bottom-nav button span { font-family: var(--mono); font-size: .6rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.bottom-nav button.active { color: var(--red); }
/* denser layout when there are 6 tabs */
.bottom-nav.six button { padding: .5rem .1rem; font-size: 1.05rem; }
.bottom-nav.six button span { font-size: .52rem; letter-spacing: .04em; }

/* ---- worker home (rich clock-in) ---- */
.wh-greet { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin: .1rem 0; }
.wh-greet .g-eyebrow { font-family: var(--mono); text-transform: uppercase; letter-spacing: .1em; font-size: .66rem; font-weight: 700; color: var(--muted); }
.wh-greet h1 { font-size: 1.7rem; margin-top: .12rem; }
.wh-greet .g-actions { display: flex; align-items: center; gap: .55rem; flex: none; }
.admin-switch { text-decoration: none; }
@media (max-width: 400px) { .admin-switch span { display: none; } } /* just the ⚙ on tiny screens */
.icon-btn { width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--border); background: #fff; display: grid; place-items: center; cursor: pointer; font-size: 1.15rem; color: var(--ink-2); }
.icon-btn:hover { background: var(--surface2); }
.avatar-sq { width: 44px; height: 44px; border-radius: 12px; background: var(--red); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: .9rem; border: 0; cursor: pointer; font-family: var(--font); }

.hero-clock { background: var(--red); color: #fff; border-radius: var(--radius-lg); padding: 1.4rem; position: relative; overflow: hidden; box-shadow: 0 14px 34px color-mix(in srgb, var(--red) 32%, transparent); }
.hero-clock .h-logo { position: absolute; top: 1.3rem; right: 1.3rem; width: 56px; height: 56px; border-radius: 14px; background: #fff; display: grid; place-items: center; padding: .5rem; }
.hero-clock .h-logo img { width: 100%; height: 100%; object-fit: contain; }
.hero-clock .h-date { font-family: var(--mono); font-size: .72rem; letter-spacing: .1em; text-transform: uppercase; color: rgba(255,255,255,.9); }
.hero-clock .h-time { font-size: 3rem; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -.02em; line-height: 1.02; margin: .15rem 0 .35rem; }
.hero-clock .h-sub { color: rgba(255,255,255,.92); font-size: .95rem; margin: 0 0 1rem; max-width: 34ch; }
.h-pills { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: 1.1rem; }
/* dark translucent backing (not light) so white pill text clears WCAG AA on the red hero */
.h-pill { display: inline-flex; align-items: center; gap: .45rem; font-family: var(--mono); font-size: .64rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; padding: .5rem .8rem; border-radius: 999px; background: rgba(0,0,0,.2); color: #fff; }
.h-pill .dot { width: .5rem; height: .5rem; border-radius: 999px; background: currentColor; }
.h-pill.live .dot { animation: pulse 1.6s ease-in-out infinite; }
.hero-btn { width: 100%; border: 0; border-radius: 14px; background: #fff; color: var(--red); font-weight: 800; font-size: 1.1rem; letter-spacing: .03em; padding: 1.05rem; cursor: pointer; font-family: var(--font); display: inline-flex; align-items: center; justify-content: center; gap: .5rem; transition: transform .06s ease, filter .15s; }
.hero-btn:active { transform: scale(.99); }
.hero-btn:disabled { filter: opacity(.75); cursor: not-allowed; }
/* clocked in → the whole card goes green (red = not clocked in). Uses the darker
   --present-strong so the white date/subline/button clear WCAG AA on green. */
.hero-clock.in { background: var(--present-strong); box-shadow: 0 14px 34px color-mix(in srgb, var(--present-strong) 40%, transparent); }
.hero-clock.in .hero-btn { background: rgba(0,0,0,.24); color: #fff; box-shadow: inset 0 0 0 1px rgba(255,255,255,.4); }
.hero-btn .spinner { width: 18px; height: 18px; border-color: rgba(200,49,44,.3); border-top-color: var(--red); }

.qa-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: .7rem; }
.qa-grid.two { grid-template-columns: repeat(2, 1fr); }
.qa { background: #fff; border: 1px solid var(--border); border-radius: 14px; padding: 1rem .4rem; display: flex; flex-direction: column; align-items: center; gap: .5rem; cursor: pointer; box-shadow: var(--shadow); font-family: var(--font); }
.qa:hover { border-color: var(--border-strong); }
.qa .qa-ic { font-size: 1.3rem; line-height: 1; }
.qa .qa-l { font-weight: 700; font-size: .82rem; color: var(--text); }

.wk-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 1.1rem; }
.wk-total { font-size: 1.5rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.wk-total small { font-size: .82rem; font-weight: 600; color: var(--muted); }
.rings { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: .25rem; align-items: start; justify-items: stretch; }
.ring { display: flex; flex-direction: column; align-items: center; gap: .4rem; min-width: 0; }
/* width is capped at 42px and never driven by content (so a multi-char number can't
   resize one circle and knock the "today" ring out of the row); it only shrinks
   below 42px on screens too narrow to fit all 7 at full size (e.g. 320px phones),
   with height following via aspect-ratio so it always stays a circle. */
.ring .r { width: min(42px, 100%); height: auto; aspect-ratio: 1; flex: none; border-radius: 999px; border: 3px solid var(--border); display: grid; place-items: center; font-weight: 800; font-size: .78rem; font-variant-numeric: tabular-nums; color: var(--ink); }
.ring.worked .r { border-color: var(--red); }
.ring.today .r { border-color: var(--present); color: var(--present-strong); }
.ring.off .r { color: var(--muted); }
.ring .d { font-family: var(--mono); font-size: .62rem; font-weight: 700; color: var(--muted); text-transform: uppercase; }
.ring.today .d { color: var(--red); }

.recent-item { display: flex; align-items: center; gap: .8rem; padding: .7rem 0; border-bottom: 1px solid var(--hairline); }
.recent-item:last-child { border-bottom: 0; }
.recent-ic { width: 38px; height: 38px; border-radius: 10px; background: var(--surface2); display: grid; place-items: center; color: var(--muted); flex: none; font-size: 1rem; }
.recent-item .r-main { flex: 1; min-width: 0; }
.recent-item .r-t { font-weight: 700; font-size: .9rem; }
.recent-item .r-s { font-size: .8rem; color: var(--muted); }
.recent-item .r-date { font-family: var(--mono); font-size: .72rem; color: var(--muted); white-space: nowrap; }

/* ---- modal ---- */
.modal-wrap { position: fixed; inset: 0; z-index: 70; background: rgba(21,24,29,.45); display: grid; place-items: center; padding: 1rem; }
.modal { width: 100%; max-width: 420px; text-align: center; }

/* ---- admin shell + dark sidebar ---- */
.admin-shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 236px; flex: none; background: var(--surface); color: var(--ink-2);
  border-right: 1px solid var(--border);
  position: fixed; top: 0; bottom: 0; left: 0; display: flex; flex-direction: column;
  padding: 1rem .75rem; z-index: 40; overflow-y: auto;
}
.sidebar .brand { display: flex; align-items: center; gap: .55rem; padding: .3rem .35rem 1rem; }
.sidebar .brand img { width: 28px; height: 28px; }
.sidebar .brand .name { color: var(--text); font-weight: 800; font-size: 1.02rem; line-height: 1; }
.sidebar .brand .name .amp { color: var(--red); }
.sidebar .brand .sub { font-family: var(--mono); font-size: .56rem; letter-spacing: .14em; color: var(--muted); text-transform: uppercase; }
.nav-group-label { font-family: var(--mono); font-size: .58rem; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin: .9rem .5rem .35rem; }
.nav-item {
  display: flex; align-items: center; gap: .6rem; width: 100%; text-align: left;
  appearance: none; border: 0; background: transparent; cursor: pointer;
  color: var(--ink-2); font-family: var(--font); font-weight: 600; font-size: .9rem;
  padding: .55rem .6rem; border-radius: var(--radius-sm); margin-bottom: .1rem;
}
.nav-item .ic { width: 1.1rem; text-align: center; }
.nav-item:hover { background: var(--surface2); color: var(--text); }
.nav-item.active { background: var(--red); color: #fff; }
/* unread/attention count pill on a nav item (pending time-off, open feedback, new forms) */
.nav-badge {
  margin-left: auto; min-width: 1.15rem; height: 1.15rem; padding: 0 .3rem; box-sizing: border-box;
  border-radius: 999px; background: var(--red); color: #fff;
  font-family: var(--mono); font-size: .62rem; font-weight: 700; line-height: 1.15rem; text-align: center;
}
.nav-badge[hidden] { display: none; }
.nav-item.active .nav-badge { background: #fff; color: var(--red); }
/* inline "jump to section" links in the dashboard's needs-attention banner */
.dash-link { appearance: none; border: 0; background: none; padding: 0; cursor: pointer; font: inherit; color: inherit; font-weight: 700; text-decoration: underline; }
/* "Clock in" shortcut back to the worker app — a link styled as a nav item, set
   off from the section list below it. */
.nav-clockin { text-decoration: none; color: var(--red); font-weight: 700; border: 1px solid var(--border); margin-bottom: .7rem; }
.nav-clockin:hover { background: color-mix(in srgb, var(--red) 8%, #fff); color: var(--red); }
.sidebar-foot { margin-top: auto; padding-top: 1rem; border-top: 1px solid var(--border); display: flex; align-items: center; gap: .55rem; }
.sidebar-foot .avatar { background: var(--ink); }
.sidebar-foot .nm { flex: 1; min-width: 0; color: var(--text); font-size: .82rem; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-foot .so { appearance: none; border: 0; background: transparent; color: var(--muted); font-family: var(--mono); font-size: .6rem; font-weight: 700; letter-spacing: .08em; cursor: pointer; }
.admin-main { margin-left: 236px; flex: 1; padding: 1.4rem 1.5rem 3rem; min-width: 0; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.1rem; }
.page-head .sub { color: var(--muted); font-size: .85rem; margin: .2rem 0 0; }

.sidebar-toggle { display: none; }
@media (max-width: 820px) {
  .sidebar { transform: translateX(-100%); transition: transform .2s ease; width: 220px; box-shadow: var(--shadow-lg); }
  .sidebar.open { transform: translateX(0); }
  .admin-main { margin-left: 0; padding: 1rem; }
  .sidebar-toggle { display: inline-flex; }
}

/* ---- action queue ---- */
.aq-row { display: flex; align-items: center; gap: .7rem; padding: .6rem .2rem; border-bottom: 1px solid var(--hairline); }
.aq-row:last-child { border-bottom: 0; }
.aq-ic { width: 30px; height: 30px; border-radius: var(--radius-sm); background: var(--amber-bg); color: var(--amber); display: grid; place-items: center; flex: none; }

/* ---- mini bar (hours) ---- */
.minibar { height: 7px; border-radius: 999px; background: var(--surface2); overflow: hidden; min-width: 80px; }
.minibar > i { display: block; height: 100%; background: var(--red); border-radius: 999px; }

/* ---- attendance grid — pixel-matched to the handoff (IBM Plex + exact spacing),
   rendered in our BRAND colours. Scoped to .grid-skin so IBM Plex stays on this page only. */
.grid-skin { font-family: 'IBM Plex Sans', var(--font); color: var(--ink); }
.grid-skin .page-head h1 { font-size: 26px; font-weight: 700; letter-spacing: -.02em; }
.grid-skin .page-head .sub { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; font-family: 'IBM Plex Mono', var(--mono); font-size: 12px; color: var(--muted); }
.grid-skin .page-head .sub .badge { background: var(--surface); border: 1px solid var(--border); color: var(--muted); border-radius: 999px; padding: 3px 9px; font-weight: 500; }
.grid-skin .btn.primary { border-radius: 8px; padding: 10px 18px; font-size: 14px; font-weight: 600; }

.grid-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin: 24px 0 20px; }
/* min-width:0 lets these shrink below their content so the range .seg inside
   can hit its max-width and scroll, instead of propping the page open */
.grid-controls, .grid-selects { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; min-width: 0; }
.grid-selects { gap: 10px; }
/* segmented control (range + unit) */
/* max-width + overflow so a long segmented row (e.g. the grid's six date
   ranges) thumb-scrolls inside its pill on a phone instead of pushing the
   page wider than the screen. Scrollbar hidden — the cut-off pill is the cue. */
.seg { display: inline-flex; gap: 2px; background: var(--surface); border: 1px solid var(--border); border-radius: 9px; padding: 3px; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.seg::-webkit-scrollbar { display: none; }
.seg button { display: inline-flex; align-items: center; gap: 7px; border: 0; background: transparent; color: var(--ink-2); font-family: 'IBM Plex Sans', var(--font); font-weight: 500; font-size: 13px; padding: 7px 13px; border-radius: 7px; cursor: pointer; white-space: nowrap; }
.seg button:hover { color: var(--ink); }
.seg button.active { background: var(--ink); color: #fff; font-weight: 600; }
/* live count badge inside a segmented tab */
.seg button .cnt { font-family: 'IBM Plex Mono', var(--mono); font-size: 11px; font-weight: 600; padding: 1px 6px; border-radius: 999px; background: var(--hairline); color: var(--muted); }
.seg button.active .cnt { background: rgba(255,255,255,.18); color: #fff; }
/* filter dropdowns sized to content (overriding the global full-width select) */
.grid-selects select { width: auto; min-width: 130px; min-height: 0; border-radius: 9px; padding: 9px 13px; font-size: 13px; font-family: 'IBM Plex Sans', var(--font); }

.grid-skin .matrix-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); box-shadow: 0 1px 3px rgba(21,37,50,.05); }
table.matrix { border-collapse: separate; border-spacing: 0; width: 100%; }
table.matrix th, table.matrix td { border-bottom: 1px solid var(--hairline); text-align: center; white-space: nowrap; }
table.matrix thead th { font-family: 'IBM Plex Mono', var(--mono); font-size: 11px; font-weight: 500; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); background: var(--panel-head); position: sticky; top: 0; z-index: 2; border-left: 1px solid var(--hairline); padding: 12px 8px; }
table.matrix thead th .dow { display: block; font-weight: 600; color: var(--ink-2); }
table.matrix thead th .dte { display: block; color: var(--muted); font-weight: 400; margin-top: 2px; }
table.matrix th.worker-col, table.matrix td.worker-col { position: sticky; left: 0; z-index: 1; background: var(--surface); text-align: left; box-shadow: 1px 0 0 var(--border); border-left: 0; padding: 8px 20px; }
table.matrix thead th.worker-col { z-index: 3; background: var(--panel-head); padding: 12px 20px; }
table.matrix tbody td { padding: 8px; border-left: 1px solid var(--hairline); }
table.matrix tbody tr:hover td, table.matrix tbody tr:hover td.worker-col { background: var(--surface2); }
table.matrix .col-today { background: var(--red-light); }
table.matrix thead th.col-today .dow, table.matrix thead th.col-today .dte { color: var(--red); }
table.matrix .col-weekend { background: var(--weekend-bg); }
table.matrix thead th.total-col, table.matrix td.total { text-align: right; }
/* worker cell: avatar + name + dominant site */
.matrix td.worker-col .wc { display: flex; align-items: center; gap: 12px; min-width: 0; }
.matrix .g-ava { width: 30px; height: 30px; border-radius: 999px; display: grid; place-items: center; font-family: 'IBM Plex Sans', var(--font); font-weight: 600; font-size: 11px; flex: none; }
.matrix .wc .nm { min-width: 0; }
.matrix .wc .nm b { display: block; font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; }
.matrix .wc .nm .st { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; }
.matrix td.worker-col.grp { background: var(--surface2); font-family: 'IBM Plex Mono', var(--mono); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 600; padding: 8px 20px; }
/* value pill (on site) + faint em-dash (absent) */
.cell { display: inline-block; min-width: 46px; padding: 4px 8px; border-radius: 6px; font-family: 'IBM Plex Mono', var(--mono); font-size: 12.5px; font-weight: 600; font-variant-numeric: tabular-nums; }
/* Solid green when present (white hours), solid red when a WORKING day has no record. */
.cell.present { background: var(--present-solid); color: #fff; }
.cell.absent { min-width: 46px; padding: 4px 8px; background: var(--red); color: #fff; font-weight: 600; }
/* Weekends aren't "missing" days — keep their blanks a quiet dash, not a wall of red. */
table.matrix td.col-weekend .cell.absent { min-width: 0; padding: 0; background: none; color: var(--border-strong); font-weight: 400; }
table.matrix td.total { font-family: 'IBM Plex Mono', var(--mono); font-size: 13px; font-weight: 600; }
/* daily totals row — dark ink */
table.matrix tr.totals td { background: var(--ink); color: #fff; font-family: 'IBM Plex Mono', var(--mono); font-size: 13px; font-weight: 600; border-bottom: 0; border-left: 1px solid rgba(255,255,255,.08); padding: 13px 8px; }
table.matrix tr.totals td.worker-col { background: var(--ink); color: #fff; box-shadow: 1px 0 0 rgba(0,0,0,.3); text-align: left; border-left: 0; padding: 13px 20px; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; }
table.matrix tr.totals .tsq { display: inline-block; width: 8px; height: 8px; border-radius: 2px; background: var(--red); margin-right: 10px; vertical-align: middle; }
table.matrix tr.totals td.z { color: rgba(255,255,255,.6); } /* dimmer than active totals but WCAG-AA on ink */
table.matrix tr.totals td.grand { text-align: right; font-weight: 700; }
.legend { display: flex; flex-wrap: wrap; gap: 20px; margin-top: 16px; font-size: 12.5px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: .4rem; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; border: 1px solid transparent; }
.legend .sw-present { background: var(--present-solid); border-color: var(--present-strong); }
.legend .sw-absent { background: var(--red); border-color: var(--red-dark); }
.legend .sw-today { background: var(--red-light); border-color: var(--red-border); }

/* ---- shared "design console" skin — IBM Plex + the redesign prototypes' exact
   spacing, rendered in our BRAND colours. Scoped to .dcx so it stays on the
   redesigned admin pages (Workers, Sites, Time Off, …) only. ---- */
.dcx { font-family: 'IBM Plex Sans', var(--font); color: var(--ink); }
.dcx .page-head { align-items: flex-start; }
.dcx .page-head h1 { font-size: 26px; font-weight: 700; letter-spacing: -.02em; }
.dcx-chips { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-top: 10px; font-family: 'IBM Plex Mono', var(--mono); font-size: 12px; color: var(--muted); }
.dcx-chips .dcx-chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); font-weight: 500; letter-spacing: normal; text-transform: none; cursor: default; }
.dcx-chips .dcx-chip b { font-weight: 600; color: var(--ink); }
.dcx-chips .dcx-chip i { width: 6px; height: 6px; border-radius: 999px; display: inline-block; flex: none; }
.dcx-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin: 24px 0 14px; }
.dcx-search { width: 280px; max-width: 100%; min-height: 0; padding: 9px 14px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface); font-family: 'IBM Plex Sans', var(--font); font-size: 13px; color: var(--ink); }
.dcx-search:focus { outline: none; border-color: var(--border-strong); }

/* card that holds a grid-based table (overflow-scrolls; headers span full width) */
.dcx-card { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; overflow-x: auto; box-shadow: 0 1px 3px rgba(21,37,50,.05); }
.dcx-card > .inner { min-width: max-content; }
.dcx-row { display: grid; align-items: center; border-bottom: 1px solid var(--hairline); background: var(--surface); }
.dcx-row.head { background: var(--panel-head); border-bottom: 1px solid var(--border); }
.dcx-row.head .h { padding: 12px 8px; font-family: 'IBM Plex Mono', var(--mono); font-size: 11px; font-weight: 500; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.dcx-row.head .h:first-child { padding-left: 20px; }
.dcx-body:hover { background: var(--surface2); }
.dcx .c { padding: 12px 8px; min-width: 0; }
.dcx .c-first { padding: 12px 20px; }
.dcx .c-end { display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding: 12px 20px 12px 8px; }
.dcx-empty { padding: 48px 20px; text-align: center; color: var(--muted); font-size: 14px; }
/* an empty table has nothing worth scrolling to — drop the max-content
   sizing so the message sits centred in the visible card and wraps, instead
   of being pushed half off-screen by the header row's width on a phone */
.dcx-card:has(> .inner .dcx-empty) > .inner { min-width: 0; }

/* avatar, status pill, id badges, compact select, count chip, quiet button */
.dcx-ava { width: 32px; height: 32px; border-radius: 999px; display: grid; place-items: center; font-family: 'IBM Plex Sans', var(--font); font-weight: 600; font-size: 11px; flex: none; }
.dcx-pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 999px; font-family: 'IBM Plex Mono', var(--mono); font-size: 10.5px; font-weight: 600; letter-spacing: .06em; }
.dcx-pill i { width: 5px; height: 5px; border-radius: 999px; display: inline-block; flex: none; }
.dcx-pill.ok { background: var(--present-bg); color: var(--present-text); }
.dcx-pill.ok i { background: var(--present); }
.dcx-pill.off { background: var(--surface2); color: var(--muted); }
.dcx-pill.off i { background: var(--border-strong); }
.dcx-pill.warn { background: var(--amber-bg); color: var(--amber); }
.dcx-pill.warn i { background: var(--amber); }
.dcx-idbadge { padding: 1px 6px; border-radius: 999px; font-family: 'IBM Plex Mono', var(--mono); font-size: 9px; font-weight: 600; letter-spacing: .08em; white-space: nowrap; }
.dcx-idbadge.you { background: var(--ink); color: #fff; }
.dcx-idbadge.owner { background: var(--red-light); color: var(--red); }
.dcx-select { appearance: none; -webkit-appearance: none; width: 100%; max-width: 150px; min-height: 0; padding: 7px 26px 7px 11px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6'><path d='M1 1l4 4 4-4' stroke='%235b636e' fill='none' stroke-width='1.5'/></svg>") no-repeat right 10px center; font-family: 'IBM Plex Sans', var(--font); font-size: 12.5px; color: var(--ink); cursor: pointer; }
.dcx-select:disabled { cursor: default; opacity: .65; }
.dcx-count { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); font-family: 'IBM Plex Mono', var(--mono); font-size: 11px; font-weight: 600; color: var(--ink-2); }
button.dcx-count { cursor: pointer; }
button.dcx-count:hover { border-color: var(--border-strong); }
.dcx-quiet { border: none; background: transparent; color: var(--muted); font-family: 'IBM Plex Sans', var(--font); font-size: 12.5px; font-weight: 500; cursor: pointer; padding: 7px 12px; border-radius: 7px; }
.dcx-quiet:hover { color: var(--red); }

/* worker identity cell */
.dcx-who { display: flex; align-items: center; gap: 12px; min-width: 0; }
.dcx-who .nm { min-width: 0; }
.dcx-who .nm .top { display: flex; align-items: center; gap: 7px; }
.dcx-who .nm .top b { font-size: 14px; font-weight: 600; white-space: nowrap; }
.dcx-who .nm .em { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* onboard / invite card */
.dcx-panel { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 22px 24px; box-shadow: 0 1px 3px rgba(21,37,50,.05); margin-top: 20px; }
.dcx-eyebrow { font-family: 'IBM Plex Mono', var(--mono); font-size: 11px; font-weight: 600; letter-spacing: .1em; color: var(--muted); text-transform: uppercase; }
.dcx-panel h2 { font-size: 17px; font-weight: 700; margin: 6px 0 0; }
.dcx-invform { display: flex; gap: 10px; margin-top: 14px; flex-wrap: wrap; }
.dcx-invform input { flex: 1; min-width: 240px; min-height: 0; padding: 10px 14px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface); font-family: 'IBM Plex Sans', var(--font); font-size: 13.5px; color: var(--ink); }
.dcx-invform input:focus { outline: none; border-color: var(--border-strong); }
.dcx-btn-accent { border: none; border-radius: 9px; padding: 10px 20px; background: var(--red); color: #fff; font-family: 'IBM Plex Sans', var(--font); font-size: 13.5px; font-weight: 600; cursor: pointer; box-shadow: 0 1px 2px rgba(21,24,29,.12); white-space: nowrap; }
.dcx-btn-accent:hover { filter: brightness(.94); }
.dcx-help { font-size: 12.5px; color: var(--muted); margin-top: 10px; }
.dcx-help b { font-weight: 600; color: var(--ink); }
.dcx-invlist { display: flex; flex-direction: column; gap: 8px; margin-top: 16px; }
.dcx-invrow { display: flex; align-items: center; gap: 14px; padding: 11px 14px; border: 1px solid var(--hairline); border-radius: 10px; background: var(--panel-head); flex-wrap: wrap; }
.dcx-code { font-family: 'IBM Plex Mono', var(--mono); font-size: 13px; font-weight: 700; letter-spacing: .04em; padding: 4px 10px; background: var(--surface); border: 1px solid var(--border); border-radius: 7px; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dcx-invrow .meta { flex: 1; min-width: 160px; }
.dcx-invrow .meta .hint { font-size: 13px; font-weight: 600; }
.dcx-invrow .meta .exp { font-family: 'IBM Plex Mono', var(--mono); font-size: 10.5px; color: var(--muted); margin-top: 1px; }
.dcx-copy { border: 1px solid var(--border); border-radius: 7px; padding: 7px 12px; background: var(--surface); color: var(--ink-2); font-family: 'IBM Plex Sans', var(--font); font-size: 12.5px; font-weight: 500; cursor: pointer; }
.dcx-copy:hover { border-color: var(--border-strong); color: var(--ink); }
.dcx-noinv { padding: 18px 14px; border: 1.5px dashed var(--border); border-radius: 10px; text-align: center; font-size: 13px; color: var(--muted); }

/* Workers page column template (worker | trade | role | sites | status | actions) */
.dcx.workers .dcx-row { grid-template-columns: minmax(250px, 1.4fr) 140px 170px 96px 116px 150px; }

/* shared form primitives (Sites, Time Off, Billing forms) */
.dcx .flabel { display: block; font-size: 12.5px; font-weight: 600; margin-bottom: 6px; }
.dcx .flabel .opt { font-weight: 400; color: var(--muted); }
.dcx-input { width: 100%; min-height: 0; padding: 10px 13px; border: 1px solid var(--border); border-radius: 9px; font-family: 'IBM Plex Sans', var(--font); font-size: 13.5px; background: var(--surface); color: var(--ink); }
.dcx-input:focus { outline: none; border-color: var(--border-strong); }
.dcx-input.mono { font-family: 'IBM Plex Mono', var(--mono); font-size: 13px; }
.dcx-obtn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--border); border-radius: 7px; padding: 7px 12px; background: var(--surface); color: var(--ink-2); font-family: 'IBM Plex Sans', var(--font); font-size: 12.5px; font-weight: 500; cursor: pointer; }
.dcx-obtn:hover { border-color: var(--border-strong); color: var(--ink); }

/* Sites page: two-column layout, rich site cards, sticky form */
/* min(400px, 100%) so the column never exceeds the screen — a plain 400px
   minimum forced the whole page to pan sideways on phones. */
.dcx.sites .sites-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(400px, 100%), 1fr)); gap: 20px; align-items: start; }
.dcx.sites .site-list { display: flex; flex-direction: column; gap: 14px; }
.site-card { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 18px 20px; box-shadow: 0 1px 3px rgba(21,37,50,.05); display: flex; flex-wrap: wrap; gap: 18px; }
.site-card .thumb { width: 72px; height: 72px; border-radius: 10px; border: 1px solid var(--hairline); background: repeating-linear-gradient(45deg, var(--surface2) 0 6px, var(--surface3) 6px 12px); display: grid; place-items: center; flex-shrink: 0; position: relative; }
.site-card .thumb .ring { border-radius: 999px; border: 1.5px dashed var(--red); background: var(--red-light); }
.site-card .thumb .pin { position: absolute; width: 5px; height: 5px; border-radius: 999px; background: var(--red); }
.site-card .sd { flex: 1; min-width: 220px; }
.site-card .sd .nm { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.site-card .sd .nm b { font-size: 15.5px; font-weight: 700; }
.site-card .sd .addr { font-size: 13px; color: var(--ink-2); margin-top: 4px; }
.site-card .sd .coords { font-family: 'IBM Plex Mono', var(--mono); font-size: 11.5px; color: var(--muted); margin-top: 4px; }
.site-card .sd .wrow { display: flex; align-items: center; gap: 8px; margin-top: 12px; }
.site-card .sd .stack { display: flex; }
.site-card .sd .stack .av { width: 26px; height: 26px; border-radius: 999px; display: grid; place-items: center; font-family: 'IBM Plex Sans', var(--font); font-size: 10px; font-weight: 600; border: 2px solid var(--surface); margin-left: -6px; }
.site-card .sd .stack .av:first-child { margin-left: 0; }
.site-card .sd .wlabel { font-size: 12px; color: var(--muted); }
.site-card .sa { display: flex; flex-direction: column; align-items: flex-end; justify-content: space-between; gap: 10px; margin-left: auto; }
.site-card .sa .btns { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.site-card .sa .act { font-family: 'IBM Plex Mono', var(--mono); font-size: 11px; color: var(--muted); }
.dcx.sites .site-form { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 24px; box-shadow: 0 1px 3px rgba(21,37,50,.05); position: sticky; top: 24px; }
.dcx.sites .site-form .fhead { display: flex; align-items: center; justify-content: space-between; }
.dcx.sites .site-form .fhead h2 { font-size: 17px; font-weight: 700; margin: 0; }
.dcx.sites .site-form .fields { display: flex; flex-direction: column; gap: 16px; margin-top: 20px; }
.dcx .fgrid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.dcx .use-loc .dot { width: 7px; height: 7px; border-radius: 999px; border: 2px solid var(--red); }
.radius-picks { display: flex; gap: 8px; }
.radius-picks button { flex: 1; border: 1px solid var(--border); border-radius: 9px; padding: 9px 0; background: var(--surface); color: var(--ink-2); font-family: 'IBM Plex Mono', var(--mono); font-size: 12.5px; font-weight: 600; cursor: pointer; }
.radius-picks button.active { background: var(--ink); border-color: var(--ink); color: #fff; }
.dcx .fhelp { font-size: 11.5px; color: var(--muted); margin-top: 6px; }
.wchips { display: flex; flex-wrap: wrap; gap: 8px; }
.wchip { display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--border); border-radius: 999px; padding: 6px 12px 6px 6px; background: var(--surface); cursor: pointer; font-family: 'IBM Plex Sans', var(--font); color: var(--ink-2); font-weight: 500; font-size: 12.5px; }
.wchip .av { width: 22px; height: 22px; border-radius: 999px; display: inline-grid; place-items: center; font-size: 9.5px; font-weight: 600; }
.wchip.on { border-color: var(--ink); background: var(--panel-head); color: var(--ink); font-weight: 600; }
.dcx .ffoot { display: flex; align-items: center; justify-content: flex-end; gap: 10px; border-top: 1px solid var(--hairline); padding-top: 16px; }
.dcx-textbtn { border: none; border-radius: 8px; padding: 10px 16px; background: transparent; color: var(--muted); font-family: 'IBM Plex Sans', var(--font); font-size: 13.5px; font-weight: 500; cursor: pointer; }
.dcx-textbtn:hover { color: var(--ink); }
.site-empty { background: var(--surface); border: 1.5px dashed var(--border); border-radius: 14px; padding: 48px 20px; text-align: center; color: var(--muted); font-size: 14px; }

/* type pill (Time Off) — holiday/sick/unpaid/other, mapped to brand tokens */
.dcx-pill.holiday { background: var(--present-bg); color: var(--present-text); }
.dcx-pill.holiday i { background: var(--present); }
.dcx-pill.sick { background: var(--amber-bg); color: var(--amber); }
.dcx-pill.sick i { background: var(--amber); }
.dcx-pill.unpaid { background: var(--blue-bg); color: var(--blue); }
.dcx-pill.unpaid i { background: var(--blue); }
.dcx-pill.other { background: var(--surface2); color: var(--muted); }
.dcx-pill.other i { background: var(--border-strong); }

/* Time Off: coverage timeline (mini-Gantt) + requests queue */
.dcx.timeoff .to-cover { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 20px 24px; box-shadow: 0 1px 3px rgba(21,37,50,.05); margin-top: 24px; }
.to-cover .chead { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.to-cover .chead .lead { font-family: 'IBM Plex Mono', var(--mono); font-size: 11px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.to-cover .chead .win { font-family: 'IBM Plex Mono', var(--mono); font-size: 11px; color: var(--muted); }
.to-cover .to-strip { overflow-x: auto; margin-top: 16px; }
.to-cover .to-strip-inner { min-width: 620px; }
.to-scale { display: flex; align-items: stretch; }
.to-scale .gutter { width: 170px; flex: none; }
.to-scale .col { flex: 1; min-width: 0; text-align: center; padding: 4px 0; border-radius: 6px 6px 0 0; }
.to-scale .col .d { display: block; font-family: 'IBM Plex Mono', var(--mono); font-size: 9.5px; font-weight: 600; color: var(--ink-2); }
.to-scale .col .n { display: block; font-family: 'IBM Plex Mono', var(--mono); font-size: 9.5px; color: var(--muted); }
.to-scale .col.wknd .d { color: var(--muted); }
.to-scale .col.wknd, .to-row .track .cell.wknd { background: var(--weekend-bg); }
/* empty note lives OUTSIDE the scrolling strip so it can't be cut off on a
   phone (the strip's 620px inner would carry half the sentence off-screen) */
.to-cover .to-none { border-top: 1px solid var(--hairline); padding: 12px 4px 2px; font-size: 12.5px; color: var(--muted); text-align: center; }
.to-row { display: flex; align-items: stretch; border-top: 1px solid var(--hairline); }
.to-row .lbl { width: 170px; flex: none; display: flex; align-items: center; gap: 9px; padding: 7px 8px 7px 0; min-width: 0; }
.to-row .lbl .av { width: 24px; height: 24px; border-radius: 999px; display: grid; place-items: center; font-family: 'IBM Plex Sans', var(--font); font-size: 9.5px; font-weight: 600; flex: none; }
.to-row .lbl .nm { font-size: 12.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.to-row .track { flex: 1; position: relative; display: flex; min-height: 34px; }
.to-row .track .cell { flex: 1; min-width: 0; }
.to-row .track .bar { position: absolute; top: 50%; transform: translateY(-50%); height: 20px; border-radius: 999px; display: flex; align-items: center; justify-content: center; font-family: 'IBM Plex Mono', var(--mono); font-size: 9.5px; font-weight: 600; letter-spacing: .04em; overflow: hidden; white-space: nowrap; padding: 0 6px; }
.to-legend { display: flex; flex-wrap: wrap; gap: 18px; align-items: center; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--hairline); font-size: 12px; color: var(--muted); }
.to-legend span { display: inline-flex; align-items: center; gap: 7px; }
.to-legend .pill { width: 16px; height: 8px; border-radius: 999px; }
.to-legend .pill.dash { background: var(--surface); border: 1.5px dashed var(--border-strong); }
.dcx.timeoff .req-tabs { margin: 20px 0 14px; }
/* Requests table column template (worker | type | dates | days | note | status | actions) */
/* column minimums must sum under the card's width at 1280 (~994px) or the
   Approve/Decline buttons sit clipped at the card edge until you scroll */
.dcx.timeoff .dcx-row { grid-template-columns: minmax(170px, 1.1fr) 96px 170px 56px minmax(120px, 1fr) 112px 190px; }
.dcx.timeoff .dcx-row .num { text-align: right; font-family: 'IBM Plex Mono', var(--mono); font-size: 13px; font-weight: 600; }
.dcx.timeoff .dates { font-family: 'IBM Plex Mono', var(--mono); font-size: 12.5px; font-weight: 600; }
/* max-width caps the note's contribution to the row's natural width — an
   essay-length note ellipsises instead of stretching the table into a scroll */
.dcx.timeoff .note { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 340px; }
.dcx-dark { border: none; border-radius: 7px; padding: 7px 14px; background: var(--ink); color: #fff; font-family: 'IBM Plex Sans', var(--font); font-size: 12.5px; font-weight: 600; cursor: pointer; }
.dcx-dark:hover { background: var(--ink-hover); }

/* Billing: trial hero + plan / payment / history cards + manage footer */
.dcx.billing { max-width: 1080px; margin: 0 auto; }
.dcx.billing .subline { font-size: 14px; color: var(--muted); margin-top: 8px; }
.bill-hero { background: var(--ink); color: #fff; border-radius: 14px; padding: 26px 28px; margin-top: 24px; display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
.bill-hero .htxt { flex: 1; min-width: 260px; }
.bill-hero .fchip { display: inline-flex; align-items: center; gap: 6px; background: rgba(255,255,255,.1); border-radius: 999px; padding: 3px 10px; font-family: 'IBM Plex Mono', var(--mono); font-size: 10.5px; font-weight: 600; letter-spacing: .08em; }
.bill-hero .fchip i { width: 6px; height: 6px; border-radius: 999px; background: var(--red); }
.bill-hero .fchip.live i { background: var(--present); }
.bill-hero h2 { color: #fff; font-size: 22px; font-weight: 700; margin: 12px 0 0; }
.bill-hero .subl { font-size: 13.5px; color: rgba(255,255,255,.65); margin-top: 8px; max-width: 520px; }
.bill-hero .subl b { color: #fff; font-weight: 600; }
.bill-progress { max-width: 420px; margin-top: 16px; }
.bill-progress .track { height: 6px; background: rgba(255,255,255,.14); border-radius: 999px; overflow: hidden; }
.bill-progress .fill { height: 100%; background: var(--red); border-radius: 999px; }
.bill-progress .ends { display: flex; justify-content: space-between; margin-top: 6px; font-family: 'IBM Plex Mono', var(--mono); font-size: 10px; color: rgba(255,255,255,.62); }
.bill-hero .cta { display: flex; flex-direction: column; align-items: flex-end; gap: 10px; }
.bill-subscribe { border: none; border-radius: 9px; padding: 13px 26px; background: var(--red); color: #fff; font-family: 'IBM Plex Sans', var(--font); font-size: 15px; font-weight: 600; cursor: pointer; box-shadow: 0 2px 8px rgba(200,49,44,.35); white-space: nowrap; }
.bill-subscribe:hover { filter: brightness(1.08); }
.bill-hero .cap { font-size: 12px; color: rgba(255,255,255,.5); text-align: right; }
.bill-hero .ownernote { font-size: 12.5px; color: rgba(255,255,255,.6); max-width: 220px; text-align: right; }
.bill-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 20px; align-items: start; margin-top: 20px; }
.bill-col { display: flex; flex-direction: column; gap: 20px; }
.bill-card { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 22px 24px; box-shadow: 0 1px 3px rgba(21,37,50,.05); }
.bill-card .lab { font-family: 'IBM Plex Mono', var(--mono); font-size: 11px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.bill-card .lab-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.perworker-chip { background: var(--red-light); color: var(--red); font-family: 'IBM Plex Mono', var(--mono); font-size: 10.5px; font-weight: 600; border-radius: 999px; padding: 3px 9px; letter-spacing: .04em; }
.bill-price { display: flex; align-items: baseline; gap: 8px; margin-top: 14px; }
.bill-price .big { font-size: 34px; font-weight: 700; letter-spacing: -.01em; }
.bill-price .per { font-size: 14px; color: var(--muted); }
.bill-break { margin-top: 18px; border-top: 1px solid var(--hairline); }
.bill-break .r { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; font-size: 13.5px; }
.bill-break .r .v { font-family: 'IBM Plex Mono', var(--mono); font-weight: 600; }
.bill-break .r.total { border-top: 1px solid var(--hairline); }
.bill-break .r.total .l { font-weight: 600; }
.bill-break .r.total .v { font-weight: 700; }
.bill-note { font-size: 12px; color: var(--muted); margin-top: 8px; }
.pay-empty { display: flex; align-items: center; gap: 14px; border: 1.5px dashed var(--border-strong); border-radius: 10px; padding: 14px 16px; margin-top: 16px; }
.pay-glyph { width: 40px; height: 28px; background: var(--hairline); border-radius: 5px; display: grid; place-items: center; font-family: 'IBM Plex Mono', var(--mono); font-size: 9px; font-weight: 600; color: var(--muted); flex: none; }
.pay-empty .pt { flex: 1; min-width: 0; }
.pay-empty .pt b { font-size: 13.5px; }
.pay-empty .pt div { font-size: 12px; color: var(--muted); }
.bill-upcoming { display: flex; align-items: center; gap: 12px; border: 1px solid var(--hairline); border-radius: 10px; background: var(--panel-head); padding: 14px 16px; margin-top: 16px; }
.bill-upcoming .tile { width: 34px; height: 34px; border-radius: 8px; background: var(--red-light); color: var(--red); display: grid; place-items: center; font-family: 'IBM Plex Mono', var(--mono); font-size: 12px; font-weight: 700; flex: none; }
.bill-upcoming .ut { flex: 1; min-width: 0; }
.bill-upcoming .ut b { font-size: 13.5px; }
.bill-upcoming .ut div { font-size: 12px; color: var(--muted); margin-top: 1px; }
.bill-upcoming .ut div b { color: var(--ink); font-weight: 600; }
.up-pill { background: var(--amber-bg); color: var(--amber); font-family: 'IBM Plex Mono', var(--mono); font-size: 10px; font-weight: 600; border-radius: 999px; padding: 3px 9px; letter-spacing: .06em; white-space: nowrap; }
.bill-empty { text-align: center; border: 1.5px dashed var(--border); border-radius: 10px; padding: 26px 16px; margin-top: 20px; }
.bill-empty b { display: block; font-size: 13.5px; color: var(--ink-2); }
.bill-empty span { font-size: 12.5px; color: var(--muted); }
.bill-manage { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 16px 24px; margin-top: 20px; }
.bill-manage .mt b { font-size: 13.5px; }
.bill-manage .mt div { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.bill-manage .ma { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* Timesheets: day-grouped table with shift bars + multi-select bulk actions */
/* same rule as .dcx.timeoff: minimums must fit the card at 1280 so the
   Approve/Edit/Delete buttons aren't cut off at the right edge */
.dcx.timesheets .dcx-row { grid-template-columns: 48px minmax(170px, 1.1fr) minmax(180px, 1.5fr) 132px 72px 104px 214px; }
.dcx.timesheets .dcx-row.head .h.hr { text-align: right; }
.ts-day { display: flex; align-items: center; gap: 12px; background: var(--panel-head); padding: 11px 20px; border-bottom: 1px solid var(--hairline); }
.ts-day .d { font-size: 13px; font-weight: 700; color: var(--ink); }
.ts-day .n { font-family: 'IBM Plex Mono', var(--mono); font-size: 11px; color: var(--muted); } /* was --border-strong: 1.3 contrast, failed WCAG */
.ts-day .tot { margin-left: auto; font-family: 'IBM Plex Mono', var(--mono); font-size: 12px; font-weight: 600; color: var(--ink-2); }
.ts-cbwrap { display: flex; align-items: center; justify-content: center; padding: 12px 0 12px 8px; }
.ts-cb { width: 17px; height: 17px; border-radius: 5px; border: 1.5px solid var(--border-strong); background: var(--surface); cursor: pointer; display: grid; place-items: center; color: #fff; font-size: 11px; font-weight: 700; flex: none; }
.ts-cb.on { background: var(--ink); border-color: var(--ink); }
.dcx.timesheets .dcx-body.sel { background: var(--surface2); }
.dcx.timesheets .dcx-who { padding: 12px 8px 12px 0; }
.dcx.timesheets .dcx-who .dcx-ava { width: 30px; height: 30px; }
.ts-bar { height: 8px; border-radius: 999px; background: var(--hairline); position: relative; }
.ts-bar .fill { position: absolute; top: 0; height: 100%; border-radius: 999px; }
.ts-io { font-family: 'IBM Plex Mono', var(--mono); font-size: 13px; color: var(--ink-2); }
.ts-io b { font-weight: 600; color: var(--ink); }
.ts-io .ar { color: var(--border-strong); padding: 0 2px; }
.ts-io .flag { display: block; font-size: 11.5px; font-family: 'IBM Plex Sans', var(--font); color: var(--amber); margin-top: 2px; }
.ts-hrs { text-align: right; font-family: 'IBM Plex Mono', var(--mono); font-size: 13px; font-weight: 600; }
.ts-bulk { display: flex; align-items: center; gap: 14px; background: var(--ink); border-radius: 10px; padding: 10px 16px; margin: 14px 0; }
.ts-bulk .n { font-family: 'IBM Plex Mono', var(--mono); font-size: 12px; font-weight: 600; color: #fff; }
.ts-bulk .divx { width: 1px; height: 18px; background: rgba(255,255,255,.2); }
.ts-bulk .b-approve { border: none; border-radius: 6px; padding: 6px 12px; background: #fff; color: var(--ink); font-family: 'IBM Plex Sans', var(--font); font-size: 12.5px; font-weight: 600; cursor: pointer; }
.ts-bulk .b-delete { border: 1px solid rgba(255,255,255,.25); border-radius: 6px; padding: 6px 12px; background: transparent; color: #fff; font-family: 'IBM Plex Sans', var(--font); font-size: 12.5px; font-weight: 500; cursor: pointer; }
.ts-bulk .b-clear { margin-left: auto; border: none; background: transparent; color: rgba(255,255,255,.6); font-family: 'IBM Plex Sans', var(--font); font-size: 12.5px; cursor: pointer; }
.ts-bulk .b-clear:hover { color: #fff; }
.ts-legend { display: flex; flex-wrap: wrap; gap: 20px; align-items: center; margin-top: 16px; font-size: 12.5px; color: var(--muted); }
.ts-legend span { display: inline-flex; align-items: center; gap: 7px; }
.ts-legend .pill { width: 18px; height: 6px; border-radius: 999px; }

/* Forms: templates table (form | fields | sites | status | filled | actions)
   and submissions table (when | worker | form | site | answers | action) */
.dcx.forms .dcx-row { grid-template-columns: minmax(220px, 1.4fr) 80px minmax(140px, 1fr) 110px 90px 190px; }
.dcx.forms .subs .dcx-row { grid-template-columns: 150px minmax(150px, .9fr) minmax(160px, 1fr) 120px minmax(200px, 1.4fr) 90px; }
.dcx.forms .num { text-align: right; font-family: 'IBM Plex Mono', var(--mono); font-size: 13px; font-weight: 600; }

/* ---- phone: stack the wide action/submission tables into cards ----
   Timesheets, time-off and form-submissions are fixed multi-column grids wider
   than a phone, so by default they scroll sideways — which hides a row's name
   (far left) or its Approve / Edit / View buttons (far right). On narrow
   screens we drop the column grid, stack each row's cells vertically, and lay
   the action buttons full-width along the bottom: everything visible at once,
   no horizontal scrolling. */
@media (max-width: 640px) {
  .dcx.timesheets .dcx-card,
  .dcx.timeoff .dcx-card,
  .dcx.forms .dcx-card.subs { overflow-x: visible; }
  .dcx.timesheets .dcx-card > .inner,
  .dcx.timeoff .dcx-card > .inner,
  .dcx.forms .dcx-card.subs > .inner { min-width: 0; }

  .dcx.timesheets .dcx-row.head,
  .dcx.timeoff .dcx-row.head,
  .dcx.forms .subs .dcx-row.head { display: none; }

  .dcx.timesheets .dcx-row.dcx-body,
  .dcx.timeoff .dcx-row.dcx-body,
  .dcx.forms .subs .dcx-row.dcx-body {
    grid-template-columns: 1fr !important;
    gap: 6px;
    padding: 14px 16px;
  }
  /* every cell full width: wrap text, drop the desktop ellipsis + right-align */
  .dcx.timesheets .dcx-row.dcx-body > *,
  .dcx.timeoff .dcx-row.dcx-body > *,
  .dcx.forms .subs .dcx-row.dcx-body > * {
    min-width: 0;
    white-space: normal !important;
    overflow: visible !important;
    text-overflow: clip !important;
    text-align: left !important;
    justify-content: flex-start !important;
  }
  /* action buttons: full-width row along the bottom, comfortable thumb targets */
  .dcx.timesheets .dcx-row.dcx-body > .c-end,
  .dcx.timeoff .dcx-row.dcx-body > .c-end,
  .dcx.forms .subs .dcx-row.dcx-body > .c-end {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 6px;
  }
  .dcx.timesheets .dcx-row.dcx-body > .c-end > button,
  .dcx.timeoff .dcx-row.dcx-body > .c-end > button,
  .dcx.forms .subs .dcx-row.dcx-body > .c-end > button { flex: 1 1 auto; min-height: 40px; }
  /* bulk-select checkbox is a desktop convenience — hide it on phone */
  .dcx.timesheets .dcx-row.dcx-body > .ts-cbwrap { display: none; }
}

/* dropdown menu (exports) */
.menu { position: relative; display: inline-block; }
.menu-list { position: absolute; right: 0; top: calc(100% + 4px); background: #fff; border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: var(--shadow-lg); min-width: 210px; padding: .3rem; z-index: 20; }
.menu-list button { display: block; width: 100%; text-align: left; appearance: none; border: 0; background: transparent; cursor: pointer; padding: .5rem .6rem; border-radius: 6px; font-family: var(--font); font-size: .85rem; color: var(--text); }
.menu-list button:hover { background: var(--surface2); }
.menu-list .sep { height: 1px; background: var(--hairline); margin: .3rem 0; }

/* ---- command palette (⌘K) ---- */
.cmdk-trigger {
  display: flex; align-items: center; justify-content: space-between; gap: .5rem; width: 100%;
  margin: .2rem 0 .5rem; padding: .5rem .6rem; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface2); color: var(--muted); font-family: var(--font); font-size: .82rem; cursor: pointer;
}
.cmdk-trigger:hover { border-color: var(--border-strong); color: var(--ink-2); }
.cmdk-wrap { position: fixed; inset: 0; z-index: 80; background: rgba(21, 24, 29, .45); display: flex; justify-content: center; align-items: flex-start; padding: 11vh 1rem 1rem; }
.cmdk { width: 100%; max-width: 540px; background: #fff; border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); overflow: hidden; }
.cmdk-input { border: 0; border-bottom: 1px solid var(--hairline); border-radius: 0; font-size: 1rem; padding: .95rem 1.1rem; }
.cmdk-input:focus { box-shadow: none; border-color: var(--hairline); }
.cmdk-list { max-height: 340px; overflow-y: auto; padding: .4rem; }
.cmdk-item { display: flex; align-items: center; gap: .7rem; padding: .6rem .7rem; border-radius: var(--radius-sm); cursor: pointer; font-size: .9rem; }
.cmdk-item .ic { width: 1.3rem; text-align: center; opacity: .85; }
.cmdk-item .sub { margin-left: auto; font-family: var(--mono); font-size: .58rem; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.cmdk-item.sel { background: var(--surface2); }
.cmdk-empty { padding: 1.6rem; text-align: center; color: var(--muted); font-size: .88rem; }
.cmdk-foot { border-top: 1px solid var(--hairline); padding: .5rem .8rem; display: flex; gap: 1.1rem; font-family: var(--mono); font-size: .58rem; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.kbd { font-family: var(--mono); font-size: .66rem; border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 5px; padding: .06rem .34rem; background: var(--surface2); color: var(--ink-2); white-space: nowrap; }

/* ---- keyboard focus (visible for keyboard users; mouse clicks stay clean) ---- */
.btn:focus-visible, .chip:focus-visible, .nav-item:focus-visible,
.bottom-nav button:focus-visible, .tabs button:focus-visible,
.menu-list button:focus-visible, a:focus-visible,
summary:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--red); outline-offset: 2px; border-radius: var(--radius-sm);
}

/* ---- comfortable touch targets (touch devices only — desktop density unchanged) ---- */
@media (pointer: coarse) {
  .btn.sm { min-height: 44px; }
  .bottom-nav button { min-height: 52px; }
  input, select, textarea { min-height: 44px; }
  .menu-list button { padding: .7rem .6rem; }
}

/* ---- skip link (keyboard/screen-reader jump to content) ---- */
.skip-link {
  position: fixed; top: -60px; left: 1rem; z-index: 100;
  background: var(--ink); color: #fff; padding: .6rem .9rem; border-radius: var(--radius-sm);
  font-weight: 700; text-decoration: none; transition: top .15s ease;
}
.skip-link:focus { top: 1rem; color: #fff; }

/* ---- visually hidden but available to screen readers (headings/labels) ---- */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* ---- mobile sidebar scrim (tap the dimmed page to close the menu) ---- */
.sidebar-scrim { display: none; }
@media (max-width: 820px) {
  .sidebar-toggle { position: sticky; top: .5rem; z-index: 25; }
  .sidebar-scrim {
    position: fixed; inset: 0; z-index: 35; background: rgba(21, 24, 29, .4);
    opacity: 0; pointer-events: none; transition: opacity .2s ease;
  }
  .sidebar-scrim.show { display: block; opacity: 1; pointer-events: auto; }
}

@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
