:root {
  font-family: 'DM Sans', sans-serif;
  color: #182321;
  background: #f3f6f5;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  --ink: #182321;
  --muted: #64736f;
  --line: #dfe7e4;
  --green: #087f68;
  --green-dark: #066955;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; min-height: 100vh; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
button:disabled { opacity: .55; cursor: not-allowed; }
[hidden] { display: none !important; }
.page-shell { width: min(1160px, calc(100% - 44px)); margin: 0 auto; }
.topbar { height: 76px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 11px; color: var(--ink); text-decoration: none; font: 800 18px Manrope, sans-serif; letter-spacing: -.06em; }
.brand-mark { width: 36px; height: 36px; border-radius: 12px; display: grid; place-items: center; color: white; background: linear-gradient(145deg, #14a789, #076d5c); letter-spacing: 0; }
.brand-sub { display: block; font: 700 9px 'DM Sans', sans-serif; letter-spacing: .16em; color: var(--muted); margin-top: 2px; }
.session-actions { display: flex; align-items: center; gap: 12px; }
.identity-pill { color: #35504a; font-size: 12px; font-weight: 700; }
.login-layout { display: grid; grid-template-columns: 1.05fr .8fr; gap: 10%; align-items: center; min-height: min(690px, calc(100vh - 120px)); padding: 52px 7%; }
.login-intro h1, .page-heading h1 { font: 800 clamp(32px, 4vw, 48px)/1.1 Manrope, sans-serif; letter-spacing: -.055em; margin: 13px 0; max-width: 510px; }
.login-intro p, .page-heading p { color: var(--muted); line-height: 1.7; max-width: 490px; }
.eyebrow { color: var(--green); font-size: 10px; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; }
.security-note { margin-top: 30px; color: #425a54; font-size: 12px; }
.security-note span { color: var(--green); font-size: 15px; margin-right: 6px; }
.panel { border: 1px solid var(--line); background: white; border-radius: 18px; box-shadow: 0 12px 32px rgba(22, 48, 41, .045); }
.login-panel { padding: 28px; }
.login-panel h2, .queue-heading h2, .case-heading h2 { font: 700 21px Manrope, sans-serif; margin: 7px 0 22px; }
.login-panel label, .review-block label { display: block; color: #42514d; font-size: 12px; font-weight: 700; margin: 14px 0 7px; }
input:not([type="checkbox"]):not([type="radio"]), textarea, select { width: 100%; padding: 12px 13px; border: 1px solid #d5dfdb; border-radius: 9px; color: var(--ink); background: #fff; outline: none; }
input:focus, textarea:focus, select:focus { border-color: #13a487; box-shadow: 0 0 0 3px rgba(19, 164, 135, .12); }
.button { border: 0; border-radius: 9px; padding: 10px 14px; font-weight: 700; font-size: 12px; transition: .15s ease; }
.button-primary { background: var(--green); color: white; }
.button-primary:hover { background: var(--green-dark); }
.button-secondary { background: #e8f4f0; color: #076d59; }
.button-secondary:hover { background: #d8ede6; }
.button-danger { color: #a23131; background: #fff0ee; }
.button-danger:hover { background: #ffe2df; }
.button-quiet { color: #52615d; background: transparent; }
.login-panel .button-primary { margin-top: 18px; width: 100%; min-height: 44px; }
.form-message { min-height: 18px; color: #52615d; font-size: 12px; line-height: 1.5; margin: 10px 0 0; }
.form-message.error { color: #ac3434; }
.form-message.success { color: #087f68; }
#console-view { padding: 42px 0 64px; }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 24px; }
.page-heading h1 { font-size: 36px; margin-bottom: 5px; }
.page-heading p { margin: 0; font-size: 13px; }
.metrics-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 13px; margin-bottom: 18px; }
.metric-card { background: white; border: 1px solid var(--line); border-radius: 13px; padding: 16px 18px; }
.metric-label { color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.metric-value { font: 800 26px Manrope, sans-serif; margin-top: 8px; }
.queue-panel, .case-panel { padding: 22px; margin-bottom: 18px; }
.queue-heading, .case-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 18px; }
.queue-heading h2, .case-heading h2 { margin: 2px 0 4px; }
.queue-heading p, .case-heading p { color: var(--muted); font-size: 12px; margin: 0; }
.filter-label { color: var(--muted); font-size: 10px; font-weight: 700; min-width: 160px; }
.filter-label select { margin-top: 5px; padding: 9px 11px; }
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; min-width: 660px; text-align: left; }
th { padding: 12px 10px; border-bottom: 1px solid var(--line); color: #74817e; font-size: 9px; letter-spacing: .1em; text-transform: uppercase; }
td { padding: 14px 10px; border-bottom: 1px solid #edf1ef; color: #35423f; font-size: 12px; }
tbody tr:last-child td { border-bottom: 0; }
.rider-name { color: var(--ink); font-weight: 700; }
.rider-phone { display: block; color: var(--muted); font-size: 10px; margin-top: 3px; }
.status-pill { display: inline-block; background: #fff4d9; color: #805600; border-radius: 30px; padding: 5px 8px; font-size: 9px; font-weight: 800; text-transform: uppercase; }
.status-pill.NEEDS_INFORMATION { color: #245a8c; background: #eaf4ff; }
.status-pill.UNDER_REVIEW { color: #66408c; background: #f3eaff; }
.row-open { background: transparent; border: 1px solid var(--line); border-radius: 7px; color: #47625a; font-size: 10px; font-weight: 700; padding: 7px 10px; }
.row-open:hover { border-color: #0b987b; color: #076d59; }
.empty-state { padding: 35px 12px; text-align: center; color: var(--muted); font-size: 12px; }
.case-panel { padding: 25px; }
.case-heading { padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.evidence-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 12px; padding: 18px 0; }
.evidence-card { border: 1px solid var(--line); border-radius: 12px; padding: 13px; background: #fbfdfc; }
.evidence-card h3 { font: 700 12px Manrope, sans-serif; margin: 0 0 8px; }
.evidence-card img, .evidence-card iframe { display: block; width: 100%; height: 240px; object-fit: contain; border: 0; border-radius: 7px; background: #e9efec; }
.evidence-link { color: var(--green); font-size: 11px; font-weight: 700; }
.evidence-missing { color: #9b4a35; background: #fff5f1; border: 1px solid #f2d8ce; padding: 12px; border-radius: 8px; font-size: 11px; line-height: 1.6; }
.admin-registry-result { grid-column: 1 / -1; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; color: #41534d; background: #f5faf8; font-size: 10px; line-height: 1.5; }
.admin-id-checklist { grid-column: 1 / -1; display: grid; gap: 8px; margin: 0; padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: #fff; font-size: 12px; }
.admin-id-checklist legend { padding: 0 4px; font-weight: 700; }
.admin-id-checklist label { display: flex; gap: 8px; align-items: flex-start; line-height: 1.4; cursor: pointer; }
.admin-id-checklist input[type="checkbox"] { width: 18px; height: 18px; flex: none; margin: 1px 0 0; padding: 0; accent-color: #13a487; box-shadow: none; }
.review-block { border-top: 1px solid var(--line); padding-top: 6px; }
.required-mark { color: #9a4540; font-size: 9px; text-transform: uppercase; margin-left: 5px; }
.review-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 9px; margin-top: 14px; }
.privacy-note { color: var(--muted); font-size: 10px; margin-top: 12px; }
footer { padding: 17px 0 25px; color: #82908b; text-align: center; font-size: 10px; border-top: 1px solid var(--line); }
/* Tabs */
.tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 26px; border-bottom: 1px solid var(--line); }
.tab { border: 0; background: transparent; padding: 11px 14px; font-size: 13px; font-weight: 700; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tab[aria-selected="true"] { color: var(--green-dark); border-bottom-color: var(--green); }
.tab-badge { display: inline-block; min-width: 18px; padding: 1px 6px; margin-left: 4px; border-radius: 20px; background: #c62828; color: #fff; font-size: 10px; }
.heading-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.button-secondary[aria-pressed="true"] { background: #fde8e6; color: #a12626; }

/* MFA */
.mfa-help { color: var(--muted); font-size: 12px; line-height: 1.6; margin: 0 0 10px; }
.mfa-qr { display: block; width: 220px; height: 220px; margin: 4px auto 14px; padding: 8px; background: #fff; border: 1px solid var(--line); border-radius: 12px; }
.mfa-secret { display: block; padding: 12px; border-radius: 9px; background: #f2f7f5; border: 1px dashed #b9d2ca; font: 700 15px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .08em; word-break: break-all; margin-bottom: 8px; }

/* Emergency triage */
.incident-alert { margin: 0 0 16px; padding: 14px 16px; border-radius: 12px; background: #fdecea; border: 1px solid #f3b9b2; color: #8f1d14; font-weight: 700; font-size: 13px; }
tr.row-urgent td { background: #fff7f6; }
.status-pill.OPEN { background: #fdecea; color: #a12626; }
.status-pill.ACKNOWLEDGED { background: #eaf4ff; color: #245a8c; }
.status-pill.ESCALATED { background: #fff1e0; color: #8a4b00; }
.status-pill.RESOLVED, .status-pill.CLOSED, .status-pill.DISMISSED { background: #e8f4f0; color: #076d59; }
.status-pill.severity-critical { background: #fdecea; color: #a12626; }
.status-pill.severity-warning { background: #fff4d9; color: #805600; }
.status-pill.severity-info { background: #eef2f1; color: #52615d; }
.incident-grid { display: grid; grid-template-columns: 1.15fr 1fr; gap: 26px; padding-top: 18px; }
.section-title { font: 700 13px Manrope, sans-serif; margin: 18px 0 9px; }
.section-title:first-child { margin-top: 0; }
.incident-map svg { width: 100%; height: auto; display: block; border-radius: 10px; border: 1px solid var(--line); }
.map-bg { fill: #eef4f2; }
.map-attribution-bg { fill: rgba(255, 255, 255, 0.8); }
.map-attribution { font-size: 10px; fill: #334155; }
.trail { fill: none; stroke: #087f68; stroke-width: 3; stroke-linejoin: round; stroke-linecap: round; }
.trail-start { fill: #fff; stroke: #087f68; stroke-width: 3; }
.sos-point { fill: #c62828; stroke: #fff; stroke-width: 2; }
.live-point { fill: #1e63b5; stroke: #fff; stroke-width: 2; }
.map-links { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 8px; }
.incident-people { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 9px; }
.person { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: #fbfdfc; }
.person .rider-name { margin-top: 4px; }
.revealed { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 8px; }
.dial-row { display: flex; flex-wrap: wrap; gap: 8px; }
.dial { display: inline-block; padding: 9px 12px; border-radius: 9px; background: #fdecea; color: #8f1d14; font-weight: 800; font-size: 12px; text-decoration: none; }
.dial:hover { background: #f9d9d5; }
.timeline { list-style: none; padding: 0; margin: 0; border-left: 2px solid var(--line); }
.timeline li { padding: 4px 0 10px 14px; font-size: 12px; color: #35423f; position: relative; text-transform: capitalize; }
.timeline li::before { content: ''; position: absolute; left: -6px; top: 8px; width: 10px; height: 10px; border-radius: 50%; background: var(--green); }
.timeline .privacy-note { text-transform: none; margin-top: 3px; }

/* Tables */
.inline-select { padding: 6px 8px; font-size: 11px; width: auto; }
td.wrap { white-space: normal; max-width: 340px; word-break: break-word; }
td.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 10px; }

@media (max-width: 760px) {
  .page-shell { width: min(100% - 28px, 620px); }
  .login-layout { grid-template-columns: 1fr; gap: 24px; min-height: unset; padding: 42px 0; }
  .login-intro h1 { font-size: 36px; }
  .login-panel { padding: 22px; }
  #console-view { padding-top: 28px; }
  .page-heading { align-items: flex-start; flex-direction: column; }
  .page-heading h1 { font-size: 31px; }
  .metrics-grid { grid-template-columns: repeat(2, 1fr); gap: 9px; }
  .metric-card { padding: 13px; }
  .metric-value { font-size: 22px; }
  .queue-heading { flex-direction: column; }
  .filter-label { width: 100%; }
  .queue-panel, .case-panel { padding: 15px; }
  .case-heading { align-items: flex-start; }
  .review-actions { justify-content: stretch; }
  .review-actions .button { flex: 1 1 40%; }
  .incident-grid { grid-template-columns: 1fr; }
  .tabs { overflow-x: auto; flex-wrap: nowrap; }
  .tab { white-space: nowrap; }
}
.muted { color: var(--muted, #64748b); font-size: 12px; margin-bottom: 4px; }
#report-rows td:last-child .button { padding: 4px 10px; font-size: 12px; margin: 2px 4px 2px 0; }
