:root {
  color-scheme: light;
  --navy-950: #061522;
  --navy-900: #071b2f;
  --navy-850: #0b243b;
  --navy-800: #102d48;
  --blue-700: #086a9f;
  --blue-600: #0a7cb8;
  --blue-500: #1597d0;
  --teal-500: #13a595;
  --ink: #12253a;
  --muted: #5a6c7e;
  --line: #d9e2e9;
  --line-strong: #c3d0da;
  --surface: #ffffff;
  --surface-2: #f5f8fa;
  --surface-3: #edf3f6;
  --danger: #b42332;
  --danger-bg: #fff0f2;
  --amber: #9b5b00;
  --amber-bg: #fff6e5;
  --green: #08765c;
  --green-bg: #eaf8f3;
  --text: var(--ink);
  --accent: var(--blue-700);
  --accent-soft: #eaf7fb;
  --surface-soft: var(--surface-3);
  --warning: #d08a15;
  --success: var(--green);
  --shadow: 0 12px 34px rgba(4, 25, 43, 0.09);
  --radius: 14px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  font-size: 16px;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --ink: #e6eef5;
  --muted: #a6b7c7;
  --line: #29445a;
  --line-strong: #3a5870;
  --surface: #10283d;
  --surface-2: #071b2f;
  --surface-3: #18364d;
  --blue-700: #63c2ed;
  --blue-600: #39a9dd;
  --blue-500: #66c8f0;
  --danger: #ff9eaa;
  --danger-bg: #4b2029;
  --amber: #ffd083;
  --amber-bg: #443316;
  --green: #79d8bc;
  --green-bg: #173c35;
  --shadow: 0 12px 34px rgba(0, 0, 0, .3);
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--surface-2); }
body { margin: 0; min-width: 320px; min-height: 100vh; color: var(--ink); background: var(--surface-2); }
button, input, select, textarea { font: inherit; }
button, a, input, select, textarea, summary { -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible {
  outline: 3px solid #55bced;
  outline-offset: 2px;
}
button { min-height: 44px; }
a { color: var(--blue-700); }
h1, h2, h3 { margin: 0; letter-spacing: -0.025em; line-height: 1.18; }
h1 { font-size: clamp(1.65rem, 4vw, 2.25rem); }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
p { line-height: 1.55; }
small { font-size: 0.8rem; color: var(--muted); }

.boot {
  min-height: 100vh;
  display: grid;
  place-content: center;
  justify-items: center;
  color: var(--muted);
}
.brand-mark {
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  background: linear-gradient(145deg, var(--blue-600), var(--teal-500));
  color: #fff;
  font-size: 1.7rem;
  font-weight: 800;
  box-shadow: 0 8px 24px rgba(10, 124, 184, 0.28);
}

.auth-page {
  min-height: 100vh;
  background:
    radial-gradient(circle at 85% 15%, rgba(21, 151, 208, .25), transparent 28rem),
    linear-gradient(145deg, var(--navy-950), var(--navy-800));
  color: #fff;
  display: grid;
  grid-template-columns: minmax(280px, .8fr) minmax(420px, 1.2fr);
}
.auth-intro {
  padding: clamp(2rem, 6vw, 5rem);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 100vh;
}
.auth-brand { display: flex; align-items: center; gap: .9rem; }
.auth-brand .brand-mark { width: 48px; height: 48px; border-radius: 13px; }
.auth-brand strong { display: block; font-size: 1.25rem; letter-spacing: .06em; }
.auth-brand small { color: #9fc0d8; font-size: .72rem; letter-spacing: .09em; text-transform: uppercase; }
.auth-logo {
  width: min(100%, 580px);
  aspect-ratio: 1.6;
  overflow: hidden;
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 18px 50px rgba(0,0,0,.22);
}
.auth-logo img { width: 100%; display: block; transform: translateY(-10%); }
.auth-copy { max-width: 31rem; margin: auto 0; }
.auth-copy h1 { font-size: clamp(2rem, 5vw, 3.9rem); max-width: 11ch; }
.auth-copy p { color: #bad0df; max-width: 38rem; font-size: 1.05rem; }
.auth-meta { color: #91adbf; font-size: .78rem; }
.auth-panel-wrap { display: grid; place-items: center; padding: 2rem; }
.auth-card {
  color: var(--ink);
  background: rgba(255,255,255,.98);
  border: 1px solid rgba(255,255,255,.7);
  border-radius: 22px;
  box-shadow: 0 22px 70px rgba(0,0,0,.25);
  padding: clamp(1.5rem, 4vw, 2.5rem);
  width: min(100%, 34rem);
}
.auth-card > p { color: var(--muted); margin: .5rem 0 1.5rem; }
.login-choice { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: .4rem; margin-bottom: 1.4rem; padding: .3rem; border-radius: 12px; background: var(--surface-3); }
.login-choice button { min-height:44px; padding:8px 6px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); font-weight: 750; cursor: pointer; }
.login-choice button.active { background: var(--surface); color: var(--blue-700); box-shadow: 0 3px 10px rgba(4,25,43,.09); }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 252px minmax(0, 1fr); }
.sidebar {
  min-height: 100vh;
  position: sticky;
  top: 0;
  height: 100vh;
  background: linear-gradient(180deg, var(--navy-900), var(--navy-950));
  color: #fff;
  padding: 1.35rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 1.4rem;
}
.side-brand { display: flex; align-items: center; gap: .8rem; padding: .25rem .45rem 1rem; }
.side-brand .brand-mark { width: 42px; height: 42px; border-radius: 12px; font-size: 1.25rem; }
.side-brand strong { display: block; letter-spacing: .07em; }
.side-brand small { color: #94afc3; display: block; margin-top: .1rem; font-size: .68rem; letter-spacing: .08em; text-transform: uppercase; }
.brand-image {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  border-radius: 12px;
  background: #fff url('/shit-logo.png') left center / 300% auto no-repeat;
  box-shadow: 0 8px 24px rgba(10,124,184,.22);
}
.primary-nav { display: grid; gap: .35rem; }
.nav-button {
  appearance: none;
  border: 0;
  background: transparent;
  color: #bdd0df;
  padding: .72rem .8rem;
  border-radius: 10px;
  display: flex;
  align-items: center;
  gap: .75rem;
  text-align: left;
  cursor: pointer;
  font-size: .92rem;
}
.nav-button:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav-button.active { background: #173d5d; color: #fff; box-shadow: inset 3px 0 0 var(--blue-500); }
.nav-icon { width: 1.25rem; text-align: center; font-weight: 700; color: #79c7e9; }
.external-tools { display: grid; gap: .3rem; padding-top: .15rem; border-top: 1px solid rgba(255,255,255,.1); }
.external-tools > small { color: #7895aa; padding: .75rem .8rem .2rem; text-transform: uppercase; letter-spacing: .08em; font-size: .65rem; }
.external-tools .nav-button { text-decoration: none; }
.tool-shortcuts { margin-top: -.2rem; }
.tool-card { display: flex; align-items: center; gap: 1rem; padding: 1rem 1.15rem; text-decoration: none; color: var(--ink); transition: transform .15s ease, box-shadow .15s ease; }
.tool-card:hover { transform: translateY(-2px); box-shadow: 0 12px 30px rgba(11,46,71,.12); }
.tool-card strong, .tool-card small { display: block; }
.tool-card small { margin-top: .25rem; }
.tool-icon { width: 38px; height: 38px; flex: 0 0 38px; display: grid; place-items: center; border-radius: 11px; background: var(--blue-50); color: var(--blue-700); font-size: 1.2rem; font-weight: 800; }
.side-user {
  margin-top: auto;
  border-top: 1px solid rgba(255,255,255,.12);
  padding: 1rem .55rem .25rem;
}
.side-user strong { display: block; font-size: .9rem; }
.side-user small { color: #9ab1c2; text-transform: capitalize; }
.link-button { appearance: none; border: 0; background: none; padding: .5rem 0 0; color: #94d8f3; cursor: pointer; font-size: .82rem; min-height: 34px; }
.theme-control { display: grid; gap: .3rem; margin-top: .8rem; }
.theme-control > span { color: #9ab1c2; font-size: .72rem; font-weight: 650; }
.theme-control select { min-height: 38px; padding: .38rem 2rem .38rem .6rem; color: #e9f4fa; background-color: #102d48; border-color: rgba(255,255,255,.18); }
.mobile-theme > span { color: var(--muted); }
.mobile-theme select { color: var(--ink); background-color: var(--surface); border-color: var(--line-strong); }

.main { min-width: 0; padding: 1.5rem clamp(1rem, 3vw, 2.6rem) 4rem; }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: 1.5rem; }
.page-title p { margin: .35rem 0 0; color: var(--muted); font-size: .92rem; }
.top-actions { display: flex; align-items: center; gap: .65rem; }
.mobile-brand, .mobile-nav { display: none; }
.notification-button { position: relative; width: 44px; min-height: 44px; border: 1px solid var(--line-strong); border-radius: 12px; color: var(--ink); background: var(--surface); cursor: pointer; }
.notification-count { position: absolute; top: -6px; right: -6px; min-width: 21px; height: 21px; padding: 0 5px; display: grid; place-items: center; border: 2px solid var(--surface-2); border-radius: 999px; color: #fff; background: var(--danger); font-size: .68rem; font-weight: 850; }
.notification-count[hidden] { display: none; }
.notification-list { display: grid; gap: .6rem; max-height: min(65vh,620px); overflow: auto; }
.notification-item { display: flex; align-items: center; justify-content: space-between; gap: .8rem; padding: .85rem; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.notification-item.unread { border-left: 5px solid var(--blue-600); background: var(--accent-soft); }
.notification-item p { margin: .2rem 0; color: var(--muted); font-size: .85rem; }
.notification-item small { display: block; }

.button {
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  padding: .65rem 1rem;
  font-weight: 650;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .45rem;
  text-decoration: none;
  line-height: 1.1;
}
.button:hover { background: var(--surface-3); }
.button.primary { background: var(--blue-700); border-color: var(--blue-700); color: #fff; box-shadow: 0 5px 16px rgba(8, 106, 159, .2); }
.button.primary:hover { background: #075b88; }
.button.danger { color: var(--danger); border-color: #e6b5bd; background: #fff; }
.button.quiet { border-color: transparent; background: transparent; box-shadow: none; }
.button.small { min-height: 36px; padding: .46rem .7rem; font-size: .82rem; }
.button:disabled { opacity: .48; cursor: not-allowed; }
.icon-button { width: 44px; padding: 0; }

.grid { display: grid; gap: 1rem; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.span-2 { grid-column: span 2; }
.full { grid-column: 1 / -1; }
.section-stack { display: grid; gap: 1rem; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 3px 10px rgba(6, 29, 46, .035);
  overflow: hidden;
}
.card-body { padding: 1.25rem; }
.card-head {
  min-height: 64px;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}
.card-head p { margin: .25rem 0 0; color: var(--muted); font-size: .85rem; }
.stat-card { padding: 1.1rem; position: relative; min-height: 122px; }
.stat-card::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--blue-600); }
.stat-card.alert::before { background: var(--danger); }
.stat-card.warn::before { background: #d08a15; }
.stat-card.good::before { background: var(--teal-500); }
.stat-card span { display: block; color: var(--muted); font-size: .83rem; }
.stat-card strong { font-size: 2.2rem; display: block; margin: .3rem 0; font-weight: 720; }
.stat-card small { display: block; }

.attention-strip {
  border: 1px solid #b9d8e7;
  background: linear-gradient(100deg, #eaf7fb, #f4fbfd);
  border-radius: var(--radius);
  padding: 1.1rem 1.2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.attention-strip p { margin: .25rem 0 0; color: #426478; font-size: .88rem; }

.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; font-size: .88rem; }
th { text-align: left; padding: .75rem 1rem; background: #f3f7f9; border-bottom: 1px solid var(--line); color: var(--muted); font-size: .74rem; text-transform: uppercase; letter-spacing: .05em; white-space: nowrap; }
td { padding: .9rem 1rem; border-bottom: 1px solid #e8edf1; vertical-align: top; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #f9fbfc; }
.row-link { border: 0; background: none; color: var(--blue-700); padding: 0; min-height: 0; cursor: pointer; font-weight: 720; text-align: left; }
.row-title { font-weight: 650; margin-top: .2rem; min-width: 16rem; }
.cell-note { color: var(--muted); display: block; margin-top: .22rem; font-size: .78rem; }

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: .2rem .55rem;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--surface-3);
  color: #3c5368;
  font-size: .74rem;
  font-weight: 750;
  white-space: nowrap;
}
.badge.p1 { background: var(--danger-bg); color: var(--danger); border-color: #edbbc2; }
.badge.p2 { background: var(--amber-bg); color: var(--amber); border-color: #efd8a7; }
.badge.p3 { background: #e9f5fb; color: #0a658f; border-color: #beddec; }
.badge.p4 { background: #eef2f4; color: #546777; }
.badge.open, .badge.submitted, .badge.under-review, .badge.action-required { background: #edf6fb; color: #075e8d; border-color: #bedce9; }
.badge.closed, .badge.completed { background: var(--green-bg); color: var(--green); border-color: #b9dfd2; }
.badge.restricted { background: #f3edf8; color: #68418b; border-color: #d9c5e7; }

.field { display: grid; gap: .38rem; min-width: 0; }
.field > label, .field > legend { font-size: .84rem; font-weight: 700; }
.field .required::after { content: " *"; color: var(--danger); }
input, select, textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  min-height: 46px;
  padding: .67rem .75rem;
}
textarea { min-height: 105px; resize: vertical; line-height: 1.45; }
select[multiple] { min-height: 160px; }
input:disabled, select:disabled, textarea:disabled { background: #edf1f3; color: #657585; }
.hint { color: var(--muted); font-size: .77rem; line-height: 1.4; }
.check-row { display: flex; align-items: flex-start; gap: .62rem; font-size: .88rem; }
.check-row input { width: 20px; height: 20px; min-height: 20px; margin: .05rem 0 0; accent-color: var(--blue-700); }
.option-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .55rem; }
.option-card { border: 1px solid var(--line); border-radius: 10px; padding: .75rem; display: flex; align-items: flex-start; gap: .6rem; cursor: pointer; background: #fff; }
.option-card:has(input:checked) { border-color: #79b9d6; background: #eff8fc; }
.option-card input { width: 19px; height: 19px; min-height: 19px; margin: .05rem 0 0; accent-color: var(--blue-700); }
.incident-type-field { margin: .25rem 0 .45rem; }
.incident-type-field .hint { margin: .25rem 0 .7rem; }
.incident-type-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .65rem; }
.incident-type-button { position: relative; cursor: pointer; }
.incident-type-button input { position: absolute; opacity: 0; pointer-events: none; }
.incident-type-button span { min-height: 68px; height: 100%; display: flex; align-items: center; justify-content: center; padding: .8rem; border: 2px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--ink); text-align: center; font-size: .86rem; font-weight: 720; line-height: 1.25; transition: border-color .15s, background .15s, transform .15s; }
.incident-type-button:hover span { border-color: var(--blue-500); transform: translateY(-1px); }
.incident-type-button input:focus-visible + span { outline: 3px solid #55bced; outline-offset: 2px; }
.incident-type-button input:checked + span { border-color: var(--blue-600); background: #eaf7fb; color: #064f76; box-shadow: 0 5px 15px rgba(8,106,159,.12); }
.report-kind-field { margin-bottom: 1.2rem; padding: 1rem; border: 0; border-radius: 14px; background: var(--surface-3); }
.report-kind-field > .hint { display: block; margin: .25rem 0 .8rem; text-align: center; }
.report-kind-field > legend { width: 100%; text-align: center; font-size: 1rem; }
.report-kind-choice { width: min(100%,720px); margin: 0 auto; display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.report-kind-choice label { position: relative; cursor: pointer; }
.report-kind-choice input { position: absolute; opacity: 0; pointer-events: none; }
.report-kind-choice span { min-height: 76px; display: grid; place-items: center; padding: 1rem; border: 2px solid var(--line-strong); border-radius: 14px; color: var(--ink); background: var(--surface); font-size: 1.05rem; font-weight: 850; text-align: center; }
.report-kind-choice input:checked + span { border-color: var(--blue-600); color: #fff; background: linear-gradient(135deg,var(--blue-700),var(--teal-500)); box-shadow: 0 9px 24px rgba(8,106,159,.2); }
.report-kind-choice input:focus-visible + span { outline: 3px solid #55bced; outline-offset: 2px; }

.filter-bar { padding: 1rem; display: grid; grid-template-columns: minmax(220px, 2fr) repeat(4, minmax(130px, 1fr)) auto; gap: .7rem; align-items: end; }
.search-input { position: relative; }
.search-input input { padding-left: 2.35rem; }
.search-input::before { content: "⌕"; position: absolute; left: .8rem; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 1.25rem; z-index: 1; }
.pagination { padding: .9rem 1rem; display: flex; align-items: center; justify-content: space-between; gap: 1rem; border-top: 1px solid var(--line); }

.wizard-steps { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: .45rem; margin-bottom: 1rem; }
.step {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 10px;
  padding: .65rem .55rem;
  color: var(--muted);
  font-size: .75rem;
  display: flex;
  gap: .45rem;
  align-items: center;
  min-height: 48px;
}
.step-index { width: 24px; height: 24px; flex: 0 0 24px; border-radius: 50%; background: var(--surface-3); display: grid; place-items: center; font-weight: 750; }
.step.active { border-color: #72b5d5; color: var(--blue-700); background: #eff8fc; }
.step.active .step-index { background: var(--blue-700); color: #fff; }
.step.done .step-index { background: var(--teal-500); color: #fff; }
.wizard-panel { padding: 1.25rem; }
.wizard-panel > .section-intro { margin: .35rem 0 1.2rem; color: var(--muted); font-size: .9rem; }
.wizard-footer {
  position: sticky;
  bottom: 0;
  z-index: 5;
  padding: .85rem 1rem calc(.85rem + var(--safe-bottom));
  background: rgba(255,255,255,.96);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}
.wizard-footer .right { display: flex; gap: .6rem; }
.wizard-nav-button { min-height: 52px; min-width: 132px; padding: .8rem 1.15rem; font-size: 1rem; font-weight: 800; }
.subsection { border-top: 1px solid var(--line); padding-top: 1.1rem; margin-top: 1.1rem; }
.repeater { border: 1px solid var(--line); background: #f8fafb; border-radius: 12px; padding: 1rem; margin-bottom: .75rem; }
.repeater-head { display: flex; justify-content: space-between; align-items: center; gap: .7rem; margin-bottom: .8rem; }

.notice, .error-box, .success-box {
  border-radius: 10px;
  padding: .85rem 1rem;
  margin: .8rem 0;
  line-height: 1.45;
  font-size: .87rem;
}
.notice { background: #edf7fb; border: 1px solid #bdddea; color: #2d586c; }
.error-box { background: var(--danger-bg); border: 1px solid #edbdc4; color: #8e2735; }
.success-box { background: var(--green-bg); border: 1px solid #b7decf; color: #17664f; }
.error-box ul { margin: .45rem 0 0; padding-left: 1.2rem; }
.toast-region { position: fixed; right: 1rem; bottom: 1rem; z-index: 100; display: grid; gap: .55rem; width: min(380px, calc(100vw - 2rem)); }
.toast { box-shadow: var(--shadow); background: var(--navy-900); color: #fff; border-radius: 10px; padding: .85rem 1rem; animation: toast-in .18s ease-out; font-size: .88rem; }
.toast.error { background: #822331; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

.detail-hero {
  background: linear-gradient(130deg, var(--navy-900), #113b5c);
  color: #fff;
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1rem;
}
.detail-hero .eyebrow { color: #9cc6dd; font-size: .75rem; font-weight: 750; letter-spacing: .06em; }
.detail-hero h1 { margin: .25rem 0 .75rem; font-size: clamp(1.35rem, 3vw, 2rem); }
.detail-badges { display: flex; flex-wrap: wrap; gap: .45rem; }
.detail-badges .badge { border-color: rgba(255,255,255,.25); }
.detail-meta { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; }
.meta-item span { display: block; color: var(--muted); font-size: .76rem; margin-bottom: .25rem; }
.meta-item strong { font-size: .9rem; font-weight: 670; }
.summary-box { border-left: 4px solid var(--blue-600); background: #edf6fa; padding: 1rem; border-radius: 8px; white-space: pre-wrap; }
.timeline { display: grid; gap: .9rem; }
.timeline-item { display: grid; grid-template-columns: 12px minmax(0,1fr); gap: .7rem; }
.timeline-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--blue-600); margin-top: .35rem; box-shadow: 0 0 0 4px #e7f2f7; }
.timeline-content { padding-bottom: .7rem; border-bottom: 1px solid var(--line); }
.timeline-content p { margin: .25rem 0; white-space: pre-wrap; }
.family-bars { display: grid; gap: .9rem; }
.family-row > div:first-child { display: flex; justify-content: space-between; gap: 1rem; font-size: .82rem; margin-bottom: .35rem; }
.family-row strong { font-weight: 650; }
.family-row span { color: var(--muted); }
.family-progress { display: block; width: 100%; height: 8px; border: 0; border-radius: 999px; overflow: hidden; background: #e7eef2; }
.family-progress::-webkit-progress-bar { background: #e7eef2; border-radius: 999px; }
.family-progress::-webkit-progress-value { background: linear-gradient(90deg, var(--blue-700), var(--teal-500)); border-radius: 999px; }
.family-progress::-moz-progress-bar { background: linear-gradient(90deg, var(--blue-700), var(--teal-500)); border-radius: 999px; }
.incident-map { min-height: 510px; background: #dfe8ed; }
.map-empty { min-height: 510px; display: grid; place-content: center; text-align: center; padding: 2rem; color: var(--muted); }
.map-empty strong { display: block; color: var(--ink); font-size: 1.05rem; margin-bottom: .4rem; }
.map-info { max-width: 250px; display: grid; gap: .35rem; color: #122433; }
.map-info span, .map-info small { display: block; }
.incident-marker { width: 20px; height: 20px; min-height: 20px; padding: 0; border: 3px solid #fff; border-radius: 50%; background: #0876ad; box-shadow: 0 2px 8px rgba(0,0,0,.35); cursor: pointer; }
.incident-marker.priority-p1 { width: 25px; height: 25px; background: #b42332; }
.incident-marker.priority-p2 { width: 23px; height: 23px; background: #d68712; }
.incident-marker.priority-p4 { background: #4f6575; }
.line-chart { width: 100%; min-height: 190px; overflow: visible; }
.chart-axis { fill: none; stroke: #cbd8df; stroke-width: 1; }
.trend-area { fill: none; stroke: rgba(12,150,163,.13); stroke-width: 16; stroke-linecap: round; stroke-linejoin: round; }
.trend-line { fill: none; stroke: var(--blue-700); stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; }
.line-chart circle { fill: var(--teal-500); stroke: #fff; stroke-width: 2; }
.live-indicator { display: inline-flex; align-items: center; gap: .45rem; color: #24566a; font-size: .78rem; font-weight: 700; white-space: nowrap; }
.live-indicator > span { width: 9px; height: 9px; border-radius: 50%; background: #15a379; box-shadow: 0 0 0 5px rgba(21,163,121,.13); }
.insight-list { display: grid; gap: .7rem; }
.insight { display: grid; grid-template-columns: 34px minmax(0,1fr); gap: .75rem; padding: .85rem; border: 1px solid var(--line); border-radius: 12px; background: #fbfcfd; }
.insight.warning { border-color: #efd6a0; background: #fffaf0; }
.insight-icon { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; background: #e4f2f7; color: var(--blue-700); font-weight: 800; }
.insight.warning .insight-icon { background: #fff0ce; color: #9b5d00; }
.insight p { margin: .25rem 0 0; color: var(--muted); font-size: .84rem; }
.select-cell { width: 42px; text-align: center; }
.select-cell input { width: 18px; height: 18px; min-height: 18px; accent-color: var(--blue-700); }
[aria-disabled="true"] { opacity: .5; }
.evidence-grid { display: grid; gap: .8rem; }
.evidence-item { display: grid; grid-template-columns: 112px minmax(0,1fr); gap: .9rem; border: 1px solid var(--line); border-radius: 12px; padding: .75rem; }
.evidence-item img, .file-tile { width: 112px; height: 88px; border-radius: 8px; object-fit: cover; background: #eaf0f3; }
.file-tile { display: grid; place-items: center; color: var(--muted); font-size: .78rem; font-weight: 800; }
.evidence-item strong, .evidence-item span, .evidence-item small { display: block; overflow-wrap: anywhere; }
.evidence-item span, .evidence-item small { color: var(--muted); font-size: .76rem; margin-top: .25rem; }
.evidence-item .button { margin-top: .55rem; }
.review-gates { display: grid; grid-template-columns: 1fr 1fr; gap: .7rem; }
.review-gate { border: 1px solid var(--line); border-radius: 12px; padding: .8rem; display: flex; gap: .65rem; align-items: center; }
.review-gate > span { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: #eef2f4; color: var(--muted); font-weight: 800; }
.review-gate.complete { border-color: #aad8c9; background: var(--green-bg); }
.review-gate.complete > span { background: var(--teal-500); color: #fff; }
.review-gate strong, .review-gate small { display: block; }
.review-gate small { color: var(--muted); margin-top: .2rem; text-transform: capitalize; }
.scan-card { border-color: #add5e6; }
.scan-actions, .patrol-run-actions { display: flex; flex-wrap: wrap; gap: .55rem; }
.qr-video { width: 100%; min-height: 320px; max-height: 62vh; background: #071b2f; border-radius: 12px; object-fit: cover; }
.intel-item { border: 1px solid var(--line); border-left: 4px solid var(--blue-600); border-radius: 12px; padding: 1rem; margin-bottom: .85rem; background: #fff; }
.intel-item.critical { border-left-color: var(--danger); background: #fffafb; }
.intel-item.high { border-left-color: #d68712; }
.intel-top { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.intel-top > div { display: flex; gap: .35rem; }
.intel-item h3 { margin: .7rem 0 .35rem; font-size: 1rem; }
.intel-item > p { margin: 0; color: #364c5c; line-height: 1.5; }
.intel-meta { display: flex; flex-wrap: wrap; gap: .45rem 1rem; margin: .7rem 0; color: var(--muted); font-size: .76rem; }
.intel-impact { background: #eff6f9; border-radius: 9px; padding: .75rem; display: grid; gap: .25rem; font-size: .8rem; margin-bottom: .75rem; }
.intel-impact small { color: var(--muted); }
.switch input { position: absolute; opacity: 0; }
.switch span { display: block; width: 44px; height: 24px; border-radius: 999px; background: #bcc8cf; position: relative; cursor: pointer; }
.switch span::after { content: ""; position: absolute; width: 18px; height: 18px; border-radius: 50%; background: #fff; top: 3px; left: 3px; transition: transform .15s; box-shadow: 0 1px 4px rgba(0,0,0,.2); }
.switch input:checked + span { background: var(--teal-500); }
.switch input:checked + span::after { transform: translateX(20px); }
.alert-list { display: grid; gap: .8rem; }
.manager-alert { display: flex; justify-content: space-between; gap: 1rem; border: 1px solid #edc5ca; border-left: 5px solid var(--danger); border-radius: 12px; padding: 1rem; background: #fffafb; }
.manager-alert.acknowledged { border-color: #eddcb5; border-left-color: #d68712; background: #fffcf5; }
.manager-alert.resolved { border-color: var(--line); border-left-color: var(--teal-500); background: #f8fcfa; }
.manager-alert h3 { margin: .55rem 0 .3rem; }
.manager-alert p { margin: 0 0 .35rem; color: #3a4f5f; }
.filter-bar.admin-filter { grid-template-columns: minmax(220px, 1fr) auto; }
.record-list { display: grid; }
.record-line { display: flex; justify-content: space-between; gap: 1rem; padding: .8rem 0; border-bottom: 1px solid var(--line); align-items: flex-start; }
.record-line:last-child { border-bottom: 0; }
.record-line strong { display: block; font-size: .88rem; }
.record-line span, .record-line small { display: block; margin-top: .2rem; color: var(--muted); font-size: .78rem; }
.record-line > div:last-child { display: flex; align-items: center; gap: .45rem; }
.answer-list { margin: .8rem 0 0; display: grid; gap: .65rem; }
.answer-list > div { display: grid; grid-template-columns: minmax(160px, 1fr) 2fr; gap: 1rem; padding-bottom: .65rem; border-bottom: 1px solid var(--line); }
.answer-list dt { color: var(--muted); font-size: .82rem; }
.answer-list dd { margin: 0; white-space: pre-wrap; font-size: .88rem; }
.preserve { white-space: pre-wrap; }
details > summary { cursor: pointer; font-weight: 700; }

.tabs { display: flex; overflow-x: auto; gap: .35rem; border-bottom: 1px solid var(--line); padding: 0 1rem; background: #fff; }
.tab { appearance: none; border: 0; border-bottom: 3px solid transparent; background: none; color: var(--muted); padding: .85rem .75rem .7rem; cursor: pointer; white-space: nowrap; font-weight: 650; font-size: .85rem; }
.tab.active { color: var(--blue-700); border-bottom-color: var(--blue-600); }
.admin-layout { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 1rem; }
.admin-nav { padding: .7rem; align-self: start; }
.admin-nav button { width: 100%; border: 0; background: none; text-align: left; padding: .7rem .75rem; border-radius: 8px; cursor: pointer; color: var(--muted); min-height: 42px; }
.admin-nav button.active { background: #eaf4f8; color: var(--blue-700); font-weight: 700; }
.config-row { display: grid; grid-template-columns: minmax(110px, .6fr) minmax(180px, 2fr) minmax(120px, 1fr) auto; gap: .7rem; align-items: center; padding: .8rem 1rem; border-bottom: 1px solid var(--line); font-size: .85rem; }
.config-row:last-child { border-bottom: 0; }

.dialog-backdrop { position: fixed; inset: 0; background: rgba(4, 18, 31, .62); z-index: 80; padding: 1rem; display: grid; place-items: center; }
.dialog { width: min(100%, 690px); max-height: calc(100vh - 2rem); overflow: auto; background: #fff; border-radius: 16px; box-shadow: 0 30px 90px rgba(0,0,0,.3); }
.dialog-head, .dialog-footer { padding: 1rem 1.2rem; display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.dialog-head { border-bottom: 1px solid var(--line); }
.dialog-body { padding: 1.2rem; }
.dialog-footer { border-top: 1px solid var(--line); justify-content: flex-end; }

:root[data-theme="dark"] .card,
:root[data-theme="dark"] .button,
:root[data-theme="dark"] input,
:root[data-theme="dark"] select,
:root[data-theme="dark"] textarea,
:root[data-theme="dark"] .option-card,
:root[data-theme="dark"] .step,
:root[data-theme="dark"] .dialog,
:root[data-theme="dark"] .tabs,
:root[data-theme="dark"] .intel-item { background-color: var(--surface); color: var(--ink); }
:root[data-theme="dark"] .wizard-footer { background: rgba(16,40,61,.96); }
:root[data-theme="dark"] .option-card:has(input:checked),
:root[data-theme="dark"] .step.active,
:root[data-theme="dark"] .incident-type-button input:checked + span,
:root[data-theme="dark"] .admin-nav button.active { background: #183f59; color: #9ddfff; }
:root[data-theme="dark"] .repeater,
:root[data-theme="dark"] th,
:root[data-theme="dark"] .insight,
:root[data-theme="dark"] .summary-box,
:root[data-theme="dark"] .intel-impact { background: #132f45; }
:root[data-theme="dark"] td { border-bottom-color: var(--line); }
:root[data-theme="dark"] tbody tr:hover { background: #142f44; }
:root[data-theme="dark"] .attention-strip { background: linear-gradient(100deg, #12374c, #102c40); border-color: #315970; }
:root[data-theme="dark"] .attention-strip p,
:root[data-theme="dark"] .live-indicator,
:root[data-theme="dark"] .intel-item > p,
:root[data-theme="dark"] .manager-alert p { color: var(--muted); }
:root[data-theme="dark"] .notice { background: #12384b; border-color: #2f647b; color: #c5e9f6; }
:root[data-theme="dark"] .manager-alert,
:root[data-theme="dark"] .manager-alert.acknowledged,
:root[data-theme="dark"] .manager-alert.resolved,
:root[data-theme="dark"] .intel-item.critical,
:root[data-theme="dark"] .insight.warning { background: var(--surface); }
:root[data-theme="dark"] input:disabled,
:root[data-theme="dark"] select:disabled,
:root[data-theme="dark"] textarea:disabled { background: #1b3346; color: #8194a4; }

.empty { padding: 3rem 1.2rem; text-align: center; color: var(--muted); }
.empty strong { display: block; color: var(--ink); margin-bottom: .4rem; }
.skeleton { min-height: 90px; border-radius: var(--radius); background: linear-gradient(90deg, #eef2f4 25%, #f7f9fa 50%, #eef2f4 75%); background-size: 200% 100%; animation: shimmer 1.2s infinite; }
@keyframes shimmer { to { background-position-x: -200%; } }
.visually-hidden { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0,0,0,0) !important; white-space: nowrap !important; border: 0 !important; }
.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }

.ops-head { gap: 1rem; }
.ops-actions, .map-controls { display: flex; flex-wrap: wrap; gap: .55rem; align-items: center; justify-content: flex-end; }
.ops-list { border-top: 1px solid var(--line); }
.ops-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .9rem 1.2rem; border-bottom: 1px solid var(--line); }
.ops-row-main { min-width: 0; display: grid; gap: .28rem; }
.ops-row-main > strong { color: var(--ink); }
.ops-row-main > span { color: var(--muted); font-size: .86rem; }
.badge-row { display: flex; flex-wrap: wrap; gap: .35rem; }
.ops-row.is-past { opacity: .52; filter: grayscale(.75); background: color-mix(in srgb, var(--surface) 84%, var(--line)); }
.ops-filter { padding: 1rem 1.2rem; border-top: 1px solid var(--line); }
.ops-dialog { width: min(820px, calc(100vw - 2rem)); max-height: min(88vh, 900px); overflow: auto; }
.offline-recovery { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; margin-bottom: .8rem; }
.offline-recovery > span { flex: 1; }
.duplicate-warning { margin-top: 1rem; padding: 1rem; border-radius: 12px; border: 1px solid #f59e0b; background: #fffbeb; display: grid; gap: .4rem; color: #78350f; }
:root[data-theme="dark"] .duplicate-warning { background: #392b0b; color: #fde68a; }
.ack-timer { display: block; color: #b45309; margin-top: .55rem; font-size: .82rem; }
.ack-timer.overdue { color: #dc2626; }
.alert-overdue { border-left: 5px solid #dc2626; }
.mobile-more-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .7rem; }
.mobile-more-grid .button { justify-content: flex-start; }
.news-grid, .news-list { display: grid; grid-template-columns: 1fr; gap: .85rem; padding: 1.2rem; border-top: 1px solid var(--line); }
.news-card { min-height: 180px; display: grid; grid-template-columns: minmax(190px,280px) minmax(0,1fr); overflow: hidden; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); box-shadow: 0 6px 18px rgba(4,25,43,.06); }
.news-card.is-past { opacity: .55; filter: grayscale(.7); }
.news-hero { display: block; width: 100%; height: 100%; min-height: 180px; object-fit: cover; background: var(--surface-3); }
.news-placeholder { display: grid; place-items: center; color: #fff; font-weight: 900; font-size: 2rem; background: linear-gradient(135deg,var(--navy-900),var(--blue-600)); }
.news-card-body { display: grid; gap: .75rem; padding: 1rem; }
.news-card-body h3 { font-size: 1.1rem; }
.news-card-body p { margin: 0; }
.news-card-body details { border-top: 1px solid var(--line); padding-top: .65rem; }
.news-card-body summary { cursor: pointer; font-weight: 700; }
.news-body { margin-top: .6rem; line-height: 1.55; color: var(--muted); }
.news-downloads { display: grid; gap: .3rem; padding: .7rem; border-radius: 10px; background: var(--surface-3); }
.news-card footer { display: flex; justify-content: space-between; align-items: center; gap: .5rem; color: var(--muted); font-size: .8rem; border-top: 1px solid var(--line); padding-top: .7rem; }
.news-asset-list { display: grid; gap: .4rem; margin-top: .7rem; }
.news-asset-list > div { display: flex; justify-content: space-between; align-items: center; gap: .5rem; padding: .55rem; border: 1px solid var(--line); border-radius: 9px; }
.mfa-setup { text-align: center; }
.mfa-qr { display: grid; place-items: center; margin: 1rem auto; background: #fff; border-radius: 12px; width: 244px; height: 244px; padding: 12px; }
.mfa-qr svg { width: 220px; height: 220px; }
.secret-code { display: block; word-break: break-all; font-size: 1rem; padding: .8rem; margin: .6rem 0; background: var(--surface-3); border-radius: 8px; letter-spacing: .08em; }
.recovery-codes { font: 700 1rem/1.8 ui-monospace,monospace; columns: 2; padding: 1rem; border-radius: 10px; background: var(--surface-3); }
.external-portal { min-height: 100vh; background: var(--surface-2); }
.external-header { min-height: 76px; display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .8rem clamp(1rem,4vw,3rem); color: #fff; background: var(--navy-900); }
.external-header .side-brand { padding: 0; }
.external-header .record-actions > span { color: #c5d7e4; font-size: .86rem; }
.external-header .button { color: #fff; border-color: rgba(255,255,255,.3); background: transparent; }
.external-main { width: min(1320px,100%); margin: 0 auto; padding: clamp(1rem,3vw,2rem); }
.external-main > section:first-child { margin-bottom: 1rem; }
.external-main > section:first-child p { color: var(--muted); }
.external-layout { display: grid; grid-template-columns: minmax(0,1.2fr) minmax(320px,.8fr); gap: 1rem; align-items: start; }
.external-history { padding: 1rem; max-height: 750px; overflow: auto; }
.training-summary { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: .65rem; margin-bottom: 1rem; }
.training-summary > div { padding: .85rem; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-soft); }
.training-summary strong { display: block; font-size: 1.5rem; }
.training-summary span { color: var(--muted); font-size: .8rem; }
.training-matrix-list { display: grid; gap: .8rem; }
.training-profile { display: grid; gap: .8rem; padding: 1rem; border: 1px solid var(--line); border-left: 5px solid var(--blue-600); border-radius: 14px; background: var(--surface); }
.training-profile > header { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; }
.training-profile h3, .training-profile p { margin: 0; }
.training-profile p { margin-top: .18rem; color: var(--muted); }
.training-flags { display: grid; grid-template-columns: repeat(auto-fit,minmax(220px,1fr)); gap: .45rem; }
.training-flags span { display: grid; gap: .12rem; padding: .55rem .65rem; border-radius: 9px; color: var(--amber); background: var(--amber-bg); font-size: .78rem; }
.training-details > summary { color: var(--blue-700); font-weight: 750; cursor: pointer; }

.assistant-launcher {
  position: fixed; right: 1.25rem; bottom: 1.25rem; z-index: 80; display: flex; align-items: center; gap: .55rem;
  min-height: 52px; padding: .75rem 1rem; border: 0; border-radius: 999px; color: #fff; background: linear-gradient(135deg,var(--blue-700),var(--teal-500));
  box-shadow: 0 12px 30px rgba(4,48,78,.28); cursor: pointer;
}
.assistant-launcher span { font-size: 1.2rem; }
.assistant-panel {
  position: fixed; right: 1.25rem; bottom: 5.5rem; z-index: 85; width: min(430px,calc(100vw - 2rem)); height: min(720px,calc(100vh - 7rem));
  display: none; grid-template-rows: auto auto auto minmax(0,1fr) auto; overflow: hidden; color: var(--ink); background: var(--surface); border: 1px solid var(--line);
  border-radius: 20px; box-shadow: 0 24px 70px rgba(3,25,42,.3);
}
.assistant-panel.open { display: grid; }
.assistant-panel > header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1rem 1.1rem; color: #fff; background: var(--navy-900); }
.assistant-panel > header > div { display: flex; align-items: center; gap: .4rem; }
.assistant-panel > header > div:first-child { display: block; }
.assistant-panel > header span { display: block; color: #9fc6dc; font-size: .72rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.assistant-panel > header h2 { margin-top: .15rem; font-size: 1.2rem; }
.assistant-icon { width: 42px; min-height: 42px; border: 0; border-radius: 10px; color: #fff; background: rgba(255,255,255,.1); cursor: pointer; }
.assistant-search { padding: .9rem 1rem .65rem; }
.assistant-search label { display: block; margin-bottom: .35rem; font-size: .78rem; font-weight: 800; }
.assistant-search > div { display: grid; grid-template-columns: minmax(0,1fr) auto; }
.assistant-search input { min-width: 0; height: 46px; border: 1px solid var(--line-strong); border-radius: 11px 0 0 11px; background: var(--surface); color: var(--ink); padding: 0 .8rem; }
.assistant-search button { min-height: 46px; border: 0; border-radius: 0 11px 11px 0; padding: 0 .9rem; color: #fff; background: var(--blue-700); font-weight: 800; cursor: pointer; }
.assistant-prompts { display: flex; gap: .4rem; overflow-x: auto; padding: 0 1rem .75rem; scrollbar-width: thin; }
.assistant-prompts button, .assistant-recent button { flex: 0 0 auto; min-height: 36px; border: 1px solid var(--line); border-radius: 999px; padding: .35rem .7rem; color: var(--blue-700); background: var(--surface-3); font-size: .76rem; font-weight: 700; cursor: pointer; }
.assistant-content { overflow-y: auto; padding: 0 1rem 1rem; }
.assistant-intro { padding: .85rem; border-radius: 12px; background: var(--surface-3); }
.assistant-intro p { margin: .35rem 0 0; color: var(--muted); font-size: .86rem; }
.assistant-recent { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: 1rem; }
.assistant-recent > small { flex-basis: 100%; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; }
.assistant-loading { display: flex; align-items: center; gap: .7rem; padding: 1.2rem; color: var(--muted); }
.assistant-loading span { width: 18px; height: 18px; border: 2px solid var(--line); border-top-color: var(--blue-700); border-radius: 50%; animation: assistant-spin .8s linear infinite; }
@keyframes assistant-spin { to { transform: rotate(360deg); } }
.assistant-answer { display: grid; grid-template-columns: auto 1fr; gap: .65rem; margin-bottom: .7rem; padding: .85rem; border-left: 4px solid var(--teal-500); border-radius: 10px; background: var(--green-bg); }
.assistant-answer p { margin: 0; font-size: .88rem; }
.assistant-results { display: grid; gap: .55rem; }
.assistant-result { display: grid; gap: .25rem; padding: .8rem; border: 1px solid var(--line); border-radius: 12px; color: var(--ink); text-decoration: none; background: var(--surface); }
.assistant-result:hover { border-color: var(--blue-500); box-shadow: 0 6px 16px rgba(4,25,43,.07); }
.assistant-result-type { color: var(--blue-700); font-size: .7rem; font-weight: 900; letter-spacing: .06em; text-transform: uppercase; }
.assistant-result > span:not(.assistant-result-type), .assistant-result small { color: var(--muted); font-size: .78rem; line-height: 1.4; }
.assistant-empty { padding: 1rem; text-align: center; color: var(--muted); }
.assistant-feedback { display: flex; align-items: center; gap: .45rem; margin-top: .8rem; padding-top: .7rem; border-top: 1px solid var(--line); color: var(--muted); font-size: .78rem; }
.assistant-feedback button { min-height: 34px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink); cursor: pointer; }
.assistant-term-form { display: grid; grid-template-columns: 1fr; gap: .5rem; margin: .8rem 0; }
.assistant-term-form input { min-height: 44px; padding: .6rem; border: 1px solid var(--line); border-radius: 9px; color: var(--ink); background: var(--surface); }
.assistant-terms { display: grid; gap: .45rem; }
.assistant-terms > div { display: flex; align-items: center; justify-content: space-between; gap: .6rem; padding: .65rem; border: 1px solid var(--line); border-radius: 10px; }
.assistant-terms span { min-width: 0; }
.assistant-terms strong, .assistant-terms small { display: block; overflow-wrap: anywhere; }
.assistant-panel > footer { padding: .65rem 1rem; border-top: 1px solid var(--line); color: var(--muted); background: var(--surface-3); font-size: .7rem; text-align: center; }

@media (max-width: 1180px) {
  .external-layout { grid-template-columns: 1fr; }
  .grid.four { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filter-bar { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .filter-bar .search-input { grid-column: span 2; }
  .wizard-steps { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 820px) {
  .auth-page { grid-template-columns: 1fr; }
  .auth-intro { min-height: auto; padding: 1.5rem; gap: 2rem; }
  .auth-copy { margin: 1rem 0; }
  .auth-copy h1 { font-size: 2rem; }
  .auth-meta { display: none; }
  .auth-panel-wrap { padding: 0 1rem 2rem; }
  .app-shell { display: block; }
  .sidebar { display: none; }
  .main { padding: 0 0 calc(5.4rem + var(--safe-bottom)); }
  .mobile-brand {
    display: flex;
    height: 64px;
    position: sticky;
    top: 0;
    z-index: 30;
    background: var(--navy-900);
    color: #fff;
    align-items: center;
    justify-content: space-between;
    padding: .65rem 1rem;
    box-shadow: 0 4px 15px rgba(3,25,42,.18);
  }
  .mobile-brand .brand-mark, .mobile-brand .brand-image { width: 38px; height: 38px; flex-basis: 38px; border-radius: 10px; font-size: 1.1rem; }
  .mobile-brand-left { display: flex; align-items: center; gap: .7rem; }
  .mobile-brand strong { font-size: .92rem; }
  .mobile-brand small { color: #9fb8ca; display: block; font-size: .67rem; text-transform: capitalize; }
  .mobile-account-actions { display: flex; align-items: center; gap: .3rem; }
  .mobile-brand .notification-button { width: 38px; min-height: 38px; border-color: rgba(255,255,255,.16); color: #fff; background: rgba(255,255,255,.08); }
  .mobile-brand .notification-count { border-color: var(--navy-900); }
  .mobile-signout { min-height: 38px; padding: .35rem .6rem; border: 1px solid rgba(255,255,255,.22); border-radius: 9px; color: #fff; background: rgba(255,255,255,.08); font-size: .75rem; font-weight: 750; cursor: pointer; }
  .mobile-nav {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 40;
    background: rgba(7,27,47,.98);
    padding: .38rem .25rem calc(.38rem + var(--safe-bottom));
    box-shadow: 0 -6px 22px rgba(3, 20, 34, .2);
  }
  .mobile-nav button { border: 0; background: none; color: #9eb6c7; font-size: .66rem; padding: .35rem .1rem; min-height: 50px; cursor: pointer; display: grid; place-items: center; gap: .05rem; }
  .mobile-nav button .nav-icon { color: inherit; font-size: 1rem; }
  .mobile-nav button.active { color: #fff; }
  .topbar { padding: 1.1rem 1rem 0; align-items: flex-start; }
  .top-actions { display: none; }
  .main-content { padding: 0 1rem; }
  .grid.two, .grid.three { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .detail-meta { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .admin-layout { grid-template-columns: 1fr; }
  .admin-nav { display: flex; overflow-x: auto; gap: .25rem; }
  .admin-nav button { width: auto; white-space: nowrap; }
  .attention-strip { align-items: flex-start; }
  .record-line { flex-direction: column; }
  .answer-list > div { grid-template-columns: 1fr; gap: .25rem; }
  .incident-map, .map-empty { min-height: 430px; }
  .manager-alert { flex-direction: column; }
  .ops-head { align-items: flex-start; }
  .ops-actions { width: 100%; justify-content: flex-start; }
  .ops-actions .button { flex: 1 1 calc(50% - .55rem); }
  .map-controls { width: 100%; justify-content: flex-start; }
  .map-controls select { flex: 1 1 100%; }
  .incident-type-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .assistant-launcher { right: 1rem; bottom: calc(5rem + var(--safe-bottom)); padding: .7rem .85rem; }
  .assistant-panel { inset: 0; width: 100%; height: 100dvh; border: 0; border-radius: 0; }
}

@media (max-width: 560px) {
  .news-grid, .news-list { padding: .75rem; }
  .news-card { grid-template-columns: 1fr; }
  .news-hero { height: 210px; min-height: 210px; }
  .report-kind-choice { grid-template-columns: 1fr; gap: .55rem; }
  .report-kind-choice span { min-height: 64px; font-size: .98rem; }
  .notification-item { align-items: stretch; flex-direction: column; }
  .external-header { align-items: stretch; flex-direction: column; }
  .external-header .record-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .external-header .record-actions > span { grid-column: 1 / -1; }
  .training-summary { grid-template-columns: 1fr; }
  .recovery-codes { columns: 1; }
  .grid.four { grid-template-columns: repeat(2, minmax(0,1fr)); gap: .65rem; }
  .stat-card { min-height: 110px; padding: .9rem; }
  .stat-card strong { font-size: 1.85rem; }
  .filter-bar { grid-template-columns: 1fr 1fr; }
  .filter-bar .search-input, .filter-bar .wide-mobile { grid-column: 1 / -1; }
  .wizard-steps { display: flex; overflow-x: auto; padding-bottom: .25rem; }
  .step { min-width: 118px; }
  .wizard-panel { padding: 1rem; }
  input, select, textarea { font-size: 16px; }
  .option-grid { grid-template-columns: 1fr; }
  .incident-type-grid { grid-template-columns: 1fr 1fr; gap: .5rem; }
  .incident-type-button span { min-height: 62px; padding: .65rem .55rem; font-size: .8rem; }
  .wizard-footer { gap: .55rem; padding-left: .75rem; padding-right: .75rem; }
  .wizard-footer .right { flex: 1; display: grid; grid-template-columns: 1fr 1fr; }
  .wizard-footer .right .button { width: 100%; padding-left: .65rem; padding-right: .65rem; }
  .detail-meta { grid-template-columns: 1fr 1fr; }
  .config-row { grid-template-columns: 1fr auto; }
  .config-row > :nth-child(3) { grid-column: 1; }
  .card-head { align-items: flex-start; }
  .review-gates { grid-template-columns: 1fr; }
  .evidence-item { grid-template-columns: 84px minmax(0,1fr); }
  .evidence-item img, .file-tile { width: 84px; height: 74px; }
  .incident-map, .map-empty { min-height: 380px; }
  .auth-card { border-radius: 16px; }
  td, th { padding-left: .75rem; padding-right: .75rem; }
  .ops-row { align-items: flex-start; padding: .85rem; }
  .ops-row-actions { flex: 0 0 auto; }
  .ops-filter { padding: .8rem; }
  .ops-actions .button { min-height: 44px; }
  .mobile-more-grid { grid-template-columns: 1fr; }
}

@media (max-width: 390px) {
  .incident-type-grid { grid-template-columns: 1fr; }
  .wizard-footer { display: grid; grid-template-columns: auto minmax(0, 1fr); }
  .wizard-footer .right { gap: .4rem; }
  .assistant-launcher strong { display: none; }
  .assistant-launcher { width: 50px; justify-content: center; padding: 0; }
}

.workforce-shell { overflow: hidden; }
.workforce-tabs { display: flex; gap: .35rem; padding: .75rem; overflow-x: auto; border-bottom: 1px solid var(--line); scrollbar-width: thin; }
.workforce-tabs button { flex: 0 0 auto; min-height: 44px; padding: .65rem .9rem; border: 1px solid transparent; border-radius: 10px; color: var(--muted); background: transparent; font: inherit; font-weight: 700; cursor: pointer; }
.workforce-tabs button:hover { background: var(--surface-soft); color: var(--text); }
.workforce-tabs button.active { color: var(--accent); background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 32%, var(--line)); }
#workforce-content { padding: 1rem; }
.workforce-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; margin-bottom: 1rem; }
.workforce-head h2, .workforce-head p { margin: 0; }
.workforce-head p { margin-top: .25rem; color: var(--muted); }
.ops-card-grid, .dispatch-board { display: grid; grid-template-columns: repeat(auto-fit,minmax(290px,1fr)); gap: 1rem; }
.ops-record, .dispatch-card { display: grid; align-content: start; gap: .8rem; padding: 1rem; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); box-shadow: 0 5px 15px rgba(3,25,43,.05); }
.ops-record > header, .dispatch-card > header { display: flex; justify-content: space-between; align-items: flex-start; gap: .75rem; }
.ops-record h3, .ops-record p, .dispatch-card h3, .dispatch-card p { margin: 0; }
.ops-record header p, .dispatch-card header span { color: var(--muted); font-size: .85rem; }
.post-order-body { min-height: 5rem; line-height: 1.55; }
.mini-facts { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: .55rem; margin: 0; }
.mini-facts div { min-width: 0; padding: .55rem; border-radius: 9px; background: var(--surface-soft); }
.mini-facts dt { color: var(--muted); font-size: .8rem; }
.mini-facts dd { margin: .12rem 0 0; font-weight: 700; overflow-wrap: anywhere; }
.record-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.full-button { width: 100%; }
.welfare-alarmed { border-color: var(--danger); box-shadow: 0 0 0 3px color-mix(in srgb,var(--danger) 15%,transparent); }
.dispatch-card { border-left: 5px solid var(--line); }
.dispatch-card.priority-priority { border-left-color: var(--accent); }
.dispatch-card.priority-urgent { border-left-color: var(--warning); }
.dispatch-card.priority-critical { border-left-color: var(--danger); }
.split-panels, .asset-groups { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 1rem; }
.split-panels > section, .asset-groups > section { min-width: 0; }
.split-panels h3, .asset-groups h3 { margin: 0 0 .65rem; }
.record-stack { display: grid; gap: .65rem; }
.record-line.rich { align-items: flex-start; padding: .85rem; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.record-line.rich > div:first-child { display: grid; gap: .25rem; min-width: 0; }
.record-line.rich > div:last-child { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .4rem; }
.record-line.rich p { margin: .25rem 0; }
.record-line.rich small { display: block; font-size: .85rem; line-height: 1.35; }
.compact-counts { display: flex; gap: .75rem; margin: 0; text-align: center; }
.compact-counts dt { color: var(--muted); font-size: .8rem; }
.compact-counts dd { margin: 0; font-size: 1.2rem; font-weight: 800; }
.history-block { margin-top: 1.25rem; border-top: 1px solid var(--line); padding-top: 1rem; }
.history-block > summary { margin-bottom: 1rem; font-weight: 800; cursor: pointer; }
.record-history { border-top: 1px solid var(--line); padding-top: .65rem; }
.record-history > summary { cursor: pointer; color: var(--accent); font-weight: 700; }
.history-entry { display: grid; gap: .12rem; margin-top: .55rem; padding: .55rem; border-radius: 8px; background: var(--surface-soft); }
.history-entry span, .history-entry small { color: var(--muted); font-size: .8rem; }
.wf-dialog .dialog { width: min(760px,calc(100vw - 2rem)); }
.wf-dialog textarea { min-height: 110px; }

@media (max-width: 760px) {
  #workforce-content { padding: .75rem; }
  .workforce-head { flex-direction: column; }
  .workforce-head > .button, .workforce-head > .record-actions { width: 100%; }
  .workforce-head > .record-actions .button { flex: 1; }
  .ops-card-grid, .dispatch-board, .split-panels, .asset-groups { grid-template-columns: 1fr; }
  .mini-facts { grid-template-columns: 1fr 1fr; }
  .record-line.rich { display: grid; gap: .75rem; }
  .record-line.rich > div:last-child { justify-content: flex-start; }
  .record-actions .button { min-height: 44px; }
}

@media (max-width: 430px) {
  .workforce-tabs { margin: -.75rem -.75rem 0; padding-inline: .75rem; }
  .ops-record, .dispatch-card { padding: .85rem; }
  .mini-facts { grid-template-columns: 1fr; }
  .wf-dialog .dialog-body.grid.two { grid-template-columns: 1fr; }
}

.roster-shell { overflow: hidden; }
.roster-tabs { display: flex; gap: .35rem; padding: .75rem; overflow-x: auto; border-bottom: 1px solid var(--line); scrollbar-width: thin; }
.roster-tabs button { flex: 0 0 auto; min-height: 44px; padding: .65rem .9rem; border: 1px solid transparent; border-radius: 10px; background: transparent; color: var(--muted); font: inherit; font-weight: 750; cursor: pointer; }
.roster-tabs button:hover { background: var(--surface-soft); color: var(--ink); }
.roster-tabs button.active { background: var(--accent-soft); color: var(--accent); border-color: color-mix(in srgb,var(--accent) 30%,var(--line)); }
#roster-content { padding: 1rem; }
.roster-state { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .85rem 1rem; margin-bottom: 1rem; border: 1px solid var(--line); border-left: 5px solid var(--warning); border-radius: 12px; background: var(--surface-soft); }
.roster-state.positive { border-left-color: var(--success); }
.roster-state.danger { border-left-color: var(--danger); }
.roster-state > div { display: grid; gap: .15rem; }
.roster-state span, .roster-state p { color: var(--muted); font-size: .85rem; margin: 0; }
.roster-toolbar { display: flex; align-items: end; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.field.compact { max-width: 260px; }
.roster-summary { display: grid; grid-template-columns: repeat(auto-fit,minmax(125px,1fr)); gap: .65rem; margin-bottom: 1.1rem; }
.roster-summary > div { display: grid; gap: .15rem; padding: .8rem; border-radius: 11px; background: var(--surface-soft); border: 1px solid var(--line); }
.roster-summary strong { font-size: 1.35rem; color: var(--ink); }
.roster-summary span { color: var(--muted); font-size: .78rem; }
.roster-day { display: grid; gap: 1.2rem; }
.roster-day section > h2, .roster-week-grid section > h2 { margin: 0 0 .65rem; font-size: 1.05rem; }
.roster-card-grid { display: grid; grid-template-columns: repeat(auto-fit,minmax(260px,1fr)); gap: .7rem; }
.roster-position { display: grid; align-content: start; gap: .55rem; min-width: 0; padding: .8rem; border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: 11px; background: var(--surface); }
.roster-position.needs-cover { border-left-color: var(--warning); }
.roster-position > header { display: flex; align-items: flex-start; justify-content: space-between; gap: .5rem; }
.roster-position > header > div { display: grid; gap: .08rem; }
.roster-position header span, .roster-position > p { color: var(--muted); font-size: .8rem; margin: 0; }
.roster-position h3 { margin: .05rem 0; font-size: 1rem; overflow-wrap: anywhere; }
.roster-flags { display: flex; flex-wrap: wrap; gap: .3rem; }
.roster-week-grid { display: grid; grid-template-columns: repeat(7,minmax(220px,1fr)); gap: .7rem; overflow-x: auto; padding-bottom: .5rem; }
.roster-week-grid section { min-width: 220px; }
.roster-week-grid section > div { display: grid; gap: .5rem; }
.roster-week-grid .roster-position { padding: .65rem; }
.roster-week-grid .roster-position header > .badge { display: none; }
.attendance-row { display: flex; justify-content: space-between; align-items: center; gap: .75rem; padding: .75rem .85rem; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.attendance-row > div { display: flex; align-items: center; flex-wrap: wrap; gap: .5rem; }
.attendance-row > div:first-child { display: grid; gap: .12rem; }
.attendance-row span { color: var(--muted); font-size: .82rem; }
.roster-split { grid-template-columns: minmax(0,1.4fr) minmax(300px,.6fr); }
.payroll-actions { justify-content: flex-end; margin-top: 1rem; }
.analysis-bars { display: grid; gap: .75rem; }
.analysis-row { display: grid; grid-template-columns: 75px minmax(120px,1fr) minmax(280px,2fr); gap: .75rem; align-items: center; }
.analysis-row > div { height: 14px; overflow: hidden; border-radius: 999px; background: var(--surface-soft); }
.analysis-row > div > span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg,var(--accent),#38bdf8); }
.analysis-row small { color: var(--muted); }
.roster-admin { grid-template-columns: repeat(2,minmax(0,1fr)); }
.roster-admin section { padding: .9rem; border: 1px solid var(--line); border-radius: 12px; }
.mode-guide { display: grid; gap: .7rem; margin: 1rem 0; }
.mode-guide > div { padding: .75rem; border-radius: 10px; background: var(--surface-soft); }
.mode-guide dt { font-weight: 800; }
.mode-guide dd { margin: .15rem 0 0; color: var(--muted); }
.chip-list { display: flex; flex-wrap: wrap; gap: .45rem; }
.filter-chip button { margin-left: .35rem; border: 0; background: transparent; color: inherit; cursor: pointer; }
.roster-dialog .dialog { width: min(780px,calc(100vw - 2rem)); max-height: 92vh; overflow: auto; }

@media (max-width: 900px) {
  .roster-admin, .roster-split { grid-template-columns: 1fr; }
  .analysis-row { grid-template-columns: 65px minmax(90px,1fr); }
  .analysis-row small { grid-column: 1 / -1; }
}

@media (max-width: 760px) {
  #roster-content { padding: .75rem; }
  .roster-tabs { margin: -.75rem -.75rem 0; padding-inline: .75rem; }
  .roster-toolbar, .roster-state { align-items: stretch; flex-direction: column; }
  .roster-toolbar .field.compact { max-width: none; width: 100%; }
  .roster-toolbar .record-actions, .roster-state .button { width: 100%; }
  .roster-toolbar .record-actions > * { flex: 1 1 120px; min-height: 44px; }
  .roster-week-grid { display: grid; grid-template-columns: 1fr; overflow: visible; }
  .roster-week-grid section { min-width: 0; padding-bottom: .8rem; border-bottom: 1px solid var(--line); }
  .roster-card-grid { grid-template-columns: 1fr; }
  .attendance-row { align-items: stretch; flex-direction: column; }
  .attendance-row > div:last-child { justify-content: space-between; }
  .roster-position .record-actions .button { min-height: 44px; flex: 1; }
}

@media (max-width: 430px) {
  .roster-summary { grid-template-columns: 1fr 1fr; }
  .roster-summary > div { padding: .65rem; }
  .roster-position { padding: .7rem; }
  .roster-dialog .dialog-body.grid.two { grid-template-columns: 1fr; }
}

@media print {
  .sidebar, .mobile-brand, .mobile-nav, .top-actions, .wizard-footer, .tabs, .no-print, .toast-region { display: none !important; }
  .app-shell { display: block; }
  .main { padding: 0; }
  .main-content { padding: 0; }
  .card, .detail-hero { box-shadow: none; break-inside: avoid; }
  body { background: #fff; }
}


/* Shared roster workspace: one dataset, operational and administration views. */
.roster-area-head { display:flex; justify-content:space-between; align-items:center; gap:12px; padding:14px 16px; border-bottom:1px solid var(--line,#d9e4eb); }
.roster-area-head strong { font-size:14px; }
.roster-pending { border:1px dashed #b77916; border-left:4px solid #b77916; background:#fffaf0; }
.roster-pending h3 { color:#59420b; }
.roster-pending-notice { display:flex; align-items:center; flex-wrap:wrap; gap:8px; margin:12px 0; }
.roster-master-filters { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:12px; align-items:end; margin:18px 0; }
.roster-master-filters .field { min-width:0; }
.roster-master-filters input,.roster-master-filters select { width:100%; min-width:0; }
.roster-master-filters > .record-actions { grid-column:1/-1; justify-content:flex-end; }
.roster-master-table { max-height:65vh; border:1px solid #d9e4eb; border-radius:10px; }
.roster-master-table thead { position:sticky; top:0; z-index:1; background:var(--panel,#f1f6f9); }
.roster-master-table td { vertical-align:middle; }
.roster-master-table td .cell-note { display:block; max-width:280px; overflow-wrap:anywhere; }
.master-pending-row { background:rgba(214,149,34,.08); }
.master-dialog { max-width:900px; }
.master-dialog .dialog-body { max-height:70vh; overflow-y:auto; }
.master-dialog #master-error:not(:empty) { padding:12px; background:#fff2ed; color:#84221b; border-radius:8px; }
.roster-week-edit { margin:0 0 14px 8px; }
.leave-type-catalogue { margin-top:24px; padding:18px; }
.leave-paste-panel { margin-top:20px; border-top:1px solid #d9e4eb; padding-top:16px; }
.leave-paste-panel textarea { width:100%; min-height:180px; font-family:ui-monospace,monospace; }
.leave-paste-panel [data-types-preview] { margin-top:18px; }
[data-theme="dark"] .roster-pending { background:#332b18; }
[data-theme="dark"] .roster-pending h3 { color:#f2d89f; }
[data-theme="dark"] .roster-master-table thead { background:#162634; }
@media(max-width:1100px) { .roster-master-filters { grid-template-columns:repeat(3,minmax(130px,1fr)); } }
@media(max-width:650px) {
 .roster-area-head { align-items:flex-start; }
 .roster-master-filters { grid-template-columns:repeat(2,minmax(0,1fr)); }
 .roster-master-filters .field:nth-child(3) { grid-column:1/-1; }
 .roster-master-filters button { width:100%; }
 .master-dialog .dialog-body.grid.two { grid-template-columns:1fr; }
 .master-dialog .dialog-footer { flex-wrap:wrap; }
 .roster-toolbar .record-actions { flex-wrap:wrap; }
 .leave-type-catalogue { padding:12px; }
}
