/* ============================================================
   MEDPADI — Global Design System
   ZiksKonect Media Hub
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Syne:wght@400;600;700;800&family=DM+Sans:wght@300;400;500;600}&family=Sora:wght@400;600;700;800&display=swap');

:root {
  --navy:       #0A2A5E;
  --navy-deep:  #061A3E;
  --teal:       #0D7377;
  --teal-light: #14BDBD;
  --teal-pale:  #E8F7F7;
  --gold:       #C89B3C;
  --gold-light: #F5E6C0;
  --white:      #FFFFFF;
  --off-white:  #F7F9FC;
  --gray-100:   #F0F2F8;
  --gray-200:   #DDE3F0;
  --gray-400:   #8A96B3;
  --gray-600:   #4A5568;
  --gray-800:   #1A202C;
  --danger:     #DC2626;
  --danger-bg:  #FEF2F2;
  --success:    #059669;
  --success-bg: #ECFDF5;
  --warning:    #D97706;
  --warning-bg: #FFFBEB;
  --info:       #2563EB;
  --info-bg:    #EFF6FF;

  --font-display: 'Syne', sans-serif;
  --font-body:    'DM Sans', sans-serif;

  --radius-sm:  6px;
  --radius-md:  12px;
  --radius-lg:  18px;
  --radius-xl:  24px;
  --radius-full:9999px;

  --shadow-sm:  0 1px 3px rgba(10,42,94,.08), 0 1px 2px rgba(10,42,94,.05);
  --shadow-md:  0 4px 16px rgba(10,42,94,.10), 0 2px 6px rgba(10,42,94,.06);
  --shadow-lg:  0 10px 40px rgba(10,42,94,.14), 0 4px 12px rgba(10,42,94,.08);
  --shadow-card:0 2px 12px rgba(10,42,94,.08);

  --sidebar-w:  260px;
  --topbar-h:   64px;
  --transition: all .2s ease;
}

/* ── Reset ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-body);
  font-size: 15px;
  color: var(--gray-800);
  background: var(--off-white);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { cursor: pointer; font-family: var(--font-body); }
input, textarea, select { font-family: var(--font-body); }

/* ── Typography ─────────────────────────────────────────────── */
h1,h2,h3,h4,h5 { font-family: var(--font-display); font-weight: 700; line-height: 1.2; }
h1 { font-size: clamp(1.8rem, 4vw, 2.6rem); }
h2 { font-size: clamp(1.4rem, 3vw, 2rem); }
h3 { font-size: 1.3rem; }
h4 { font-size: 1.1rem; }

/* ── Buttons ────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 20px; border-radius: var(--radius-md);
  font-size: 14px; font-weight: 600; border: none;
  transition: var(--transition); white-space: nowrap;
}
.btn-primary {
  background: var(--navy); color: var(--white);
}
.btn-primary:hover { background: var(--navy-deep); transform: translateY(-1px); box-shadow: var(--shadow-md); }

.btn-teal {
  background: var(--teal); color: var(--white);
}
.btn-teal:hover { background: #0a5e62; transform: translateY(-1px); box-shadow: var(--shadow-md); }

.btn-gold {
  background: var(--gold); color: var(--white);
}
.btn-gold:hover { background: #b08530; transform: translateY(-1px); }

.btn-outline {
  background: transparent; color: var(--navy);
  border: 1.5px solid var(--navy);
}
.btn-outline:hover { background: var(--navy); color: var(--white); }

.btn-ghost {
  display: inline-flex; align-items: center; gap: 8px;
  color: var(--navy); background: white;
  border: 1.5px solid var(--navy);
  border-radius: 999px; padding: 12px 20px;
  font-weight: 600; transition: all .25s;
}
.btn-ghost:hover {
  background: var(--teal-pale);
  color: var(--navy);
  transform: translateY(-1px);
}

.btn-danger { background: var(--danger); color: var(--white); }
.btn-danger:hover { background: #b91c1c; }

.btn-sm  { padding: 7px 14px; font-size: 13px; }
.btn-lg  { padding: 14px 28px; font-size: 16px; border-radius: var(--radius-lg); }
.btn-block { width: 100%; justify-content: center; }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none !important; }

/* ── Shared Marketing Nav & Footer ───────────────────────────────────── */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 200;
  padding: 0 40px;
  display: flex; align-items: center; justify-content: space-between;
  height: 68px;
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid var(--gray-200);
  transition: all .4s;
}
.nav.scrolled { box-shadow: 0 2px 20px rgba(0,150,199,.12); }
.nav-logo {
  font-family: var(--font-display); font-size: 1.7rem; font-weight: 400;
  color: var(--navy); letter-spacing: -.01em;
}
.nav-logo span { font-style: italic; color: var(--teal); }
.nav-links { display: flex; align-items: center; gap: 6px; }
.nav-pill {
  font-size: 13px; font-weight: 600; color: var(--gray-600);
  padding: 8px 16px; border-radius: 999px; transition: all .25s;
}
.nav-pill:hover { color: var(--navy); background: var(--teal-pale); }
.nav-hamburger { display: none; }

