/* HSE Workspace — light theme. Logical properties (inline-start/end) keep the
   layout correct in right-to-left (Arabic) mode. */
:root {
  /* Redesign (1 Dec 2026): concrete and graphite, colour only for status (safety-sign colours),
     DIN — the typeface of road and safety signs — for headings, numbers and buttons. */
  --bg: #ecedea;            /* concrete: the page ground */
  --surface: #ffffff;       /* the sheet you work on */
  --surface-2: #f6f6f4;
  --surface-3: #e8e9e6;
  --hover: #f3f4f1;
  --line: #d9dbd6;
  --line-strong: #c4c7c1;
  --ink: #1c2024;
  --ink-2: #3d4247;
  --muted: #6a6f74;
  --primary: #24282c;       /* graphite: site board, main buttons */
  --primary-hover: #111315;
  --primary-ink: #ffffff;
  --primary-soft: #e4e5e2;
  --board: #24282c;
  --board-2: #30353a;
  --board-ink: #f2f3f1;
  --board-muted: #9ca1a5;
  --focus: rgba(36, 40, 44, .32);
  --focus-soft: rgba(36, 40, 44, .14);
  --ok: #2b774b; --ok-soft: #e5f0e9;
  --warn: #8f5d05; --warn-soft: #faf0da; --warn-mark: #e2a40f;
  --danger: #b02e3a; --danger-soft: #f9e8ea;
  --info: #2b5a88; --info-soft: #e6edf5;
  --na: #84888c;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: none;
  --shadow-lg: 0 16px 40px rgba(20, 22, 24, .18);
  --sidebar: 244px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Noto Sans Arabic", "Helvetica Neue", Arial, sans-serif;
  --font-display: "DIN Alternate", "Bahnschrift", "DIN 2014", "D-DIN", "DIN Next", "Roboto Condensed", "Arial Narrow", system-ui, sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 14px/1.5 var(--font); color: var(--ink); background: var(--bg); }
a:where(:not(.safeplan *)){ color: var(--ink); text-decoration: none; font-weight: inherit; }
a:hover:where(:not(.safeplan *)){ text-decoration: underline; }
h1:where(:not(.safeplan *)), h2:where(:not(.safeplan *)), h3:where(:not(.safeplan *)){ margin: 0; line-height: 1.25; letter-spacing: -.01em; }
p:where(:not(.safeplan *)){ margin: 0; }
button:where(:not(.safeplan *)), input:where(:not(.safeplan *)), select:where(:not(.safeplan *)), textarea:where(:not(.safeplan *)){ font: inherit; color: inherit; }
img:where(:not(.safeplan *)){ max-width: 100%; }
code:where(:not(.safeplan *)){ font: 13px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--surface-2); border: 1px solid var(--line); padding: 1px 6px; border-radius: 6px; }
.icon { flex: none; }
.muted { color: var(--muted); }
.small:where(:not(.safeplan *)){ font-size: 13px; }
.pre { white-space: pre-wrap; }
.hidden { display: none !important; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
[hidden] { display: none !important; }

/* ---------- layout ---------- */
.app-shell:where(:not(.safeplan *)){ display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; }
.sidebar:where(:not(.safeplan *)){ position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 14px; padding: 16px 12px; background: var(--surface); border-inline-end: 1px solid var(--line); overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px; color: var(--ink); }
.brand:hover { text-decoration: none; }
.brand strong { display: block; font-size: 15px; }
.brand small { display: block; color: var(--muted); font-size: 12px; }
.event-switch { display: grid; gap: 4px; padding: 10px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-2); }
.event-switch-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.event-switch select { border: 0; background: transparent; font-weight: 650; padding: 0; min-height: 28px; cursor: pointer; }
.event-switch small { color: var(--muted); font-size: 12px; }
.nav { display: grid; gap: 2px; }
.nav-link { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: var(--radius-sm); color: var(--ink-2); font-weight: 550; }
.nav-link:hover { background: var(--surface-2); text-decoration: none; color: var(--ink); }
.nav-link.active:where(:not(.safeplan *)){ background: var(--primary-soft); color: var(--ink); font-weight: 650; box-shadow: inset 3px 0 0 var(--primary); }
.nav-count { margin-inline-start: auto; min-width: 22px; padding: 0 7px; border-radius: 999px; background: var(--danger); color: #fff; font-size: 12px; text-align: center; }
.nav-sep { height: 1px; background: var(--line); margin: 8px 4px; }
.sidebar-foot { margin-top: auto; }
.user-chip { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); cursor: pointer; text-align: start; }
.user-chip span:nth-child(2) { flex: 1; min-width: 0; }
.user-chip strong, .user-chip small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-chip small { color: var(--muted); font-size: 12px; }
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar:where(:not(.safeplan *)){ position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; padding: 10px 24px; background: rgba(244, 244, 242, .92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.global-search { flex: 1; max-width: 520px; display: flex; align-items: center; gap: 8px; padding: 0 12px; height: 40px; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; color: var(--muted); }
.global-search input { flex: 1; border: 0; outline: 0; background: transparent; min-width: 0; }
.topbar-tools { margin-inline-start: auto; display: flex; gap: 6px; }
.topbar-event { font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.view { padding: 20px 24px; width: 100%; max-width: 1280px; margin: 0 auto; outline: none; }
.only-mobile { display: none !important; }
.scrim { display: none; }

/* ---------- page parts ---------- */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 10px 20px; margin-bottom: 14px; }
.page-title h1, .page-h1 { font-size: 21px; font-weight: 700; }
.page-title p { color: var(--muted); margin-top: 2px; font-size: 13px; }
.page-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.back-link { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 14px; overflow-x: auto; scrollbar-width: none; }
.tab { padding: 8px 12px; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; white-space: nowrap; }
.tab:hover { color: var(--ink); text-decoration: none; }
.tab.active:where(:not(.safeplan *)){ color: var(--primary); border-bottom-color: var(--primary); }
.tab-count { display: inline-block; min-width: 20px; padding: 0 6px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); font-size: 12px; text-align: center; }
.grid { display: grid; gap: 14px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-auto { grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); }
.grid-main { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); align-items: start; }
.grid > *, .stack > *, .form-grid > *:where(:not(.safeplan *)), .kv > * { min-width: 0; }
.card, .stat, .list-item, .table td, .value-body, .banner { overflow-wrap: anywhere; }
.stack { display: grid; gap: 14px; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.spacer:where(:not(.safeplan *)){ flex: 1; }
.narrow { max-width: 560px; margin: 0 auto; display: grid; gap: 16px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); min-width: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 11px 16px; border-bottom: 1px solid var(--line); }
.card-head h2 { font-size: 14px; font-weight: 700; }
.card-subtitle { margin-top: 3px; color: var(--muted); font-size: 12.5px; }
.card-body { padding: 14px 16px; }
.card-body.flush { padding: 0; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat { display: grid; gap: 2px; padding: 14px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); color: var(--ink); }
a.stat:hover { border-color: var(--primary); text-decoration: none; }
.stat-label { font-size: 13px; color: var(--muted); font-weight: 550; }
.stat-value { font-size: 26px; font-weight: 750; letter-spacing: -.02em; }
.stat-note { font-size: 12px; color: var(--muted); }
.stat-danger .stat-value { color: var(--danger); }
.stat-warn .stat-value { color: var(--warn); }
.stat-ok .stat-value { color: var(--ok); }
.empty, .empty-page { display: grid; justify-items: center; gap: 8px; padding: 32px 20px; text-align: center; color: var(--muted); }
.empty h3, .empty-page h1 { color: var(--ink); font-size: 18px; }
.empty-page { padding: 80px 20px; }
.empty-mark { width: 48px; height: 48px; display: grid; place-items: center; border-radius: 14px; background: var(--surface-3); color: var(--muted); }
.table-empty { padding: 28px; text-align: center; color: var(--muted); }
.info-note { padding: 10px 12px; border-radius: var(--radius-sm); background: var(--info-soft); color: var(--info); font-size: 14px; }
.banner { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: var(--radius); border: 1px solid; margin-bottom: 16px; }
.banner-warn { background: var(--warn-soft); border-color: #f2d49b; color: var(--warn); }
.banner-info { background: var(--info-soft); border-color: var(--line-strong); color: var(--info); }
.banner-ok { background: var(--ok-soft); border-color: #b7e0c6; color: var(--ok); }
.banner-danger { background: var(--danger-soft); border-color: #f4c2cb; color: var(--danger); }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 38px; padding: 0 14px; border-radius: var(--radius-sm); border: 1px solid transparent; font-weight: 600; cursor: pointer; white-space: nowrap; text-decoration: none !important; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: var(--primary-ink); }
.btn-primary:hover { background: var(--primary-hover); }
.btn-secondary { background: var(--surface); color: var(--ink); border-color: var(--line-strong); }
.btn-secondary:hover { background: var(--surface-2); }
.btn-ghost { background: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--primary-soft); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger-ghost { background: transparent; color: var(--danger); border-color: #ecc7cc; }
.btn-ok { background: var(--ok); color: #fff; }
.btn-sm { min-height: 32px; padding: 0 10px; font-size: 13px; }
.btn-block { width: 100%; }
.icon-btn { position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 4px; min-width: 38px; height: 38px; padding: 0 8px; border: 1px solid transparent; border-radius: var(--radius-sm); background: transparent; cursor: pointer; color: var(--ink-2); }
.icon-btn:hover { background: var(--surface); border-color: var(--line); }
.badge { position: absolute; top: 3px; inset-inline-end: 3px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 999px; background: var(--danger); color: #fff; font-size: 11px; line-height: 17px; font-weight: 700; }

/* ---------- pills / chips ---------- */
.pill { display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 650; white-space: nowrap; }
.pill-ok { background: var(--ok-soft); color: var(--ok); }
.pill-warn { background: var(--warn-soft); color: var(--warn); }
.pill-danger { background: var(--danger-soft); color: var(--danger); }
.pill-info { background: var(--info-soft); color: var(--info); }
.pill-muted { background: var(--surface-3); color: var(--ink-2); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { padding: 3px 10px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); font-size: 13px; }

/* ---------- tables ---------- */
.table-wrap { width: 100%; overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th { text-align: start; font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 700; padding: 8px 12px; background: var(--surface-2); border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table tr[data-href] { cursor: pointer; }
.table tr[data-href]:hover td { background: var(--hover); }
.table-compact td, .table-compact th { padding: 7px 10px; }
.cell-main { font-weight: 650; }
.cell-sub { display: block; color: var(--muted); font-size: 13px; }
.num { text-align: end; }

/* ---------- toolbar ---------- */
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.toolbar input[type=search], .toolbar select, .toolbar input[type=date] { height: 38px; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--surface); }
.toolbar input[type=search] { flex: 1 1 220px; min-width: 160px; }

/* ---------- forms ---------- */
.form-section { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.form-section + .form-section { margin-top: 14px; }
.form-section-head { margin-bottom: 14px; }
.form-section-head h3 { font-size: 15px; }
.form-section-head p { color: var(--muted); font-size: 13.5px; margin-top: 2px; }
.form-grid:where(:not(.safeplan *)){ display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.field:where(:not(.safeplan *)){ display: grid; gap: 6px; align-content: start; min-width: 0; border: 0; padding: 0; margin: 0; }
.field-full { grid-column: 1 / -1; }
.field-label { font-size: 13px; font-weight: 650; color: var(--ink-2); }
.req { color: var(--danger); }
.field-hint { color: var(--muted); font-size: 12.5px; }
:where(input:not([type=checkbox]):not([type=radio]):not([type=file]), select:where(:not(.safeplan *)), textarea) {
  width: 100%; min-height: 40px; padding: 7px 11px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--surface); outline: none;
}
textarea:where(:not(.safeplan *)){ resize: vertical; min-height: 84px; }
:where(input, select:where(:not(.safeplan *)), textarea):focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--focus-soft); }
:where(input:read-only) { background: var(--surface-2); }
.form-actions { position: sticky; bottom: 0; z-index: 5; display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; padding: 12px 0; margin-top: 14px; background: linear-gradient(to top, var(--bg) 70%, transparent); }
.form-error { color: var(--danger); font-size: 14px; min-height: 1em; }
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 8px; margin-top: 6px; }
.check { display: flex; align-items: flex-start; gap: 8px; padding: 9px 11px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); cursor: pointer; }
.check:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }
.check input { margin-top: 3px; accent-color: var(--primary); width: 16px; height: 16px; flex: none; }
.check-single { border: 0; padding: 0; background: transparent !important; }
.segmented { display: inline-flex; flex-wrap: wrap; gap: 6px; }
.segmented label { position: relative; }
.segmented input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.segmented span { display: inline-flex; align-items: center; min-height: 38px; padding: 0 14px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--surface); font-weight: 600; font-size: 14px; }
.segmented input:checked + span { background: var(--primary); border-color: var(--primary); color: #fff; }
.segmented input:focus-visible + span { outline: 3px solid var(--focus); }
.field-yesno { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 0; border-bottom: 1px dashed var(--line); grid-column: 1 / -1; }
.field-yesno .field-label { flex: 1 1 280px; font-weight: 550; }
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.photo-grid:empty { display: none; }
.photo { position: relative; display: block; aspect-ratio: 1; border-radius: var(--radius-sm); overflow: hidden; border: 1px solid var(--line); background: var(--surface-2); }
.photo img { width: 100%; height: 100%; object-fit: cover; }
.photo-remove { position: absolute; top: 4px; inset-inline-end: 4px; width: 26px; height: 26px; display: grid; place-items: center; border-radius: 50%; border: 0; background: rgba(0, 0, 0, .6); color: #fff; cursor: pointer; }
.photo-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.sig-pad { position: relative; border: 1px dashed var(--line-strong); border-radius: var(--radius-sm); background: #fff; }
.sig-pad canvas { display: block; width: 100%; height: 160px; touch-action: none; cursor: crosshair; }
.sig-pad button { position: absolute; top: 6px; inset-inline-end: 6px; }
.sig-img { max-height: 90px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: #fff; }
.rows-table { display: grid; gap: 6px; }
.rows-head, .rows-row { display: grid; grid-template-columns: repeat(var(--cols), minmax(90px, 1fr)) 38px; gap: 6px; align-items: center; }
.rows-head span { font-size: 12px; color: var(--muted); font-weight: 650; }
.rows-table { overflow-x: auto; }
.value { display: grid; gap: 3px; min-width: 0; }
.value-label { font-size: 12.5px; color: var(--muted); font-weight: 650; }
.value-body { overflow-wrap: anywhere; }
.kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px 18px; margin: 0; }
.kv dt { font-size: 12.5px; color: var(--muted); font-weight: 650; }
.kv dd { margin: 2px 0 0; font-weight: 550; overflow-wrap: anywhere; }

/* ---------- charts ---------- */
.hbars { display: grid; gap: 6px; max-width: 760px; }
.hbars-more summary { cursor: pointer; font-size: 12.5px; color: var(--primary); font-weight: 600; margin-top: 2px; }
.hbars-more[open] summary { margin-bottom: 6px; }
.hbar { display: grid; grid-template-columns: minmax(0, 38%) minmax(0, 1fr) auto; gap: 4px 12px; align-items: center; font-size: 13px; line-height: 1.3; }
.hbar-label { color: var(--ink-2); overflow-wrap: anywhere; }
.hbar-track { height: 6px; background: var(--surface-3); border-radius: 999px; overflow: hidden; }
.hbar-track i { display: block; height: 100%; background: #6f7277; border-radius: 999px; }
.hbar-value { text-align: end; font-weight: 650; white-space: nowrap; font-variant-numeric: tabular-nums; }
.hbar-value small { color: var(--muted); font-weight: 500; margin-inline-start: 4px; }
.hbars-total { margin-top: 8px; font-size: 12px; color: var(--muted); }

/* ---------- lists ---------- */
.list { display: grid; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 10px 16px; border-bottom: 1px solid var(--line); color: var(--ink); }
.list-item:last-child { border-bottom: 0; }
a.list-item:hover { background: var(--hover); text-decoration: none; }
.list-item .grow { flex: 1; min-width: 0; }
.list-item strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-item small { color: var(--muted); font-size: 13px; }
.mod-icon { width: 34px; height: 34px; flex: none; display: grid; place-items: center; border-radius: 9px; background: var(--surface-3); color: var(--ink-2); }
.quick { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.quick a { display: flex; align-items: center; gap: 10px; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: var(--shadow); }
.quick a:hover { border-color: var(--primary); text-decoration: none; }
.timeline { display: grid; gap: 14px; }
.timeline-item { display: grid; grid-template-columns: 28px 1fr; gap: 10px; }
.timeline-dot { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); border: 1px solid var(--line); color: var(--muted); }
.timeline-item small { color: var(--muted); }
.avatar { display: inline-grid; place-items: center; border-radius: 50%; background: var(--surface-3); color: var(--ink-2); font-weight: 700; flex: none; }
.avatar-sm { width: 32px; height: 32px; font-size: 12px; }
.avatar-md { width: 40px; height: 40px; font-size: 14px; }

/* ---------- dialog ---------- */
.dialog { border: 0; padding: 0; border-radius: 16px; width: min(520px, calc(100vw - 24px)); max-height: calc(100vh - 40px); box-shadow: var(--shadow-lg); color: var(--ink); }
.dialog-wide { width: min(860px, calc(100vw - 24px)); }
.dialog::backdrop { background: rgba(20, 20, 22, .45); }
.dialog-inner { display: flex; flex-direction: column; max-height: calc(100vh - 40px); }
.dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.dialog-head h2 { font-size: 17px; }
.dialog-body { padding: 18px 20px; overflow-y: auto; display: grid; gap: 12px; }
.dialog-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--line); background: var(--surface-2); }
.menu-list { display: grid; gap: 4px; }
.menu-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 0; border-radius: var(--radius-sm); background: transparent; cursor: pointer; text-align: start; font-weight: 550; }
.menu-item:hover { background: var(--surface-2); }
.menu-item.danger { color: var(--danger); }
.notif-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.notif-list a { display: grid; gap: 2px; padding: 10px 12px; border-radius: var(--radius-sm); border: 1px solid var(--line); color: var(--ink); }
.notif-list li.unread a { border-color: var(--line-strong); background: var(--primary-soft); }
.notif-list small { color: var(--muted); }

/* ---------- toasts ---------- */
.toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 1000; display: grid; gap: 8px; }
.toast:where(:not(.safeplan *)){ padding: 11px 16px; border-radius: 10px; background: #2b2f36; color: #fff; box-shadow: var(--shadow-lg); font-weight: 550; max-width: min(92vw, 460px); transition: opacity .3s, transform .3s; }
.toast-error { background: var(--danger); }
.toast.leaving:where(:not(.safeplan *)){ opacity: 0; transform: translateY(8px); }

/* ---------- auth ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: var(--bg); }
.auth-card { width: min(420px, 100%); display: grid; gap: 14px; padding: 28px; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow-lg); }
.auth-card h1 { font-size: 22px; }
.auth-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; }
.auth-brand strong { display: block; font-size: 17px; }
.auth-brand small { color: var(--muted); }
.auth-note { display: flex; gap: 6px; font-size: 13px; color: var(--muted); }
.fatal { max-width: 560px; margin: 80px auto; padding: 24px; }

/* ---------- module specifics ---------- */
.q-list { display: grid; }
.q-item { display: grid; grid-template-columns: 32px 1fr auto; gap: 10px 12px; align-items: start; padding: 14px 0; border-bottom: 1px solid var(--line); }
.q-item:last-child { border-bottom: 0; }
.q-num { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--line); font-size: 12px; font-weight: 700; color: var(--muted); }
.q-text { font-weight: 550; }
.q-extra { grid-column: 2 / -1; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.q-extra textarea, .q-extra input { min-height: 38px; }
.q-extra textarea { grid-column: 1 / -1; min-height: 60px; }
.resp { display: inline-flex; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); overflow: hidden; }
.resp label { position: relative; }
.resp input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.resp span { display: inline-flex; align-items: center; min-height: 36px; padding: 0 12px; font-weight: 650; font-size: 13.5px; border-inline-start: 1px solid var(--line-strong); background: var(--surface); cursor: pointer; }
.resp label:first-child span { border-inline-start: 0; }
.resp input:checked + span.r-ok { background: var(--ok); color: #fff; }
.resp input:checked + span.r-bad { background: var(--danger); color: #fff; }
.resp input:checked + span.r-na { background: var(--na); color: #fff; }
.resp input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: -3px; }
.score-select { min-width: 210px; }
.score-strong { color: var(--ok); }
.score-attention { color: var(--warn); }
.score-action { color: var(--danger); }
.progress { height: 8px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--primary); }
.sticky-summary { position: sticky; top: 70px; }
.type-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.type-card { display: grid; gap: 6px; padding: 14px; text-align: start; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); cursor: pointer; box-shadow: var(--shadow); color: var(--ink); }
.type-card:hover, .type-card.selected { border-color: var(--primary); background: var(--primary-soft); text-decoration: none; }
.type-card strong { display: flex; align-items: center; gap: 8px; }
.type-card span { color: var(--muted); font-size: 13.5px; }
.swatch:where(:not(.safeplan *)){ width: 12px; height: 12px; border-radius: 4px; flex: none; }
.access-grid td, .access-grid th { white-space: nowrap; }
.access-grid select { min-height: 34px; padding: 4px 8px; min-width: 130px; font-size: 13px; }
.access-grid .disabled-col { opacity: .45; }
.legend:where(:not(.safeplan *)){ display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px; }
.legend div:where(:not(.safeplan *)){ padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2); font-size: 13px; }
.legend strong:where(:not(.safeplan *)){ display: block; margin-bottom: 2px; }
.switch-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.switch-row:last-child { border-bottom: 0; }
.switch-row .grow { flex: 1; min-width: 0; }
.switch-row small { display: block; color: var(--muted); }
.switch { position: relative; width: 44px; height: 26px; flex: none; }
.switch input { position: absolute; opacity: 0; inset: 0; cursor: pointer; z-index: 1; }
.switch i { position: absolute; inset: 0; border-radius: 999px; background: var(--line-strong); transition: background .2s; }
.switch i::after { content: ''; position: absolute; top: 3px; inset-inline-start: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.2); transition: inset-inline-start .2s; }
.switch input:checked + i { background: var(--primary); }
.switch input:checked + i::after { inset-inline-start: 21px; }
.switch input:focus-visible + i { outline: 3px solid var(--focus); }

