/* ============================================================================
   Mạng Lưới Đột Quỵ Việt Nam — UI/UX Pro Max Medical Emergency Design System
   WCAG 2.2 AA/AAA Contrast · 44-48px Touch Targets · Focused Cartography UI
   ============================================================================ */
@import url('https://fonts.googleapis.com/css2?family=Be+Vietnam+Pro:wght@400;500;600;700;800&family=JetBrains+Mono:wght@500;700&display=swap');

:root {
  --bg: #f1f5f9;
  --bg-subtle: #f8fafc;
  --surface: #ffffff;
  --surface-muted: #f1f5f9;
  --surface-hover: #f8fafc;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;

  --text: #0f172a;
  --text-secondary: #334155;
  --text-muted: #475569;

  /* Medical Trust Primary (WCAG AA compliant on white) */
  --primary: #0284c7;
  --primary-hover: #0369a1;
  --primary-soft: #e0f2fe;
  --primary-bg: #f0f9ff;
  --primary-ring: rgba(2, 132, 199, 0.28);

  /* Emergency Critical Red (strictly reserved for 115 & critical alerts) */
  --emergency: #dc2626;
  --emergency-dark: #b91c1c;
  --emergency-hover: #991b1b;
  --emergency-bg: #fef2f2;
  --emergency-border: #fecaca;

  /* 4 Clinical Stroke Tiers */
  --tier-1: #16a34a;
  --tier-2: #2563eb;
  --tier-3: #ea580c;
  --tier-4: #9333ea;

  /* 4 Real-time Availability Statuses */
  --status-ready: #16a34a;
  --status-ready-bg: #dcfce7;
  --status-limited: #d97706;
  --status-limited-bg: #fef3c7;
  --status-unavailable: #dc2626;
  --status-unavailable-bg: #fee2e2;
  --status-unconfirmed: #475569;
  --status-unconfirmed-bg: #e2e8f0;

  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 24px;
  --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-sm: 0 2px 8px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 8px 24px -6px rgba(15, 23, 42, 0.1);
  --shadow-lg: 0 18px 40px -10px rgba(15, 23, 42, 0.16);
}

*, *::before, *::after {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  font-family: 'Be Vietnam Pro', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14.5px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a {
  color: inherit;
  text-decoration: none;
}

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
}

/* High-visibility keyboard & accessibility focus rings (Pro Max Priority 1) */
:focus-visible {
  outline: 3px solid var(--primary);
  outline-offset: 2px;
}

.tabular {
  font-variant-numeric: tabular-nums;
}

.mono {
  font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, monospace;
  font-variant-numeric: tabular-nums;
}

/* Custom sleek scrollbars */
::-webkit-scrollbar {
  width: 7px;
  height: 7px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 999px;
}
::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* ---------------- Top Navigation (Glassmorphic Clinical Header) ---------------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 950;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  height: 66px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 22px;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: linear-gradient(135deg, #fee2e2 0%, #fef2f2 100%);
  border: 1.5px solid #fca5a5;
  color: var(--emergency-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(220, 38, 38, 0.14);
}

.brand-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.brand-title {
  font-weight: 800;
  font-size: 15.5px;
  letter-spacing: -0.02em;
  color: var(--text);
  line-height: 1.2;
  white-space: nowrap;
}

.brand-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--surface-muted);
  padding: 4px;
  border-radius: 12px;
  border: 1px solid var(--border);
}

.nav-link {
  padding: 7px 14px;
  border-radius: 9px;
  font-weight: 600;
  font-size: 13.5px;
  color: var(--text-secondary);
  transition: all 0.14s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.nav-link:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.7);
}

.nav-link.active {
  background: var(--surface);
  color: var(--primary-hover);
  box-shadow: var(--shadow-xs);
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-115-top {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 16px;
  min-height: 40px;
  border-radius: 999px;
  background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
  color: #fff;
  font-weight: 800;
  font-size: 13.5px;
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.28);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
  white-space: nowrap;
}

.btn-115-top:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(185, 28, 28, 0.36);
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #fecaca;
  box-shadow: 0 0 0 3px rgba(254, 202, 202, 0.4);
  display: inline-block;
}