@media (max-width:900px) {
  .nav { padding: 0 20px; }
  .nav-links { flex-wrap: wrap; gap: 10px; }
}

.footer {
  padding: 32px 40px;
  background: var(--navy);
  border-top: 1px solid rgba(255,255,255,.06);
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 16px;
}
.footer-logo { font-family: var(--font-display); font-size: 1.25rem; color: white; }
.footer-logo span { font-style: italic; color: var(--cyan); }
.footer-copy { font-size: 12px; color: rgba(255,255,255,.3); }
.footer-links { display: flex; gap: 20px; }
.footer-links a { font-size: 12px; color: rgba(255,255,255,.4); transition: color .2s; }
.footer-links a:hover { color: rgba(255,255,255,.8); }

/* ── Form Controls ──────────────────────────────────────────── */
.form-group { margin-bottom: 20px; }
.form-label {
  display: block; margin-bottom: 6px;
  font-size: 13px; font-weight: 600; color: var(--gray-600);
  text-transform: uppercase; letter-spacing: .04em;
}
.form-control {
  width: 100%; padding: 11px 14px;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-md);
  font-size: 15px; color: var(--gray-800);
  background: var(--white);
  transition: var(--transition); outline: none;
}
.form-control:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(13,115,119,.12);
}
.form-control::placeholder { color: var(--gray-400); }
.form-control.is-invalid { border-color: var(--danger); }
.form-hint { font-size: 12px; color: var(--gray-400); margin-top: 5px; }
.form-error { font-size: 12px; color: var(--danger); margin-top: 5px; }

.input-group { position: relative; }
.input-group .form-control { padding-left: 42px; }
.input-group .input-icon {
  position: absolute; left: 13px; top: 50%; transform: translateY(-50%);
  color: var(--gray-400); pointer-events: none;
}
.input-group .input-icon-right {
  position: absolute; right: 13px; top: 50%; transform: translateY(-50%);
  color: var(--gray-400); cursor: pointer;
}

/* ── Cards ──────────────────────────────────────────────────── */
.card {
  background: var(--white); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card); overflow: hidden;
}
.card-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--gray-100);
  display: flex; align-items: center; justify-content: space-between;
}
.card-header h3, .card-header h4 { margin: 0; }
.card-body { padding: 24px; }
.card-footer {
  padding: 14px 24px;
  border-top: 1px solid var(--gray-100);
  background: var(--off-white);
}

