:root {
  --bg: #071017;
  --panel: #111827;
  --panel-2: #0f172a;
  --border: #243244;
  --text: #f8fafc;
  --muted: #94a3b8;
  --primary: #10b981;
  --primary-2: #14b8a6;
  --warning: #f59e0b;
  --danger: #ef4444;
}

* {
  box-sizing: border-box;
}

.skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 20000;
  transform: translateY(-140%);
  padding: 10px 14px;
  border-radius: 6px;
  background: #f8fafc;
  color: #071017;
  font-weight: 700;
}

.skip-link:focus { transform: translateY(0); }

.mobile-nav-toggle,
.mobile-nav-backdrop { display: none; }

body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  grid-template-columns: 260px 1fr;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.sidebar {
  border-right: 1px solid var(--border);
  background: #0b1220;
  padding: 24px;
  overflow-y: auto;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 26px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: linear-gradient(135deg, #dc2626, #991b1b);
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.3);
}

.brand-text strong {
  font-family: "Poppins", "Inter", ui-sans-serif, system-ui, sans-serif;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
}

.brand-text .brand-360 {
  font-weight: 800;
  background: linear-gradient(135deg, #dc2626, #ef4444);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-size: 20px;
}

.brand-text span:last-child {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.brand span,
.section-title p,
.eyebrow,
label,
.current-status {
  color: var(--muted);
}

nav {
  display: grid;
  gap: 16px;
}

.nav-group {
  display: grid;
  gap: 6px;
}

.nav-group + .nav-group {
  padding-top: 12px;
  border-top: 1px solid rgba(148, 163, 184, 0.12);
}

.nav-group-toggle {
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 0 10px 2px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  text-align: left;
}

.nav-group-toggle:hover,
.nav-group-toggle:focus-visible {
  color: var(--text);
  outline: none;
}

.nav-group-chevron {
  width: 14px;
  height: 14px;
  transition: transform 0.18s ease;
}

.nav-group.collapsed .nav-group-chevron {
  transform: rotate(-90deg);
}

.nav-group-links {
  display: grid;
  gap: 6px;
  overflow: hidden;
}

.nav-group.collapsed .nav-group-links {
  display: none;
}

nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  text-decoration: none;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 14px;
}

.nav-icon {
  width: 17px;
  height: 17px;
  flex: 0 0 auto;
}

nav a.active,
nav a:hover {
  color: var(--text);
  background: #162235;
}

nav a.active {
  box-shadow: inset 3px 0 0 var(--primary);
}

.shell {
  padding: 28px;
}

.medical-action-loader {
  position: fixed;
  inset: 0;
  z-index: 5000;
  display: none;
  place-items: center;
  padding: 24px;
  background: rgba(7, 16, 23, 0.58);
  backdrop-filter: blur(4px);
}

.medical-action-loader.active {
  display: grid;
}

.medical-loader-card {
  display: flex;
  align-items: center;
  gap: 16px;
  width: min(420px, 100%);
  padding: 18px 20px;
  border: 1px solid rgba(20, 184, 166, 0.4);
  border-radius: 8px;
  background: #0f172a;
  box-shadow: 0 22px 70px rgba(0, 0, 0, 0.38);
}

.medical-loader-icon {
  position: relative;
  flex: 0 0 auto;
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--primary);
  background: rgba(16, 185, 129, 0.12);
}

.medical-loader-icon::before {
  content: "";
  position: absolute;
  inset: -5px;
  border-radius: 50%;
  border: 3px solid rgba(16, 185, 129, 0.14);
  border-top-color: var(--primary-2);
  animation: medicalSpin 0.9s linear infinite;
}

.medical-loader-icon svg {
  width: 28px;
  height: 28px;
  animation: medicalPulse 1s ease-in-out infinite;
}

.medical-loader-card strong {
  display: block;
  margin-bottom: 4px;
  font-size: 15px;
}

.medical-loader-card p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

@keyframes medicalSpin {
  to { transform: rotate(360deg); }
}

@keyframes medicalPulse {
  0%, 100% { transform: scale(0.94); opacity: 0.78; }
  50% { transform: scale(1.08); opacity: 1; }
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 28px;
}

.eyebrow {
  margin: 0 0 6px;
  text-transform: uppercase;
  font-size: 12px;
  letter-spacing: .08em;
}

h1,
h2,
p {
  margin-top: 0;
}

.status-pill {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 9px 14px;
  color: var(--warning);
  background: #111827;
  font-size: 14px;
}

.status-pill.connected {
  color: var(--primary);
}

.grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr);
  gap: 18px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 24px;
}

.wide {
  grid-column: 1 / -1;
}

.section-title {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  margin-bottom: 22px;
}

.step {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: rgba(16, 185, 129, .16);
  color: var(--primary);
  font-weight: 700;
  flex: 0 0 auto;
}

form,
.two-col {
  display: grid;
  gap: 16px;
}

.two-col {
  grid-template-columns: 1fr 1fr;
}

label {
  display: grid;
  gap: 8px;
  font-size: 14px;
}

input,
select {
  width: 100%;
  border: 1px solid #334155;
  border-radius: 8px;
  background: var(--panel-2);
  color: var(--text);
  padding: 13px 14px;
  font: inherit;
}

input:focus,
select:focus {
  outline: 2px solid rgba(20, 184, 166, .3);
  border-color: var(--primary-2);
}

.check-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #0b1220;
}

.check-row input {
  width: 18px;
  height: 18px;
}

button {
  border: 0;
  border-radius: 8px;
  background: linear-gradient(90deg, var(--primary), var(--primary-2));
  color: white;
  padding: 14px 18px;
  font-weight: 700;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: .45;
}

.biometric-card {
  min-height: 142px;
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 20px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #0b1220;
}

.fingerprint {
  width: 64px;
  height: 64px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: var(--primary);
  background: rgba(16, 185, 129, .12);
  font-size: 38px;
}

.progress {
  height: 12px;
  background: #0b1220;
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid var(--border);
}

#progressBar {
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--primary-2));
  transition: width .3s ease;
}

.current-status {
  margin: 16px 0;
}

.timeline {
  display: grid;
  gap: 10px;
  padding-left: 20px;
}

.timeline li {
  padding: 12px 14px;
  background: #0b1220;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.room-link {
  display: block;
  margin-top: 14px;
  color: var(--primary);
  overflow-wrap: anywhere;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 12px;
  font-size: 14px;
}

.data-table th,
.data-table td {
  border: 1px solid var(--border);
  padding: 10px 14px;
  text-align: left;
}

.data-table th {
  background: #0b1220;
  color: var(--muted);
  font-weight: 600;
}

.data-table tr:hover td {
  background: rgba(16, 185, 129, .04);
}

textarea {
  width: 100%;
  border: 1px solid #334155;
  border-radius: 8px;
  background: var(--panel-2);
  color: var(--text);
  padding: 13px 14px;
  font: inherit;
  resize: vertical;
}

textarea:focus {
  outline: 2px solid rgba(20, 184, 166, .3);
  border-color: var(--primary-2);
}

.camera-container {
  position: relative;
  width: 100%;
  max-width: 640px;
  margin: 16px auto;
  border: 2px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  background: #000;
  aspect-ratio: 4/3;
}

.camera-container video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.camera-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.face-guide {
  width: 200px;
  height: 260px;
  border: 3px solid rgba(16, 185, 129, 0.6);
  border-radius: 50%;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.3);
}

.camera-actions {
  display: flex;
  gap: 12px;
  margin: 16px 0;
  flex-wrap: wrap;
}

.local-call-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px;
  height: 100%;
  min-height: 420px;
  background: #020617;
}

.local-call-tile {
  position: relative;
  min-height: 320px;
  background: #020617;
  overflow: hidden;
}

.local-call-tile video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.local-call-tile span {
  position: absolute;
  left: 12px;
  bottom: 12px;
  padding: 4px 8px;
  border-radius: 6px;
  background: rgba(15, 23, 42, .78);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
}

.btn-primary {
  border: 0;
  border-radius: 8px;
  background: linear-gradient(90deg, var(--primary), var(--primary-2));
  color: white;
  padding: 14px 18px;
  font-weight: 700;
  cursor: pointer;
}

.btn-secondary {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel-2);
  color: var(--text);
  padding: 14px 18px;
  font-weight: 700;
  cursor: pointer;
}

.btn-warning {
  border: 1px solid var(--warning);
  border-radius: 8px;
  background: transparent;
  color: var(--warning);
  padding: 14px 18px;
  font-weight: 700;
  cursor: pointer;
}

.btn-success {
  border: 0;
  border-radius: 8px;
  background: linear-gradient(90deg, #16a34a, #22c55e);
  color: white;
  padding: 14px 18px;
  font-weight: 700;
  cursor: pointer;
}

/* Dashboard */
#homeDashboard {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.welcome-bar {
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 28px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.welcome-bar h2 {
  margin: 0 0 4px;
  font-size: 24px;
}

.welcome-bar p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.dashboard-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(145px, 1fr));
  gap: 12px;
}

.dashboard-refresh-wrap { display:flex; align-items:center; justify-content:flex-end; gap:10px; }
.dashboard-data-status { color:var(--muted); font-size:12px; text-align:right; }
.dashboard-data-status.has-warning { color:var(--warning); }
.icon-button,
.mobile-nav-toggle {
  width:40px; height:40px; display:inline-flex; align-items:center; justify-content:center;
  flex:0 0 40px; border:1px solid var(--border); border-radius:8px;
  background:var(--surface,#111827); color:var(--text); cursor:pointer;
}
.icon-button svg,
.mobile-nav-toggle svg { width:18px; height:18px; }

.patient-dashboard-grid {
  display:grid;
  grid-template-columns:minmax(0,1.2fr) repeat(2,minmax(0,.9fr));
  gap:12px;
}
.dashboard-panel {
  min-width:0; padding:18px; border:1px solid var(--border); border-radius:8px;
  background:var(--panel);
}
.dashboard-panel-heading {
  display:flex; align-items:flex-start; justify-content:space-between; gap:12px; margin-bottom:12px;
}
.dashboard-panel-heading h3 { margin:0; font-size:16px; }
.dashboard-panel-heading .eyebrow { margin-bottom:3px; font-size:10px; }
.dashboard-panel-heading > svg { width:20px; color:var(--primary); }
.dashboard-list { display:grid; gap:8px; }
.dashboard-list-item {
  width:100%; min-width:0; min-height:54px; display:grid;
  grid-template-columns:34px minmax(0,1fr) 16px; align-items:center; gap:10px;
  padding:9px; border:1px solid transparent; border-radius:7px;
  background:#0b1522; color:var(--text); text-align:left; cursor:pointer;
}
.dashboard-list-item > svg:first-child { width:18px; height:18px; color:var(--primary); }
.dashboard-list-item.warning > svg:first-child,
.dashboard-list-item.urgent > svg:first-child { color:var(--warning); }
.dashboard-list-item.urgent { border-color:rgba(239,68,68,.35); }
.dashboard-list-item span,
.dashboard-appointment > div,
.dashboard-clear div { min-width:0; }
.dashboard-list-item strong,
.dashboard-list-item small,
.dashboard-appointment strong,
.dashboard-appointment span,
.dashboard-clear strong,
.dashboard-clear span { display:block; overflow-wrap:anywhere; }
.dashboard-list-item strong,
.dashboard-appointment strong,
.dashboard-clear strong { font-size:13px; }
.dashboard-list-item small,
.dashboard-appointment span,
.dashboard-clear span { margin-top:2px; color:var(--muted); font-size:11px; line-height:1.35; }
.dashboard-list-chevron { width:15px; color:var(--muted); }
.dashboard-clear,
.dashboard-appointment { display:flex; align-items:center; gap:12px; min-height:58px; }
.dashboard-clear > svg { color:var(--primary); }
.dashboard-date {
  flex:0 0 66px; padding:8px; border-radius:7px;
  background:rgba(16,185,129,.12); color:var(--primary); text-align:center;
}
.dashboard-date small { display:block; margin-top:3px; color:var(--text); }
.dashboard-empty p,
.dashboard-placeholder { margin:0 0 10px; color:var(--muted); font-size:12px; line-height:1.45; }
.dashboard-text-action {
  display:inline-flex; align-items:center; gap:6px; padding:7px 0; border:0;
  background:transparent; color:var(--primary); font-weight:700; cursor:pointer;
}
.dashboard-text-action svg { width:15px; }

.dashboard-actions {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}

.dash-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 18px;
  cursor: pointer;
  transition: border-color 0.2s, transform 0.15s;
}

.dash-card:hover {
  border-color: var(--primary);
  transform: translateY(-1px);
}