.mobile-menu-btn {
  display: none;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  width: 42px;
  height: 42px;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text);
}

/* ---------------- Buttons & Inputs (44-48px Accessible Touch Targets) ---------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  min-height: 42px;
  border-radius: 12px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  border: 1.5px solid transparent;
  transition: background-color 0.12s ease, border-color 0.12s ease, transform 0.1s ease, box-shadow 0.12s ease;
  line-height: 1.25;
}

.btn:active:not(:disabled) {
  transform: scale(0.985);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-emergency {
  background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
  color: #fff;
  box-shadow: 0 3px 10px rgba(220, 38, 38, 0.22);
}
.btn-emergency:hover {
  background: linear-gradient(135deg, #b91c1c 0%, #991b1b 100%);
}

.btn-primary {
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
  color: #fff;
  box-shadow: 0 3px 10px rgba(2, 132, 199, 0.22);
}
.btn-primary:hover {
  background: linear-gradient(135deg, #0369a1 0%, #075985 100%);
}

.btn-success {
  background: #15803d;
  color: #fff;
}
.btn-success:hover { background: #166534; }

.btn-warning {
  background: #d97706;
  color: #fff;
}
.btn-warning:hover { background: #b45309; }

.btn-outline {
  background: var(--surface);
  border-color: var(--border-strong);
  color: var(--text);
}
.btn-outline:hover {
  background: var(--surface-muted);
  border-color: #94a3b8;
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}
.btn-ghost:hover {
  background: var(--surface-muted);
  color: var(--text);
}

.btn-sm {
  padding: 7px 12px;
  min-height: 36px;
  font-size: 13px;
  border-radius: 10px;
}

.btn-lg {
  padding: 12px 18px;
  min-height: 48px;
  font-size: 14.5px;
  font-weight: 700;
}

.input, .select, .textarea {
  width: 100%;
  padding: 10px 13px;
  min-height: 44px;
  border-radius: 12px;
  border: 1.5px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  outline: none;
  transition: border-color 0.14s, box-shadow 0.14s;
}

.input:focus, .select:focus, .textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3.5px var(--primary-ring);
}

.textarea {
  resize: vertical;
  min-height: 82px;
}

.field-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.field-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 5px;
}

/* ---------------- Semantic Badges & Status Pills ---------------- */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 11px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 700;
  line-height: 1.25;
}