/* ── Badges ─────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: var(--radius-full);
  font-size: 12px; font-weight: 600; letter-spacing: .02em;
}
.badge-emergency { background: #FEE2E2; color: #991B1B; }
.badge-high      { background: #FEF3C7; color: #92400E; }
.badge-medium    { background: #FEF9C3; color: #713F12; }
.badge-low       { background: var(--success-bg); color: #065F46; }
.badge-pending   { background: #FEF3C7; color: #92400E; }
.badge-verified  { background: var(--success-bg); color: #065F46; }
.badge-rejected  { background: var(--danger-bg); color: #991B1B; }
.badge-suspended { background: var(--gray-100); color: var(--gray-600); }
.badge-available { background: var(--success-bg); color: #065F46; }
.badge-busy      { background: #FEF3C7; color: #92400E; }
.badge-off_duty  { background: var(--gray-100); color: var(--gray-600); }
.badge-navy      { background: var(--navy); color: var(--white); }
.badge-teal      { background: var(--teal); color: var(--white); }

/* ── Alerts ─────────────────────────────────────────────────── */
.alert {
  padding: 14px 16px; border-radius: var(--radius-md);
  font-size: 14px; display: flex; align-items: flex-start; gap: 10px;
  margin-bottom: 20px;
}
.alert-success { background: var(--success-bg); color: #065F46; border-left: 4px solid var(--success); }
.alert-danger  { background: var(--danger-bg);  color: #991B1B; border-left: 4px solid var(--danger); }
.alert-warning { background: var(--warning-bg); color: #92400E; border-left: 4px solid var(--warning); }
.alert-info    { background: var(--info-bg);    color: #1E40AF; border-left: 4px solid var(--info); }
.alert-emergency {
  background: #7f1d1d; color: #fff;
  border-left: 6px solid #DC2626;
  border-radius: var(--radius-md);
  font-weight: 600; font-size: 15px;
  animation: pulse-emergency 1.5s infinite;
}
@keyframes pulse-emergency {
  0%,100% { box-shadow: 0 0 0 0 rgba(220,38,38,.4); }
  50%      { box-shadow: 0 0 0 8px rgba(220,38,38,0); }
}

/* ── Dashboard layout ───────────────────────────────────────── */
.dashboard-wrapper { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w); min-height: 100vh;
  background: var(--navy-deep);
  display: flex; flex-direction: column;
  position: fixed; top: 0; left: 0; z-index: 100;
  transition: var(--transition);
}
.sidebar-logo {
  padding: 22px 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar-logo .app-name {
  font-family: var(--font-display); font-size: 1.7rem; font-weight: 800;
  color: var(--white); letter-spacing: .04em;
}
.sidebar-logo .app-sub {
  font-size: 11px; color: var(--teal-light); letter-spacing: .06em;
  text-transform: uppercase; margin-top: 2px;
}
.sidebar-nav { flex: 1; padding: 16px 0; overflow-y: auto; }
.nav-section-title {
  padding: 10px 20px 4px;
  font-size: 10px; font-weight: 700; letter-spacing: .1em;
  text-transform: uppercase; color: rgba(255,255,255,.3);
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 20px; color: rgba(255,255,255,.65);
  font-size: 14px; font-weight: 500;
  transition: var(--transition); border-left: 3px solid transparent;
}
.nav-item:hover { background: rgba(255,255,255,.06); color: var(--white); }
.nav-item.active {
  background: rgba(13,115,119,.25);
  color: var(--teal-light);
  border-left-color: var(--teal-light);
}
.nav-item svg { flex-shrink: 0; }
.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,.08);
}

.main-content {
  margin-left: var(--sidebar-w);
  flex: 1; display: flex; flex-direction: column; min-height: 100vh;
}
.topbar {
  height: var(--topbar-h); background: var(--white);
  border-bottom: 1px solid var(--gray-100);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 28px; position: sticky; top: 0; z-index: 50;
  box-shadow: var(--shadow-sm);
}
.topbar-title {
  font-family: var(--font-display); font-size: 1.1rem; font-weight: 700;
  color: var(--navy);
}
.topbar-right { display: flex; align-items: center; gap: 16px; }
.topbar-avatar {
  width: 36px; height: 36px; border-radius: var(--radius-full);
  background: var(--navy); color: var(--white);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px;
}
.page-content { padding: 28px; flex: 1; }

/* ── Stats grid ─────────────────────────────────────────────── */
.stats-grid {
  display: grid; gap: 20px;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  margin-bottom: 28px;
}
.stat-card {
  background: var(--white); border-radius: var(--radius-lg);
  padding: 22px; box-shadow: var(--shadow-card);
  display: flex; align-items: flex-start; gap: 16px;
}
.stat-icon {
  width: 48px; height: 48px; border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.stat-icon.navy  { background: rgba(10,42,94,.1);  color: var(--navy); }
.stat-icon.teal  { background: rgba(13,115,119,.1);color: var(--teal); }
.stat-icon.gold  { background: rgba(200,155,60,.1); color: var(--gold); }
.stat-icon.green { background: var(--success-bg);  color: var(--success); }
.stat-icon.red   { background: var(--danger-bg);   color: var(--danger); }
.stat-value {
  font-family: var(--font-display); font-size: 2rem; font-weight: 800;
  color: var(--navy); line-height: 1;
}
.stat-label { font-size: 13px; color: var(--gray-400); margin-top: 4px; }

/* ── Table ──────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
thead tr { background: var(--off-white); }
th {
  padding: 12px 16px; text-align: left;
  font-size: 12px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .05em; color: var(--gray-400);
  border-bottom: 1px solid var(--gray-200);
}
td {
  padding: 14px 16px; font-size: 14px;
  border-bottom: 1px solid var(--gray-100);
  vertical-align: middle;
}
tbody tr:hover { background: var(--off-white); }
tbody tr:last-child td { border-bottom: none; }

/* ── Auth pages ─────────────────────────────────────────────── */
.auth-page {
  min-height: 100vh; display: flex;
}
.auth-panel {
  width: 480px; background: var(--white);
  display: flex; flex-direction: column; justify-content: center;
  padding: 48px 52px;
}
.auth-brand {
  margin-bottom: 36px;
}
.auth-brand .app-name {
  font-family: var(--font-display); font-size: 2.4rem;
  font-weight: 800; color: var(--navy);
}
.auth-brand .app-tagline {
  font-size: 14px; color: var(--gray-400); margin-top: 4px;
}
.auth-visual {
  flex: 1; background: linear-gradient(135deg, var(--navy-deep) 0%, var(--navy) 50%, var(--teal) 100%);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 48px; position: relative; overflow: hidden;
}
.auth-visual::before {
  content: ''; position: absolute; inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.03'%3E%3Ccircle cx='30' cy='30' r='20'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}
.auth-visual-content { position: relative; text-align: center; color: var(--white); }
.auth-visual-icon {
  width: 90px; height: 90px; border-radius: var(--radius-xl);
  background: rgba(255,255,255,.1); backdrop-filter: blur(10px);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 24px; font-size: 2.5rem;
}
.auth-visual h2 { font-size: 1.9rem; margin-bottom: 12px; }
.auth-visual p { font-size: 15px; opacity: .7; line-height: 1.7; }
.auth-features { list-style: none; margin-top: 28px; text-align: left; }
.auth-features li {
  display: flex; align-items: center; gap: 10px;
  font-size: 14px; color: rgba(255,255,255,.8); margin-bottom: 10px;
}
.auth-features li::before {
  content: '✓'; display: flex; align-items: center; justify-content: center;
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--teal); color: white; font-size: 11px; font-weight: 700;
  flex-shrink: 0;
}

/* ── Doctor card ─────────────────────────────────────────────── */
.doctor-card {
  background: var(--white); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card); padding: 20px;
  display: flex; gap: 16px; align-items: flex-start;
  transition: var(--transition); cursor: pointer; border: 2px solid transparent;
}
.doctor-card:hover { border-color: var(--teal); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.doctor-card.selected { border-color: var(--navy); }
.doctor-avatar {
  width: 56px; height: 56px; border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--navy), var(--teal));
  display: flex; align-items: center; justify-content: center;
  color: white; font-weight: 700; font-size: 1.2rem; flex-shrink: 0;
}
.doctor-distance {
  font-size: 12px; color: var(--teal); font-weight: 600;
  display: flex; align-items: center; gap: 3px;
}

/* ── Chat ────────────────────────────────────────────────────── */
.chat-window {
  display: flex; flex-direction: column; height: calc(100vh - var(--topbar-h) - 56px);
  background: var(--off-white); border-radius: var(--radius-lg);
  overflow: hidden; box-shadow: var(--shadow-card);
}
.chat-messages { flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 12px; }
.message-bubble {
  max-width: 75%; padding: 12px 16px;
  border-radius: var(--radius-lg); font-size: 14px; line-height: 1.6;
}
.message-bubble.patient { background: var(--navy); color: white; align-self: flex-end; border-bottom-right-radius: 4px; }
.message-bubble.ai      { background: var(--white); color: var(--gray-800); align-self: flex-start; border-bottom-left-radius: 4px; box-shadow: var(--shadow-sm); }
.message-bubble.doctor  { background: var(--teal-pale); color: var(--navy); align-self: flex-start; border-bottom-left-radius: 4px; }
.message-bubble.system  { background: var(--warning-bg); color: var(--warning); align-self: center; font-size: 13px; max-width: 90%; text-align: center; }
.message-time { font-size: 11px; opacity: .55; margin-top: 4px; }
.chat-input-bar {
  padding: 16px 20px; background: var(--white);
  border-top: 1px solid var(--gray-100);
  display: flex; gap: 10px; align-items: flex-end;
}
.chat-input {
  flex: 1; border: 1.5px solid var(--gray-200); border-radius: var(--radius-full);
  padding: 10px 18px; font-size: 14px; outline: none; resize: none;
  max-height: 120px; line-height: 1.5; font-family: var(--font-body);
  transition: var(--transition);
}
.chat-input:focus { border-color: var(--teal); }
.chat-send-btn {
  width: 42px; height: 42px; border-radius: var(--radius-full);
  background: var(--navy); color: white; border: none;
  display: flex; align-items: center; justify-content: center;
  transition: var(--transition); flex-shrink: 0;
}
.chat-send-btn:hover { background: var(--teal); }

/* ── Availability dot ────────────────────────────────────────── */
.avail-dot {
  width: 10px; height: 10px; border-radius: 50%; display: inline-block;
}
.avail-dot.available { background: var(--success); box-shadow: 0 0 0 3px rgba(5,150,105,.2); }
.avail-dot.busy      { background: var(--warning); }
.avail-dot.off_duty  { background: var(--gray-400); }

/* ── Step progress ───────────────────────────────────────────── */
.step-progress {
  display: flex; align-items: center; gap: 0; margin-bottom: 32px;
}
.step {
  display: flex; flex-direction: column; align-items: center;
  flex: 1; position: relative;
}
.step:not(:last-child)::after {
  content: ''; position: absolute; top: 16px; left: 50%;
  width: 100%; height: 2px; background: var(--gray-200); z-index: 0;
}
.step.done::after  { background: var(--teal); }
.step-circle {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--gray-200); color: var(--gray-400);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; position: relative; z-index: 1;
  transition: var(--transition);
}
.step.active .step-circle { background: var(--navy); color: white; }
.step.done .step-circle   { background: var(--teal); color: white; }
.step-label { font-size: 11px; color: var(--gray-400); margin-top: 6px; text-align: center; }
.step.active .step-label  { color: var(--navy); font-weight: 600; }