.dash-icon,
.catalogue-icon,
.catalogue-group-icon,
.section-heading-icon {
  --icon-accent: var(--primary);
  --icon-accent-2: var(--primary-2, #06b6d4);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  background:
    radial-gradient(circle at 28% 22%, rgba(255,255,255,0.34), transparent 32%),
    linear-gradient(135deg, var(--icon-accent), var(--icon-accent-2));
  border: 1px solid rgba(255,255,255,0.16);
  box-shadow: 0 10px 24px color-mix(in srgb, var(--icon-accent) 24%, transparent);
}

.dash-icon {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  margin-bottom: 12px;
}

.dash-icon svg {
  width: 24px;
  height: 24px;
  stroke-width: 2.25;
}

.dash-card h4 {
  margin: 0 0 4px;
  font-size: 15px;
}

.dash-card p {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px 20px;
  text-align: center;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.dash-card,
.edu-card {
  width: 100%;
  color: inherit;
  font: inherit;
  text-align: left;
}

.stat-card:hover,
.stat-card:focus-visible,
.dashboard-list-item:hover,
.dashboard-list-item:focus-visible,
.dashboard-text-action:focus-visible,
.icon-button:hover,
.icon-button:focus-visible,
.dash-card:focus-visible,
.edu-card:focus-visible,
.edu-viewer-close:focus-visible,
.mobile-nav-toggle:focus-visible {
  border-color: var(--primary);
  outline: 3px solid rgba(16, 185, 129, 0.24);
  outline-offset: 2px;
}

.stat-value {
  display: block;
  font-size: 24px;
  font-weight: 800;
  color: var(--primary);
}

.stat-label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

/* ── Service Catalogue ── */
#services {
  grid-column: 1 / -1;
  max-width: 900px;
  margin: 0 auto;
}

.section-header {
  margin-bottom: 24px;
}

.section-header h2 {
  font-size: 24px;
  margin: 0;
}

.section-heading-with-icon {
  display: flex;
  align-items: center;
  gap: 10px;
}

.section-heading-icon {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  flex: 0 0 38px;
}

.section-heading-icon svg {
  width: 20px;
  height: 20px;
  stroke-width: 2.25;
}

.section-heading-icon.appointment,
.section-heading-icon.monitoring { --icon-accent: #2563eb; --icon-accent-2: #38bdf8; }
.section-heading-icon.triage { --icon-accent: #dc2626; --icon-accent-2: #fb7185; }
.section-heading-icon.medication { --icon-accent: #059669; --icon-accent-2: #14b8a6; }
.section-heading-icon.immunization { --icon-accent: #0284c7; --icon-accent-2: #0ea5e9; }
.section-heading-icon.journey { --icon-accent: #7c3aed; --icon-accent-2: #c084fc; }
.section-heading-icon.dvt { --icon-accent: #7c3aed; --icon-accent-2: #a78bfa; }
.section-heading-icon.alerts { --icon-accent: #f97316; --icon-accent-2: #facc15; }
.section-heading-icon.care { --icon-accent: #16a34a; --icon-accent-2: #84cc16; }
.section-heading-icon.community { --icon-accent: #0891b2; --icon-accent-2: #22d3ee; }
.section-heading-icon.kids { --icon-accent: #ec4899; --icon-accent-2: #f9a8d4; }
.section-heading-icon.education { --icon-accent: #ca8a04; --icon-accent-2: #facc15; }
.section-heading-icon.identity { --icon-accent: #334155; --icon-accent-2: #64748b; }
.section-heading-icon.devices { --icon-accent: #0f766e; --icon-accent-2: #14b8a6; }
.section-heading-icon.biometrics { --icon-accent: #4f46e5; --icon-accent-2: #06b6d4; }
.section-heading-icon.ratings { --icon-accent: #eab308; --icon-accent-2: #f97316; }
.section-heading-icon.catalogue { --icon-accent: #6366f1; --icon-accent-2: #06b6d4; }

.section-subtitle {
  color: var(--muted);
  font-size: 14px;
  margin: 8px 0 0;
}

.catalogue-group {
  margin-bottom: 32px;
}

.catalogue-group-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 17px;
  margin: 0 0 14px;
  color: var(--text);
}

.catalogue-group-icon {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  flex: 0 0 34px;
}

.catalogue-group-icon svg {
  width: 18px;
  height: 18px;
  stroke-width: 2.25;
}

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

.catalogue-card {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.catalogue-card:hover {
  border-color: var(--primary);
  background: #162235;
}

.catalogue-icon {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  flex: 0 0 46px;
  margin-top: 2px;
}

.catalogue-icon svg {
  width: 24px;
  height: 24px;
  stroke-width: 2.25;
}

.dash-icon.appointment,
.catalogue-icon.appointment,
.catalogue-group-icon.monitoring { --icon-accent: #2563eb; --icon-accent-2: #38bdf8; }
.dash-icon.triage,
.catalogue-icon.triage,
.catalogue-icon.urgent,
.catalogue-group-icon.urgent { --icon-accent: #dc2626; --icon-accent-2: #fb7185; }
.dash-icon.medication,
.catalogue-icon.medication { --icon-accent: #059669; --icon-accent-2: #14b8a6; }
.dash-icon.journey,
.catalogue-icon.journey { --icon-accent: #7c3aed; --icon-accent-2: #c084fc; }
.dash-icon.alerts,
.catalogue-icon.alerts { --icon-accent: #f97316; --icon-accent-2: #facc15; }
.dash-icon.biometrics,
.catalogue-icon.biometrics { --icon-accent: #4f46e5; --icon-accent-2: #06b6d4; }
.catalogue-icon.immunization { --icon-accent: #0284c7; --icon-accent-2: #0ea5e9; }
.catalogue-icon.record,
.catalogue-icon.care,
.catalogue-group-icon.health { --icon-accent: #16a34a; --icon-accent-2: #84cc16; }
.catalogue-icon.home-health { --icon-accent: #0d9488; --icon-accent-2: #2dd4bf; }
.catalogue-icon.community,
.catalogue-group-icon.family { --icon-accent: #0891b2; --icon-accent-2: #22d3ee; }
.catalogue-icon.accessibility { --icon-accent: #7c3aed; --icon-accent-2: #c084fc; }
.catalogue-icon.household { --icon-accent: #475569; --icon-accent-2: #94a3b8; }
.catalogue-icon.kids { --icon-accent: #ec4899; --icon-accent-2: #f9a8d4; }
.catalogue-icon.education { --icon-accent: #ca8a04; --icon-accent-2: #facc15; }
.catalogue-icon.identity,
.catalogue-group-icon.identity { --icon-accent: #334155; --icon-accent-2: #64748b; }
.catalogue-icon.devices { --icon-accent: #0f766e; --icon-accent-2: #14b8a6; }
.catalogue-icon.ratings { --icon-accent: #eab308; --icon-accent-2: #f97316; }
.catalogue-icon.whatsapp { --icon-accent: #16a34a; --icon-accent-2: #22c55e; }
.catalogue-group-icon.catalogue { --icon-accent: #6366f1; --icon-accent-2: #06b6d4; }

.catalogue-card h4 {
  margin: 0 0 4px;
  font-size: 14px;
}

.catalogue-card p {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
}

.catalogue-link {
  display: inline-block;
  margin-top: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--primary);
}

.product-offering-grid {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.product-suite-strip {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 14px;
}

.catalogue-billing-hint {
  grid-column: 1 / -1;
  margin: 0 0 16px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent, #2563eb);
  border-radius: 10px;
  background: var(--panel);
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.catalogue-billing-hint a {
  color: var(--accent, #2563eb);
  font-weight: 800;
  text-decoration: underline;
  min-height: 24px;
  display: inline-block;
  margin-left: 6px;
}

.product-suite-pill {
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--panel);
  color: var(--text);
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.2;
  padding: 8px 11px;
  transition: border-color 0.15s, background 0.15s, transform 0.15s;
}

.product-suite-pill:hover,
.product-suite-pill:focus-visible {
  border-color: var(--primary);
  background: color-mix(in srgb, var(--primary) 12%, var(--panel));
  outline: none;
  transform: translateY(-1px);
}

.product-offering-group {
  grid-column: 1 / -1;
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.42);
}

.product-offering-group + .product-offering-group {
  margin-top: 4px;
}

.product-offering-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.12);
}

.product-offering-group-header h3 {
  margin: 0;
  font-size: 15px;
}

.product-offering-group-header span {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.product-offering-card {
  width: 100%;
  text-align: left;
  border-radius: 8px;
}

.product-offering-card.selected,
.product-card-focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 18%, transparent);
}

button.selected,
.btn-primary.selected,
.btn-secondary.selected,
.option-button.selected,
.catalogue-card.selected,
.platform-choice.active,
.triage-option.selected,
.triage-option[aria-pressed="true"] {
  border-color: var(--primary) !important;
  background: color-mix(in srgb, var(--primary) 18%, var(--panel)) !important;
  color: var(--text) !important;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 22%, transparent);
}

button.selected i,
.btn-primary.selected i,
.btn-secondary.selected i,
.option-button.selected i,
.catalogue-card.selected i {
  color: var(--primary-2);
}

[data-theme="light"] button.selected,
[data-theme="light"] .btn-primary.selected,
[data-theme="light"] .btn-secondary.selected,
[data-theme="light"] .option-button.selected,
[data-theme="light"] .catalogue-card.selected,
[data-theme="light"] .platform-choice.active,
[data-theme="light"] .triage-option.selected,
[data-theme="light"] .triage-option[aria-pressed="true"] {
  background: color-mix(in srgb, var(--primary) 12%, #ffffff) !important;
  color: #0f172a !important;
}

.product-card-focus {
  animation: productCardPulse 1.2s ease-out;
}

.product-offering-content {
  display: grid;
  gap: 7px;
}

.product-offering-content strong {
  color: var(--text);
  font-size: 14px;
}

.product-offering-content span,
.product-offering-content small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.product-offering-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.product-suite-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.product-suite-chip {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  background: color-mix(in srgb, var(--primary) 10%, var(--panel));
  border: 1px solid color-mix(in srgb, var(--primary) 24%, var(--border));
  color: var(--text);
  font-size: 10px;
  font-weight: 800;
  padding: 3px 8px;
}

.product-flow-eyebrow {
  color: var(--primary);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.04em;
  margin-bottom: 6px;
  text-transform: uppercase;
}

.sector-pill {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.sector-public {
  color: #7dd3fc;
  background: rgba(14, 165, 233, 0.12);
  border-color: rgba(14, 165, 233, 0.28);
}

.sector-private {
  color: #f0abfc;
  background: rgba(217, 70, 239, 0.12);
  border-color: rgba(217, 70, 239, 0.28);
}

.sector-mixed {
  color: #86efac;
  background: rgba(34, 197, 94, 0.12);
  border-color: rgba(34, 197, 94, 0.28);
}

.billing-selected-plan {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--muted);
  margin-bottom: 14px;
  padding: 12px 14px;
}

.billing-selected-plan strong {
  color: var(--text);
}

.billing-checkout-panel {
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.12), rgba(34, 197, 94, 0.10));
  border: 1px solid rgba(14, 165, 233, 0.28);
  border-radius: 10px;
  color: var(--text);
  display: grid;
  gap: 14px;
  padding: 16px;
}

.billing-checkout-panel h3 {
  margin: 8px 0 4px;
}

.billing-checkout-panel p {
  color: var(--muted);
  margin: 0;
}

.billing-checkout-summary {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}

.billing-checkout-summary span {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 10px;
  word-break: break-word;
}

.billing-checkout-summary strong {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
}

.billing-checkout-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.home-care-agency-panel {
  display: grid;
  gap: 14px;
}

.home-care-agency-panel p {
  color: var(--muted);
  margin: 6px 0 0;
}

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

.home-care-agency-card,
.home-care-agency-mini {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  display: grid;
  gap: 7px;
  padding: 12px;
}

.home-care-agency-card p,
.home-care-agency-card small,
.home-care-agency-mini span,
.home-care-agency-mini small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  margin: 0;
}

@keyframes productCardPulse {
  0% { transform: translateY(0); }
  40% { transform: translateY(-2px); }
  100% { transform: translateY(0); }
}

.kids-product-card {
  position: relative;
  overflow: hidden;
}

.kids-product-card::after {
  content: "";
  position: absolute;
  inset: auto -20% 0 -20%;
  height: 3px;
  background: linear-gradient(90deg, #22c55e, #38bdf8, #f59e0b);
  animation: kidColorRun 3s ease-in-out infinite;
}

@media (max-width: 640px) {
  .catalogue-grid {
    grid-template-columns: 1fr;
  }
}

.landing-grid {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-top: 8px;
}

.landing-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 24px;
  cursor: pointer;
  display: grid;
  gap: 10px;
  transition: border-color 0.15s, background 0.15s;
}

.landing-card:hover {
  border-color: var(--primary);
  background: #162235;
}

/* Explanation cards sit on the landing page too, but they are not buttons: without this they
   inherit the clickable cursor and hover lift of the action cards above them. */
.landing-card.is-info {
  cursor: default;
}

.landing-card.is-info:hover {
  border-color: var(--border);
  background: var(--panel);
}

.landing-about h2 {
  font-size: 28px;
  font-weight: 700;
  margin: 8px 0 10px;
}

.landing-about {
  margin-top: 36px;
}

.landing-about .landing-subtitle {
  margin-bottom: 18px;
}

.landing-about-cta {
  margin-top: 32px;
  margin-bottom: 24px;
}

@media (max-width: 900px) {
  .landing-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 560px) {
  .landing-grid {
    grid-template-columns: 1fr;
  }
}

.landing-card-icon {
  width: 28px;
  height: 28px;
  color: var(--primary);
}

.landing-card h3 {
  margin: 0;
  font-size: 15px;
}

.landing-card p {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.4;
}

.mv-icon svg {
  display: block;
}

.mv-card h3 {
  margin: 0;
  font-size: 17px;
  color: var(--text);
}

.mv-card p {
  margin: 0;
  font-size: 14px;
  color: var(--muted);
  line-height: 1.7;
}

@media (max-width: 900px) {
  .landing-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .hero-card {
    padding: 24px;
    gap: 20px;
  }
  .dashboard-stats {
    grid-template-columns: 1fr;
  }
  .dashboard-actions {
    grid-template-columns: 1fr 1fr;
  }
}

.auth-panel {
  grid-column: 1 / -1;
  max-width: 520px;
  margin: 0 auto;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 18px 44px rgba(2, 6, 23, 0.22);
}

.auth-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
}

.auth-tab {
  flex: 1;
  min-height: 48px;
  padding: 14px 16px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-weight: 600;
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
}

.auth-tab.active {
  color: var(--text);
  background: rgba(16, 185, 129, 0.08);
  border-bottom: 2px solid var(--primary);
}

.auth-form {
  padding: 32px;
  max-width: 420px;
  margin: 0 auto;
}

.auth-form h2 {
  margin: 0 0 4px;
  font-size: 22px;
}

.auth-form > p {
  margin: 0 0 20px;
  color: var(--muted);
  font-size: 14px;
}

.auth-fields {
  display: grid;
  gap: 14px;
  width: 100%;
}

.auth-fields label {
  display: grid;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
}

.auth-fields input,
.auth-fields select {
  width: 100%;
  box-sizing: border-box;
  min-height: 44px;
  padding: 11px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
  font-size: 14px;
  outline: none;
}

.auth-fields button,
.auth-form > button,
.auth-form .btn-primary,
.auth-form .btn-secondary {
  min-height: 44px;
  box-sizing: border-box;
  justify-content: center;
}

.auth-fields input:focus,
.auth-fields select:focus {
  border-color: var(--primary);
}

.auth-error {
  color: #ef4444;
  font-size: 13px;
  margin: 4px 0 0;
  min-height: 18px;
}

.immutable-badge {
  background: #dc2626;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  letter-spacing: 0.5px;
  vertical-align: middle;
}

.auth-divider {
  text-align: center;
  margin: 18px 0;
  color: var(--muted);
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  border-top: 1px solid var(--border);
}

.g_id_signin {
  display: flex;
  justify-content: center;
  min-height: 44px;
}

.user-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 20px;
  background: rgba(16, 185, 129, 0.12);
  color: var(--primary);
  font-size: 12px;
  font-weight: 600;
}

.btn-logout {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  padding: 6px 14px;
  font-size: 12px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}

.btn-logout:hover {
  color: #ef4444;
  border-color: #ef4444;
}

.biometric-result {
  margin-top: 16px;
}

.biometric-login-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(2, 6, 23, 0.82);
}

.biometric-login-dialog {
  width: min(520px, 100%);
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
}

.biometric-login-dialog h3 {
  margin: 0 0 6px;
}

.biometric-login-dialog p {
  color: var(--muted);
  font-size: 13px;
}

.biometric-login-dialog video {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #020617;
}

.biometric-login-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 12px;
}

.result-card {
  padding: 18px;
  border-radius: 8px;
  margin-top: 8px;
}

.result-card.success {
  background: rgba(22, 163, 74, 0.15);
  border: 1px solid rgba(22, 163, 74, 0.4);
}

.result-card.error {
  background: rgba(220, 38, 38, 0.15);
  border: 1px solid rgba(220, 38, 38, 0.4);
}

#triage {
  padding-bottom: 100px;
}
#triageVoiceBtn.recording {
  background: #dc2626 !important;
  border-color: #dc2626 !important;
  color: #fff !important;
  animation: triageMicPulse 1.2s infinite;
}
.triage-guided-stop {
  border-color: #dc2626 !important;
  color: #fecaca !important;
}
.triage-guided-stop:hover {
  background: rgba(220, 38, 38, 0.14) !important;
  border-color: #ef4444 !important;
}
@keyframes triageMicPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.5); }
  50% { box-shadow: 0 0 0 8px rgba(220, 38, 38, 0); }
}
.triage-info {
  background: #0b1220;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 20px;
}

.triage-info ol {
  padding-left: 20px;
  color: var(--muted);
}

.triage-info li {
  margin-bottom: 8px;
}

.triage-progress {
  margin-bottom: 20px;
}

.triage-progress-bar {
  height: 8px;
  background: #0b1220;
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 8px;
}

.triage-progress-bar > div {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--primary-2));
  transition: width 0.3s ease;
}

.triage-question {
  background: #0b1220;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 24px;
  margin-bottom: 16px;
}

.triage-question h3 {
  margin-bottom: 16px;
}

.triage-checkbox-group {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  align-items: stretch;
  gap: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  margin: 12px 0;
}

.triage-checkbox-group legend {
  padding: 0 6px;
  color: var(--muted);
  font-size: 13px;
}

.triage-checkbox-group label,
.triage-checkbox-answer {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  line-height: 1.25;
}

.triage-checkbox-group label {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  font-size: 14px;
}

.triage-checkbox-group input[type="checkbox"],
.triage-checkbox-answer input[type="checkbox"] {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--primary);
}

.triage-checkbox-answer {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  background: var(--surface);
}

.triage-btn-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0;
}

.triage-option-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  border: 2px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  flex: 1 0 auto;
  min-width: 80px;
  justify-content: center;
}

.triage-option-btn:hover {
  border-color: var(--primary);
  background: var(--surface-2);
}

.triage-option-btn.selected {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
}

.triage-option-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  color: var(--triage-option-color, var(--primary));
  background: color-mix(in srgb, var(--triage-option-color, var(--primary)) 14%, transparent);
  flex: 0 0 26px;
}

.triage-option-icon svg {
  width: 16px;
  height: 16px;
  stroke-width: 2.4;
}

.triage-option-icon.yes { --triage-option-color: #16a34a; }
.triage-option-icon.no { --triage-option-color: #dc2626; }
.triage-option-icon.choice { --triage-option-color: #2563eb; }

.triage-option-btn.selected .triage-option-icon {
  color: #fff;
  background: rgba(255,255,255,0.18);
}

.triage-checkbox-group label.triage-symptom-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
  min-height: 48px;
}

.triage-checkbox-group label.triage-symptom-btn.active-symptom {
  border-color: var(--primary);
  background: linear-gradient(135deg, var(--primary), var(--primary-2, #06b6d4));
  color: #fff;
  box-shadow: 0 8px 22px rgba(37, 99, 235, 0.18);
}

.triage-checkbox-group label.triage-symptom-btn.active-symptom span {
  color: #fff;
}

.symptom-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  flex: 0 0 34px;
  color: var(--symptom-color, var(--primary));
  background: color-mix(in srgb, var(--symptom-color, var(--primary)) 14%, transparent);
}

.symptom-icon svg {
  width: 19px;
  height: 19px;
  stroke-width: 2.3;
}

.triage-symptom-btn.active-symptom .symptom-icon {
  color: #fff;
  background: rgba(255,255,255,0.18);
}

.symptom-icon.fever { --symptom-color: #dc2626; }
.symptom-icon.cough { --symptom-color: #0891b2; }
.symptom-icon.breathing { --symptom-color: #2563eb; }
.symptom-icon.chest { --symptom-color: #e11d48; }
.symptom-icon.stomach { --symptom-color: #f97316; }
.symptom-icon.vomiting { --symptom-color: #ca8a04; }
.symptom-icon.rash { --symptom-color: #db2777; }
.symptom-icon.dizziness { --symptom-color: #7c3aed; }
.symptom-icon.pregnancy { --symptom-color: #ec4899; }
.symptom-icon.mood { --symptom-color: #6366f1; }

/* AI App Symptom Logger */
.ai-app-section {
  max-width: 1180px;
  margin: 0 auto;
  padding-bottom: 32px;
  scroll-margin-top: 24px;
}

.ai-app-heading {
  align-items: center;
  margin-bottom: 18px;
}

.ai-app-heading h2 {
  margin: 0 0 4px;
  font-size: 24px;
}

.ai-app-heading p {
  max-width: 780px;
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.ai-app-step svg {
  width: 18px;
  height: 18px;
}

.ai-app-shell {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(280px, 0.55fr);
  gap: 18px;
  align-items: start;
}

.ai-app-form-panel,
.ai-app-summary-panel,
.ai-app-referral-panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px;
}

.ai-app-panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding-bottom: 14px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.ai-app-panel-header h3,
.ai-app-summary-panel h3 {
  margin: 0 0 4px;
  color: var(--text);
  font-size: 17px;
}

.ai-app-panel-header h3 {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ai-app-panel-header h3 svg {
  width: 18px;
  height: 18px;
  color: var(--primary);
}

.ai-app-panel-header p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.ai-app-status {
  flex: 0 0 auto;
  border: 1px solid color-mix(in srgb, var(--primary) 42%, transparent);
  border-radius: 999px;
  padding: 5px 10px;
  background: color-mix(in srgb, var(--primary) 12%, transparent);
  color: var(--primary);
  font-size: 12px;
  font-weight: 800;
}

.ai-app-fields {
  display: grid;
  gap: 14px;
}

.ai-app-field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  align-items: start;
}

.ai-app-context-grid {
  display: grid;
  grid-template-columns: minmax(100px, 0.7fr) minmax(140px, 1fr) minmax(180px, 1.3fr);
  gap: 12px;
  align-items: start;
}

#ai-app .ai-app-symptoms {
  margin: 0;
  grid-template-columns: repeat(auto-fit, minmax(235px, 1fr));
}

#ai-app .ai-app-symptoms legend {
  font-size: 14px;
  font-weight: 700;
}

.ai-upload-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  min-height: 48px;
}

.ai-upload-row .file-upload-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: fit-content;
  min-height: 42px;
  padding: 10px 12px;
  overflow: hidden;
}

.ai-upload-row .file-upload-btn i,
.ai-app-actions i {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
}

#aiWoundUpload {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.ai-upload-status {
  min-height: 18px;
  color: var(--text-muted, var(--muted));
  font-size: 13px;
}

.ai-app-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.ai-app-actions button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.ai-app-result {
  margin-top: 2px;
}

.ai-app-result .card {
  margin: 0;
}

.ai-app-summary-panel h3 {
  margin-bottom: 14px;
}

.ai-app-route-list {
  display: grid;
  gap: 10px;
}

.ai-app-route-list div {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 2px 10px;
  align-items: center;
  padding: 12px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 8px;
  background: var(--surface, #0b1220);
}

.ai-app-route-list span {
  grid-row: 1 / span 2;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: rgba(16, 185, 129, 0.16);
  color: var(--primary);
  font-size: 12px;
  font-weight: 800;
}

.ai-app-route-list strong {
  color: var(--text);
  font-size: 14px;
}

.ai-app-route-list small {
  color: var(--muted);
  font-size: 12px;
}

.ai-app-governance-note,
.ai-risk-context-impact {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-top: 14px;
  padding: 12px;
  border: 1px solid color-mix(in srgb, var(--primary) 32%, var(--border));
  border-radius: 8px;
  background: color-mix(in srgb, var(--primary) 7%, var(--surface));
}

.ai-app-governance-note svg,
.ai-risk-context-impact svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  color: var(--primary);
}

.ai-app-governance-note strong,
.ai-risk-context-impact strong {
  display: block;
  color: var(--text);
  font-size: 13px;
}

.ai-app-governance-note p,
.ai-risk-context-impact p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.ai-app-referral {
  margin-top: 18px;
}

.ai-app-referral-panel {
  max-width: 100%;
}

#aiAppReferralContent {
  display: grid;
  gap: 12px;
}

/* Operational workspace: keep assessment output visible beside the form. */
#ai-app.ai-app-section {
  width: 100%;
  max-width: 1280px;
  min-height: calc(100vh - 120px);
  margin: 0 auto;
  padding: 4px 0 40px;
  letter-spacing: 0;
}

#ai-app .ai-app-heading {
  min-height: 64px;
  margin-bottom: 16px;
  padding: 0 2px;
}

#ai-app .ai-app-heading h2,
#ai-app .ai-app-heading p,
#ai-app h3,
#ai-app button,
#ai-app label,
#ai-app input,
#ai-app select,
#ai-app textarea {
  letter-spacing: 0 !important;
}

#ai-app .ai-app-shell {
  grid-template-columns: minmax(0, 1fr) minmax(320px, 380px);
  gap: 16px;
  align-items: start;
}

#ai-app .ai-app-form-panel,
#ai-app .ai-app-summary-panel,
#ai-app .ai-app-rail-panel,
#ai-app .ai-app-referral-panel {
  border-radius: 8px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
}

#ai-app .ai-app-form-panel {
  min-width: 0;
  padding: 0;
  overflow: hidden;
}

#ai-app .ai-app-form-panel > .ai-app-panel-header {
  margin: 0;
  padding: 18px 20px;
  background: var(--panel-2);
}

#ai-app .ai-app-fields {
  gap: 18px;
  padding: 20px;
}

#ai-app .ai-app-fields > .ai-app-field-grid,
#ai-app .ai-app-fields > .ai-app-context-grid,
#ai-app .ai-app-fields > fieldset {
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border);
}

#ai-app .ai-app-fields label,
#ai-app .ai-app-symptoms legend {
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
}

#ai-app .ai-app-fields input,
#ai-app .ai-app-fields select,
#ai-app .ai-app-fields textarea {
  min-height: 44px;
  margin-top: 7px;
}

#ai-app .ai-app-symptoms {
  gap: 8px;
  padding-top: 0;
}

#ai-app .triage-symptom-btn {
  min-height: 54px;
  border-width: 1px;
  border-radius: 8px;
  text-align: left;
}

#ai-app .triage-symptom-btn:has(input:checked),
#ai-app .triage-symptom-btn.active-symptom {
  border-color: var(--primary);
  background: color-mix(in srgb, var(--primary) 12%, var(--panel));
  color: var(--text) !important;
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary) 15%, transparent);
}

#ai-app .triage-symptom-btn:has(input:checked) > span:not(.symptom-icon),
#ai-app .ai-app-symptoms label.triage-symptom-btn.active-symptom > span:not(.symptom-icon) {
  color: var(--text) !important;
}

#ai-app .triage-symptom-btn:has(input:checked) .symptom-icon,
#ai-app .triage-symptom-btn.active-symptom .symptom-icon {
  background: color-mix(in srgb, var(--primary) 16%, var(--panel));
  color: var(--primary) !important;
}

#ai-app .triage-symptom-btn:focus-within {
  outline: 3px solid color-mix(in srgb, var(--primary) 30%, transparent);
  outline-offset: 2px;
}

#ai-app .ai-app-actions {
  position: sticky;
  bottom: 0;
  z-index: 2;
  margin: 0 -20px -20px;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  background: color-mix(in srgb, var(--panel) 96%, transparent);
  backdrop-filter: blur(8px);
}

#ai-app .ai-app-actions button {
  min-height: 44px;
}