.status-dot {
  width: 8.5px;
  height: 8.5px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

.status-ready { background: var(--status-ready-bg); color: #14532d; }
.status-limited { background: var(--status-limited-bg); color: #78350f; }
.status-unavailable { background: var(--status-unavailable-bg); color: #7f1d1d; }
.status-unconfirmed { background: var(--status-unconfirmed-bg); color: #334155; }

.tier-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3.5px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.tier-badge-1 { background: #dcfce7; color: #14532d; }
.tier-badge-2 { background: #dbeafe; color: #1e3a8a; }
.tier-badge-3 { background: #ffedd5; color: #7c2d12; }
.tier-badge-4 { background: #f3e8ff; color: #581c87; }

.approval-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
}
.approval-approved { background: #dcfce7; color: #14532d; }
.approval-pending { background: #fef3c7; color: #78350f; }
.approval-needs_revision { background: #ffedd5; color: #7c2d12; }
.approval-rejected { background: #fee2e2; color: #7f1d1d; }
.approval-suspended { background: #e2e8f0; color: #334155; }

/* ---------------- Index Page Layout (Framed Vietnam Map + Friendly Sidebar) ---------------- */
.index-shell {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 66px);
  overflow: hidden;
  background: var(--bg);
}

/* Authoritative, empathetic emergency strip */
.emergency-strip {
  background: linear-gradient(90deg, #fef2f2 0%, #fff5f5 60%, #fef2f2 100%);
  border-bottom: 1px solid #fecaca;
  padding: 10px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.emergency-strip-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.emergency-badge-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 11px;
  border-radius: 999px;
  background: var(--emergency);
  color: #fff;
  font-weight: 800;
  font-size: 12.5px;
  letter-spacing: 0.01em;
}

.emergency-headline {
  font-weight: 800;
  font-size: 14.5px;
  color: #991b1b;
}

.symptom-pills {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.symptom-chip {
  background: #ffffff;
  border: 1px solid #fecaca;
  color: #7f1d1d;
  padding: 2.5px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

.emergency-strip-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Split workspace with airy framing around the rounded Vietnam map */
.map-workspace {
  display: grid;
  grid-template-columns: 455px 1fr;
  flex: 1;
  min-height: 0;
  gap: 16px;
  padding: 14px 18px 16px;
  position: relative;
}

.sidebar-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.sidebar-controls {
  padding: 16px 16px 13px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  display: flex;
  flex-direction: column;
  gap: 11px;
}

/* Prominent Hero GPS CTA Button */
.btn-gps-hero {
  width: 100%;
  min-height: 48px;
  border-radius: 13px;
  border: none;
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
  color: #ffffff;
  font-weight: 700;
  font-size: 14.5px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  cursor: pointer;
  box-shadow: 0 5px 16px rgba(2, 132, 199, 0.28);
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.14s ease;
}

.btn-gps-hero:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(3, 105, 161, 0.34);
}

.btn-gps-hero:active {
  transform: scale(0.99);
}

.search-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
}

.search-box-wrap {
  position: relative;
}

.search-box-wrap .search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

.search-box-wrap input {
  padding-left: 38px;
  padding-right: 68px;
  min-height: 44px;
  border-radius: 12px;
  background: var(--surface);
  border: 1.5px solid var(--border-strong);
  font-size: 13.8px;
}

.search-submit-btn {
  position: absolute;
  right: 5px;
  top: 50%;
  transform: translateY(-50%);
  padding: 6px 12px;
  min-height: 32px;
  border-radius: 8px;
  border: none;
  background: var(--primary-soft);
  color: var(--primary-hover);
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
}
.search-submit-btn:hover {
  background: var(--primary);
  color: #fff;
}

.autocomplete-list {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  z-index: 700;
  max-height: 260px;
  overflow-y: auto;
  display: none;
}

.autocomplete-list.open {
  display: block;
}

.autocomplete-item {
  padding: 11px 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border-bottom: 1px solid var(--surface-muted);
  font-size: 13.5px;
}

.autocomplete-item:hover {
  background: var(--primary-bg);
}

.quick-loc-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.quick-loc-select {
  flex: 1;
  font-size: 12.8px;
  padding: 7px 11px;
  min-height: 38px;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text-secondary);
}

.filter-chips {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.chip {
  padding: 6px 11px;
  min-height: 33px;
  border-radius: 999px;
  font-size: 12.2px;
  font-weight: 600;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text-secondary);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.13s ease;
}

.chip:hover {
  border-color: var(--primary);
  color: var(--primary-hover);
}

.chip.active {
  background: var(--text);
  color: #fff;
  border-color: var(--text);
}

.chip-ready.active {
  background: #15803d;
  border-color: #15803d;
  color: #fff;
}

/* Live readiness mini-bar */
.network-pulse-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 12px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 11px;
  font-size: 12.2px;
  color: var(--text-secondary);
}

.sidebar-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 14px 16px 26px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ---------------- BE-FAST Triage Drawer ---------------- */
.triage-box {
  background: #fffbeb;
  border: 1.5px solid #fcd34d;
  border-radius: var(--radius-md);
  padding: 14px 15px;
  display: none;
  box-shadow: var(--shadow-xs);
}

.triage-box.open {
  display: block;
}

.triage-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
  margin: 10px 0 12px;
}

.triage-check {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px 10px;
  background: #fff;
  border: 1px solid #fde68a;
  border-radius: 10px;
  font-size: 12.5px;
  cursor: pointer;
  line-height: 1.35;
}

.triage-check:hover {
  border-color: #f59e0b;
}

.triage-check input {
  margin-top: 2px;
  width: 16px;
  height: 16px;
  accent-color: #d97706;
}

/* ---------------- Clinical Recommendation Banner ---------------- */
.recommend-banner {
  background: linear-gradient(135deg, #f0f9ff 0%, #eff6ff 55%, #f5f3ff 100%);
  border: 1.5px solid #bae6fd;
  border-radius: var(--radius-md);
  padding: 13px 15px;
  box-shadow: var(--shadow-xs);
}

.recommend-banner-title {
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--primary-hover);
  margin-bottom: 5px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.recommend-banner-text {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text);
  line-height: 1.48;
}

.window-pill {
  margin-top: 8px;
  font-size: 12.2px;
  padding: 7px 10px;
  background: rgba(255, 255, 255, 0.9);
  border-radius: 9px;
  border: 1px solid #bae6fd;
  color: var(--text-secondary);
}

/* ---------------- Selected Hospital Card (Pro Max Elevated — Screenshot 2 Faithful) ---------------- */
.hospital-focus-card {
  background: var(--surface);
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 18px;
  box-shadow: var(--shadow-md);
  position: relative;
  overflow: hidden;
}

.focus-accent-bar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
}

.focus-header {
  display: flex;
  align-items: flex-start;
  gap: 13px;
}

.focus-icon-box {
  width: 50px;
  height: 50px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.focus-title {
  margin: 0;
  font-size: 17.5px;
  font-weight: 800;
  line-height: 1.25;
  color: var(--text);
  letter-spacing: -0.015em;
}

.focus-tier-text {
  font-size: 13.2px;
  font-weight: 700;
  margin-top: 2px;
}

.focus-address {
  font-size: 12.5px;
  color: var(--text-muted);
  margin-top: 3px;
  line-height: 1.4;
}

.focus-status-row {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.focus-alert-note {
  margin-top: 11px;
  padding: 10px 12px;
  border-radius: 11px;
  font-size: 13px;
  font-weight: 500;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  line-height: 1.45;
}

.focus-alert-note.amber {
  background: #fef3c7;
  color: #78350f;
  border: 1px solid #fcd34d;
}

.focus-alert-note.red {
  background: #fee2e2;
  color: #7f1d1d;
  border: 1px solid #fca5a5;
}

.focus-alert-note.gray {
  background: #f1f5f9;
  color: #334155;
  border: 1px solid #cbd5e1;
}

.focus-metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 14px 0;
}

.metric-tile {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 13px;
  padding: 11px 13px;
}

.metric-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}

.metric-value {
  font-family: 'JetBrains Mono', 'Be Vietnam Pro', sans-serif;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text);
  line-height: 1.2;
  margin-top: 3px;
}

.metric-sub {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 3px;
}

.cap-checklist {
  list-style: none;
  padding: 12px 0;
  margin: 0 0 12px;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.cap-item {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text);
}

.cap-item.disabled {
  color: #64748b;
  font-weight: 400;
}

.cap-item.temp-off {
  color: #92400e;
  font-weight: 700;
}

.cap-icon {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 11.5px;
  font-weight: 800;
}

.cap-icon.ok { background: #15803d; color: #fff; }
.cap-icon.no { background: #e2e8f0; color: #64748b; }
.cap-icon.warn { background: #d97706; color: #fff; }

.cert-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
}

.freshness-row {
  font-size: 12.2px;
  color: var(--text-muted);
  margin-top: 5px;
  margin-bottom: 14px;
}

.cta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.prenotify-cta {
  width: 100%;
  min-height: 44px;
  margin-top: 9px;
  background: #fff7ed;
  border: 1.5px solid #fdba74;
  color: #9a3412;
  font-weight: 700;
}
.prenotify-cta:hover {
  background: #ffedd5;
}

.detail-link-btn {
  display: block;
  width: 100%;
  text-align: center;
  margin-top: 10px;
  padding: 8px;
  border-radius: 10px;
  background: transparent;
  border: none;
  color: var(--primary-hover);
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
}
.detail-link-btn:hover {
  background: var(--primary-bg);
}

/* ---------------- Ranked List Items ---------------- */
.list-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 800;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-top: 4px;
}

.hospital-list-item {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  padding: 13px 14px;
  cursor: pointer;
  transition: all 0.14s ease;
}

.hospital-list-item:hover {
  border-color: var(--primary);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.hospital-list-item.selected {
  border-color: var(--primary);
  background: var(--primary-bg);
  box-shadow: 0 0 0 3px var(--primary-ring);
}

.rec-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 7px;
  font-size: 11.5px;
  font-weight: 700;
  background: #e0f2fe;
  color: #0369a1;
  margin-bottom: 7px;
}

.rec-tag.top {
  background: #dcfce7;
  color: #14532d;
}

.list-item-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}

.list-item-name {
  font-weight: 700;
  font-size: 14.5px;
  color: var(--text);
  line-height: 1.32;
}

.list-item-dist {
  text-align: right;
  flex-shrink: 0;
}

.list-item-eta {
  font-family: 'JetBrains Mono', 'Be Vietnam Pro', sans-serif;
  font-weight: 700;
  font-size: 15px;
  color: var(--primary-hover);
}

.list-item-km {
  font-size: 12px;
  color: var(--text-muted);
}

.list-item-meta {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
  margin-top: 8px;
}

/* ---------------- Cropped, Rounded & Focused Vietnam Map Stage ---------------- */
.map-stage {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 440px;
  border-radius: var(--radius-xl);
  overflow: hidden;
  border: 1.5px solid var(--border-strong);
  box-shadow: var(--shadow-md);
  background: #dbeafe;
}

#stroke-map {
  width: 100%;
  height: 100%;
  z-index: 1;
  background: #dbeafe;
}

/* Clean rounded Leaflet zoom control */
.leaflet-control-zoom {
  border: none !important;
  box-shadow: var(--shadow-md) !important;
  border-radius: 12px !important;
  overflow: hidden;
  margin-top: 14px !important;
  margin-left: 14px !important;
}

.leaflet-control-zoom a {
  width: 38px !important;
  height: 38px !important;
  line-height: 38px !important;
  font-size: 17px !important;
  color: var(--text) !important;
  border-bottom-color: var(--border) !important;
}

.leaflet-control-layers {
  border-radius: 12px !important;
  border: 1px solid var(--border) !important;
  box-shadow: var(--shadow-md) !important;
  font-family: inherit !important;
}

/* Floating Region Jump Bar at top-center of Vietnam Map */
.map-region-bar {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 460;
  display: flex;
  align-items: center;
  gap: 4px;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  padding: 4px;
  box-shadow: var(--shadow-md);
}

.region-pill {
  padding: 6px 13px;
  border-radius: 999px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.14s ease;
}

.region-pill:hover {
  background: var(--surface-muted);
  color: var(--text);
}

.region-pill.active {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 2px 6px rgba(2, 132, 199, 0.3);
}

/* Floating Quick Action Buttons on Top-Right of Map */
.map-fab-stack {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 460;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.map-fab {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  border: 1px solid var(--border-strong);
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--shadow-md);
  transition: all 0.14s ease;
}

.map-fab:hover {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* Compact Glassmorphic Legend Card */
.map-legend-card {
  position: absolute;
  bottom: 14px;
  left: 14px;
  z-index: 460;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  padding: 10px 13px;
  box-shadow: var(--shadow-md);
  max-width: 350px;
}

.legend-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px 14px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 7px;
}

.legend-divider {
  border-top: 1px solid var(--border);
  margin: 7px 0;
}

.legend-disclaimer {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 6px;
  line-height: 1.38;
}

/* Custom Map Markers */
.hospital-pin {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 900;
  font-size: 20px;
  line-height: 1;
  border: 2.5px solid #fff;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.32);
  position: relative;
  transition: transform 0.14s ease;
}

.hospital-pin:hover,
.hospital-pin.selected {
  transform: scale(1.2);
  z-index: 500;
}

.hospital-pin.recommended {
  box-shadow: 0 0 0 6px rgba(22, 163, 74, 0.32), 0 5px 14px rgba(15, 23, 42, 0.38);
}

.pin-status-badge {
  position: absolute;
  right: -3px;
  bottom: -3px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid #fff;
}

.user-gps-marker {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #0284c7;
  border: 3px solid #fff;
  box-shadow: 0 0 0 7px rgba(2, 132, 199, 0.28), 0 2px 8px rgba(0, 0, 0, 0.3);
}

.sovereignty-label {
  background: transparent;
  border: none;
  box-shadow: none;
  color: #1e293b;
  font-weight: 700;
  font-size: 11.5px;
  text-shadow: 0 1px 4px rgba(255, 255, 255, 0.96), 0 0 7px rgba(255, 255, 255, 0.96);
  white-space: nowrap;
  pointer-events: none;
}

.sea-label {
  color: #0369a1;
  font-style: italic;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.05em;
}

/* ---------------- Standard Page Containers (Hospital / Admin / Guide) ---------------- */
.page-container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 26px 22px 68px;
}

.page-hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.page-title {
  margin: 0;
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.025em;
  color: var(--text);
}

.page-subtitle {
  margin: 5px 0 0;
  color: var(--text-secondary);
  font-size: 14.5px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px;
  box-shadow: var(--shadow-sm);
}

.card-title {
  margin: 0 0 14px;
  font-size: 17px;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 8px;
  letter-spacing: -0.01em;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(205px, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}

.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  box-shadow: var(--shadow-xs);
}

.kpi-card-label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-muted);
}

.kpi-card-value {
  font-family: 'JetBrains Mono', 'Be Vietnam Pro', sans-serif;
  font-size: 26px;
  font-weight: 700;
  margin-top: 5px;
  line-height: 1.15;
}

.kpi-card-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 5px;
}

.tabs {
  display: flex;
  align-items: center;
  gap: 6px;
  border-bottom: 1.5px solid var(--border);
  margin-bottom: 20px;
  overflow-x: auto;
}

.tab-btn {
  padding: 11px 16px;
  background: transparent;
  border: none;
  border-bottom: 3px solid transparent;
  font-weight: 700;
  font-size: 14px;
  color: var(--text-secondary);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
}

.tab-btn:hover { color: var(--text); }
.tab-btn.active {
  color: var(--primary-hover);
  border-bottom-color: var(--primary);
}

.tab-count {
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
  background: var(--surface-muted);
  color: var(--text-secondary);
}

.tab-btn.active .tab-count {
  background: var(--primary-soft);
  color: var(--primary-hover);
}

.tab-count.alert {
  background: #fee2e2;
  color: #b91c1c;
}

.form-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}

.form-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.form-grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.form-section {
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: 16px;
  background: #fafcff;
}

.form-section-title {
  font-weight: 700;
  font-size: 15px;
  color: var(--text);
  margin: 0 0 5px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.form-section-desc {
  font-size: 12.8px;
  color: var(--text-muted);
  margin: 0 0 14px;
}

.layer-tag {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
.layer-tag.l1 { background: #dcfce7; color: #14532d; }
.layer-tag.l2 { background: #e0f2fe; color: #0369a1; }
.layer-tag.l3 { background: #fae8ff; color: #701a75; }

.checkbox-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}

.checkbox-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 13px;
  min-height: 44px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 500;
}

.checkbox-card:hover {
  border-color: var(--primary);
}

.checkbox-card input {
  width: 17px;
  height: 17px;
  accent-color: var(--primary);
}

/* ---------------- Tables ---------------- */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
}

table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

.data-table th {
  text-align: left;
  padding: 12px 14px;
  background: var(--bg-subtle);
  color: var(--text-secondary);
  font-weight: 700;
  font-size: 12.5px;
  border-bottom: 1.5px solid var(--border);
  white-space: nowrap;
}

.data-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.data-table tr:last-child td {
  border-bottom: none;
}

.data-table tr:hover td {
  background: #f8fbff;
}

/* ---------------- Modals & Toasts ---------------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.58);
  backdrop-filter: blur(4px);
  z-index: 1200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-backdrop.open {
  display: flex;
}

.modal-dialog {
  background: var(--surface);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 720px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.modal-dialog.wide {
  max-width: 920px;
}

.modal-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.modal-title {
  margin: 0;
  font-size: 18px;
  font-weight: 800;
}

.modal-close {
  background: var(--surface-muted);
  border: none;
  border-radius: 10px;
  width: 36px;
  height: 36px;
  cursor: pointer;
  font-size: 18px;
  color: var(--text-secondary);
}

.modal-body {
  padding: 20px 22px;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 15px 22px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  background: var(--bg-subtle);
}

.toast-container {
  position: fixed;
  bottom: 22px;
  right: 22px;
  z-index: 1500;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: #0f172a;
  color: #fff;
  padding: 12px 17px;
  border-radius: 12px;
  font-size: 13.5px;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  max-width: 390px;
  animation: fadeSlide 0.16s ease;
}

.toast.success { background: #14532d; }
.toast.error { background: #991b1b; }
.toast.warning { background: #92400e; }

@keyframes fadeSlide {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------------- Auth Shell ---------------- */
.auth-wrapper {
  max-width: 520px;
  margin: 32px auto;
}

.demo-creds-box {
  background: var(--primary-bg);
  border: 1.5px dashed #7dd3fc;
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 13px;
  color: #0c4a6e;
  margin-top: 14px;
}

/* ---------------- Mobile Sticky Bottom Dock ---------------- */
.mobile-bottom-bar {
  display: none;
}

@media (max-width: 1024px) {
  .map-workspace {
    grid-template-columns: 395px 1fr;
    padding: 12px;
    gap: 12px;
  }
}

@media (max-width: 900px) {
  html, body {
    font-size: 15px;
  }

  .topbar {
    padding: 0 14px;
    height: 60px;
  }

  .brand-subtitle {
    display: none;
  }

  .nav-links {
    display: none;
    position: absolute;
    top: 60px;
    left: 0;
    right: 0;
    background: var(--surface);
    border-radius: 0;
    border: none;
    border-bottom: 1px solid var(--border);
    padding: 12px 14px;
    flex-direction: column;
    align-items: stretch;
    box-shadow: var(--shadow-lg);
  }
  .nav-links.open {
    display: flex;
  }
  .nav-link {
    min-height: 44px;
    padding: 10px 14px;
  }
  .mobile-menu-btn {
    display: inline-flex;
  }

  .emergency-strip {
    padding: 10px 14px;
  }
  .symptom-pills {
    display: none;
  }

  .index-shell {
    height: auto;
    min-height: calc(100vh - 60px);
    overflow: visible;
    padding-bottom: 76px;
  }

  .map-workspace {
    grid-template-columns: 1fr;
    display: flex;
    flex-direction: column;
    padding: 10px 12px 14px;
    gap: 12px;
  }

  .sidebar-panel {
    overflow: visible;
    border-radius: 16px;
  }

  .sidebar-scroll {
    overflow: visible;
    padding: 12px 14px 18px;
  }

  .map-stage {
    height: 62vh;
    min-height: 410px;
    border-radius: 18px;
  }

  .map-region-bar {
    top: 10px;
    padding: 3px;
    max-width: calc(100% - 110px);
    overflow-x: auto;
  }
  .region-pill {
    padding: 5px 10px;
    font-size: 12px;
  }

  .map-legend-card {
    max-width: calc(100% - 24px);
    bottom: 10px;
    left: 10px;
    padding: 8px 11px;
  }

  .map-workspace.mobile-show-list .map-stage {
    display: none;
  }

  .map-workspace.mobile-show-map .sidebar-scroll {
    display: none;
  }

  .mobile-bottom-bar {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: 8px;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 980;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid var(--border-strong);
    padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
    box-shadow: 0 -6px 20px rgba(15, 23, 42, 0.08);
  }

  .mobile-bottom-bar .btn {
    min-height: 46px;
    font-size: 13.5px;
    padding: 8px 10px;
  }

  .form-grid-2, .form-grid-3, .form-grid-4 {
    grid-template-columns: 1fr;
  }

  .page-container {
    padding: 18px 14px 48px;
  }

  .page-title {
    font-size: 21px;
  }
}
