/* ACE office design system. Colours come from the ACE brand package (Josh, 30 Sep 2026): metallic
   gold (#C89324, range #B07A1A–#E0B14A), near-black #111111 and white, on warm neutral greys.
   Gold is the accent for buttons, highlights and icons. Gold TEXT on white uses the darker
   --gold-700 / --gold-800 (contrast at least 4.5:1); #C89324 on white is only about 2.7:1, so it is
   never used for words. Dark text (--on-gold) sits on gold buttons.

   Every colour lives in the tokens below. Light is the default. Dark applies when the person picks
   Dark in the profile menu (html[data-theme="dark"]) or, with no choice made (System), when the
   computer prefers dark. The dark set is written twice — the media query and the attribute cannot
   share one rule — and test/theme.test.js checks the two copies stay identical. Printing and PDFs
   always use the light set (the dark sets only apply to "screen"). New colours: add a token to
   :root and to BOTH dark blocks, then use var(--name); never a raw #hex in a rule or an inline style.
   Logos: brand images pair up as .for-light / .for-dark (shown by --show-light / --show-dark). */
:root {
  color-scheme: light;
  --gold: #c89324; --gold-hover: #d7a233; --gold-600: #b07a1a; --gold-700: #8a6412; --gold-800: #7a5810; --gold-50: #fbf5e6; --gold-100: #f3e6c3;
  --on-gold: #111111; --focus: #b07a1a; --focus-ring: rgba(200, 147, 36, .22);
  --ink: #111111; --ink-2: #262626; --text: #3a3936; --muted: #57544f; --subtle: #625f58; --faint: #706c65;
  --line: #e6e3dd; --line-2: #efece7; --line-strong: #cfcac2; --bg: #f6f5f2; --surface: #ffffff; --surface-2: #faf9f7; --field-bg: #ffffff; --paper: #ffffff;
  --ok: #067647; --ok-bg: #ecfdf3; --warn: #b54708; --warn-bg: #fff6e8; --bad: #b42318; --bad-bg: #fef1f0; --bad-line: #f3c6c1; --bad-solid: #b42318; --on-solid: #ffffff; --info: #262626; --info-bg: #f1efea;
  --dot-ok: #17b26a; --dot-warn: #f79009; --dot-bad: #f04438; --dot-neutral: #c4c0b8; --dot-done: #a09c94;
  --block-bg: #eef4f0; --planned-stripe: #f7f6f2; --weekend-bg: #fbfaf8;
  --sidebar-bg: #111111; --sidebar-line: transparent; --sidebar-text: #c9c6c0; --sidebar-strong: #ffffff; --sidebar-muted: #8f8c85; --sidebar-label: #8f8c85; --sidebar-hover: rgba(255, 255, 255, .07); --sidebar-active: rgba(200, 147, 36, .2);
  --env-line: #4a4843; --env-text: #e6e4df; --env-demo-line: #a07a26; --env-demo-text: #f2d594;
  --btn-dark: #111111; --btn-dark-hover: #2b2a28; --btn-dark-text: #ffffff;
  --toast-bg: #111111; --toast-text: #ffffff; --toast-line: transparent; --scrim: rgba(17, 17, 17, .4); --mark-ring: transparent;
  --show-light: block; --show-dark: none;
  --radius: 8px; --radius-lg: 12px;
  --shadow-sm: 0 1px 2px rgba(17, 17, 17, .06); --shadow: 0 5px 25px rgba(17, 17, 17, .08), 0 1px 2px rgba(17, 17, 17, .06); --shadow-lg: 0 20px 50px rgba(17, 17, 17, .18);
  /* System fonts keep the local office app usable when the PC is offline. */
  --font-ui: system-ui, -apple-system, 'Segoe UI', sans-serif; --font-brand: 'Segoe UI', system-ui, sans-serif;
  --sidebar: 232px; --topbar: 60px;
}
/* Dark. Near-black neutrals, light warm text, gold stays the accent. Keep the two copies identical. */
@media screen and (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --gold: #c89324; --gold-hover: #d7a233; --gold-600: #c89324; --gold-700: #d9a93f; --gold-800: #e3b75a; --gold-50: #221b0c; --gold-100: #3a2d0f;
    --on-gold: #111111; --focus: #d9a93f; --focus-ring: rgba(200, 147, 36, .3);
    --ink: #f5f4f1; --ink-2: #e6e4df; --text: #cfccc6; --muted: #b0ada6; --subtle: #9d9a93; --faint: #86837c;
    --line: #2e2c29; --line-2: #242321; --line-strong: #45423d; --bg: #0e0e0e; --surface: #171717; --surface-2: #1d1d1c; --field-bg: #0e0e0e; --paper: #ffffff;
    --ok: #4cc38a; --ok-bg: #10261c; --warn: #f0a04b; --warn-bg: #2b2010; --bad: #f97a70; --bad-bg: #331a1c; --bad-line: #6b2d2a; --bad-solid: #b42318; --on-solid: #ffffff; --info: #e6e4df; --info-bg: #252422;
    --dot-ok: #17b26a; --dot-warn: #f79009; --dot-bad: #f04438; --dot-neutral: #6f6b64; --dot-done: #8a867f;
    --block-bg: #14261d; --planned-stripe: #1d1d1c; --weekend-bg: #131312;
    --sidebar-bg: #0a0a0a; --sidebar-line: #242321; --sidebar-text: #c9c6c0; --sidebar-strong: #ffffff; --sidebar-muted: #8f8c85; --sidebar-label: #8f8c85; --sidebar-hover: rgba(255, 255, 255, .07); --sidebar-active: rgba(200, 147, 36, .2);
    --env-line: #4a4843; --env-text: #e6e4df; --env-demo-line: #a07a26; --env-demo-text: #f2d594;
    --btn-dark: #2e2c29; --btn-dark-hover: #3d3a36; --btn-dark-text: #f5f4f1;
    --toast-bg: #262626; --toast-text: #f5f4f1; --toast-line: #3a3835; --scrim: rgba(0, 0, 0, .62); --mark-ring: rgba(255, 255, 255, .16);
    --show-light: none; --show-dark: block;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .5); --shadow: 0 5px 25px rgba(0, 0, 0, .45), 0 1px 2px rgba(0, 0, 0, .5); --shadow-lg: 0 20px 50px rgba(0, 0, 0, .6);
  }
}
@media screen {
  :root[data-theme="dark"] {
    color-scheme: dark;
    --gold: #c89324; --gold-hover: #d7a233; --gold-600: #c89324; --gold-700: #d9a93f; --gold-800: #e3b75a; --gold-50: #221b0c; --gold-100: #3a2d0f;
    --on-gold: #111111; --focus: #d9a93f; --focus-ring: rgba(200, 147, 36, .3);
    --ink: #f5f4f1; --ink-2: #e6e4df; --text: #cfccc6; --muted: #b0ada6; --subtle: #9d9a93; --faint: #86837c;
    --line: #2e2c29; --line-2: #242321; --line-strong: #45423d; --bg: #0e0e0e; --surface: #171717; --surface-2: #1d1d1c; --field-bg: #0e0e0e; --paper: #ffffff;
    --ok: #4cc38a; --ok-bg: #10261c; --warn: #f0a04b; --warn-bg: #2b2010; --bad: #f97a70; --bad-bg: #331a1c; --bad-line: #6b2d2a; --bad-solid: #b42318; --on-solid: #ffffff; --info: #e6e4df; --info-bg: #252422;
    --dot-ok: #17b26a; --dot-warn: #f79009; --dot-bad: #f04438; --dot-neutral: #6f6b64; --dot-done: #8a867f;
    --block-bg: #14261d; --planned-stripe: #1d1d1c; --weekend-bg: #131312;
    --sidebar-bg: #0a0a0a; --sidebar-line: #242321; --sidebar-text: #c9c6c0; --sidebar-strong: #ffffff; --sidebar-muted: #8f8c85; --sidebar-label: #8f8c85; --sidebar-hover: rgba(255, 255, 255, .07); --sidebar-active: rgba(200, 147, 36, .2);
    --env-line: #4a4843; --env-text: #e6e4df; --env-demo-line: #a07a26; --env-demo-text: #f2d594;
    --btn-dark: #2e2c29; --btn-dark-hover: #3d3a36; --btn-dark-text: #f5f4f1;
    --toast-bg: #262626; --toast-text: #f5f4f1; --toast-line: #3a3835; --scrim: rgba(0, 0, 0, .62); --mark-ring: rgba(255, 255, 255, .16);
    --show-light: none; --show-dark: block;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .5); --shadow: 0 5px 25px rgba(0, 0, 0, .45), 0 1px 2px rgba(0, 0, 0, .5); --shadow-lg: 0 20px 50px rgba(0, 0, 0, .6);
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text); font: 14px/1.45 var(--font-ui); -webkit-font-smoothing: antialiased; }
a { color: inherit; }
h1, h2, h3 { font-family: var(--font-brand); color: var(--ink); letter-spacing: -.02em; margin: 0; }
h1 { font-size: 22px; font-weight: 700; } h2 { font-size: 16px; font-weight: 700; } h3 { font-size: 13px; font-weight: 600; color: var(--muted); letter-spacing: 0; font-family: var(--font-ui); }
.icon { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.muted { color: var(--subtle); } .small { font-size: 12.5px; } .mono { font-variant-numeric: tabular-nums; }

/* Shell */
.shell { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; }
.sidebar { background: var(--sidebar-bg); border-right: 1px solid var(--sidebar-line); color: var(--sidebar-text); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; padding: 18px 12px; }
/* The logo alone, no wordmark beside it (Josh, 30 Sep 2026: cleaner). */
.brand { display: flex; align-items: center; align-self: flex-start; padding: 2px 4px; margin: 0 2px 20px; text-decoration: none; }
.brand:focus-visible { outline-offset: 4px; }
/* The ACE tile: a light one and a dark one, both always in the page; the theme picks which shows. */
.brand-mark { width: 48px; height: 48px; border-radius: 10px; flex: none; box-shadow: 0 0 0 1px var(--mark-ring); }
.for-light { display: var(--show-light); } .for-dark { display: var(--show-dark); }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a { display: flex; align-items: center; gap: 11px; padding: 9px 10px; border-radius: 8px; color: var(--sidebar-text); text-decoration: none; font-weight: 500; position: relative; }
.nav a:hover { background: var(--sidebar-hover); color: var(--sidebar-strong); }
.nav a.active { background: var(--sidebar-active); color: var(--sidebar-strong); }
.nav a.active::before { content: ''; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--gold); }
.nav a .count { margin-left: auto; font-size: 11.5px; font-weight: 700; color: var(--on-gold); background: var(--gold); border-radius: 99px; padding: 1px 7px; }
.nav-label { font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: var(--sidebar-label); padding: 18px 10px 6px; }
.sidebar-foot { margin-top: auto; padding: 10px; font-size: 12px; color: var(--sidebar-muted); display: flex; flex-direction: column; gap: 6px; }
.sidebar-foot a { color: var(--sidebar-muted); }
.sidebar-foot .muted { color: var(--sidebar-muted); }
.env-badge { display:block; padding:7px 8px; border:1px solid var(--env-line); border-radius:6px; color:var(--env-text); line-height:1.3; }
.env-badge.demo { border-color:var(--env-demo-line); color:var(--env-demo-text); }
.main { min-width: 0; display: flex; flex-direction: column; overflow-x: clip; }
.topbar { height: var(--topbar); display: flex; align-items: center; gap: 12px; padding: 0 28px; background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.topbar .menu { display: none; }
.search { flex: 1; max-width: 460px; position: relative; }
.search .icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--faint); width: 16px; height: 16px; }
.search input { width: 100%; padding: 9px 12px 9px 34px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); }
.kbd { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); font: 600 11px var(--font-ui); color: var(--faint); border: 1px solid var(--line); border-radius: 5px; padding: 1px 6px; background: var(--surface); }
.search input:focus + .kbd { display: none; }
.search-results { position: absolute; top: calc(100% + 6px); left: 0; right: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); padding: 6px; max-height: 60vh; overflow: auto; }
.search-results a { display: flex; gap: 10px; padding: 8px 10px; border-radius: 8px; text-decoration: none; align-items: baseline; }
.search-results a:hover, .search-results a.focus { background: var(--gold-50); }
.topbar .spacer { flex: 1; }
.profile-menu { position: relative; flex: none; }
.profile-trigger { display: inline-flex; align-items: center; gap: 8px; min-height: 38px; border: 1px solid transparent; border-radius: 8px; padding: 4px 7px 4px 5px; background: transparent; color: var(--ink-2); font: 600 13px var(--font-ui); cursor: pointer; }
.profile-trigger:hover, .profile-trigger[aria-expanded="true"] { background: var(--surface-2); border-color: var(--line); }
.profile-trigger .icon { width: 15px; height: 15px; color: var(--subtle); }
.profile-avatar { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--gold-100); color: var(--gold-800); font-weight: 800; }
.profile-popover { position: absolute; top: calc(100% + 8px); right: 0; z-index: 30; min-width: 220px; padding: 6px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow-lg); }
.profile-summary { display: flex; flex-direction: column; gap: 1px; padding: 9px 10px 11px; border-bottom: 1px solid var(--line-2); color: var(--ink); }
.profile-summary span { color: var(--subtle); font-size: 12px; }
.profile-popover button { display: flex; align-items: center; gap: 9px; width: 100%; padding: 9px 10px; margin-top: 2px; border: 0; border-radius: 7px; background: none; color: var(--ink-2); font: inherit; font-weight: 600; cursor: pointer; }
.profile-popover button:hover { background: var(--gold-50); } .profile-popover button .icon { width: 17px; height: 17px; color: var(--gold-800); }
body.signin { display: grid; place-items: center; min-height: 100vh; padding: 24px; }
.signin-card { width: min(400px, 100%); display: grid; gap: 14px; justify-items: center; text-align: center; padding: 32px 28px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow); }
.signin-logo { width: min(280px, 100%); height: auto; border-radius: 10px; }
/* The dark logo picture has its own near-black backdrop; 'lighten' lets the card show through it. */
.signin-logo.for-dark { mix-blend-mode: lighten; } .signin-card .btn { width: 100%; justify-content: center; } .signin-error { white-space: normal; padding: 8px 10px; text-align: left; }
.profile-popover a { display: flex; align-items: center; gap: 9px; padding: 9px 10px; margin-top: 5px; border-radius: 7px; color: var(--ink-2); text-decoration: none; font-weight: 600; }
.profile-popover a:hover { background: var(--gold-50); }
.profile-popover a .icon { width: 17px; height: 17px; color: var(--gold-800); }
.page { padding: 26px 28px 60px; max-width: 1440px; width: 100%; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head p { margin: 4px 0 0; color: var(--subtle); }

/* Controls */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; border: 1px solid transparent; border-radius: var(--radius); padding: 8px 14px; font: 600 13.5px/1.2 var(--font-ui); cursor: pointer; text-decoration: none; white-space: nowrap; transition: background .12s, border-color .12s, box-shadow .12s; }
.btn .icon { width: 16px; height: 16px; }
.btn-primary { background: var(--gold); color: var(--on-gold); box-shadow: var(--shadow-sm); } .btn-primary:hover { background: var(--gold-hover); }
.btn-dark { background: var(--btn-dark); color: var(--btn-dark-text); } .btn-dark:hover { background: var(--btn-dark-hover); }
.btn-secondary { background: var(--surface); border-color: var(--line); color: var(--ink-2); } .btn-secondary:hover { border-color: var(--line-strong); background: var(--surface-2); }
.btn-ghost { background: transparent; color: var(--muted); } .btn-ghost:hover { background: var(--line-2); color: var(--ink); }
.btn-danger { background: var(--surface); border-color: var(--bad-line); color: var(--bad); } .btn-danger:hover { background: var(--bad-bg); }
.btn-sm { padding: 5px 10px; font-size: 12.5px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
[tabindex="0"]:focus-visible, .btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
input, select, textarea { font: inherit; color: var(--ink); background: var(--field-bg); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 10px; width: 100%; }
input:focus, select:focus, textarea:focus { border-color: var(--gold); outline: none; box-shadow: 0 0 0 3px var(--focus-ring); }
textarea { resize: vertical; min-height: 70px; }
label.field { display: block; font-size: 12.5px; font-weight: 600; color: var(--muted); }
label.field > input, label.field > select, label.field > textarea, label.field > .combo { display: block; margin-top: 5px; }
label.field .hint { font-weight: 400; color: var(--faint); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; } .grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.segmented { display: inline-flex; background: var(--line-2); border-radius: var(--radius); padding: 3px; gap: 2px; }
.segmented button { border: 0; background: transparent; padding: 6px 12px; border-radius: 6px; font: 600 12.5px var(--font-ui); color: var(--muted); cursor: pointer; }
.segmented button.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }

/* Surfaces */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line-2); }
.panel-body { padding: 16px 18px; }
.panel-head h2 { font-size: 15px; }
.stack { display: flex; flex-direction: column; gap: 18px; }
.cols { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.empty { padding: 26px 18px; text-align: center; color: var(--subtle); }
.empty .icon { width: 26px; height: 26px; color: var(--gold-600); margin-bottom: 6px; }

/* Status: a dot + words, one meaning per colour */
.status { display: inline-flex; align-items: center; gap: 7px; font-weight: 500; color: var(--ink-2); white-space: nowrap; }
.status::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--faint); flex: none; }
.status.ok::before { background: var(--dot-ok); } .status.warn::before { background: var(--dot-warn); } .status.bad::before { background: var(--dot-bad); } .status.neutral::before { background: var(--dot-neutral); } .status.gold::before { background: var(--gold); }
.flag { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; padding: 2px 8px; border-radius: 6px; }
.flag.warn { background: var(--warn-bg); color: var(--warn); } .flag.bad { background: var(--bad-bg); color: var(--bad); } .flag.ok { background: var(--ok-bg); color: var(--ok); } .flag.info { background: var(--info-bg); color: var(--ink-2); }

/* Tables */
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 11.5px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--subtle); padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--surface-2); position: sticky; top: var(--topbar); }
.table td { padding: 11px 14px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.table tbody tr { cursor: pointer; } .table tbody tr:hover { background: var(--gold-50); }
.table .primary { font-weight: 600; color: var(--ink); }
.table .sub { display: block; color: var(--subtle); font-size: 12.5px; }
.jobno { font: 600 12.5px var(--font-ui); color: var(--gold-800); font-variant-numeric: tabular-nums; }

/* Attention list */
.attn { display: flex; flex-direction: column; }
.attn-item { display: grid; grid-template-columns: 20px 1fr auto; gap: 12px; align-items: center; padding: 12px 18px; border-bottom: 1px solid var(--line-2); }
.attn-item:last-child { border-bottom: 0; }
.attn-item .icon { width: 18px; height: 18px; }
.attn-item.bad .icon { color: var(--bad); } .attn-item.warn .icon { color: var(--warn); } .attn-item.info .icon { color: var(--gold-700); }
.attn-item .what { color: var(--ink); font-weight: 600; } .attn-item .why { color: var(--subtle); font-size: 12.5px; }
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 18px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 14px 16px; text-decoration: none; display: block; }
.kpi:hover { border-color: var(--gold-100); box-shadow: var(--shadow-sm); }
.kpi b { display: block; font: 700 24px/1.1 var(--font-brand); color: var(--ink); letter-spacing: -.02em; }
.kpi span { color: var(--subtle); font-size: 12.5px; }
.kpi.alert b { color: var(--bad); }