#ai-app .ai-app-actions button[disabled] {
  cursor: wait;
  opacity: 0.72;
}

.ai-app-form-error {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: -4px 0 0;
  padding: 10px 12px;
  border: 1px solid color-mix(in srgb, var(--danger) 35%, var(--border));
  border-radius: 8px;
  background: color-mix(in srgb, var(--danger) 8%, var(--panel));
  color: var(--danger);
  font-size: 13px;
  font-weight: 600;
}

.ai-app-form-error[hidden] {
  display: none;
}

#ai-app .ai-app-side-rail {
  position: sticky;
  top: 16px;
  display: grid;
  gap: 12px;
  max-height: calc(100vh - 32px);
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}

#ai-app .ai-app-side-rail:has(.ai-app-rail-panel[style*="display: block"]) {
  position: static;
  max-height: none;
  overflow: visible;
}

body.ai-app-active #triageBotFloating,
body.ai-app-active #scribe-widget,
body.ai-app-active #themeToggle {
  display: none !important;
}

#ai-app .ai-app-summary-panel {
  order: 3;
  padding: 16px;
}

.ai-app-rail-heading {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.ai-app-rail-heading h3,
.ai-app-rail-heading p {
  margin: 0;
}

.ai-app-rail-heading p {
  color: var(--muted);
  font-size: 12px;
}

.ai-app-rail-icon {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 8px;
  background: color-mix(in srgb, var(--secondary) 12%, var(--panel));
  color: var(--secondary);
}

#ai-app .ai-app-route-list {
  gap: 0;
}

#ai-app .ai-app-route-list div {
  position: relative;
  border: 0;
  border-radius: 0;
  padding: 8px 4px 8px 42px;
  background: transparent;
}

#ai-app .ai-app-route-list div:not(:last-child)::after {
  content: "";
  position: absolute;
  left: 18px;
  top: 38px;
  bottom: -6px;
  width: 1px;
  background: var(--border);
}

#ai-app .ai-app-route-list span {
  position: absolute;
  left: 4px;
  top: 9px;
  width: 28px;
  height: 28px;
}

#ai-app .ai-app-governance-note,
#ai-app .ai-risk-context-impact {
  border-left: 3px solid var(--primary);
  border-radius: 6px;
}

#ai-app .ai-app-rail-panel {
  background: var(--panel);
  border: 1px solid var(--border);
  padding: 16px;
}

#ai-app .ai-app-result,
#ai-app .ai-app-referral {
  margin: 0;
}

#ai-app .ai-app-result { order: 1; }
#ai-app .ai-app-referral { order: 2; }

#ai-app .ai-app-referral-panel {
  padding: 0;
  border: 0;
  box-shadow: none;
}

#ai-app .ai-app-referral-panel .ai-app-panel-header {
  margin-bottom: 12px;
  padding-bottom: 12px;
}

.ai-assessment-card {
  border-left: 4px solid var(--primary);
  padding-left: 12px;
}

.ai-assessment-card[data-risk="critical"] { border-left-color: var(--danger); }
.ai-assessment-card[data-risk="high"] { border-left-color: var(--warning); }
.ai-assessment-card[data-risk="moderate"] { border-left-color: #b7791f; }
.ai-assessment-card[data-risk="error"] { border-left-color: var(--danger); }

.ai-assessment-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.ai-assessment-header h3 {
  margin: 0;
  font-size: 15px;
}

.ai-risk-badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 4px 9px;
  border: 1px solid currentColor;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
}

.ai-risk-badge[data-risk="critical"] { color: var(--danger); background: color-mix(in srgb, var(--danger) 10%, var(--panel)); }
.ai-risk-badge[data-risk="high"] { color: #a65f00; background: color-mix(in srgb, var(--warning) 12%, var(--panel)); }
.ai-risk-badge[data-risk="moderate"] { color: #8a5b00; background: #fff8e1; }
.ai-risk-badge[data-risk="low"] { color: var(--primary-dark); background: var(--primary-soft); }

.ai-assessment-score {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 12px;
}

.ai-assessment-copy {
  display: grid;
  gap: 10px;
}

.ai-assessment-copy p,
.ai-assessment-copy ol {
  margin: 0;
  color: var(--text-secondary, var(--text));
  font-size: 13px;
  line-height: 1.5;
}

.ai-assessment-copy ol {
  padding-left: 18px;
}

.ai-app-result-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.ai-app-result-actions button {
  min-height: 38px;
}

.ai-referral-context {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 13px;
}

.ai-facility-list {
  display: grid;
  gap: 8px;
}

.ai-facility-item {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.ai-facility-item:last-child {
  border-bottom: 0;
}

.ai-facility-icon {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: color-mix(in srgb, var(--info) 12%, var(--panel));
  color: var(--info);
}

.ai-facility-copy strong {
  display: block;
  color: var(--text);
  font-size: 13px;
}

.ai-facility-meta,
.ai-facility-services {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
}

.ai-facility-services span {
  padding: 2px 5px;
  border-radius: 4px;
  background: var(--panel-2);
  color: var(--text-secondary, var(--text));
}

.ai-referral-action {
  margin-top: 12px;
  padding: 10px 12px;
  border-left: 3px solid var(--success);
  border-radius: 6px;
  background: color-mix(in srgb, var(--success) 8%, var(--panel));
  color: var(--text-secondary, var(--text));
  font-size: 12px;
  line-height: 1.5;
}

.ai-app-spinner {
  animation: ai-app-spin 800ms linear infinite;
}

@keyframes ai-app-spin {
  to { transform: rotate(360deg); }
}

.auto-filled-id {
  background: var(--surface-2);
  color: var(--muted);
}

.red-flag-badge {
  display: inline-block;
  background: rgba(220, 38, 38, 0.2);
  color: #f87171;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 12px;
}

.boolean-options {
  display: flex;
  gap: 12px;
}

.bool-btn {
  flex: 1;
  padding: 16px;
  border-radius: 8px;
  border: 2px solid var(--border);
  background: transparent;
  color: var(--text);
  font-weight: 700;
  font-size: 16px;
  cursor: pointer;
  transition: all 0.2s ease;
}

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

.bool-btn.selected-yes {
  border-color: #16a34a;
  background: rgba(22, 163, 74, 0.15);
  color: #4ade80;
}

.bool-btn.selected-no {
  border-color: #dc2626;
  background: rgba(220, 38, 38, 0.15);
  color: #f87171;
}

.triage-actions {
  display: flex;
  gap: 12px;
  margin-top: 16px;
}

.vitals-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  margin: 20px 0;
}

.death-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
  margin: 12px 0;
}
.death-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 14px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  text-align: center;
  background: var(--card-bg);
}
.death-card:hover { border-color: var(--primary); }
.death-card.selected { border-color: var(--primary); background: rgba(13,148,136,0.08); }
.death-icon { font-size: 24px; }
.death-label { font-size: 13px; font-weight: 600; }
.death-type { font-size: 11px; padding: 2px 4px; border-radius: 4px; border: 1px solid var(--border); background: var(--input-bg); color: var(--text); margin-top: 4px; }
.hiv-disclosure { margin-top: 4px; }
.hiv-disclosure input { margin-right: 4px; }
.med-row, .surgery-row {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 6px;
  background: var(--card-bg);
}
.file-upload-btn { cursor: pointer; display: inline-block; }

.triage-result-card {
  background: #0b1220;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 28px;
  text-align: center;
}

.risk-badge {
  display: inline-block;
  padding: 12px 28px;
  border-radius: 999px;
  font-weight: 800;
  font-size: 18px;
  letter-spacing: 0.05em;
  margin-bottom: 16px;
}

.result-detail-card {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 18px;
  margin: 12px 0;
  text-align: left;
}

.result-detail-card h4 {
  margin-bottom: 10px;
  color: var(--primary);
}

.referral-alert {
  background: rgba(220, 38, 38, 0.15);
  border: 1px solid rgba(220, 38, 38, 0.4);
  border-radius: 8px;
  padding: 14px 18px;
  color: #f87171;
  font-weight: 600;
  margin: 12px 0;
}

.workflow-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.workflow-tag {
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: var(--primary);
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
}

.triage-summary-report {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  text-align: left;
}

.triage-summary-report-head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.triage-summary-report-head strong {
  color: var(--text);
}

.triage-summary-report-head small {
  margin-left: auto;
  color: var(--muted);
}

.triage-summary-risk {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 10px;
  border: 1px solid currentColor;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}

.triage-summary-note,
.triage-summary-care-path {
  margin: 0;
  padding: 10px;
  border-radius: 8px;
  background: var(--panel-2, #0f172a);
  color: var(--muted);
  line-height: 1.5;
}

.triage-summary-care-path {
  display: grid;
  gap: 4px;
}

.triage-summary-list ol {
  margin: 6px 0 0;
  padding-left: 20px;
  color: var(--muted);
}

.biometric-controls {
  margin-bottom: 16px;
}

@media (max-width: 860px) {
  body {
    grid-template-columns: 1fr;
  }

  .sidebar {
    display: block;
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 12000;
    width: min(300px, 86vw);
    transform: translateX(-105%);
    transition: transform 0.2s ease;
    box-shadow: 20px 0 50px rgba(0, 0, 0, 0.35);
  }

  .sidebar.mobile-open {
    transform: translateX(0);
  }

  .mobile-nav-toggle {
    display: inline-flex;
  }

  .mobile-nav-backdrop:not([hidden]) {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 11000;
    width: 100%;
    height: 100%;
    border: 0;
    background: rgba(2, 6, 23, 0.72);
  }

  body.mobile-nav-open {
    overflow: hidden;
  }

  .shell {
    padding: 18px;
  }

  .topbar {
    align-items: flex-start;
    gap: 12px;
  }

  .topbar-title {
    min-width: 0;
    flex: 1;
  }

  .topbar-title h1 {
    font-size: 21px;
    overflow-wrap: anywhere;
  }

  #topbarEnd {
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .welcome-bar {
    align-items: flex-start;
    padding: 20px;
  }

  .dashboard-refresh-wrap {
    flex-direction: column-reverse;
    align-items: flex-end;
  }

  .patient-dashboard-grid {
    grid-template-columns: 1fr;
  }

  .grid,
  .two-col {
    grid-template-columns: 1fr;
  }

  .camera-container {
    max-width: 100%;
  }

  .vitals-grid {
    grid-template-columns: 1fr;
  }

  .ai-app-section {
    max-width: 100%;
  }

  #ai-app .ai-app-shell,
  #ai-app .ai-app-field-grid,
  #ai-app .ai-app-context-grid {
    grid-template-columns: 1fr;
  }

  #ai-app .ai-app-side-rail {
    position: static;
    max-height: none;
    overflow: visible;
  }

  .ai-app-panel-header {
    flex-direction: column;
  }

  .ai-app-actions button {
    width: 100%;
  }

}

