:root {
  --bg: #f3f4f6;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --text: #111827;
  --muted: #5b6472;
  --border: #d9dee5;
  --brand: #1f2a37;
  --brand-text: #ffffff;
  --accent: #c2410c;
  --accent-text: #ffffff;
  --in: #15803d;
  --in-bg: #e8f6ec;
  --out: #b42318;
  --out-bg: #fdecea;
  --warn: #92400e;
  --warn-bg: #fff4d6;
  --focus: #2563eb;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.06), 0 1px 3px rgba(16, 24, 40, 0.08);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f141a;
    --surface: #18202a;
    --surface-2: #1d2733;
    --text: #edf0f4;
    --muted: #9aa5b4;
    --border: #2d3846;
    --brand: #0b1016;
    --accent: #f08c4a;
    --accent-text: #1a0d04;
    --in: #4ade80;
    --in-bg: #12301d;
    --out: #f87171;
    --out-bg: #3a1717;
    --warn: #fbbf24;
    --warn-bg: #3a2c0b;
    --focus: #60a5fa;
    --shadow: none;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  padding-bottom: env(safe-area-inset-bottom);
}
h1, h2, h3 { line-height: 1.2; margin: 0 0 0.5rem; }
h1 { font-size: 1.35rem; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
a { color: var(--focus); }
.loading { padding: 2rem; text-align: center; color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: 0.875rem; }
.num { font-variant-numeric: tabular-nums; }
.hidden { display: none !important; }

/* ---- top bar & nav ---- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: var(--brand); color: var(--brand-text);
  padding: calc(env(safe-area-inset-top) + 0.6rem) 16px 0.6rem;
  display: flex; align-items: center; gap: 0.75rem;
}
.topbar .title { font-weight: 700; font-size: 1.05rem; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar .who { font-size: 0.85rem; opacity: 0.85; white-space: nowrap; }
.topbar button { background: transparent; color: inherit; border: 1px solid rgba(255,255,255,0.35); min-height: 36px; padding: 0 0.7rem; font-size: 0.85rem; }
.tabs {
  display: flex; gap: 0.25rem; overflow-x: auto; scrollbar-width: none;
  background: var(--surface); border-bottom: 1px solid var(--border);
  padding: 0 12px; position: sticky; top: calc(env(safe-area-inset-top) + 52px); z-index: 19;
}
.tabs::-webkit-scrollbar { display: none; }
.tabs a {
  flex: none; padding: 0.8rem 0.7rem; color: var(--muted); text-decoration: none; font-weight: 600; font-size: 0.95rem;
  border-bottom: 3px solid transparent;
}
.tabs a.on { color: var(--text); border-bottom-color: var(--accent); }

main { max-width: 1100px; margin: 0 auto; padding: 16px; }
.narrow { max-width: 460px; margin: 0 auto; }

/* ---- cards, lists ---- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; margin-bottom: 16px; }
.card > h2:first-child, .card > h3:first-child { margin-top: 0; }
.row { display: flex; gap: 0.75rem; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.stack > * + * { margin-top: 0.75rem; }
.grid-cards { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.grid-cards .card { margin: 0; }

.list { list-style: none; margin: 0; padding: 0; }
.list > li { border-top: 1px solid var(--border); }
.list > li:first-child { border-top: 0; }
.item { display: flex; align-items: center; gap: 0.75rem; padding: 0.7rem 0; min-height: 52px; }
.item .main { flex: 1; min-width: 0; }
.item .name { font-weight: 600; }
.item .sub { color: var(--muted); font-size: 0.875rem; }
button.item { width: 100%; text-align: left; background: none; border: 0; border-radius: 0; color: inherit; font: inherit; padding: 0.7rem 0; cursor: pointer; }

/* Selectable worker rows on the crew screen */
label.pick {
  display: flex; align-items: center; gap: 0.85rem; padding: 0.65rem 0.75rem; margin: 0 -0.75rem;
  min-height: 56px; cursor: pointer; border-radius: 10px;
}
label.pick:hover { background: var(--surface-2); }
label.pick input { width: 26px; height: 26px; flex: none; accent-color: var(--accent); }
label.pick.checked { background: var(--surface-2); }
.pick .name { font-weight: 600; font-size: 1.05rem; }
.pick .sub { color: var(--muted); font-size: 0.875rem; }

.badge { display: inline-block; font-size: 0.78rem; font-weight: 700; padding: 0.15rem 0.5rem; border-radius: 999px; white-space: nowrap; }
.badge.in { background: var(--in-bg); color: var(--in); }
.badge.out { background: var(--out-bg); color: var(--out); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.plain { background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); }

.notice { padding: 0.75rem 1rem; border-radius: 10px; background: var(--warn-bg); color: var(--warn); margin-bottom: 16px; }
.notice.error { background: var(--out-bg); color: var(--out); }
.empty { color: var(--muted); padding: 0.5rem 0; }

/* ---- forms ---- */
label.field { display: block; }
label.field > span { display: block; font-weight: 600; font-size: 0.9rem; margin-bottom: 0.3rem; }
label.field > small { display: block; color: var(--muted); margin-top: 0.25rem; font-size: 0.82rem; }
input, select, textarea {
  width: 100%; font: inherit; font-size: 16px; color: var(--text); background: var(--surface);
  border: 1px solid var(--border); border-radius: 10px; padding: 0.65rem 0.75rem; min-height: 48px;
}
textarea { min-height: 72px; resize: vertical; }
input[type="checkbox"] { width: auto; min-height: 0; }
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible, a:focus-visible {
  outline: 3px solid var(--focus); outline-offset: 2px;
}
.form-grid { display: grid; gap: 0.9rem; grid-template-columns: 1fr 1fr; }
.form-grid .full { grid-column: 1 / -1; }
@media (max-width: 520px) { .form-grid { grid-template-columns: 1fr; } }
.check-row { display: flex; align-items: center; gap: 0.6rem; min-height: 44px; }
.check-row input { width: 22px; height: 22px; }

button, .btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
  font: inherit; font-weight: 700; min-height: 48px; padding: 0 1.1rem; border-radius: 10px; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface); color: var(--text); text-decoration: none;
}
button:disabled { opacity: 0.55; cursor: default; }
button.primary, .btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
button.go-in { background: var(--in); border-color: var(--in); color: #fff; }
button.go-out { background: var(--out); border-color: var(--out); color: #fff; }
@media (prefers-color-scheme: dark) { button.go-in, button.go-out { color: #0b0f14; } }
button.danger { color: var(--out); border-color: var(--out); background: transparent; }
button.link { background: none; border: 0; color: var(--focus); padding: 0; min-height: 0; font-weight: 600; }
button.small, .btn.small { min-height: 38px; padding: 0 0.8rem; font-size: 0.9rem; }
button.wide { width: 100%; }

.chips { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.chips button { min-height: 44px; padding: 0 0.95rem; font-weight: 600; }
.chips button.on { background: var(--brand); color: var(--brand-text); border-color: var(--brand); }
@media (prefers-color-scheme: dark) { .chips button.on { background: var(--accent); color: var(--accent-text); border-color: var(--accent); } }

/* Sticky action bar on the crew screen */
.actionbar {
  position: sticky; bottom: 0; z-index: 15; margin: 0 -16px; padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: var(--surface); border-top: 1px solid var(--border); display: flex; gap: 0.6rem; flex-wrap: wrap;
}
.actionbar button { flex: 1 1 140px; min-height: 54px; font-size: 1.02rem; }

/* ---- tables ---- */
.table-wrap { overflow-x: auto; margin: 0 -16px; padding: 0 16px; }
table { border-collapse: collapse; width: 100%; font-size: 0.93rem; }
th, td { text-align: left; padding: 0.55rem 0.5rem; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { font-size: 0.8rem; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: 0.02em; }
td.n, th.n { text-align: right; font-variant-numeric: tabular-nums; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: var(--surface-2); }
tr.total td { font-weight: 700; border-top: 2px solid var(--border); }
td.ot { color: var(--accent); font-weight: 700; }
tr.sub td { background: var(--surface-2); }

/* ---- dialog ---- */
dialog {
  border: 0; border-radius: 16px; padding: 0; width: min(560px, calc(100vw - 24px)); max-height: calc(100vh - 32px);
  background: var(--surface); color: var(--text); box-shadow: 0 20px 50px rgba(0,0,0,0.35);
}
dialog::backdrop { background: rgba(10, 15, 20, 0.55); }
dialog .dlg { padding: 20px; overflow-y: auto; max-height: calc(100vh - 32px); }
dialog .dlg-actions { display: flex; gap: 0.6rem; justify-content: flex-end; margin-top: 1.25rem; flex-wrap: wrap; }
dialog .dlg-actions .spacer { flex: 1; }
@media (max-width: 520px) {
  dialog { width: 100vw; max-width: 100vw; margin: auto 0 0; border-radius: 16px 16px 0 0; }
  dialog .dlg { padding-bottom: calc(20px + env(safe-area-inset-bottom)); }
}

#toast {
  position: fixed; left: 50%; bottom: calc(90px + env(safe-area-inset-bottom)); transform: translateX(-50%) translateY(20px);
  background: var(--brand); color: var(--brand-text); padding: 0.75rem 1.1rem; border-radius: 10px; font-weight: 600;
  opacity: 0; pointer-events: none; transition: opacity 0.2s, transform 0.2s; z-index: 100; max-width: calc(100vw - 32px);
}
@media (prefers-color-scheme: dark) { #toast { background: #e5e9ef; color: #111; } }
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.error { background: var(--out); color: #fff; }

.login-logo { display: block; width: 72px; height: 72px; margin: 1.5rem auto 0.75rem; }
.center { text-align: center; }
.period { display: flex; align-items: center; gap: 0.5rem; }
.period strong { min-width: 0; text-align: center; flex: 1; }
.period button { min-width: 48px; padding: 0; }
.mb { margin-bottom: 12px; }
.mt { margin-top: 1rem; }
.mt-s { margin-top: 0.2rem; }
.pull-up { margin-top: -0.3rem; }

/* ---- camera ---- */
.cam { position: relative; width: 100%; aspect-ratio: 4 / 3; background: #000; border-radius: 12px; overflow: hidden; }
.cam-video { width: 100%; height: 100%; object-fit: cover; display: block; }
.cam-video.mirror { transform: scaleX(-1); }
.cam-oval {
  position: absolute; left: 50%; top: 50%; width: 46%; height: 78%; transform: translate(-50%, -50%);
  border: 3px dashed rgba(255, 255, 255, 0.85); border-radius: 50%; pointer-events: none;
}
.cam-status { font-weight: 600; margin: 0.75rem 0 0.25rem; }
.cam-status.error { color: var(--out); }
.cam-status.ok { color: var(--in); }

/* ---- worker phone ---- */
button.huge { width: 100%; min-height: 84px; font-size: 1.5rem; border-radius: 16px; }
.big-status { font-size: 1.35rem; font-weight: 800; margin: 0.25rem 0; }
.big-status.in { color: var(--in); }
.center { text-align: center; }

.result { text-align: center; padding: 0.5rem 0 0.25rem; }
.result-mark {
  width: 84px; height: 84px; margin: 0 auto 0.75rem; border-radius: 50%; display: grid; place-items: center;
  font-size: 2.6rem; font-weight: 800; color: #fff; background: var(--in);
}
.result.out .result-mark { background: var(--out); }
.result p { font-size: 1.1rem; }

/* ---- site tablet ---- */
.kiosk-head h1 { font-size: 1.6rem; margin: 0; }
.kiosk-clock { font-size: 1.6rem; font-weight: 800; }
.kiosk-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
button.kiosk-name {
  display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 0.2rem;
  min-height: 92px; padding: 0.8rem 1rem; text-align: left; background: var(--surface); border: 2px solid var(--border);
}
button.kiosk-name .name { font-size: 1.15rem; font-weight: 800; }
button.kiosk-name .sub { font-size: 0.85rem; font-weight: 500; color: var(--muted); }
button.kiosk-name.on { border-color: var(--in); background: var(--in-bg); }
.pin-dots { text-align: center; font-size: 1.6rem; letter-spacing: 0.3em; min-height: 2.4rem; margin-bottom: 0.75rem; color: var(--muted); }
.pin-pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; max-width: 320px; margin: 0 auto; }
.pin-key { min-height: 64px; font-size: 1.5rem; }

/* ---- evidence / review ---- */
.evidence { margin: 0.5rem 0 1rem; }
.ev-photos { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 0.5rem; }
.ev-photo { margin: 0; }
.ev-photo img, .ev-none { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; border-radius: 10px; background: var(--surface-2); display: block; }
.ev-none { display: grid; place-items: center; color: var(--muted); font-size: 0.8rem; border: 1px dashed var(--border); }
.ev-photo figcaption { font-size: 0.78rem; color: var(--muted); text-align: center; margin-top: 0.2rem; }
.review-actions .row button { flex: 1; }
.face-thumb { width: 48px; height: 48px; border-radius: 50%; object-fit: cover; flex: none; background: var(--surface-2); }
.empty-thumb { display: grid; place-items: center; color: var(--muted); font-weight: 700; border: 1px dashed var(--border); }

fieldset.geo { border: 1px solid var(--border); border-radius: 12px; padding: 0.75rem 1rem 1rem; margin: 0; }
fieldset.geo legend { font-weight: 700; padding: 0 0.35rem; }
fieldset.geo > * + * { margin-top: 0.6rem; }

/* ---- site map ---- */
.site-map { height: 320px; border-radius: 12px; overflow: hidden; border: 1px solid var(--border); background: var(--surface-2); position: relative; z-index: 0; }
.map-loading { padding: 1rem; }
label.field { position: relative; }
ul.suggest {
  list-style: none; margin: 4px 0 0; padding: 4px 0; position: absolute; left: 0; right: 0; z-index: 30;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,0.18);
  max-height: 260px; overflow-y: auto;
}
ul.suggest li { padding: 0.65rem 0.8rem; cursor: pointer; font-size: 0.95rem; }
ul.suggest li:hover { background: var(--surface-2); }
ul.suggest li.muted { cursor: default; }
.radius-row { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; font-weight: 600; }
.radius-row input.radius-input { width: 120px; }
ul.suggest li.suggest-more { color: var(--focus); font-weight: 600; border-top: 1px solid var(--border); }
.notice.adjustments ul { margin: 0.4rem 0 0; padding-left: 1.2rem; }

/* ---- clocks ---- */
.clock { text-align: center; line-height: 1.15; }
.clock-time { font-size: 2rem; font-weight: 800; letter-spacing: 0.01em; }
.clock-date { font-size: 0.9rem; color: var(--muted); }
.clock.big .clock-time { font-size: 2.6rem; }
.clock.small { text-align: right; }
.clock.small .clock-time { font-size: 1.3rem; }
.clock.small .clock-date { font-size: 0.78rem; }
.login-clock { min-height: 4.2rem; margin-bottom: 0.75rem; }
.clock.kiosk-clock { text-align: right; }
.clock.kiosk-clock .clock-time { font-size: 1.8rem; }

/* ---- review count & banner ---- */
.tab-count {
  display: inline-block; min-width: 1.4em; margin-left: 0.35rem; padding: 0 0.4em; border-radius: 999px;
  background: var(--out); color: #fff; font-size: 0.78rem; line-height: 1.5; text-align: center;
}
a.review-banner { display: block; text-decoration: none; font-weight: 700; }
.notif-card h2 { margin: 0; }
p.reviewed { background: var(--surface-2); border-left: 4px solid var(--border); padding: 0.6rem 0.8rem; border-radius: 8px; }
.notice.locked { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }
.lock-card { gap: 0.75rem; }
.meter { height: 12px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); overflow: hidden; }
.meter-fill { height: 100%; background: var(--in); }
.meter-fill.full { background: var(--out); }
.day-checks { gap: 0.4rem; }
label.day-check { display: inline-flex; align-items: center; gap: 0.35rem; border: 1px solid var(--border); border-radius: 10px; padding: 0 0.7rem; min-height: 44px; font-weight: 600; cursor: pointer; }
label.day-check input { width: 20px; height: 20px; min-height: 0; }
details.own-sched { border: 1px solid var(--border); border-radius: 12px; padding: 0.6rem 0.9rem; }
details.own-sched summary { font-weight: 700; cursor: pointer; min-height: 32px; }
table.compact th, table.compact td { padding: 0.5rem 0.35rem; white-space: normal; }
table.compact td:first-child { font-weight: 600; }
.cell-sub { font-size: 0.75rem; font-weight: 500; color: var(--muted); white-space: nowrap; }
.notice.plain-notice { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }
.notice.plain-notice ul { margin: 0.4rem 0; padding-left: 1.2rem; }
.notice.cam-notice { font-weight: 700; margin-bottom: 10px; }
.lunch-choice { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 16px; }
.lunch-choice button { min-height: 72px; font-size: 1.4rem; }

/* Foreman search: matches under the box, picked names as removable chips */
.search-results:empty, .picked:empty { display: none; }
.search-results .pick { display: flex; align-items: center; gap: 0.75rem; padding: 0.6rem 0.5rem; border-radius: 10px; cursor: pointer; }
.search-results .pick input { width: 26px; height: 26px; flex: none; accent-color: var(--accent); pointer-events: none; }
.search-results .pick.checked { background: var(--surface-2); }
.search-results .empty { padding: 0.5rem; }
.picked { display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center; }
.picked .chip-x { min-height: 36px; padding: 0 0.75rem; font-weight: 600; border-radius: 999px; font-size: 0.9rem; }

/* Jobs tab */
a.job-card { display: block; color: inherit; text-decoration: none; }
a.job-card:hover { border-color: var(--accent); }
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.75rem; margin: 0.6rem 0; }
.stats.four { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 520px) { .stats.four { grid-template-columns: repeat(2, 1fr); } }
.stat-n { font-size: 1.5rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat-l { color: var(--muted); font-size: 0.85rem; }
.warn-text { color: var(--warn); font-weight: 600; }
.cost-table { width: 100%; border-collapse: collapse; margin-top: 0.5rem; }
.cost-table td { padding: 0.45rem 0; border-bottom: 1px solid var(--border); }
.cost-table td.n { text-align: right; font-variant-numeric: tabular-nums; }
.cost-table tr.total td { font-weight: 700; font-size: 1.1rem; border-top: 2px solid var(--text); border-bottom: 2px solid var(--text); }
details.extras summary { cursor: pointer; list-style: revert; }
details.extras[open] summary { margin-bottom: 0.75rem; }
details.extras .extras-grid { margin-bottom: 0.9rem; }
a.back { display: inline-block; margin-bottom: 0.5rem; font-weight: 600; }

/* Employee profile */
.profile-head h1 { margin: 0; }
.profile-head p { margin: 0.15rem 0 0; }
.face-big { width: 72px; height: 72px; border-radius: 50%; object-fit: cover; flex: none; background: var(--surface-2); display: grid; place-items: center; font-size: 1.6rem; color: var(--muted); }
.face-photo { width: 140px; height: 140px; border-radius: 12px; object-fit: cover; background: var(--surface-2); }
.info-row { display: flex; gap: 1rem; padding: 0.5rem 0; border-bottom: 1px solid var(--border); }
.info-row:last-child { border-bottom: 0; }
.info-l { color: var(--muted); width: 40%; flex: none; }
.info-v { min-width: 0; overflow-wrap: anywhere; }
.stats.three { grid-template-columns: repeat(3, 1fr); }
.cert-row { display: grid; gap: 0.4rem; padding: 0.7rem 0; border-bottom: 1px solid var(--border); }
.cert-row:last-child { border-bottom: 0; }
.cert-row .name { font-weight: 600; }
.cert-row .sub { color: var(--muted); font-size: 0.875rem; }
.btn.wide { width: 100%; justify-content: center; text-align: center; margin: 0.5rem 0; }
.notice.warn-notice { background: var(--warn-bg); color: var(--text); border-left: 4px solid var(--warn); }
button.big-action { min-height: 64px; font-size: 1.2rem; margin-top: 0.5rem; }
.earlier-box { border-top: 1px solid var(--border); padding-top: 0.9rem; margin-top: 0.4rem; }
.face-thumb.initials { display: grid; place-items: center; font-weight: 700; font-size: 0.95rem; color: var(--muted); border: 1px solid var(--border); }
.fix-compare { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; background: var(--surface-2); border-radius: 10px; padding: 0.6rem 0.8rem; }
.fix-compare .arrow { font-size: 1.3rem; color: var(--muted); }
.fix-compare .strong { font-weight: 700; }

/* Foreman screen: job site stands out */
.site-card { border: 2px solid var(--accent); }
.site-pick { display: block; }
.site-label { display: block; font-size: 1.05rem; font-weight: 800; letter-spacing: 0.02em; text-transform: uppercase; color: var(--accent); margin-bottom: 0.35rem; }
select.site-select { font-size: 1.25rem; font-weight: 700; min-height: 56px; border: 2px solid var(--border); }
/* Crew groups: bigger headings, coloured edge; "On site now" in green */
.crew-group h2 { font-size: 1.3rem; }
.crew-group h2 .badge { font-size: 1rem; padding: 0.15rem 0.6rem; vertical-align: middle; }
.crew-group.group-in { border-left: 6px solid var(--in); }
.crew-group.group-in h2 { color: var(--in); }
.crew-group.group-warn { border-left: 6px solid var(--warn); }
.crew-group.group-plain { border-left: 6px solid var(--border); }
label.pick .face-thumb, .search-results .face-thumb { width: 40px; height: 40px; }
@media (max-width: 600px) { .site-card > .row { flex-direction: column; align-items: stretch; gap: 0.6rem; } .site-card .clock { text-align: left; } select.site-select { font-size: 1.05rem; width: 100%; } }
.site-city { margin-left: 0.5rem; padding: 0.1rem 0.55rem; border-radius: 999px; background: var(--accent); color: var(--accent-text); font-size: 0.8rem; letter-spacing: 0.04em; }
label.pick .edit-time { flex: none; min-height: 40px; padding: 0 0.7rem; font-size: 0.85rem; }

/* Site board */
.board-tabs { margin: 0.75rem 0; }
.board-tabs .chip-count { margin-left: 0.35rem; background: var(--warn-bg); color: var(--warn); border-radius: 999px; padding: 0 0.45rem; font-size: 0.8rem; }
.board-tabs button.on .chip-count { background: rgba(255, 255, 255, 0.25); color: inherit; }
.req-items { white-space: pre-wrap; font: inherit; margin: 0; font-weight: 600; }
.req-card.done, .task-card.done { opacity: 0.7; }
.task-title { font-weight: 700; font-size: 1.05rem; }
.photo-strip { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.photo-tile { position: relative; width: 84px; height: 84px; border-radius: 10px; overflow: hidden; background: var(--surface-2); display: block; }
.photo-tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-x { position: absolute; top: 3px; right: 3px; min-height: 0; width: 26px; height: 26px; padding: 0; border-radius: 50%; background: rgba(0, 0, 0, 0.6); color: #fff; border: 0; font-size: 0.8rem; }
button.report-card { display: block; width: 100%; text-align: left; font-weight: 400; min-height: 0; padding: 1rem; }
.report-text { white-space: pre-wrap; margin: 0.4rem 0; }
.crew-list { margin: 0; padding-left: 1.1rem; }
.board-links { margin: 0.25rem 0 0.75rem; gap: 0.5rem; }
.eod-card { border: 2px solid var(--out); }
/* Schedule */
.sched-day { font-size: 1.4rem; font-weight: 800; }
.center-row { justify-content: center; }
.sched-pick { max-height: 45vh; overflow: auto; }
.sched-card { border: 2px solid var(--accent); }
.sched-line { display: flex; gap: 1rem; align-items: center; }
.sched-when { font-weight: 800; min-width: 5.5rem; color: var(--accent); }
/* Dashboard */
.dash-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 0.75rem; margin-bottom: 1rem; }
.dash-tile { display: block; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 0.8rem 1rem; color: inherit; text-decoration: none; }
.dash-tile.warn { border-color: var(--warn); background: var(--warn-bg); }
.bars { display: grid; gap: 0.55rem; margin-top: 0.75rem; }
.bar-row { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 2fr) auto; gap: 0.75rem; align-items: center; color: inherit; text-decoration: none; }
.bar-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.bar-track { height: 14px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--accent); border-radius: 999px; }
.bar-fill.ok { background: var(--in); }
.bar-fill.near { background: var(--warn); }
.bar-fill.over { background: var(--out); }
.bar-num { white-space: nowrap; font-size: 0.9rem; }
@media (max-width: 600px) { .bar-row { grid-template-columns: 1fr auto; } .bar-row .bar-track { grid-column: 1 / -1; grid-row: 2; } }
.budget-box { border-top: 1px solid var(--border); padding-top: 0.75rem; }
.budget-box input { max-width: 9rem; }
.notif-help { border-top: 1px solid var(--border); padding-top: 0.6rem; }
.notif-help summary { cursor: pointer; font-weight: 700; color: var(--accent); }
.help-steps { margin-top: 0.75rem; }
.help-steps ol { margin: 0.35rem 0 0; padding-left: 1.3rem; }
.help-steps li { margin: 0.25rem 0; }
/* Fold-up sections (employee profile) */
details.fold { padding: 0; }
details.fold > summary { list-style: none; display: flex; align-items: center; gap: 0.75rem; padding: 1rem 1.1rem; cursor: pointer; min-height: 56px; }
details.fold > summary::-webkit-details-marker { display: none; }
.fold-title { font-weight: 800; font-size: 1.1rem; }
.fold-sum { margin-left: auto; text-align: right; }
.fold-arrow { font-size: 1.2rem; color: var(--muted); transition: transform 0.15s; }
details.fold[open] .fold-arrow { transform: rotate(180deg); }
details.fold[open] > summary { border-bottom: 1px solid var(--border); }
.fold-body { padding: 0.9rem 1.1rem 1.1rem; }
.fold-all { justify-content: flex-end; margin-bottom: 0.5rem; gap: 0.5rem; }
.travel-note { gap: 0.5rem; flex-wrap: wrap; }
.travel-card { border: 2px solid var(--warn); }
.travel-box { padding-left: 0.5rem; border-left: 3px solid var(--warn); }
.field-label { font-weight: 600; font-size: 0.9rem; }
.travel-box input[type=number] { max-width: 5rem; }
.travel-box select { max-width: 7rem; }
.travel-check { border: 2px solid var(--warn); }
.eod-ask { font-weight: 800; width: 100%; }
/* ✕ close button on every pop-up */
dialog { position: fixed; }
.dlg-x { position: absolute; top: 8px; right: 8px; z-index: 2; width: 40px; height: 40px; min-height: 40px; padding: 0; border-radius: 50%; font-size: 1.1rem; font-weight: 700; background: var(--surface-2); border: 1px solid var(--border); color: var(--text); }
.dlg-x:hover { background: var(--border); }
dialog .dlg > h2:first-child, dialog .dlg > :first-child h2:first-child { padding-right: 2.75rem; }
.switch-row input { width: 22px; height: 22px; }
.money-hidden-btn { min-height: 34px; background: var(--warn-bg); color: var(--warn); border-color: var(--warn); margin-right: 0.5rem; }
/* Announcements */
.ann-text { white-space: pre-wrap; margin: 0; font-size: 1.05rem; }
.ann-mine { border: 2px solid var(--accent); }
.ann-item { border-bottom: 1px solid var(--border); padding-bottom: 0.6rem; }
.ann-item:last-child { border-bottom: 0; }
.ann-card.done { opacity: 0.65; }

/* ---- Menu styles ---- */
.nav-style-btn { min-height: 34px; padding: 0 0.7rem; margin-right: 0.5rem; font-size: 1.1rem; }
.nav-style-choice { display: grid; gap: 0.2rem; text-align: left; justify-items: start; padding: 0.8rem 1rem; min-height: 0; font-weight: 400; }
.nav-style-choice.on { border-color: var(--accent); background: var(--surface-2); }
/* Grouped menus */
.nav-groups { gap: 0.25rem; }
.nav-groups .nav-group { background: none; border: 0; border-radius: 0; min-height: 0; padding: 0.85rem 0.9rem; font-weight: 600; color: var(--muted); border-bottom: 3px solid transparent; white-space: nowrap; }
.nav-groups .nav-group.on, .nav-groups .nav-group.open { color: var(--text); border-bottom-color: var(--accent); }
.nav-dropdown { position: fixed; z-index: 50; min-width: 220px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 12px 30px rgba(0,0,0,0.2); padding: 0.35rem; display: grid; }
.nav-dropdown a { padding: 0.7rem 0.9rem; border-radius: 8px; color: var(--text); text-decoration: none; font-weight: 600; display: flex; align-items: center; gap: 0.4rem; }
.nav-dropdown a:hover, .nav-dropdown a.on { background: var(--surface-2); }
/* Side menu (computer) */
.side-layout { display: block; }
.side-nav { display: none; }
.side-group { display: grid; gap: 0.1rem; margin-bottom: 0.6rem; }
.side-head { font-size: 0.78rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); padding: 0.4rem 0.7rem 0.1rem; }
.side-link { padding: 0.55rem 0.7rem; border-radius: 8px; color: var(--text); text-decoration: none; font-weight: 600; display: flex; align-items: center; gap: 0.4rem; }
.side-link:hover { background: var(--surface-2); }
.side-link.on { background: var(--surface-2); color: var(--accent); }
@media (min-width: 900px) {
  .side-layout { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 1rem; align-items: start; }
  .side-nav { display: block; position: sticky; top: 0.75rem; max-height: calc(100vh - 1.5rem); overflow-y: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 0.6rem; margin: 1rem 0 1rem 1rem; }
  .bottom-nav { display: none !important; }
  body.with-bottom-nav .actionbar { bottom: 0; }
}
/* Bottom bar (phone) */
.bottom-nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: grid; grid-template-columns: repeat(5, 1fr); background: var(--surface); border-top: 1px solid var(--border); padding-bottom: env(safe-area-inset-bottom); }
.bottom-item { display: grid; justify-items: center; gap: 0.1rem; padding: 0.45rem 0.2rem; min-height: 58px; font-size: 0.72rem; font-weight: 700; color: var(--muted); text-decoration: none; background: none; border: 0; border-radius: 0; position: relative; }
.bottom-item.on { color: var(--accent); }
.bottom-icon { font-size: 1.3rem; line-height: 1.2; }
.bottom-item .tab-count { position: absolute; top: 4px; right: 18%; }
@media (max-width: 899px) {
  body.with-bottom-nav main { padding-bottom: 80px; }
  body.with-bottom-nav .actionbar { bottom: calc(58px + env(safe-area-inset-bottom)); }
}
.side-toggle { display: flex; align-items: center; gap: 0.45rem; width: 100%; background: none; border: 0; border-radius: 8px; min-height: 0; cursor: pointer; text-align: left; }
.side-toggle:hover { background: var(--surface-2); }
.side-chev { display: inline-block; font-size: 1.15rem; line-height: 1; transform: rotate(90deg); transition: transform 0.15s; }
.side-toggle.folded .side-chev { transform: rotate(0deg); }
.side-links { display: grid; gap: 0.1rem; }
.side-toggle { justify-content: flex-start; padding: 0.5rem 0.7rem 0.3rem; font-weight: 800; }