/* Job card */
.jobhead { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; flex-wrap: wrap; margin-bottom: 14px; }
.crumbs { font-size: 12.5px; color: var(--subtle); margin-bottom: 6px; } .crumbs a { color: var(--subtle); text-decoration: none; } .crumbs a:hover { color: var(--ink); }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; }
.tabs a { padding: 10px 14px; text-decoration: none; color: var(--subtle); font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a:hover { color: var(--ink); } .tabs a.on { color: var(--ink); border-color: var(--gold); }
.tabs a .n { color: var(--faint); font-weight: 500; margin-left: 4px; }
.tabs button { padding: 10px 14px; background: none; border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; color: var(--subtle); font: inherit; font-weight: 600; cursor: pointer; }
.tabs button:hover { color: var(--ink); } .tabs button.on { color: var(--ink); border-color: var(--gold); }
.tabs button:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.dl { display: grid; grid-template-columns: 130px 1fr; gap: 9px 14px; margin: 0; }
.dl dt { color: var(--subtle); } .dl dd { margin: 0; color: var(--ink-2); white-space: pre-wrap; }
.report { padding: 14px 18px; border-bottom: 1px solid var(--line-2); } .report:last-child { border-bottom: 0; }
.thumbs { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.thumbs img { width: 88px; height: 88px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }
.file-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.file-card { display: flex; gap: 10px; align-items: center; min-width: 0; padding: 10px; border: 1px solid var(--line); border-radius: 8px; color: var(--ink); text-decoration: none; background: var(--surface); }
.file-card:hover { border-color: var(--gold); box-shadow: var(--shadow-sm); }
.file-card img { width: 58px; height: 58px; object-fit: cover; border-radius: 6px; flex: 0 0 auto; }
.file-card > span:not(.file-icon) { min-width: 0; }
.file-card b, .file-card small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-card small { color: var(--subtle); margin-top: 3px; }
.file-icon { display: grid; place-items: center; width: 48px; height: 58px; border-radius: 6px; flex: 0 0 auto; background: var(--bad-bg); color: var(--bad); font-weight: 800; font-size: 12px; }
.timeline { padding: 6px 18px; } .timeline .ev { display: grid; grid-template-columns: 120px 1fr; gap: 12px; padding: 8px 0; border-bottom: 1px dashed var(--line-2); font-size: 13px; } .timeline .ev:last-child { border: 0; }

/* Schedule */
.sched-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 290px; gap: 16px; align-items: start; }
.sched { overflow: auto; max-height: calc(100vh - var(--topbar) - 130px); }
/* Saturday is a real working day at ACE: a full column. Sunday stays narrow. */
.sched-grid { display: grid; grid-template-columns: 150px repeat(6, minmax(112px, 1fr)) minmax(64px, .55fr); min-width: 900px; }
.sched-grid > div { border-right: 1px solid var(--line-2); border-bottom: 1px solid var(--line-2); }
.sched-day { padding: 10px; font-size: 12px; font-weight: 600; color: var(--subtle); background: var(--surface-2); position: sticky; top: 0; z-index: 2; }
.sched-day b { display: block; font: 700 15px var(--font-brand); color: var(--ink); }
.sched-day.today b { color: var(--gold-800); } .sched-day.today { box-shadow: inset 0 -2px var(--gold); }
.sched-worker { padding: 10px 12px; background: var(--surface); position: sticky; left: 0; z-index: 1; }
.sched-worker b { display: block; color: var(--ink); font-weight: 600; } .sched-worker small { color: var(--subtle); }
.sched-cell { min-height: 78px; padding: 5px; background: var(--surface); display: flex; flex-direction: column; gap: 4px; transition: background .1s; }
.sched-cell.weekend { background: var(--weekend-bg); } .sched-cell.over { background: var(--gold-50); box-shadow: inset 0 0 0 2px var(--gold); }
.block { border-radius: 6px; padding: 6px 8px; font-size: 12px; line-height: 1.3; background: var(--block-bg); border-left: 3px solid var(--dot-ok); cursor: pointer; color: var(--ink-2); }
.block:hover { box-shadow: var(--shadow); }
.block b { font-weight: 700; color: var(--ink); } .block .s { color: var(--subtle); display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.block.planned { background: repeating-linear-gradient(-45deg, var(--surface), var(--surface) 6px, var(--planned-stripe) 6px, var(--planned-stripe) 12px); border: 1px dashed var(--dot-neutral); border-left: 3px solid var(--dot-neutral); }
.block.warn { background: var(--warn-bg); border-left-color: var(--dot-warn); } .block.bad { background: var(--bad-bg); border-left-color: var(--dot-bad); } .block.done { background: var(--info-bg); border-left-color: var(--dot-done); }
.block.crew { opacity: .8; border-left-style: dotted; }
.block[draggable=true] { cursor: grab; }
.tray .block { margin-bottom: 6px; }
.sched-day a { display: block; color: inherit; text-decoration: none; } .sched-day a:hover b { color: var(--gold-800); }
/* The empty part of a worker's day books work for them. */
.sched-cell.bookable { cursor: cell; }
.sched-cell.bookable:hover::after { content: '+ Book work'; font-size: 11.5px; font-weight: 600; color: var(--faint); padding: 2px 4px; pointer-events: none; }
body.dragging .sched-cell.bookable:hover::after { content: none; }
/* A worker the office marked unavailable (sick, leave…): office-only, shown on the Schedule. */
.sched-cell.away { background: repeating-linear-gradient(-45deg, var(--bad-bg), var(--bad-bg) 6px, var(--surface) 6px, var(--surface) 12px); }
.away-chip { display: inline-block; max-width: 100%; border: 1px solid var(--bad-line); background: var(--bad-bg); color: var(--bad); border-radius: 6px; padding: 2px 6px; font: 600 11.5px var(--font-ui); text-align: left; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.day-worker > .panel-head { flex-wrap: wrap; }
.day-worker.away > .panel-head { background: var(--bad-bg); border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
.linkish { display: block; border: 0; background: none; padding: 2px 0 0; font: 600 11.5px var(--font-ui); color: var(--subtle); cursor: pointer; text-decoration: underline; }
.linkish:hover { color: var(--bad); }
/* Subcontractor work: labelled in words ("Subcontractor · …"); the style only groups it. */
.sched-group { grid-column: 1 / -1; padding: 8px 12px; background: var(--surface-2); font: 600 12px var(--font-ui); text-transform: uppercase; letter-spacing: .06em; color: var(--subtle); position: sticky; left: 0; }
.sched-group .muted { text-transform: none; letter-spacing: 0; font-weight: 400; }
.block.sub { border-left-style: double; border-left-width: 4px; }
.sched-worker.sub b::before, .day-worker.sub h2::before { content: 'Sub · '; color: var(--subtle); font-weight: 600; }
.pick { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line-2); }
.pick:last-child { border-bottom: 0; } .pick > div { min-width: 0; overflow-wrap: anywhere; }
/* Day sheet: one worker after another, readable on a phone without sideways scrolling */
.day-sheet { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.day-visit { display: grid; grid-template-columns: 124px minmax(0, 1fr); gap: 10px; width: 100%; text-align: left; border: 0; border-bottom: 1px solid var(--line-2); background: none; padding: 12px 18px; font: inherit; color: inherit; cursor: pointer; }
.day-visit:last-child { border-bottom: 0; border-radius: 0 0 var(--radius-lg) var(--radius-lg); } .day-visit:hover { background: var(--gold-50); }
.day-visit.done { opacity: .78; }
.day-time { font-weight: 700; color: var(--ink); }
.day-what { display: flex; flex-direction: column; gap: 2px; min-width: 0; } .day-what > span { overflow-wrap: anywhere; } .day-what b { color: var(--ink); }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--subtle); }

/* Drawer, modal, toast */
.scrim { position: fixed; inset: 0; background: var(--scrim); z-index: 40; animation: fade .12s; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 100vw); background: var(--surface); z-index: 41; box-shadow: var(--shadow-lg); display: flex; flex-direction: column; animation: slide .16s ease-out; }
.drawer-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.drawer-body { padding: 18px 22px; overflow: auto; flex: 1; }
.drawer-foot { padding: 14px 22px; border-top: 1px solid var(--line); display: flex; gap: 10px; justify-content: flex-end; background: var(--surface-2); }
.modal { position: fixed; left: 50%; top: 18vh; transform: translateX(-50%); width: min(460px, calc(100vw - 32px)); background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); z-index: 42; padding: 20px 22px; animation: fade .12s; }
.modal p { margin: 8px 0 16px; }
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: var(--toast-bg); color: var(--toast-text); border: 1px solid var(--toast-line); padding: 11px 16px; border-radius: var(--radius); box-shadow: var(--shadow-lg); z-index: 50; display: flex; gap: 14px; align-items: center; animation: fade .15s; }
.toast button { background: none; border: 0; color: var(--gold); font-weight: 700; cursor: pointer; }
/* A toast must never swallow a tap meant for the button under it (on a phone it sits over the
   drawer's buttons): only its own action button takes clicks. */