@media (max-width: 560px) {
  .topbar { flex-wrap: wrap; }
  #topbarEnd { width: 100%; justify-content: flex-start; }
  .welcome-bar { flex-direction: column; }
  .dashboard-refresh-wrap { width: 100%; flex-direction: row; justify-content: space-between; align-items: center; }
  .dashboard-data-status { text-align: left; }
  .dashboard-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-actions { grid-template-columns: 1fr; }
}

.upload-zone {
  padding: 24px;
  border: 2px dashed var(--border);
  border-radius: 12px;
  text-align: center;
  margin: 16px 0;
}
.upload-zone input[type="file"] {
  margin-top: 12px;
  padding: 10px;
  background: var(--surface);
  border-radius: 8px;
  color: var(--text);
}
.upload-status {
  margin-top: 8px;
  font-size: 13px;
  color: var(--primary);
}

.assistive-status {
  margin: 10px 0;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.doctor-card:focus-visible,
.slot-btn:focus-visible,
.camera-actions button:focus-visible {
  outline: 3px solid var(--primary);
  outline-offset: 3px;
}

.location-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--surface);
  border-radius: 8px;
  margin-bottom: 12px;
  font-size: 14px;
}
.location-bar span {
  color: var(--muted);
  font-size: 13px;
}

.location-consent-prompt {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin: 12px 0;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}

.location-consent-prompt p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.location-consent-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.visit-type-btn {
  flex: 1;
  min-width: 140px;
  min-height: 46px;
  padding: 14px 20px;
  border: 2px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.visit-type-btn:hover {
  border-color: var(--primary);
  background: rgba(20, 184, 166, 0.1);
}
.visit-type-btn.active {
  background: linear-gradient(135deg, var(--primary), var(--primary-2)) !important;
  border-color: #5eead4 !important;
  color: #fff !important;
  box-shadow: 0 0 0 3px rgba(20, 184, 166, 0.18);
}

.facility-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
  align-items: stretch;
  margin: 16px 0;
}
.facility-list-section {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 4px 0 0;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}
.facility-list-section:first-child {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}
.facility-list-empty,
.facility-list-note {
  grid-column: 1 / -1;
  padding: 14px;
  font-size: 13px;
  color: var(--muted);
  text-align: center;
  border: 1px dashed var(--border);
  border-radius: 8px;
  background: rgba(148, 163, 184, 0.06);
}
.facility-card {
  min-height: 156px;
  padding: 16px;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 7px;
  overflow: hidden;
  transition: all 0.2s;
}
.facility-card:hover {
  border-color: var(--primary);
  background: rgba(20, 184, 166, 0.08);
}
.facility-card.selected {
  border-color: var(--primary);
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.18), rgba(37, 99, 235, 0.12));
  box-shadow: 0 0 0 3px rgba(20, 184, 166, 0.14);
}
.facility-card-disabled {
  opacity: 0.65;
  cursor: default !important;
}
.facility-card-disabled:hover {
  border-color: var(--border) !important;
}
.facility-card h4 {
  margin: 0 0 4px;
  font-size: 15px;
  line-height: 1.25;
  color: var(--text);
}
.facility-card .facility-type {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--primary);
  font-weight: 600;
  text-transform: uppercase;
}
.facility-card .facility-distance {
  font-size: 13px;
  color: var(--muted);
  margin-top: 4px;
}
.facility-card .facility-available {
  font-size: 13px;
  color: var(--primary);
  margin-top: 6px;
}
.facility-card-meta {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 12px;
}
.facility-card-detail {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}
.facility-card-warning {
  color: var(--danger);
  font-size: 11px;
  margin-top: auto;
}
.facility-badge {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
  text-transform: uppercase;
}
.facility-badge.registered {
  background: rgba(16, 185, 129, 0.14);
  border: 1px solid rgba(16, 185, 129, 0.32);
  color: #10b981;
}
.facility-badge.info {
  background: rgba(100, 116, 139, 0.14);
  border: 1px solid rgba(100, 116, 139, 0.32);
  color: var(--muted);
}
.facility-card.health-train {
  border-left: 4px solid #7c3aed;
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.12), rgba(20, 184, 166, 0.05));
}
.train-status {
  display: inline-flex;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 800;
}
.train-status.on-site {
  background: rgba(16, 185, 129, 0.14);
  color: #10b981;
}
.train-status.in-transit {
  background: rgba(245, 158, 11, 0.16);
  color: #f59e0b;
}
.train-status.scheduled {
  background: rgba(100, 116, 139, 0.14);
  color: var(--muted);
}
.facility-train-icon {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #7c3aed;
  color: #fff;
  border: 2px solid rgba(255, 255, 255, 0.85);
  box-shadow: 0 3px 12px rgba(15, 23, 42, 0.35);
  font-size: 18px;
  font-weight: 900;
  animation: trainPulse 2s ease-in-out infinite;
}
@keyframes trainPulse {
  0%, 100% { transform: scale(1); box-shadow: 0 3px 12px rgba(124, 58, 237, 0.35); }
  50% { transform: scale(1.08); box-shadow: 0 5px 20px rgba(124, 58, 237, 0.55); }
}
@media (max-width: 640px) {
  .facility-list {
    grid-template-columns: 1fr;
  }
  .visit-type-btn {
    width: 100%;
  }
}

.map-container {
  margin: 16px 0;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.med-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 12px;
}
.med-card.active {
  border-left: 3px solid var(--primary);
}
.med-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.med-details {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 8px;
}
.med-details span {
  background: var(--panel-2);
  padding: 2px 8px;
  border-radius: 4px;
}
.med-warning {
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid var(--warning);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 13px;
  color: var(--warning);
  margin-top: 8px;
}

.advice-list, .alerts-list, .availability-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.advice-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
}
.advice-card.info {
  border-left: 3px solid #3b82f6;
}
.advice-card.moderate {
  border-left: 3px solid var(--warning);
}
.advice-card.high {
  border-left: 3px solid #ef4444;
  background: rgba(239, 68, 68, 0.05);
}
.advice-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.category-tag {
  font-size: 11px;
  background: var(--panel-2);
  padding: 2px 8px;
  border-radius: 4px;
  color: var(--muted);
  text-transform: uppercase;
}
.advice-card p {
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
}

.med-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.med-wallet-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  border: 1px solid rgba(16, 185, 129, 0.25);
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.12), rgba(59, 130, 246, 0.08));
}
.med-wallet-summary > div {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.med-wallet-summary strong {
  font-size: 22px;
  color: var(--text);
}
.med-wallet-summary small,
.med-summary-label {
  color: var(--muted);
  font-size: 12px;
}
.med-summary-label {
  text-transform: uppercase;
  letter-spacing: 0;
  font-weight: 700;
}
.med-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
}
.med-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 100%;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
}
.med-card.active {
  border-color: rgba(16, 185, 129, 0.35);
}
.med-card-top {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: start;
  gap: 10px;
}
.med-icon {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(16, 185, 129, 0.14);
  color: var(--primary);
  border: 1px solid rgba(16, 185, 129, 0.28);
  font-weight: 800;
  font-size: 14px;
}
.med-title {
  min-width: 0;
}
.med-title h3 {
  margin: 0;
  font-size: 16px;
  line-height: 1.25;
  color: var(--text);
}
.med-title span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.med-status {
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  white-space: nowrap;
}
.med-status.active {
  background: rgba(16, 185, 129, 0.16);
  color: var(--primary);
}
.med-status.muted {
  background: var(--panel-2);
  color: var(--muted);
}
.med-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.med-chip {
  display: inline-flex;
  flex-direction: column;
  gap: 2px;
  min-width: 88px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font-size: 12px;
  line-height: 1.2;
}
.med-chip em {
  color: var(--muted);
  font-style: normal;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
}
.med-instruction,
.med-warning {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.35;
}
.med-instruction {
  background: rgba(59, 130, 246, 0.08);
  border: 1px solid rgba(59, 130, 246, 0.18);
}
.med-warning {
  background: rgba(245, 158, 11, 0.10);
  border: 1px solid rgba(245, 158, 11, 0.24);
}
.med-instruction strong,
.med-warning strong {
  color: var(--text);
  font-size: 12px;
}
.med-instruction span,
.med-warning span {
  color: var(--muted);
}
.med-card-actions {
  margin-top: auto;
  padding-top: 4px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}
.med-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 28px 16px;
  border: 1px dashed var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--muted);
  text-align: center;
}
.med-empty strong {
  color: var(--text);
}
.med-empty-icon {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(16, 185, 129, 0.14);
  color: var(--primary);
  font-weight: 800;
}
.med-plan-heading {
  margin: 4px 0 12px;
  color: var(--text);
}
.med-cycle-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}
.med-cycle-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  border: 1px solid rgba(59, 130, 246, 0.24);
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(59, 130, 246, 0.08), var(--panel));
}
.med-cycle-top {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
}
.med-cycle-top h3 {
  margin: 0;
  font-size: 16px;
  color: var(--text);
}
.med-cycle-top span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}
.med-cycle-instructions {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 11px 12px;
  border-radius: 10px;
  background: rgba(16, 185, 129, 0.10);
  border: 1px solid rgba(16, 185, 129, 0.22);
}
.med-cycle-instructions strong,
.med-cycle-meta strong {
  color: var(--text);
  font-size: 12px;
}
.med-cycle-instructions span {
  color: var(--text);
  font-size: 13px;
  line-height: 1.35;
}
.med-cycle-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.med-cycle-meta span {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--muted);
  font-size: 12px;
}
.med-cycle-card p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}
@media (max-width: 640px) {
  .med-wallet-summary {
    align-items: stretch;
    flex-direction: column;
  }
  .med-card-grid {
    grid-template-columns: 1fr;
  }
  .med-cycle-grid,
  .med-cycle-meta {
    grid-template-columns: 1fr;
  }
}

.alert-banner {
  padding: 16px;
  border-radius: 12px;
  margin-bottom: 16px;
}
.alert-banner.critical {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid #ef4444;
  color: #fca5a5;
}
.alert-banner p {
  margin: 4px 0 0;
  font-size: 14px;
}

.alert-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
}
.alert-card.contraindicated, .alert-card.major {
  border-left: 3px solid #ef4444;
}
.alert-card.moderate {
  border-left: 3px solid var(--warning);
}
.alert-card.acknowledged {
  opacity: 0.75;
}
.alert-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.alert-card p {
  margin: 0 0 8px;
  font-size: 14px;
  line-height: 1.5;
}
.alert-action {
  color: var(--primary);
  font-weight: 500;
}
.channels {
  font-size: 12px;
  color: var(--muted);
  display: block;
  margin-bottom: 8px;
}

.severity-badge {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 600;
  text-transform: uppercase;
}
.severity-badge.contraindicated {
  background: rgba(239, 68, 68, 0.2);
  color: #fca5a5;
}
.severity-badge.major {
  background: rgba(245, 158, 11, 0.2);
  color: #fcd34d;
}
.severity-badge.moderate {
  background: rgba(59, 130, 246, 0.2);
  color: #93c5fd;
}
.severity-badge.minor {
  background: rgba(16, 185, 129, 0.2);
  color: #6ee7b7;
}

.interaction-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 12px;
}
.interaction-card.contraindicated, .interaction-card.major {
  border-left: 3px solid #ef4444;
  background: rgba(239, 68, 68, 0.05);
}
.interaction-card.moderate {
  border-left: 3px solid var(--warning);
}
.interaction-card p {
  margin: 8px 0 0;
  font-size: 14px;
}

/* ── Medication Safety Summary ── */
.safety-summary {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  padding: 16px;
  border-radius: 12px;
  background: var(--panel);
  border: 1px solid var(--border);
  align-items: center;
}
.safety-summary .summary-label {
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
  margin-right: 4px;
}
.severity-count {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 20px;
}
.severity-count.contraindicated {
  background: rgba(239, 68, 68, 0.2);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.4);
}
.severity-count.major {
  background: rgba(245, 158, 11, 0.2);
  color: #fcd34d;
  border: 1px solid rgba(245, 158, 11, 0.4);
}
.severity-count.moderate {
  background: rgba(59, 130, 246, 0.2);
  color: #93c5fd;
  border: 1px solid rgba(59, 130, 246, 0.4);
}
.severity-count.minor {
  background: rgba(16, 185, 129, 0.2);
  color: #6ee7b7;
  border: 1px solid rgba(16, 185, 129, 0.4);
}
.severity-count .count {
  font-size: 14px;
}

/* ── Interaction Check Results ── */
.interaction-result-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 12px;
}
.interaction-result-card.contraindicated,
.interaction-result-card.major {
  border-left: 4px solid #ef4444;
  background: rgba(239, 68, 68, 0.05);
}
.interaction-result-card.moderate {
  border-left: 4px solid var(--warning);
}
.interaction-result-card.minor {
  border-left: 4px solid var(--primary);
}
.interaction-result-card .med-pair {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 15px;
  margin-bottom: 6px;
}
.interaction-result-card .med-pair .vs {
  color: var(--muted);
  font-weight: 400;
}
.interaction-result-card p {
  margin: 4px 0;
  font-size: 14px;
  line-height: 1.5;
}
.interaction-result-card .action-recommended {
  color: var(--primary);
  font-weight: 500;
  margin-top: 6px;
}
.interaction-check-safe {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 16px;
  border-radius: 12px;
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid var(--primary);
  color: #6ee7b7;
  font-weight: 600;
  font-size: 14px;
}
.interaction-check-error {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 16px;
  border-radius: 12px;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid #ef4444;
  color: #fca5a5;
  font-weight: 500;
  font-size: 14px;
}

.availability-list table {
  width: 100%;
  border-collapse: collapse;
}
.availability-list th, .availability-list td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}
.availability-list th {
  font-size: 12px;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}

.location-toggle-btn {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 10px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
  transition: all 0.2s;
}
.location-toggle-btn:hover {
  background: #162235;
}
.location-toggle-btn.active {
  background: #dcfce7;
  border-color: #22c55e;
  color: #22c55e;
}

/* ── Global Notification Bar ── */
.global-notification {
  padding: 10px 24px;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid transparent;
  animation: notifSlide 0.3s ease-out;
}
@keyframes notifSlide {
  from { opacity: 0; max-height: 0; padding: 0 24px; }
  to { opacity: 1; max-height: 60px; padding: 10px 24px; }
}
.global-info {
  background: rgba(37, 99, 235, 0.12);
  color: #93c5fd;
  border-color: rgba(37, 99, 235, 0.3);
}
.global-warning {
  background: rgba(202, 138, 4, 0.12);
  color: #fde68a;
  border-color: rgba(202, 138, 4, 0.3);
}
.global-success {
  background: rgba(22, 163, 74, 0.12);
  color: #86efac;
  border-color: rgba(22, 163, 74, 0.3);
}
.global-urgent {
  background: rgba(220, 38, 38, 0.12);
  color: #fca5a5;
  border-color: rgba(220, 38, 38, 0.3);
}
.global-notification a {
  color: inherit;
  text-decoration: underline;
  font-weight: 600;
}
.global-notification .dismiss-btn {
  margin-left: auto;
  background: none;
  border: none;
  color: inherit;
  opacity: 0.6;
  cursor: pointer;
  font-size: 16px;
  padding: 0 4px;
}
.global-notification .dismiss-btn:hover {
  opacity: 1;
}

/* ── Floating Dr. Triage Bot ── */
#triageBotFloating {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
}

.triage-bot-btn {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  cursor: pointer;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(37, 99, 235, 0.4);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  animation: doctorFloat 3s ease-in-out infinite;
}
.triage-bot-btn:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 28px rgba(37, 99, 235, 0.55);
}
.triage-bot-btn:active {
  transform: scale(0.95);
}

@keyframes doctorFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

.doctor-avatar {
  width: 48px;
  height: 48px;
}
.doctor-avatar .doctor-svg {
  width: 100%;
  height: 100%;
}

.pulse-ring {
  position: absolute;
  top: -4px;
  left: -4px;
  right: -4px;
  bottom: -4px;
  border-radius: 50%;
  border: 3px solid rgba(37, 99, 235, 0.3);
  animation: pulseRing 2s ease-in-out infinite;
}

@keyframes pulseRing {
  0% { transform: scale(1); opacity: 0.6; }
  50% { transform: scale(1.15); opacity: 0.2; }
  100% { transform: scale(1); opacity: 0.6; }
}

/* ── Telehealth Countdown ── */
.telehealth-countdown {
  position: fixed;
  bottom: 100px;
  right: 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--panel-bg, #1e293b);
  border: 1px solid var(--border, #334155);
  border-radius: 16px;
  padding: 14px 20px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  cursor: pointer;
  z-index: 1000;
  animation: countdownSlideUp 0.4s ease-out;
  transition: transform 0.2s, box-shadow 0.2s;
}
.telehealth-countdown:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 40px rgba(0,0,0,0.5);
}

.appointment-countdown {
  bottom: 178px;
}