/* ── Utilities ───────────────────────────────────────────────── */
.d-flex   { display: flex; }
.d-grid   { display: grid; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 8px; }  .gap-2 { gap: 12px; } .gap-3 { gap: 16px; }
.mt-1 { margin-top: 8px; }  .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; } .mb-2 { margin-bottom: 16px; } .mb-3 { margin-bottom: 24px; }
.text-muted { color: var(--gray-400); }
.text-navy  { color: var(--navy); }
.text-teal  { color: var(--teal); }
.text-danger{ color: var(--danger); }
.text-success{color: var(--success); }
.text-small { font-size: 13px; }
.text-center{ text-align: center; }
.fw-600 { font-weight: 600; } .fw-700 { font-weight: 700; }
.w-100  { width: 100%; }
.divider { border: none; border-top: 1px solid var(--gray-100); margin: 20px 0; }
.loading-spinner {
  width: 20px; height: 20px; border-radius: 50%;
  border: 2px solid var(--gray-200); border-top-color: var(--teal);
  animation: spin .7s linear infinite; display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Mobile responsive ───────────────────────────────────────── */
@media (max-width: 1024px) {
  .hero { grid-template-columns: 1fr; padding: 100px 24px 60px; gap: 36px; }
  .hero-right { display: none; }
  .hero-h1 { font-size: clamp(2rem, 5vw, 3rem); }
  .container { padding: 0 24px; }
}

@media (max-width: 900px) {
  .nav { padding: 0 20px; }
  .nav-links { gap: 4px; }
}

@media (max-width: 768px) {
  /* Sidebar becomes an off-canvas drawer */
  .sidebar {
    transform: translateX(-100%);
    width: 280px;
    box-shadow: 4px 0 24px rgba(0,0,0,.25);
  }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }

  /* Hamburger */
  .nav-hamburger { display: flex !important; }
  .nav-links {
    display: none;
    position: absolute;
    top: 68px; left: 0; right: 0;
    background: var(--white);
    flex-direction: column;
    padding: 12px 16px;
    gap: 4px;
    border-bottom: 1px solid var(--gray-200);
    box-shadow: 0 8px 24px rgba(0,0,0,.08);
    z-index: 150;
  }
  .nav-links.open { display: flex; }
  .nav-pill, .nav-links .btn-primary, .nav-links .btn-ghost {
    width: 100%; text-align: center; border-radius: var(--radius-md);
    padding: 12px 16px; font-size: 14px;
  }

  /* Auth pages */
  .auth-page { flex-direction: column; }
  .auth-panel { width: 100%; padding: 28px 20px; min-height: auto; }
  .auth-visual { display: none; }
  .auth-panel { background: var(--off-white); }
  .page-content { padding: 16px; }
  .topbar { padding: 0 16px; }
  .topbar-title { font-size: 1rem; }

  /* Stats */
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
  .stat-card { padding: 16px; }
  .stat-value { font-size: 1.5rem; }

  /* Tables */
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  table { min-width: 600px; }

  /* Forms */
  .form-control { font-size: 16px; /* prevents iOS zoom */ }

  /* Buttons */
  .btn { width: 100%; justify-content: center; }
  .btn-lg { padding: 14px 20px; font-size: 15px; }

  /* Cards */
  .card { border-radius: var(--radius-md); }

  /* Chat */
  .chat-window { height: calc(100vh - 56px - 130px); }
  .message-bubble { max-width: 88%; }

  /* Hero */
  .hero { padding: 80px 20px 50px; }
  .hero-h1 { font-size: clamp(1.8rem, 6vw, 2.4rem); }
  .hero-sub { font-size: 0.95rem; max-width: 100%; }
  .hero-actions { flex-direction: column; align-items: stretch; gap: 10px; }
  .hero-actions .btn { width: 100%; justify-content: center; }

  /* Footer */
  .footer { padding: 24px 20px; flex-direction: column; text-align: center; }
  .footer-links { flex-wrap: wrap; justify-content: center; }

  /* Admin panels */
  .reg-card-body { padding: 20px; }
  .two-col { grid-template-columns: 1fr; }
  .step-indicator { font-size: 10px; }

  /* Sidebar overlay */
  .sidebar-overlay {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,.45);
    z-index: 99;
  }
  .sidebar-overlay.active { display: block; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .stat-card { flex-direction: row; align-items: center; }
  .stat-value { font-size: 1.3rem; }
  .hero-trust { flex-direction: column; align-items: flex-start; gap: 10px; }
  .topbar { height: 56px; }
  .page-content { padding: 12px; }
  .btn { font-size: 14px; padding: 12px 16px; }
}