.toast { pointer-events: none; } .toast button { pointer-events: auto; }
.toast.error { background: var(--bad-solid); color: var(--on-solid); border-color: transparent; }
@keyframes fade { from { opacity: 0; } } @keyframes slide { from { transform: translateX(24px); opacity: .6; } }
.section-title { font: 600 12px var(--font-ui); text-transform: uppercase; letter-spacing: .06em; color: var(--subtle); margin: 18px 0 8px; }
.combo { position: relative; }
.combo-list { position: absolute; z-index: 5; top: calc(100% + 4px); left: 0; right: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); max-height: 230px; overflow: auto; }
.combo-list button { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 8px 10px; cursor: pointer; font: inherit; }
.combo-list button:hover, .combo-list button.focus { background: var(--gold-50); }
.combo-list .new { color: var(--gold-800); font-weight: 600; border-top: 1px solid var(--line-2); }
.inline-new { background: var(--gold-50); border: 1px solid var(--gold-100); border-radius: var(--radius); padding: 12px; display: grid; gap: 10px; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.filters select, .filters input { width: auto; min-width: 0; max-width: 200px; }

/* Timesheets */
.ts-week { display: grid; grid-template-columns: 190px repeat(7, 1fr) 90px; }
.ts-week > div { padding: 10px 12px; border-bottom: 1px solid var(--line-2); font-variant-numeric: tabular-nums; }
.ts-week .hd { font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--subtle); background: var(--surface-2); }
.ts-week .quiet { color: var(--faint); } .ts-week .normal { color: var(--ink-2); }
.ts-week .exc { background: var(--warn-bg); color: var(--warn); font-weight: 600; } .ts-week .exc.bad { background: var(--bad-bg); color: var(--bad); }
.ts-week .tot { font-weight: 700; color: var(--ink); text-align: right; }

