/* Security Services Register — plain corporate look.
   Calibri (Arial where Calibri is missing), neutral greys, one dark-blue
   accent. Branding, when switched on, overrides --bar/--bar-ink and, when
   white text reads well on it, --accent. */

:root {
  --bg: #f2f4f7;
  --surface: #ffffff;
  --surface-2: #edf1f5;
  --ink: #1b2530;
  --ink-2: #33414f;
  --muted: #5a6776;
  --line: #d5dce4;
  --line-strong: #b6c1cd;
  --accent: #1d5a96;
  --accent-hover: #174b7e;
  --accent-soft: #e1ebf6;
  --accent-text: #153f6a;
  --bar: #16314d;
  --bar-ink: #ffffff;
  --ok: #2a774a;     --ok-soft: #e2f1e8;
  --warn: #8f5600;   --warn-soft: #fbefda;
  --crit: #b3261e;   --crit-soft: #fbe4e2;
  --info: #1d5a96;   --info-soft: #e1ebf6;
  --font: Calibri, Carlito, Arial, "Helvetica Neue", sans-serif;
  --mono: Consolas, "Courier New", monospace;
  --radius: 4px;
  --focus: 0 0 0 3px rgba(29, 90, 150, .35);
  --shadow: 0 10px 30px rgba(15, 25, 40, .18);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--bg); }
body { color: var(--ink); font-family: var(--font); font-size: 15px; line-height: 1.45; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }
h1 { font-size: 24px; margin: 0 0 4px; line-height: 1.2; }
h2 { font-size: 18px; margin: 0 0 12px; }
h3 { font-size: 15px; margin: 0 0 6px; }
p { margin: 0 0 10px; }
code { font-family: var(--mono); background: var(--surface-2); padding: 1px 5px; border-radius: var(--radius); }
.icon { fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.small { font-size: 13px; }
.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }
.pad { padding: 14px; }
.ok-text { color: var(--ok); font-weight: 700; }
.warn-text { color: var(--warn); font-weight: 700; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.boot { padding: 40px; color: var(--muted); }

/* ---------- Sign-in screens ---------- */
.page-centered { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 32px 16px; gap: 14px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 28px; box-shadow: 0 1px 2px rgba(0,0,0,.04); }
.card-narrow { width: min(420px, 100%); }
.auth-head { text-align: center; margin-bottom: 18px; }
.auth-head h1 { margin-top: 8px; }
.auth-head p { margin: 6px 0 0; }
.auth-logo { max-width: 220px; max-height: 70px; object-fit: contain; }
.card-mark { width: 48px; height: 48px; margin: 0 auto; border-radius: 50%; display: grid; place-items: center; background: var(--bar); color: var(--bar-ink); }
.auth-foot { text-align: center; }

.notice { border: 1px solid; border-radius: var(--radius); padding: 9px 12px; margin: 0 0 14px; font-size: 14px; }
.notice-info { background: var(--info-soft); border-color: var(--info); color: var(--accent-text); }
.notice-warn { background: var(--warn-soft); border-color: var(--warn); color: var(--ink); }
.notice-crit { background: var(--crit-soft); border-color: var(--crit); color: var(--ink); }

/* ---------- Forms ---------- */
.field { margin: 0 0 14px; border: 0; padding: 0; min-width: 0; }
.field > label, .field > legend { display: block; margin-bottom: 4px; font-weight: 700; font-size: 14px; color: var(--ink-2); padding: 0; }
.field .optional { margin-left: 6px; font-weight: 400; color: var(--muted); font-size: 13px; }
.field .optional::before { content: "· "; }
.field input[type=text], .field input[type=password], .field input[type=email], .field input[type=number], .field input[type=date], .field select, .field textarea {
  width: 100%; min-height: 34px; padding: 5px 9px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--surface);
}
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--accent); box-shadow: var(--focus); }
.field.has-error input, .field.has-error select { border-color: var(--crit); }
.field .hint { margin-top: 4px; font-size: 13px; color: var(--muted); }
.field .error { font-size: 13px; color: var(--crit); font-weight: 700; }
.field.has-error .error { margin-top: 4px; }
.field .static { padding: 6px 0; }
.with-unit { display: flex; align-items: center; gap: 8px; }
.with-unit input.num-input { width: 110px; }
.colour-picker { width: 44px; height: 34px; padding: 2px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--surface); flex: none; }
.choices { display: grid; gap: 8px; }
.choice { display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--line-strong); border-radius: var(--radius); padding: 9px 12px; cursor: pointer; background: var(--surface); }
.choice:hover { border-color: var(--muted); }
.choice:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
.choice:has(input:focus-visible) { box-shadow: var(--focus); }
.choice input { margin: 3px 0 0; accent-color: var(--accent); width: 16px; height: 16px; flex: none; }
.choice-body { display: grid; gap: 2px; }
.choice-body span { font-size: 13px; color: var(--muted); }
.field-check .check { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; font-weight: 400; margin: 0; color: var(--ink); }
.field-check input { margin: 3px 0 0; width: 16px; height: 16px; accent-color: var(--accent); flex: none; }
.field-check .check > span { display: grid; gap: 2px; }
.field-check .hint { margin: 0; }
.form-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 4px; }