/* ── Sidebar overlay (mobile) ────────────────────────────────── */
.sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 99;
}
.sidebar-overlay.active { display: block; }

/* ── Hamburger button (hidden on desktop) ─────────────────────── */
.nav-hamburger {
  display: none;
  flex-direction: column; gap: 5px;
  background: none; border: none; padding: 8px; cursor: pointer;
}
.nav-hamburger span {
  display: block; width: 24px; height: 2px;
  background: var(--navy); border-radius: 2px;
  transition: all .3s;
}
.nav-hamburger.active span:nth-child(1) { transform: rotate(45deg) translate(5px, 5px); }
.nav-hamburger.active span:nth-child(2) { opacity: 0; }
.nav-hamburger.active span:nth-child(3) { transform: rotate(-45deg) translate(5px, -5px); }

/* ── Patient sidebar mobile toggle ────────────────────────────── */
.sidebar-mobile-toggle { display: none; position: fixed; top: 12px; left: 12px; z-index: 110; background: var(--navy); color: white; border: none; border-radius: var(--radius-md); padding: 10px 12px; cursor: pointer; box-shadow: var(--shadow-md); }
.sidebar-mobile-toggle svg { width: 22px; height: 22px; display: block; }

@media (max-width: 768px) {
  .sidebar-mobile-toggle { display: block; }
}

/* ── iOS safe-area padding ───────────────────────────────────── */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  .chat-input-bar { padding-bottom: calc(16px + env(safe-area-inset-bottom)); }
  .footer { padding-bottom: calc(24px + env(safe-area-inset-bottom)); }
}

/* ── Prevent text selection ── */
body {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
}

/* ── Allow selection only in input fields ── */
input, textarea, select {
    -webkit-user-select: text !important;
    -moz-user-select: text !important;
    -ms-user-select: text !important;
    user-select: text !important;
}

/* ── Prevent image dragging ── */
img {
    -webkit-user-drag: none;
    -khtml-user-drag: none;
    -moz-user-drag: none;
    -o-user-drag: none;
    user-drag: none;
    pointer-events: none;
}

/* ── Prevent selection on code blocks ── */
pre, code {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}