:root {
  color-scheme: light;
  --ink: #142522;
  --muted: #667571;
  --soft: #eef3f1;
  --canvas: #f5f7f6;
  --surface: #ffffff;
  --line: #dce5e2;
  --brand: #123c37;
  --brand-2: #1e5b52;
  --gold: #c79538;
  --gold-soft: #f6ead2;
  --normal: #137a5b;
  --normal-soft: #e2f4ed;
  --attention: #9b6816;
  --attention-soft: #fff1d5;
  --issue: #af4d28;
  --issue-soft: #ffeadf;
  --emergency: #ad2638;
  --emergency-soft: #fee8eb;
  --unknown: #66736f;
  --unknown-soft: #edf0ef;
  --shadow: 0 16px 40px rgba(24, 52, 47, 0.09);
  --shadow-soft: 0 7px 20px rgba(24, 52, 47, 0.06);
  --radius: 18px;
  --radius-sm: 11px;
  --focus: 0 0 0 3px rgba(199, 149, 56, 0.4);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --ink: #edf5f2;
  --muted: #a8b7b2;
  --soft: #18312d;
  --canvas: #0d1c19;
  --surface: #132824;
  --line: #29433e;
  --brand: #0b2420;
  --brand-2: #79b9aa;
  --gold-soft: #3e311d;
  --normal-soft: #153b31;
  --attention-soft: #3f331c;
  --issue-soft: #48271e;
  --emergency-soft: #491f27;
  --unknown-soft: #283632;
  --shadow: 0 16px 40px rgba(0, 0, 0, 0.24);
  --shadow-soft: 0 7px 20px rgba(0, 0, 0, 0.18);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--canvas); color: var(--ink); min-width: 320px; }
