:root {
  --bg: #0b1220; --bg2: #101a2d; --panel: #14213a; --panel2: #1a2a48; --line: #263a5e; --line2: #31497a;
  --text: #dfe7f5; --muted: #8a9bbb; --accent: #3d8bfd; --accent2: #2563c9; --gold: #d4af37;
  --ok: #22c55e; --warn: #f59e0b; --bad: #ef4444; --info: #38bdf8; --purple: #a78bfa;
  --mono: 'Consolas', 'Cascadia Mono', 'Courier New', monospace;
  --radius: 6px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font: 14px/1.45 'Segoe UI', system-ui, -apple-system, sans-serif; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0 0 .5em; font-weight: 600; }
h1 { font-size: 22px; } h2 { font-size: 18px; } h3 { font-size: 15px; } h4 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.hidden { display: none !important; }
.muted { color: var(--muted); } .small { font-size: 12px; } .mono { font-family: var(--mono); }
.nowrap { white-space: nowrap; } .right { text-align: right; } .center { text-align: center; }
.pre { white-space: pre-wrap; word-break: break-word; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grow { flex: 1; }
.grid { display: grid; gap: 14px; }
.grid > * { min-width: 0; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } .g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.span2 { grid-column: span 2; } .full { grid-column: 1 / -1; }

/* ---- layout */
.app { display: flex; height: 100vh; }
.sidebar { width: 220px; background: linear-gradient(180deg, #0e1a30, #0a1324); border-right: 1px solid var(--line); display: flex; flex-direction: column; flex-shrink: 0; }
.brand { display: flex; gap: 10px; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.brand img { width: 44px; height: 44px; object-fit: contain; }
.brand b { display: block; font-size: 18px; letter-spacing: .08em; color: var(--gold); }
.brand small { color: var(--muted); font-size: 11px; letter-spacing: .15em; }
nav { flex: 1; overflow-y: auto; padding: 8px 0; }
nav .sec { padding: 12px 18px 4px; font-size: 10px; letter-spacing: .15em; color: var(--muted); text-transform: uppercase; }
nav a { display: flex; align-items: center; gap: 10px; padding: 8px 18px; color: var(--text); border-left: 3px solid transparent; }
nav a:hover { background: var(--panel); text-decoration: none; }
nav a.active { background: var(--panel2); border-left-color: var(--accent); color: #fff; }
nav a .ico { width: 18px; text-align: center; opacity: .85; }
nav a .count { margin-left: auto; background: var(--bad); color: #fff; border-radius: 10px; font-size: 11px; padding: 0 7px; }
.sidebar-foot { padding: 10px 16px; border-top: 1px solid var(--line); font-family: var(--mono); color: var(--muted); font-size: 12px; }
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar { display: flex; align-items: center; gap: 12px; padding: 8px 16px; background: var(--bg2); border-bottom: 1px solid var(--line); }
.global-search { flex: 1; max-width: 520px; }
.global-search input { width: 100%; }
.top-unit { display: flex; gap: 8px; align-items: center; font-size: 12px; }
.view { flex: 1; overflow-y: auto; padding: 18px 20px 40px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.page-head h1 { margin: 0; }
.page-head .sub { color: var(--muted); font-size: 13px; }
.mobile-only { display: none; }
.client-mode .staff-only, body:not(.client-mode) .client-only { display: none !important; }
/* Modern-layout-only shell pieces (see theme-modern.css) */
.tb-brand, .topnav, .statusbar { display: none; }

/* ---- controls */
input, select, textarea { background: #0c1628; color: var(--text); border: 1px solid var(--line2); border-radius: var(--radius); padding: 7px 9px; font: inherit; width: 100%; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px rgba(61, 139, 253, .25); }
input[type=checkbox], input[type=radio] { width: auto; accent-color: var(--accent); transform: scale(1.15); }
input[type=color] { padding: 2px; height: 34px; }
textarea { min-height: 80px; resize: vertical; }
textarea.narrative { min-height: 320px; font-family: var(--mono); font-size: 13px; line-height: 1.55; }
input[readonly] { opacity: .7; }
.btn { display: inline-flex; align-items: center; gap: 6px; background: var(--panel2); color: var(--text); border: 1px solid var(--line2); border-radius: var(--radius); padding: 7px 13px; font: inherit; font-weight: 500; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: var(--accent); text-decoration: none; }
.btn.primary { background: var(--accent2); border-color: var(--accent); color: #fff; }
.btn.ok { background: #15803d; border-color: var(--ok); color: #fff; }
.btn.warn { background: #b45309; border-color: var(--warn); color: #fff; }
.btn.danger { background: #991b1b; border-color: var(--bad); color: #fff; }
.btn.ghost { background: transparent; }
.btn.sm { padding: 3px 9px; font-size: 12px; }
.btn.block { width: 100%; justify-content: center; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.panic { background: #b91c1c; border: 2px solid #ff4d4d; color: #fff; font-weight: 800; letter-spacing: .1em; }
.btn.panic:hover { background: #dc2626; }
.icon-btn { background: none; border: none; color: var(--text); font-size: 20px; cursor: pointer; }
.user-menu { position: relative; }
.user-btn { background: var(--panel); border: 1px solid var(--line2); color: var(--text); border-radius: 20px; padding: 5px 12px; cursor: pointer; font: inherit; }
.dropdown { position: absolute; right: 0; top: 110%; background: var(--panel); border: 1px solid var(--line2); border-radius: var(--radius); min-width: 180px; z-index: 50; box-shadow: 0 8px 24px rgba(0,0,0,.5); }
.dropdown a { display: block; padding: 9px 14px; color: var(--text); }
.dropdown a:hover { background: var(--panel2); text-decoration: none; }

/* ---- cards & panels */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 14px 16px; }
.card + .card { margin-top: 14px; }
.card > h3:first-child, .card > .card-head:first-child { margin-top: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.card-head h3 { margin: 0; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; border-left: 4px solid var(--accent); }
.stat b { display: block; font-size: 26px; font-family: var(--mono); line-height: 1.1; }
.stat span { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; }
.stat.bad { border-left-color: var(--bad); } .stat.warn { border-left-color: var(--warn); } .stat.ok { border-left-color: var(--ok); } .stat.gold { border-left-color: var(--gold); }
a.stat:hover { text-decoration: none; background: var(--panel2); }
.stat-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
@media (min-width: 1500px) { .stat-grid { grid-template-columns: repeat(9, minmax(0, 1fr)); } .stat-grid .stat span { font-size: 11px; } }
@media (max-width: 560px) { .stat-grid { gap: 6px; } .stat-grid .stat { padding: 8px 9px; } .stat-grid .stat b { font-size: 20px; } .stat-grid .stat span { font-size: 10px; letter-spacing: .03em; } }
.tbl .mono, .tbl td.nowrap { white-space: nowrap; }
.kv { display: grid; grid-template-columns: 160px 1fr; gap: 6px 14px; }
.kv > div { min-width: 0; overflow-wrap: anywhere; }
.kv > div:nth-child(odd) { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; padding-top: 1px; }
.empty { color: var(--muted); padding: 18px; text-align: center; font-style: italic; }
.notice { padding: 10px 14px; border-radius: var(--radius); border: 1px solid var(--line2); background: var(--panel2); margin-bottom: 12px; }
.notice.bad { border-color: var(--bad); background: rgba(239, 68, 68, .12); }
.notice.warn { border-color: var(--warn); background: rgba(245, 158, 11, .12); }
.notice.ok { border-color: var(--ok); background: rgba(34, 197, 94, .1); }

/* ---- tables */
.tbl-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { text-align: left; font-weight: 600; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .05em; padding: 8px 10px; border-bottom: 1px solid var(--line2); white-space: nowrap; }
.tbl td { padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl tr[data-href] { cursor: pointer; }
.tbl tbody tr:hover { background: rgba(61, 139, 253, .07); }
.tbl .actions { white-space: nowrap; text-align: right; }

/* ---- badges */
.badge { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 11px; font-weight: 600; letter-spacing: .03em; background: var(--line2); color: #fff; white-space: nowrap; border: 1px solid transparent; }
.badge.outline { background: transparent; border-color: currentColor; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 4px; background: var(--panel2); border: 1px solid var(--line2); font-size: 12px; font-family: var(--mono); margin: 2px 3px 2px 0; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--muted); flex-shrink: 0; }

/* ---- tabs */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line2); margin-bottom: 14px; flex-wrap: wrap; }
.tabs a { padding: 8px 14px; color: var(--muted); border-bottom: 2px solid transparent; cursor: pointer; }
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a.active { color: #fff; border-bottom-color: var(--accent); }
.tabs a .n { background: var(--line2); border-radius: 8px; padding: 0 6px; font-size: 11px; margin-left: 4px; color: var(--text); }

/* ---- forms */
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(210px, 100%), 1fr)); gap: 10px 14px; }
.form-grid > * { min-width: 0; }
.fld label { display: block; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 3px; }
.fld label .req { color: var(--bad); }
.fld .help { font-size: 11px; color: var(--muted); margin-top: 2px; }
.fld.check { display: flex; align-items: center; gap: 8px; padding-top: 18px; }
.fld.check label { margin: 0; font-size: 13px; text-transform: none; letter-spacing: 0; color: var(--text); cursor: pointer; }
.form-sec { grid-column: 1 / -1; border-bottom: 1px solid var(--line2); padding: 8px 0 4px; margin-top: 6px; font-size: 12px; text-transform: uppercase; letter-spacing: .1em; color: var(--gold); }
.perm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 10px 18px; }
.perm-group h4 { margin: 4px 0 6px; color: var(--gold); }
.perm-item { display: flex !important; gap: 8px; align-items: flex-start; padding: 3px 0; text-transform: none !important; letter-spacing: 0 !important; font-size: 13px !important; color: var(--text) !important; cursor: pointer; }
.perm-item input { margin-top: 3px; }
.perm-item input:disabled + span { color: var(--muted); }
.rep-row { background: var(--bg2); border: 1px solid var(--line); border-radius: 6px; padding: 10px 12px; margin-bottom: 10px; position: relative; }
.rep-row .rep-del { position: absolute; top: 6px; right: 8px; }
.rep-row .rep-title { font-size: 12px; color: var(--gold); text-transform: uppercase; letter-spacing: .08em; margin-bottom: 6px; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 12px; }
.filters > * { width: auto; }
.filters input, .filters select { min-width: 140px; max-width: 100%; }
.filters .filter-wide { min-width: min(360px, 100%); flex: 1; }

/* ---- modal */
.modal-bg { position: fixed; inset: 0; background: rgba(2, 6, 16, .72); display: flex; align-items: flex-start; justify-content: center; z-index: 100; padding: 40px 16px; overflow-y: auto; }
.modal { background: var(--panel); border: 1px solid var(--line2); border-radius: 10px; width: 100%; max-width: 640px; box-shadow: 0 20px 60px rgba(0,0,0,.6); }
.modal.wide { max-width: 980px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.modal-head h2 { margin: 0; font-size: 16px; }
.modal-body { padding: 16px; max-height: calc(100vh - 200px); overflow-y: auto; }
.modal-foot { display: flex; gap: 8px; justify-content: flex-end; padding: 12px 16px; border-top: 1px solid var(--line); }
.modal-foot .left { margin-right: auto; }

/* ---- toasts & alerts */
#toasts { position: fixed; bottom: 18px; right: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 200; }
.toast { background: var(--panel2); border: 1px solid var(--line2); border-left: 4px solid var(--ok); padding: 10px 14px; border-radius: 6px; min-width: 240px; max-width: 420px; box-shadow: 0 8px 20px rgba(0,0,0,.5); animation: slidein .2s; }
.toast.err { border-left-color: var(--bad); }
@keyframes slidein { from { transform: translateX(30px); opacity: 0; } }
.alert-panic { background: repeating-linear-gradient(45deg, #7f1d1d, #7f1d1d 14px, #991b1b 14px, #991b1b 28px); color: #fff; padding: 10px 18px; display: flex; gap: 12px; align-items: center; font-weight: 700; animation: flash 1s infinite; border-bottom: 2px solid #ff4d4d; }
.alert-panic .grow { font-family: var(--mono); letter-spacing: .05em; }
@keyframes flash { 50% { filter: brightness(1.4); } }

/* ---- login */
.login { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; background: radial-gradient(circle at 50% 20%, #17305a, #070d18 70%); }
.login-banner { background: #fff; border-radius: 8px; margin: -12px -12px 16px; overflow: hidden; }
.login-banner img { display: block; width: 100%; height: 120px; object-fit: cover; object-position: center 55%; }
.login-card { width: 400px; background: rgba(20, 33, 58, .95); border: 1px solid var(--line2); border-radius: 12px; padding: 30px; text-align: center; box-shadow: 0 30px 80px rgba(0,0,0,.6); }
.login-card h1 { font-size: 18px; color: var(--gold); margin-top: 10px; }
.login-card label { display: block; text-align: left; font-size: 12px; color: var(--muted); margin: 12px 0; }
.login-card label input { margin-top: 4px; }
.login-logo { width: 96px; height: 96px; object-fit: contain; }
.logo-preview { max-height: 90px; max-width: 100%; background: #fff; border-radius: 6px; padding: 4px; margin-top: 6px; }
.login-err { color: var(--bad); min-height: 20px; margin-top: 10px; }

/* ---- staff board */
.board-group { margin-bottom: 18px; }
.board-group > h3 { display: flex; align-items: center; gap: 8px; border-bottom: 1px solid var(--line); padding-bottom: 6px; }
.emp-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 10px; }
.emp-card { display: flex; gap: 10px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 10px; cursor: pointer; border-left: 4px solid var(--line2); color: var(--text); }
.emp-card:hover { border-color: var(--accent); text-decoration: none; }
.avatar { width: 44px; height: 44px; border-radius: 6px; background: var(--panel2); display: flex; align-items: center; justify-content: center; font-weight: 700; color: var(--gold); flex-shrink: 0; overflow: hidden; border: 1px solid var(--line2); }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.lg { width: 96px; height: 96px; font-size: 30px; border-radius: 10px; }
.emp-card .nm { font-weight: 600; }
.emp-card .meta { font-size: 12px; color: var(--muted); }
.contract-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; }
.contract-card { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; color: var(--text); display: block; border-top: 3px solid var(--accent); }
.contract-card:hover { border-color: var(--accent); text-decoration: none; }
.contract-card .stats { display: flex; gap: 14px; margin-top: 8px; font-size: 12px; color: var(--muted); }
.contract-card .stats b { color: var(--text); font-family: var(--mono); }

/* ---- CAD */
.cad { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 14px; }
.call { background: var(--panel); border: 1px solid var(--line); border-left: 5px solid var(--muted); border-radius: 6px; padding: 10px 12px; margin-bottom: 8px; cursor: pointer; }
.call:hover { border-color: var(--accent); }
.call.p1 { border-left-color: var(--bad); } .call.p2 { border-left-color: var(--warn); } .call.p3 { border-left-color: var(--info); } .call.p4 { border-left-color: var(--muted); }
.call.panic { background: rgba(185, 28, 28, .25); border-color: var(--bad); animation: flash 1s infinite; }
.call .cno { font-family: var(--mono); color: var(--gold); font-weight: 600; }
.call .loc { font-weight: 600; }
.unit-row td:first-child { font-family: var(--mono); font-weight: 700; }
.us-Available { color: var(--ok); } .us-Dispatched { color: var(--purple); } .us-En-Route { color: var(--warn); } .us-On-Scene { color: var(--info); }
.us-Busy { color: #fb923c; } .us-Break { color: var(--muted); } .us-Panic { color: #ff4d4d; font-weight: 800; animation: flash 1s infinite; } .us-Off-Duty { color: #64748b; }
.bg-Available { background: #15803d; } .bg-Dispatched { background: #6d28d9; } .bg-En-Route { background: #b45309; } .bg-On-Scene { background: #0369a1; }
.bg-Busy { background: #c2410c; } .bg-Break { background: #475569; } .bg-Panic { background: #b91c1c; } .bg-Off-Duty { background: #334155; }
.log { max-height: 300px; overflow-y: auto; font-family: var(--mono); font-size: 12px; background: #08101e; border: 1px solid var(--line); border-radius: 6px; padding: 8px; }
.log div { padding: 2px 0; border-bottom: 1px dotted #1b2a45; }
.log .sys { color: var(--muted); }
.log time { color: var(--gold); margin-right: 8px; }

/* ---- MDT */
.mdt-status { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; }
.mdt-status button { padding: 16px 8px; font-size: 14px; font-weight: 700; border-radius: 8px; border: 2px solid transparent; color: #fff; cursor: pointer; opacity: .55; letter-spacing: .04em; }
.mdt-status button.on { opacity: 1; border-color: #fff; box-shadow: 0 0 0 2px rgba(255,255,255,.2), 0 0 18px rgba(255,255,255,.15); }
.mdt-status button:hover { opacity: .9; }
/* ---- bodycam / video */
.drop-zone { border: 2px dashed var(--line2); border-radius: 10px; padding: 22px; text-align: center; background: var(--bg2); cursor: pointer; transition: border-color .15s, background .15s; }
.drop-zone:hover, .drop-zone.over { border-color: var(--accent); background: rgba(61, 139, 253, .08); }
.drop-big { font-size: 16px; font-weight: 600; margin-bottom: 4px; }
.up-row { margin-top: 8px; } .up-row .track { background: var(--bg2); height: 8px; border-radius: 4px; overflow: hidden; margin-top: 3px; }
.up-row .fill { background: linear-gradient(90deg, var(--accent2), var(--ok)); height: 100%; transition: width .2s; }
.media-list { margin-top: 12px; display: grid; gap: 12px; }
.media-item { background: var(--bg2); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; }
.media-item video { width: 100%; max-height: 480px; margin-top: 8px; border-radius: 6px; background: #000; }
.media-embed { position: relative; padding-top: 56.25%; margin-top: 8px; } .media-embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; border-radius: 6px; }
.modal-body p { white-space: pre-line; }
.theme-opts { display: grid; gap: 10px; }
.theme-opt { display: flex; gap: 12px; align-items: center; padding: 10px 12px; border: 2px solid var(--line2); border-radius: var(--radius); cursor: pointer; background: var(--bg2); }
.theme-opt:hover { border-color: var(--accent); }
.theme-opt:has(input:checked) { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.theme-opt .swatch { width: 92px; height: 54px; flex-shrink: 0; border: 1px solid rgba(0,0,0,.35); display: grid; grid-template: 10px 1fr / 18px 1fr; overflow: hidden; }
.theme-opt .swatch i { display: block; } .theme-opt .swatch i:first-child { grid-row: 1 / 3; }

/* ---- MDT terminal */
.mdt { display: flex; flex-direction: column; height: calc(100vh - var(--mdt-offset, 110px)); min-height: 560px; background: #070d18; border: 1px solid var(--line2); border-radius: 8px; overflow: hidden; }
.mdt-bar { display: flex; align-items: center; gap: 18px; padding: 8px 14px; background: linear-gradient(180deg, #13223d, #0d1729); border-bottom: 1px solid var(--line2); font-size: 13px; flex-wrap: wrap; }
.mdt-brand { color: var(--gold); letter-spacing: .15em; font-family: var(--mono); }
.mdt-body { flex: 1; display: grid; grid-template-columns: 250px minmax(0, 1fr); min-height: 0; }
.mdt-side { display: flex; flex-direction: column; padding: 12px; border-right: 1px solid var(--line2); background: #0a1322; overflow-y: auto; }
.mdt-label { font-family: var(--mono); font-size: 11px; letter-spacing: .15em; color: var(--muted); margin-bottom: 6px; }
.mdt-keys { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.mdt-key { position: relative; padding: 14px 6px 10px; background: #111d33; border: 1px solid var(--line2); border-radius: 6px; color: var(--text); font: 700 12px var(--mono); letter-spacing: .05em; cursor: pointer; }
.mdt-key:hover { border-color: var(--accent); }
.mdt-key .k { position: absolute; top: 3px; left: 6px; font-size: 10px; color: var(--muted); font-weight: 400; }
.mdt-key.on { color: #fff; border-color: #fff; box-shadow: 0 0 14px rgba(255, 255, 255, .15); }
.mdt-site { background: #111d33; border: 1px solid var(--line2); border-radius: 6px; padding: 8px 10px; margin-bottom: 6px; }
.mdt-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 14px; }
.mdt-actions .btn { justify-content: center; font-size: 12px; padding: 8px 4px; white-space: normal; text-align: center; }
.mdt-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.mdt-tabs { scrollbar-width: none; display: flex; gap: 2px; padding: 6px 8px 0; background: #0a1322; border-bottom: 1px solid var(--line2); overflow-x: auto; }
.mdt-tabs button { background: transparent; border: 1px solid transparent; border-bottom: none; color: var(--muted); font: 700 12px var(--mono); letter-spacing: .08em; padding: 9px 14px; border-radius: 6px 6px 0 0; cursor: pointer; white-space: nowrap; }
.mdt-tabs::-webkit-scrollbar { display: none; }
.mdt-tabs button:hover { color: var(--text); }
.mdt-tabs button.on { background: #070d18; color: #fff; border-color: var(--line2); margin-bottom: -1px; }
.mdt-tabs .n { margin-left: 6px; background: var(--bad); color: #fff; border-radius: 8px; padding: 0 6px; font-size: 10px; }
.mdt-screen { flex: 1; overflow-y: auto; padding: 14px 16px; }
.mdt-empty { text-align: center; padding: 60px 10px; font-family: var(--mono); letter-spacing: .12em; color: var(--muted); }
.mdt-empty .small { letter-spacing: 0; margin-top: 6px; font-family: inherit; }
.mdt-call { border: 1px solid var(--line2); border-left: 6px solid var(--info); border-radius: 6px; padding: 12px 14px; background: #0d1729; }
.mdt-call.p1 { border-left-color: var(--bad); } .mdt-call.p2 { border-left-color: var(--warn); } .mdt-call.panic { background: rgba(185, 28, 28, .2); animation: flash 1s infinite; }
.mdt-call .cno { font: 700 16px var(--mono); color: var(--gold); }
.mdt-loc { font-size: 20px; font-weight: 700; margin: 6px 0 8px; }
.mdt-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 6px 16px; font-size: 13px; }
.mdt-grid span { display: block; font: 10px var(--mono); letter-spacing: .12em; color: var(--muted); }
.mdt-narr { white-space: pre-wrap; font-family: var(--mono); font-size: 12.5px; background: #08101e; border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; margin-top: 6px; }
.mdt-table td, .mdt-table th { font-size: 12.5px; }
.mdt-chips { display: flex; flex-wrap: wrap; gap: 4px; }
@media (max-width: 1000px) { .mdt-body { grid-template-columns: 210px minmax(0, 1fr); } .mdt-key { padding: 12px 4px 8px; font-size: 11px; } .mdt-side .big-panic { font-size: 16px; letter-spacing: .08em; padding: 16px 6px; } }
@media (max-width: 700px) { .mdt { height: auto; min-height: 0; } .mdt-body { grid-template-columns: 1fr; } .mdt-side { border-right: none; border-bottom: 1px solid var(--line2); }
  .mdt-screen { min-height: 360px; } .mdt-bar { gap: 10px; } .big-panic { padding: 14px; font-size: 18px; } }
.site-btns { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px; }
.site-btn { text-align: left; background: var(--bg2); border: 2px solid var(--line2); border-radius: 8px; padding: 10px 12px; color: var(--text); cursor: pointer; font: inherit; }
.site-btn:hover { border-color: var(--accent); }
.site-btn.on { border-color: var(--ok); background: rgba(34, 197, 94, .14); box-shadow: 0 0 12px rgba(34, 197, 94, .2); }
.site-btn b { display: block; } .site-btn span { font-size: 12px; color: var(--muted); }
.site-board { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 12px; }
.site-tile { background: var(--panel); border: 1px solid var(--line); border-left: 5px solid var(--muted); border-radius: 8px; padding: 12px 14px; }
.site-tile.staffed { border-left-color: var(--ok); } .site-tile.short { border-left-color: var(--warn); } .site-tile.empty-site { border-left-color: var(--bad); }
.site-tile.has-call { box-shadow: 0 0 0 1px var(--warn) inset; }
.act-row { display: flex; gap: 8px; padding: 5px 0; border-bottom: 1px dotted var(--line); font-size: 13px; align-items: baseline; }
.act-row time { font-family: var(--mono); color: var(--gold); font-size: 12px; white-space: nowrap; }
.big-panic { width: 100%; padding: 22px; font-size: 22px; letter-spacing: .2em; }

/* ---- incident report */
.report-paper { background: #fff; color: #111; padding: 34px 40px; border-radius: 4px; max-width: 980px; margin: 0 auto; font-size: 13px; }
.report-paper h2, .report-paper h3 { color: #111; }
.report-paper .rp-head { display: flex; gap: 16px; align-items: center; border-bottom: 3px double #0d2547; padding-bottom: 12px; margin-bottom: 14px; }
.report-paper .rp-head img { width: 84px; height: 84px; object-fit: contain; }
.report-paper .rp-head .org { font-size: 20px; font-weight: 700; color: #0d2547; }
.report-paper .rp-head .rno { margin-left: auto; text-align: right; font-family: var(--mono); }
.report-paper .rp-head .rno b { font-size: 18px; display: block; }
.report-paper .sec { background: #0d2547; color: #fff; padding: 4px 10px; font-weight: 700; font-size: 12px; letter-spacing: .1em; text-transform: uppercase; margin: 16px 0 6px; }
.report-paper table { width: 100%; border-collapse: collapse; }
.report-paper td, .report-paper th { border: 1px solid #b8c2d3; padding: 5px 7px; vertical-align: top; text-align: left; }
.report-paper th { background: #eef2f8; font-size: 11px; text-transform: uppercase; color: #333; width: 1%; white-space: nowrap; }
.report-paper .narr { white-space: pre-wrap; font-family: var(--mono); font-size: 12.5px; border: 1px solid #b8c2d3; padding: 10px; line-height: 1.6; }
.report-paper .stamp { display: inline-block; border: 3px solid; padding: 2px 10px; font-weight: 800; letter-spacing: .15em; transform: rotate(-4deg); margin-top: 6px; }
.report-paper .stamp.Approved, .report-paper .stamp.Closed { color: #15803d; } .report-paper .stamp.Submitted { color: #b45309; }
.report-paper .stamp.Draft, .report-paper .stamp.Returned { color: #b91c1c; }
.report-paper .critical { background: #b91c1c; color: #fff; padding: 6px 10px; font-weight: 700; letter-spacing: .08em; margin-bottom: 10px; }
.report-paper .sig { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; margin-top: 40px; }
.report-paper .sig div { border-top: 1px solid #333; padding-top: 4px; font-size: 11px; }
.report-paper .disc { margin-top: 24px; font-size: 10px; color: #666; text-align: center; border-top: 1px solid #ccc; padding-top: 6px; }

/* ---- charts */
.bars { display: flex; flex-direction: column; gap: 5px; }
.bar { display: grid; grid-template-columns: 170px 1fr 50px; gap: 8px; align-items: center; font-size: 12px; }
.bar .lbl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }
.bar .track { background: var(--bg2); border-radius: 3px; height: 16px; overflow: hidden; }
.bar .fill { background: linear-gradient(90deg, var(--accent2), var(--accent)); height: 100%; border-radius: 3px; min-width: 2px; }
.bar .val { font-family: var(--mono); text-align: right; }
.cols { display: flex; align-items: flex-end; gap: 6px; height: 160px; padding-top: 10px; }
.cols .col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; font-size: 11px; color: var(--muted); }
.cols .col .c { width: 100%; max-width: 46px; background: linear-gradient(0deg, var(--accent2), var(--accent)); border-radius: 3px 3px 0 0; min-height: 2px; }
.cols .col b { color: var(--text); font-family: var(--mono); }

.photo { max-width: 160px; max-height: 160px; border-radius: 6px; border: 1px solid var(--line2); }
.flag { display: inline-block; padding: 2px 8px; border-radius: 4px; font-weight: 700; font-size: 11px; margin: 2px; color: #fff; }

@media (max-width: 1100px) { .cad { grid-template-columns: 1fr; } .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 800px) {
  .sidebar { position: fixed; z-index: 80; height: 100%; transform: translateX(-100%); transition: transform .2s; }
  .sidebar.open { transform: none; }
  body.nav-open .main::after { content: ''; position: fixed; inset: 0; background: rgba(2, 6, 16, .55); z-index: 70; }
  .mobile-only { display: inline-block; }
  .g2, .g3 { grid-template-columns: 1fr; }
  .top-unit { display: none; }
  .topbar { flex-wrap: wrap; gap: 8px; padding: 8px 10px; }
  .topbar .global-search { order: 10; flex: 1 0 100%; max-width: none; }
  .topbar .user-menu { margin-left: auto; }
  .user-btn { max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  .tabs::-webkit-scrollbar { display: none; }
  .tabs a { white-space: nowrap; flex-shrink: 0; }
  .page-head > .row { width: 100%; }
  .kv { grid-template-columns: 1fr; }
  .kv > div:nth-child(odd) { padding-top: 6px; }
  .form-grid > [style*="grid-column"] { grid-column: 1 / -1 !important; }
  .view { padding: 12px 12px 32px; }
  .page-head h1 { font-size: 19px; }
  .modal-bg { padding: 10px 6px; }
  .modal-body { max-height: calc(100vh - 140px); }
  .filters > * { flex: 1 1 140px; }
  .report-paper { padding: 16px 12px; font-size: 12.5px; }
  .report-paper .rp-head { flex-wrap: wrap; }
  .report-paper .rp-head .rno { margin-left: 0; text-align: left; }
  .report-paper th { white-space: normal; width: auto; }
  .report-paper td, .report-paper th { padding: 4px 5px; } .report-paper td { overflow-wrap: anywhere; } .report-paper th { font-size: 9.5px; letter-spacing: 0; }
  .report-paper table { display: block; overflow-x: auto; }
  .report-paper .sig { grid-template-columns: 1fr; gap: 28px; }
}

@media print {
  body { background: #fff; }
  .sidebar, .topbar, #alerts, .no-print, #toasts { display: none !important; }
  .app, .main, .view { display: block; height: auto; overflow: visible; padding: 0; }
  .report-paper { max-width: none; padding: 0; border-radius: 0; }
  .card { background: #fff; color: #000; border-color: #999; }
  .print-light, .print-light * { color: #000 !important; background: #fff !important; border-color: #999 !important; }
  .print-light .fill, .print-light .c { background: #555 !important; }
}