.countdown-pulse {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #22c55e;
  animation: countdownPulse 1.2s ease-in-out infinite;
  flex-shrink: 0;
}
.countdown-icon {
  font-size: 28px;
  line-height: 1;
  flex-shrink: 0;
}
.countdown-text strong {
  display: block;
  font-size: 14px;
  color: var(--text, #e2e8f0);
}
.countdown-text span {
  font-size: 12px;
  color: var(--muted, #94a3b8);
}
@keyframes countdownPulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.4); opacity: 0.6; }
}
@keyframes countdownSlideUp {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
@keyframes countdownUrgent {
  0%, 100% { background: #22c55e; }
  50% { background: #eab308; }
}

/* ── Chat Popup ── */
.triage-bot-popup {
  position: fixed;
  bottom: 100px;
  right: 24px;
  width: 420px;
  max-height: 640px;
  background: #0f172a;
  border: 1px solid #1e293b;
  border-radius: 16px;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.4);
  z-index: 9998;
  display: none;
  flex-direction: column;
  overflow: hidden;
  animation: slideUp 0.35s ease-out;
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.triage-bot-popup.open {
  display: flex;
}

.triage-bot-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  background: linear-gradient(135deg, #1e293b, #0f172a);
  border-bottom: 1px solid #1e293b;
}

.triage-bot-header-avatar {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
}
.triage-bot-header-avatar .doctor-svg-small {
  width: 100%;
  height: 100%;
}

.triage-bot-header-info {
  flex: 1;
}
.triage-bot-header-info strong {
  display: block;
  font-size: 15px;
  color: #f1f5f9;
}
.triage-bot-status {
  font-size: 11px;
  color: #22c55e;
}
.triage-bot-status::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #22c55e;
  margin-right: 5px;
  vertical-align: middle;
  animation: statusPulse 1.5s ease-in-out infinite;
}
@keyframes statusPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.triage-bot-close {
  background: none;
  border: none;
  color: var(--text-muted, #94a3b8);
  font-size: 24px;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
  transition: color 0.2s;
}
.triage-bot-close:hover {
  color: #f1f5f9;
}

/* ── Messages ── */
.triage-bot-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 260px;
  max-height: 380px;
}
@media (-webkit-min-device-pixel-ratio: 0) {
  .triage-bot-messages::-webkit-scrollbar { width: 4px; }
  .triage-bot-messages::-webkit-scrollbar-track { background: transparent; }
  .triage-bot-messages::-webkit-scrollbar-thumb { background: #334155; border-radius: 4px; }
}

.bot-message {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  max-width: 85%;
  animation: messageIn 0.3s ease-out;
}

.bot-message .msg-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: #1e293b;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}
.bot-message .msg-bubble {
  background: #1e293b;
  color: #e2e8f0;
  padding: 10px 14px;
  border-radius: 6px 16px 16px 16px;
  font-size: 13.5px;
  line-height: 1.55;
}

.user-message {
  align-self: flex-end;
  max-width: 80%;
  animation: messageIn 0.3s ease-out;
}
.user-message .msg-bubble {
  background: #2563eb;
  color: #fff;
  padding: 10px 14px;
  border-radius: 16px 6px 16px 16px;
  font-size: 13.5px;
  line-height: 1.55;
}

.typing-indicator {
  display: flex;
  gap: 4px;
  padding: 12px 16px;
}
.typing-indicator span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #64748b;
  animation: typingBounce 1.4s ease-in-out infinite;
}
.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }
@keyframes typingBounce {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(-6px); }
}

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

/* ── Input Area ── */
.triage-bot-input {
  padding: 12px 16px;
  border-top: 1px solid #1e293b;
  background: #0f172a;
}