/* induction / kiosk / pass */
body.bare { background: var(--bg); }
.kiosk { max-width: 760px; margin: 0 auto; padding: 20px 16px 60px; }
.kiosk-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 18px; }
.kiosk-hero { padding: 28px; border-radius: 18px; background: var(--primary); color: #fff; display: grid; gap: 10px; }
.kiosk-hero h1 { font-size: 30px; }
.kiosk-hero p { opacity: .92; font-size: 16px; }
.lang-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.lang-card { padding: 18px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); font-size: 18px; font-weight: 650; cursor: pointer; }
.lang-card:hover, .lang-card.selected { border-color: var(--primary); background: var(--primary-soft); }
.rule-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 12px; }
.rule { padding: 12px; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--line); }
.rule strong { display: block; color: var(--primary); }
.pass { max-width: 380px; margin: 0 auto; padding: 20px; border-radius: 18px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-lg); display: grid; gap: 10px; justify-items: center; text-align: center; }
.pass-photo { width: 120px; height: 120px; border-radius: 50%; object-fit: cover; border: 4px solid var(--primary-soft); }
.pass canvas { width: 220px; height: 220px; image-rendering: pixelated; }
.pass-status { width: 100%; padding: 8px; border-radius: 10px; font-weight: 750; }
.pass-status.ok:where(:not(.safeplan *)){ background: var(--ok-soft); color: var(--ok); }
.pass-status.bad:where(:not(.safeplan *)){ background: var(--danger-soft); color: var(--danger); }
.verify-result { display: grid; gap: 10px; justify-items: center; padding: 24px; border-radius: 18px; text-align: center; }
.verify-result.ok:where(:not(.safeplan *)){ background: var(--ok-soft); border: 2px solid var(--ok); }
.verify-result.bad:where(:not(.safeplan *)){ background: var(--danger-soft); border: 2px solid var(--danger); }
.verify-result h2 { font-size: 24px; }
.scanner video { width: 100%; max-height: 360px; border-radius: var(--radius); background: #000; object-fit: cover; }

/* crowd */
.exit-row { display: grid; grid-template-columns: 34px 1fr 40px; gap: 8px; align-items: center; }
.exit-tag { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 8px; background: var(--primary-soft); color: var(--primary); font-weight: 700; }
.big-number { font-size: 34px; font-weight: 800; letter-spacing: -.02em; }

/* ---------- responsive ---------- */
@media (max-width: 1240px) {
  .grid-2.stack-early { grid-template-columns: 1fr; }
}
@media (max-width: 1100px) {
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-main { grid-template-columns: 1fr; }
  .sticky-summary { position: static; }
}
@media (max-width: 860px) {
  .app-shell:where(:not(.safeplan *)){ grid-template-columns: 1fr; }
  .sidebar:where(:not(.safeplan *)){ position: fixed; inset-block: 0; inset-inline-start: 0; z-index: 50; width: min(300px, 86vw); transform: translateX(-105%); transition: transform .22s ease; box-shadow: var(--shadow-lg); }
  body.drawer-open .sidebar:where(:not(.safeplan *)){ transform: none; }
  body.drawer-open .scrim { display: block; position: fixed; inset: 0; z-index: 40; background: rgba(20, 20, 22, .4); }
  .only-mobile { display: inline-flex !important; }
  .topbar-event.only-mobile { display: block !important; }
  .topbar:where(:not(.safeplan *)){ padding: 8px 12px; flex-wrap: wrap; }
  .topbar-event { flex: 1; min-width: 0; }
  .global-search { order: 5; flex-basis: 100%; max-width: none; height: 38px; }
  .view { padding: 16px 12px 40px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .form-grid:where(:not(.safeplan *)){ grid-template-columns: 1fr; }
  .page-title h1 { font-size: 21px; }
  .page-actions { width: 100%; }
  .page-actions .btn { flex: 1; }
  .q-item { grid-template-columns: 28px 1fr; }
  .q-item > :nth-child(3) { grid-column: 2; }
  .q-extra { grid-template-columns: 1fr; }
  .rule-grid { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat-value { font-size: 22px; }
  /* tables become labelled cards */
  .table:not(.table-keep) thead { display: none; }
  .table:not(.table-keep), .table:not(.table-keep) tbody, .table:not(.table-keep) tr, .table:not(.table-keep) td { display: block; width: 100%; }
  .table:not(.table-keep) tr { padding: 10px 14px; border-bottom: 1px solid var(--line); }
  .table:not(.table-keep) td { display: grid; grid-template-columns: minmax(90px, 38%) 1fr; gap: 10px; padding: 4px 0; border: 0; }
  .table:not(.table-keep) td::before { content: attr(data-label); color: var(--muted); font-size: 12.5px; font-weight: 650; }
  .access-grid select { min-width: 0; }
  .hbar { grid-template-columns: minmax(0, 1fr) auto; }
  .hbar-track { grid-column: 1 / -1; grid-row: 2; }
  .dialog { width: calc(100vw - 16px); }
}

/* ---------- print ---------- */
.print-only { display: none; }
@media print {
  @page { size: A4; margin: 14mm; }
  body { background: #fff; font-size: 11pt; }
  .sidebar:where(:not(.safeplan *)), .topbar:where(:not(.safeplan *)), .page-actions, .form-actions, .tabs, .toolbar, .no-print, .toasts, .back-link { display: none !important; }
  .app-shell:where(:not(.safeplan *)){ display: block; }
  .view { padding: 0; max-width: none; }
  .card, .form-section, .stat { box-shadow: none; break-inside: avoid; }
  .print-only { display: block; }
  .grid-main, .grid-2 { grid-template-columns: 1fr 1fr; }
  a:where(:not(.safeplan *)){ color: inherit; }
  .table tr { break-inside: avoid; }
  .print-head { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid #c9c9c4; padding-bottom: 8px; margin-bottom: 12px; }
}

/* forms placed in the narrow side column use a single column */
.grid-main > :last-child .form-grid:where(:not(.safeplan *)){ grid-template-columns: 1fr; }
.grid-main > :last-child .form-grid.fg12 > *:where(:not(.safeplan *)){ grid-column: 1 / -1; }
.card .form-section { box-shadow: none; }

.global-search input { border: 0; min-height: 0; padding: 0; box-shadow: none; background: transparent; }
.access-grid th:first-child, .access-grid td:first-child { position: sticky; inset-inline-start: 0; background: var(--surface); z-index: 1; }
.access-grid th:first-child { background: var(--surface-2); }


.auth-demo { display: grid; gap: 8px; padding-top: 14px; border-top: 1px solid var(--line); }
.auth-demo > span { font-weight: 650; }
.input-unit { display: flex; align-items: center; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--surface); }
.input-unit:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px var(--focus-soft); }
.input-unit input { border: 0; box-shadow: none !important; flex: 1; min-width: 0; }
.input-unit span { padding: 0 12px; color: var(--muted); font-size: 13px; white-space: nowrap; }
.calc-line { display: flex; flex-wrap: wrap; align-items: baseline; gap: 10px; font-size: 22px; font-variant-numeric: tabular-nums; }
.calc-line b { color: var(--muted); font-weight: 400; }
.calc-labels { display: flex; gap: 16px; font-size: 12px; color: var(--muted); margin-top: 4px; }
.card.mt, .mt { margin-top: 16px; }
.q-toggle { grid-column: 2; justify-self: start; min-height: 26px; padding: 0 6px; font-size: 12.5px; }

/* ---------- compact plant register ---------- */
.plant-hero { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 18px 20px; margin-bottom: 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.plant-eyebrow { display: block; margin-bottom: 4px; color: var(--primary); font-size: 11px; font-weight: 800; letter-spacing: .1em; }
.plant-hero h2 { font-size: 20px; }
.plant-hero p { margin-top: 4px; color: var(--muted); font-size: 13px; }
.plant-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
.plant-kpi { display: grid; grid-template-columns: 1fr auto; align-items: center; column-gap: 10px; padding: 11px 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); box-shadow: var(--shadow); }
.plant-kpi span, .plant-kpi small { color: var(--muted); font-size: 12px; }
.plant-kpi span { grid-column: 1 / -1; font-weight: 650; }
.plant-kpi strong { font-size: 24px; line-height: 1.1; letter-spacing: -.03em; }
.plant-kpi small { grid-column: 1 / -1; margin-top: 2px; }
.plant-kpi-ok strong { color: var(--ok); }
.plant-kpi-warn { border-color: #ecd8b4; background: var(--warn-soft); }
.plant-kpi-warn strong { color: var(--warn); }
.plant-register-layout { display: grid; grid-template-columns: minmax(0, 1.85fr) minmax(260px, .75fr); gap: 14px; align-items: start; }
.plant-register-panel { overflow: hidden; }
.plant-register-panel .card-head { padding: 13px 16px; }
.plant-register-panel .card-body.flush { padding: 0; }
.plant-register-panel .toolbar { padding: 10px 12px; background: var(--surface-2); }
.plant-register-panel .table { font-size: 13.5px; }
.plant-register-panel .table th { padding: 8px 12px; font-size: 11px; }
.plant-register-panel .table td { padding: 10px 12px; }
.plant-register-panel .table tr[data-href]:hover td { background: var(--hover); }
.plant-name-cell { display: flex; align-items: center; gap: 9px; min-width: 190px; }
.plant-name-cell > span:last-child { min-width: 0; }
.plant-name-cell strong, .plant-name-cell small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.plant-name-cell small { max-width: 240px; color: var(--muted); font-size: 12px; }
.plant-avatar { display: grid; place-items: center; width: 30px; height: 30px; flex: none; border-radius: 8px; background: var(--surface-3); color: var(--ink-2); }
.plant-status-detail { margin-top: 2px; font-size: 11.5px; }
.plant-side-column { gap: 14px; }
.plant-side-card .card-head { padding: 12px 14px; }
.plant-side-card .card-body { padding: 4px 10px; }
.plant-attention-list { display: grid; }
.plant-attention-item { display: flex; align-items: center; gap: 8px; min-width: 0; padding: 10px 4px; color: var(--ink); border-bottom: 1px solid var(--line); }
.plant-attention-item:last-child { border-bottom: 0; }
.plant-attention-item:hover { text-decoration: none; color: var(--primary); }
.plant-attention-item strong, .plant-attention-item small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.plant-attention-item small { color: var(--muted); font-size: 12px; }
.plant-attention-item .icon { margin-inline-start: auto; color: var(--muted); }
.plant-status-dot { width: 8px; height: 8px; flex: none; border-radius: 50%; background: var(--muted); }
.plant-status-dot.plant-status-danger { background: var(--danger); }
.plant-status-dot.plant-status-warn { background: var(--warn); }
.plant-status-dot.plant-status-ok { background: var(--ok); }
.plant-clear-state { display: flex; align-items: center; gap: 8px; padding: 14px 4px; color: var(--ok); }
.plant-clear-state p { color: var(--ink-2); font-size: 13px; }
.plant-quick-actions { display: grid; }
.plant-quick-actions > a { display: flex; align-items: center; gap: 9px; padding: 9px 4px; color: var(--ink); border-bottom: 1px solid var(--line); }
.plant-quick-actions > a:last-child { border-bottom: 0; }
.plant-quick-actions > a:hover { text-decoration: none; color: var(--primary); }
.plant-quick-actions strong, .plant-quick-actions small { display: block; }
.plant-quick-actions small { color: var(--muted); font-size: 12px; }
.plant-action-icon { display: grid; place-items: center; width: 28px; height: 28px; flex: none; border-radius: 7px; background: var(--surface-2); color: var(--primary); }
@media (max-width: 1000px) {
  .plant-register-layout { grid-template-columns: 1fr; }
  .plant-side-column { grid-template-columns: repeat(2, minmax(0, 1fr)); display: grid; }
}
@media (max-width: 680px) {
  .plant-hero { align-items: flex-start; flex-direction: column; padding: 15px; }
  .plant-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .plant-side-column { grid-template-columns: 1fr; }
  .plant-register-panel .card-head { align-items: flex-start; }
  .plant-register-panel .card-head .btn { padding-inline: 6px; }
}

/* ---------- compact filter bar (all registers) ---------- */
.filters { padding: 10px 12px; border-bottom: 1px solid var(--line); background: var(--surface); }
.filters-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.fsearch { flex: 1 1 240px; min-width: 180px; max-width: 420px; display: flex; align-items: center; gap: 6px; height: 36px; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--surface); color: var(--muted); }
.fsearch:focus-within, .fsel:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px var(--focus-soft); }
.fsearch input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; height: 34px; padding: 0; font-size: 14px; color: var(--ink); }
.filters-fields { display: flex; flex-wrap: wrap; gap: 8px; }
.fsel { display: inline-flex; align-items: center; height: 36px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--surface); overflow: hidden; max-width: 100%; }
.fsel > span { padding: 0 8px 0 10px; font-size: 12px; font-weight: 650; color: var(--muted); white-space: nowrap; border-inline-end: 1px solid var(--line); height: 100%; display: inline-flex; align-items: center; background: var(--surface-2); }
.fsel select, .fsel input { border: 0; outline: 0; background: transparent; height: 34px; min-height: 0; padding: 0 28px 0 8px; font-size: 13.5px; color: var(--ink); width: auto; max-width: 220px; box-shadow: none; }
.fsel input[type=date] { padding: 0 8px; max-width: 160px; }
.fsel input[type=date]:invalid, .fsel input[type=date]:not(:focus):placeholder-shown { color: var(--muted); }
.filters-extra { margin-inline-start: auto; display: flex; gap: 6px; }
.filters-toggle { display: none; }
.fcount { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--primary); color: #fff; font-size: 11px; line-height: 18px; text-align: center; }
.filters-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.fchip { display: inline-flex; align-items: center; gap: 4px; height: 26px; padding: 0 8px; border: 1px solid var(--line-strong); border-radius: 999px; background: var(--primary-soft); color: var(--primary); font-size: 12.5px; cursor: pointer; }
.fchip b { font-weight: 650; }
@media (max-width: 860px) {
  .fsearch { flex: 1 1 auto; max-width: none; }
  .filters-toggle { display: inline-flex; }
  .filters-fields { display: none; width: 100%; flex-direction: column; }
  .filters.open .filters-fields:where(:not(.safeplan *)){ display: flex; }
  .fsel { width: 100%; }
  .fsel > span { min-width: 92px; }
  .fsel select, .fsel input, .fsel input[type=date] { flex: 1; max-width: none; }
  .filters-extra { margin-inline-start: 0; }
}
/* admin access grid: short level names so all modules fit */
.access-grid { table-layout: auto; }
.access-grid select { min-width: 0; width: 100%; padding: 4px 22px 4px 6px; font-size: 12.5px; min-height: 32px; }