.btn { display: inline-flex; align-items: center; gap: 6px; min-height: 34px; padding: 0 14px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--surface); color: var(--ink); cursor: pointer; white-space: nowrap; text-decoration: none; font-size: 15px; }
.btn:hover { background: var(--surface-2); }
.btn:focus-visible { outline: none; box-shadow: var(--focus); }
.btn:disabled { opacity: .55; cursor: default; }
.btn.busy { cursor: progress; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 700; }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); filter: brightness(.95); }
.btn-danger { background: var(--crit); border-color: var(--crit); color: #fff; font-weight: 700; }
.btn-danger-text { color: var(--crit); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn-small { min-height: 28px; padding: 0 9px; font-size: 13px; }
.btn-block { width: 100%; justify-content: center; margin-top: 6px; }

/* ---------- Shell ---------- */
.shell { min-height: 100vh; display: flex; flex-direction: column; }
.topbar { background: var(--bar); color: var(--bar-ink); display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 20px; padding: 8px 18px; min-height: 54px; }
.brand { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; min-width: 0; }
.brand-logo { max-height: 36px; max-width: 160px; object-fit: contain; background: #fff; border-radius: 3px; padding: 2px 4px; }
.brand-text { display: grid; line-height: 1.15; min-width: 0; }
.brand-title { font-size: 18px; font-weight: 700; }
.brand-org { font-size: 13px; opacity: .85; }
.bar-right { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; font-size: 14px; }
.bar-user { display: inline-flex; align-items: center; gap: 6px; color: inherit; text-decoration: none; }
.bar-user:hover span:first-of-type { text-decoration: underline; }
.bar-role { font-size: 12px; border: 1px solid currentColor; border-radius: 999px; padding: 0 7px; opacity: .85; }
.bar-btn { display: inline-flex; align-items: center; gap: 5px; background: transparent; border: 1px solid currentColor; color: inherit; border-radius: var(--radius); padding: 3px 10px; cursor: pointer; font-size: 14px; opacity: .9; }
.bar-btn:hover { opacity: 1; }
.bar-warn { display: inline-flex; align-items: center; gap: 5px; background: var(--warn-soft); color: var(--warn); border-radius: var(--radius); padding: 2px 9px; font-weight: 700; text-decoration: none; font-size: 13px; }

.layout { flex: 1; display: grid; grid-template-columns: 230px minmax(0, 1fr); }
.sidebar { background: var(--surface); border-right: 1px solid var(--line); padding: 10px 0 24px; }
.nav-section { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding: 14px 16px 4px; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 8px 16px; color: var(--ink); text-decoration: none; border-left: 3px solid transparent; }
.nav-item:hover { background: var(--surface-2); }
.nav-item[aria-current="page"] { background: var(--accent-soft); border-left-color: var(--accent); color: var(--accent-text); font-weight: 700; }
.main { padding: 22px 26px 48px; min-width: 0; outline: none; }

.page-head { margin-bottom: 16px; }
.page-head-row { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 12px; }
.lede { color: var(--muted); max-width: 80ch; margin: 2px 0 0; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; min-width: 0; }
.panel.narrow { max-width: 560px; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.stack { display: grid; gap: 16px; align-content: start; }
.plain-list { margin: 0; padding-left: 18px; }
.plain-list li { margin: 4px 0; }
.build-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.build-list li { display: flex; align-items: center; gap: 10px; color: var(--muted); }
.build-list li.is-done { color: var(--ink); }
.build-list li.is-next { color: var(--ink); font-weight: 700; }
.build-n { width: 22px; height: 22px; border-radius: 50%; border: 1px solid var(--line-strong); display: grid; place-items: center; font-size: 12px; flex: none; }
.is-done .build-n { background: var(--ok); border-color: var(--ok); color: #fff; }
.is-next .build-n { border-color: var(--accent); color: var(--accent); }
dl.kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 6px 16px; margin: 0 0 12px; }
dl.kv dt { color: var(--muted); }
dl.kv dd { margin: 0; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.table { border-collapse: collapse; width: 100%; font-size: 14px; }
.table th, .table td { padding: 8px 11px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.table thead th { background: var(--surface-2); font-size: 13px; white-space: nowrap; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tr.is-muted td { color: var(--muted); }
.row-actions { display: flex; gap: 5px; }
.pill { display: inline-block; font-size: 12px; font-weight: 700; padding: 1px 8px; border-radius: 999px; border: 1px solid; white-space: nowrap; }
.pill-ok { background: var(--ok-soft); color: var(--ok); border-color: var(--ok); }
.pill-warn { background: var(--warn-soft); color: var(--warn); border-color: var(--warn); }
.pill-crit { background: var(--crit-soft); color: var(--crit); border-color: var(--crit); }
.pill-info { background: var(--info-soft); color: var(--accent-text); border-color: var(--info); }
.pill-plain { background: var(--surface-2); color: var(--muted); border-color: var(--line-strong); font-weight: 400; }
.change-list { margin: 4px 0 0; padding-left: 16px; font-size: 13px; }
.change-list li { margin: 1px 0; }
.chg-label { color: var(--muted); }
.chg-before { text-decoration: line-through; text-decoration-color: var(--line-strong); color: var(--ink-2); }
.chg-after { font-weight: 700; }
.filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 0 14px; align-items: end; margin-bottom: 14px; }
.filters .field { margin-bottom: 10px; }
.filters .field-check { align-self: center; grid-column: span 2; }
.pager { display: flex; align-items: center; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.pager .muted { margin-right: auto; }

/* ---------- Dialogs and messages ---------- */
.dialog { border: 1px solid var(--line); border-radius: var(--radius); padding: 22px 24px; background: var(--surface); color: var(--ink); box-shadow: var(--shadow); width: min(460px, calc(100vw - 32px)); max-height: calc(100vh - 32px); overflow: auto; }
.dialog-wide { width: min(620px, calc(100vw - 32px)); }
.dialog::backdrop { background: rgba(10, 18, 28, .45); }
.dialog-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.temp-password { font-family: var(--mono); font-size: 20px; letter-spacing: .04em; background: var(--surface-2); border: 1px dashed var(--line-strong); border-radius: var(--radius); padding: 12px; text-align: center; user-select: all; margin: 12px 0; word-break: break-all; }
.conflict-list { display: grid; gap: 10px; margin: 10px 0; }
.conflict-item { border: 1px solid var(--line); border-left: 4px solid var(--warn); border-radius: 0; padding: 8px 12px; }
#toasts { position: fixed; right: 18px; bottom: 18px; display: grid; gap: 8px; z-index: 1000; }
.toast { display: flex; align-items: center; gap: 8px; max-width: 440px; padding: 10px 14px; border-radius: var(--radius); background: var(--ink); color: #fff; box-shadow: var(--shadow); font-size: 14px; transition: opacity .35s, transform .35s; }
.toast-ok .icon { color: #8fd6aa; }
.toast-error { background: var(--crit); }
.toast-info { background: var(--accent); }
.toast.leaving { opacity: 0; transform: translateY(6px); }

/* ---------- Branding page ---------- */
.preview-bar { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: var(--radius); margin-bottom: 8px; }
.logo-box { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; background: repeating-conic-gradient(#f3f3f3 0 25%, #fff 0 50%) 0 0 / 16px 16px; text-align: center; margin-bottom: 10px; }
.logo-box img { max-width: 100%; max-height: 90px; }

@media (max-width: 860px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .sidebar { display: flex; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line); padding: 0; }
  .nav-section { display: none; }
  .nav-item { border-left: 0; border-bottom: 3px solid transparent; white-space: nowrap; }
  .nav-item[aria-current="page"] { border-bottom-color: var(--accent); }
  .main { padding: 16px; }
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ---------- Phase 2: register pages ---------- */
.crumbs { font-size: 14px; color: var(--muted); margin-bottom: 6px; }
.crumbs a { text-decoration: none; }
.crumbs a:hover { text-decoration: underline; }
.pill-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 6px; }
.pre { white-space: pre-wrap; }
.stack-sm { display: grid; gap: 10px; }
.muted-panel { background: var(--surface-2); }
.link-btn { background: none; border: 0; padding: 0; color: var(--accent); cursor: pointer; text-decoration: underline; font: inherit; }
.check-inline { display: inline-flex; align-items: center; gap: 7px; cursor: pointer; }
.grid-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 0 16px; }
.table-click tbody tr { cursor: pointer; }
.table-click tbody tr:hover td { background: var(--surface-2); }
.narrow-table { max-width: 760px; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin: 14px 0 16px; overflow-x: auto; }
.tabs button { background: none; border: 0; border-bottom: 3px solid transparent; padding: 8px 14px; cursor: pointer; color: var(--muted); white-space: nowrap; font-size: 15px; }
.tabs button:hover { color: var(--ink); }
.tabs button[aria-selected="true"] { border-bottom-color: var(--accent); color: var(--ink); font-weight: 700; }
.tab-actions { display: flex; gap: 8px; margin-bottom: 12px; }
.choices-2 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }

/* Address block and map */
.address-block { border: 0; padding: 0; margin: 0; min-width: 0; }
.address-block > legend { font-size: 18px; font-weight: 700; margin-bottom: 10px; padding: 0; }
.address-grid { display: grid; grid-template-columns: minmax(0, 1fr) 110px 120px; gap: 0 14px; }
.address-grid .span-2 { grid-column: 1 / -1; }
.geo-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 4px 0 8px; }
.geo-status { color: var(--muted); }
.geo-choices { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-bottom: 8px; }
.map { position: relative; height: 340px; overflow: hidden; border: 1px solid var(--line-strong); border-radius: var(--radius); background: #d9dee3; touch-action: none; cursor: grab; user-select: none; }
.map.map-tall { height: 480px; }
.map:active { cursor: grabbing; }
.map:focus-visible { outline: none; box-shadow: var(--focus); }
.map-tiles, .map-marks { position: absolute; inset: 0; }
.map-tile { position: absolute; left: 0; top: 0; width: 256px; height: 256px; max-width: none; pointer-events: none; }
.map-pin { position: absolute; left: 0; top: 0; display: block; line-height: 0; }
.map-pin-main { z-index: 5; filter: drop-shadow(0 2px 2px rgba(0,0,0,.35)); }
.map-pin-main.is-draggable { cursor: move; }
.map-pin-other { z-index: 4; text-decoration: none; filter: drop-shadow(0 1px 2px rgba(0,0,0,.35)); }
.map-pin-label { position: absolute; left: 26px; top: 4px; line-height: 1.2; white-space: nowrap; background: rgba(255,255,255,.92); color: var(--ink); font-size: 12px; font-weight: 700; padding: 1px 6px; border-radius: 3px; }
.map-zoom { position: absolute; left: 10px; top: 10px; display: grid; gap: 4px; z-index: 6; }
.map-btn { background: #fff; color: #1b2530; border: 1px solid #9aa6b2; border-radius: var(--radius); min-width: 30px; height: 30px; font-size: 18px; line-height: 1; cursor: pointer; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.map-layer { position: absolute; right: 10px; top: 10px; z-index: 6; font-size: 13px; padding: 0 10px; }
.map-overlay { position: absolute; right: 10px; top: 46px; z-index: 6; font-size: 13px; padding: 0 6px; max-width: calc(100% - 70px); }
.map-boundary-label { font: 700 12px Calibri, Arial, sans-serif; fill: #fff; paint-order: stroke; stroke: rgba(0,0,0,.75); stroke-width: 3px; }
.map-credit { position: absolute; right: 0; bottom: 0; z-index: 6; background: rgba(255,255,255,.8); color: #333; font-size: 11px; padding: 1px 6px; }
.map-hint { position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%); z-index: 6; background: rgba(22,49,77,.9); color: #fff; padding: 5px 12px; border-radius: var(--radius); font-size: 13px; max-width: calc(100% - 32px); text-align: center; }

/* Attachments */
.drop-zone { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; border: 2px dashed var(--line-strong); border-radius: var(--radius); padding: 14px; background: var(--surface); }
.drop-zone.is-over { border-color: var(--accent); background: var(--accent-soft); }
.caption-input { flex: 1 1 260px; min-height: 34px; padding: 5px 9px; border: 1px solid var(--line-strong); border-radius: var(--radius); }
.upload-queue { list-style: none; margin: 10px 0; padding: 0; display: grid; gap: 6px; }
.upload-queue li { display: grid; grid-template-columns: minmax(0, 1fr) auto 140px minmax(0, 1.2fr); gap: 10px; align-items: center; font-size: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 6px 10px; }
.upload-queue .q-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upload-queue progress { width: 140px; }
.upload-queue li.is-done span:last-child { color: var(--ok); font-weight: 700; }
.upload-queue li.is-failed { border-color: var(--crit); }
.upload-queue li.is-failed span:last-child { color: var(--crit); font-weight: 700; }
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.photo { margin: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; }
.photo-btn { border: 0; padding: 0; background: var(--surface-2); cursor: zoom-in; display: block; }
.photo-btn img { display: block; width: 100%; height: 150px; object-fit: cover; }
.photo figcaption { padding: 8px 10px; display: grid; gap: 4px; }
.photo-cap { font-weight: 700; font-size: 14px; overflow-wrap: anywhere; }
.dialog-photo { width: min(1100px, calc(100vw - 32px)); padding: 12px; }
.dialog-photo img { display: block; max-width: 100%; max-height: calc(100vh - 170px); margin: 0 auto; }
.photo-meta { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; margin-top: 10px; }

@media (max-width: 860px) {
  .address-grid { grid-template-columns: minmax(0, 1fr); }
  .upload-queue li { grid-template-columns: minmax(0, 1fr) auto; }
  .map { height: 280px; }
}

/* ---------- Phase 3: catalogue, rates, holidays, maps ---------- */
.spread { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 12px; }
.section-gap { margin-top: 16px; }
.big-figure { font-size: 20px; margin: 4px 0 14px; }
.num, .table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.year-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.year-tabs button { border: 1px solid var(--line-strong); background: var(--surface); border-radius: var(--radius); padding: 5px 12px; cursor: pointer; font-size: 15px; }
.year-tabs button[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-text); font-weight: 700; }
.site-picks { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 4px 14px; max-height: 220px; overflow: auto; border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 10px; margin-top: 8px; }
details.panel > summary { cursor: pointer; }
details.panel[open] > summary { margin-bottom: 10px; }

/* ---------- Phase 4: services and schedules ---------- */
:root { --adhoc: #6a3f9e; --adhoc-soft: #efe7f8; }
.pill-adhoc { background: var(--adhoc-soft); color: var(--adhoc); border-color: var(--adhoc); }
.svc-group { margin-top: 4px; }
.svc-group-title { font-size: 13px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 6px 0 8px; }
.svc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; }
.svc-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; display: grid; gap: 6px; align-content: start; }
.svc-card.is-ended { background: var(--surface-2); color: var(--muted); }
.svc-card-head { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.svc-card-head .pill-row { margin-top: 0; flex-wrap: nowrap; }
.svc-title { font-weight: 700; text-decoration: none; }
.svc-title:hover { text-decoration: underline; }
.svc-lines { margin: 0; padding-left: 18px; font-size: 14px; }
.svc-lines li { margin: 2px 0; }
.svc-money { border-top: 1px solid var(--line); padding-top: 6px; }
.svc-summary { list-style: none; margin: 0 0 10px; padding: 0; display: grid; gap: 8px; }
.svc-summary li { border-left: 3px solid var(--line-strong); padding-left: 8px; }

.days { display: inline-flex; gap: 2px; flex-wrap: wrap; }
.days button { min-width: 28px; padding: 3px 4px; font-size: 12px; border: 1px solid var(--line-strong); background: var(--surface); border-radius: var(--radius); cursor: pointer; color: var(--muted); }
.days button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 700; }
.ed-table td { vertical-align: middle; }
.ed-table .days { flex-wrap: nowrap; }
.ed-table select { max-width: 190px; }
.ed-table input[type=text]:not(.time-input) { width: 150px; }
.ed-table .reads-cell { min-width: 180px; }
.time-input { width: 72px; font-variant-numeric: tabular-nums; }
.ed-table input[type=text], .ed-table select { min-height: 30px; padding: 3px 6px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--surface); max-width: 220px; }
.time-input, .num-input-sm { min-height: 30px; padding: 3px 6px; border: 1px solid var(--line-strong); border-radius: var(--radius); }
.num-input-sm { width: 64px; }
.reads { font-size: 13px; color: var(--accent-text); background: var(--accent-soft); padding: 2px 8px; border-radius: var(--radius); display: inline-block; }

.checks { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 8px 18px; }
.check-item { display: grid; gap: 4px; }
.asset-picks { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-left: 24px; }
.field select[data-list], .field input[data-other] { width: 100%; min-height: 34px; padding: 5px 9px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--surface); }
.field input[data-other] { margin-top: 6px; }

/* ---------- Phase 5: static guarding rosters ---------- */
.dialog-xwide { width: min(940px, calc(100vw - 32px)); }
.month-nav { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.month-nav-label { min-width: 130px; text-align: center; font-size: 17px; }
.guard-totals { text-align: right; }
.roster-summary { display: flex; flex-wrap: wrap; gap: 10px 28px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px; }
.roster-summary strong { font-size: 18px; font-variant-numeric: tabular-nums; }
.roster-summary-sm { border: 0; padding: 0; gap: 6px 22px; background: none; }
.roster-summary-sm strong { font-size: 16px; }
.roster-table td { vertical-align: top; }
.roster-table tr.is-weekend td { background: var(--surface-2); }
.roster-table tr.is-holiday td { background: var(--warn-soft); }
.roster-table tr.is-today td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
.roster-table tr.is-off td { color: var(--muted); background: repeating-linear-gradient(135deg, var(--surface), var(--surface) 6px, var(--surface-2) 6px, var(--surface-2) 12px); }
.shift-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.shift-list .pill { font-size: 11px; padding: 0 6px; }
tr.is-ended td { color: var(--muted); }
.roster-preview { display: grid; gap: 6px; }
.roster-notes { margin: 4px 0 0; padding-left: 18px; font-size: 14px; color: var(--warn); }
.preview-errors { max-height: 320px; overflow: auto; }
.preview-errors td:first-child { width: 60px; }
@media (max-width: 860px) {
  .guard-totals { text-align: left; }
  .roster-summary { gap: 8px 18px; }
}

/* ---------- Phase 6: variation register ---------- */
.var-box { border-left: 4px solid var(--accent); }
.var-box[hidden] { display: none !important; }
.var-intro { font-weight: 700; margin: 0 0 8px; }
.var-details { display: grid; gap: 4px; margin-top: 6px; }
.date-today { display: flex; gap: 8px; align-items: center; }
.date-today input { flex: 1; min-width: 0; }
.log-extras { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin-top: 4px; }
.log-extras .pill { text-decoration: none; }
.log-extras .link-btn { font-size: 13px; }
dialog .var-box { border-left: 0; padding: 0; }

/* ---------- Phase 7: Master Services Schedule, run sheet, reminders ---------- */
.flags h2 { margin-top: 0; }
.flag-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.flag { display: grid; grid-template-columns: 18px minmax(0, 1fr) auto; gap: 8px; align-items: start; padding: 6px 8px; border-left: 3px solid var(--line-strong); background: var(--surface-2); border-radius: var(--radius); }
.flag-crit { border-left-color: var(--crit); } .flag-crit .icon { color: var(--crit); }
.flag-warn { border-left-color: var(--warn); } .flag-warn .icon { color: var(--warn); }
.flag-info { border-left-color: var(--info); } .flag-info .icon { color: var(--info); }
.flag-group { white-space: nowrap; }
.mss-table { font-size: 13.5px; }
.mss-table thead th { position: sticky; top: 0; z-index: 1; }
.mss-table th[scope=row] { min-width: 128px; }
.mss-table th, .mss-table td { padding: 6px 6px; }
.mss-group th { background: var(--accent-soft); color: var(--accent-text); font-size: 14px; }
.mss-cell { min-width: 96px; max-width: 200px; }
.mss-svc { display: grid; gap: 1px; text-decoration: none; color: inherit; padding: 3px 5px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); margin-bottom: 4px; }
.mss-svc:hover { border-color: var(--accent); background: var(--accent-soft); }
.mss-line { display: block; line-height: 1.3; }
.mss-more, .mss-tag { font-size: 12px; color: var(--muted); }
.mss-tag { color: var(--accent-text); }
.mss-adhoc td { background: var(--adhoc-soft); padding-top: 4px; padding-bottom: 4px; font-size: 13px; }
.mss-adhoc-item + .mss-adhoc-item { margin-top: 3px; }
.mss-table tfoot th, .mss-table tfoot td { background: var(--surface-2); font-weight: 700; }
.narrow-panel { max-width: 520px; }
.rs-date { min-height: 30px; padding: 3px 6px; border: 1px solid var(--line-strong); border-radius: var(--radius); }
.rs-head { margin: 10px 0 8px; }
.rs-title { margin: 0 0 2px; font-size: 19px; }
.rs-holidays { margin: 6px 0 10px; }
.rs-table td { vertical-align: top; }
.rs-time { font-weight: 700; font-variant-numeric: tabular-nums; width: 70px; }
.rs-table tr.rs-next td { background: var(--surface-2); }
.rs-done { display: none; }
.rs-site h3 { margin: 8px 0 4px; font-size: 16px; }
.print-only { display: none; }

@page { size: A4 portrait; margin: 14mm 10mm 16mm;
  @top-center { content: "SENSITIVE"; color: #c00000; font: 700 12pt Calibri, Arial, sans-serif; }
  @bottom-center { content: "SENSITIVE"; color: #c00000; font: 700 12pt Calibri, Arial, sans-serif; }
  @bottom-right { content: "Page " counter(page) " of " counter(pages); font: 9pt Calibri, Arial, sans-serif; color: #555; } }
@media print {
  html, body, .shell, .main { background: #fff !important; }
  .topbar, .sidebar, .no-print, .toast, .crumbs, .flags { display: none !important; }
  .layout { display: block; }
  .main { padding: 0; }
  .print-only { display: inline !important; }
  .rs-org { display: block !important; font-size: 10pt; color: #555; }
  .rs-title { font-size: 14pt; }
  .table-wrap { overflow: visible; border: 0; background: #fff !important; }
  .table, .rs-table td { background: #fff; }
  .rs-table tr.rs-next td { background: #f2f2f2 !important; }
  .rs-table { font-size: 9.5pt; width: 100%; border-collapse: collapse; }
  .rs-table th, .rs-table td { padding: 3px 5px; border-bottom: 1px solid #bbb; }
  .rs-table thead { display: table-header-group; }
  .rs-table tr { break-inside: avoid; }
  .rs-done { display: table-cell; width: 46px; text-align: center; }
  .rs-site-col { width: 34mm; }
  .rs-time { width: 16mm; }
  .rs-box { display: inline-block; width: 13px; height: 13px; border: 1px solid #333; }
  .rs-site { break-inside: avoid-page; }
  a { color: inherit !important; text-decoration: none !important; }
  .pill { border: 1px solid #666 !important; background: #fff !important; color: #000 !important; }
  .notice { border: 1px solid #999 !important; background: #fff !important; }
}
.rs-group-title { margin: 14px 0 4px; padding: 6px 10px; background: var(--accent-soft); color: var(--accent-text); border-radius: var(--radius); font-size: 15px; }
.rs-site h4 { margin: 8px 0 4px; font-size: 15px; }
@media print { .rs-group-title { background: #eee !important; color: #000 !important; } .rs-group { break-inside: auto; } }

/* ---------- Events, Control room, areas ---------- */
.map-shapes { position: absolute; inset: 0; pointer-events: none; z-index: 3; }
.map-shape-label { font: 700 12px Calibri, Arial, sans-serif; fill: #1b2530; paint-order: stroke; stroke: #fff; stroke-width: 3px; }
.map-draw { position: absolute; left: 50px; right: 10px; bottom: 26px; z-index: 7; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; background: rgba(22,49,77,.92); color: #fff; padding: 6px 10px; border-radius: var(--radius); font-size: 13px; }
.map-draw .map-btn { font-size: 13px; padding: 0 10px; height: 28px; }
.map-draw .map-btn:disabled { opacity: .5; cursor: default; }
.sensitive-banner { color: #c00000; font-weight: 700; letter-spacing: .12em; text-align: center; border: 2px solid #c00000; border-radius: var(--radius); padding: 4px 8px; margin: 0 0 12px; background: #fff5f5; }
.sensitive-banner span { letter-spacing: 0; font-weight: 400; }
.risk-key { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 13px; color: var(--muted); margin: 0 0 12px; }
.place-chips { list-style: none; margin: 0 0 8px; padding: 0; display: grid; gap: 4px; }
.place-chips li { display: flex; justify-content: space-between; gap: 10px; padding: 5px 9px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-2); }
.place-pickers { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 8px 14px; }
.place-add { display: flex; gap: 6px; }
.place-add select, .place-add input { flex: 1; min-width: 0; min-height: 32px; border: 1px solid var(--line-strong); border-radius: var(--radius); padding: 3px 6px; background: var(--surface); }
.num-input { width: 90px; min-height: 30px; border: 1px solid var(--line-strong); border-radius: var(--radius); padding: 3px 6px; }
.advice { border-left: 4px solid var(--warn); background: var(--warn-soft); padding: 6px 10px; border-radius: var(--radius); margin: 8px 0; }
.ev-flags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.ev-flag { font-size: 12px; font-weight: 700; text-decoration: none; padding: 1px 7px; border-radius: 3px; border: 1px solid; }
.ev-flag-routine { color: var(--muted); border-color: var(--line-strong); background: var(--surface-2); }
.ev-flag-low { color: var(--accent-text); border-color: var(--info); background: var(--info-soft); }
.ev-flag-medium { color: var(--warn); border-color: var(--warn); background: var(--warn-soft); }
.ev-flag-high { color: #fff; border-color: var(--crit); background: var(--crit); }
.rs-events { border: 2px solid var(--crit); border-radius: var(--radius); padding: 8px 12px; margin: 6px 0 12px; background: var(--surface); }
.rs-events h3 { margin: 0 0 6px; font-size: 16px; color: var(--crit); }
.rs-event-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.rs-event { border-left: 4px solid var(--line-strong); padding: 2px 0 2px 10px; }
.rs-event-high { border-left-color: var(--crit); } .rs-event-medium { border-left-color: var(--warn); } .rs-event-low { border-left-color: var(--info); }
@media print {
  .rs-events { border: 2px solid #c00000 !important; break-inside: auto; }
  .rs-event { break-inside: avoid; }
  .ev-flag { border: 1px solid #333 !important; color: #000 !important; background: #fff !important; }
  .ev-flag-high { border-width: 2px !important; }
}
.columns-3 { display: grid; grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr)); gap: 2px 24px; }

/* Reports (Phase 8) */
.report-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.report-card { display: block; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; color: inherit; text-decoration: none; }
.report-card:hover { border-color: var(--accent); }
.report-card:focus-visible { outline: none; box-shadow: var(--focus); }
.report-card-head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; color: var(--accent-text); }
.report-card p { margin: 6px 0 0; }
.report-form .report-period { display: contents; }
.report-form .report-actions { align-self: end; margin-bottom: 10px; }
.report-downloads { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 0 0 16px; }
.report-preview { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; }
.report-title { margin: 0; font-size: 22px; }
.report-subtitle { color: var(--ink-2); font-size: 15px; }
.report-summary { display: flex; flex-wrap: wrap; gap: 8px; }
.report-figure { background: var(--surface-2); border-radius: var(--radius); padding: 8px 14px; min-width: 150px; display: grid; gap: 2px; }
.report-figure span { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; }
.report-figure strong { font-size: 18px; font-variant-numeric: tabular-nums; }
.report-table { table-layout: fixed; width: 100%; }
.report-table td { vertical-align: top; overflow-wrap: break-word; hyphens: auto; }
.report-table thead th { white-space: normal; overflow-wrap: break-word; vertical-align: bottom; }
.report-table th, .report-table td { padding: 7px 8px; font-size: 13px; }
.report-table .num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.report-group td { background: var(--surface-2); border-top: 1px solid var(--line-strong); }
.report-subtotal td { font-weight: 700; border-top: 1px solid var(--line-strong); }
.report-total td { font-weight: 700; background: var(--surface-2); border-top: 2px solid var(--ink-2); }
.report-check { width: 56px; text-align: center; }
.report-check .rs-box { display: inline-block; width: 13px; height: 13px; border: 1px solid var(--ink-2); }
.risk-high-text { color: var(--crit); font-weight: 700; }
.official-panel { margin-bottom: 14px; }
.official-head { display: flex; gap: 16px; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; }
.official-head h2 { margin: 0 0 4px; }
.official-head p { margin: 2px 0; max-width: 80ch; }

/* Help & guides (Phase 10) */
.guide-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.guide-card { display: flex; flex-direction: column; gap: 6px; margin: 0; }
.guide-card h2 { margin: 0; font-size: 18px; }
.guide-card h2 a { color: inherit; text-decoration: none; }
.guide-card h2 a:hover { color: var(--accent); }
.guide-card p { flex: 1; margin: 0 0 6px; }
.guide-for { text-transform: uppercase; letter-spacing: .06em; font-size: 12px; }
.help-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; }
.help-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 28px; align-items: start; }
.help-toc { position: sticky; top: 12px; display: flex; flex-direction: column; gap: 2px; }
.help-toc a { display: block; padding: 5px 10px; border-radius: var(--radius); color: var(--ink-2); text-decoration: none; font-size: 14px; }
.help-toc a:hover { background: var(--surface-2); }
.help-toc a.current { background: var(--accent-soft); color: var(--accent-text); }
.help-article { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px 32px 32px; min-width: 0; }
@media (max-width: 900px) { .help-layout { grid-template-columns: minmax(0, 1fr); } .help-toc { position: static; } }
.help-article, .help-print { line-height: 1.55; }
.help-article h1 { font-size: 28px; margin: 0 0 12px; }
.help-article h2 { font-size: 21px; margin: 32px 0 8px; padding-top: 14px; border-top: 1px solid var(--line); }
.help-article h3 { font-size: 17px; margin: 22px 0 6px; }
.help-article p, .help-article li { max-width: 78ch; }
.help-article ol, .help-article ul { padding-left: 24px; margin: 6px 0 12px; }
.help-article li { margin: 4px 0; }
.help-article code { font-family: var(--mono); background: var(--surface-2); padding: 1px 5px; border-radius: 3px; font-size: 13.5px; }
.help-article hr { border: 0; border-top: 1px solid var(--line); margin: 24px 0; }
.help-figure { margin: 14px 0 20px; }
.help-figure img { display: block; max-width: 100%; height: auto; border: 1px solid var(--line-strong); border-radius: var(--radius); box-shadow: 0 2px 10px rgba(15, 25, 40, .10); }
.help-figure figcaption { font-size: 13px; color: var(--muted); margin-top: 6px; }
.help-note { background: var(--info-soft); border-left: 4px solid var(--info); border-radius: var(--radius); padding: 10px 14px; margin: 12px 0; }
.help-note p { margin: 0; }
.help-warn { background: var(--warn-soft); border-left-color: var(--warn); }
.help-table { overflow-x: auto; margin: 10px 0 16px; }
.help-table table { border-collapse: collapse; width: 100%; font-size: 14px; }
.help-table th, .help-table td { text-align: left; vertical-align: top; padding: 7px 10px; border: 1px solid var(--line); }
.help-table th { background: var(--surface-2); }
.help-checklist { list-style: none; padding-left: 0 !important; }
.help-checklist li { display: flex; gap: 10px; align-items: flex-start; padding: 6px 0; border-bottom: 1px dashed var(--line); max-width: none !important; }
.help-box { flex: none; width: 16px; height: 16px; margin-top: 3px; border: 1.5px solid var(--ink-2); border-radius: 2px; }
.help-table td:empty { height: 2.2em; }
.help-article .help-figure img[src*="inst-"] { max-width: 600px; }