.bot-quick-replies {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.bot-quick-reply {
  padding: 8px 16px;
  border-radius: 20px;
  border: 1.5px solid #334155;
  background: transparent;
  color: #e2e8f0;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
}
.bot-quick-reply:hover {
  border-color: #2563eb;
  background: rgba(37, 99, 235, 0.1);
  color: #60a5fa;
}
.bot-quick-reply.selected {
  border-color: #2563eb;
  background: #2563eb;
  color: #fff;
}

.bot-input-row {
  display: flex;
  gap: 8px;
}
.bot-input-row input,
.bot-input-row select {
  flex: 1;
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid #334155;
  background: #1e293b;
  color: #f1f5f9;
  font-size: 13.5px;
  outline: none;
  transition: border-color 0.2s;
}
.bot-input-row input:focus {
  border-color: #2563eb;
}
.bot-input-row input::placeholder {
  color: var(--text-muted, #94a3b8);
}
.bot-input-row button {
  padding: 10px 18px;
  border-radius: 8px;
  border: none;
  background: #2563eb;
  color: #fff;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.2s;
}
.bot-input-row button:hover {
  background: #1d4ed8;
}

.bot-concern-controls,
.bot-demographics-grid {
  display: grid;
  gap: 8px;
}

.bot-concern-controls select,
.bot-concern-controls textarea,
.bot-demographics-grid input,
.bot-demographics-grid select {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid #334155;
  background: #1e293b;
  color: #f1f5f9;
  font-size: 13px;
  outline: none;
}

.bot-symptom-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  max-height: 72px;
  overflow-y: auto;
}

.bot-symptom-tag {
  padding: 3px 10px;
  border-radius: 12px;
  border: 1px solid #334155;
  background: transparent;
  color: #cbd5e1;
  font-size: 11px;
  cursor: pointer;
  transition: all 0.15s;
  user-select: none;
  white-space: nowrap;
}

.bot-symptom-tag:hover {
  border-color: #3b82f6;
  color: #60a5fa;
}

.bot-symptom-tag.active {
  border-color: #3b82f6;
  background: #2563eb;
  color: #fff;
}

.bot-primary-action {
  width: 100%;
  padding: 10px 14px;
  border-radius: 8px;
  border: none;
  background: #2563eb;
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}

.bot-result-card {
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 12px;
  padding: 16px;
  text-align: center;
  margin: 4px 0;
}
.bot-result-card .risk-badge-result {
  display: inline-block;
  padding: 8px 20px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 16px;
  margin-bottom: 10px;
}
.bot-result-card h3 {
  color: #f1f5f9;
  margin-bottom: 6px;
}
.bot-result-card p {
  color: #94a3b8;
  font-size: 13px;
  line-height: 1.5;
}
.bot-result-card .result-action-btn {
  display: inline-block;
  margin-top: 12px;
  padding: 10px 24px;
  border-radius: 8px;
  border: none;
  background: #2563eb;
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  font-size: 13px;
  transition: background 0.2s;
}
.bot-result-card .result-action-btn:hover {
  background: #1d4ed8;
}

.triage-bot-note {
  font-size: 11px;
  color: var(--text-muted, #94a3b8);
  text-align: center;
  padding: 4px 16px 8px;
  border-top: 1px solid #1e293b;
}

/* Dr. Triage color identity: clinical blue, teal, and warm urgency accents. */
.triage-bot-btn {
  background: radial-gradient(circle at 32% 28%, #67e8f9 0 12%, transparent 13%),
    linear-gradient(135deg, #0ea5e9 0%, #2563eb 48%, #14b8a6 100%) !important;
  border: 2px solid rgba(255, 255, 255, 0.2) !important;
  box-shadow: 0 12px 30px rgba(37, 99, 235, 0.34), 0 0 0 5px rgba(20, 184, 166, 0.12) !important;
}
.triage-bot-btn:hover {
  box-shadow: 0 16px 38px rgba(37, 99, 235, 0.46), 0 0 0 7px rgba(103, 232, 249, 0.16) !important;
}
.triage-bot-popup {
  background: linear-gradient(180deg, #082f49 0%, #0f172a 44%, #111827 100%) !important;
  border-color: rgba(56, 189, 248, 0.34) !important;
  box-shadow: 0 22px 60px rgba(8, 47, 73, 0.5), 0 0 0 1px rgba(20, 184, 166, 0.1) !important;
}
.triage-bot-header {
  background: linear-gradient(135deg, #075985, #1d4ed8 54%, #0f766e) !important;
  border-bottom-color: rgba(103, 232, 249, 0.28) !important;
}
.triage-bot-status {
  color: #67e8f9 !important;
}
.triage-bot-status::before {
  background: #67e8f9 !important;
}
.bot-message .msg-avatar {
  background: linear-gradient(135deg, #0ea5e9, #14b8a6) !important;
  color: #ffffff;
}
.bot-message .msg-bubble {
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.18), rgba(20, 184, 166, 0.12)) !important;
  border: 1px solid rgba(56, 189, 248, 0.22);
  color: #e0f2fe !important;
}
.user-message .msg-bubble {
  background: linear-gradient(135deg, #7c3aed, #2563eb) !important;
}
.typing-indicator span {
  background: #67e8f9 !important;
}
.triage-bot-input {
  background: linear-gradient(180deg, rgba(8, 47, 73, 0.72), rgba(15, 23, 42, 0.96)) !important;
  border-top-color: rgba(56, 189, 248, 0.22) !important;
}
.bot-quick-reply,
.bot-symptom-tag {
  background: rgba(14, 165, 233, 0.1) !important;
  border-color: rgba(56, 189, 248, 0.32) !important;
  color: #bae6fd !important;
}
.bot-quick-reply:hover,
.bot-symptom-tag:hover {
  background: rgba(20, 184, 166, 0.16) !important;
  border-color: #2dd4bf !important;
  color: #ccfbf1 !important;
}
.bot-quick-reply.selected,
.bot-symptom-tag.active {
  background: linear-gradient(135deg, #0ea5e9, #14b8a6) !important;
  border-color: #67e8f9 !important;
  color: #ffffff !important;
}
.bot-input-row button,
.bot-primary-action,
.bot-result-card .result-action-btn {
  background: linear-gradient(135deg, #0ea5e9, #2563eb, #14b8a6) !important;
  color: #ffffff !important;
}
.bot-input-row input,
.bot-input-row select,
.bot-concern-controls select,
.bot-concern-controls textarea,
.bot-demographics-grid input,
.bot-demographics-grid select {
  border-color: rgba(56, 189, 248, 0.28) !important;
  background: rgba(8, 47, 73, 0.58) !important;
}
.bot-result-card {
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.16), rgba(15, 23, 42, 0.92)) !important;
  border-color: rgba(103, 232, 249, 0.28) !important;
}
[data-theme="light"] .triage-bot-popup {
  background: linear-gradient(180deg, #ffffff 0%, #eef7ff 100%) !important;
  border-color: rgba(14, 165, 233, 0.28) !important;
}
[data-theme="light"] .triage-bot-messages,
[data-theme="light"] .triage-bot-input {
  background: #f8fafc !important;
}
[data-theme="light"] .bot-message .msg-bubble {
  color: #0f172a !important;
  background: linear-gradient(135deg, #e0f2fe, #ccfbf1) !important;
}
[data-theme="light"] .bot-result-card h3,
[data-theme="light"] .bot-result-card p {
  color: #0f172a !important;
}

/* ── Responsive ── */
@media (max-width: 480px) {
  .triage-bot-popup {
    right: 12px;
    left: 12px;
    bottom: 90px;
    width: auto;
    max-height: 70vh;
  }
  #triageBotFloating {
    bottom: 16px;
    right: 16px;
  }
  .triage-bot-btn {
    width: 58px;
    height: 58px;
  }
  .doctor-avatar {
    width: 40px;
    height: 40px;
  }
}
.notif-bell {
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 8px;
  cursor: pointer;
  color: var(--text);
  display: flex;
  align-items: center;
  transition: border-color 0.2s;
}
.notif-bell:hover {
  border-color: var(--primary);
}
.notif-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: var(--danger, #ef4444);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  line-height: 1;
}

/* ── Lifecycle Timeline ── */
.milestone-item {
  position: relative;
  padding: 16px 16px 16px 48px;
  margin-left: 16px;
  border-left: 2px solid var(--border);
  transition: border-color 0.4s ease, opacity 0.4s ease;
}
.milestone-item:last-child { border-left-color: transparent; }
.milestone-item.completed { border-left-color: var(--primary); }
.milestone-item.completed + .milestone-item { border-left-color: var(--primary); }
.milestone-item.active { border-left-color: #7c3aed; }
.milestone-item.active + .milestone-item { border-left-color: #7c3aed; }
.milestone-item.active .milestone-icon {
  background: #7c3aed;
  border-color: #7c3aed;
  box-shadow: 0 0 12px rgba(124,58,237,0.4);
}
.milestone-icon {
  position: absolute;
  left: -14px;
  top: 14px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  background: var(--panel);
  border: 2px solid var(--border);
  transition: all 0.4s ease;
  z-index: 1;
}
.milestone-item.completed .milestone-icon {
  background: var(--primary);
  border-color: var(--primary);
  box-shadow: 0 0 12px rgba(16,185,129,0.4);
}
.milestone-item.overdue .milestone-icon {
  border-color: var(--warning);
  box-shadow: 0 0 12px rgba(245,158,11,0.3);
}
.milestone-item.mandatory .milestone-icon {
  border-color: var(--danger);
  box-shadow: 0 0 12px rgba(239,68,68,0.24);
}
.milestone-title {
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 2px;
}
.milestone-desc {
  font-size: 12px;
  color: var(--muted);
}
.milestone-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
  margin-top: 4px;
}
.milestone-badge.completed {
  background: rgba(16,185,129,0.15);
  color: var(--primary);
}
.milestone-badge.upcoming {
  background: rgba(148,163,184,0.15);
  color: var(--muted);
}
.milestone-badge.overdue {
  background: rgba(245,158,11,0.15);
  color: var(--warning);
}
.milestone-badge.mandatory {
  background: rgba(239,68,68,0.14);
  color: var(--danger);
}
.milestone-badge.profile {
  background: rgba(59,130,246,0.12);
  color: #2563eb;
  margin-left: 6px;
}
.psychosocial-required-status {
  margin-top: 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--danger);
}
.psychosocial-required-status[data-complete="true"] {
  color: var(--primary);
}
.psychosocial-milestone-markers {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(118px, 1fr));
  gap: 6px;
  margin-top: 10px;
}
.psychosocial-marker {
  min-width: 0;
  border: 1px solid rgba(239,68,68,0.35);
  background: rgba(239,68,68,0.06);
  color: var(--text);
  padding: 8px;
  border-radius: 6px;
  cursor: pointer;
  text-align: left;
}
.psychosocial-marker.completed {
  border-color: rgba(16,185,129,0.45);
  background: rgba(16,185,129,0.08);
}
.psychosocial-marker-code {
  display: block;
  color: var(--danger);
  font-size: 11px;
  font-weight: 700;
}
.psychosocial-marker.completed .psychosocial-marker-code {
  color: var(--primary);
}
.psychosocial-marker-title {
  display: block;
  margin-top: 3px;
  font-size: 11px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

/* Child development product */
.kids-panel {
  overflow: hidden;
}

.kids-hero {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  padding: 18px;
  border: 1px solid rgba(56,189,248,0.28);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(34,197,94,0.12), rgba(56,189,248,0.10)),
    var(--panel);
}

.kids-hero h2 {
  margin: 0 0 6px;
  font-size: 22px;
}

.kids-hero p {
  margin: 0;
  color: var(--muted);
  max-width: 680px;
}

.kids-hero-badges {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
  min-width: 160px;
}

.kids-badge {
  border: 1px solid transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 54px;
  height: 34px;
  padding: 0 10px;
  border-radius: 8px;
  color: #0f172a;
  font-size: 12px;
  font-weight: 800;
  background: #a7f3d0;
  cursor: pointer;
  animation: kidFloat 2.8s ease-in-out infinite;
}

.kids-badge:hover,
.kids-badge:focus-visible {
  border-color: var(--primary);
  outline: none;
  box-shadow: 0 0 0 3px rgba(16,185,129,0.22);
}

.kids-badge.active {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(16,185,129,0.28);
  transform: translateY(-1px);
}

.kids-badge:nth-child(2) {
  background: #bae6fd;
  animation-delay: 0.2s;
}

.kids-badge:nth-child(3) {
  background: #fde68a;
  animation-delay: 0.4s;
}

.kids-note {
  margin: 12px 0;
  padding: 10px 12px;
  border: 1px solid rgba(245,158,11,0.28);
  border-radius: 8px;
  background: rgba(245,158,11,0.08);
  color: var(--text);
  font-size: 12px;
}

.kids-child-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 12px;
}

.kids-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
  padding: 14px;
  animation: kidPop 0.35s ease both;
}

.kids-card-head {
  display: flex;
  gap: 10px;
  align-items: center;
}

.kids-card-head h3 {
  margin: 0;
  font-size: 16px;
}

.kids-card-head p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.kids-avatar {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #0f172a;
  background: linear-gradient(135deg, #86efac, #7dd3fc);
  font-weight: 900;
  animation: kidWiggle 4s ease-in-out infinite;
}

.kids-progress {
  height: 8px;
  border-radius: 8px;
  overflow: hidden;
  background: rgba(148,163,184,0.18);
  margin: 12px 0 4px;
}

.kids-progress span {
  display: block;
  height: 100%;
  border-radius: 8px;
  background: linear-gradient(90deg, #22c55e, #38bdf8, #f59e0b);
  transition: width 0.5s ease;
}

.kids-progress-label {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 12px;
}

.kids-focus-summary {
  display: grid;
  gap: 3px;
  margin: 0 0 12px;
  padding: 10px;
  border: 1px solid rgba(56,189,248,0.25);
  border-radius: 8px;
  background: rgba(56,189,248,0.07);
}

.kids-focus-summary strong {
  font-size: 13px;
}

.kids-focus-summary span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.kids-subgrid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.kids-subgrid h4 {
  margin: 0 0 8px;
  font-size: 13px;
}

.kid-milestone,
.kid-vaccine-row {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px;
  margin-bottom: 8px;
  background: rgba(15,23,42,0.18);
}

.kid-milestone.complete {
  border-color: rgba(34,197,94,0.4);
  background: rgba(34,197,94,0.08);
}

.kid-milestone.next,
.kid-vaccine-row.soon {
  border-color: rgba(56,189,248,0.4);
  background: rgba(56,189,248,0.08);
}

.kid-vaccine-row.due {
  border-color: rgba(245,158,11,0.45);
  background: rgba(245,158,11,0.10);
}

.kid-milestone strong,
.kid-vaccine-row strong {
  display: block;
  font-size: 12px;
}

.kid-milestone span,
.kid-vaccine-row span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  margin-top: 3px;
}

.kid-vaccine-row em {
  display: inline-block;
  margin-top: 6px;
  color: var(--primary);
  font-size: 11px;
  font-style: normal;
  font-weight: 700;
}

.kids-next {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  margin-top: 12px;
  padding: 10px;
  border-radius: 8px;
  background: rgba(34,197,94,0.08);
  font-size: 12px;
}

.kids-next span {
  color: var(--muted);
  text-align: right;
}

.kids-action {
  margin-top: 12px;
}

.kids-empty {
  border: 1px dashed var(--border);
  border-radius: 8px;
  padding: 18px;
  background: rgba(148,163,184,0.06);
}

.kids-empty p {
  color: var(--muted);
}

.kid-drive-alert {
  border: 1px solid rgba(56,189,248,0.35);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 10px;
  background: rgba(56,189,248,0.08);
}

.kid-drive-alert.urgent {
  border-color: rgba(245,158,11,0.45);
  background: rgba(245,158,11,0.10);
}

.kid-drive-alert p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

@keyframes milestoneSlideIn {
  from { opacity: 0; transform: translateX(-16px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes kidFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

@keyframes kidWiggle {
  0%, 88%, 100% { transform: rotate(0deg); }
  91% { transform: rotate(-4deg); }
  94% { transform: rotate(4deg); }
}

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

@keyframes kidColorRun {
  0%, 100% { transform: translateX(-12%); opacity: 0.65; }
  50% { transform: translateX(12%); opacity: 1; }
}
.milestone-item {
  animation: milestoneSlideIn 0.4s ease forwards;
  opacity: 0;
}
.milestone-item:nth-child(1) { animation-delay: 0.05s; }
.milestone-item:nth-child(2) { animation-delay: 0.1s; }
.milestone-item:nth-child(3) { animation-delay: 0.15s; }
.milestone-item:nth-child(4) { animation-delay: 0.2s; }
.milestone-item:nth-child(5) { animation-delay: 0.25s; }
.milestone-item:nth-child(6) { animation-delay: 0.3s; }
.milestone-item:nth-child(7) { animation-delay: 0.35s; }
.milestone-item:nth-child(8) { animation-delay: 0.4s; }
.milestone-item:nth-child(9) { animation-delay: 0.45s; }
.milestone-item:nth-child(10) { animation-delay: 0.5s; }
.milestone-item:nth-child(11) { animation-delay: 0.55s; }
.milestone-item:nth-child(12) { animation-delay: 0.6s; }
.milestone-item:nth-child(13) { animation-delay: 0.65s; }
.milestone-item:nth-child(14) { animation-delay: 0.7s; }
.milestone-item:nth-child(15) { animation-delay: 0.75s; }

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
  .triage-bot-btn,
  .pulse-ring,
  .triage-bot-popup,
  .bot-message,
  .user-message,
  .typing-indicator span,
  .triage-bot-status::before,
  .kids-product-card::after,
  .kids-badge,
  .kids-avatar,
  .kids-card {
    animation: none !important;
  }
  .triage-bot-popup {
    animation: none !important;
  }
}

@media (max-width: 760px) {
  .kids-hero,
  .kids-next {
    flex-direction: column;
    align-items: flex-start;
  }

  .kids-hero-badges {
    justify-content: flex-start;
  }

  .kids-subgrid {
    grid-template-columns: 1fr;
  }

  .kids-next span {
    text-align: left;
  }
}

.profile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  padding: 8px 0;
}

.profile-section-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 6px 0 14px;
}

.profile-section-tabs button {
  min-height: 34px;
  padding: 7px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--panel-2);
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.btn-secondary.danger {
  border-color: rgba(239, 68, 68, .55);
  color: var(--danger);
}

.btn-secondary.danger:hover {
  background: rgba(239, 68, 68, .12);
}

.profile-section-tabs button:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.profile-health-snapshot {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}

.profile-health-metric {
  min-height: 76px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
}

.profile-health-metric strong {
  display: block;
  color: var(--text);
  font-size: 17px;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.profile-health-metric span,
.profile-health-metric small {
  display: block;
  color: var(--muted);
  font-size: 11px;
  margin-top: 3px;
}

.profile-health-metric.urgent {
  border-color: rgba(220,38,38,0.55);
  background: rgba(220,38,38,0.08);
}

.profile-latest-triage-callout {
  display: grid;
  gap: 5px;
  padding: 10px 12px;
  margin: 4px 0 10px;
  border: 1px solid rgba(37,99,235,0.35);
  border-radius: 10px;
  background: rgba(37,99,235,0.08);
}

.profile-latest-triage-callout div {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
}

.profile-latest-triage-callout span,
.profile-latest-triage-callout p {
  color: var(--muted);
}

.profile-latest-triage-callout p {
  margin: 0;
  font-size: 12px;
  line-height: 1.45;
}

.profile-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}
.profile-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 600;
  border-bottom: 1px solid var(--border);
  background: var(--panel-2);
}
.profile-card-body {
  padding: 12px 16px;
}
.profile-photo-summary {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0 14px;
  margin-bottom: 4px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.profile-photo-img,
.profile-photo-placeholder {
  width: 68px;
  height: 68px;
  border-radius: 18px;
  flex: 0 0 68px;
  border: 2px solid color-mix(in srgb, var(--primary) 38%, transparent);
  box-shadow: 0 12px 28px rgba(2,6,23,0.28);
  object-fit: cover;
}
.profile-photo-placeholder {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 800;
  letter-spacing: 0;
  background:
    radial-gradient(circle at 30% 25%, rgba(255,255,255,0.28), transparent 32%),
    linear-gradient(135deg, #2563eb, #06b6d4);
}
.profile-photo-summary strong {
  display: block;
  color: var(--text);
  font-size: 14px;
}
.profile-photo-summary span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-top: 3px;
}
.profile-field {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  font-size: 13px;
}
.profile-field:last-child {
  border-bottom: none;
}
.profile-field span {
  color: var(--muted);
}
.profile-field strong {
  color: var(--text);
  text-align: right;
  max-width: 60%;
  word-break: break-word;
}
.risk-low { color: var(--primary) !important; }
.risk-medium { color: var(--warning) !important; }
.risk-high { color: var(--danger) !important; }

.profile-card-personal { border-left: 3px solid #2563eb; }
.profile-card-address { border-left: 3px solid #16a34a; }
.profile-card-health { border-left: 3px solid #dc2626; }
.profile-card-household { border-left: 3px solid #ca8a04; }
.profile-card-devices { border-left: 3px solid #9333ea; }
.profile-card-tree { border-left: 3px solid #6366f1; grid-column: 1 / -1; min-height: 400px; overflow: hidden; }
.profile-card-map { border-left: 3px solid #0891b2; grid-column: 1 / -1; }
.profile-card-environment { border-left: 3px solid #65a30d; grid-column: 1 / -1; }
.profile-card-learning { border-left: 3px solid #8b5cf6; grid-column: 1 / -1; }
.profile-card-achievements { border-left: 3px solid #f59e0b; grid-column: 1 / -1; }
.profile-card-audit { border-left: 3px solid #f59e0b; grid-column: 1 / -1; }
.profile-card-socioeconomic { border-left: 3px solid #06b6d4; }
.profile-card-psychosocial { border-left: 3px solid #8b5cf6; }
.profile-card-psychosocial { border-left: 3px solid #8b5cf6; }

#profileTreeSvg {
  display: block;
  min-height: 500px;
  max-width: 100%;
  background:
    radial-gradient(circle at 50% 50%, rgba(37, 99, 235, 0.08), transparent 34%),
    linear-gradient(180deg, rgba(15, 23, 42, 0.08), transparent);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.08);
}

#profileTreeDetails {
  display: grid;
  gap: 4px;
}

#profileTreeDetails .profile-field strong {
  max-width: 68%;
}

.profile-tree-controls {
  display: grid;
  gap: 8px;
  margin-bottom: 10px;
}

.profile-tree-layer-title {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--text);
  font-size: 12px;
}

.profile-tree-layer-title span {
  color: var(--muted);
}

.profile-tree-zoom-controls {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  justify-self: start;
}

.profile-tree-zoom-controls button {
  min-width: 34px;
  min-height: 30px;
  padding: 5px 9px;
}

.profile-tree-zoom-controls span {
  min-width: 48px;
  color: var(--text);
  font-size: 12px;
  font-weight: 800;
  text-align: center;
}

.profile-tree-layer-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.profile-tree-layer-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  padding: 5px 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--panel-2);
  color: var(--text);
  font-size: 11px;
  cursor: pointer;
}

.profile-tree-layer-toggle input {
  width: 13px;
  height: 13px;
  margin: 0;
}

.profile-tree-layer-toggle span {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  display: inline-block;
}

[data-theme="light"] #profileTreeSvg {
  background:
    radial-gradient(circle at 50% 50%, rgba(37, 99, 235, 0.08), transparent 34%),
    linear-gradient(180deg, rgba(241, 245, 249, 0.9), rgba(255, 255, 255, 0.7));
}

@media (max-width: 760px) {
  #profileTreeSvg {
    min-height: 420px;
  }

  .profile-tree-layer-title {
    align-items: flex-start;
    flex-direction: column;
  }
}

.profile-map-layer-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  width: 100%;
  padding: 4px 0 2px;
}

.profile-map-layer-toggle {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 26px;
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--panel-2);
  color: var(--text);
  font-size: 11px;
  cursor: pointer;
  user-select: none;
}

.profile-map-layer-toggle input {
  width: 13px;
  height: 13px;
  margin: 0;
}

.profile-map-layer-toggle span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

[data-theme="light"] .risk-low { color: #15803d !important; }
[data-theme="light"] .risk-medium { color: #b45309 !important; }

[data-theme="light"] {
  --bg: #f0f4f8;
  --panel: #ffffff;
  --panel-2: #f8fafc;
  --border: #dce2ed;
  --text: #0f172a;
  --muted: #64748b;
}

[data-theme="light"] .card,
[data-theme="light"] .profile-card,
[data-theme="light"] .panel {
  box-shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  transition: box-shadow 0.2s, transform 0.2s;
}
[data-theme="light"] .card:hover,
[data-theme="light"] .profile-card:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.08), 0 2px 4px rgba(0,0,0,0.04);
  transform: translateY(-1px);
}
[data-theme="light"] .btn-secondary {
  background: #ffffff;
  border-color: #d0d9e6;
  box-shadow: 0 1px 2px rgba(0,0,0,0.03);
}
[data-theme="light"] .btn-secondary:hover {
  background: #f8fafc;
  border-color: #94a3b8;
  box-shadow: 0 2px 6px rgba(0,0,0,0.06);
}
[data-theme="light"] .btn-primary {
  box-shadow: 0 2px 6px rgba(16,185,129,0.25);
}
[data-theme="light"] .btn-primary:hover {
  box-shadow: 0 4px 12px rgba(16,185,129,0.35);
  transform: translateY(-1px);
}
[data-theme="light"] .sidebar {
  background: #ffffff;
  border-right: 1px solid var(--border);
  box-shadow: 1px 0 3px rgba(0,0,0,0.04);
}
[data-theme="light"] .nav-item:hover {
  background: #f1f5f9;
}
[data-theme="light"] .nav-item.active {
  background: #ecfdf5;
  border-left: 3px solid var(--primary);
}
[data-theme="light"] .landing-card,
[data-theme="light"] .dash-card,
[data-theme="light"] .catalogue-card {
  background: #ffffff;
  border: 1px solid var(--border);
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
  transition: box-shadow 0.2s, transform 0.2s;
}
[data-theme="light"] .landing-card:hover,
[data-theme="light"] .dash-card:hover,
[data-theme="light"] .catalogue-card:hover {
  box-shadow: 0 6px 16px rgba(0,0,0,0.08);
  transform: translateY(-2px);
}
[data-theme="light"] .profile-card-header {
  border-bottom: 1px solid var(--border);
  background: #f8fafc;
}
[data-theme="light"] input,
[data-theme="light"] select,
[data-theme="light"] textarea {
  background: #ffffff;
  border: 1px solid #d0d9e6;
}
[data-theme="light"] input:focus,
[data-theme="light"] select:focus,
[data-theme="light"] textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(16,185,129,0.1);
}

[data-theme="dark"] .btn-secondary {
  background: #1e293b;
  border-color: #475569;
}
[data-theme="dark"] .btn-secondary:hover {
  background: #334155;
  border-color: #64748b;
}
[data-theme="dark"] .btn-warning {
  background: rgba(245,158,11,0.1);
}
[data-theme="dark"] .btn-warning:hover {
  background: rgba(245,158,11,0.2);
}

.slot-btn {
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card-bg, var(--panel));
  cursor: pointer;
  font-size: 13px;
  transition: all 0.15s ease;
}
.slot-btn:hover {
  border-color: var(--primary);
  background: rgba(16, 185, 129, 0.1);
}

.doctor-card:hover {
  border-color: var(--primary) !important;
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.15);
}

/* Patient search results */
.result-detail-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  margin-bottom: 8px;
}
.result-detail-card strong {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.result-detail-card p {
  margin: 0;
  font-size: 14px;
  font-weight: 500;
}

.star-rating {
  cursor: pointer;
  transition: transform 0.15s ease;
  color: var(--warning);
  user-select: none;
}
.star-rating:hover {
  transform: scale(1.2);
}
.star-rating:hover ~ .star-rating {
  transform: none;
}

/* ── Landing Page ── */
#landing { max-width: 900px; margin: 0 auto; padding: 40px 20px; }
.landing-hero { text-align: center; grid-column: 1 / -1; }
.landing-hero h1 { font-size: 48px; font-weight: 800; background: linear-gradient(135deg,var(--primary),var(--primary-2)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; margin: 0; }
.landing-tagline { font-size: 18px; color: var(--muted); margin: 12px 0 8px; letter-spacing: 2px; text-transform: uppercase; }
.landing-subtitle { font-size: 16px; color: var(--muted); max-width: 640px; margin: 0 auto 32px; line-height: 1.6; }
.landing-cta { margin: 24px 0; }
.landing-cta .btn-lg { padding: 14px 36px; font-size: 18px; border-radius: 12px; }
/* Landing banner with hero photo */
.landing-banner {
  position: relative;
  border-radius: 16px;
  max-width: 900px;
  margin: 0 auto;
  min-height: 320px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.landing-banner-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 16px;
}

.landing-banner-overlay {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px 24px;
  background: linear-gradient(135deg, rgba(7,16,23,0.85) 0%, rgba(7,16,23,0.6) 100%);
  border-radius: 16px;
  width: 100%;
  align-self: stretch;
}

.landing-stats { display: flex; justify-content: center; gap: 24px; margin: 32px 0 48px; flex-wrap: wrap; }
.landing-stats .stat-card { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 20px 32px; text-align: center; min-width: 160px; }
.landing-stats .stat-value { font-size: 28px; font-weight: 700; color: var(--primary); display: block; }
.landing-stats .stat-label { font-size: 13px; color: var(--muted); margin-top: 4px; }
.landing-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; margin-top: 24px; }
@media (max-width: 640px) {
  .landing-hero h1 { font-size: 32px; }
  .landing-stats { flex-direction: column; align-items: center; }
  .landing-banner { min-height: 240px; }
  .landing-banner-overlay { padding: 24px 16px; }
  .landing-banner-overlay p.landing-subtitle { font-size: 14px; }
}

/* ── Portal CTA ── */
.portal-cta {
  text-align: center;
  padding: 32px 24px;
  margin-bottom: 24px;
  background: linear-gradient(135deg, var(--primary)22, var(--primary-2)22);
  border: 1px solid var(--border);
  border-radius: 16px;
}

/* What the platform is, on the launcher itself: a visitor arriving at #portals is choosing a
   portal before they know what the portals are for. Colour does work here - each capability keeps
   one accent, so the six read as a set of things rather than a paragraph of chips. */
.portal-about {
  position: relative;
  margin: 0 0 20px;
  padding: 22px 22px 20px 26px;
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  background:
    radial-gradient(120% 140% at 0% 0%, rgba(16, 185, 129, 0.12) 0%, rgba(16, 185, 129, 0) 58%),
    var(--panel-2);
  background:
    radial-gradient(120% 140% at 0% 0%, color-mix(in srgb, var(--primary) 12%, transparent) 0%, transparent 58%),
    var(--panel-2);
}

/* the accent bar stays visible even when the gradient is clipped on a narrow screen */
.portal-about::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: linear-gradient(180deg, var(--primary), var(--primary-2));
}

.portal-about-eyebrow {
  margin: 0 0 10px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--primary);
}

.portal-about-lead {
  margin: 0 0 16px;
  max-width: 82ch;
  font-size: 15.5px;
  line-height: 1.65;
  color: var(--text);
}

.portal-about-lead strong {
  font-weight: 650;
  color: var(--primary);
}

.portal-about-points {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(215px, 1fr));
  gap: 10px;
  margin: 0 0 18px;
  padding: 0;
  list-style: none;
}

.portal-about-point {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--text);
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-color: color-mix(in srgb, var(--accent, var(--primary)) 32%, transparent);
  background: rgba(255, 255, 255, 0.03);
  background: color-mix(in srgb, var(--accent, var(--primary)) 10%, transparent);
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.portal-about-point:hover {
  transform: translateY(-1px);
  border-color: rgba(148, 163, 184, 0.4);
  border-color: color-mix(in srgb, var(--accent, var(--primary)) 55%, transparent);
}

/* lucide replaces <i data-lucide> with an <svg class="lucide">, and the shared health-theme.css
   sizes that svg with `svg.lucide { width: 1.125rem }` - one class, same specificity as a plain
   `.portal-about-point > svg`. It also loads after this file, so the tie went to the theme and the
   "tile" collapsed to an 18px box with 7px of padding around a 4px glyph. Two classes win, and the
   tile is 32px so the theme's 18px glyph sits inside it undistorted. */
.portal-about-points .portal-about-point > svg.lucide {
  width: 32px;
  height: 32px;
  padding: 7px;
  box-sizing: border-box;
  border-radius: 9px;
  color: var(--accent, var(--primary));
  background: rgba(255, 255, 255, 0.06);
  background: color-mix(in srgb, var(--accent, var(--primary)) 20%, transparent);
  stroke-width: 2.1;
}

.portal-about-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  border-radius: 999px;
  border: 1px solid rgba(16, 185, 129, 0.45);
  border-color: color-mix(in srgb, var(--primary) 45%, transparent);
  background: rgba(16, 185, 129, 0.12);
  background: color-mix(in srgb, var(--primary) 12%, transparent);
  color: var(--primary);
  font-size: 13.5px;
  font-weight: 600;
  text-decoration: none;
}

.portal-about-link:hover,
.portal-about-link:focus-visible {
  background: rgba(16, 185, 129, 0.22);
  background: color-mix(in srgb, var(--primary) 22%, transparent);
  border-color: color-mix(in srgb, var(--primary) 70%, transparent);
  text-decoration: none;
}

/* on the light theme --primary is a teal that is too pale for text; darken the same hue rather
   than swapping in an unrelated green */
[data-theme="light"] .portal-about-lead strong,
[data-theme="light"] .portal-about-link {
  color: #047857;
  color: color-mix(in srgb, var(--primary) 70%, #0f172a);
}

[data-theme="light"] .portal-about-point {
  background: color-mix(in srgb, var(--accent, var(--primary)) 8%, #ffffff);
  border-color: color-mix(in srgb, var(--accent, var(--primary)) 26%, transparent);
}

@media (max-width: 640px) {
  .portal-about {
    padding: 16px 14px 14px 18px;
  }

  .portal-about-lead {
    font-size: 14.5px;
  }

  .portal-about-points {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  .portal-about-point {
    transition: none;
  }

  .portal-about-point:hover {
    transform: none;
  }
}

.portal-cta h3 {
  font-size: 24px;
  font-weight: 700;
  margin: 0 0 8px;
}

.portal-cta p {
  color: var(--muted);
  margin: 0 0 16px;
  font-size: 14px;
}

.portal-cta-buttons {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

.portal-cta-buttons .btn {
  padding: 12px 28px;
  font-size: 15px;
  border-radius: 10px;
  text-decoration: none;
  font-weight: 600;
}

.portal-access-guide {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 18px;
  margin: 16px 0;
  padding: 16px 18px;
  border: 1px solid color-mix(in srgb, var(--primary) 28%, var(--border));
  border-left: 4px solid var(--primary);
  border-radius: 8px;
  background: var(--panel);
  box-sizing: border-box;
  max-width: 100%;
  overflow: hidden;
}

.portal-access-guide strong {
  display: block;
  color: var(--text);
  font-size: 15px;
}

.portal-access-guide p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
  word-wrap: break-word;
  overflow-wrap: anywhere;
}

.portal-access-actions {
  display: flex;
  flex: 1 1 100%;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: flex-start;
  min-width: 0;
}

.portal-access-actions .btn {
  text-decoration: none;
  white-space: normal;
  word-break: break-word;
  max-width: 100%;
  box-sizing: border-box;
}

@media (max-width: 640px) {
  .portal-access-guide {
  align-items: flex-start;
  flex-direction: column;
  }

  .portal-access-actions {
  width: 100%;
  }

  .portal-access-actions .btn {
  flex: 1;
  text-align: center;
  }
}

/* Portal Tiles */
.portal-tile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}

.portal-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 24px 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel);
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}

.portal-tile::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 0%, rgba(255,255,255,0.08), transparent 42%);
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
}