/* ---------- checklist inspection sheet ---------- */
#chk-form { max-width: 1040px; }
.chk-section { padding: 0; overflow: hidden; }
.chk-sec-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; padding: 12px 16px; background: var(--surface-2); border-bottom: 1px solid var(--line); }
.chk-sec-head h3 { margin: 0; font-size: 15px; }
.chk-sec-head p { margin: 2px 0 0; font-size: 12.5px; color: var(--muted); }
.chk-sec-tools { display: flex; align-items: center; gap: 8px; }
.chk-sec-count { font-size: 12.5px; font-weight: 650; color: var(--muted); font-variant-numeric: tabular-nums; }
.chk-sec-count.done { color: var(--ok); }
.chk-list { list-style: none; margin: 0; padding: 0; }
.chk-row { border-bottom: 1px solid var(--line); border-inline-start: 3px solid transparent; }
.chk-row:last-child { border-bottom: 0; }
.chk-row[data-state=yes] { border-inline-start-color: var(--ok); }
.chk-row[data-state=no] { border-inline-start-color: var(--danger); background: #fffafa; }
.chk-row[data-state=na] { border-inline-start-color: #b4b6b9; }
.chk-main { display: grid; grid-template-columns: 26px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px 14px 10px 12px; }
.chk-num { font-size: 12.5px; font-weight: 700; color: var(--muted); text-align: end; font-variant-numeric: tabular-nums; }
.chk-q { font-size: 14px; line-height: 1.45; color: var(--ink); }
.chk-answer { display: flex; align-items: center; gap: 6px; }
.chk-answer .resp span { min-height: 32px; padding: 0 12px; font-size: 13px; }
.chk-note-btn { width: 32px; height: 32px; color: var(--muted); }
.chk-note-btn.has-note { color: var(--primary); background: var(--primary-soft); }
.tag-critical { display: inline-block; vertical-align: 1px; margin-inline-start: 4px; padding: 1px 6px; border-radius: 4px; background: var(--danger-soft); color: var(--danger); font-size: 10.5px; font-weight: 700; letter-spacing: .03em; text-transform: uppercase; }
.chk-detail { display: grid; gap: 10px; padding: 0 14px 14px 50px; }
.chk-detail .field-label { font-size: 12px; }
.chk-detail textarea { min-height: 56px; }
.chk-plan { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1.3fr) minmax(0, 1fr); gap: 10px; }
.chk-row[data-state=no] .chk-plan { padding: 10px; border: 1px solid #f3c7c7; border-radius: var(--radius-sm); background: #fff; }
.result-box { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface-2); }
.result-box strong { font-size: 16px; display: block; }
.result-box ul { margin: 4px 0 0; padding-inline-start: 18px; font-size: 13.5px; color: var(--ink-2); }
.result-box .result-pending { display: block; font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.result-icon { width: 36px; height: 36px; flex: none; display: grid; place-items: center; border-radius: 50%; color: #fff; background: var(--muted); }
.result-ok { background: var(--ok-soft); border-color: #b7e0c5; } .result-ok .result-icon { background: var(--ok); } .result-ok strong { color: var(--ok); }
.result-warn { background: var(--warn-soft); border-color: #f2d49b; } .result-warn .result-icon { background: var(--warn); } .result-warn strong { color: var(--warn); }
.result-danger { background: var(--danger-soft); border-color: #f3c0c0; } .result-danger .result-icon { background: var(--danger); } .result-danger strong { color: var(--danger); }
.rule-help { margin-top: 10px; font-size: 13px; color: var(--ink-2); }
.rule-help summary { cursor: pointer; color: var(--primary); font-weight: 600; }
.rule-help ul { margin: 6px 0 0; padding-inline-start: 18px; display: grid; gap: 4px; }
@media (max-width: 860px) {
  .chk-main { grid-template-columns: 22px minmax(0, 1fr); gap: 8px 10px; padding: 12px; }
  .chk-answer { grid-column: 2; }
  .chk-answer .resp { flex: 1; }
  .chk-answer .resp label { flex: 1; }
  .chk-answer .resp span { width: 100%; justify-content: center; min-height: 38px; }
  .chk-detail { padding: 0 12px 12px 12px; }
  .chk-plan { grid-template-columns: 1fr; }
}

/* ---------- template picker (new audit / checklist / incident / permit) ---------- */
.picker { max-width: 920px; }
.picker-list { display: grid; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); overflow: hidden; }
.picker-item { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 14px 16px; color: var(--ink); border-bottom: 1px solid var(--line); }
.picker-item:last-child { border-bottom: 0; }
.picker-item:hover { background: var(--surface-2); text-decoration: none; }
.picker-item:hover .picker-go { border-color: var(--primary); color: var(--primary); }
.picker-icon { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 10px; color: var(--ink-2); background: var(--surface-3); border: 1px solid var(--line); }
.picker-body { display: grid; gap: 3px; min-width: 0; }
.picker-body strong { font-size: 15px; }
.picker-desc { font-size: 13.5px; color: var(--ink-2); line-height: 1.45; }
.picker-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 3px; }
.picker-meta span { font-size: 12px; padding: 1px 8px; border-radius: 999px; background: var(--surface-3); color: var(--ink-2); }
.picker-side { display: grid; justify-items: end; gap: 6px; }
.picker-last { font-size: 12px; color: var(--muted); white-space: nowrap; }
@media (max-width: 640px) {
  .picker-item { grid-template-columns: 40px minmax(0, 1fr); gap: 10px 12px; }
  .picker-icon { width: 40px; height: 40px; }
  .picker-side { grid-column: 2; justify-items: start; grid-auto-flow: column; align-items: center; justify-content: space-between; }
  .picker-last { white-space: normal; }
}

/* ---------- induction: worker flow, pass, gate, staff tools ---------- */
.kiosk-h2 { font-size: 16px; margin: 22px 0 10px; }
.kiosk-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: space-between; margin-top: 18px; }
.kiosk-actions.center { justify-content: center; }
.kiosk-actions .btn-primary { margin-inline-start: auto; }
.kiosk-actions.center .btn-primary { margin-inline-start: 0; }
.btn-lg { min-height: 48px; padding: 0 22px; font-size: 16px; }
.kiosk-card { margin-top: 14px; }
.center { text-align: center; justify-content: center; }
.row.wrap { flex-wrap: wrap; }
.mono-small { font-family: ui-monospace, Menlo, monospace; font-size: 12px; word-break: break-all; }
.choice-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); gap: 10px; }
.choice { display: grid; gap: 4px; justify-items: start; text-align: start; padding: 14px 16px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--surface); cursor: pointer; color: var(--ink); font: inherit; }
.choice svg { color: var(--ink-2); }
.choice strong { font-size: 15.5px; }
.choice span { font-size: 13.5px; color: var(--muted); }
.choice.selected { border-color: var(--primary); background: var(--primary-soft); box-shadow: 0 0 0 1px var(--primary) inset; }
.steps:where(:not(.safeplan *)){ list-style: none; display: flex; gap: 6px; margin: 0 0 16px; padding: 0; counter-reset: s; overflow: hidden; }
.steps li:where(:not(.safeplan *)){ flex: 1; display: flex; align-items: center; gap: 6px; padding-top: 8px; border-top: 3px solid var(--line); font-size: 12.5px; font-weight: 650; color: var(--muted); min-width: 0; white-space: nowrap; }
.steps li span:where(:not(.safeplan *)){ width: 20px; height: 20px; flex: none; display: grid; place-items: center; border-radius: 50%; background: var(--line); color: var(--ink-2); font-size: 11px; }
.steps li.done:where(:not(.safeplan *)){ border-top-color: var(--ok); color: var(--ok); } .steps li.done span:where(:not(.safeplan *)){ background: var(--ok); color: #fff; }
.steps li.current:where(:not(.safeplan *)){ border-top-color: var(--primary); color: var(--primary); } .steps li.current span:where(:not(.safeplan *)){ background: var(--primary); color: #fff; }
@media (max-width: 480px) { .steps li:where(:not(.safeplan *)){ font-size: 0; gap: 0; justify-content: center; } .steps li.current:where(:not(.safeplan *)){ font-size: 12.5px; gap: 6px; } }
.video-box { position: relative; margin-top: 12px; border-radius: var(--radius); overflow: hidden; background: #111; aspect-ratio: 16 / 9; }
.video-box video, .video-box iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.video-status { margin-top: 8px; font-size: 13.5px; font-weight: 650; color: var(--warn); }
.video-status.ok:where(:not(.safeplan *)){ color: var(--ok); }
.video-status.ok:where(:not(.safeplan *))::before{ content: '✓ '; }
.kiosk-rules { margin-top: 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); padding: 12px 14px; }
.kiosk-rules summary { cursor: pointer; font-weight: 650; }
.kiosk-rules h3 { font-size: 15px; margin-top: 10px; }
.kiosk-rules p, .kiosk-rules li { font-size: 14px; color: var(--ink-2); }
.kiosk-rules ul { margin: 4px 0 0; padding-inline-start: 18px; }
.video-grid { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 1fr); gap: 10px 12px; }
@media (max-width: 640px) { .video-grid { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); } }
.done-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.done-head > svg { width: 44px; height: 44px; padding: 10px; border-radius: 50%; background: var(--ok); color: #fff; flex: none; }
.done-head h1 { font-size: 24px; }
.pass-head { width: calc(100% + 40px); margin: -20px -20px 4px; padding: 12px 16px; border-radius: 18px 18px 0 0; background: var(--primary); color: #fff; display: grid; gap: 2px; }
.pass-head span { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font-size: 12px; font-weight: 650; letter-spacing: .05em; text-transform: uppercase; opacity: .9; }
.pass-head strong { font-size: 17px; }
.pass-code { font-size: 18px; font-weight: 700; letter-spacing: .12em; }
.pass .kv { width: 100%; text-align: start; }
.confirm-panel { margin-top: 18px; padding: 16px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--primary-soft); display: grid; gap: 8px; }
.confirm-panel h2 { font-size: 17px; display: flex; align-items: center; gap: 8px; color: var(--primary); }
.verify-result.warn:where(:not(.safeplan *)){ background: var(--warn-soft); border: 2px solid var(--warn); }
.verify-result .kv { text-align: start; }
.tool-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); gap: 10px; }
.tool-tile { display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 12px; align-items: center; padding: 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); color: var(--ink); text-align: start; cursor: pointer; font: inherit; }
.tool-tile:hover { border-color: var(--primary); text-decoration: none; background: var(--surface-2); }
.tool-tile strong { display: block; font-size: 15px; }
.tool-tile small { display: block; color: var(--muted); font-size: 13px; line-height: 1.4; margin-top: 2px; }
/* lists never push past their card */
.list { grid-template-columns: minmax(0, 1fr); }
.list-item .grow, .list-item > span:first-child { min-width: 0; }
.list-item > .pill, .list-item > svg { flex: none; }
/* phones: tab strips and steppers wrap instead of scrolling sideways */
@media (max-width: 860px) {
  .tabs { flex-wrap: wrap; overflow: visible; gap: 0 2px; }
  .tab { padding: 8px 10px; font-size: 13.5px; }
}