button, input, select, textarea { font: inherit; }
button, a, select, input, textarea { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible { outline: none; box-shadow: var(--focus); }
button:disabled { cursor: not-allowed; opacity: 0.55; }
a { color: inherit; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 8px; font-size: clamp(1.85rem, 2.8vw, 3rem); line-height: 1.04; letter-spacing: -0.045em; }
h2 { margin-bottom: 6px; font-size: 1.22rem; letter-spacing: -0.025em; }
h3 { margin-bottom: 4px; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.skip-link { position: fixed; z-index: 1000; top: 12px; left: 12px; transform: translateY(-150%); background: var(--surface); padding: 12px 16px; border-radius: 8px; }
.skip-link:focus { transform: translateY(0); }
.muted { color: var(--muted); }
.eyebrow { margin: 0 0 7px; color: var(--brand-2); font-size: 0.72rem; font-weight: 800; letter-spacing: 0.13em; text-transform: uppercase; }
.icon { display: inline-grid; width: 1.2em; height: 1.2em; place-items: center; font-weight: 900; line-height: 1; }

.boot-screen, .message-page { min-height: 100vh; display: grid; place-content: center; justify-items: center; padding: 32px; text-align: center; }
.boot-screen p, .message-page p { color: var(--muted); max-width: 580px; }
.message-page .button { margin: 6px; }
.brand-emblem { display: grid; width: 42px; height: 42px; place-items: center; border-radius: 13px 13px 13px 4px; background: linear-gradient(145deg, var(--gold), #e3c06d); color: #16342e; font-weight: 900; box-shadow: 0 8px 22px rgba(199, 149, 56, 0.3); }
.brand-emblem + h1 { margin-top: 18px; }
.brand-lockup { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.brand-lockup > div:last-child { display: grid; gap: 1px; }
.brand-lockup strong { font-size: 1rem; }
.brand-lockup span { color: var(--muted); font-size: 0.76rem; }
.brand-lockup.large .brand-emblem { width: 54px; height: 54px; font-size: 1.3rem; }
.brand-lockup.large strong { font-size: 1.22rem; }
.brand-lockup.large span { color: rgba(255,255,255,.66); }
.demo-ribbon { display: inline-flex; width: fit-content; padding: 6px 10px; border: 1px solid rgba(216, 170, 82, 0.45); border-radius: 999px; background: rgba(216, 170, 82, 0.12); color: #f2ce86; font-size: 0.68rem; font-weight: 900; letter-spacing: 0.12em; }
.demo-ribbon.compact { margin: 22px 0 24px; color: var(--gold); background: var(--gold-soft); border-color: transparent; }

.login-page { min-height: 100vh; display: grid; grid-template-columns: minmax(360px, 1.05fr) minmax(420px, .95fr); background: var(--surface); }
.login-brand { position: relative; display: flex; flex-direction: column; justify-content: center; min-height: 100%; padding: clamp(48px, 8vw, 130px); overflow: hidden; color: #f8fbfa; background: radial-gradient(circle at 12% 15%, rgba(210, 171, 91, .23), transparent 26%), radial-gradient(circle at 80% 80%, rgba(86, 155, 140, .2), transparent 30%), linear-gradient(145deg, #0c2d29, #174a43); }
.login-brand::after { content: ""; position: absolute; right: -18%; bottom: -20%; width: 65%; aspect-ratio: 1; border: 1px solid rgba(255,255,255,.08); border-radius: 50%; box-shadow: 0 0 0 50px rgba(255,255,255,.025), 0 0 0 100px rgba(255,255,255,.018); }
.login-brand .brand-lockup, .login-brand .demo-ribbon, .login-brand h1, .login-brand > p, .safety-note { position: relative; z-index: 1; }
.login-brand .demo-ribbon { margin: 48px 0 20px; }
.login-brand h1 { max-width: 690px; font-size: clamp(2.8rem, 5.6vw, 5.8rem); letter-spacing: -0.06em; }
.login-brand > p { max-width: 660px; color: rgba(248,251,250,.73); font-size: 1.08rem; line-height: 1.7; }
.safety-note { display: grid; gap: 5px; max-width: 650px; margin-top: 42px; padding: 16px 18px; border: 1px solid rgba(255,255,255,.11); border-radius: 12px; background: rgba(0,0,0,.12); }
.safety-note span { color: rgba(248,251,250,.69); font-size: .83rem; line-height: 1.5; }
.login-panel { display: flex; flex-direction: column; justify-content: center; width: min(520px, 100%); margin: auto; padding: 48px; }
.login-panel h2 { margin-bottom: 9px; font-size: 2rem; }
.stack-form { display: grid; gap: 10px; margin-top: 28px; }
.stack-form label, .settings-form label, .dialog-form label { font-size: .76rem; font-weight: 800; color: var(--ink); }
input, select, textarea { width: 100%; min-height: 46px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); padding: 11px 13px; }
textarea { min-height: 100px; resize: vertical; line-height: 1.5; }
label > input, label > select, label > textarea { display: block; margin-top: 7px; }
.form-error { margin-top: 20px; padding: 13px 15px; border-left: 4px solid var(--emergency); border-radius: 9px; background: var(--emergency-soft); color: var(--emergency); font-size: .88rem; font-weight: 700; }
.account-reference { margin-top: 24px; color: var(--muted); font-size: .82rem; }
.account-reference summary { cursor: pointer; font-weight: 800; color: var(--ink); }
.account-reference ul { display: grid; gap: 5px; padding: 10px 0; list-style: none; }
.account-reference li { display: flex; justify-content: space-between; gap: 12px; }
.account-reference code { color: var(--brand-2); }
.system-chip { display: flex; align-items: center; gap: 8px; width: fit-content; margin-top: 28px; color: var(--muted); font-size: .75rem; }
.system-chip > span, .connection-state > span { width: 8px; height: 8px; border-radius: 50%; background: var(--unknown); }
.system-chip.healthy > span, .connection-state.connected > span { background: var(--normal); box-shadow: 0 0 0 4px var(--normal-soft); }
.system-chip.degraded > span, .connection-state.reconnecting > span { background: var(--attention); box-shadow: 0 0 0 4px var(--attention-soft); }

.button { display: inline-flex; min-height: 42px; align-items: center; justify-content: center; gap: 8px; border: 1px solid transparent; border-radius: 10px; padding: 9px 14px; cursor: pointer; font-weight: 800; font-size: .82rem; text-decoration: none; transition: transform .16s ease, background-color .16s ease, border-color .16s ease; }
.button:hover:not(:disabled) { transform: translateY(-1px); }
.button.primary { background: var(--brand); color: #fff; }
:root[data-theme="dark"] .button.primary { background: #3f8c7e; }
.button.secondary { border-color: var(--line); background: var(--surface); }
.button.ghost { background: transparent; }
.button.subtle { min-height: 36px; background: var(--soft); padding: 7px 10px; }
.button.large { min-height: 52px; padding: 13px 17px; }
.button.full { width: 100%; }
.button.emergency-action { background: var(--emergency); color: #fff; }
.button.all-clear { background: #fff; color: var(--emergency); min-height: 48px; }
.button.acknowledge { background: #fff; color: #6b3a00; min-height: 48px; }
.button.warning { background: var(--attention-soft); color: var(--attention); border-color: #e6ca91; }
.button.assistance { background: var(--brand); color: #fff; }
.button.medical { background: #24517c; color: #fff; }
.danger-text { color: var(--emergency) !important; }
.text-button { border: 0; background: transparent; color: var(--brand-2); padding: 0; cursor: pointer; font-weight: 800; font-size: .78rem; text-decoration: underline; text-underline-offset: 3px; }
.icon-button, .mobile-menu { display: inline-grid; min-width: 42px; min-height: 42px; place-items: center; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); cursor: pointer; }

.app-shell { display: grid; grid-template-columns: 244px minmax(0, 1fr); min-height: 100vh; }
.app-rail { position: sticky; top: 0; display: flex; flex-direction: column; height: 100vh; padding: 24px 18px; border-right: 1px solid var(--line); background: var(--surface); z-index: 20; }
.app-rail nav { display: grid; gap: 4px; }
.app-rail nav a { display: flex; align-items: center; gap: 11px; min-height: 43px; padding: 9px 11px; border-radius: 10px; color: var(--muted); text-decoration: none; font-size: .83rem; font-weight: 700; }
.app-rail nav a:hover, .app-rail nav a.active { background: var(--soft); color: var(--brand-2); }
.rail-spacer { flex: 1; }
.user-card { display: flex; gap: 10px; align-items: center; padding-top: 18px; border-top: 1px solid var(--line); }
.user-card > div:last-child { display: grid; gap: 2px; min-width: 0; }
.user-card strong, .user-card span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-card strong { font-size: .8rem; }
.user-card span { color: var(--muted); font-size: .68rem; }
.avatar { display: grid; flex: 0 0 auto; width: 38px; height: 38px; place-items: center; border-radius: 12px; background: var(--gold-soft); color: var(--attention); font-size: .72rem; font-weight: 900; }
.avatar.small { width: 30px; height: 30px; border-radius: 9px; font-size: .62rem; }
.avatar.large { width: 54px; height: 54px; border-radius: 16px; font-size: .92rem; }
.app-stage { min-width: 0; }
.app-header { position: sticky; top: 0; z-index: 15; display: flex; min-height: 70px; align-items: center; justify-content: space-between; gap: 18px; padding: 10px 28px; border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(12px); }
.header-context { display: grid; gap: 1px; }
.header-context strong { font-size: .82rem; }
.header-context span { color: var(--muted); font-size: .7rem; }
.header-actions { display: flex; align-items: center; gap: 9px; }
.header-demo { padding: 5px 8px; border-radius: 999px; background: var(--gold-soft); color: var(--gold); font-size: .6rem; font-weight: 900; letter-spacing: .08em; white-space: nowrap; }
.connection-state { display: inline-flex; align-items: center; gap: 8px; padding: 7px 10px; border-radius: 999px; background: var(--soft); color: var(--muted); font-size: .7rem; font-weight: 800; }
.connection-state.offline > span { background: var(--emergency); }
.role-switcher { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: .68rem; font-weight: 800; }
.role-switcher select { width: auto; min-height: 38px; margin: 0; padding: 6px 30px 6px 10px; }
.mobile-menu { display: none; }
.main-workspace { width: min(1660px, 100%); margin: 0 auto; padding: 34px 34px 64px; }
.page-title { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin-bottom: 26px; }
.page-title > div:first-child { max-width: 760px; }
.page-title p:last-child { margin-bottom: 0; color: var(--muted); line-height: 1.55; }
.page-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 9px; }

.status-pill { display: inline-flex; align-items: center; gap: 6px; width: fit-content; border-radius: 999px; padding: 5px 9px; font-size: .66rem; font-weight: 900; line-height: 1; white-space: nowrap; }
.status-pill.normal { background: var(--normal-soft); color: var(--normal); }
.status-pill.attention { background: var(--attention-soft); color: var(--attention); }
.status-pill.issue { background: var(--issue-soft); color: var(--issue); }
.status-pill.emergency { background: var(--emergency-soft); color: var(--emergency); }
.status-pill.unknown { background: var(--unknown-soft); color: var(--unknown); }
.lockdown-panel { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 22px; padding: 20px 22px; border-radius: var(--radius); background: linear-gradient(120deg, #8f1f30, #bd3445); color: #fff; box-shadow: 0 14px 30px rgba(173, 38, 56, .22); }
.lockdown-panel .eyebrow { color: #ffd7dd; }
.lockdown-panel h2 { margin-bottom: 5px; font-size: 1.5rem; }
.lockdown-panel p:last-child { margin: 0; color: #ffe9ec; }
.lockdown-command { display: flex; align-items: center; gap: 18px; }
.lockdown-acknowledgements { display: grid; max-width: 440px; gap: 3px; text-align: right; }
.lockdown-acknowledgements span { color: #ffe9ec; font-size: .8rem; line-height: 1.35; }
.lockdown-active .app-header { border-bottom-color: #c23b4e; }

.readiness-grid { display: grid; grid-template-columns: repeat(6, minmax(130px, 1fr)); gap: 12px; margin-bottom: 22px; }
.readiness-card { display: grid; gap: 5px; min-height: 116px; text-align: left; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); padding: 16px; cursor: pointer; box-shadow: var(--shadow-soft); }
.readiness-card:hover { border-color: #a9c1bb; }
.readiness-card > span { color: var(--muted); font-size: .72rem; font-weight: 700; }
.readiness-card strong { font-size: 1.65rem; letter-spacing: -.04em; }
.readiness-card small { color: var(--muted); font-size: .67rem; }
.readiness-card.complete strong { color: var(--normal); }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(330px, .8fr); gap: 18px; align-items: start; }
.dashboard-primary, .dashboard-secondary { display: grid; gap: 18px; }
.dashboard-secondary { position: sticky; top: 90px; }
.panel { margin-bottom: 18px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); padding: 20px; box-shadow: var(--shadow-soft); scroll-margin-top: 90px; }
.panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.panel-heading h2 { margin: 0; }
.panel-count, .integration-note { color: var(--muted); font-size: .7rem; font-weight: 700; }
.map-panel { padding-bottom: 14px; }
.map-legend { display: flex; flex-wrap: wrap; gap: 11px; color: var(--muted); font-size: .66rem; }
.map-legend span { display: flex; align-items: center; gap: 5px; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; }
.dot.normal { background: var(--normal); }.dot.attention { background: var(--attention); }.dot.emergency { background: var(--emergency); }
.facility-map { position: relative; min-height: 420px; overflow: hidden; border: 1px solid var(--line); border-radius: 14px; background: #eef0ef; }
.facility-map > img { display: block; width: 100%; height: 100%; min-height: 420px; object-fit: contain; opacity: .88; }
:root[data-theme="dark"] .facility-map > img { filter: invert(.86) hue-rotate(110deg); opacity: .65; }
.map-marker { position: absolute; transform: translate(-50%, -50%); display: grid; width: 25px; height: 25px; place-items: center; border: 2px solid #fff; border-radius: 50%; background: var(--attention); color: #fff; cursor: pointer; box-shadow: 0 4px 12px rgba(0,0,0,.24); z-index: 2; }
.map-marker > span { font-size: .58rem; font-weight: 900; }
.map-marker > strong { position: absolute; left: 50%; bottom: calc(100% + 7px); display: none; min-width: max-content; transform: translateX(-50%); border-radius: 6px; background: #102c27; color: #fff; padding: 5px 7px; font-size: .62rem; }
.map-marker:hover, .map-marker:focus-visible { z-index: 5; }
.map-marker:hover > strong, .map-marker:focus-visible > strong { display: block; }
.map-marker.ready, .map-marker.secure, .map-marker.clear, .map-marker.online, .map-marker.occupied { background: var(--normal); }
.map-marker.issue, .map-marker.offline { background: var(--issue); }
.map-marker.emergency { width: 31px; height: 31px; background: var(--emergency); }
.map-marker.event-active { background: var(--emergency); box-shadow: 0 4px 14px rgba(116, 15, 29, .45); z-index: 4; }
.map-marker.event-active::before { content: ""; position: absolute; inset: -8px; border: 3px solid rgba(173, 38, 56, .78); border-radius: 50%; pointer-events: none; animation: map-event-halo 1.35s ease-out infinite; }
.map-marker.camera { width: 19px; height: 19px; border-radius: 5px; background: #315f83; }
.map-marker.camera.event-active { background: var(--emergency); }
.map-marker.classroom { border-radius: 6px; }

.incident-list { display: grid; gap: 8px; }
.incident-row { display: flex; width: 100%; align-items: center; justify-content: space-between; gap: 14px; text-align: left; border: 1px solid var(--line); border-left-width: 4px; border-radius: 11px; background: var(--surface); padding: 13px 14px; cursor: pointer; }
.incident-row.priority-emergency { border-left-color: var(--emergency); }.incident-row.priority-high { border-left-color: var(--issue); }.incident-row.priority-medium { border-left-color: var(--attention); }
.incident-row > div:first-child { display: grid; gap: 4px; min-width: 0; }
.incident-row > div:first-child span { color: var(--muted); font-size: .68rem; font-weight: 800; text-transform: uppercase; }
.incident-row > div:first-child strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .83rem; }
.incident-row > div:last-child { display: grid; justify-items: end; gap: 5px; }
.incident-row small { color: var(--muted); font-size: .65rem; }
.empty-state { display: grid; justify-items: center; gap: 7px; padding: 34px 18px; text-align: center; color: var(--muted); }
.empty-state .icon { color: var(--normal); font-size: 1.6rem; }
.empty-state span { max-width: 420px; font-size: .78rem; line-height: 1.5; }
.empty-state.small { padding: 18px; }

.data-table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: .78rem; }
.data-table th { color: var(--muted); text-align: left; font-size: .64rem; letter-spacing: .06em; text-transform: uppercase; }
.data-table th, .data-table td { padding: 11px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.data-table td > strong, .data-table td > small { display: block; }
.data-table td > small { margin-top: 3px; color: var(--muted); font-size: .66rem; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.checkpoint-grid { display: grid; grid-template-columns: repeat(4, minmax(200px, 1fr)); gap: 12px; }
.checkpoint-card { border: 1px solid var(--line); border-radius: 14px; padding: 15px; }
.checkpoint-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.checkpoint-symbol { display: grid; width: 33px; height: 33px; place-items: center; border-radius: 9px; background: var(--soft); color: var(--brand-2); }
.checkpoint-card h3 { font-size: .92rem; }
.checkpoint-card > p { margin-bottom: 14px; color: var(--muted); font-size: .7rem; }
.checkpoint-card dl { display: grid; gap: 8px; margin: 0; }
.checkpoint-card dl > div { display: flex; justify-content: space-between; gap: 10px; }
.checkpoint-card dt { color: var(--muted); font-size: .66rem; }.checkpoint-card dd { margin: 0; text-align: right; font-size: .68rem; font-weight: 700; }
.card-actions { display: flex; gap: 7px; margin-top: 15px; padding-top: 12px; border-top: 1px solid var(--line); }
.card-actions .button { flex: 1; }

.message-feed { display: grid; gap: 13px; max-height: 410px; overflow-y: auto; }
.message-item { display: grid; grid-template-columns: auto 1fr; gap: 9px; }
.message-item > div:last-child > div { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 5px; }
.message-item strong { font-size: .75rem; }.message-item span { color: var(--muted); font-size: .62rem; }
.message-item p { margin: 5px 0; color: var(--ink); font-size: .76rem; line-height: 1.45; }
.acknowledged { color: var(--normal); font-weight: 800; }
.message-compose { display: grid; grid-template-columns: 145px minmax(0, 1fr) auto; gap: 7px; margin-top: 15px; padding-top: 13px; border-top: 1px solid var(--line); }
.message-compose input, .message-compose select { min-height: 40px; margin: 0; padding: 8px 9px; font-size: .72rem; }
.camera-grid { display: grid; grid-template-columns: repeat(3, minmax(240px, 1fr)); gap: 12px; }
.camera-card { display: grid; grid-template-columns: 74px minmax(0, 1fr) auto; align-items: center; gap: 12px; border: 1px solid var(--line); border-radius: 13px; padding: 10px; }
.camera-placeholder { display: grid; height: 55px; place-items: center; border-radius: 9px; background: linear-gradient(145deg, #143b42, #0d242a); color: #8dc3c5; overflow: hidden; }
.camera-placeholder span { align-self: end; color: #c2dbda; font-size: .46rem; letter-spacing: .08em; }
.camera-card > div:nth-child(2) { display: grid; gap: 3px; }.camera-card > div:nth-child(2) strong { font-size: .78rem; }.camera-card > div:nth-child(2) span { color: var(--muted); font-size: .66rem; }
.camera-card > div:last-child { display: grid; justify-items: end; gap: 5px; }.camera-card small { color: var(--muted); font-size: .6rem; }
.timeline { display: grid; gap: 0; margin: 0; padding: 0; list-style: none; }
.timeline li { display: grid; grid-template-columns: 72px 16px 1fr; gap: 8px; min-height: 58px; }
.timeline time { color: var(--muted); font-size: .64rem; padding-top: 2px; }
.timeline-dot { position: relative; width: 9px; height: 9px; margin-top: 3px; border-radius: 50%; background: var(--brand-2); }
.timeline-dot::after { content: ""; position: absolute; top: 12px; bottom: -45px; left: 4px; width: 1px; background: var(--line); }
.timeline li:last-child .timeline-dot::after { display: none; }
.timeline-dot.lockdown, .timeline-dot.incident { background: var(--emergency); }
.timeline strong { font-size: .74rem; }.timeline p { margin: 3px 0; color: var(--muted); font-size: .68rem; line-height: 1.4; }.timeline small { color: var(--muted); font-size: .6rem; }

.mobile-workspace { max-width: 760px; margin: 0 auto; }
.mobile-identity { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 13px; margin-bottom: 22px; }
.mobile-identity h1 { margin: 0 0 3px; font-size: 1.55rem; }
.mobile-identity p:last-child { margin: 0; color: var(--muted); font-size: .75rem; }
.mobile-status-card { position: relative; overflow: hidden; margin-bottom: 14px; border-radius: 20px; padding: 22px; background: linear-gradient(135deg, var(--brand), #23685f); color: #fff; box-shadow: var(--shadow); }
.mobile-status-card.issue, .mobile-status-card.emergency { background: linear-gradient(135deg, #8b1f31, #c33b4d); }
.mobile-status-card > p { margin-bottom: 14px; color: rgba(255,255,255,.72); font-size: .7rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.mobile-status-card > div { display: grid; gap: 7px; }.mobile-status-card > div strong { font-size: 1.55rem; }.mobile-status-card > div > span:last-child { color: rgba(255,255,255,.72); font-size: .72rem; }
.mobile-card { margin-bottom: 14px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); padding: 18px; box-shadow: var(--shadow-soft); }
.mobile-checklist { display: grid; gap: 8px; margin-bottom: 14px; }
.check-control { display: grid; grid-template-columns: 36px 1fr auto; align-items: center; gap: 9px; min-height: 57px; text-align: left; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); padding: 9px 12px; cursor: pointer; }
.check-control > span { display: grid; width: 30px; height: 30px; place-items: center; border-radius: 9px; background: var(--unknown-soft); color: var(--unknown); font-weight: 900; }
.check-control.checked > span { background: var(--normal-soft); color: var(--normal); }
.check-control strong { font-size: .8rem; }.check-control small { color: var(--muted); font-size: .65rem; }
.need-help h2 { margin-bottom: 14px; }.need-help > small { display: block; margin-top: 11px; color: var(--muted); line-height: 1.45; }
.emergency-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.emergency-grid .button { min-height: 55px; }
.emergency-lockdown-control { display: grid; gap: 8px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.emergency-lockdown-control small { color: var(--muted); line-height: 1.45; }
.guard-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.claim-row { display: flex; width: 100%; align-items: center; justify-content: space-between; gap: 10px; border: 0; border-top: 1px solid var(--line); background: transparent; padding: 13px 2px; cursor: pointer; }
.claim-row:first-of-type { border-top: 0; }.claim-row > div { display: flex; gap: 10px; align-items: center; }.claim-row > div > span { display: grid; gap: 3px; text-align: left; }.claim-row strong { font-size: .78rem; }.claim-row small { color: var(--muted); font-size: .66rem; }.claim-row > span { color: var(--brand-2); font-size: .7rem; font-weight: 800; }
.status-list { display: grid; }.status-list > div { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); font-size: .75rem; }.status-list > div:first-child { border-top: 0; }

.config-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 18px; }
.config-grid article { display: grid; gap: 6px; min-height: 110px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); padding: 16px; }
.config-grid span, .config-grid small { color: var(--muted); font-size: .7rem; }.config-grid strong { font-size: 1.15rem; }
.settings-form { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.settings-form .wide { grid-column: 1 / -1; }.settings-form .button { width: fit-content; }
.detail-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin: 0; }
.detail-grid > div { display: grid; gap: 5px; min-width: 0; }
.detail-grid span, .detail-grid dt { color: var(--muted); font-size: .67rem; }.detail-grid strong, .detail-grid dd { margin: 0; font-size: .8rem; overflow-wrap: anywhere; }
.resource-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 9px; }
.resource-grid > button { display: grid; gap: 6px; text-align: left; border: 1px solid var(--line); border-radius: 11px; background: var(--surface); padding: 12px; cursor: pointer; }
.resource-grid > button:hover { border-color: #9ab9b1; background: var(--soft); }.resource-grid strong { font-size: .76rem; }.resource-grid span:not(.status-pill) { color: var(--muted); font-size: .64rem; }
.persona-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 9px; margin: 16px 0; }.persona-grid .button { display: grid; justify-content: start; text-align: left; }.persona-grid .button span { color: var(--muted); font-size: .65rem; }
.demo-tools { border-color: #dfc892; background: linear-gradient(145deg, var(--surface), var(--gold-soft)); }
.danger-zone { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-top: 20px; padding-top: 18px; border-top: 1px solid rgba(173,38,56,.2); }.danger-zone > div { display: grid; gap: 4px; }.danger-zone span { color: var(--muted); font-size: .72rem; }
.audit-table code { font-size: .68rem; color: var(--brand-2); }

.report-summary { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; margin-bottom: 18px; }
.report-summary article { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); padding: 20px; box-shadow: var(--shadow-soft); }
.report-summary article > div:first-child { display: flex; justify-content: space-between; align-items: center; }.report-summary article > div:first-child > span:last-child { color: var(--muted); font-size: .68rem; }
.report-summary h2 { margin-top: 15px; }.report-summary dl, .report-metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 9px; margin: 15px 0; }
.report-summary dl > div, .report-metrics > div { display: grid; gap: 3px; border-radius: 10px; background: var(--soft); padding: 10px; }.report-summary dt, .report-metrics dt { color: var(--muted); font-size: .61rem; }.report-summary dd, .report-metrics dd { margin: 0; font-size: 1rem; font-weight: 900; }

.offline-banner { position: fixed; z-index: 100; top: 0; left: 0; right: 0; padding: 8px; text-align: center; background: var(--emergency); color: #fff; font-size: .75rem; font-weight: 800; }
.toast-region { position: fixed; z-index: 1000; right: 18px; bottom: 18px; display: grid; gap: 9px; width: min(380px, calc(100vw - 36px)); pointer-events: none; }
.toast { border-left: 4px solid var(--normal); border-radius: 10px; background: var(--surface); color: var(--ink); padding: 13px 15px; box-shadow: 0 16px 45px rgba(0,0,0,.2); font-size: .8rem; font-weight: 700; animation: toast-in .22s ease-out; }
.toast.error { border-left-color: var(--emergency); }
.app-dialog { width: min(680px, calc(100vw - 32px)); max-height: min(850px, calc(100vh - 32px)); border: 0; border-radius: 20px; background: var(--surface); color: var(--ink); padding: 0; box-shadow: 0 30px 90px rgba(0,0,0,.3); }
.app-dialog::backdrop { background: rgba(5, 20, 17, .64); backdrop-filter: blur(3px); }
.dialog-form header { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; padding: 21px 22px 16px; border-bottom: 1px solid var(--line); }
.dialog-form header h2 { margin: 0; font-size: 1.4rem; }.dialog-close { display: grid; width: 36px; height: 36px; place-items: center; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); cursor: pointer; font-size: 1.3rem; }
.dialog-body { display: grid; gap: 14px; max-height: 66vh; overflow-y: auto; padding: 21px 22px; }
.dialog-body > p { margin: 0; color: var(--muted); line-height: 1.55; }.dialog-body fieldset { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; border: 1px solid var(--line); border-radius: 11px; }.dialog-body legend { color: var(--muted); font-size: .7rem; font-weight: 800; }
.dialog-form footer { display: flex; justify-content: flex-end; gap: 9px; padding: 15px 22px; border-top: 1px solid var(--line); }
.warning-callout { display: grid; gap: 4px; border-left: 4px solid var(--attention); border-radius: 9px; background: var(--attention-soft); color: var(--attention); padding: 13px; }.warning-callout span { font-size: .75rem; line-height: 1.45; }
.dialog-camera { height: 130px; font-size: 2rem; }.incident-summary { display: grid; gap: 12px; }.incident-summary > div:first-child { display: flex; gap: 7px; }.incident-summary > p { line-height: 1.55; }
.incident-timeline { display: grid; gap: 0; margin: 0; padding: 0; list-style: none; }.incident-timeline li { display: grid; grid-template-columns: 14px 1fr; gap: 10px; min-height: 70px; }.incident-timeline li > span { position: relative; width: 9px; height: 9px; margin-top: 4px; border-radius: 50%; background: var(--brand-2); }.incident-timeline li > span::after { content: ""; position: absolute; top: 12px; bottom: -58px; left: 4px; width: 1px; background: var(--line); }.incident-timeline li:last-child > span::after { display: none; }.incident-timeline strong { font-size: .78rem; }.incident-timeline p { margin: 4px 0; font-size: .74rem; line-height: 1.5; }.incident-timeline small { color: var(--muted); font-size: .64rem; }
.report-dialog-actions { display: flex; gap: 9px; }.print-report > div:first-child { display: flex; align-items: center; justify-content: space-between; gap: 10px; }.print-report > div:first-child > span { color: var(--muted); font-size: .66rem; }.print-report h3 { margin-top: 16px; font-size: 1.5rem; }

@keyframes pulse { 50% { box-shadow: 0 0 0 10px rgba(173,38,56,0); } 0%, 100% { box-shadow: 0 0 0 2px rgba(173,38,56,.32); } }
@keyframes map-event-halo { from { opacity: .95; transform: scale(.72); } to { opacity: 0; transform: scale(1.55); } }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

@media (max-width: 1400px) {
  .readiness-grid { grid-template-columns: repeat(3, 1fr); }
  .checkpoint-grid, .resource-grid { grid-template-columns: repeat(3, 1fr); }
  .camera-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 1120px) {
  .app-shell { grid-template-columns: 82px minmax(0, 1fr); }
  .app-rail { padding: 21px 12px; align-items: center; }
  .app-rail .brand-lockup > div:last-child, .app-rail .demo-ribbon, .app-rail nav a span, .user-card > div:last-child { display: none; }
  .app-rail nav { width: 100%; }.app-rail nav a { justify-content: center; }
  .dashboard-grid { grid-template-columns: 1fr; }.dashboard-secondary { position: static; grid-template-columns: 1fr 1fr; }
  .checkpoint-grid { grid-template-columns: repeat(2, 1fr); }
  .config-grid { grid-template-columns: repeat(2, 1fr); }
  .resource-grid { grid-template-columns: repeat(3, 1fr); }
  .login-brand { padding: 64px; }
}

@media (max-width: 800px) {
  .login-page { grid-template-columns: 1fr; }.login-brand { min-height: 430px; padding: 44px; }.login-brand h1 { font-size: 3rem; }.login-brand .demo-ribbon { margin: 30px 0 15px; }.safety-note { margin-top: 20px; }.login-panel { padding: 42px 28px; }
  .app-shell { display: block; }.app-rail { position: fixed; left: 0; top: 0; width: 270px; height: 100vh; align-items: stretch; transform: translateX(-105%); transition: transform .2s ease; box-shadow: var(--shadow); }.app-rail.open { transform: translateX(0); }.app-rail .brand-lockup > div:last-child, .app-rail .demo-ribbon, .app-rail nav a span, .user-card > div:last-child { display: grid; }.app-rail nav a { justify-content: flex-start; }
  .mobile-menu { display: inline-grid; }.header-context { display: none; }.app-header { padding: 9px 15px; }.main-workspace { padding: 25px 18px 54px; }
  .page-title { display: grid; }.page-actions { justify-content: flex-start; }.readiness-grid { grid-template-columns: repeat(2, 1fr); }
  .dashboard-secondary { grid-template-columns: 1fr; }.facility-map, .facility-map > img { min-height: 330px; }
  .checkpoint-grid, .camera-grid, .resource-grid { grid-template-columns: repeat(2, 1fr); }
  .settings-form { grid-template-columns: 1fr; }.settings-form .wide { grid-column: auto; }
  .persona-grid { grid-template-columns: repeat(2, 1fr); }.detail-grid { grid-template-columns: repeat(2, 1fr); }
  .report-summary { grid-template-columns: 1fr; }.report-summary dl, .report-metrics { grid-template-columns: repeat(2, 1fr); }
  .message-compose { grid-template-columns: 1fr auto; }.message-compose label:first-child { grid-column: 1 / -1; }
  .role-switcher > span { display: none; }
}

@media (max-width: 520px) {
  h1 { font-size: 1.75rem; }.login-brand { min-height: 360px; padding: 30px 24px; }.login-brand h1 { font-size: 2.35rem; }.login-brand > p { font-size: .9rem; line-height: 1.5; }.safety-note { display: none; }.login-panel { padding: 34px 22px; }.login-panel h2 { font-size: 1.6rem; }
  .app-header { min-height: 62px; }.header-actions { gap: 6px; }.header-demo { font-size: 0; }.header-demo::after { content: "DEMO"; font-size: .6rem; }.connection-state { padding: 7px; font-size: 0; }.connection-state > span { margin: 0; }.role-switcher select { max-width: 125px; }.main-workspace { padding: 20px 12px 48px; }
  .page-title { margin-bottom: 18px; }.page-actions { display: grid; grid-template-columns: 1fr 1fr; width: 100%; }.page-actions .button { width: 100%; }.page-actions .status-pill { grid-column: 1 / -1; }
  .readiness-grid { gap: 8px; }.readiness-card { min-height: 102px; padding: 13px; }.readiness-card strong { font-size: 1.4rem; }
  .panel { border-radius: 15px; padding: 15px; }.panel-heading { align-items: center; }.map-legend { display: none; }.facility-map, .facility-map > img { min-height: 260px; }
  .checkpoint-grid, .camera-grid, .resource-grid, .config-grid { grid-template-columns: 1fr; }.camera-card { grid-template-columns: 68px 1fr; }.camera-card > div:last-child { grid-column: 2; justify-items: start; }
  .lockdown-panel { display: grid; padding: 17px; }.lockdown-panel .button { width: 100%; }
  .lockdown-command { display: grid; }.lockdown-acknowledgements { text-align: left; }
  .mobile-identity { grid-template-columns: auto 1fr; }.mobile-identity > div:last-child { grid-column: 1 / -1; }.mobile-identity .status-pill { margin-left: 66px; }
  .mobile-status-card { padding: 19px; }.mobile-card { padding: 15px; }.check-control { min-height: 61px; }.emergency-grid { grid-template-columns: 1fr; }.emergency-grid .button { min-height: 52px; }.guard-actions { grid-template-columns: 1fr; }
  .message-compose { grid-template-columns: 1fr; }.message-compose label:first-child { grid-column: auto; }.message-compose .button { width: 100%; }
  .danger-zone { display: grid; }.persona-grid { grid-template-columns: 1fr; }.detail-grid { grid-template-columns: 1fr 1fr; }
  .incident-row { align-items: flex-start; }.incident-row > div:first-child strong { white-space: normal; }.data-table { min-width: 760px; }
  .app-dialog { width: calc(100vw - 16px); max-height: calc(100vh - 16px); border-radius: 16px; }.dialog-form header, .dialog-body, .dialog-form footer { padding-left: 16px; padding-right: 16px; }.dialog-form footer .button { flex: 1; }.dialog-body fieldset { grid-template-columns: 1fr; }
}

@media (max-width: 380px) {
  .main-workspace { padding-left: 9px; padding-right: 9px; }.readiness-grid { grid-template-columns: 1fr 1fr; }.readiness-card { min-width: 0; }.readiness-card > span, .readiness-card small { font-size: .64rem; }.header-actions .icon-button { min-width: 38px; }.role-switcher select { max-width: 105px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

@media print {
  body { background: #fff; color: #111; }.app-rail, .app-header, .page-actions, .button, .text-button, .connection-state, .demo-tools, .toast-region { display: none !important; }.app-shell { display: block; }.main-workspace { width: 100%; padding: 0; }.panel, .report-summary article { box-shadow: none; break-inside: avoid; }.page-title { display: block; }.app-dialog[open] { position: static; width: 100%; max-height: none; box-shadow: none; }.app-dialog::backdrop, .dialog-form header, .dialog-form footer { display: none; }.dialog-body { max-height: none; overflow: visible; }
}
