
/* Layout: navy sidebar (sites + screens) beside a working area; collapses to a top bar on phones */
:root {
  --bg: #f4f6fa; --surface: #ffffff; --fg: #142033; --muted: #5d6b82; --line: #dce3ed; --side: #0e1726; --side-fg: #e8edf7;
  --accent: #2162fb; --accent-soft: #e6eeff; --uca: #e2561f; --ok: #1f7a4d; --ok-soft: #e3f4ea; --warn: #9a6200; --warn-soft: #fbf0d9;
  --stop: #b42318; --stop-soft: #fde7e5;
  --display: "Space Grotesk", "Segoe UI", system-ui, sans-serif; --body: "Atkinson Hyperlegible", system-ui, -apple-system, sans-serif;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --bg: #0b1120; --surface: #121b2d; --fg: #e6ecf5; --muted: #9aa8bf; --line: #24304a; --side: #060b16;
  --accent: #6b9bff; --accent-soft: #17264a; --uca: #ff7a45; --ok: #5fd39a; --ok-soft: #12301f; --warn: #f0b85a; --warn-soft: #33270f;
  --stop: #ff8a80; --stop-soft: #3a1512; color-scheme: dark } }
:root[data-theme="dark"] {
  --bg: #0b1120; --surface: #121b2d; --fg: #e6ecf5; --muted: #9aa8bf; --line: #24304a; --side: #060b16;
  --accent: #6b9bff; --accent-soft: #17264a; --uca: #ff7a45; --ok: #5fd39a; --ok-soft: #12301f; --warn: #f0b85a; --warn-soft: #33270f;
  --stop: #ff8a80; --stop-soft: #3a1512; color-scheme: dark }
* { box-sizing: border-box; }
body { background: var(--bg); color: var(--fg); font: 15px/1.5 var(--body); }
h1, h2, h3 { font-family: var(--display); margin: 0; line-height: 1.2; text-wrap: balance; }
button, select, textarea, input { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.muted { color: var(--muted); } .small { font-size: 0.85rem; }
.shell { display: grid; grid-template-columns: 15.5rem minmax(0, 1fr); min-height: 100vh; }
.side { background: var(--side); color: var(--side-fg); padding: 1.25rem 0.9rem; display: flex; flex-direction: column; gap: 1.1rem;
  position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 0.5rem; padding: 0 0.3rem; }
.chip { display: inline-flex; align-items: center; background: #fff; border-radius: 999px; padding: 0.35rem 0.8rem; }
.chip img, .chip svg { display: block; height: 20px; width: auto; }
.wordmark { font-family: var(--display); font-weight: 700; font-size: 1.35rem; letter-spacing: -0.01em; color: #fff; }
.wordmark b { color: #f6a21a; }
.side label { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.06em; opacity: 0.7; padding: 0 0.3rem; }
.side select { width: 100%; background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.16); color: var(--side-fg);
  border-radius: 8px; padding: 0.5rem 0.6rem; }
.side select option { color: #142033; }
.side nav { display: grid; gap: 0.15rem; }
.side nav button { display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; text-align: left; border: 0;
  background: transparent; color: var(--side-fg); padding: 0.55rem 0.7rem; border-radius: 8px; opacity: 0.8; }
.side nav button:hover { background: rgba(255,255,255,0.07); opacity: 1; }
.side nav button[aria-current="page"] { background: rgba(255,255,255,0.12); opacity: 1; box-shadow: inset 3px 0 0 #f6a21a; }
.count { font-size: 0.75rem; font-weight: 700; background: #f6a21a; color: #0e1726; border-radius: 999px; padding: 0 0.45rem; }
.who { margin-top: auto; font-size: 0.85rem; display: grid; gap: 0.1rem; padding: 0.7rem; border-radius: 8px; background: rgba(255,255,255,0.06); }
main { padding-block: 1.6rem 3rem; padding-left: max(16px, 2rem); padding-right: max(16px, 2rem); display: grid; gap: 1.25rem; align-content: start; min-width: 0; }
.head { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; align-items: end; padding-right: 9rem; }
.head p { margin: 0.3rem 0 0; color: var(--muted); max-width: 62ch; }
.demo { font-size: 0.75rem; font-weight: 700; color: var(--warn); background: var(--warn-soft); border-radius: 999px; padding: 0.15rem 0.6rem; }
.toggle { position: fixed; top: max(0.75rem, env(safe-area-inset-top, 0px)); right: max(0.75rem, env(safe-area-inset-right, 0px)); z-index: 20;
  display: inline-flex; gap: 2px; padding: 3px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); box-shadow: 0 2px 8px rgba(0,0,0,0.15); }
.toggle button { border: 0; border-radius: 999px; padding: 0.3rem 0.75rem; font-size: 0.8rem; font-weight: 700; background: transparent; opacity: 0.65; }
.toggle button[aria-pressed="true"] { background: var(--accent); color: #fff; opacity: 1; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); gap: 0.75rem; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 0.9rem 1rem; display: grid; gap: 0.15rem; }
.tile .label { font-size: 0.8rem; color: var(--muted); }
.tile .value { font-family: var(--display); font-size: 1.6rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 1rem 1.1rem; display: grid; gap: 0.8rem; min-width: 0; }
.spread { display: flex; justify-content: space-between; align-items: center; gap: 0.75rem; flex-wrap: wrap; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.seg button { border: 0; background: transparent; padding: 0.35rem 0.75rem; font-size: 0.88rem; }
.seg button[aria-pressed="true"] { background: var(--accent); color: #fff; }
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 0.92rem; }
th, td { padding: 0.55rem 0.6rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
th { font-family: var(--display); font-size: 0.75rem; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
tr:last-child td { border-bottom: 0; }
.mark { display: inline-block; font-size: 0.75rem; font-weight: 700; border-radius: 999px; padding: 0.1rem 0.55rem; white-space: nowrap; }
.mark.ok { background: var(--ok-soft); color: var(--ok); } .mark.soon { background: var(--warn-soft); color: var(--warn); }
.mark.stop { background: var(--stop-soft); color: var(--stop); } .mark.info { background: var(--accent-soft); color: var(--accent); }
.emp { display: inline-flex; align-items: center; gap: 0.4rem; white-space: nowrap; }
.dot { width: 0.6rem; height: 0.6rem; border-radius: 50%; flex: none; }
.btn { border: 1px solid var(--accent); background: var(--accent); color: #fff; border-radius: 8px; padding: 0.4rem 0.8rem; font-weight: 700; font-size: 0.88rem; }
.btn.quiet { background: transparent; color: var(--accent); }
.btn:disabled { opacity: 0.45; cursor: default; }
.hbar { display: grid; grid-template-columns: minmax(7rem, 13rem) 1fr 6.5rem; gap: 0.7rem; align-items: center; }
.track { height: 1.3rem; background: var(--bg); border-radius: 6px; overflow: hidden; display: flex; }
.track span { display: block; height: 100%; }
.legend { display: flex; flex-wrap: wrap; gap: 0.4rem 1rem; font-size: 0.85rem; }
.map { width: 100%; height: auto; display: block; background: var(--bg); border-radius: 8px; }
.map text { fill: var(--fg); font-family: var(--body); }
.map .road { stroke: var(--line); stroke-width: 2; fill: none; }
.map .link { stroke: var(--muted); stroke-dasharray: 4 4; stroke-width: 1.2; fill: none; opacity: 0.7; }
.maps { display: grid; gap: 0.9rem; }
.compose { display: grid; gap: 0.6rem; }
.compose textarea { width: 100%; min-height: 7rem; border: 1px solid var(--line); border-radius: 8px; padding: 0.6rem; background: var(--bg); }
.outbox li { padding: 0.55rem 0; border-bottom: 1px solid var(--line); list-style: none; display: grid; gap: 0.15rem; }
.outbox { margin: 0; padding: 0; }
.toast { position: fixed; bottom: max(1rem, env(safe-area-inset-bottom, 0px)); left: 50%; transform: translateX(-50%); background: var(--side); color: #fff;
  padding: 0.6rem 1rem; border-radius: 8px; z-index: 30; box-shadow: 0 4px 14px rgba(0,0,0,0.25); }
.rise { animation: rise 0.35s ease-out both; }
@keyframes rise { from { opacity: 0.4; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .rise { animation: none; } }
@media (max-width: 52rem) {
  .shell { grid-template-columns: 1fr; }
  .side { position: static; height: auto; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
  .side nav { grid-template-columns: repeat(auto-fit, minmax(8.5rem, 1fr)); }
  .who { display: none; }
  .head { padding-right: 0; }
  .hbar { grid-template-columns: 1fr; gap: 0.25rem; }
}
body { margin: 0; }

/* street map (Leaflet + OpenStreetMap tiles, same as the employer portal) */
.lmap { height: 32rem; border-radius: 8px; border: 1px solid var(--line); z-index: 0; }
.site-pin { background: none; border: 0; }
.site-pin span { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 6px; background: var(--uca); color: #fff;
  font: 700 18px/1 var(--display); border: 2px solid #fff; box-shadow: 0 2px 6px rgba(0,0,0,0.35); }
.site-pin.dim span { opacity: 0.45; }
.leaflet-tooltip.emp-tip, .leaflet-tooltip.site-tip { font: 12px/1.35 var(--body); padding: 3px 7px; }
.leaflet-tooltip.site-tip { background: var(--side); color: #fff; border-color: var(--side); }

/* modal invoice + print */
.modal { position: fixed; inset: 0; z-index: 40; background: rgba(8, 14, 26, 0.55); display: grid; place-items: center;
  padding: max(16px, env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) max(16px, env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px)); }
.modal-card { background: var(--surface); color: var(--fg); border-radius: 12px; padding: 1.25rem; width: min(52rem, 100%); max-height: 90vh; overflow: auto; display: grid; gap: 1rem; }
.invoice { display: grid; gap: 0.9rem; }
@media print {
  body > *:not(.modal) { display: none !important; }
  .modal { position: static; background: none; padding: 0; }
  .modal-card { max-height: none; box-shadow: none; width: 100%; }
  .no-print { display: none !important; }
}

/* employee phone preview */
.phone { position: fixed; right: max(16px, env(safe-area-inset-right, 0px)); bottom: max(16px, env(safe-area-inset-bottom, 0px)); z-index: 35;
  width: min(20rem, calc(100vw - 32px)); background: #0e1726; color: #fff; border-radius: 28px; padding: 0.8rem 0.8rem 1rem;
  box-shadow: 0 12px 40px rgba(0,0,0,0.4); border: 6px solid #1d2a40; display: grid; gap: 0.7rem; }
.phone.in { animation: slidein 0.45s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
@keyframes slidein { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.phone-top { display: flex; justify-content: space-between; align-items: center; font-size: 0.78rem; opacity: 0.85; padding: 0 0.3rem; }
.phone-x { background: none; border: 0; color: #fff; font-size: 1.2rem; line-height: 1; }
.note { background: rgba(255,255,255,0.14); border-radius: 16px; padding: 0.7rem 0.8rem; display: grid; gap: 0.2rem; cursor: pointer; animation: slidein 0.5s 0.25s both; }
.note-head { display: flex; gap: 0.45rem; align-items: center; font-size: 0.82rem; }
.note-head .muted { color: rgba(255,255,255,0.6); margin-left: auto; }
.app-dot { width: 1.3rem; height: 1.3rem; border-radius: 6px; background: #f6a21a; color: #0e1726; display: grid; place-items: center; font-weight: 700; font-size: 0.75rem; }
.inapp { background: #fff; color: #142033; border-radius: 16px; padding: 1rem; display: grid; gap: 0.5rem; }
.inapp .due { font-family: var(--display); font-size: 2rem; font-weight: 700; }
.inapp .muted { color: #5d6b82; }
@media (prefers-reduced-motion: reduce) { .phone.in, .note { animation: none; } }
@media print { .phone { display: none !important; } }
[hidden] { display: none !important; }