/* ---------- crowd & venue capacity ---------- */
.cc-grid { grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr)); }
.info-hint { position: relative; display: inline-grid; place-items: center; width: 16px; height: 16px; margin-inline-start: 6px; border-radius: 50%; border: 1px solid var(--line-strong); background: var(--surface); color: var(--muted); font: 700 10px/1 system-ui, sans-serif; cursor: help; vertical-align: 1px; padding: 0; }
.info-hint:hover, .info-hint:focus { color: var(--primary); border-color: var(--primary); outline: none; }
.info-hint:hover::after, .info-hint:focus::after { content: attr(data-tip); position: absolute; z-index: 30; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%); width: min(260px, 70vw); padding: 8px 10px; border-radius: 8px; background: #2b2f36; color: #fff; font: 500 12px/1.4 system-ui, sans-serif; text-align: start; white-space: normal; box-shadow: var(--shadow-lg); }
.rgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 190px), 1fr)); gap: 10px; }
.rcard { display: grid; gap: 4px; align-content: start; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); border-inline-start: 3px solid var(--line-strong); min-width: 0; }
.rcard-label { font-size: 12px; font-weight: 600; color: var(--muted); line-height: 1.35; }
.rcard-value { font-size: 19px; font-weight: 750; line-height: 1.25; overflow-wrap: anywhere; }
.rcard-accent { border-inline-start-color: var(--primary); }
.rcard-ok { border-inline-start-color: var(--ok); background: var(--ok-soft); } .rcard-ok .rcard-value { color: var(--ok); }
.rcard-warn { border-inline-start-color: var(--warn); background: var(--warn-soft); } .rcard-warn .rcard-value { color: var(--warn); }
.rcard-danger { border-inline-start-color: var(--danger); background: var(--danger-soft); } .rcard-danger .rcard-value { color: var(--danger); }
.cc-rec .rcard:first-child .rcard-value { font-size: 26px; }
.cc-empty { padding: 14px; border: 1px dashed var(--line-strong); border-radius: var(--radius-sm); color: var(--muted); font-size: 13.5px; background: var(--surface-2); }
.cc-gap { margin-top: 12px; }
.cc-h3 { font-size: 14px; margin: 16px 0 10px; }
.cc-eyebrow, .eyebrow:where(:not(.safeplan *)){ font-size: 11.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 0 0 6px; }
.calc-note { margin-top: 12px; padding: 12px 14px; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--line); font-size: 13.5px; color: var(--ink-2); }
.calc-note h3 { font-size: 14px; margin: 0 0 6px; color: var(--ink); }
.calc-note ul { margin: 0; padding-inline-start: 18px; display: grid; gap: 4px; }
.calc-note-footer { margin: 8px 0 0; font-size: 12.5px; color: var(--muted); }
.cc-section { margin-top: 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.cc-section > summary { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 16px; cursor: pointer; list-style: none; }
.cc-section > summary::-webkit-details-marker { display: none; }
.cc-section > summary::before { content: '▸'; color: var(--muted); font-size: 12px; transition: transform .15s; }
.cc-section[open] > summary::before { transform: rotate(90deg); }
.cc-sec-title { flex: 1; display: grid; font-weight: 700; font-size: 15px; }
.cc-sec-title small { font-weight: 500; font-size: 12.5px; color: var(--muted); }
.cc-status { font-size: 11.5px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--surface-3); color: var(--muted); white-space: nowrap; }
.cc-status:empty { display: none; }
.cc-status.on:where(:not(.safeplan *)){ background: var(--ok-soft); color: var(--ok); }
.cc-sec-body { padding: 0 16px 16px; }
.cc-plain { box-shadow: none; margin: 0 0 14px; }
.cc-table td, .cc-table th { padding: 8px 10px; font-size: 13.5px; }
.evac-ok { color: var(--ok); font-weight: 650; } .evac-warn { color: var(--warn); font-weight: 650; } .evac-bad { color: var(--danger); font-weight: 650; }
.cc-cheat { margin-top: 12px; font-size: 13.5px; }
.cc-cheat summary { cursor: pointer; color: var(--primary); font-weight: 600; }
.cheat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 170px), 1fr)); gap: 8px; margin-top: 8px; }
.cheat-grid article { display: grid; gap: 2px; padding: 10px; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.cheat-grid small { color: var(--muted); }
/* zones */
.zone-head, .zone-row { display: grid; grid-template-columns: minmax(120px, 1.3fr) minmax(150px, 1.6fr) repeat(3, minmax(80px, .8fr)) minmax(80px, .8fr) minmax(130px, 1.2fr) 36px; gap: 8px; align-items: center; }
.zone-head { padding: 0 2px 6px; font-size: 11.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; border-bottom: 1px solid var(--line); }
.zone-row { padding: 8px 2px; }
.zone-block { border-bottom: 1px solid var(--line); }
.zone-row-summary { background: var(--primary-soft); border-radius: var(--radius-sm); padding: 10px 8px; margin: 8px 0; }
.zone-cell { min-width: 0; font-size: 13.5px; }
.zone-cell input, .zone-cell select { min-height: 36px; padding: 6px 8px; font-size: 13.5px; }
.zone-name small, .zone-cap small { display: block; color: var(--muted); font-size: 11.5px; font-weight: 500; }
.zone-cap { font-weight: 750; }
.zone-mlabel { display: none; }
.zone-lock { font-size: 11px; font-weight: 700; color: var(--primary); text-align: center; }
.zone-constraints { margin: 0 0 10px; font-size: 13px; }
.zone-constraints summary { cursor: pointer; color: var(--primary); font-weight: 600; padding: 2px 0 6px; }
.constraint-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); gap: 10px; }
.constraint-group { padding: 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2); }
.constraint-group h4 { margin: 0; font-size: 13.5px; }
.constraint-group p { margin: 2px 0 8px; font-size: 12px; color: var(--muted); }
.constraint-fields { display: grid; gap: 8px; }
.constraint-field { display: grid; gap: 4px; font-size: 12px; font-weight: 600; color: var(--ink-2); }
.constraint-field input, .constraint-field select { min-height: 34px; padding: 5px 8px; font-size: 13px; }
@media (max-width: 1100px) {
  .zone-head { display: none; }
  .zone-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .zone-row .zone-name { grid-column: 1 / -1; }
  .zone-mlabel { display: block; font-size: 11.5px; font-weight: 650; color: var(--muted); margin-bottom: 3px; }
  .zone-cell[data-label]::before { content: attr(data-label); display: block; font-size: 11.5px; font-weight: 650; color: var(--muted); margin-bottom: 3px; }
  .zone-remove, .zone-lock { grid-column: 1 / -1; justify-self: end; }
}
/* visual */
.visual-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); gap: 14px; }
.visual-stage { position: relative; aspect-ratio: 1; min-height: 240px; border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; background: var(--surface-2); }
.visual-stage canvas { display: block; width: 100% !important; height: 100% !important; }
/* calculations & report */
.calc-layout { display: grid; grid-template-columns: minmax(180px, 230px) minmax(0, 1fr); gap: 16px; margin-top: 16px; align-items: start; }
.calc-index { position: sticky; top: 80px; display: grid; gap: 6px; }
.calc-index h3 { font-size: 13px; margin: 0 0 4px; }
.calc-index button { display: grid; grid-template-columns: 22px 1fr; gap: 0 8px; text-align: start; padding: 8px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); cursor: pointer; font: inherit; }
.calc-index button span { grid-row: span 2; width: 22px; height: 22px; display: grid; place-items: center; border-radius: 50%; background: var(--primary-soft); color: var(--primary); font-size: 11.5px; font-weight: 700; }
.calc-index button strong { font-size: 13px; } .calc-index button small { font-size: 12px; color: var(--muted); }
.calc-section { padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); scroll-margin-top: 80px; }
.calc-section header { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; flex-wrap: wrap; }
.calc-section h3 { margin: 0; font-size: 16px; }
.calc-section ol { margin: 10px 0 0; padding-inline-start: 20px; display: grid; gap: 6px; font-size: 14px; color: var(--ink-2); }
.calc-chip { padding: 4px 10px; border-radius: 999px; background: var(--primary-soft); color: var(--primary); font-size: 13px; white-space: nowrap; }
.mreport { display: grid; gap: 14px; }
.mreport-hero { padding: 16px 18px; border-radius: var(--radius); background: var(--primary-soft); border: 1px solid var(--line-strong); }
.mreport-hero h2 { margin: 0 0 6px; font-size: 20px; }
.mreport-hero p { margin: 0; color: var(--ink-2); }
.mreport-section h3 { font-size: 15px; margin: 0 0 6px; }
.mreport-section ul { margin: 0; padding-inline-start: 20px; display: grid; gap: 5px; font-size: 14px; color: var(--ink-2); }
@media (max-width: 860px) { .calc-layout { grid-template-columns: 1fr; } .calc-index { position: static; } }
@media print { .cc-section { box-shadow: none; } .cc-section:not([open]) { display: none; } }
.cc-table { width: 100%; }
@media (max-width: 860px) { .cc-table { table-layout: fixed; } .cc-table td, .cc-table th { padding: 6px 5px; font-size: 12px; overflow-wrap: anywhere; } }


/* ---------- form engine v2 (notes 10–13): widths, chips, yes/detail, signatures, steps ---------- */
/* Safari ignores the height of native dropdowns: draw our own so selects line up with text boxes */
:where(select:not([multiple])) { -webkit-appearance: none; appearance: none; padding-inline-end: 34px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236f7277' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; }
.form-grid.fg12:where(:not(.safeplan *)){ grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 12px 14px; }
.fg12 > * { grid-column: span 6; }
.fg12 > .field-full, .fg12 > .field-yesno { grid-column: 1 / -1; }
.fg12 > .field-third { grid-column: span 4; }
.fg12 > .field-quarter { grid-column: span 3; }
.fg12 > .field-twothird { grid-column: span 8; }
.fg12 > .field-pair { grid-column: span 6; }
.form-section-head { margin-bottom: 12px; }
.field-label .opt { font-weight: 500; color: var(--muted); font-size: 12px; }
.field-label .req { color: var(--danger); }

/* one-tap choices */
.pick { display: flex; flex-wrap: wrap; gap: 6px; }
.pick-opt { position: relative; }
.pick-opt input { position: absolute; opacity: 0; inset: 0; cursor: pointer; margin: 0; }
.pick-opt span { display: inline-flex; align-items: center; min-height: 40px; padding: 0 14px; border: 1px solid var(--line-strong); border-radius: 999px; background: var(--surface); font-weight: 600; font-size: 14px; cursor: pointer; }
.pick-sm .pick-opt span { min-height: 34px; padding: 0 14px; font-size: 13.5px; }
.pick-opt input:checked + span { background: var(--primary); border-color: var(--primary); color: #fff; }
.pick-opt[data-tone=danger] input:checked + span { background: var(--danger); border-color: var(--danger); }
.pick-opt[data-tone=warn] input:checked + span { background: #c27803; border-color: #c27803; }
.pick-opt[data-tone=ok] input:checked + span { background: var(--ok); border-color: var(--ok); }
.pick-opt[data-tone=info] input:checked + span { background: var(--primary); border-color: var(--primary); }
.pick-opt input:focus-visible + span { outline: 3px solid var(--focus); }
.quick { display: flex; flex-wrap: wrap; gap: 6px; }
.quick-chip { min-height: 32px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: 999px; background: var(--surface); font: inherit; font-size: 13px; font-weight: 600; color: var(--ink-2); cursor: pointer; }
.quick-chip:hover { border-color: var(--primary); color: var(--primary); }
.quick-chip.on:where(:not(.safeplan *)){ background: var(--primary-soft); border-color: var(--primary); color: var(--primary); }
.field-yd { gap: 8px; padding: 8px 0; border-bottom: 1px dashed var(--line); }
.yd-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.yd-head .field-label { flex: 1 1 240px; font-weight: 550; }
.check-grid.compact { grid-template-columns: repeat(auto-fill, minmax(min(100%, 175px), 1fr)); gap: 6px; }
.check-grid.compact .check { padding: 7px 10px; font-size: 13.5px; }
.check-group + .check-group { margin-top: 10px; }
.check-group-label { display: block; font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); margin-top: 4px; }
fieldset.field legend:where(:not(.safeplan *)){ display: flex; flex-wrap: wrap; align-items: center; gap: 8px; width: 100%; }
.usual-btn { min-height: 28px; font-size: 12.5px; margin-inline-start: auto; }

/* collapsible "More details" */
.form-more { padding: 0; }
.form-more > summary { list-style: none; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 18px; cursor: pointer; }
.form-more > summary::-webkit-details-marker { display: none; }
.form-more > summary span { display: grid; gap: 2px; }
.form-more > summary small { color: var(--muted); font-size: 12.5px; font-weight: 400; }
.form-more > summary svg { transition: transform .15s; color: var(--muted); }
.form-more[open] > summary svg { transform: rotate(180deg); }
.form-more > .form-grid:where(:not(.safeplan *)){ padding: 0 18px 18px; }

/* named signatures */
.sign-block { padding: 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-2); }
.sign-head { display: grid; gap: 2px; margin-bottom: 8px; }
.sign-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: 12px; align-items: start; }
.sign-grid .sig-pad canvas { height: 130px; }
.sign-time { color: var(--muted); font-size: 12px; margin-top: 4px; }
.sign-card { display: flex; align-items: center; gap: 12px; min-width: 0; }
.sign-card img { height: 56px; max-width: 160px; object-fit: contain; border-bottom: 1px solid #c9ccd1; background: #fff; }
.sign-card span { display: grid; gap: 1px; min-width: 0; }
.sign-card small { color: var(--muted); font-size: 12px; }

/* steps used by long forms (permits) */
.form-steps li.reachable { cursor: pointer; }
.form-actions [hidden] { display: none !important; }
.form-actions .spacer:where(:not(.safeplan *)){ flex: 1; }
.draft-banner { margin-bottom: 12px; }

/* table rows become stacked cards on phones */
@media (max-width: 860px) {
  .fg12 > *, .fg12 > .field-third, .fg12 > .field-twothird { grid-column: 1 / -1; }
  .fg12 > .field-quarter, .fg12 > .field-pair { grid-column: span 6; }
  .sign-grid { grid-template-columns: 1fr; }
  .rows-head { display: none; }
  .rows-table { overflow: visible; }
  .rows-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 38px; padding: 10px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2); }
  .rows-row > :first-child { grid-column: 1 / 3; }
  .rows-row > [data-row-remove] { grid-column: 3; grid-row: 1; }
  .form-section { padding: 14px; }
  .form-more > summary { padding: 12px 14px; }
  .form-more > .form-grid:where(:not(.safeplan *)){ padding: 0 14px 14px; }
  .form-actions { margin-inline: -12px; padding: 10px 12px; background: var(--surface); border-top: 1px solid var(--line); box-shadow: 0 -4px 14px rgba(20, 20, 22, .06); }
  .form-actions .btn { flex: 1 1 auto; }
}