.portal-tile:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(37, 99, 235, 0.15);
}

.portal-tile:hover::before {
  opacity: 1;
}

.portal-tile-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  margin-bottom: 10px;
  border-radius: 16px;
  color: #fff;
  background:
    radial-gradient(circle at 30% 24%, rgba(255,255,255,0.38), transparent 34%),
    linear-gradient(135deg, var(--tile-accent, var(--primary)), var(--tile-accent-2, #06b6d4));
  border: 1px solid rgba(255,255,255,0.16);
  box-shadow: 0 10px 22px color-mix(in srgb, var(--tile-accent, var(--primary)) 28%, transparent);
  position: relative;
  isolation: isolate;
}

.portal-tile-icon::after {
  content: "";
  position: absolute;
  inset: 1px;
  border-radius: 15px;
  background: linear-gradient(145deg, rgba(255,255,255,0.22), rgba(255,255,255,0));
  pointer-events: none;
  z-index: -1;
}

.portal-tile-icon svg {
  width: 30px;
  height: 30px;
  stroke-width: 2.4;
  filter: drop-shadow(0 2px 3px rgba(15, 23, 42, 0.25));
}

.portal-tile[data-portal="citizen"] { --tile-accent: #2563eb; --tile-accent-2: #38bdf8; }
.portal-tile[data-portal="home_health"] { --tile-accent: #16a34a; --tile-accent-2: #84cc16; }
.portal-tile[data-portal="accessibility"] { --tile-accent: #7c3aed; --tile-accent-2: #c084fc; }
.portal-tile[data-portal="admin"] { --tile-accent: #475569; --tile-accent-2: #94a3b8; }
.portal-tile[data-portal="chw"] { --tile-accent: #0d9488; --tile-accent-2: #2dd4bf; }
.portal-tile[data-portal="doctor"] { --tile-accent: #dc2626; --tile-accent-2: #fb7185; }
.portal-tile[data-portal="nurse"] { --tile-accent: #0891b2; --tile-accent-2: #22d3ee; }
.portal-tile[data-portal="moh"] { --tile-accent: #9333ea; --tile-accent-2: #6366f1; }
.portal-tile[data-portal="donor"] { --tile-accent: #ca8a04; --tile-accent-2: #facc15; }
.portal-tile[data-portal="lab"] { --tile-accent: #4f46e5; --tile-accent-2: #06b6d4; }
.portal-tile[data-portal="pharmacy"] { --tile-accent: #059669; --tile-accent-2: #14b8a6; }
.portal-tile[data-portal="nhi"] { --tile-accent: #0284c7; --tile-accent-2: #0ea5e9; }
.portal-tile[data-portal="developer"] { --tile-accent: #f97316; --tile-accent-2: #f59e0b; }
.portal-tile[data-portal="tourism"] { --tile-accent: #db2777; --tile-accent-2: #f472b6; }
.portal-tile[data-portal="workforce"] { --tile-accent: #64748b; --tile-accent-2: #0f766e; }
.portal-tile[data-portal="mobile"] { --tile-accent: #10b981; --tile-accent-2: #3b82f6; }

.oauth-origin-hint {
  margin: 8px 0 0;
  font-size: 11px;
  line-height: 1.4;
  color: var(--muted);
  word-break: break-all;
}

.portal-tile h3 {
  font-size: 15px;
  font-weight: 600;
  margin: 0 0 6px;
}

.portal-tile p {
  font-size: 12px;
  color: var(--muted);
  margin: 0;
  line-height: 1.4;
}

/* Tiles are buttons: they must be operable by keyboard, and a button resets its font and
   text alignment unless told otherwise. */
button.portal-tile {
  font: inherit;
  color: inherit;
  width: 100%;
  text-align: center;
}

.portal-tile:focus-visible {
  outline: 3px solid var(--primary);
  outline-offset: 3px;
}

.portal-tile-name {
  display: block;
  font-size: 15px;
  font-weight: 600;
  margin: 0 0 6px;
}

.portal-tile-desc {
  display: block;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.4;
}

/* Groups give the launcher a hierarchy: a citizen sees one group open, an administrator can
   open the rest. Each audience carries its own accent so the page reads before it is read. */
.portal-group {
  grid-column: 1 / -1;
  display: block;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--panel);
  overflow: hidden;
}

.portal-group[data-audience="citizen"] { --group-accent: #2563eb; }
.portal-group[data-audience="provider"] { --group-accent: #0d9488; }
.portal-group[data-audience="operations"] { --group-accent: #64748b; }
.portal-group[data-audience="network"] { --group-accent: #7c3aed; }

.portal-group-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  cursor: pointer;
  list-style: none;
  border-left: 3px solid var(--group-accent, var(--primary));
  min-height: 52px;
}

.portal-group-summary::-webkit-details-marker { display: none; }

.portal-group-summary:focus-visible {
  outline: 3px solid var(--group-accent, var(--primary));
  outline-offset: -3px;
}

.portal-group-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--group-accent, var(--primary));
  flex: 0 0 auto;
}

.portal-group-title {
  margin: 0;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: none;
  color: var(--text);
}

.portal-group-hint {
  color: var(--muted);
  font-size: 12.5px;
}

.portal-group-summary::after {
  content: "▾";
  margin-left: auto;
  color: var(--muted);
  font-size: 12px;
  transition: transform 0.18s ease;
}

.portal-group[open] > .portal-group-summary::after {
  transform: rotate(180deg);
}

.portal-group-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
  padding: 4px 16px 16px;
}

.portal-group[open] > .portal-group-summary {
  border-bottom: 1px solid var(--border);
  margin-bottom: 12px;
}

/* The sign-in section: the answer to "where is the CHW / MOH / donors / API portal?".
   It used to be one de-emphasised text link that expanded a list. */
.portal-signin-section {
  margin-top: 24px;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface, var(--panel));
  transition: box-shadow 0.3s ease, border-color 0.3s ease;
}

.portal-signin-section.is-highlighted {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 18%, transparent);
}

.portal-signin-section h3 {
  margin: 0 0 6px;
  font-size: 17px;
}

.portal-signin-intro {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 13px;
}

.portal-signin-grid {
  display: grid;
  gap: 16px;
}

.portal-signin-group h4 {
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.portal-signin-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.portal-signin-link {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel);
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
}

.portal-signin-link:hover {
  border-color: var(--primary);
}

.portal-signin-link[data-audience="provider"] { border-left: 3px solid #0d9488; }
.portal-signin-link[data-audience="operations"] { border-left: 3px solid #64748b; }
.portal-signin-link[data-audience="network"] { border-left: 3px solid #7c3aed; }

.portal-signin-link:focus-visible {
  outline: 3px solid var(--primary);
  outline-offset: 2px;
}

.portal-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin: 18px 0 14px;
}

/* Sticky so the search and "Sign in" stay reachable on a page that is taller than a phone. */
.portal-toolbar-sticky {
  position: sticky;
  top: 0;
  z-index: 5;
  padding: 10px 0;
  background: color-mix(in srgb, var(--bg, var(--panel)) 92%, transparent);
  backdrop-filter: blur(6px);
}

.portal-toolbar-signin {
  min-height: 44px;
  padding: 0 20px;
  white-space: nowrap;
}

.portal-search {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1 1 260px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel);
}

.portal-search:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 22%, transparent);
}

.portal-search input {
  width: 100%;
  min-height: 24px;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  outline: none;
}

.portal-search-icon {
  color: var(--muted);
  font-size: 15px;
}

/* Label text a screen reader reads and a sighted user does not need. */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.portal-no-results {
  text-align: center;
  color: var(--muted);
  padding: 22px 12px;
  margin: 0;
}

/* "Where am I?" answered before the grid. */
.portal-my-portal {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 0 0 20px;
  padding: 18px 20px;
  border: 1px solid color-mix(in srgb, var(--primary) 45%, var(--border));
  border-radius: 14px;
  background: color-mix(in srgb, var(--primary) 9%, var(--panel));
}

.portal-my-portal h3 {
  margin: 0 0 4px;
  font-size: 18px;
}

.portal-my-portal p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.portal-my-portal .btn {
  padding: 12px 24px;
  min-height: 44px;
}

/* My Health Insights: the citizen's own numbers, with the gaps they can act on. */
.insight-headline {
  margin: 0 0 14px;
  font-size: 14px;
  line-height: 1.5;
}

.insight-heading {
  margin: 18px 0 10px;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.insight-gap {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  margin-bottom: 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2, var(--panel));
  font-size: 13px;
}

.insight-gap .btn-secondary {
  min-height: 40px;
  padding: 0 16px;
  flex: 0 0 auto;
}

/* Figures: a ring for a share, a bar for a risk, a sparkline for a trend. Inline SVG so the
   citizen portal does not take on a charting dependency for three numbers. */
.insight-figure {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel);
}

.insight-ring {
  width: 64px;
  height: 64px;
}

.insight-ring-track {
  fill: none;
  stroke: var(--border);
  stroke-width: 6;
}

.insight-ring-value {
  fill: none;
  stroke-width: 6;
  stroke-linecap: round;
  transform: rotate(-90deg);
  transform-origin: 32px 32px;
  transition: stroke-dasharray 0.6s ease;
}

.insight-ring-text {
  fill: var(--text);
  font-size: 15px;
  font-weight: 800;
}

.insight-figure-bar {
  min-width: 140px;
}

.insight-bar {
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: var(--border);
  overflow: hidden;
}

.insight-bar span {
  display: block;
  height: 100%;
  border-radius: 999px;
}

.insight-bar-value {
  font-size: 16px;
  font-weight: 800;
}

.insight-figure-empty {
  font-size: 24px;
  color: var(--muted);
}

.insight-trend {
  margin: 0 0 12px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel);
}

.insight-trend figcaption {
  font-size: 12.5px;
  color: var(--muted);
  margin-bottom: 6px;
}

.insight-trend figcaption strong {
  color: var(--text);
  font-size: 13px;
}

.insight-trend svg {
  width: 100%;
  height: 56px;
  display: block;
}

.insight-trend-dir {
  font-weight: 800;
}

.insight-trend-up {
  color: #0d9488;
}

.insight-trend-down {
  color: #dc2626;
}

.insight-trend-flat {
  color: var(--muted);
}

.telehealth-provider-picker {
  margin-top: 10px;
}

.telehealth-picker-label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.platform-select-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.platform-button-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.platform-choice {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 70px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel);
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: border-color .2s ease, box-shadow .2s ease, transform .2s ease;
}

.platform-choice:hover,
.platform-choice.active {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .14);
  transform: translateY(-1px);
}

.platform-choice strong,
.platform-choice small {
  display: block;
}

.platform-choice strong {
  font-size: 13px;
}

.platform-choice small {
  color: var(--muted);
  font-size: 11px;
  margin-top: 2px;
}

.platform-logo {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  color: #fff;
  font-weight: 800;
  font-size: 13px;
}

.platform-logo-jitsi {
  background: linear-gradient(135deg, #0ea5e9, #2563eb);
}

.platform-logo-webrtc {
  background: linear-gradient(135deg, #10b981, #0f766e);
  font-size: 11px;
}

.platform-logo-teams {
  grid-template-columns: repeat(2, 1fr);
  gap: 2px;
  padding: 5px;
  background: #fff;
  border: 1px solid var(--border);
}

.platform-logo-teams i {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 2px;
}

.platform-logo-teams i:nth-child(1) { background: #f25022; }
.platform-logo-teams i:nth-child(2) { background: #7fba00; }
.platform-logo-teams i:nth-child(3) { background: #00a4ef; }
.platform-logo-teams i:nth-child(4) { background: #ffb900; }

@media (max-width: 760px) {
  .platform-button-grid {
    grid-template-columns: 1fr;
  }
}

.visit-complete-action.visit-complete-pulse {
  border-color: var(--success, #16a34a);
  color: var(--success, #16a34a);
  animation: visitCompletePulse 1.25s ease-in-out infinite;
}

@keyframes visitCompletePulse {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(22, 163, 74, .35);
  }
  50% {
    box-shadow: 0 0 0 8px rgba(22, 163, 74, 0);
  }
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes trainPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(124, 58, 237, 0.5); transform: scale(1); }
  50% { box-shadow: 0 0 0 12px rgba(124, 58, 237, 0); transform: scale(1.05); }
}

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

/* ── Education Library ── */
.edu-toolbar { display:flex; gap:10px; margin-bottom:20px; flex-wrap:wrap; align-items:center; }
.edu-search-wrap { position:relative; flex:2; min-width:200px; }
.edu-search { width:100%; padding:10px 14px 10px 38px; border-radius:10px; border:1px solid var(--border,#334155); background:var(--input-bg,#0f172a); color:var(--text,#e2e8f0); font-size:14px; outline:none; transition:border-color 0.15s; }
.edu-search:focus { border-color:var(--primary,#0d9488); }
.edu-search-icon { position:absolute; left:12px; top:50%; transform:translateY(-50%); width:18px; height:18px; color:var(--muted,#64748b); pointer-events:none; }
.edu-select { padding:10px 14px; border-radius:10px; border:1px solid var(--border,#334155); background:var(--input-bg,#0f172a); color:var(--text,#e2e8f0); font-size:13px; cursor:pointer; outline:none; min-width:150px; flex:1; }
.edu-select:focus { border-color:var(--primary,#0d9488); }
.edu-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(300px,1fr)); gap:16px; }
.edu-empty { grid-column:1/-1; text-align:center; padding:60px 20px; color:var(--muted,#64748b); }
.edu-empty p { margin-top:12px; font-size:14px; }

.edu-card { background:var(--panel,#1e293b); border:1px solid var(--border,#334155); border-radius:12px; padding:18px; cursor:pointer; transition:border-color 0.15s, transform 0.15s, box-shadow 0.15s; display:flex; flex-direction:column; gap:8px; animation:eduSlideUp 0.3s ease forwards; }
.edu-card:hover { border-color:var(--primary,#0d9488); transform:translateY(-2px); box-shadow:0 6px 20px rgba(0,0,0,0.2); }
.edu-card-top { display:flex; align-items:flex-start; gap:12px; }
.edu-card-icon { width:40px; height:40px; border-radius:10px; display:flex; align-items:center; justify-content:center; font-size:20px; flex-shrink:0; }
.edu-card-body { flex:1; min-width:0; }
.edu-card-title { font-size:15px; font-weight:600; margin:0 0 4px; line-height:1.3; color:var(--text,#e2e8f0); }
.edu-card-desc { font-size:13px; color:var(--muted,#94a3b8); margin:0; line-height:1.4; display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden; }
.edu-card-footer { display:flex; gap:8px; align-items:center; margin-top:4px; flex-wrap:wrap; }
.edu-card-badge { font-size:11px; padding:3px 8px; border-radius:6px; font-weight:500; }
.edu-card-badge.article { background:rgba(59,130,246,0.12); color:#60a5fa; }
.edu-card-badge.video { background:rgba(239,68,68,0.12); color:#f87171; }
.edu-card-badge.audio { background:rgba(168,85,247,0.12); color:#c084fc; }
.edu-card-badge.infographic { background:rgba(245,158,11,0.12); color:#fbbf24; }
.edu-card-badge.quiz { background:rgba(34,197,94,0.12); color:#4ade80; }
.edu-card-badge.checklist { background:rgba(6,182,212,0.12); color:#22d3ee; }
.edu-card-time { font-size:11px; color:var(--muted,#64748b); display:flex; align-items:center; gap:4px; }
.edu-card-cat { font-size:11px; color:var(--muted,#64748b); padding:2px 8px; border-radius:4px; background:var(--bg,#0f172a); }

/* ── Learning Progress ── */
.edu-progress-stats { display:grid; grid-template-columns:repeat(4,1fr); gap:12px; margin-bottom:12px; }
.edu-stat { background:var(--panel,#1e293b); border:1px solid var(--border,#334155); border-radius:10px; padding:16px; text-align:center; }
.edu-stat-val { display:block; font-size:28px; font-weight:700; color:var(--primary,#0d9488); }
.edu-stat-lbl { display:block; font-size:12px; color:var(--muted,#94a3b8); margin-top:2px; }
.edu-progress-bar-wrap { height:6px; border-radius:3px; background:var(--border,#334155); margin-bottom:16px; overflow:hidden; }
.edu-progress-bar { height:100%; border-radius:3px; background:linear-gradient(90deg,var(--primary,#0d9488),#06b6d4); transition:width 0.5s ease; }
.edu-assignment { background:var(--panel,#1e293b); border:1px solid var(--border,#334155); border-radius:10px; padding:14px; margin-bottom:8px; animation:eduSlideUp 0.25s ease forwards; }
.edu-assignment:last-child { margin-bottom:0; }
.edu-assign-top { display:flex; justify-content:space-between; align-items:flex-start; gap:10px; }
.edu-assign-title { font-size:14px; font-weight:600; color:var(--text,#e2e8f0); }
.edu-assign-status { font-size:11px; padding:2px 8px; border-radius:6px; font-weight:500; white-space:nowrap; }
.edu-assign-status.assigned { background:rgba(245,158,11,0.12); color:#fbbf24; }
.edu-assign-status.viewed { background:rgba(59,130,246,0.12); color:#60a5fa; }
.edu-assign-status.completed { background:rgba(34,197,94,0.12); color:#4ade80; }
.edu-assign-status.quiz_passed { background:rgba(168,85,247,0.12); color:#c084fc; }
.edu-assign-meta { font-size:12px; color:var(--muted,#94a3b8); margin:6px 0; }
.edu-assign-actions { display:flex; gap:8px; margin-top:8px; }
.edu-assign-actions button { padding:6px 14px; border-radius:6px; font-size:12px; font-weight:500; cursor:pointer; border:none; transition:opacity 0.15s; }
.edu-assign-actions button:hover { opacity:0.85; }
.edu-assign-open { background:var(--primary,#0d9488); color:#fff; }
.edu-assign-done { background:var(--surface,#334155); color:var(--text,#e2e8f0); border:1px solid var(--border,#475569) !important; }

/* ── Content Viewer Modal ── */
.modal-overlay { position:fixed; inset:0; background:rgba(0,0,0,0.6); z-index:10000; display:flex; align-items:center; justify-content:center; padding:20px; backdrop-filter:blur(2px); }
.edu-viewer { max-width:640px; width:100%; max-height:80vh; background:var(--panel,#1e293b); border:1px solid var(--border,#334155); border-radius:16px; overflow:hidden; display:flex; flex-direction:column; animation:fadeIn 0.2s ease; }
.edu-viewer-header { display:flex; justify-content:space-between; align-items:center; padding:16px 20px; border-bottom:1px solid var(--border,#334155); gap:12px; }
.edu-viewer-badge { font-size:12px; padding:4px 10px; border-radius:6px; font-weight:500; }
.edu-viewer-duration { font-size:12px; color:var(--muted,#94a3b8); margin-left:8px; }
.edu-viewer-close { width:32px; height:32px; border-radius:8px; border:none; background:var(--surface,#334155); color:var(--text,#e2e8f0); cursor:pointer; display:flex; align-items:center; justify-content:center; flex-shrink:0; }
.edu-viewer-close:hover { background:var(--danger,#dc2626); color:#fff; }
.edu-viewer-body { padding:20px; overflow-y:auto; flex:1; font-size:14px; line-height:1.6; color:var(--text,#e2e8f0); }
.edu-viewer-body h3 { margin:0 0 12px; font-size:18px; }
.edu-content-meta { color:var(--muted,#94a3b8); font-size:12px; text-transform:capitalize; }
.edu-viewer-body p { margin:0 0 10px; }
.edu-viewer-body .edu-key-msg { background:rgba(59,130,246,0.08); border-left:3px solid var(--primary,#0d9488); padding:10px 14px; border-radius:6px; margin:8px 0; font-size:13px; }
.edu-viewer-body .edu-red-flag { background:rgba(220,38,38,0.08); border-left:3px solid #dc2626; padding:10px 14px; border-radius:6px; margin:8px 0; font-size:13px; }
.edu-viewer-body .edu-action-item { background:rgba(34,197,94,0.08); border-left:3px solid #22c55e; padding:10px 14px; border-radius:6px; margin:8px 0; font-size:13px; }
.edu-viewer-body ul { margin:8px 0; padding-left:20px; }
.edu-viewer-body li { margin:4px 0; font-size:13px; }
.edu-viewer-body .edu-checklist-item { display:flex; align-items:flex-start; gap:8px; padding:6px 0; font-size:13px; }
.edu-viewer-body .edu-checklist-item input { margin-top:3px; flex-shrink:0; }

/* ── Visit Alert Modal ── */
.visit-alert-overlay {
  position:fixed; inset:0; z-index:99999;
  background:rgba(0,0,0,0.7); backdrop-filter:blur(4px);
  display:flex; align-items:center; justify-content:center;
  padding:20px; animation:visitAlertFadeIn 0.3s ease;
}
.visit-alert-card {
  max-width:440px; width:100%;
  background:var(--panel,#1e293b); border:2px solid var(--primary,#2563eb);
  border-radius:20px; padding:32px 28px 24px;
  text-align:center; position:relative;
  animation:visitAlertSlideIn 0.4s cubic-bezier(0.16,1,0.3,1);
  box-shadow:0 0 40px rgba(37,99,235,0.3), 0 20px 60px rgba(0,0,0,0.5);
}
.visit-alert-close {
  position:absolute; top:12px; right:12px;
  width:32px; height:32px; border-radius:50%;
  border:none; background:var(--surface,#334155);
  color:var(--text,#e2e8f0); font-size:20px; line-height:1;
  cursor:pointer; display:flex; align-items:center; justify-content:center;
  transition:all 0.15s;
}
.visit-alert-close:hover { background:var(--danger,#dc2626); color:#fff; transform:scale(1.1); }
.visit-alert-icon-box {
  width:72px; height:72px; border-radius:50%;
  background:rgba(37,99,235,0.15); margin:0 auto 16px;
  display:flex; align-items:center; justify-content:center;
  animation:visitAlertPulse 2s ease-in-out infinite;
}
.visit-alert-icon { font-size:36px; line-height:1; }
.visit-alert-title {
  margin:0 0 8px; font-size:20px; font-weight:700;
  color:var(--text,#e2e8f0);
}
.visit-alert-details {
  margin:0 0 20px; font-size:14px; line-height:1.5;
  color:var(--muted,#94a3b8);
}
.visit-alert-actions { display:flex; gap:10px; justify-content:center; flex-wrap:wrap; }
.visit-alert-action { min-width:140px; }
.visit-alert-dismiss { min-width:100px; }
@keyframes visitAlertFadeIn {
  from { opacity:0; }
  to { opacity:1; }
}
@keyframes visitAlertSlideIn {
  from { transform:translateY(30px) scale(0.95); opacity:0; }
  to { transform:translateY(0) scale(1); opacity:1; }
}
@keyframes visitAlertPulse {
  0%,100% { transform:scale(1); box-shadow:0 0 0 0 rgba(37,99,235,0.3); }
  50% { transform:scale(1.08); box-shadow:0 0 0 12px rgba(37,99,235,0); }
}

/* Become a provider section - shown to citizens/unauthenticated visitors */
.become-provider-section {
  margin-top: 24px;
  padding: 20px;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 12px;
  background: var(--surface, #f8fafc);
}
.become-provider-section h3 {
  margin: 0 0 6px;
  font-size: 1.1rem;
}
.become-provider-intro {
  margin: 0 0 14px;
  color: var(--muted, #64748b);
  font-size: 0.9rem;
}
.become-provider-section .portal-tile-grid {
  margin-top: 8px;
}

.become-provider-signin {
  margin: 0 0 14px;
  font-size: 0.85rem;
  color: var(--muted, #64748b);
}
.become-provider-signin a {
  color: var(--primary, #2563eb);
  text-decoration: underline;
  cursor: pointer;
}

/* Staff / partner sign-in helper - de-emphasised, always available as a fallback */
.staff-signin-panel {
  margin-top: 28px;
  padding: 12px 16px;
  border-top: 1px solid var(--border, #e2e8f0);
  text-align: center;
  font-size: 0.85rem;
  color: var(--muted, #64748b);
}
.staff-signin-panel a {
  color: var(--muted, #64748b);
  text-decoration: underline;
  cursor: pointer;
}
.staff-signin-panel a:hover {
  color: var(--primary, #2563eb);
}

/* Language selector in citizen portal header */
.lang-select {
  padding: 4px 8px;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 6px;
  background: var(--panel, #fff);
  color: var(--text, #1e293b);
  font-size: 0.8rem;
  cursor: pointer;
}

/* ── Booking map: facility metadata and care-team popups ───────────────────
   The booking map shows more than a name now: sector, funding, coverage,
   services, ward and staffing, plus the clinicians who practise at the site.
   Kept light so a popup never covers the map it describes. */
.bm-popup { min-width: 230px; max-width: 300px; font-size: 12px; line-height: 1.45; }
.bm-title { font-weight: 700; font-size: 13px; margin-bottom: 4px; }
.bm-badges { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 6px; }
.bm-badge { font-size: 10px; font-weight: 600; border-radius: 999px; padding: 1px 7px; }
.bm-badge.ok { background: #dcfce7; color: #15803d; }
.bm-badge.info { background: #e2e8f0; color: #475569; }
.bm-badge.warn { background: #fee2e2; color: #b91c1c; }
.bm-row { display: flex; justify-content: space-between; gap: 10px; padding: 1px 0; }
.bm-row > span { color: var(--muted, #64748b); }
.bm-row > strong { font-weight: 600; text-align: right; }
.bm-chips { display: flex; gap: 4px; flex-wrap: wrap; margin: 6px 0 2px; }
.bm-chip { font-size: 10px; background: #eef2ff; color: #3730a3; border-radius: 4px; padding: 1px 6px; }
.bm-team { margin-top: 8px; border-top: 1px solid #e2e8f0; padding-top: 6px; }
.bm-team-title { font-weight: 600; color: var(--muted, #64748b); margin-bottom: 3px; }
.bm-team-row { display: flex; justify-content: space-between; gap: 8px; }
.bm-team-row em { color: var(--muted, #64748b); font-style: normal; font-size: 11px; }
.bm-team-more { color: var(--muted, #64748b); font-size: 11px; }
.bm-book { margin-top: 8px; width: 100%; border: 0; border-radius: 6px; padding: 6px 8px;
  background: var(--primary, #10b981); color: #fff; font-weight: 600; font-size: 12px; cursor: pointer; }
.bm-book:hover { filter: brightness(0.95); }

/* Telehealth has no facility, so the panel carries the availability instead. */
.telehealth-panel { position: absolute; top: 10px; right: 10px; z-index: 500;
  max-width: 260px; background: rgba(255, 255, 255, 0.96); color: #1e293b;
  border-radius: 8px; padding: 8px 10px; font-size: 12px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.18); }
.telehealth-panel strong { display: block; margin-bottom: 4px; font-size: 12px; }
.telehealth-row { display: flex; justify-content: space-between; gap: 8px; padding: 1px 0; }
.telehealth-row em { color: #64748b; font-style: normal; font-size: 11px; text-align: right; }
.telehealth-note { margin-top: 6px; color: #64748b; font-size: 11px; }

/* -- Registration wizard ---------------------------------------------------- */
.form-stepper {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  list-style: none;
  margin: 0 0 16px;
  padding: 0;
}

.form-stepper li {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1 1 140px;
  min-height: 44px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.form-stepper li span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 11px;
  flex: 0 0 auto;
}

.form-stepper li.is-active {
  color: var(--text);
  border-color: var(--primary);
}

.form-stepper li.is-active span {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.form-stepper li.is-done {
  color: var(--text);
  border-color: var(--success, #16a34a);
}

.form-stepper li.is-done span {
  background: var(--success, #16a34a);
  border-color: var(--success, #16a34a);
  color: #fff;
}

.reg-step {
  border: 0;
  margin: 0;
  padding: 0;
  min-width: 0;
}

.reg-step[hidden] { display: none; }

.reg-actions {
  display: flex;
  gap: 8px;
  margin-top: 16px;
}

.reg-actions button {
  min-height: 44px;
  flex: 1;
}

.field-invalid input,
.field-invalid select,
.field-invalid textarea {
  border-color: var(--danger);
}

.field-error {
  display: block;
  margin: 4px 0 8px;
  color: var(--danger);
  font-size: 12px;
  font-weight: 600;
}

@media (max-width: 560px) {
  .form-stepper li { flex: 1 1 100%; }
}

/* -- Citizen quick start ---------------------------------------------------
   Three answers to "what brings you here?" above the counters, so a citizen does not have
   to read five statistics and a navigation tree to start. */
.citizen-quickstart { margin: 0 0 16px; }

.citizen-quickstart .eyebrow {
  margin: 0 0 8px;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.quickstart-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}

.quickstart-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  min-height: 92px;
  padding: 14px;
  text-align: left;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}

.quickstart-card:hover,
.quickstart-card:focus-visible { border-color: var(--primary); }

.quickstart-card i { width: 20px; height: 20px; color: var(--primary); }
.quickstart-card strong { font-size: 14px; }
.quickstart-card small { color: var(--muted); font-size: 12px; line-height: 1.35; }

/* Inline feedback for citizen actions (replaces modal alerts). */
#citizenToastHost {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 16px;
  width: min(420px, calc(100vw - 24px));
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 5000;
}

.citizen-toast {
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  font-size: 13px;
  line-height: 1.4;
  white-space: pre-wrap;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.citizen-toast-error { border-color: var(--danger); }
.citizen-toast-success { border-color: var(--success, #16a34a); }
.citizen-toast-out { opacity: 0; transform: translateY(8px); }

@media (prefers-reduced-motion: reduce) {
  .citizen-toast { transition: none; }
}

/* -- My subscriptions (citizen billing) ------------------------------------
   What the citizen already pays for sits above the plans they could add. */
.billing-my-subscriptions { margin-bottom: 8px; }

.subscription-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
}

.subscription-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
}

.subscription-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.subscription-card-meta {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
}

.subscription-card-note {
  margin: 0;
  font-size: 12px;
  line-height: 1.45;
  color: var(--muted);
}

.subscription-card button {
  align-self: flex-start;
  margin-top: 4px;
  min-height: 40px;
}