@media (max-width: 1100px) { .cols { grid-template-columns: 1fr; } .sched-wrap { grid-template-columns: 1fr; } .kpis { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 820px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .attn-item { grid-template-columns: 20px minmax(0, 1fr); } .attn-item > .row { grid-column: 2; }
  #new-job span { display: none; } #new-job { padding: 8px 10px; }
  .kpis { gap: 8px; } .kpi { padding: 12px; } .kpi b { font-size: 20px; }
  .page-head { margin-bottom: 14px; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: 250px; z-index: 45; transform: translateX(-100%); transition: transform .18s; }
  .shell.nav-open .sidebar { transform: none; box-shadow: var(--shadow-lg); }
  .topbar { padding: 0 14px; } .topbar .menu { display: inline-flex; }
  .profile-name { display: none; }
  .page { padding: 18px 14px 50px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .table thead { display: none; } .table tr { display: grid; grid-template-columns: 1fr auto; } .table td { border: 0; padding: 4px 14px; } .table tr { border-bottom: 1px solid var(--line-2); padding: 8px 0; }
  .ts-week { grid-template-columns: 1fr 1fr 1fr 1fr; }
  .dl { grid-template-columns: 1fr; gap: 2px 0; } .dl dd { margin-bottom: 8px; }
  .day-visit { grid-template-columns: 112px minmax(0, 1fr); padding: 10px 14px; }
}

/* Forms: required marker, checkboxes, $/% affixes, repeatable rows */
.req { color: var(--bad); }
.check { display: inline-flex; align-items: center; gap: 8px; font: 500 13px var(--font-ui); color: var(--text); text-transform: none; letter-spacing: 0; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--gold-700); margin: 0; }
.check-row { display: flex; margin: 8px 0; }
.affix { display: flex; align-items: stretch; margin-top: 5px; }
.affix span { display: grid; place-items: center; padding: 0 10px; background: var(--surface-2); border: 1px solid var(--line); color: var(--subtle); font-weight: 600; }
.affix span:first-child { border-radius: var(--radius) 0 0 var(--radius); border-right: 0; }
.affix.right span { border-radius: 0 var(--radius) var(--radius) 0; border-left: 0; }
.affix input { border-radius: 0 var(--radius) var(--radius) 0; }
.affix.right input { border-radius: var(--radius) 0 0 var(--radius); }
.other-contact { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; margin-bottom: 10px; background: var(--surface-2); }
.section-title .check { font-size: 12.5px; }

/* Live-update notice in the top bar */
.live { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--subtle); white-space: nowrap; max-width: 46vw; overflow: hidden; }
.live .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--dot-ok); flex: none; }
.live.news { color: var(--ink); background: var(--gold-50); border: 1px solid var(--gold-100); padding: 4px 6px 4px 10px; border-radius: 99px; font-weight: 600; }
.live.news .dot { background: var(--gold-700); animation: pulse 1.2s ease-in-out 3; }
.live > span:not(.dot) { overflow: hidden; text-overflow: ellipsis; }
@keyframes pulse { 50% { transform: scale(1.8); opacity: .5; } }
@media (max-width: 820px) { .live:not(.news) { display: none; } .live.news { max-width: 60vw; } }
.next { margin: 10px 0 0; padding: 8px 12px; background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--gold); border-radius: var(--radius); color: var(--ink-2); max-width: 720px; }
.next b { color: var(--gold-800); }
.block .state { font-weight: 600; color: var(--ink-2); }
.history summary { cursor: pointer; font-weight: 600; color: var(--muted); } .history { border-top: 1px solid var(--line-2); }
.faint { color: var(--faint); }
.block .clash { font-weight: 700; color: var(--bad); white-space: normal; }
/* address field status line (public/app/address.js) */
.addr-status { display: block; margin-top: 5px; font-size: 12px; font-weight: 400; color: var(--subtle); }
.addr-status.ok { color: var(--ok); } .addr-status.warn { color: var(--warn); }
.addr-status a { color: inherit; text-decoration: underline; }
.addr-toggle { border: 0; background: none; padding: 2px 0; font: inherit; font-size: 12px; font-weight: 600; color: var(--gold-800); text-decoration: underline; cursor: pointer; }
/* Appearance switch: System / Light / Dark (public/app/theme.js) */
.theme-switch { margin: 6px 0 2px; padding: 9px 10px 8px; border-top: 1px solid var(--line-2); text-align: left; }
.theme-switch fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
.theme-switch legend { padding: 0; display: block; color: var(--subtle); font-size: 12px; margin-bottom: 6px; }
.theme-options { display: flex; width: 100%; background: var(--line-2); border-radius: var(--radius); padding: 3px; gap: 2px; }
.theme-options label { flex: 1; position: relative; }
.theme-options input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.theme-options span { display: block; text-align: center; padding: 6px 4px; border-radius: 6px; font: 600 12.5px var(--font-ui); color: var(--muted); }
.theme-options input:checked + span { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }
.theme-options input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: 1px; }
#theme-switch { justify-self: stretch; width: 100%; }
.signin-card .theme-switch { border-top: 0; margin: 4px 0 0; padding: 0; width: 100%; justify-self: stretch; }

/* Expected finish: Full day / Half day / Night shift / Custom, one click to change. */
.finish-control { display: block; }
.finish-control .finish-head { display: block; font-size: 12.5px; font-weight: 600; color: var(--muted); margin-bottom: 5px; }
.finish-control .finish-head .hint { margin-left: 6px; }
.finish-control .segmented { display: flex; flex-wrap: wrap; }
.finish-control .segmented button:disabled { opacity: .45; cursor: not-allowed; }
.finish-control input[type="time"] { display: block; margin-top: 6px; }