/* ---------- document view: the neutral, PDF-style printed report ---------- */
.doc-layout { align-items: start; }
.doc { background: #fff; border: 1px solid var(--line); border-radius: 6px; box-shadow: var(--shadow); color: #3a3d42; font-family: Verdana, "DejaVu Sans", Geneva, sans-serif; font-size: 13.5px; overflow: hidden; }
.doc-frame { width: 100%; border-collapse: collapse; }
.doc-frame > * > tr > td { padding: 0 34px; }
.doc-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; min-height: 64px; padding: 24px 0 12px; border-bottom: 1px solid #e4e4e1; }
.doc-head img { max-height: 54px; max-width: 170px; object-fit: contain; }
.doc-org { font-size: 11px; font-weight: 700; letter-spacing: .28em; text-transform: uppercase; color: #7a7d82; text-align: end; }
.doc-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 26px 0 0; padding: 18px 16px; background: #f6f6f4; border-top: 1px solid #e6e6e3; border-bottom: 1px solid #e6e6e3; }
.doc-title h2 { margin: 0; font-size: 18px; letter-spacing: .08em; color: #2b2f36; }
.doc-title p { margin: 4px 0 0; font-size: 12px; color: #7a7d82; letter-spacing: .02em; }
.doc-tag { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border: 1px solid #d5d6d8; border-radius: 999px; font-size: 11.5px; font-weight: 700; color: #4b4f56; background: #fff; white-space: nowrap; }
.doc-tag i { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.doc-section { margin-top: 22px; break-inside: auto; }
.doc-bar { margin: 0; padding: 9px 16px; background: #f6f6f4; border-top: 1px solid #e6e6e3; border-bottom: 1px solid #e6e6e3; font-size: 13.5px; font-weight: 700; letter-spacing: .1em; color: #2b2f36; break-after: avoid; }
.doc-rows { display: grid; }
.doc-row { display: grid; grid-template-columns: minmax(150px, 35%) minmax(0, 1fr); gap: 4px 18px; padding: 11px 16px; border-bottom: 1px solid #ececea; break-inside: avoid; }
.doc-row-pair { grid-template-columns: minmax(150px, 35%) minmax(0, 1fr) minmax(0, 1fr); }
.doc-l { font-weight: 700; color: #3a3d42; }
.doc-v { font-weight: 600; color: #3a3d42; overflow-wrap: anywhere; }
.doc-v2 { font-weight: 600; } .doc-v2 b { font-weight: 700; margin-inline-end: 6px; }
.doc-narrative { padding: 14px 16px 16px; background: #f6f6f4; border-bottom: 1px solid #e6e6e3; font-family: Georgia, "Times New Roman", serif; font-size: 15px; line-height: 1.5; color: #1f2226; }
.doc-narrative + .doc-narrative { border-top: 1px solid #fff; }
.doc-narrative-title { display: block; margin-bottom: 8px; font-family: Georgia, "Times New Roman", serif; font-weight: 700; letter-spacing: .08em; color: #2b2f36; font-size: 14px; }
.doc-photos { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: 10px; }
.doc-photos figure { margin: 0; aspect-ratio: 3 / 4; overflow: hidden; background: #eee; break-inside: avoid; }
.doc-photos img { width: 100%; height: 100%; object-fit: cover; display: block; }
.doc-block { display: grid; gap: 8px; padding: 12px 16px; border-bottom: 1px solid #ececea; }
.doc-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.doc-table th { text-align: start; padding: 6px 8px; background: #fafaf9; border-bottom: 1px solid #e4e4e1; font-weight: 700; }
.doc-table td { padding: 6px 8px; border-bottom: 1px solid #f0f0ee; vertical-align: top; }
.doc-signs { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 0; border-bottom: 1px solid #ececea; }
.doc-sign { display: grid; gap: 8px; padding: 12px 16px; border-bottom: 1px solid #ececea; break-inside: avoid; }
.doc-sign-role { font-size: 11.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: #6b6f75; }
.doc-foot { display: flex; justify-content: space-between; gap: 12px; margin-top: 28px; padding: 12px 0 20px; border-top: 1px solid #e4e4e1; font-size: 11.5px; color: #7a7d82; }
@media (max-width: 860px) {
  .doc-frame > * > tr > td { padding: 0 14px; }
  .doc-row, .doc-row-pair { grid-template-columns: 1fr; padding: 10px 12px; }
  .doc-l { font-size: 12px; color: #6b6f75; }
  .doc-bar, .doc-narrative, .doc-block, .doc-sign { padding-inline: 12px; }
  .doc-title { padding: 14px 12px; }
  .doc-title h2 { font-size: 16px; }
  .doc-photos { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@page { @bottom-right { content: counter(page) " / " counter(pages); font: 9pt Verdana, sans-serif; color: #7a7d82; } }
@media print {
  .view:has(.doc) .page-head, .view:has(.doc) .banner, .view:has(.doc) .print-head { display: none !important; }
  .doc-layout { display: block !important; }
  .doc { border: 0; box-shadow: none; border-radius: 0; font-size: 10.5pt; }
  .doc-frame > * > tr > td { padding: 0; }
  .doc-head { padding-top: 0; }
  .doc-photos figure { aspect-ratio: 3 / 4; }
  .doc-narrative, .doc-title, .doc-bar { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* ---------- audit sheet (note 11) ---------- */
.audit-sheet { display: grid; gap: 14px; }
.audit-sheet .form-section + .form-section { margin-top: 0; }
.sheet-bar { position: sticky; top: 58px; z-index: 6; }
.sheet-bar-in { display: flex; align-items: center; gap: 14px; padding: 10px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.sheet-score { display: grid; justify-items: center; min-width: 74px; padding: 4px 10px; border-radius: 10px; background: var(--surface-2); }
.sheet-score strong { font-size: 22px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.sheet-score small { font-size: 11px; color: var(--muted); white-space: nowrap; }
.sheet-score.tone-ok strong { color: var(--ok); } .sheet-score.tone-warn strong { color: #b26a00; } .sheet-score.tone-danger strong { color: var(--danger); }
.sheet-progress { flex: 1; min-width: 0; display: grid; gap: 6px; }
.sheet-progress-top { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; font-weight: 600; color: var(--ink-2); flex-wrap: wrap; }
.audit-notes { margin: 0; padding: 0 18px 16px 36px; display: grid; gap: 6px; font-size: 13.5px; color: var(--ink-2); }
.score-meaning { display: block; margin-top: 3px; font-size: 12.5px; color: var(--muted); }
.score-resp span { min-width: 44px; justify-content: center; }
.resp input:checked + span.s-100 { background: #1f8a4c; color: #fff; }
.resp input:checked + span.s-75 { background: #6aa84f; color: #fff; }
.resp input:checked + span.s-50 { background: #d29a00; color: #fff; }
.resp input:checked + span.s-25 { background: #e06d1f; color: #fff; }
.resp input:checked + span.s-0 { background: var(--danger); color: #fff; }
.resp input:checked + span.s-na { background: var(--na); color: #fff; }
.audit-row[data-score="100"], .audit-row[data-score="YES"] { border-inline-start-color: #1f8a4c; }
.audit-row[data-score="75"] { border-inline-start-color: #6aa84f; }
.audit-row[data-score="50"] { border-inline-start-color: #d29a00; }
.audit-row[data-score="25"] { border-inline-start-color: #e06d1f; background: #fffaf6; }
.audit-row[data-score="0"], .audit-row[data-score="NO"] { border-inline-start-color: var(--danger); background: #fffafa; }
.audit-row[data-score="NA"] { border-inline-start-color: #b4b6b9; }
.audit-row .chk-plan { padding: 10px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: #fff; }
.chk-row.flash { animation: flash 1.4s ease; }
@keyframes flash { 0%, 60% { background: #fff4c2; } 100% { background: transparent; } }
@media (max-width: 860px) {
  .sheet-bar { top: 104px; }
  .sheet-bar-in { gap: 10px; padding: 8px 10px; }
  .sheet-bar-in .btn { display: none; }
  .audit-row .chk-answer { min-width: 0; }
  .score-resp { flex: 1 1 0; min-width: 0; display: flex; }
  .score-resp label { flex: 1 1 0; min-width: 0; }
  .score-resp span { width: 100%; min-width: 0; padding: 0 2px; font-size: 12.5px; }
}
@media print { .sheet-bar { display: none; } }

/* ---------- permits (note 13) ---------- */
.permit-form { display: grid; gap: 14px; }
.permit-form [data-pane] { display: grid; gap: 14px; }
.permit-form [data-pane][hidden] { display: none; }
.permit-form .form-section + .form-section { margin-top: 0; }
.permit-form .form-section { border-top: 3px solid var(--ptw, var(--line)); }
.form-steps { margin-bottom: 12px; }
.review-grid .kv { margin: 0; }
.commit-list { margin: 0 0 12px; padding-inline-start: 18px; display: grid; gap: 4px; font-size: 13.5px; color: var(--ink-2); }
.stage-form .form-section { box-shadow: var(--shadow); }
.stage-form .form-actions { position: static; background: none; padding: 10px 0 0; margin: 0 !important; box-shadow: none; border: 0; }
.stage-more { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.stage-more > summary { display: flex; align-items: center; gap: 8px; padding: 14px 16px; cursor: pointer; font-weight: 650; }
.stage-more > .stage-form { padding: 0 2px 2px; }
.stage-more .form-section { border: 0; box-shadow: none; }
.doc-sub { margin: 14px 16px 0; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: #6b6f75; }
.doc-sign .sign-card { flex-direction: column; align-items: flex-start; gap: 6px; }
.doc-sign .sign-card img { height: 52px; max-width: 200px; }
.doc-sign .sign-card span { grid-auto-flow: row; }

/* ---------- note 14: one pattern everywhere — neutral, compact ---------- */
/* menu group labels (flat menu, no sub-menus) */
.nav-group { margin: 10px 10px 2px; font-size: 10.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: #9a9c9f; }
.nav-group:first-of-type { margin-top: 6px; }
.sidebar:where(:not(.safeplan *)){ gap: 10px; padding: 14px 10px; }
.event-switch { padding: 8px 10px; }
.nav-link .icon { width: 17px; height: 17px; color: var(--muted); }
.nav-link.active .icon:where(:not(.safeplan *)){ color: var(--ink); }
.nav-count { background: var(--danger); }
.btn-primary:hover { background: var(--primary-hover); }
.tab.active:where(:not(.safeplan *)){ color: var(--ink); border-bottom-color: var(--ink); }
a.stat:hover, .stat-btn:hover { border-color: var(--line-strong); background: var(--hover); }
.picker-icon.keep-tone { box-shadow: inset 4px 0 0 var(--tone); }
.fcount { background: var(--ink); }
.fchip { border-color: var(--line-strong); background: var(--surface-3); color: var(--ink); }
.quick-chip:hover { border-color: var(--ink-2); color: var(--ink); }
.quick-chip.on:where(:not(.safeplan *)){ background: var(--primary); border-color: var(--primary); color: #fff; }
.check:has(input:checked) { border-color: var(--ink-2); background: var(--surface-3); }
.check input { accent-color: var(--primary); }
.type-card:hover, .type-card.selected, .lang-card:hover, .lang-card.selected, .choice.selected { border-color: var(--ink-2); background: var(--surface-3); }
.choice.selected { box-shadow: 0 0 0 1px var(--ink-2) inset; }
.rule strong, .plant-eyebrow, .zone-lock { color: var(--ink-2); }
.exit-tag, .calc-index button span, .calc-chip, .zone-row-summary, .mreport-hero { background: var(--surface-3); color: var(--ink); }
.mreport-hero, .confirm-panel { border-color: var(--line); }
.confirm-panel { background: var(--surface-2); }
.confirm-panel h2 { color: var(--ink); }
.plant-action-icon { color: var(--ink-2); }
.plant-attention-item:hover, .plant-quick-actions > a:hover { color: var(--ink); background: var(--hover); }
.chk-note-btn.has-note { color: var(--ink); background: var(--surface-3); }
.steps li.current:where(:not(.safeplan *)){ border-top-color: var(--ink); color: var(--ink); }
.pass-photo { border-color: var(--surface-3); }
.notif-list li.unread a { border-color: var(--line-strong); background: var(--surface-2); }
.hbars-more summary, .rule-help summary, .cc-cheat summary, .zone-constraints summary { color: var(--ink-2); text-decoration: underline; text-underline-offset: 2px; }
.info-hint:hover, .info-hint:focus { color: var(--ink); border-color: var(--ink-2); }
.info-note { background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line); }
.banner-info { background: var(--surface-2); border-color: var(--line); color: var(--ink-2); }
.progress i { background: var(--ink-2); }
.pill-info { background: var(--info-soft); color: var(--info); }
.rcard-accent { border-inline-start-color: var(--ink-2); }
.card-head a, .link { color: var(--ink-2); font-weight: 600; text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 3px; }
.card-head a.btn { text-decoration: none; }
p a:where(:not(.safeplan *)), .pre a, .field-hint a, .muted a { text-decoration: underline; text-underline-offset: 2px; }

td.c-phone { display: none; }
/* stat strip: always one row; on phones it scrolls sideways instead of wrapping */
.stats { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); grid-template-columns: none; gap: 0; margin-bottom: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.stats > .stat { border: 0; border-inline-start: 1px solid var(--line); border-radius: 0; box-shadow: none; padding: 9px 14px 10px; gap: 0; align-content: start; background: transparent; font: inherit; text-align: start; color: var(--ink); }
.stats > .stat:first-child { border-inline-start: 0; }
.stat-label { font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-value { font-size: 20px; line-height: 1.25; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat-note { font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-btn { cursor: pointer; }
.stat-btn.on:where(:not(.safeplan *)){ background: var(--surface-3) !important; box-shadow: inset 0 -2px 0 var(--ink) !important; }
.stats-loose { background: transparent; border: 0; box-shadow: none; gap: 10px; overflow: visible; }
.stats-loose > .stat { border: 1px solid var(--line) !important; border-radius: var(--radius); background: var(--surface); }

/* filter bar: search + two dropdowns on the row, the rest behind "More filters" */
.filters-row { flex-wrap: nowrap; }
.filters-fields { flex-wrap: nowrap; min-width: 0; }
.filters-fields .fmore { display: none; }
.filters.open .filters-fields:where(:not(.safeplan *)){ flex-wrap: wrap; }
.filters.open .filters-fields .fmore:where(:not(.safeplan *)){ display: inline-flex; }
.filters.has-more.open .filters-row:where(:not(.safeplan *)){ flex-wrap: wrap; }
.filters-toggle { display: none; white-space: nowrap; }
.filters.has-more .filters-toggle { display: inline-flex; }
.ft-phone { display: none; }
.fsearch { flex: 1 1 220px; max-width: 360px; }
.fsel select, .fsel input { max-width: 180px; }

/* page header: one main button + up to two others; nothing destructive up here */
.page-actions .btn { min-height: 36px; }
.section-gap { margin-top: 14px; }

/* empty state with its next step */
.empty { padding: 28px 20px; }
.empty h3 { font-size: 16px; }
.empty p { max-width: 420px; font-size: 13.5px; }
.empty .btn { margin-top: 6px; }

/* home: quick action tiles of equal size */
.quick-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.quick-tiles a { display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 8px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); color: var(--ink); font-weight: 600; font-size: 13.5px; line-height: 1.25; }
.quick-tiles a:hover { border-color: var(--line-strong); background: var(--hover); text-decoration: none; }
.quick-tiles .mod-icon { width: 30px; height: 30px; border-radius: 8px; }
.attention { display: grid; }
.attention a { display: flex; align-items: center; gap: 10px; padding: 9px 16px; border-bottom: 1px solid var(--line); color: var(--ink); }
.attention a:last-child { border-bottom: 0; }
.attention a:hover { background: var(--hover); text-decoration: none; }
.attention .dot { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--na); }
.attention .dot.danger { background: var(--danger); } .attention .dot.warn:where(:not(.safeplan *)){ background: var(--warn); } .attention .dot.ok:where(:not(.safeplan *)){ background: var(--ok); }
.attention .grow { flex: 1; min-width: 0; }
.attention small { color: var(--muted); }
.list-item strong { white-space: normal; }
.home-greet { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; }

/* record pages: document on the left, respond / close-out panel on the right */
.record-side { display: grid; gap: 14px; align-content: start; }
.record-side .card-body .form-grid:where(:not(.safeplan *)){ grid-template-columns: 1fr; }

/* the checklist's progress stays on screen, like the audit's */
.chk-bar .sheet-progress-top b { font-variant-numeric: tabular-nums; }

/* setup tab tiles (inductions, plant) */
.setup-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); gap: 10px; }

@media (max-width: 860px) {
  .stats { grid-auto-columns: minmax(108px, 1fr); overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  .stats::-webkit-scrollbar { display: none; }
  .stats > .stat { padding: 8px 12px; }
  .stat-value { font-size: 18px; }
  .stats-loose { grid-auto-columns: minmax(140px, 1fr); }
  .filters-row { flex-wrap: wrap; }
  .filters-toggle { display: inline-flex; }
  .ft-phone { display: inline; } .ft-desk { display: none; }
  .filters-fields .fmore { display: inline-flex; }
  .filters.open .filters-fields:where(:not(.safeplan *)){ flex-wrap: nowrap; }
  .page-actions { width: 100%; }
  .page-actions .btn { flex: 1 1 0; min-width: 0; padding: 0 10px; }
  .page-actions .btn-primary { flex: 2 1 0; }
  .quick-tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
  .quick-tiles a { flex-direction: column; justify-content: center; text-align: center; gap: 6px; min-height: 78px; padding: 8px 4px; font-size: 12px; }
  .record-side { position: static; }
  .nav-link { padding: 9px 10px; }
  /* phone lists: two-line cards instead of six-line label/value blocks */
  .table.table-cards:not(.table-keep) tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 10px; padding: 10px 14px; border-inline-start: 3px solid transparent; }
  .table.table-cards:not(.table-keep) td { display: block; padding: 0; font-size: 13px; color: var(--muted); }
  .table.table-cards:not(.table-keep) td::before { content: none; }
  .table.table-cards td.c-title { grid-column: 1; grid-row: 1; color: var(--ink); font-size: 14px; }
  .table.table-cards td.c-status { grid-column: 2; grid-row: 1; justify-self: end; }
  .table.table-cards td.c-phone { grid-column: 1 / -1; }
  .table.table-cards td.c-hide { display: none !important; }
  .table.table-cards tr.edge-danger { border-inline-start-color: var(--danger); }
  .table.table-cards tr.edge-warn { border-inline-start-color: var(--warn); }
  .table.table-cards tr.edge-info { border-inline-start-color: var(--info); }
  .meta-line .sep { color: #b4b6b9; }
  .meta-line .pill { padding: 0 7px; font-size: 11.5px; }
  .meta-line .cell-sub { display: inline; }
  .table.table-cards .cell-sub { font-size: 12.5px; }
  .meta-line { display: flex; flex-wrap: wrap; gap: 0 6px; grid-column: 1 / -1; }
}
@media print { .stats { break-inside: avoid; } .stat-btn.on:where(:not(.safeplan *)){ box-shadow: none !important; } }
.home-top { display: flex; flex-direction: column; gap: 0; }
.home-top .stats { margin-bottom: 10px; }
.card-flush > .card-body { padding: 0; }
.card-flush > .card-body > .empty { padding: 24px 16px; }
@media (max-width: 860px) { .home-quick { order: -1; margin-bottom: 10px; } }
/* checklist record in the document layout */
.doc-q { grid-template-columns: minmax(0, 1fr) auto; align-items: start; }
.doc-q.is-issue { background: #fdf6f6; }
.doc-n { font-weight: 700; color: #6b6f75; margin-inline-end: 4px; }
.doc-note { display: block; margin-top: 3px; font-size: 12px; font-weight: 500; color: #6b6f75; }
.doc-ans .pill { font-family: var(--font); }
.doc-list { margin: 6px 0 0; padding-inline-start: 18px; font-size: 13px; }
.delete-btn { margin-top: 2px; }
.chk-bar { margin: 12px 0; }
@media (max-width: 860px) { .doc-q { grid-template-columns: minmax(0, 1fr) auto; } }
.phone-only-label { display: none; }
@media (max-width: 860px) { .phone-only-label { display: inline; } .desk-only { display: none; } }
/* crowd inputs: grouped, units inside the box, help under the box while it has focus */
.cc-inputs .cc-group { margin: 14px 0 8px; font-size: 11.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.cc-inputs .cc-group:first-of-type { margin-top: 4px; }
.cc-inputs .cc-grid { grid-template-columns: repeat(auto-fill, minmax(min(100%, 195px), 1fr)); }
.cc-field .field-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cc-help { display: none; }
.cc-field:focus-within .cc-help { display: block; }
.input-unit input { min-height: 38px; }
.input-unit span { border-inline-start: 1px solid var(--line); align-self: stretch; display: inline-flex; align-items: center; background: var(--surface-2); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.cc-inputs .segmented span { min-height: 34px; font-size: 13px; }
.seg-switch { display: inline-flex; padding: 3px; border-radius: 9px; background: var(--surface-3); gap: 2px; }
.seg-switch a { padding: 5px 12px; border-radius: 7px; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.seg-switch a.on:where(:not(.safeplan *)){ background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.seg-switch a:hover { text-decoration: none; }
/* "More filters" open: search and the toggle stay on the first line, every filter below */
.filters.open .filters-toggle:where(:not(.safeplan *)){ order: 2; }
.filters.open .filters-fields:where(:not(.safeplan *)){ order: 3; flex-basis: 100%; }
@media (max-width: 860px) { .stats > .stat .stat-label { white-space: normal; line-height: 1.25; } }
@media (max-width: 860px) {
  /* three header buttons: the main one gets its own line, the other two share the next */
  .page-actions:has(> .btn:nth-of-type(3)) .btn-primary { flex-basis: 100%; }
  .page-actions .btn { overflow: hidden; text-overflow: ellipsis; }
}

/* ======================================================================
   REDESIGN (1 Dec 2026) — concrete, graphite, DIN, safety-sign status marks.
   One bold element: the graphite site board on the left, with the open page
   shown as a tab cut into the work area. Everything else stays quiet: flat
   white sheets on concrete, thin lines, no shadows, no all-caps labels.
   ====================================================================== */
body { background: var(--bg); color: var(--ink); }
.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; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

/* --- type: DIN for headings, numbers, tabs and buttons --- */
h1:where(:not(.safeplan *)), h2:where(:not(.safeplan *)), h3:where(:not(.safeplan *)), .page-title h1, .page-h1, .card-head h2, .form-section-head h3, .chk-sec-head h3, .dialog-head h2,
.stat-value, .tab, .btn, .picker-body strong, .quick-tiles a, .sheet-score strong, .rcard-value, .big-number,
.auth-card h1, .tool-tile strong, .choice strong, .cc-sec-title, .calc-section h3, .done-head h1, .verify-result h2, .kiosk-hero h1 {
  font-family: var(--font-display); font-weight: 700; letter-spacing: 0;
}
.page-title h1, .page-h1 { font-size: 30px; line-height: 1.1; }
.page-title p { font-size: 13.5px; color: var(--muted); margin-top: 4px; }
.page-head { margin-bottom: 16px; align-items: flex-end; }
.card-head h2 { font-size: 16px; }
.form-section-head h3, .chk-sec-head h3 { font-size: 16px; }
.dialog-head h2 { font-size: 19px; }
.back-link { font-weight: 600; color: var(--ink-2); }

/* --- the site board (sidebar) --- */
.sidebar:where(:not(.safeplan *)){ background: var(--board); color: var(--board-ink); border: 0; padding: 14px 0 12px 12px; gap: 6px; }
.sidebar:where(:not(.safeplan *))::-webkit-scrollbar{ width: 0; }
.brand { color: var(--board-muted); gap: 8px; padding: 2px 6px; font-size: 13px; font-weight: 600; }
.brand:hover { color: #fff; }
.site-board { margin: 6px 12px 6px 0; padding: 12px 10px 14px 6px; border-bottom: 1px solid rgba(255, 255, 255, .09); }
.board-name { position: relative; display: flex; align-items: flex-start; gap: 6px; cursor: pointer; }
.board-title { flex: 1; min-width: 0; color: #fff; font: 700 23px/1.12 var(--font-display); overflow-wrap: anywhere; }
.board-chev { margin-top: 5px; color: var(--board-muted); }
.board-name:hover .board-chev { color: #fff; }
/* the native chooser sits invisibly over the event name, so the name can wrap */
.board-name select { position: absolute; inset: 0; width: 100%; height: 100%; min-height: 0; opacity: 0; cursor: pointer; }
.board-name:focus-within { outline: 2px solid #fff; outline-offset: 4px; border-radius: 4px; }
.board-name select option { color: var(--ink); }
.board-meta { display: flex; flex-wrap: wrap; gap: 2px 12px; margin-top: 5px; color: var(--board-muted); font-size: 12.5px; }
.board-phase { display: flex; align-items: center; gap: 8px; margin-top: 12px; color: var(--board-muted); font-size: 12px; }
.board-phase b { display: inline-block; padding: 4px 9px 3px; border-radius: 4px; background: #fff; color: var(--board); font: 700 14px/1.1 var(--font-display); }
.nav { gap: 1px; }
.nav-group { margin: 14px 12px 4px 8px; color: #868b8f; font: 600 12px var(--font); letter-spacing: 0; text-transform: none; }
.nav-group:first-of-type { margin-top: 8px; }
.nav-link { position: relative; padding: 7px 12px 7px 10px; border-radius: 8px 0 0 8px; color: #d3d6d4; font-weight: 500; }
.nav-link .icon { color: #8f9498; }
.nav-link:hover { background: var(--board-2); color: #fff; text-decoration: none; }
.nav-link:hover .icon { color: #d3d6d4; }
/* the open page: a tab cut into the work area, with curved joins above and below */
.nav-link.active:where(:not(.safeplan *)){ background: var(--bg); color: var(--ink); font-weight: 650; box-shadow: none; }
.nav-link.active .icon:where(:not(.safeplan *)){ color: var(--ink); }
.nav-link.active:where(:not(.safeplan *))::before, .nav-link.active:where(:not(.safeplan *))::after{ content: ''; position: absolute; right: 0; width: 10px; height: 10px; pointer-events: none; }
.nav-link.active:where(:not(.safeplan *))::before{ top: -10px; background: radial-gradient(circle at 0 0, transparent 9.5px, var(--bg) 10px); }
.nav-link.active:where(:not(.safeplan *))::after{ bottom: -10px; background: radial-gradient(circle at 0 100%, transparent 9.5px, var(--bg) 10px); }
.nav-sep { background: rgba(255, 255, 255, .09); margin: 10px 12px 10px 4px; }
.sidebar-foot { margin-right: 12px; }
.user-chip { background: var(--board-2); border-color: transparent; color: #fff; }
.user-chip small { color: var(--board-muted); }
.user-chip .avatar { background: #fff; color: var(--board); }
.user-chip .icon { color: var(--board-muted); }

/* --- top bar --- */
.topbar:where(:not(.safeplan *)){ background: rgba(236, 237, 234, .94); border-bottom: 1px solid var(--line); padding: 10px 28px; }
.global-search { height: 38px; border-radius: 9px; border-color: var(--line); background: var(--surface); }
.global-search:focus-within { border-color: var(--ink); }
.view { padding: 22px 28px 40px; }

/* --- sheets: flat white on concrete, thin lines, no shadows --- */
.card, .form-section, .stat, .picker-list, .tool-tile, .quick-tiles a, .sheet-bar-in, .cc-section, .stage-more, .doc { box-shadow: none; }
.card { border-color: var(--line); border-radius: var(--radius); }
.card-head { padding: 12px 16px; border-bottom-color: var(--line); }
.form-section { border-color: var(--line); }
.list-item:hover, a.list-item:hover { background: var(--hover); }

/* --- stat strip: a scoreboard row --- */
.stats { border-color: var(--line); border-radius: var(--radius); }
.stats > .stat { padding: 10px 16px 11px; }
.stat-label { color: var(--muted); font-size: 12.5px; font-weight: 550; }
.stat-value { font-size: 26px; line-height: 1.15; margin-top: 2px; font-variant-numeric: tabular-nums; }
.stat-btn.on:where(:not(.safeplan *)){ background: var(--surface-3) !important; box-shadow: inset 0 -3px 0 var(--ink) !important; }

/* --- tabs --- */
.tabs { border-bottom-color: var(--line-strong); gap: 6px; }
.tab { font-size: 15px; padding: 8px 4px 9px; margin-inline-end: 14px; color: var(--muted); border-bottom-width: 3px; }
.tab.active:where(:not(.safeplan *)){ color: var(--ink); border-bottom-color: var(--ink); }
.tab-count { background: transparent; border: 0; font: 700 13px var(--font-display); color: var(--muted); min-width: 0; padding: 0 0 0 2px; }
.tab.active .tab-count:where(:not(.safeplan *)){ color: var(--ink); }

/* --- tables: sentence-case headings, no fills --- */
.table th { text-transform: none; letter-spacing: 0; font: 600 12.5px var(--font); color: var(--muted); background: var(--surface); border-bottom: 1px solid var(--line); padding: 9px 12px; }
.table td { border-bottom-color: var(--line); }
.table tr[data-href]:hover td { background: var(--hover); }
.cell-main { font-weight: 650; }

/* --- status tags with safety-sign shapes: square = OK, triangle = warning,
       crossed circle = danger / stop, filled circle = information --- */
.pill { gap: 6px; padding: 2px 8px 2px 7px; border-radius: 5px; font-size: 12.5px; font-weight: 650; line-height: 1.5; }
.pill::before { content: ''; flex: none; width: 9px; height: 9px; background: currentColor; }
.pill-ok::before { border-radius: 1.5px; }
.pill-warn::before { width: 11px; height: 10px; background: var(--warn-mark); clip-path: polygon(50% 0, 100% 100%, 0 100%); }
.pill-danger::before { width: 10px; height: 10px; box-sizing: border-box; border: 1.7px solid currentColor; border-radius: 50%; background: linear-gradient(135deg, transparent 41%, currentColor 41% 59%, transparent 59%); }
.pill-info::before { border-radius: 50%; }
.pill-muted { background: var(--surface-3); color: var(--ink-2); }
.pill-muted::before { width: 8px; height: 2px; background: var(--na); }
.meta-line .pill::before, .doc .pill::before { width: 8px; height: 8px; }
.tag-critical { text-transform: none; letter-spacing: 0; font-size: 11.5px; border-radius: 4px; }

/* --- buttons --- */
.btn { font-size: 14.5px; border-radius: var(--radius-sm); min-height: 38px; padding: 0 15px; }
.btn-sm { font-size: 13.5px; min-height: 32px; padding: 0 11px; }
.btn-primary { background: var(--primary); }
.btn-secondary { border-color: var(--line-strong); background: var(--surface); }
.btn-secondary:hover { background: var(--hover); border-color: var(--ink-2); }
.btn-ghost { color: var(--ink-2); }
.btn-ghost:hover { background: var(--surface-3); }

/* --- forms --- */
:where(input:not([type=checkbox]):not([type=radio]):not([type=file]), select:where(:not(.safeplan *)), textarea) { border-color: var(--line-strong); border-radius: var(--radius-sm); }
:where(input, select:where(:not(.safeplan *)), textarea):focus { border-color: var(--ink); box-shadow: 0 0 0 3px var(--focus-soft); }
.field-label { color: var(--ink); font-weight: 600; }
.field-label .opt { color: var(--muted); font-weight: 400; }
.pick-opt input:checked + span { background: var(--primary); border-color: var(--primary); }
.resp span { font-family: var(--font-display); font-weight: 700; }
.fsel > span { background: var(--surface-2); }
.fsearch, .fsel { border-color: var(--line-strong); }

/* --- labels that used to shout --- */
.eyebrow:where(:not(.safeplan *)), .cc-eyebrow, .zone-head, .check-group-label, .cc-inputs .cc-group { text-transform: none; letter-spacing: 0; font-size: 12.5px; font-weight: 650; color: var(--ink-2); }
.cc-inputs .cc-group { font: 700 14px var(--font-display); color: var(--ink); margin-top: 18px; }

/* --- home and tiles --- */
.home-date { font-variant-numeric: tabular-nums; }
.quick-tiles a { font-size: 14px; border-color: var(--line); }
.quick-tiles a:hover { border-color: var(--ink-2); background: var(--surface); }
.mod-icon { background: var(--surface-3); color: var(--ink); border-radius: 8px; }
.attention .dot { width: 9px; height: 9px; border-radius: 1.5px; }
.attention .dot.danger { border-radius: 50%; }
.attention .dot.warn:where(:not(.safeplan *)){ width: 11px; height: 10px; border-radius: 0; background: var(--warn-mark); clip-path: polygon(50% 0, 100% 100%, 0 100%); }

/* --- dialogs, toasts, auth --- */
.dialog { border-radius: 14px; }
.dialog-foot { background: var(--surface); }
.toast:where(:not(.safeplan *)){ background: var(--primary); border-radius: 9px; }
.auth { background: var(--board); }
.auth-card { border: 0; border-radius: 16px; }
.auth-card h1 { font-size: 26px; }
.empty-mark { border-radius: 10px; }
.empty h3 { font-size: 18px; }

@media (max-width: 860px) {
  .sidebar:where(:not(.safeplan *)){ padding-inline-end: 0; }
  .topbar:where(:not(.safeplan *)){ padding: 8px 12px; }
  .topbar-event { font: 700 17px var(--font-display); }
  .view { padding: 16px 12px 40px; }
  .page-title h1, .page-h1 { font-size: 25px; }
  .stat-value { font-size: 21px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
/* the printed document keeps its own PDF-style type (Verdana, as the source form) */
.doc h2, .doc h3, .doc .doc-bar { font-family: inherit; }
@media (max-width: 860px) {
  /* in the drawer the menu floats over the page, so the open page is a plain highlight, not a joined tab */
  .sidebar:where(:not(.safeplan *)){ padding-inline-end: 12px; }
  .nav-link { border-radius: 8px; }
  .nav-link.active:where(:not(.safeplan *)){ background: #fff; }
  .nav-link.active:where(:not(.safeplan *))::before, .nav-link.active:where(:not(.safeplan *))::after{ content: none; }
  .site-board, .nav-sep, .sidebar-foot { margin-inline-end: 0; }
}
/* Site plans (SafePlan) fill the work area below the top bar */
.view:has(.safeplan-host) { max-width: none; padding: 0; }
.safeplan-host { height: calc(100vh - 59px); min-height: 520px; }
@media (max-width: 860px) { .safeplan-host { height: calc(100vh - 104px); } }

/* ======================================================================
   NOTE 18 (2 Dec 2026): enterprise layout. No top bar: the event, search,
   notifications and account live in a light side menu that folds to icons.
   Lighter palette with one steel-blue accent, compact page headers, one-line
   count strips, 32 px controls on desktop (40 px on touch screens).
   ====================================================================== */
:root {
  --bg: #f4f5f6; --surface: #fff; --surface-2: #f8f9fa; --surface-3: #eef0f2; --hover: #f3f5f7;
  --line: #e3e5e8; --line-strong: #cdd2d8;
  --ink: #1a1f26; --ink-2: #3c444f; --muted: #646c76;
  --primary: #1f5c99; --primary-hover: #184b7e; --primary-soft: #e9f0f7;
  --focus: rgba(31, 92, 153, .4); --focus-soft: rgba(31, 92, 153, .15);
  --side-bg: #fafbfb;
  --radius: 8px; --radius-sm: 6px;
  --sidebar: 224px;
  --font-num: "DIN Alternate", "Bahnschrift", "DIN 2014", "D-DIN", system-ui, sans-serif;
  --font-display: var(--font); /* titles, buttons and tabs in the system font; DIN only for figures */
}
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.stat-value, .tab-count, .nav-count, .big-number, .rcard-value, .sheet-score strong, .home-date { font-family: var(--font-num); }

/* --- side menu --- */
.sidebar:where(:not(.safeplan *)){ background: var(--side-bg); color: var(--ink); border-inline-end: 1px solid var(--line); padding: 10px 8px; gap: 4px; overflow-x: hidden; }
.side-top { display: flex; align-items: center; justify-content: space-between; gap: 4px; min-height: 32px; padding-inline-start: 6px; }
.brand { color: var(--ink); font-size: 13.5px; font-weight: 650; padding: 0; gap: 9px; white-space: nowrap; }
.brand:hover { color: var(--ink); }
.fold-btn { min-width: 28px; height: 28px; padding: 0; color: var(--muted); }
.site-board { margin: 4px 0 4px; padding: 8px 9px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); }
.board-name { align-items: flex-start; gap: 4px; }
.board-title { color: var(--ink); font: 650 14px/1.3 var(--font); }
.board-chev { margin-top: 2px; color: var(--muted); }
.board-name:hover .board-chev { color: var(--ink); }
.board-name:focus-within { outline: 2px solid var(--primary); outline-offset: 3px; }
.board-meta { margin-top: 4px; gap: 2px 8px; font-size: 12px; color: var(--muted); }
.board-meta b { font-weight: 650; color: var(--ink-2); background: var(--surface-3); border-radius: 4px; padding: 0 5px; }
.global-search { height: 32px; max-width: none; margin: 2px 0 4px; padding: 0 8px 0 2px; gap: 2px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); }
.global-search:focus-within { border-color: var(--primary); }
.global-search input { font-size: 13px; }
.search-icon { display: grid; place-items: center; width: 28px; height: 28px; padding: 0; border: 0; background: none; color: var(--muted); cursor: pointer; flex: none; }
.nav { gap: 1px; }
.nav-group { margin: 10px 8px 2px; font: 600 11.5px var(--font); color: var(--muted); }
.nav-group:first-of-type { margin-top: 6px; }
.nav-link { height: 30px; padding: 0 8px; gap: 10px; border-radius: 6px; color: var(--ink-2); font-weight: 500; font-size: 13.5px; white-space: nowrap; }
button.nav-link { width: 100%; border: 0; background: none; font: inherit; font-size: 13.5px; cursor: pointer; text-align: start; }
.nav-link .icon { width: 17px; height: 17px; color: var(--muted); }
.nav-link:hover { background: var(--surface-3); color: var(--ink); }
.nav-link:hover .icon { color: var(--ink-2); }
.nav-link.active:where(:not(.safeplan *)){ background: var(--primary-soft); color: var(--primary); font-weight: 600; box-shadow: none; }
.nav-link.active .icon:where(:not(.safeplan *)){ color: var(--primary); }
.nav-link.active::before { content: ''; position: absolute; inset: 6px auto 6px -8px; width: 3px; height: auto; border-radius: 0 2px 2px 0; background: var(--primary); }
.nav-link.active::after { content: none; }
.nav-count { font-size: 11.5px; line-height: 18px; min-width: 20px; padding: 0 6px; }
.sidebar-foot { display: grid; gap: 1px; margin: auto 0 0; padding-top: 6px; border-top: 1px solid var(--line); }
.user-chip { padding: 4px 8px; gap: 10px; border: 0; border-radius: 6px; background: none; color: var(--ink); }
.user-chip:hover { background: var(--surface-3); }
.user-chip .avatar { background: var(--surface-3); color: var(--ink-2); }
.user-chip small { color: var(--muted); }

@media (min-width: 861px) {
  body.nav-folded { --sidebar: 56px; }
  body.nav-folded .sidebar { padding: 10px 6px; }
  body.nav-folded .side-label, body.nav-folded .site-board, body.nav-folded .global-search input { display: none; }
  body.nav-folded .side-top { flex-direction: column; gap: 6px; padding: 0; }
  body.nav-folded .fold-btn .icon { transform: scaleX(-1); }
  body.nav-folded .global-search { justify-content: center; padding: 0; border: 0; background: none; }
  body.nav-folded .search-icon { width: 36px; height: 30px; border-radius: 6px; }
  body.nav-folded .search-icon:hover { background: var(--surface-3); color: var(--ink); }
  body.nav-folded .nav-group { height: 1px; margin: 6px 8px; font-size: 0; background: var(--line); }
  body.nav-folded .nav-link { justify-content: center; padding: 0; }
  body.nav-folded .nav-link.active::before { left: -6px; }
  body.nav-folded .nav-count { position: absolute; top: 2px; inset-inline-end: 4px; min-width: 15px; padding: 0 3px; font-size: 10px; line-height: 15px; }
  body.nav-folded .user-chip { justify-content: center; padding: 4px 0; }
}
[dir=rtl] .fold-btn .icon { transform: scaleX(-1); }
[dir=rtl] body.nav-folded .fold-btn .icon { transform: none; }

/* --- work area --- */
.view { max-width: 1480px; margin: 0; padding: 16px 20px 32px; }
.page-head { margin-bottom: 12px; align-items: center; gap: 8px 16px; }
.title-row { display: flex; align-items: center; gap: 4px; min-width: 0; }
.page-title h1, .page-h1 { font: 650 20px/1.25 var(--font); letter-spacing: -.005em; }
.page-title p { margin-top: 2px; font-size: 13px; }
.back-link { display: inline-grid; place-items: center; flex: none; width: 28px; height: 28px; margin: 0 0 0 -6px; border-radius: 6px; color: var(--ink-2); }
.back-link:hover { background: var(--surface-3); text-decoration: none; }
.page-actions { gap: 6px; }
.page-actions .btn { min-height: 32px; }
.section-gap { margin-top: 12px; }
.grid, .stack { gap: 12px; }
.card { border-radius: var(--radius); }
.card-head { padding: 9px 14px; }
.card-head h2 { font: 650 14px var(--font); }
.card-body { padding: 12px 14px; }
.form-section-head h3, .chk-sec-head h3 { font: 650 14.5px var(--font); }
.dialog { border-radius: 10px; }
.dialog-head h2 { font: 650 17px var(--font); }

/* count strip: one line per count; tapping a count filters the list */
.stats { margin-bottom: 12px; border-radius: var(--radius); }
.stats > .stat { display: flex; align-items: baseline; gap: 6px; min-width: 0; padding: 7px 12px; }
.stats > .stat .stat-label { flex: 0 1 auto; min-width: 0; font-size: 12.5px; color: var(--muted); }
.stats > .stat .stat-value { flex: none; margin: 0; font-size: 17px; line-height: 1.25; font-weight: 700; }
.stats > .stat .stat-note { flex: 0 1 auto; min-width: 0; color: var(--muted); }
.stats-loose > .stat { border-radius: var(--radius); }
.stat-btn.on:where(:not(.safeplan *)){ background: var(--primary-soft) !important; box-shadow: inset 0 -2px 0 var(--primary) !important; }
.stat-btn.on .stat-label { color: var(--primary); }

/* tabs */
.tabs { gap: 0; margin-bottom: 12px; border-bottom-color: var(--line); }
.tab { padding: 7px 2px 8px; margin-inline-end: 18px; font: 600 13.5px var(--font); border-bottom-width: 2px; }
.tab.active:where(:not(.safeplan *)){ color: var(--ink); border-bottom-color: var(--primary); }
.tab-count { font-size: 12.5px; }

/* controls: two button styles, one height */
.btn { min-height: 32px; padding: 0 12px; font: 600 13.5px/1 var(--font); border-radius: 6px; }
.btn-sm { min-height: 28px; padding: 0 9px; font-size: 12.5px; }
.btn-primary { background: var(--primary); }
.btn-primary:hover { background: var(--primary-hover); }
.btn-secondary:hover { border-color: var(--line-strong); background: var(--surface-3); }
.icon-btn { height: 32px; min-width: 32px; border-radius: 6px; }
.quick-chip.on:where(:not(.safeplan *)), .pick-opt input:checked + span { background: var(--primary); border-color: var(--primary); }
.check input { accent-color: var(--primary); }
.pill { border-radius: 4px; font-size: 12px; padding: 1px 7px 1px 6px; }

/* home: compact shortcut buttons */
.quick-tiles { grid-template-columns: repeat(auto-fill, minmax(175px, 1fr)); gap: 6px; }
.quick-tiles a { min-height: 38px; padding: 4px 10px; font: 600 13px/1.25 var(--font); }
.quick-tiles .mod-icon { width: 24px; height: 24px; border-radius: 6px; }
.quick-tiles a:hover { border-color: var(--line-strong); background: var(--hover); }

/* sign-in and setup screens */
.auth { background: var(--bg); }
.auth-card { border: 1px solid var(--line); border-radius: 12px; }
.auth-card h1 { font: 650 22px var(--font); }
.toast:where(:not(.safeplan *)){ background: var(--ink); border-radius: 8px; }

/* touch screens: larger targets */
@media (pointer: coarse) {
  .btn { min-height: 40px; }
  .btn-sm { min-height: 34px; }
  .nav-link { height: 40px; }
  .icon-btn { height: 40px; min-width: 40px; }
}

/* phones: the menu is a drawer, opened from one slim bar */
.phonebar { position: sticky; top: 0; z-index: 20; align-items: center; gap: 6px; height: 48px; padding: 0 8px; background: var(--surface); border-bottom: 1px solid var(--line); }
.phonebar .topbar-event { flex: 1; min-width: 0; font: 650 15px var(--font); }
@media (max-width: 860px) {
  .phonebar.only-mobile { display: flex !important; }
  .sidebar:where(:not(.safeplan *)){ padding: 12px 10px; width: min(300px, 86vw); }
  .fold-btn { display: none; }
  .nav-link.active:where(:not(.safeplan *)){ background: var(--primary-soft); }
  .nav-link.active::before { left: -10px; }
  .view { padding: 12px 12px 32px; }
  .page-title h1, .page-h1 { font-size: 19px; }
  .stats > .stat { padding: 7px 10px; }
  .stats > .stat .stat-label { white-space: nowrap; }
}

/* --- Site plans: the map in the same look, with one toolbar --- */
.safeplan-host { height: 100vh; }
@media (max-width: 860px) { .safeplan-host { height: calc(100vh - 48px); } }
.safeplan-host .safeplan { --ink: #1a1f26; --muted: #646c76; --line: #e3e5e8; --paper: #f4f5f6; --panel: #fff; --panel-2: #f8f9fa; --forest: #1f5c99; --forest-2: #184b7e; --mint: #e9f0f7; font-family: var(--font); }
.safeplan-host .safeplan * { font-family: var(--font) !important; text-transform: none !important; letter-spacing: normal !important; }
.safeplan-host .safeplan .canvas-toolbar { flex-wrap: wrap; justify-content: flex-start; height: auto; min-height: 44px; padding: 5px 8px; gap: 6px; }
.safeplan-host .safeplan .canvas-toolbar .canvas-actions { margin-inline-start: auto; }
.safeplan-host .safeplan .canvas-toolbar .topbar-actions { display: flex; align-items: center; gap: 4px; padding-inline-start: 8px; border-inline-start: 1px solid var(--line); }
.safeplan-host .safeplan .canvas-toolbar .button { min-height: 30px; height: 30px; padding: 0 10px; font-size: 13px; }
.safeplan-host .safeplan .sp-name { display: flex; align-items: center; gap: 6px; min-width: 0; }
.safeplan-host .safeplan .sp-name input { width: 240px; max-width: 40vw; height: 22px; padding: 0 6px; border: 1px solid transparent; border-radius: 4px; background: transparent; color: var(--ink); font-size: 12px; }
.safeplan-host .safeplan .sp-name input:hover, .safeplan-host .safeplan .sp-name input:focus { border-color: var(--line-strong); background: #fff; }
.safeplan-host .safeplan .canvas-statusbar { justify-content: flex-start; gap: 14px; }
.stats > .stat { overflow: hidden; }
.stats > .stat .stat-label { flex-shrink: 0; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.stats > .stat .stat-note { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* mouse screens: filter boxes match the 32 px buttons; form boxes and one-tap choices stay a little taller */
@media (pointer: fine) {
  .fsearch, .fsel { height: 32px; }
  .fsearch input, .fsel select, .fsel input { height: 30px; font-size: 13px; }
  :where(input:not([type=checkbox]):not([type=radio]):not([type=file]):not([type=range]), select, textarea):where(:not(.safeplan *)) { min-height: 36px; }
  .pick-opt span, .segmented span { min-height: 34px; }
  .filters { padding: 8px 10px; }
}
.safeplan-host .safeplan .canvas-toolbar { height: auto; }
.safeplan-host .safeplan .sheet-pick select { width: 150px; max-width: 150px; }
.safeplan-host .safeplan .doc-text { max-width: 150px; }
.safeplan-host .safeplan .canvas-actions { gap: 4px; }
.safeplan-host .safeplan .sheet-pick { margin-inline-end: 0; }
@media (max-width: 860px) {
  /* phones: each count keeps its full label; the strip scrolls sideways */
  .stats { grid-auto-columns: max-content; }
  .stats > .stat .stat-label { max-width: none; overflow: visible; }
}
.sidebar .global-search { order: 0; flex: none; height: 32px; }
@media (pointer: coarse) { .sidebar .global-search { height: 40px; } }

/* ======================================================================
   NOTE 19 (2 Dec 2026): Administration. One access matrix per event: the switch
   in a column head turns that module on or off for the event; the cells below
   set each person's level, coloured from light (read) to solid (manage).
   ====================================================================== */
:root { --lv-view: #eef3f9; --lv-view-ink: #1f5c99; --lv-contribute: #d6e4f2; --lv-contribute-ink: #174a7d; --lv-closeout: #a9c6e3; --lv-closeout-ink: #0f3a66; --lv-manage: #1f5c99; --lv-manage-ink: #fff; }
.admin-tabs .tabs { margin-bottom: 14px; }
.admin-block { margin-bottom: 12px; }
.admin-note { margin-top: 10px; }
details.admin-block > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 12px; border-bottom: 0; }
details.admin-block > summary::-webkit-details-marker { display: none; }
details.admin-block > summary h2 { flex: none; }
details.admin-block > summary .muted { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
details.admin-block > summary > .icon { margin-inline-start: auto; color: var(--muted); transition: transform .15s; }
details.admin-block[open] > summary { border-bottom: 1px solid var(--line); }
details.admin-block[open] > summary > .icon { transform: rotate(180deg); }
details.admin-block > summary:hover h2 { text-decoration: underline; text-underline-offset: 3px; }
.access-card .card-head { align-items: flex-start; }
.access-card .card-subtitle { max-width: 72ch; }

/* level chips (legend) and cells share one colour scale */
.am-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; padding: 8px 14px; border-bottom: 1px solid var(--line); background: var(--surface-2); font-size: 12.5px; color: var(--ink-2); }
.am-legend span { display: inline-flex; align-items: center; gap: 6px; }
.lv { display: inline-grid; place-items: center; min-width: 48px; height: 20px; padding: 0 6px; border-radius: 4px; font: 600 11.5px var(--font); font-style: normal; }
.lv-none, .am-cell select[data-level=none] { background: var(--surface); color: var(--muted); box-shadow: inset 0 0 0 1px var(--line); }
.lv-view, .am-cell select[data-level=view] { background: var(--lv-view); color: var(--lv-view-ink); }
.lv-contribute, .am-cell select[data-level=contribute] { background: var(--lv-contribute); color: var(--lv-contribute-ink); }
.lv-closeout, .am-cell select[data-level=closeout] { background: var(--lv-closeout); color: var(--lv-closeout-ink); }
.lv-manage, .am-cell select[data-level=manage] { background: var(--lv-manage); color: var(--lv-manage-ink); }

.am-wrap { overflow-x: auto; }
.access-matrix { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
.access-matrix th, .access-matrix td { padding: 4px 3px; border-bottom: 1px solid var(--line); text-align: center; vertical-align: middle; }
.access-matrix thead th { padding: 8px 3px 7px; vertical-align: bottom; background: var(--surface); color: var(--ink-2); font-size: 11.5px; font-weight: 600; }
.access-matrix tbody tr:last-child td { border-bottom: 0; }
.access-matrix tbody tr:hover td { background: var(--hover); }
.am-mod { width: 64px; min-width: 64px; }
.am-icon { display: block; color: var(--muted); line-height: 1; margin-bottom: 3px; }
.am-name { display: flex; align-items: flex-end; justify-content: center; min-height: 28px; line-height: 1.2; overflow-wrap: normal; }
.am-mod .switch-sm { display: block; margin: 5px auto 0; }
.am-always { display: block; height: 20px; margin-top: 5px; font-size: 10.5px; font-weight: 500; color: var(--muted); line-height: 20px; }
th.is-off .am-icon, th.is-off .am-name { color: var(--muted); opacity: .55; }
td.is-off { background-image: repeating-linear-gradient(45deg, transparent 0 5px, var(--surface-3) 5px 6px); }
td.is-off select { opacity: .35; }
.am-person { position: sticky; inset-inline-start: 0; z-index: 1; width: 210px; min-width: 190px; padding: 6px 10px !important; background: var(--surface); text-align: start !important; border-inline-end: 1px solid var(--line); }
thead .am-person { vertical-align: bottom; }
.am-person strong { display: block; font-size: 13px; }
.am-person small { display: block; overflow: hidden; color: var(--muted); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; max-width: 190px; }
.am-person select { width: 100%; height: 28px; min-height: 28px !important; margin-top: 4px; padding: 0 26px 0 8px; font-size: 12.5px; background-position: right 8px center; }
.am-cell select { width: 58px; height: 30px; min-height: 30px !important; padding: 0 2px; border: 1px solid transparent; border-radius: 5px; background-image: none; text-align: center; text-align-last: center; font: 600 12px var(--font); cursor: pointer; }
.am-cell select:hover { border-color: var(--ink-2); }
.am-cell select:focus { outline: 2px solid var(--primary); outline-offset: 1px; box-shadow: none; }
.am-admin { width: 66px; min-width: 60px; }
.am-admin .switch-sm { margin: 0 auto; }
.am-x { width: 36px; }
.switch-sm { width: 34px; height: 20px; }
.switch-sm i::after { top: 3px; width: 14px; height: 14px; }
.switch-sm input:checked + i::after { inset-inline-start: 17px; }
.am-foot { position: sticky; bottom: 0; z-index: 2; display: flex; align-items: center; gap: 8px; padding: 8px 14px; border-top: 1px solid var(--line); background: var(--surface); border-radius: 0 0 var(--radius) var(--radius); }
.am-help { flex: 1; min-width: 0; font-size: 12.5px; color: var(--ink-2); }
.am-dirty { font-size: 12.5px; font-weight: 650; color: var(--warn); white-space: nowrap; }
@media (max-width: 860px) {
  .am-foot { flex-wrap: wrap; }
  .am-help { flex-basis: 100%; }
  .am-person { width: 150px; min-width: 150px; }
  .access-card .card-head { flex-direction: column; }
}
.am-mod { width: 60px; min-width: 60px; }
.am-cell select { width: 54px; }
.am-person { width: 190px; min-width: 180px; }
.am-person small { max-width: 170px; }
.am-admin { width: 56px; min-width: 56px; white-space: normal; line-height: 1.2; }
.am-x { width: 34px; padding: 0 !important; }
.am-x .icon-btn { min-width: 30px; height: 30px; }
.storage-kv .kv { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px 14px; }
@media (max-width: 860px) { .storage-kv .kv { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.page-actions .btn[data-delete-event] { flex: none; }
/* client / contractor sides */
.side-tag { display: inline-flex; align-items: center; height: 20px; padding: 0 7px; border-radius: 4px; font-size: 11.5px; font-weight: 650; white-space: nowrap; }
.side-tag + .side-tag { margin-inline-start: 4px; }
.side-client { background: #e9f0f7; color: #1f5c99; }
.side-contractor { background: #f3ede2; color: #7a4e0c; }
.access-matrix tr.am-group th { position: sticky; inset-inline-start: 0; padding: 7px 10px; text-align: start; background: var(--surface-2); font-size: 12px; font-weight: 600; color: var(--ink-2); border-bottom: 1px solid var(--line); }
.access-matrix tr.am-group:hover th { background: var(--surface-2); }
.access-matrix tr.am-group.side-contractor th { box-shadow: inset 3px 0 0 #c9a46a; }
.access-matrix tr.am-group.side-client th { box-shadow: inset 3px 0 0 var(--primary); }
.board-scope { display: flex; align-items: center; gap: 5px; margin-top: 6px; padding: 3px 6px; border-radius: 4px; background: #f3ede2; color: #7a4e0c; font-size: 11.5px; font-weight: 600; }
.am-adj { display: block; margin-top: 2px; font-size: 11px; font-weight: 600; color: var(--warn); }

/* ======================================================================
   NOTE 21 (2 Dec 2026): editable dashboard. Two-column grid of chart cards;
   one hue for magnitude (accent), status colours only for status splits.
   ====================================================================== */
.dash-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; align-items: start; }
.dash-cell.is-wide { grid-column: 1 / -1; }
.dash-card .card-head { min-height: 44px; }
.dash-card .card-head > div { display: flex; }
.dash-tools { display: flex; align-items: center; gap: 2px; }
.dash-tools .icon-btn { min-width: 28px; height: 28px; }
.dash-tools [data-dir="-1"] .icon { transform: rotate(90deg); }
.dash-tools [data-dir="1"] .icon { transform: rotate(90deg); }
.dash-grid.is-editing .dash-card { outline: 1px dashed var(--line-strong); outline-offset: 2px; }
.dash-add { margin-bottom: 12px; }
.dash-add .card-body { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.dash-add strong { margin-inline-end: 6px; font-size: 13px; }
.stats-dash { margin: 0; border: 0; }
.dash-card .hbar-track i { background: var(--primary); }
/* columns per day */
.col-chart { margin: 0; }
.col-chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.col-bar { fill: var(--primary); }
.col-bar:hover { fill: var(--primary-hover); }
.col-grid { stroke: var(--line); stroke-dasharray: 3 3; }
.col-base { stroke: var(--line-strong); }
.col-max, .col-tick { font: 11px var(--font); fill: var(--muted); }
.col-table summary { margin-top: 6px; font-size: 12px; color: var(--muted); cursor: pointer; }
.col-table table { margin-top: 4px; font-size: 12.5px; }
/* one bar split by status */
.seg-bar { display: flex; gap: 2px; height: 14px; border-radius: 4px; overflow: hidden; }
.seg-bar i { min-width: 3px; }
.seg-ok { background: var(--ok); } .seg-warn { background: var(--warn-mark); } .seg-danger { background: var(--danger); } .seg-info { background: var(--info); } .seg-muted { background: var(--na); }
.seg-legend { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 4px 14px; margin: 10px 0 0; padding: 0; list-style: none; font-size: 13px; color: var(--ink-2); }
.seg-legend li { display: flex; align-items: center; gap: 7px; }
.seg-legend li i { width: 10px; height: 10px; border-radius: 2px; flex: none; }
.seg-legend b { margin-inline-start: auto; color: var(--ink); font-family: var(--font-num); }
.seg-legend small { min-width: 32px; text-align: end; color: var(--muted); }
@media (max-width: 860px) { .dash-grid { grid-template-columns: 1fr; } }

/* ======================================================================
   NOTE 24 (2 Dec 2026): WhatsApp channel. Admin tab and the contractor's public pages.
   ====================================================================== */
.wa-grid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 12px; align-items: start; }
.wa-grid .card > .card-head + .card-body + .card-head { border-top: 1px solid var(--line); }
.wa-modes { display: grid; gap: 6px; }
.wa-modes .choice { display: flex; gap: 10px; align-items: flex-start; padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; cursor: pointer; }
.wa-modes .choice small { display: block; color: var(--muted); font-size: 12.5px; }
.wa-modes .choice.selected { border-color: var(--primary); background: var(--primary-soft); box-shadow: none; }
.wa-kv { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 14px; margin-top: 10px; }
.wa-sub { margin: 14px 0 6px; font-size: 13px; font-weight: 650; }
.wa-qr { display: grid; justify-items: center; gap: 8px; text-align: center; }
.wa-qr canvas { width: 220px; height: 220px; image-rendering: pixelated; }
.wa-qr p { overflow-wrap: anywhere; }
@media (max-width: 1100px) { .wa-grid { grid-template-columns: 1fr; } }
/* public pages for contractors */
.pub-page { max-width: 900px; margin: 0 auto; padding: 0 12px 40px; }
.pub-head { display: flex; align-items: center; gap: 8px; padding: 14px 0; border-bottom: 1px solid var(--line); margin-bottom: 14px; color: var(--ink-2); }
.pub-intro { margin-bottom: 12px; }
.pub-intro h1 { font: 650 20px/1.25 var(--font); }
.pub-intro p { color: var(--muted); font-size: 13px; margin-top: 2px; }
.pub-msg { display: grid; justify-items: center; gap: 8px; padding: 48px 16px; text-align: center; }
.pub-msg h1 { font: 650 20px var(--font); }
.pub-msg p { max-width: 460px; color: var(--muted); }
.pub-ok .icon { color: var(--ok); }
.pub-actions { justify-content: flex-end; margin-bottom: 10px; }
