:root {
  --bg: #f7f9fc;
  --surface: #ffffff;
  --surface-2: #f1f5f9;
  --border: #e5e9f0;
  --border-strong: #d0d7e2;
  --text: #0f172a;
  --text-2: #475569;
  --text-muted: #64748b;
  --primary: #0ea5a4;
  --primary-600: #0b8f8e;
  --primary-50: #e6f7f6;
  --accent: #1e3a8a;
  --accent-50: #eef2ff;
  --danger: #ef4444;
  --warning: #f59e0b;
  --success: #10b981;
  --shadow-sm: 0 1px 2px rgba(15,23,42,.06);
  --shadow: 0 2px 8px rgba(15,23,42,.06), 0 1px 2px rgba(15,23,42,.04);
  --shadow-lg: 0 20px 40px -12px rgba(15,23,42,.15), 0 8px 20px -8px rgba(15,23,42,.08);
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 18px;
  --radius-xl: 24px;
  --fs-xs: .75rem;
  --fs-sm: .875rem;
  --fs-md: 1rem;
  --fs-lg: 1.125rem;
  --fs-xl: 1.375rem;
  --fs-2xl: 1.75rem;
  --fs-3xl: 2.25rem;
  --fs-4xl: 3rem;
  --maxw: 1200px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: var(--primary-600); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font-family: inherit; }
h1, h2, h3, h4 { margin: 0 0 .5em; letter-spacing: -0.01em; font-weight: 700; line-height: 1.2; }
h1 { font-size: var(--fs-4xl); letter-spacing: -0.025em; }
h2 { font-size: var(--fs-3xl); letter-spacing: -0.02em; }
h3 { font-size: var(--fs-xl); }
h4 { font-size: var(--fs-md); }
p { margin: 0 0 1em; color: var(--text-2); }
.muted { color: var(--text-muted); }
.small { font-size: var(--fs-sm); }
.tiny { font-size: var(--fs-xs); }

.container { max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(255,255,255,.82);
  backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  display: flex;
  align-items: center;
  gap: 20px;
  height: 68px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 1.125rem;
  color: var(--text);
  text-decoration: none;
}
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 36px; height: 36px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--primary), #4fd1c5);
  color: #fff;
  box-shadow: var(--shadow-sm);
}
.nav { display: flex; align-items: center; gap: 6px; margin-left: 12px; }
.nav a {
  padding: 8px 12px;
  color: var(--text-2);
  border-radius: 8px;
  font-weight: 500;
  font-size: .95rem;
}
.nav a:hover { color: var(--text); background: var(--surface-2); text-decoration: none; }
.nav a.active { color: var(--primary-600); background: var(--primary-50); }
.nav-muted { opacity: .7; }
.header-actions { margin-left: auto; display: flex; gap: 8px; }
.menu-toggle { display: none; background: transparent; border: 1px solid var(--border); border-radius: 8px; padding: 6px; cursor: pointer; color: var(--text-2); }

@media (max-width: 860px) {
  .nav, .header-actions { display: none; }
  .menu-toggle { display: inline-flex; margin-left: auto; }
  .nav.open, .header-actions.open {
    display: flex;
    position: absolute;
    top: 68px; left: 0; right: 0;
    background: #fff;
    flex-direction: column;
    padding: 12px;
    border-bottom: 1px solid var(--border);
    gap: 4px;
  }
  .header-actions.open { top: unset; }
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 18px;
  font-size: .95rem; font-weight: 600;
  border-radius: 10px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all .15s ease;
  text-decoration: none;
  white-space: nowrap;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--primary); color: #fff; box-shadow: var(--shadow-sm); }
.btn-primary:hover { background: var(--primary-600); transform: translateY(-1px); box-shadow: var(--shadow); }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
.btn-secondary:hover { background: var(--surface-2); }
.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-sm { padding: 6px 12px; font-size: .85rem; border-radius: 8px; }
.btn-lg { padding: 14px 24px; font-size: 1.05rem; border-radius: 12px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }

/* ---------- Forms ---------- */
.field { display: block; margin-bottom: 14px; }
.field > label { display: block; font-weight: 600; font-size: .875rem; color: var(--text); margin-bottom: 6px; }
.field > .help { font-size: .8rem; color: var(--text-muted); margin-top: 4px; }
.input, .select, .textarea {
  width: 100%;
  font-size: 1rem;
  padding: 11px 14px;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  transition: border-color .15s, box-shadow .15s;
  font-family: inherit;
}
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(14,165,164,.12);
}
.textarea { min-height: 110px; resize: vertical; }
.input-icon { position: relative; }
.input-icon .input { padding-left: 42px; }
.input-icon svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--text-muted); pointer-events: none; }

.chip-group { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px;
  background: #fff;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  font-size: .875rem;
  font-weight: 500;
  color: var(--text-2);
  cursor: pointer;
  transition: all .12s ease;
  user-select: none;
}
.chip:hover { border-color: var(--primary); color: var(--primary-600); }
.chip.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.chip input { display: none; }

.checkbox, .radio {
  display: inline-flex; align-items: flex-start; gap: 10px;
  cursor: pointer; font-size: .95rem;
  padding: 4px 0;
}
.checkbox input, .radio input { margin-top: 3px; accent-color: var(--primary); width: 18px; height: 18px; }

.segment {
  display: inline-flex;
  background: var(--surface-2);
  padding: 4px;
  border-radius: 10px;
  border: 1px solid var(--border);
}
.segment button {
  border: none; background: transparent;
  padding: 7px 16px;
  font-weight: 500; font-size: .875rem;
  color: var(--text-2); cursor: pointer;
  border-radius: 7px;
}
.segment button.active { background: #fff; color: var(--text); box-shadow: var(--shadow-sm); }

/* ---------- Cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.card-body { padding: 20px; }
.card-row {
  display: flex; gap: 16px; align-items: flex-start;
  padding: 16px;
  border-bottom: 1px solid var(--border);
}
.card-row:last-child { border-bottom: none; }

/* ---------- Layouts ---------- */
.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 900px) { .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }

.row { display: flex; gap: 12px; align-items: center; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.stack-sm { gap: 6px; }
.stack-lg { gap: 24px; }

/* ---------- Hero / Home ---------- */
.hero {
  position: relative;
  padding: 64px 0 40px;
  background:
    radial-gradient(1000px 500px at 85% -10%, rgba(14,165,164,.10), transparent 60%),
    radial-gradient(800px 400px at -10% 20%, rgba(30,58,138,.07), transparent 60%),
    linear-gradient(to bottom, #fff, var(--bg));
  overflow: hidden;
}
.hero-inner { display: grid; grid-template-columns: 1.1fr .9fr; gap: 48px; align-items: center; }
@media (max-width: 900px) { .hero-inner { grid-template-columns: 1fr; gap: 32px; } }
.hero h1 {
  font-size: clamp(2rem, 4vw, 3.5rem);
  line-height: 1.1;
}
.hero .lede { font-size: 1.125rem; color: var(--text-2); max-width: 560px; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 12px;
  background: var(--primary-50);
  color: var(--primary-600);
  border-radius: 999px;
  font-size: .8rem; font-weight: 600;
  margin-bottom: 16px;
}
.search-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 22px;
  box-shadow: var(--shadow-lg);
}
.search-row {
  display: grid;
  grid-template-columns: 1.3fr 1fr .9fr auto;
  gap: 12px;
  align-items: end;
}
@media (max-width: 720px) { .search-row { grid-template-columns: 1fr; } }
.search-row .field { margin: 0; }
.hero-side {
  background: linear-gradient(135deg, #eafaf9, #f0f2ff);
  border-radius: var(--radius-xl);
  padding: 32px;
  position: relative;
  overflow: hidden;
  border: 1px solid var(--border);
}
.hero-side::before {
  content: '';
  position: absolute;
  top: -40px; right: -40px;
  width: 180px; height: 180px;
  background: rgba(14,165,164,.22);
  border-radius: 50%;
}
.hero-side::after {
  content: '';
  position: absolute;
  bottom: -60px; left: -30px;
  width: 160px; height: 160px;
  background: rgba(30,58,138,.10);
  border-radius: 50%;
}
.hero-side > * { position: relative; z-index: 1; }
.hero-stats { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; margin-top: 20px; }
.hero-stats .stat { background: rgba(255,255,255,.7); backdrop-filter: blur(4px); border-radius: 12px; padding: 14px; border: 1px solid rgba(255,255,255,.9); }
.stat .num { font-size: 1.5rem; font-weight: 800; color: var(--accent); }
.stat .lbl { font-size: .75rem; color: var(--text-muted); }

/* ---------- Sections ---------- */
.section { padding: 64px 0; }
.section-title { text-align: center; margin-bottom: 8px; }
.section-sub { text-align: center; color: var(--text-muted); max-width: 600px; margin: 0 auto 36px; }

.feature {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  transition: transform .15s ease, box-shadow .15s ease;
}
.feature:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.feature .icon {
  width: 42px; height: 42px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  background: var(--primary-50);
  color: var(--primary-600);
  margin-bottom: 14px;
}
.feature h4 { margin-bottom: 6px; }
.feature p { margin: 0; font-size: .92rem; }

.steps { counter-reset: step; }
.step-item { position: relative; padding-left: 56px; }
.step-item::before {
  counter-increment: step;
  content: counter(step);
  position: absolute; left: 0; top: 0;
  width: 40px; height: 40px;
  background: var(--primary);
  color: #fff;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
}

/* ---------- Results page ---------- */
.results-wrap { display: grid; grid-template-columns: 380px 1fr; gap: 20px; min-height: calc(100vh - 68px); }
@media (max-width: 1000px) { .results-wrap { grid-template-columns: 1fr; } }
.filters-col {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  height: fit-content;
  position: sticky;
  top: 88px;
  max-height: calc(100vh - 88px);
  overflow-y: auto;
}
.filter-section { padding: 14px 0; border-bottom: 1px solid var(--border); }
.filter-section:first-child { padding-top: 0; }
.filter-section:last-child { border-bottom: none; padding-bottom: 0; }
.filter-section h4 { margin-bottom: 10px; font-size: .875rem; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); }

.results-col { display: flex; flex-direction: column; gap: 14px; }
.results-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }

.doctor-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 16px;
  transition: border-color .15s, transform .15s;
  cursor: pointer;
}
.doctor-card:hover { border-color: var(--primary); transform: translateY(-1px); }
@media (max-width: 640px) { .doctor-card { grid-template-columns: 72px 1fr; } }
.doctor-card .avatar {
  width: 96px; height: 96px;
  border-radius: 14px;
  background: linear-gradient(135deg, #e0f2f1, #e0e7ff);
  display: flex; align-items: center; justify-content: center;
  font-size: 28px; font-weight: 700; color: var(--accent);
  overflow: hidden;
  position: relative;
  flex-shrink: 0;
}
@media (max-width: 640px) { .doctor-card .avatar { width: 72px; height: 72px; } }
.doctor-card .dc-body h3 { margin-bottom: 4px; font-size: 1.1rem; }
.doctor-card .dc-specialty { color: var(--primary-600); font-weight: 600; font-size: .875rem; }
.doctor-card .dc-meta { display: flex; flex-wrap: wrap; gap: 10px 14px; font-size: .85rem; color: var(--text-muted); margin-top: 8px; }
.doctor-card .dc-meta span { display: inline-flex; align-items: center; gap: 4px; }
.doctor-card .tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.tag { font-size: .75rem; padding: 3px 10px; background: var(--surface-2); color: var(--text-2); border-radius: 999px; font-weight: 500; }
.tag.success { background: #e6f9f1; color: var(--success); }
.tag.warning { background: #fef3c7; color: #92400e; }
.tag.accent { background: var(--accent-50); color: var(--accent); }
.tag.primary { background: var(--primary-50); color: var(--primary-600); }

.rating { display: inline-flex; align-items: center; gap: 4px; font-weight: 600; color: var(--text); }
.stars { color: var(--warning); letter-spacing: 1px; font-size: .95rem; }

.match-score {
  background: linear-gradient(135deg, #0ea5a4, #22d3ee);
  color: #fff;
  padding: 6px 12px;
  border-radius: 999px;
  font-weight: 700;
  font-size: .8rem;
  display: inline-flex; align-items: center; gap: 4px;
}
.match-reason {
  margin-top: 10px;
  padding: 10px 12px;
  background: var(--primary-50);
  border-radius: 8px;
  font-size: .85rem;
  color: var(--text);
}

.map-container {
  background: #eef2f6;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  height: calc(100vh - 180px);
  min-height: 500px;
  overflow: hidden;
}

/* ---------- Profile page ---------- */
.profile-hero {
  background: linear-gradient(135deg, #0ea5a4 0%, #1e3a8a 100%);
  color: #fff;
  padding: 40px 0 24px;
}
.profile-hero-inner { display: grid; grid-template-columns: 130px 1fr auto; gap: 24px; align-items: center; }
@media (max-width: 720px) { .profile-hero-inner { grid-template-columns: 1fr; text-align: center; } }
.profile-hero .avatar { width: 130px; height: 130px; border-radius: 50%; background: #fff; color: var(--accent); font-size: 42px; display:flex; align-items:center; justify-content:center; font-weight: 700; box-shadow: var(--shadow-lg); }
.profile-hero h1 { color: #fff; font-size: 2rem; margin-bottom: 6px; }
.profile-hero .subtitle { color: rgba(255,255,255,.85); font-size: 1.05rem; }
.profile-hero .meta-row { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 14px; font-size: .875rem; color: rgba(255,255,255,.85); }
.profile-hero .meta-row span { display: inline-flex; align-items: center; gap: 6px; }

.profile-layout { display: grid; grid-template-columns: 1fr 360px; gap: 24px; padding: 24px 0 60px; }
@media (max-width: 960px) { .profile-layout { grid-template-columns: 1fr; } }
.profile-main { display: flex; flex-direction: column; gap: 16px; }
.profile-side { display: flex; flex-direction: column; gap: 16px; position: sticky; top: 88px; align-self: flex-start; }
@media (max-width: 960px) { .profile-side { position: static; } }

.review-item { padding: 16px 0; border-bottom: 1px solid var(--border); }
.review-item:last-child { border-bottom: none; }
.review-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.review-author { font-weight: 600; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); padding: 0 20px; overflow-x: auto; }
.tabs button {
  background: none; border: none; border-bottom: 2px solid transparent;
  padding: 14px 12px; font-weight: 600; font-size: .9rem;
  color: var(--text-muted); cursor: pointer;
  white-space: nowrap;
}
.tabs button.active { color: var(--primary-600); border-bottom-color: var(--primary); }

.tab-content { padding: 20px; }
.kv-list { display: grid; grid-template-columns: 1fr 2fr; gap: 10px 20px; font-size: .92rem; }
.kv-list dt { color: var(--text-muted); }
.kv-list dd { margin: 0; color: var(--text); font-weight: 500; }
@media (max-width: 540px) { .kv-list { grid-template-columns: 1fr; gap: 2px 0; } .kv-list dd { margin-bottom: 8px; } }

/* ---------- Questionnaire ---------- */
.quest-shell { max-width: 760px; margin: 40px auto; padding: 0 20px; }
.quest-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 36px;
  box-shadow: var(--shadow);
}
.progress { height: 6px; background: var(--surface-2); border-radius: 999px; overflow: hidden; margin-bottom: 28px; }
.progress-bar { height: 100%; background: var(--primary); transition: width .3s ease; }
.quest-title { font-size: 1.5rem; margin-bottom: 4px; }
.quest-sub { color: var(--text-muted); margin-bottom: 24px; }
.quest-nav { display: flex; justify-content: space-between; gap: 10px; margin-top: 32px; }
.option-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (max-width: 540px) { .option-grid { grid-template-columns: 1fr; } }
.option-card {
  padding: 14px 16px;
  background: #fff;
  border: 1.5px solid var(--border-strong);
  border-radius: 12px;
  cursor: pointer;
  transition: all .12s ease;
  font-weight: 500;
  font-size: .95rem;
  text-align: left;
}
.option-card:hover { border-color: var(--primary); background: var(--primary-50); }
.option-card.selected { border-color: var(--primary); background: var(--primary-50); color: var(--primary-600); }

/* ---------- Modals ---------- */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(15,23,42,.5);
  backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  z-index: 100;
  animation: fadein .15s ease;
}
@keyframes fadein { from { opacity: 0; } }
.modal {
  background: #fff;
  border-radius: var(--radius-xl);
  padding: 28px;
  max-width: 520px; width: 100%;
  max-height: 90vh; overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: slideup .2s ease;
}
@keyframes slideup { from { transform: translateY(12px); opacity: 0; } }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.modal-close { background: none; border: none; font-size: 1.5rem; cursor: pointer; color: var(--text-muted); padding: 4px; }

/* ---------- Toasts ---------- */
.toast-root {
  position: fixed; bottom: 20px; right: 20px;
  display: flex; flex-direction: column; gap: 10px;
  z-index: 200;
}
.toast {
  background: #fff;
  border-left: 4px solid var(--success);
  border-radius: 10px;
  padding: 14px 18px;
  box-shadow: var(--shadow-lg);
  font-size: .92rem;
  min-width: 260px; max-width: 380px;
  animation: slidein .2s ease;
}
.toast.error { border-left-color: var(--danger); }
.toast.info { border-left-color: var(--primary); }
@keyframes slidein { from { transform: translateX(20px); opacity: 0; } }

/* ---------- Auth / forms pages ---------- */
.auth-shell { max-width: 440px; margin: 60px auto; padding: 0 20px; }

/* ---------- Dashboard ---------- */
.dash-shell { display: grid; grid-template-columns: 240px 1fr; gap: 24px; padding: 24px 0; }
@media (max-width: 900px) { .dash-shell { grid-template-columns: 1fr; } }
.dash-sidebar {
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 16px; height: fit-content;
}
.dash-sidebar a {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 8px;
  color: var(--text-2); font-weight: 500; font-size: .92rem;
}
.dash-sidebar a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.dash-sidebar a.active { background: var(--primary-50); color: var(--primary-600); }
.dash-main { display: flex; flex-direction: column; gap: 20px; }
.metric-card { padding: 18px; background: #fff; border: 1px solid var(--border); border-radius: var(--radius); }
.metric-card .lbl { font-size: .8rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .06em; }
.metric-card .num { font-size: 1.75rem; font-weight: 800; color: var(--text); margin-top: 4px; }
.metric-card .trend { font-size: .8rem; margin-top: 2px; }
.trend.up { color: var(--success); }
.trend.down { color: var(--danger); }

.table-wrap { overflow-x: auto; }
table.data-table { width: 100%; border-collapse: collapse; font-size: .92rem; }
table.data-table th, table.data-table td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--border); }
table.data-table th { background: var(--surface-2); font-weight: 600; color: var(--text-2); font-size: .85rem; text-transform: uppercase; letter-spacing: .04em; }
table.data-table tbody tr:hover { background: var(--surface-2); }

.status-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; }
.status-dot.green { background: var(--success); }
.status-dot.amber { background: var(--warning); }
.status-dot.red { background: var(--danger); }
.status-dot.gray { background: var(--text-muted); }

/* ---------- Footer ---------- */
.site-footer { background: #0b1220; color: #cbd5e1; margin-top: 80px; }
.footer-inner {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 40px;
  padding: 48px 20px;
  max-width: var(--maxw); margin: 0 auto;
}
@media (max-width: 760px) { .footer-inner { grid-template-columns: 1fr 1fr; } }
@media (max-width: 480px) { .footer-inner { grid-template-columns: 1fr; } }
.site-footer h4 { color: #fff; font-size: .875rem; text-transform: uppercase; letter-spacing: .06em; }
.site-footer a { display: block; color: #94a3b8; text-decoration: none; padding: 4px 0; font-size: .92rem; }
.site-footer a:hover { color: #fff; text-decoration: none; }
.brand-footer { color: #fff; margin-bottom: 8px; }
.footer-bottom { border-top: 1px solid rgba(255,255,255,.08); padding: 18px 0; }

/* ---------- Utilities ---------- */
.divider { height: 1px; background: var(--border); margin: 20px 0; }
.hidden { display: none !important; }
.text-center { text-align: center; }
.empty-state {
  padding: 48px 24px;
  text-align: center;
  color: var(--text-muted);
}
.empty-state svg { margin: 0 auto 12px; color: var(--text-muted); opacity: .6; }
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 8px;
  font-size: .7rem;
  font-weight: 600;
  border-radius: 6px;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.badge.primary { background: var(--primary-50); color: var(--primary-600); }
.badge.success { background: #e6f9f1; color: var(--success); }
.badge.warning { background: #fef3c7; color: #92400e; }
.badge.accent { background: var(--accent-50); color: var(--accent); }

/* Leaflet tweaks */
.leaflet-container { font-family: inherit; }
.leaflet-popup-content h4 { margin-bottom: 4px; font-size: 1rem; }
.leaflet-popup-content p { margin: 0; font-size: .85rem; }

/* ---------- i18n: language switcher + RTL overrides (Phase 0) ---------- */
.lang-switcher {
  display: inline-flex;
  gap: 2px;
  padding: 2px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-right: 8px;
}
.lang-btn {
  appearance: none;
  background: transparent;
  border: 0;
  padding: 4px 8px;
  font: 600 12px/1 Inter, sans-serif;
  color: var(--text-muted);
  border-radius: 6px;
  cursor: pointer;
}
.lang-btn:hover { color: var(--text); }
.lang-btn.is-active {
  background: var(--surface);
  color: var(--primary-600);
  box-shadow: var(--shadow-sm);
}

/* RTL: flip spacing/logical directions for Hebrew. Search/map logic untouched. */
html[dir="rtl"] body { direction: rtl; }
html[dir="rtl"] .lang-switcher { margin-right: 0; margin-left: 8px; }
html[dir="rtl"] .header-inner,
html[dir="rtl"] .footer-inner { direction: rtl; }
html[dir="rtl"] .leaflet-container { direction: ltr; } /* keep map LTR */

.demo-banner {
  position: sticky;
  top: 0;
  z-index: 50;
  background: #fef3c7;
  color: #92400e;
  border-bottom: 1px solid #fde68a;
  padding: 8px 20px;
  text-align: center;
  font-size: .875rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}
.user-chip-demo {
  outline: 1px dashed var(--warning);
  outline-offset: 2px;
}
.spinner {
  display: inline-block;
  width: 18px; height: 18px;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  vertical-align: middle;
}
.spinner-lg { width: 32px; height: 32px; border-width: 3px; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading-block {
  display: flex; align-items: center; justify-content: center;
  gap: 12px; padding: 40px; color: var(--text-muted);
}
.error-text { color: var(--danger); }

/* ---------- Focus styles (F4) ---------- */
:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: 4px;
}
.btn:focus-visible, .chip:focus-visible, .lang-btn:focus-visible {
  outline-offset: 3px;
}
.modal { outline: none; }

/* ---------- RTL — Hebrew layout mirroring ---------- */
html[dir="rtl"] .header-inner { flex-direction: row-reverse; }
html[dir="rtl"] .nav { flex-direction: row-reverse; }
html[dir="rtl"] .header-actions { flex-direction: row-reverse; }
html[dir="rtl"] .brand { flex-direction: row-reverse; }

/* Input icons live on the left in LTR — move to right in RTL. */
html[dir="rtl"] .input-icon svg { left: auto; right: 12px; }
html[dir="rtl"] .input-icon .input { padding-left: 14px; padding-right: 38px; }

/* Results layout */
html[dir="rtl"] .results-wrap { direction: rtl; }
html[dir="rtl"] .filters-col { order: 2; }
html[dir="rtl"] .results-col { order: 1; }

/* Dashboard */
html[dir="rtl"] .dash-shell { direction: rtl; }
html[dir="rtl"] .dash-sidebar { order: 2; }
html[dir="rtl"] .dash-main { order: 1; }

/* Profile hero & card rows */
html[dir="rtl"] .profile-hero-inner { direction: rtl; }
html[dir="rtl"] .profile-layout { direction: rtl; }
html[dir="rtl"] .card-row { flex-direction: row-reverse; }
html[dir="rtl"] .row-between { flex-direction: row-reverse; }

/* Doctor card */
html[dir="rtl"] .doctor-card { direction: rtl; }
html[dir="rtl"] .dc-meta { flex-direction: row-reverse; }

/* Badges / tags / chips spacing */
html[dir="rtl"] .badge, html[dir="rtl"] .tag, html[dir="rtl"] .chip { margin-left: 4px; margin-right: 0; }

/* Data tables: right-align first column (doctor name) for readability */
html[dir="rtl"] .data-table th,
html[dir="rtl"] .data-table td { text-align: right; }

/* Keep Leaflet map internals LTR regardless of locale (already present — keep) */
html[dir="rtl"] .leaflet-container { direction: ltr; }

/* Toasts anchored left in LTR, anchor right in RTL */
html[dir="rtl"] .toast-root { left: 20px; right: auto; }

/* Demo banner (from F2) stays centered — no change needed */

/* Auth / modal / footer already flex-based and responsive — minor fixes */
html[dir="rtl"] .footer-inner { direction: rtl; }
html[dir="rtl"] .segment button:first-child { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
html[dir="rtl"] .segment button:last-child  { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }

/* ---------- Photo upload card (F9) ---------- */
.photo-card { margin-bottom: 16px; }
.photo-row { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; }
.photo-preview {
  width: 96px; height: 96px; border-radius: 50%;
  overflow: hidden; background: var(--surface-2);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.photo-preview img { width: 100%; height: 100%; object-fit: cover; }
.avatar-lg { width: 96px; height: 96px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--primary-50); color: var(--primary-600);
  font-weight: 700; font-size: 1.5rem; }
.photo-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ---------- F15: Photo rendering on avatar with initials fallback ---------- */
.avatar.has-photo { padding: 0; overflow: hidden; }
.avatar.has-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar.avatar-xl { width: 120px; height: 120px; font-size: 2rem; }

/* ---------- F16: Performance — CSS containment & content-visibility ---------- */
.doctor-card { contain: layout style; }
.data-table { contain: layout; }
.card { contain: layout style; }
.section { content-visibility: auto; contain-intrinsic-size: 700px; }

/* ---------- F17: Responsive polish for ≤640px ---------- */
.filters-toggle { display: none; }
@media (max-width: 640px) {
  .hero-inner { grid-template-columns: 1fr; }
  .hero-side { margin-top: 24px; }
  .hero-stats { grid-template-columns: 1fr 1fr; }
  .search-row { flex-direction: column; align-items: stretch; }
  .search-row .btn-lg { width: 100%; }

  .results-wrap { grid-template-columns: 1fr; }
  .filters-col { order: 2; }
  .results-col { order: 1; }
  .filters-col.is-collapsed { display: none; }

  .dash-shell { grid-template-columns: 1fr; }
  .dash-sidebar { flex-direction: row; overflow-x: auto; gap: 6px; }
  .dash-sidebar a { white-space: nowrap; }

  .profile-hero-inner { grid-template-columns: 1fr; gap: 12px; text-align: center; }
  .profile-hero-inner .avatar { margin: 0 auto; }
  .profile-layout { grid-template-columns: 1fr; }

  .data-table { font-size: .85rem; }
  .table-wrap { overflow-x: auto; }

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

  .doctor-card { flex-direction: column; align-items: stretch; }
  .dc-action { flex-direction: row !important; }

  .modal { width: calc(100% - 24px); max-width: none; }

  .nav, .header-actions { display: none; }
  .nav.open, .header-actions.open {
    display: flex; flex-direction: column;
    position: absolute; top: 68px; left: 0; right: 0;
    background: var(--surface); border-bottom: 1px solid var(--border);
    padding: 12px 20px; gap: 8px; z-index: 40;
  }
  .menu-toggle { display: inline-flex; }
  .filters-toggle { display: inline-flex; margin-bottom: 10px; }
}
