/* ═══════════════════════════════════════════════════════
   MEDAI — Complete Design System
   Font: Sora (headings) + DM Sans (body)
   Theme: Clinical modern with warm accents
═══════════════════════════════════════════════════════ */

:root {
  --primary: #0f7fdb;
  --primary-dark: #0a65b5;
  --primary-light: #e8f4fd;
  --accent: #00c89e;
  --accent-light: #e6fff9;
  --danger: #ef4444;
  --warning: #f59e0b;
  --success: #10b981;
  --text: #0f172a;
  --text-2: #475569;
  --text-3: #94a3b8;
  --border: #e2e8f0;
  --bg: #f8fafd;
  --bg-2: #ffffff;
  --sidebar-w: 260px;
  --topbar-h: 60px;
  --radius: 14px;
  --radius-sm: 8px;
  --shadow: 0 2px 16px rgba(15,127,219,0.08);
  --shadow-lg: 0 8px 40px rgba(15,127,219,0.14);
}

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

html { font-size: 15px; scroll-behavior: smooth; }

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}

h1,h2,h3,h4 { font-family: 'Sora', sans-serif; }
strong { font-weight: 600; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── SCROLLBAR ─────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 99px; }

/* ═══════════════════════════════════════════════════════
   AUTH MODAL
═══════════════════════════════════════════════════════ */
.auth-overlay {
  position: fixed; inset: 0; z-index: 1000;
  background: linear-gradient(135deg, #0f172a 0%, #0f4c8a 60%, #0f172a 100%);
  display: flex; align-items: center; justify-content: center; padding: 16px;
}

.auth-modal {
  background: #fff;
  border-radius: 24px;
  padding: 40px 36px;
  width: 100%; max-width: 420px;
  box-shadow: var(--shadow-lg);
  animation: fadeUp .4s ease;
}

@keyframes fadeUp { from { opacity:0; transform: translateY(20px); } to { opacity:1; transform:none; } }

.auth-logo {
  display: flex; align-items: center; gap: 12px;
  font-family: 'Sora', sans-serif; font-size: 26px; font-weight: 700; color: var(--text);
  margin-bottom: 6px;
}
.auth-logo-icon {
  width: 44px; height: 44px; border-radius: 12px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  display: flex; align-items: center; justify-content: center;
  color: white; font-size: 20px;
}
.auth-tagline { color: var(--text-2); font-size: 14px; margin-bottom: 24px; }

.auth-tabs { display: flex; background: var(--bg); border-radius: 10px; padding: 4px; margin-bottom: 24px; }
.auth-tab { flex: 1; padding: 9px; border: none; background: none; border-radius: 8px; cursor: pointer; font-family: 'DM Sans',sans-serif; font-size: 14px; font-weight: 500; color: var(--text-2); transition: all .2s; }
.auth-tab.active { background: white; color: var(--primary); box-shadow: 0 1px 6px rgba(0,0,0,.1); }

.auth-field { margin-bottom: 16px; }
.auth-field label { display: block; font-size: 13px; font-weight: 500; color: var(--text-2); margin-bottom: 6px; }
.auth-field input { width: 100%; padding: 11px 14px; border: 1.5px solid var(--border); border-radius: 10px; font-family: 'DM Sans',sans-serif; font-size: 14px; color: var(--text); transition: border .2s; outline: none; }
.auth-field input:focus { border-color: var(--primary); }

.auth-btn { width: 100%; padding: 12px; background: linear-gradient(135deg, var(--primary), var(--primary-dark)); color: white; border: none; border-radius: 10px; font-family: 'Sora',sans-serif; font-size: 15px; font-weight: 600; cursor: pointer; transition: all .2s; margin-bottom: 10px; }
.auth-btn:hover { transform: translateY(-1px); box-shadow: 0 4px 16px rgba(15,127,219,.35); }

.auth-guest-btn { width: 100%; padding: 11px; background: none; border: 1.5px solid var(--border); border-radius: 10px; color: var(--text-2); font-family: 'DM Sans',sans-serif; font-size: 14px; cursor: pointer; transition: all .2s; }
.auth-guest-btn:hover { background: var(--bg); border-color: var(--text-2); }

.auth-error { background: #fef2f2; border: 1px solid #fecaca; color: #dc2626; padding: 10px 14px; border-radius: 8px; font-size: 13px; margin-bottom: 12px; }
.auth-success { background: #f0fdf4; border: 1px solid #bbf7d0; color: #16a34a; padding: 10px 14px; border-radius: 8px; font-size: 13px; margin-bottom: 12px; }
.auth-footer-note { text-align: center; font-size: 12px; color: var(--text-3); margin-top: 16px; }

/* ═══════════════════════════════════════════════════════
   LAYOUT
═══════════════════════════════════════════════════════ */
.mobile-topbar { display: none; }
.sidebar-overlay { display: none; position: fixed; inset: 0; z-index: 199; background: rgba(0,0,0,.4); }
.sidebar-overlay.open { display: block; }

/* ── SIDEBAR ───────────────────────────────────────── */
.sidebar {
  position: fixed; top: 0; left: 0; height: 100vh; height: 100dvh; width: var(--sidebar-w);
  background: #0f172a;
  display: flex; flex-direction: column;
  z-index: 200; overflow-y: auto; overflow-x: hidden;
  transition: transform .3s cubic-bezier(.4,0,.2,1);
}

.sidebar-brand {
  display: flex; align-items: center; gap: 12px; padding: 22px 20px 18px;
  border-bottom: 1px solid rgba(255,255,255,.07);
}
.brand-logo { width: 36px; height: 36px; border-radius: 10px; background: linear-gradient(135deg, var(--primary), var(--accent)); display: flex; align-items: center; justify-content: center; color: white; font-size: 16px; flex-shrink: 0; }
.brand-text { font-family: 'Sora',sans-serif; font-size: 20px; font-weight: 700; color: white; }
.brand-text strong { color: var(--accent); }
.sidebar-close { display: none; margin-left: auto; background: none; border: none; color: rgba(255,255,255,.5); font-size: 18px; cursor: pointer; padding: 4px; }

.sidebar-user { padding: 14px 16px; border-bottom: 1px solid rgba(255,255,255,.08); display: flex; align-items: center; gap: 12px; background: rgba(255,255,255,.04); }
.sidebar-user-avatar { position: relative; width: 46px; height: 46px; border-radius: 14px; background: linear-gradient(135deg, rgba(15,127,219,.6), rgba(0,200,158,.5)); display: flex; align-items: center; justify-content: center; color: white; font-size: 19px; flex-shrink: 0; overflow: hidden; border: 2px solid rgba(255,255,255,.18); box-shadow: 0 2px 8px rgba(0,0,0,.25); }
.avatar-edit-badge { position: absolute; bottom: -1px; right: -1px; width: 16px; height: 16px; background: var(--accent); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 7px; color: white; }
.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-username { font-size: 13.5px; font-weight: 700; color: white; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; letter-spacing: 0.1px; }
.sidebar-email { font-size: 10.5px; color: rgba(255,255,255,.38); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-badge { display: inline-flex; align-items: center; gap: 4px; background: rgba(15,127,219,.25); border: 1px solid rgba(15,127,219,.4); border-radius: 99px; padding: 2px 8px; font-size: 9.5px; font-weight: 700; color: #7dd3fc; margin-top: 3px; letter-spacing: 0.3px; }

.sidebar-nav { flex: 1; padding: 10px 10px; overflow-y: auto; }
.nav-group-label { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: rgba(255,255,255,.3); padding: 14px 10px 6px; }

.nav-btn {
  width: 100%; display: flex; align-items: center; gap: 10px; padding: 9px 12px; border: none;
  background: none; color: rgba(255,255,255,.6); border-radius: 10px; cursor: pointer;
  font-family: 'DM Sans',sans-serif; font-size: 13.5px; font-weight: 500; text-align: left;
  transition: all .18s; position: relative; margin-bottom: 1px;
}
.nav-btn i { width: 18px; font-size: 14px; flex-shrink: 0; }
.nav-btn span { flex: 1; }
.nav-btn:hover { background: rgba(255,255,255,.07); color: white; }
.nav-btn.active { background: linear-gradient(135deg, rgba(15,127,219,.35), rgba(0,200,158,.15)); color: white; }
.nav-btn.active i { color: var(--accent); }
.nav-indicator { width: 3px; height: 16px; border-radius: 2px; background: var(--accent); display: none; }
.nav-btn.active .nav-indicator { display: block; }

.sidebar-footer { padding: 14px; border-top: 1px solid rgba(255,255,255,.07); flex-shrink: 0; }
.logout-btn { width: 100%; padding: 9px 14px; background: rgba(239,68,68,.12); border: 1px solid rgba(239,68,68,.25); color: #f87171; border-radius: 10px; cursor: pointer; font-family: 'DM Sans',sans-serif; font-size: 13px; font-weight: 600; transition: all .2s; margin-bottom: 10px; }
.logout-btn:hover { background: rgba(239,68,68,.2); }
.sidebar-disclaimer { font-size: 11px; color: rgba(255,255,255,.3); line-height: 1.5; }

/* ── MAIN CONTENT ──────────────────────────────────── */
.main-content {
  margin-left: var(--sidebar-w);
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.top-header {
  position: sticky; top: 0; z-index: 100;
  height: var(--topbar-h); background: white; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; padding: 0 24px;
  box-shadow: 0 1px 0 var(--border);
}
.header-left { display: flex; align-items: center; gap: 14px; }
.hamburger { display: none; background: none; border: none; font-size: 18px; cursor: pointer; color: var(--text-2); padding: 6px; border-radius: 8px; }
.hamburger:hover { background: var(--bg); }
.header-title { font-family: 'Sora',sans-serif; font-size: 16px; font-weight: 600; color: var(--text); }
.header-right { display: flex; align-items: center; gap: 12px; }
.header-badge { display: flex; align-items: center; gap: 6px; background: var(--primary-light); color: var(--primary); padding: 5px 12px; border-radius: 99px; font-size: 12px; font-weight: 600; transition: all .3s; }
.header-avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--primary-light); display: flex; align-items: center; justify-content: center; color: var(--primary); font-size: 14px; overflow: hidden; }

.disclaimer-bar { background: linear-gradient(90deg, #fffbeb, #fef9ec); border-bottom: 1px solid #fde68a; padding: 8px 24px; font-size: 12.5px; color: #92400e; }

/* ── SECTIONS ──────────────────────────────────────── */
.section { display: none; flex: 1; padding: 28px 24px; animation: fadeSection .25s ease; overflow-y: auto; min-height: 0; }
.section.active { display: block; overflow-y: auto; }
.section#section-chat { padding: 0 !important; }
.section#section-chat.active { display: flex; flex-direction: column; overflow: hidden; flex: 1; min-height: 0; }
@keyframes fadeSection { from { opacity:0; transform:translateY(8px); } to { opacity:1; transform:none; } }

/* ── PAGE CARD ─────────────────────────────────────── */
.page-card { background: white; border-radius: var(--radius); padding: 32px; border: 1px solid var(--border); max-width: 720px; box-shadow: var(--shadow); }
.page-card.wide { max-width: 100%; }
.page-card-header { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 28px; }
.page-card-header > i { font-size: 22px; color: var(--primary); width: 44px; height: 44px; background: var(--primary-light); border-radius: 12px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.page-card-header h2 { font-size: 20px; font-weight: 700; color: var(--text); margin-bottom: 4px; }
.page-card-header p { font-size: 13.5px; color: var(--text-2); }

/* ── FORMS ─────────────────────────────────────────── */
.form-group { margin-bottom: 18px; }
.form-group label { display: block; font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.form-group input, .form-group textarea, .form-group select {
  width: 100%; padding: 10px 14px; border: 1.5px solid var(--border); border-radius: 10px;
  font-family: 'DM Sans',sans-serif; font-size: 14px; color: var(--text); background: white;
  transition: border .2s; outline: none; resize: vertical;
}
.form-group input:focus, .form-group textarea:focus, .form-group select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(15,127,219,.08); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.input-row { display: flex; gap: 10px; }
.input-row input { flex: 1; }
.field-hint { font-size: 12px; color: var(--text-3); margin-top: 5px; }
.required { color: var(--danger); }
.optional { font-size: 12px; color: var(--text-3); font-weight: 400; }

.input-with-toggle { position: relative; }
.input-with-toggle input { padding-right: 44px; }
.toggle-visibility { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); background: none; border: none; color: var(--text-3); cursor: pointer; font-size: 14px; }

/* ── BUTTONS ───────────────────────────────────────── */
.primary-btn { display: inline-flex; align-items: center; gap: 8px; padding: 10px 22px; background: linear-gradient(135deg, var(--primary), var(--primary-dark)); color: white; border: none; border-radius: 10px; font-family: 'Sora',sans-serif; font-size: 14px; font-weight: 600; cursor: pointer; transition: all .2s; }
.primary-btn:hover { transform: translateY(-1px); box-shadow: 0 4px 16px rgba(15,127,219,.3); }
.primary-btn:active { transform: none; }
.danger-btn { display: inline-flex; align-items: center; gap: 8px; padding: 10px 22px; background: none; border: 1.5px solid var(--danger); color: var(--danger); border-radius: 10px; font-family: 'Sora',sans-serif; font-size: 14px; font-weight: 600; cursor: pointer; transition: all .2s; }
.danger-btn:hover { background: #fef2f2; }
.outline-btn { display: inline-flex; align-items: center; gap: 8px; padding: 8px 18px; background: none; border: 1.5px solid var(--border); color: var(--text-2); border-radius: 10px; font-family: 'DM Sans',sans-serif; font-size: 13px; font-weight: 500; cursor: pointer; transition: all .2s; }
.outline-btn:hover { background: var(--bg); border-color: var(--text-2); }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }

/* ── RESULT BOX ────────────────────────────────────── */
.result-box { margin-top: 20px; padding: 18px 20px; background: var(--bg); border: 1px solid var(--border); border-radius: 12px; font-size: 14px; line-height: 1.7; white-space: pre-wrap; display: none; }
.result-box.visible { display: block; animation: fadeUp .3s ease; }
.result-box.error { background: #fef2f2; border-color: #fecaca; color: #dc2626; }
.result-box.success { background: #f0fdf4; border-color: #bbf7d0; color: #166534; }

/* ── QUICK TAGS ────────────────────────────────────── */
.quick-tags { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 16px; }
.quick-tags span { font-size: 12px; font-weight: 600; color: var(--text-2); }
.quick-tags button { padding: 5px 12px; background: var(--bg); border: 1px solid var(--border); border-radius: 99px; font-size: 12px; font-weight: 500; color: var(--text-2); cursor: pointer; transition: all .2s; }
.quick-tags button:hover { background: var(--primary-light); color: var(--primary); border-color: var(--primary); }

.works-with-chips { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 16px; }
.works-with-chips span:first-child { font-size: 12px; font-weight: 600; color: var(--text-2); }
.chip { background: var(--accent-light); color: #047857; border-radius: 99px; padding: 3px 10px; font-size: 12px; font-weight: 500; }

/* ── UPLOAD ZONE ───────────────────────────────────── */
.upload-zone { border: 2px dashed var(--border); border-radius: 14px; cursor: pointer; transition: all .2s; background: var(--bg); }
.upload-zone:hover { border-color: var(--primary); background: var(--primary-light); }
.upload-zone-inner { padding: 36px; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.upload-zone-inner i { font-size: 36px; color: var(--text-3); }
.upload-zone-inner p { font-size: 15px; font-weight: 500; color: var(--text-2); }
.upload-zone-inner span { font-size: 12px; color: var(--text-3); }
.upload-preview-img { max-width: 100%; max-height: 280px; border-radius: 12px; border: 2px solid var(--border); }

/* ── INFO BOXES ────────────────────────────────────── */
.info-box { border-radius: 12px; padding: 16px 18px; margin-bottom: 20px; }
.info-box.blue { background: #eff6ff; border: 1px solid #bfdbfe; }
.info-box.green { background: #f0fdf4; border: 1px solid #bbf7d0; }
.info-box.yellow { background: #fffbeb; border: 1px solid #fde68a; }
.info-box-title { font-weight: 700; font-size: 13.5px; color: var(--text); margin-bottom: 8px; display: flex; align-items: center; gap: 7px; }
.info-box.blue .info-box-title { color: #1e40af; }
.info-box.green .info-box-title { color: #166534; }
.info-box.yellow .info-box-title { color: #92400e; }
.info-steps { padding-left: 18px; font-size: 13px; color: var(--text-2); line-height: 2.1; }
.info-steps code { background: rgba(0,0,0,.06); padding: 1px 6px; border-radius: 4px; font-family: monospace; font-size: 12px; }

/* ─── TAB BAR ──────────────────────────────────────── */
.tab-bar { display: flex; gap: 4px; background: var(--bg); border-radius: 12px; padding: 4px; }
.tab-btn { flex: 1; padding: 9px 14px; border: none; background: none; border-radius: 8px; font-family: 'DM Sans',sans-serif; font-size: 13px; font-weight: 500; color: var(--text-2); cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 7px; transition: all .2s; }
.tab-btn.active { background: white; color: var(--primary); box-shadow: 0 1px 6px rgba(0,0,0,.08); font-weight: 600; }

/* ─── HISTORY ITEMS ────────────────────────────────── */
.history-item { background: white; border: 1px solid var(--border); border-radius: 12px; padding: 16px; margin-bottom: 12px; }
.history-meta { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.history-role { font-size: 11px; font-weight: 700; padding: 2px 9px; border-radius: 99px; }
.history-role.user { background: var(--primary-light); color: var(--primary); }
.history-role.assistant { background: var(--accent-light); color: #047857; }
.history-time { font-size: 11px; color: var(--text-3); }
.history-content { font-size: 13.5px; color: var(--text-2); line-height: 1.6; }

/* ─── BMI SCALE ────────────────────────────────────── */
.bmi-scale { margin-top: 24px; }
.bmi-scale h4 { font-size: 13px; font-weight: 600; color: var(--text-2); margin-bottom: 10px; }
.bmi-bar { display: flex; border-radius: 10px; overflow: hidden; }
.bmi-segment { flex: 1; padding: 10px 6px; text-align: center; font-size: 11px; font-weight: 600; line-height: 1.4; }
.bmi-segment.underweight { background: #bfdbfe; color: #1e40af; }
.bmi-segment.normal { background: #bbf7d0; color: #166534; }
.bmi-segment.overweight { background: #fde68a; color: #92400e; }
.bmi-segment.obese { background: #fecaca; color: #991b1b; }

/* ─── PROFILE PIC ──────────────────────────────────── */
.profile-pic-section { display: flex; align-items: center; gap: 24px; margin-bottom: 28px; padding: 20px; background: var(--bg); border-radius: 14px; }
.profile-pic-wrapper { flex-shrink: 0; }
.profile-pic-circle { position: relative; width: 88px; height: 88px; border-radius: 50%; background: var(--primary-light); display: flex; align-items: center; justify-content: center; cursor: pointer; overflow: hidden; border: 3px solid white; box-shadow: 0 0 0 3px var(--primary); }
.profile-pic-overlay { position: absolute; inset: 0; background: rgba(0,0,0,.5); display: none; align-items: center; justify-content: center; color: white; font-size: 12px; font-weight: 600; flex-direction: column; gap: 4px; }
.profile-pic-circle:hover .profile-pic-overlay { display: flex; }
.profile-pic-info h3 { font-size: 18px; font-weight: 700; margin-bottom: 4px; }
.profile-pic-info p { font-size: 13px; color: var(--text-2); margin-bottom: 12px; }

/* ─── CHECKBOX GROUP ───────────────────────────────── */
.checkbox-group { display: flex; flex-direction: column; gap: 12px; }
.checkbox-item { display: flex; align-items: center; gap: 10px; cursor: pointer; font-size: 14px; color: var(--text); }
.checkbox-item input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--primary); cursor: pointer; }

/* ─── SHARE LINK BOX ───────────────────────────────── */
.share-link-box { display: flex; align-items: center; gap: 10px; background: var(--bg); border: 1.5px solid var(--border); border-radius: 12px; padding: 12px 16px; margin-top: 12px; }
.share-link-url { flex: 1; font-size: 13px; color: var(--primary); font-family: monospace; word-break: break-all; }
.copy-link-btn { background: var(--primary); color: white; border: none; padding: 7px 14px; border-radius: 8px; font-size: 13px; font-weight: 600; cursor: pointer; white-space: nowrap; transition: all .2s; }
.copy-link-btn:hover { background: var(--primary-dark); }

/* ─── HOW TO USE ───────────────────────────────────── */
.howto-steps { display: flex; flex-direction: column; gap: 0; }
.howto-step { display: flex; gap: 20px; padding: 24px 0; border-bottom: 1px solid var(--border); }
.howto-step:last-child { border-bottom: none; }
.howto-step-num { width: 36px; height: 36px; border-radius: 50%; background: linear-gradient(135deg, var(--primary), var(--accent)); color: white; font-family: 'Sora',sans-serif; font-weight: 700; font-size: 16px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.howto-step-content h3 { font-size: 16px; font-weight: 700; margin-bottom: 6px; }
.howto-step-content p { font-size: 14px; color: var(--text-2); line-height: 1.6; }

/* ─── ABOUT ────────────────────────────────────────── */
.about-hero { text-align: center; padding: 32px 0 40px; }
.about-logo { width: 72px; height: 72px; border-radius: 20px; background: linear-gradient(135deg, var(--primary), var(--accent)); display: flex; align-items: center; justify-content: center; margin: 0 auto 16px; font-size: 32px; color: white; }
.about-hero h1 { font-size: 32px; font-weight: 700; margin-bottom: 8px; }
.about-hero h1 strong { color: var(--accent); }
.about-hero p { font-size: 16px; color: var(--text-2); }
.about-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; margin-bottom: 32px; }
.about-card { background: var(--bg); border: 1px solid var(--border); border-radius: 14px; padding: 20px; }
.about-card-icon { width: 44px; height: 44px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 18px; margin-bottom: 12px; }
.about-card h3 { font-size: 15px; font-weight: 700; margin-bottom: 6px; }
.about-card p { font-size: 13px; color: var(--text-2); line-height: 1.6; }
.about-disclaimer { display: flex; gap: 14px; background: #fffbeb; border: 1px solid #fde68a; border-radius: 14px; padding: 20px; font-size: 13px; color: #92400e; }
.about-disclaimer i { font-size: 20px; flex-shrink: 0; margin-top: 2px; }
.about-disclaimer p { margin-top: 6px; line-height: 1.6; }

/* ─── PRIVACY ──────────────────────────────────────── */
.privacy-section { margin-bottom: 28px; padding-bottom: 28px; border-bottom: 1px solid var(--border); }
.privacy-section:last-child { border-bottom: none; }
.privacy-section h3 { font-size: 15px; font-weight: 700; margin-bottom: 8px; display: flex; align-items: center; gap: 8px; color: var(--text); }
.privacy-section h3 i { color: var(--primary); }
.privacy-section p { font-size: 13.5px; color: var(--text-2); line-height: 1.7; }

/* ═══════════════════════════════════════════════════════
   CHAT UI — NEW MODERN DESIGN
   iMessage-inspired. Bulletproof iOS + Android layout.
   Layout chain:
     section-chat.active  →  display:flex, flex-direction:column
     chat-container       →  flex:1 1 0, overflow:hidden
     chat-messages        →  flex:1 1 0, overflow-y:auto  (ONLY scroll zone)
     chat-input-area      →  flex:0 0 auto               (NEVER moves)
═══════════════════════════════════════════════════════ */

/* ── Chat container ── */
.chat-container {
  display: flex;
  flex-direction: column;
  flex: 1 1 0;
  min-height: 0;
  width: 100%;
  background: #f0f4f8;
  overflow: hidden;
  position: relative;
}

/* ── Messages scroll zone — the ONLY element that scrolls ── */
.chat-messages {
  flex: 1 1 0;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 16px 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
  scroll-behavior: smooth;
}
.chat-messages::-webkit-scrollbar { width: 3px; }
.chat-messages::-webkit-scrollbar-thumb { background: rgba(0,0,0,.1); border-radius: 3px; }

/* ── Message rows ── */
.message {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  animation: msgIn .2s ease;
  max-width: 100%;
}
@keyframes msgIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}
.user-message { flex-direction: row-reverse; }

/* ── Avatars ── */
.message-avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; flex-shrink: 0;
  margin-bottom: 2px;
}
.bot-message .message-avatar {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: white;
  box-shadow: 0 2px 8px rgba(15,127,219,.25);
}
.user-message .message-avatar {
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: white;
}

/* ── Bubbles ── */
.message-content {
  max-width: 72%;
  padding: 10px 14px;
  font-size: 14px;
  line-height: 1.65;
  word-break: break-word;
  position: relative;
}
.bot-message .message-content {
  background: white;
  border: 1px solid #e4eaf2;
  border-radius: 4px 18px 18px 18px;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
  color: #1a2332;
}
.user-message .message-content {
  background: linear-gradient(135deg, #0f7fdb, #0a5fc4);
  color: white;
  border-radius: 18px 4px 18px 18px;
  border: none;
  box-shadow: 0 2px 10px rgba(15,127,219,.28);
}
.user-message .message-content p,
.user-message .message-content li { color: rgba(255,255,255,.95); }
.user-message .message-content a { color: rgba(255,255,255,.8); }
.user-message .message-content strong { color: white; }

/* ── Typing indicator ── */
.typing-indicator {
  display: flex; gap: 4px; align-items: center;
  padding: 12px 14px;
  background: white;
  border-radius: 4px 18px 18px 18px;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
  width: fit-content;
}
.typing-dot {
  width: 7px; height: 7px;
  background: #94a3b8; border-radius: 50%;
  animation: typingBounce 1.2s infinite;
}
.typing-dot:nth-child(2) { animation-delay: .2s; }
.typing-dot:nth-child(3) { animation-delay: .4s; }
@keyframes typingBounce {
  0%, 60%, 100% { transform: translateY(0); opacity: .5; }
  30% { transform: translateY(-5px); opacity: 1; }
}

/* ── Quick suggestion chips ── */
.quick-questions {
  display: flex; flex-wrap: wrap;
  gap: 7px; padding: 8px 16px 6px;
  flex-shrink: 0;
  background: #f0f4f8;
}
.quick-questions button {
  padding: 7px 13px;
  background: white;
  border: 1.5px solid #dde3ea;
  border-radius: 20px;
  font-size: 12.5px; color: #4a5568;
  cursor: pointer;
  font-family: 'DM Sans', sans-serif;
  transition: all .15s;
  white-space: nowrap;
  display: flex; align-items: center; gap: 5px;
  box-shadow: 0 1px 3px rgba(0,0,0,.05);
  -webkit-tap-highlight-color: transparent;
}
.quick-questions button:hover,
.quick-questions button:active {
  background: var(--primary-light);
  color: var(--primary);
  border-color: var(--primary);
}

/* ── Chat controls ── */
.chat-controls { padding: 2px 16px 4px; flex-shrink: 0; background: #f0f4f8; }
.clear-chat-btn {
  background: none; border: none;
  color: #94a3b8; font-size: 12px; cursor: pointer;
  display: flex; align-items: center; gap: 5px;
  padding: 4px 8px; border-radius: 6px;
  font-family: 'DM Sans', sans-serif;
  transition: all .15s;
}
.clear-chat-btn:hover { color: var(--danger); background: #fef2f2; }

/* ── Image preview bar ── */
.chat-preview-bar { flex-shrink: 0; padding: 8px 14px; background: white; border-top: 1px solid #e4eaf2; }
.chat-preview-inner { display: flex; align-items: center; gap: 10px; }
.chat-preview-thumb { width: 46px; height: 46px; object-fit: cover; border-radius: 8px; border: 2px solid #e2e8f0; }
.chat-preview-name { font-size: 12px; font-weight: 600; color: var(--text); }
.chat-preview-sub { font-size: 11px; color: var(--text-3); margin-top: 1px; }
.chat-preview-remove { background: none; border: none; color: var(--danger); font-size: 18px; cursor: pointer; margin-left: auto; padding: 4px; }

/* ── Input footer — ANCHORED TO BOTTOM, NEVER MOVES ── */
.chat-input-area {
  flex: 0 0 auto;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 10px 12px 12px;
  background: white;
  border-top: 1px solid #e4eaf2;
  box-shadow: 0 -2px 12px rgba(0,0,0,.07);
  position: relative;
  z-index: 50;
  /* iOS safe area — home indicator & Dynamic Island */
  padding-bottom: max(12px, env(safe-area-inset-bottom, 12px));
  /* Landscape safe area */
  padding-left: max(12px, env(safe-area-inset-left, 12px));
  padding-right: max(12px, env(safe-area-inset-right, 12px));
}

/* ── Attach button ── */
.attach-wrapper { position: relative; flex-shrink: 0; }
.attach-btn {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: #f1f5f9; border: none;
  color: #64748b;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: all .15s; font-size: 16px;
  -webkit-tap-highlight-color: transparent;
}
.attach-btn:hover, .attach-btn.active { background: var(--primary); color: white; }
.attach-menu {
  position: absolute; bottom: 48px; left: 0;
  background: white; border: 1px solid #e2e8f0;
  border-radius: 14px; padding: 6px;
  box-shadow: 0 8px 28px rgba(0,0,0,.13);
  min-width: 176px; z-index: 200;
}
.attach-option {
  width: 100%; padding: 10px 14px;
  background: none; border: none;
  text-align: left; cursor: pointer;
  font-size: 13.5px; color: var(--text);
  font-family: 'DM Sans', sans-serif;
  border-radius: 9px;
  display: flex; align-items: center; gap: 10px;
  transition: background .12s;
}
.attach-option:hover { background: #f8fafc; }

/* ── Text input ── */
#chat-input {
  flex: 1;
  padding: 10px 14px;
  border: 1.5px solid #dde3ea;
  border-radius: 22px;
  font-family: 'DM Sans', sans-serif;
  font-size: 15px;
  resize: none; outline: none;
  min-height: 42px; max-height: 120px;
  line-height: 1.5;
  background: #f8fafc;
  color: #1a2332;
  transition: border .18s, background .18s, box-shadow .18s;
  -webkit-appearance: none;
  appearance: none;
}
#chat-input:focus {
  border-color: var(--primary);
  background: white;
  box-shadow: 0 0 0 3px rgba(15,127,219,.1);
}
#chat-input::placeholder { color: #94a3b8; }

/* ── Send button ── */
.send-btn {
  width: 40px; height: 40px;
  background: linear-gradient(135deg, var(--primary), #0a5fc4);
  color: white; border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: all .2s;
  font-size: 15px;
  box-shadow: 0 3px 10px rgba(15,127,219,.35);
  -webkit-tap-highlight-color: transparent;
}
.send-btn:hover { transform: scale(1.07); box-shadow: 0 5px 16px rgba(15,127,219,.45); }
.send-btn:active { transform: scale(.94); }

/* ── Media in chat ── */
.chat-image-bubble { max-width: 220px; border-radius: 14px; display: block; margin-bottom: 6px; }
.chat-pdf-badge { background: #fef2f2; border: 1px solid #fecaca; border-radius: 10px; padding: 8px 12px; font-size: 12px; color: #b91c1c; display: inline-flex; align-items: center; gap: 6px; margin-bottom: 8px; }

/* ═══════════════════════════════════════════════════════
   LOADING
═══════════════════════════════════════════════════════ */
.loading-overlay { position: fixed; inset: 0; z-index: 9999; background: rgba(15,23,42,.5); backdrop-filter: blur(4px); display: none; align-items: center; justify-content: center; }
.loading-overlay.active { display: flex; }
.loading-card { background: white; border-radius: 20px; padding: 32px 40px; text-align: center; box-shadow: var(--shadow-lg); }
.loading-pulse i { font-size: 36px; color: var(--primary); animation: pulse 1s ease-in-out infinite; }
.loading-card p { margin-top: 14px; font-size: 15px; font-weight: 600; color: var(--text-2); }
@keyframes pulse { 0%,100%{ transform: scale(1); opacity: 1; } 50% { transform: scale(1.2); opacity: .7; } }

/* ═══════════════════════════════════════════════════════
   MOBILE BOTTOM NAV
═══════════════════════════════════════════════════════ */
.bottom-nav { display: none; }

/* ═══════════════════════════════════════════════════════
   RESPONSIVE
═══════════════════════════════════════════════════════ */
/* ═══════════════════════════════════════════════════════
   FIX 4: RESPONSIVE — Universal, mobile-first
   Breakpoints: 380 | 480 | 600 | 768 | 900 | 1200 | 1600 | 1800
═══════════════════════════════════════════════════════ */

/* ── TV / Ultra-wide (≥1800px) ───────────────────────── */
@media (min-width: 1800px) {
  :root { --sidebar-w: 300px; }
  html { font-size: 16px; }
  .page-card { max-width: 960px; padding: 48px; }
  .chat-messages { padding: 28px 32px 8px; gap: 16px; }
  .message-content { font-size: 15.5px; max-width: 68%; }
}

/* ── Large desktop (≥1600px) ─────────────────────────── */
@media (min-width: 1600px) {
  :root { --sidebar-w: 280px; }
  html { font-size: 15.5px; }
  .page-card { max-width: 860px; }
  .message-content { max-width: 70%; }
}

/* ── Medium desktop (≤1200px) ────────────────────────── */
@media (max-width: 1200px) {
  :root { --sidebar-w: 230px; }
  .two-col-layout { grid-template-columns: 1fr 260px; gap: 18px; }
  .page-card { max-width: 660px; }
}

/* ── Tablet / small desktop (≤1024px) ──────────────────
   Sidebar collapses to drawer, bottom-nav IN FLOW inside main  */
@media (max-width: 1024px) {
  :root { --sidebar-w: 260px; --bnav-h: 60px; }

  /* main-content is a flex column that fills the viewport exactly.
     top-header → disclaimer → section (flex:1) → bottom-nav (flex:0 0 fixed)
     The bottom-nav is the LAST CHILD inside <main>, so it naturally
     reserves space and chat input can never go behind it. */
  .main-content {
    margin-left: 0;
    height: 100vh;
    height: 100dvh;
    overflow-x: hidden;
    overflow-y: hidden;
    display: flex;
    flex-direction: column;
    padding-bottom: 0;
  }

  /* Kill the footer padding-bottom that pushes main-content off-screen on mobile */
  body { padding-bottom: 0 !important; }

  .top-header { padding: 0 14px; }
  .hamburger  { display: flex; }
  .sidebar    { transform: translateX(-100%); transition: transform .28s cubic-bezier(.4,0,.2,1); }
  .sidebar.open { transform: none; box-shadow: 4px 0 32px rgba(0,0,0,.22); }
  .sidebar-close { display: block; }

  /* Non-chat sections scroll freely */
  .section { padding: 14px 12px 16px; overflow-y: auto; flex: 1; min-height: 0; }

  /* Chat section: flex column filling space between disclaimer and bottom-nav */
  .section#section-chat { padding: 0 !important; overflow: hidden; flex: 1; min-height: 0; display: none; flex-direction: column; }
  .section#section-chat.active { display: flex !important; }

  /* Chat container fills section-chat completely */
  .chat-container {
    flex: 1 1 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  /* Messages: scrolls inside chat-container */
  .chat-messages {
    flex: 1 1 0;
    min-height: 0;
    overflow-y: auto;
    padding: 12px 10px 6px;
    gap: 10px;
  }

  /* Input: always visible, never moves, always above bottom-nav */
  .chat-input-area {
    flex: 0 0 auto;
    padding: 8px 10px 10px;
    position: relative;
    z-index: 50;
    background: white;
    border-top: 1px solid #e4eaf2;
  }

  .disclaimer-bar { font-size: 11.5px; padding: 5px 14px; }

  /* Bottom-nav: flex: 0 0 var(--bnav-h) — never grows, never shrinks,
     always occupies exactly --bnav-h pixels at the bottom of main */
  .bottom-nav {
    display: flex;
    flex: 0 0 var(--bnav-h);
    width: 100%;
    background: white;
    border-top: 1.5px solid var(--border);
    z-index: 150;
    align-items: center;
  }
  .bottom-nav-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    background: none;
    border: none;
    color: var(--text-3);
    font-size: 10px;
    font-family: 'DM Sans', sans-serif;
    font-weight: 500;
    cursor: pointer;
    transition: color .2s;
    height: 100%;
    padding: 0;
  }
  .bottom-nav-btn i    { font-size: 18px; }
  .bottom-nav-btn span { font-size: 10px; line-height: 1; }
  .bottom-nav-btn.active { color: var(--primary); }

  .badge-text  { display: none; }
  .page-card   { padding: 18px 14px; }
  .form-row    { grid-template-columns: 1fr; gap: 0; }
  .about-grid  { grid-template-columns: 1fr; }
  .message-content { max-width: 88%; }
  .two-col-layout  { grid-template-columns: 1fr; gap: 14px; }
  .right-panel     { display: none; }
}

/* ── Tablet portrait (≤768px) ────────────────────────── */
@media (max-width: 768px) {
  .nb-prov-grid     { grid-template-columns: 1fr 1fr; gap: 10px; }
  .nb-prov-card     { padding: 12px 8px; }
  .doctor-tools-grid { grid-template-columns: 1fr 1fr !important; }
  .page-card        { padding: 16px 13px; }
}

/* ── Mobile portrait (≤600px) ────────────────────────── */
@media (max-width: 600px) {
  html { font-size: 14px; }
  .auth-modal  { padding: 24px 18px; }
  .auth-logo   { font-size: 22px; }
  .header-badge {
    font-size: 11px; padding: 4px 8px;
    max-width: 130px; overflow: hidden;
    white-space: nowrap; text-overflow: ellipsis;
  }
  .page-card-header   { flex-direction: column; gap: 10px; }
  .profile-pic-section { flex-direction: column; text-align: center; }
  .message-content    { max-width: 93%; font-size: 13.5px; }
  .chat-messages      { padding: 10px 8px 4px; gap: 8px; }
  /* prevent iOS auto-zoom on focus */
  #chat-input { font-size: 16px !important; }
}

/* ── Small phones (≤480px) ──────────────────────────── */
@media (max-width: 480px) {
  :root { --bnav-h: 50px; }

  .auth-modal { padding: 20px 14px; }
  .page-card  { padding: 12px 10px; border-radius: 10px; }
  .section    { padding: 10px 8px 16px; }

  #current-key-status > div { flex-direction: column !important; align-items: flex-start !important; gap: 8px; }
  #current-key-status { word-break: break-all; overflow-wrap: anywhere; }
  .success-msg, .error-msg { word-break: break-word; font-size: 13px; }

  /* prevent iOS zoom on ALL inputs */
  .form-group input, .form-group textarea, .form-group select,
  #chat-input, .auth-field input, .nb-input { font-size: 16px !important; }

  /* Bottom nav: icon only on very small screens */
  .bottom-nav-btn span { display: none; }
  .bottom-nav-btn i    { font-size: 22px; }

  .nb-card         { padding: 26px 16px; border-radius: 18px; }
  .nb-prov-grid    { grid-template-columns: 1fr 1fr; gap: 7px; }
  .nb-actions      { flex-direction: column; width: 100%; }
  .nb-btn-amber, .nb-btn-primary, .nb-btn-ghost, .nb-google-btn { width: 100%; }
}

/* ── Very small (≤380px) ────────────────────────────── */
@media (max-width: 380px) {
  .header-badge    { display: none; }
  .message-content { max-width: 97%; }
}

/* ── Landscape phones ───────────────────────────────── */
@media (max-width: 1024px) and (orientation: landscape) {
  :root { --bnav-h: 46px; }
  .bottom-nav-btn span { display: none; }
  .chat-messages { padding: 6px 10px 4px; gap: 7px; }
}

/* ── iOS safe area: home indicator padding ── */
@supports (padding: env(safe-area-inset-bottom)) {
  @media (max-width: 1024px) {
    /* bottom-nav absorbs home indicator space via flex-basis */
    .bottom-nav {
      flex-basis: calc(var(--bnav-h) + env(safe-area-inset-bottom, 0px));
      padding-bottom: env(safe-area-inset-bottom, 0px);
    }
    .chat-input-area {
      padding-bottom: max(10px, env(safe-area-inset-bottom, 10px));
    }
  }
}

/* ── PROVIDER CARDS ─────────────────────────────────────── */
.provider-card {
  border: 2px solid var(--border);
  border-radius: 12px;
  padding: 14px 12px;
  cursor: pointer;
  transition: all .2s;
  text-align: center;
  background: var(--bg);
}
.provider-card:hover {
  border-color: var(--primary);
  box-shadow: 0 4px 12px rgba(99,102,241,.15);
  transform: translateY(-2px);
}
.provider-icon {
  width: 40px; height: 40px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  color: white; font-weight: 700; font-size: 16px;
  margin: 0 auto 8px;
}
.provider-name {
  font-weight: 600; font-size: 14px;
  color: var(--text-1); margin-bottom: 4px;
}
.provider-hint {
  font-size: 11px; color: var(--text-3);
  margin-bottom: 8px; line-height: 1.4;
}
.provider-hint code {
  background: #f1f5f9; padding: 1px 4px;
  border-radius: 4px; font-size: 10px;
}
.provider-link {
  font-size: 11px; color: var(--primary);
  text-decoration: none; font-weight: 600;
}
.provider-link:hover { text-decoration: underline; }
/* ═══════════════════════════════════════════════════════════
   TWO-COLUMN LAYOUT — main tool + right contextual sidebar
═══════════════════════════════════════════════════════════ */

.two-col-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 24px;
  align-items: start;
  max-width: 1200px;
}

.tc-main {
  max-width: 100% !important; /* override page-card max-width */
}

/* ── RIGHT PANEL ──────────────────────────────────────── */
.right-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
  position: sticky;
  top: calc(var(--topbar-h) + 16px);
}

.rp-card {
  background: white;
  border: 1.5px solid var(--border);
  border-radius: 14px;
  padding: 16px 18px;
  transition: box-shadow .2s;
}
.rp-card:hover { box-shadow: 0 4px 16px rgba(15,127,219,.07); }

.rp-title {
  font-family: 'Sora', sans-serif;
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 7px;
}
.rp-title i {
  width: 22px; height: 22px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  flex-shrink: 0;
}

/* Card type colors */
.rp-tip { border-left: 3px solid var(--primary); }
.rp-tip .rp-title i { background: var(--primary-light); color: var(--primary); }

.rp-warning { border-left: 3px solid #f59e0b; }
.rp-warning .rp-title i { background: #fef3c7; color: #d97706; }

.rp-info { border-left: 3px solid var(--accent); }
.rp-info .rp-title i { background: var(--accent-light); color: #047857; }

.rp-links { border-left: 3px solid #8b5cf6; }
.rp-links .rp-title i { background: #f5f3ff; color: #7c3aed; }

/* List styles */
.rp-list {
  list-style: none;
  padding: 0; margin: 0;
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.rp-list li {
  font-size: 12.5px;
  color: var(--text-2);
  display: flex;
  align-items: flex-start;
  gap: 7px;
  line-height: 1.5;
}
.rp-list li i.fa-check {
  color: var(--accent);
  font-size: 10px;
  margin-top: 3px;
  flex-shrink: 0;
}
.rp-list-red li { color: #7f1d1d; }
.rp-list-red li::before { content: '•'; color: #ef4444; font-weight: 700; margin-right: 4px; flex-shrink:0; }
.rp-list-red li i { display: none; }

/* Text / subtext */
.rp-text {
  font-size: 12.5px;
  color: var(--text-2);
  line-height: 1.6;
  margin: 0 0 8px;
}
.rp-subtext {
  font-size: 11px;
  color: var(--text-3);
  line-height: 1.5;
  margin-top: 8px;
}

/* External links */
.rp-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 600;
  color: #7c3aed;
  text-decoration: none;
  background: #faf9ff;
  border: 1px solid #ede9fe;
  margin-bottom: 6px;
  transition: all .18s;
}
.rp-link:last-child { margin-bottom: 0; }
.rp-link:hover {
  background: #f0ebff;
  border-color: #c4b5fd;
  transform: translateX(3px);
}
.rp-link i {
  width: 18px; height: 18px;
  background: #ede9fe;
  border-radius: 5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  flex-shrink: 0;
}

/* Badge link */
.rp-badge-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  color: var(--primary);
  text-decoration: none;
  padding: 5px 12px;
  background: var(--primary-light);
  border-radius: 99px;
  border: 1px solid #bfdbfe;
  transition: all .18s;
}
.rp-badge-link:hover { background: #dbeafe; }

/* Daily Values grid */
.rp-dv-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-bottom: 4px;
}
.rp-dv-item {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.rp-dv-label { font-size: 10px; font-weight: 600; text-transform: uppercase; color: var(--text-3); letter-spacing: .04em; }
.rp-dv-val { font-size: 13px; font-weight: 700; color: var(--primary); }

/* BMI categories */
.rp-bmi-cats { display: flex; flex-direction: column; gap: 6px; }
.rp-bmi-cat {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: var(--bg);
  border-radius: 8px;
  font-size: 12.5px;
}
.rp-bmi-cat span { color: var(--text-2); }
.rp-bmi-cat strong { font-size: 12px; }

/* Lab test grid */
.rp-lab-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
.rp-lab-item {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
}
.rp-lab-name { display: block; font-size: 12px; font-weight: 700; color: var(--primary); }
.rp-lab-desc { display: block; font-size: 10.5px; color: var(--text-3); margin-top: 1px; }

/* Language grid */
.rp-lang-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
}
.rp-lang-grid span {
  font-size: 11.5px;
  color: var(--text-2);
  padding: 4px 6px;
  background: var(--bg);
  border-radius: 6px;
  border: 1px solid var(--border);
}

/* Chip grid */
.rp-chip-grid { display: flex; flex-wrap: wrap; gap: 5px; }
.rp-chip {
  font-size: 11.5px;
  padding: 4px 9px;
  background: var(--primary-light);
  color: var(--primary);
  border-radius: 99px;
  border: 1px solid #bfdbfe;
  font-weight: 500;
}

/* ── RESULT CARD BASE ─────────────────────────────────── */
.result-box {
  margin-top: 20px;
  display: none;
}
.result-box.visible, .result-box.show {
  display: block;
  animation: fadeUp .35s ease;
}
.error-msg {
  background: #fef2f2; border: 1.5px solid #fecaca; color: #dc2626;
  padding: 12px 16px; border-radius: 12px; font-size: 13.5px;
  font-weight: 500; display: flex; align-items: center; gap: 8px;
}
.success-msg {
  background: #f0fdf4; border: 1.5px solid #bbf7d0; color: #166534;
  padding: 12px 16px; border-radius: 12px; font-size: 13.5px;
  font-weight: 500; display: flex; align-items: center; gap: 8px;
}

/* ── RESPONSIVE BREAKPOINTS ───────────────────────────── */

/* Large desktop: wider right panel */
@media (min-width: 1400px) {
  .two-col-layout { grid-template-columns: minmax(0, 1fr) 320px; }
}

/* Tablet: collapse right panel below main */
@media (max-width: 1100px) {
  .two-col-layout {
    grid-template-columns: 1fr;
  }
  .right-panel {
    position: static;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 12px;
  }
}

/* Mobile */
@media (max-width: 1024px) {
  .two-col-layout { gap: 16px; }
  .right-panel {
    grid-template-columns: 1fr;
  }
}

/* Hide lowest-priority right panel card on very small screens */
@media (max-width: 480px) {
  .right-panel .rp-card:last-child { display: none; }
  .rp-dv-grid, .rp-lab-grid, .rp-lang-grid { grid-template-columns: repeat(3, 1fr); }
}

/* Nutrition result fix: full-width on narrow */
@media (max-width: 680px) {
  .rc-nutr-body { grid-template-columns: 1fr; }
  .rc-cal-panel {
    border-right: none;
    border-bottom: 1.5px solid var(--border);
    flex-direction: row;
    padding: 16px 20px;
    gap: 20px;
  }
  .rc-cal-ring { width: 80px; height: 80px; }
  .rc-cal-num { font-size: 20px; }
  .rc-drug-fields { grid-template-columns: 1fr; }
  .rc-dfield { border-right: none; }
  .rc-dfield:nth-last-child(-n+2) { border-bottom: 1px solid var(--border); }
  .rc-dfield:last-child { border-bottom: none; }
  .rc-bmi-top { flex-direction: column; align-items: flex-start; gap: 16px; }
  .rc-stats-grid { grid-template-columns: repeat(2, 1fr); }
}

/* Nutrition calorie ring text fix on very small screens */
@media (max-width: 380px) {
  .rc-cal-num { font-size: 18px; }
  .rc-micros { grid-template-columns: repeat(3, 1fr); }
}

/* ═══════════════════════════════════════════════════════════
   RESULT CARDS
═══════════════════════════════════════════════════════════ */

/* NUTRITION */
.rc-nutrition { background:white; border:1.5px solid var(--border); border-radius:16px; overflow:hidden; }
.rc-nutr-header { background:linear-gradient(135deg,#0f7fdb,#0a65b5); padding:20px 24px; color:white; }
.rc-nutr-title { font-family:'Sora',sans-serif; font-size:20px; font-weight:700; margin-bottom:4px; }
.rc-nutr-serving { font-size:13px; opacity:.8; }
.rc-nutr-body { display:grid; grid-template-columns:180px 1fr; }
.rc-cal-panel { display:flex; flex-direction:column; align-items:center; justify-content:center; padding:24px 20px; border-right:1.5px solid var(--border); gap:10px; min-width:160px; }
.rc-cal-ring { position:relative; width:110px; height:110px; flex-shrink:0; }
.rc-donut-svg { width:110px; height:110px; display:block; }
.rc-donut-bg { }
.rc-donut-fill { transition: stroke-dasharray .8s cubic-bezier(.4,0,.2,1); }
.rc-cal-inner { position:absolute; inset:0; display:flex; flex-direction:column; align-items:center; justify-content:center; pointer-events:none; }
.rc-cal-num { font-family:'Sora',sans-serif; font-size:26px; font-weight:800; color:var(--primary); line-height:1; text-align:center; }
.rc-cal-lbl { font-size:10px; font-weight:700; color:var(--text-3); text-transform:uppercase; letter-spacing:.06em; margin-top:2px; }
.rc-cal-note { font-size:11.5px; color:var(--text-2); text-align:center; line-height:1.6; font-weight:500; }
.rc-cal-note small { font-size:10px; color:var(--text-3); }
.rc-macros { padding:20px 24px; display:flex; flex-direction:column; justify-content:center; gap:14px; }
.rc-macro-row { display:flex; flex-direction:column; gap:5px; }
.rc-macro-info { display:flex; align-items:center; gap:8px; }
.rc-macro-dot { width:10px; height:10px; border-radius:50%; flex-shrink:0; }
.rc-macro-name { font-size:13px; font-weight:600; color:var(--text-2); flex:1; }
.rc-macro-val { font-size:13px; font-weight:700; color:var(--text); }
.nutr-bar-track { height:6px; background:#f1f5f9; border-radius:3px; overflow:hidden; }
.nutr-bar-fill { height:100%; border-radius:3px; transition:width .8s cubic-bezier(.4,0,.2,1); }
.rc-micros { display:grid; grid-template-columns:repeat(auto-fill,minmax(90px,1fr)); gap:1px; border-top:1.5px solid var(--border); background:var(--border); }
.rc-micro-item { background:white; padding:14px 10px; display:flex; flex-direction:column; align-items:center; gap:6px; transition:background .2s; }
.rc-micro-item:hover { background:#f8fafd; }
.rc-micro-icon { width:32px; height:32px; border-radius:8px; display:flex; align-items:center; justify-content:center; font-size:16px; }
.rc-micro-data { text-align:center; }
.rc-micro-v { font-family:'Sora',sans-serif; font-size:14px; font-weight:700; color:var(--text); }
.rc-micro-l { font-size:10px; font-weight:600; color:var(--text-3); text-transform:uppercase; letter-spacing:.04em; }

/* DRUG */
.rc-drug { background:white; border:1.5px solid var(--border); border-radius:16px; overflow:hidden; }
.rc-drug-banner { background:linear-gradient(135deg,#f0f9ff,#e0f2fe); border-bottom:1.5px solid #bae6fd; padding:20px 24px; display:flex; align-items:center; gap:16px; }
.rc-drug-pill-icon { width:52px; height:52px; background:white; border-radius:14px; display:flex; align-items:center; justify-content:center; font-size:24px; color:#0284c7; box-shadow:0 2px 8px rgba(0,0,0,.1); flex-shrink:0; }
.rc-drug-name { font-family:'Sora',sans-serif; font-size:22px; font-weight:700; color:#0c4a6e; margin-bottom:8px; }
.rc-drug-tags { display:flex; flex-wrap:wrap; gap:6px; }
.rc-tag { font-size:12px; font-weight:600; padding:3px 10px; border-radius:99px; }
.rc-tag-blue { background:#dbeafe; color:#1d4ed8; }
.rc-tag-slate { background:#f1f5f9; color:#475569; }
.rc-drug-fields { display:grid; grid-template-columns:1fr 1fr; gap:0; }
.rc-dfield { padding:16px 20px; border-bottom:1px solid var(--border); border-right:1px solid var(--border); }
.rc-dfield:nth-child(2n) { border-right:none; }
.rc-dfield:nth-last-child(-n+2) { border-bottom:none; }
.rc-df-head { font-size:12px; font-weight:700; text-transform:uppercase; letter-spacing:.06em; margin-bottom:8px; display:flex; align-items:center; gap:6px; }
.rc-df-body { font-size:13.5px; color:var(--text-2); line-height:1.6; }
.rc-dfield-blue .rc-df-head { color:#1d4ed8; } .rc-dfield-green .rc-df-head { color:#166534; }
.rc-dfield-amber .rc-df-head { color:#92400e; } .rc-dfield-rose .rc-df-head { color:#9f1239; }
.rc-dfield-purple .rc-df-head { color:#6b21a8; }
.rc-dfield-blue { background:#fafbff; } .rc-dfield-green { background:#f9fffa; }
.rc-dfield-amber { background:#fffbf0; } .rc-dfield-rose { background:#fff9f9; }
.rc-dfield-purple { background:#fdf9ff; }
.rc-drug-footer { padding:12px 20px; background:#f8fafc; border-top:1.5px solid var(--border); font-size:12px; color:var(--text-3); display:flex; align-items:center; gap:6px; }

/* BMI */
.rc-bmi { background:white; border:1.5px solid var(--border); border-radius:16px; padding:28px; }
.rc-bmi-top { display:flex; align-items:center; gap:28px; margin-bottom:28px; flex-wrap:wrap; }
.rc-bmi-gauge { flex-shrink:0; }
.rc-bmi-info { flex:1; min-width:180px; }
.rc-bmi-badge { display:inline-block; font-family:'Sora',sans-serif; font-size:18px; font-weight:700; padding:6px 18px; border-radius:99px; margin-bottom:12px; }
.rc-bmi-advice { font-size:14px; color:var(--text-2); line-height:1.6; margin-bottom:12px; }
.rc-bmi-ideal { font-size:13px; color:var(--text-2); display:flex; align-items:center; gap:6px; }
.rc-bmi-scale { position:relative; display:grid; grid-template-columns:repeat(4,1fr); gap:4px; }
.rc-bmi-seg { display:flex; flex-direction:column; gap:5px; }
.rc-bmi-seg-bar { height:8px; border-radius:4px; }
.rc-bmi-seg-lbl { font-size:10px; font-weight:600; text-align:center; }
.rc-bmi-pointer { position:absolute; top:-6px; transform:translateX(-50%); pointer-events:none; }
.rc-bmi-ptr-dot { width:16px; height:16px; border-radius:50%; border:3px solid white; box-shadow:0 2px 6px rgba(0,0,0,.2); }

/* AI TEXT RESULTS */
.rc-ai-result { background:white; border:1.5px solid var(--border); border-radius:16px; overflow:hidden; }
.rc-ai-header { padding:14px 20px; display:flex; align-items:center; gap:10px; font-size:14px; font-weight:700; border-bottom:1.5px solid var(--border); flex-wrap:wrap; }
.rc-ai-teal { background:linear-gradient(90deg,#f0fdf9,#ecfdf5); color:#0f766e; border-bottom-color:#a7f3d0; }
.rc-ai-blue { background:linear-gradient(90deg,#eff6ff,#f0f9ff); color:#1d4ed8; border-bottom-color:#bfdbfe; }
.rc-ai-violet { background:linear-gradient(90deg,#faf5ff,#f5f3ff); color:#7c3aed; border-bottom-color:#ddd6fe; }
.rc-ai-indigo { background:linear-gradient(90deg,#eef2ff,#f0f9ff); color:#4338ca; border-bottom-color:#c7d2fe; }
.rc-ai-lang { margin-left:auto; font-size:12px; font-weight:600; opacity:.7; display:flex; align-items:center; gap:5px; }
.rc-ai-body { padding:20px; font-size:14px; line-height:1.85; color:var(--text-2); white-space:pre-wrap; }
.rc-ai-body strong { color:var(--text); font-weight:700; }

/* STATS */
.rc-stats-title { font-family:'Sora',sans-serif; font-size:15px; font-weight:700; color:var(--text); margin:0 0 14px; display:flex; align-items:center; gap:8px; }
.rc-stats-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(150px,1fr)); gap:12px; }
.rc-stat { background:white; border:1.5px solid var(--border); border-radius:14px; padding:20px 16px; text-align:center; position:relative; overflow:hidden; transition:transform .2s,box-shadow .2s; }
.rc-stat:hover { transform:translateY(-3px); box-shadow:0 8px 24px rgba(0,0,0,.08); }
.rc-stat::before { content:''; position:absolute; top:0; left:0; right:0; height:3px; background:var(--sc); }
.rc-stat-icon { font-size:20px; color:var(--sc); margin-bottom:10px; display:block; }
.rc-stat-val { font-family:'Sora',sans-serif; font-size:20px; font-weight:800; color:var(--sc); line-height:1.2; margin-bottom:4px; }
.rc-stat-lbl { font-size:11px; font-weight:600; text-transform:uppercase; letter-spacing:.05em; color:var(--text-3); }
.rc-countries { display:flex; flex-direction:column; gap:0; border:1.5px solid var(--border); border-radius:12px; overflow:hidden; }
.rc-country { display:grid; grid-template-columns:36px 1fr auto auto; align-items:center; gap:12px; padding:12px 16px; border-bottom:1px solid var(--border); background:white; transition:background .15s; }
.rc-country:last-child { border-bottom:none; }
.rc-country:hover { background:#f8fafd; }
.rc-country-rank { width:28px; height:28px; border-radius:8px; background:var(--bg); color:var(--text-3); font-size:12px; font-weight:700; display:flex; align-items:center; justify-content:center; }
.rc-country:nth-child(1) .rc-country-rank { background:#fef3c7; color:#d97706; }
.rc-country:nth-child(2) .rc-country-rank { background:#f1f5f9; color:#64748b; }
.rc-country:nth-child(3) .rc-country-rank { background:#fde8d8; color:#c2410c; }
.rc-country-name { font-size:14px; font-weight:600; color:var(--text); }
.rc-country-cases { font-size:13px; font-weight:600; color:#ef4444; display:flex; align-items:center; gap:5px; }
.rc-country-deaths { font-size:13px; font-weight:600; color:#64748b; display:flex; align-items:center; gap:5px; }

/* Loading */
.loading-overlay { position:fixed; inset:0; z-index:999; background:rgba(15,23,42,.5); backdrop-filter:blur(4px); display:none; align-items:center; justify-content:center; }
.loading-overlay.active { display:flex; }
.loading-card { background:white; border-radius:16px; padding:28px 36px; text-align:center; box-shadow:0 20px 60px rgba(0,0,0,.2); }
.loading-pulse { font-size:32px; color:var(--primary); animation:pulse 1s ease-in-out infinite; margin-bottom:8px; }
.loading-card p { font-size:14px; color:var(--text-2); font-weight:500; }


/* ═══════════════════════════════════════════════════════════
   DOCTOR MODE CSS — Append this to the END of style.css
   ═══════════════════════════════════════════════════════════ */

/* ── ROLE SELECTOR AT LOGIN ─────────────────────────────── */
.auth-role-selector {
    margin: 16px 0 4px;
}
.auth-role-label {
    font-size: 13px;
    color: #64748b;
    text-align: center;
    margin-bottom: 10px;
    font-weight: 500;
}
.auth-role-btns {
    display: flex;
    gap: 10px;
}
.auth-role-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 12px 8px;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    background: #f8fafc;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}
.auth-role-btn i    { font-size: 22px; color: #94a3b8; transition: color 0.2s; }
.auth-role-btn span { font-size: 14px; font-weight: 700; color: #334155; }
.auth-role-btn small{ font-size: 11px; color: #94a3b8; }
.auth-role-btn:hover,
.auth-role-btn.active {
    border-color: #7c3aed;
    background: #f5f3ff;
}
.auth-role-btn.active i    { color: #7c3aed; }
.auth-role-btn.active span { color: #5b21b6; }

/* ── DOCTOR HEADER STYLE ─────────────────────────────────── */
.doc-header { border-bottom: 2px solid #ede9fe !important; }
.doc-header i { color: #7c3aed !important; }

/* ── DOCTOR NAV INDICATOR ────────────────────────────────── */
#doctor-nav-group .nav-btn:hover,
#doctor-nav-group .nav-btn.active {
    background: linear-gradient(135deg, #f5f3ff, #ede9fe);
    color: #7c3aed;
}
#doctor-nav-group .nav-btn.active i { color: #7c3aed; }
.appt-badge {
    background: #ef4444;
    color: white;
    font-size: 10px;
    font-weight: 700;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-left: auto;
}

/* ── DOCTOR DASHBOARD ────────────────────────────────────── */
.doctor-dashboard {
    max-width: 900px;
    padding: 0 0 40px;
}
.doc-welcome {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    background: linear-gradient(135deg, #1e1b4b, #312e81, #4c1d95);
    border-radius: 16px;
    padding: 24px 28px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}
.doc-welcome-text h2 { font-family: 'Sora', sans-serif; font-size: 22px; font-weight: 800; color: white; margin: 0 0 4px; }
.doc-welcome-text p  { font-size: 13px; color: rgba(255,255,255,0.7); margin: 0; }
.doc-mode-badge {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 10px;
    padding: 10px 16px;
    color: white;
    font-size: 13px;
    font-weight: 600;
    flex-wrap: wrap;
    gap: 8px;
}
.switch-mode-btn {
    background: rgba(255,255,255,0.2);
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 8px;
    color: white;
    font-size: 12px;
    padding: 5px 10px;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.2s;
}
.switch-mode-btn:hover { background: rgba(255,255,255,0.35); }

/* Dashboard stats row */
.doc-stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 14px;
    margin-bottom: 24px;
}
.doc-stat-card {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 14px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.05);
}
.doc-stat-icon {
    width: 44px; height: 44px;
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}
.doc-stat-num  { font-family: 'Sora', sans-serif; font-size: 26px; font-weight: 800; color: #0f172a; }
.doc-stat-lbl  { font-size: 12px; color: #64748b; font-weight: 500; margin-top: 2px; }

/* Quick tools grid */
.doc-quick-tools { background: white; border: 1px solid #e2e8f0; border-radius: 14px; padding: 20px; margin-bottom: 20px; }
.doc-quick-tools h3 { font-family: 'Sora', sans-serif; font-size: 15px; font-weight: 700; color: #0f172a; margin: 0 0 14px; }
.doc-tool-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 10px;
}
.doc-tool-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 16px 8px;
    background: #fafafa;
    border: 1.5px solid #e2e8f0;
    border-radius: 12px;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s;
    text-align: center;
}
.doc-tool-card i    { font-size: 22px; color: #7c3aed; }
.doc-tool-card span { font-size: 12px; font-weight: 600; color: #334155; line-height: 1.3; }
.doc-tool-card:hover {
    background: #f5f3ff;
    border-color: #7c3aed;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(124,58,237,0.12);
}

/* Reminders */
.doc-reminders { background: #fffbeb; border: 1px solid #fde68a; border-radius: 14px; padding: 18px; }
.doc-reminders h3 { font-size: 14px; font-weight: 700; color: #92400e; margin: 0 0 12px; }
.reminder-card {
    display: flex; align-items: flex-start; gap: 12px;
    background: white; border-radius: 10px; padding: 12px; margin-bottom: 8px;
    border: 1px solid #fde68a; font-size: 13px; color: #374151;
}
.reminder-icon { font-size: 18px; color: #f59e0b; margin-top: 2px; }

/* ── DOCTOR BUTTON ───────────────────────────────────────── */
.doc-btn {
    background: linear-gradient(135deg, #7c3aed, #6d28d9) !important;
}
.doc-btn:hover {
    background: linear-gradient(135deg, #6d28d9, #5b21b6) !important;
}
.doc-action-row {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}
.copy-result-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 11px 20px;
    background: #f1f5f9;
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    color: #475569;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s;
}
.copy-result-btn:hover { background: #e2e8f0; }

/* ── AI RESULT HEADERS — DOCTOR STYLE ───────────────────── */
.doc-ai-header {
    background: linear-gradient(135deg, #1e1b4b, #4c1d95) !important;
    color: white !important;
    padding: 14px 18px !important;
    border-radius: 10px 10px 0 0 !important;
    font-size: 14px !important;
    font-weight: 700 !important;
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
}
.soap-body {
    font-family: 'DM Sans', monospace;
    white-space: pre-wrap;
    font-size: 13.5px;
    line-height: 1.7;
}
.ai-h2 {
    font-family: 'Sora', sans-serif;
    font-size: 16px;
    font-weight: 800;
    color: #1e1b4b;
    margin: 18px 0 8px;
    padding-bottom: 6px;
    border-bottom: 2px solid #ede9fe;
}
.ai-h3 {
    font-family: 'Sora', sans-serif;
    font-size: 14px;
    font-weight: 700;
    color: #5b21b6;
    margin: 14px 0 6px;
}
.ai-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    margin: 12px 0;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #e2e8f0;
}
.ai-table td {
    padding: 8px 12px;
    border: 1px solid #e2e8f0;
    vertical-align: top;
}
.ai-table tr:first-child td { background: #f1f5f9; font-weight: 700; }
.ai-table tr:nth-child(even) td { background: #f8fafc; }

/* ── DOCUMENT TYPE SELECTOR ──────────────────────────────── */
.doc-type-selector {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.doc-type-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    background: #f8fafc;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    color: #475569;
    font-family: inherit;
    transition: all 0.2s;
}
.doc-type-btn:hover { border-color: #7c3aed; color: #7c3aed; background: #f5f3ff; }
.doc-type-btn.active { border-color: #7c3aed; background: #f5f3ff; color: #5b21b6; }

/* ── MEDICAL CALCULATORS ─────────────────────────────────── */
.calc-tabs {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid #e2e8f0;
}
.calc-tab {
    padding: 7px 14px;
    border: 1.5px solid #e2e8f0;
    border-radius: 20px;
    background: #f8fafc;
    font-size: 13px;
    font-weight: 600;
    color: #475569;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s;
}
.calc-tab:hover  { border-color: #7c3aed; color: #7c3aed; }
.calc-tab.active { background: #7c3aed; border-color: #7c3aed; color: white; }

.calc-panel { display: none; }
.calc-panel.active { display: block; }
.calc-panel h3 { font-family: 'Sora', sans-serif; font-size: 16px; font-weight: 700; color: #0f172a; margin: 0 0 18px; }

.calc-checklist { display: flex; flex-direction: column; gap: 6px; }
.calc-check {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 14px;
    border: 1.5px solid #e2e8f0;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    color: #374151;
    background: #f8fafc;
    transition: all 0.15s;
    user-select: none;
}
.calc-check:hover { border-color: #7c3aed; background: #f5f3ff; }
.calc-check input[type=checkbox] { accent-color: #7c3aed; margin-top: 2px; flex-shrink: 0; }
.calc-check input:checked + span { color: #5b21b6; font-weight: 600; }
.calc-pts {
    margin-left: 6px;
    background: #ede9fe;
    color: #5b21b6;
    border-radius: 6px;
    padding: 1px 7px;
    font-size: 12px;
    font-weight: 700;
}

.calc-result {
    margin-top: 18px;
    min-height: 20px;
}
.calc-output {
    background: #f8fafc;
    border: 1.5px solid #e2e8f0;
    border-radius: 12px;
    padding: 20px;
    text-align: center;
}
.calc-big-num {
    font-family: 'Sora', sans-serif;
    font-size: 52px;
    font-weight: 900;
    line-height: 1;
    margin-bottom: 4px;
}
.calc-badge {
    display: inline-block;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    margin-top: 8px;
    text-align: center;
    max-width: 100%;
    word-break: break-word;
}

/* ── APPOINTMENTS ────────────────────────────────────────── */
.appt-form-card {
    background: #f8fafc;
    border: 1.5px solid #e2e8f0;
    border-radius: 14px;
    padding: 20px;
    margin-bottom: 8px;
}
.appt-form-card h3 {
    font-family: 'Sora', sans-serif;
    font-size: 15px;
    font-weight: 700;
    color: #0f172a;
    margin: 0 0 16px;
}
.appt-card {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    background: white;
    border: 1.5px solid #e2e8f0;
    border-radius: 12px;
    padding: 14px 16px;
    margin-bottom: 10px;
    transition: box-shadow 0.2s;
}
.appt-card:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.07); }
.appt-today { border-left: 4px solid #7c3aed !important; background: #faf5ff; }
.appt-past  { opacity: 0.55; }

.appt-time-col { text-align: center; min-width: 60px; flex-shrink: 0; }
.appt-date  { font-weight: 700; font-size: 13px; color: #0f172a; }
.appt-time  { font-size: 15px; font-weight: 800; color: #2563eb; font-family: 'Sora', sans-serif; }
.appt-today-badge {
    background: #7c3aed; color: white;
    font-size: 10px; font-weight: 700; border-radius: 8px;
    padding: 2px 6px; margin-top: 4px; display: inline-block;
}
.appt-soon-badge {
    background: #f59e0b; color: white;
    font-size: 10px; font-weight: 700; border-radius: 8px;
    padding: 2px 6px; margin-top: 4px; display: inline-block;
}
.appt-info   { flex: 1; min-width: 0; }
.appt-name   { font-size: 14px; font-weight: 700; color: #0f172a; margin-bottom: 3px; }
.appt-meta   { font-size: 12px; color: #64748b; margin-bottom: 3px; }
.appt-note-text { font-size: 12px; color: #64748b; background: #f1f5f9; padding: 4px 8px; border-radius: 6px; margin-top: 4px; }
.appt-del-btn {
    background: none; border: 1.5px solid #fee2e2; border-radius: 8px;
    color: #ef4444; width: 32px; height: 32px;
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    flex-shrink: 0; transition: all 0.2s; font-size: 13px;
    align-self: center;
}
.appt-del-btn:hover { background: #fef2f2; }

/* ── SIDEBAR SEPARATOR ────────────────────────────────────── */
#doctor-nav-group .nav-group-label {
    color: #a78bfa;
    border-top: 1px solid #ede9fe;
    padding-top: 10px;
    margin-top: 6px;
}

/* ── RESPONSIVE ──────────────────────────────────────────── */
@media (max-width: 600px) {
    .doc-welcome { flex-direction: column; }
    .doc-tool-grid { grid-template-columns: repeat(3, 1fr); }
    .doc-stats-row { grid-template-columns: repeat(2, 1fr); }
    .calc-tabs { gap: 4px; }
    .calc-tab  { padding: 6px 10px; font-size: 12px; }
    .calc-big-num { font-size: 40px; }
    .doc-type-selector { flex-direction: column; }
    .appt-card { flex-wrap: wrap; }
}

/* ══════════════════════════════════════════════
   PORTAL SELECTOR + PDF BUTTONS
   ══════════════════════════════════════════════ */
.portal-card {
    width:100%;display:flex;align-items:center;gap:14px;
    padding:14px 16px;background:#f8fafc;border:2px solid #e2e8f0;
    border-radius:14px;cursor:pointer;font-family:inherit;
    text-align:left;margin-bottom:10px;transition:all 0.2s;
}
.portal-card:hover { border-color:#0f7fdb;background:#eff8ff;transform:translateY(-1px);box-shadow:0 4px 16px rgba(15,127,219,0.12); }
.portal-card-doctor:hover { border-color:#7c3aed;background:#f5f3ff;box-shadow:0 4px 16px rgba(124,58,237,0.12); }
.portal-card-icon { width:46px;height:46px;border-radius:12px;display:flex;align-items:center;justify-content:center;font-size:20px;color:white;flex-shrink:0; }
.portal-card-body { flex:1; }
.portal-card-title { font-size:15px;font-weight:700;color:#0f172a;margin-bottom:2px; }
.portal-card-sub { font-size:12px;color:#64748b; }
.portal-card-arrow { color:#cbd5e1;font-size:14px;flex-shrink:0; }
.back-to-portal { display:inline-flex;align-items:center;gap:6px;background:none;border:none;color:#64748b;font-size:13px;font-weight:600;cursor:pointer;font-family:inherit;padding:0;margin-bottom:4px;transition:color 0.2s; }
.back-to-portal:hover { color:#0f172a; }
.auth-modal-doctor .doc-auth-tab.active { color:#7c3aed;border-bottom-color:#7c3aed; }
.doc-auth-btn { background:linear-gradient(135deg,#7c3aed,#6d28d9) !important; }
.doc-auth-btn:hover { background:linear-gradient(135deg,#6d28d9,#5b21b6) !important; }

/* PDF Download Button */
.pdf-download-btn {
    display:inline-flex;align-items:center;gap:8px;
    padding:11px 20px;background:linear-gradient(135deg,#dc2626,#b91c1c);
    border:none;border-radius:10px;font-size:14px;font-weight:600;
    color:white;cursor:pointer;font-family:inherit;transition:all 0.2s;
}
.pdf-download-btn:hover { background:linear-gradient(135deg,#b91c1c,#991b1b);transform:translateY(-1px);box-shadow:0 4px 12px rgba(220,38,38,0.25); }

.doc-result-actions {
    display:flex;align-items:center;gap:10px;flex-wrap:wrap;
    padding:14px 0 4px;border-top:1px solid #e2e8f0;margin-top:14px;
}

/* Color Presets */
.color-preset {
    width:28px;height:28px;border-radius:8px;cursor:pointer;
    border:2px solid transparent;transition:all 0.15s;flex-shrink:0;
}
.color-preset:hover { transform:scale(1.2);border-color:white;box-shadow:0 2px 8px rgba(0,0,0,0.3); }


/* ═══════════════════════════════════════════════════════════
   DOCTOR MODE STYLES — merged from doctor_style.css
   ═══════════════════════════════════════════════════════════ */
/* ═══════════════════════════════════════════════════════════
   DOCTOR MODE CSS — Append this to the END of style.css
   ═══════════════════════════════════════════════════════════ */

/* ── ROLE SELECTOR AT LOGIN ─────────────────────────────── */
.auth-role-selector {
    margin: 16px 0 4px;
}
.auth-role-label {
    font-size: 13px;
    color: #64748b;
    text-align: center;
    margin-bottom: 10px;
    font-weight: 500;
}
.auth-role-btns {
    display: flex;
    gap: 10px;
}
.auth-role-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 12px 8px;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    background: #f8fafc;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}
.auth-role-btn i    { font-size: 22px; color: #94a3b8; transition: color 0.2s; }
.auth-role-btn span { font-size: 14px; font-weight: 700; color: #334155; }
.auth-role-btn small{ font-size: 11px; color: #94a3b8; }
.auth-role-btn:hover,
.auth-role-btn.active {
    border-color: #7c3aed;
    background: #f5f3ff;
}
.auth-role-btn.active i    { color: #7c3aed; }
.auth-role-btn.active span { color: #5b21b6; }

/* ── DOCTOR HEADER STYLE ─────────────────────────────────── */
.doc-header { border-bottom: 2px solid #ede9fe !important; }
.doc-header i { color: #7c3aed !important; }

/* ── DOCTOR NAV INDICATOR ────────────────────────────────── */
#doctor-nav-group .nav-btn:hover,
#doctor-nav-group .nav-btn.active {
    background: linear-gradient(135deg, #f5f3ff, #ede9fe);
    color: #7c3aed;
}
#doctor-nav-group .nav-btn.active i { color: #7c3aed; }
.appt-badge {
    background: #ef4444;
    color: white;
    font-size: 10px;
    font-weight: 700;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-left: auto;
}

/* ── DOCTOR DASHBOARD ────────────────────────────────────── */
.doctor-dashboard {
    max-width: 900px;
    padding: 0 0 40px;
}
.doc-welcome {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    background: linear-gradient(135deg, #1e1b4b, #312e81, #4c1d95);
    border-radius: 16px;
    padding: 24px 28px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}
.doc-welcome-text h2 { font-family: 'Sora', sans-serif; font-size: 22px; font-weight: 800; color: white; margin: 0 0 4px; }
.doc-welcome-text p  { font-size: 13px; color: rgba(255,255,255,0.7); margin: 0; }
.doc-mode-badge {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 10px;
    padding: 10px 16px;
    color: white;
    font-size: 13px;
    font-weight: 600;
    flex-wrap: wrap;
    gap: 8px;
}
.switch-mode-btn {
    background: rgba(255,255,255,0.2);
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 8px;
    color: white;
    font-size: 12px;
    padding: 5px 10px;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.2s;
}
.switch-mode-btn:hover { background: rgba(255,255,255,0.35); }

/* Dashboard stats row */
.doc-stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 14px;
    margin-bottom: 24px;
}
.doc-stat-card {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 14px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.05);
}
.doc-stat-icon {
    width: 44px; height: 44px;
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}
.doc-stat-num  { font-family: 'Sora', sans-serif; font-size: 26px; font-weight: 800; color: #0f172a; }
.doc-stat-lbl  { font-size: 12px; color: #64748b; font-weight: 500; margin-top: 2px; }

/* Quick tools grid */
.doc-quick-tools { background: white; border: 1px solid #e2e8f0; border-radius: 14px; padding: 20px; margin-bottom: 20px; }
.doc-quick-tools h3 { font-family: 'Sora', sans-serif; font-size: 15px; font-weight: 700; color: #0f172a; margin: 0 0 14px; }
.doc-tool-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 10px;
}
.doc-tool-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 16px 8px;
    background: #fafafa;
    border: 1.5px solid #e2e8f0;
    border-radius: 12px;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s;
    text-align: center;
}
.doc-tool-card i    { font-size: 22px; color: #7c3aed; }
.doc-tool-card span { font-size: 12px; font-weight: 600; color: #334155; line-height: 1.3; }
.doc-tool-card:hover {
    background: #f5f3ff;
    border-color: #7c3aed;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(124,58,237,0.12);
}

/* Reminders */
.doc-reminders { background: #fffbeb; border: 1px solid #fde68a; border-radius: 14px; padding: 18px; }
.doc-reminders h3 { font-size: 14px; font-weight: 700; color: #92400e; margin: 0 0 12px; }
.reminder-card {
    display: flex; align-items: flex-start; gap: 12px;
    background: white; border-radius: 10px; padding: 12px; margin-bottom: 8px;
    border: 1px solid #fde68a; font-size: 13px; color: #374151;
}
.reminder-icon { font-size: 18px; color: #f59e0b; margin-top: 2px; }

/* ── DOCTOR BUTTON ───────────────────────────────────────── */
.doc-btn {
    background: linear-gradient(135deg, #7c3aed, #6d28d9) !important;
}
.doc-btn:hover {
    background: linear-gradient(135deg, #6d28d9, #5b21b6) !important;
}
.doc-action-row {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}
.copy-result-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 11px 20px;
    background: #f1f5f9;
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    color: #475569;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s;
}
.copy-result-btn:hover { background: #e2e8f0; }

/* ── AI RESULT HEADERS — DOCTOR STYLE ───────────────────── */
.doc-ai-header {
    background: linear-gradient(135deg, #1e1b4b, #4c1d95) !important;
    color: white !important;
    padding: 14px 18px !important;
    border-radius: 10px 10px 0 0 !important;
    font-size: 14px !important;
    font-weight: 700 !important;
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
}
.soap-body {
    font-family: 'DM Sans', monospace;
    white-space: pre-wrap;
    font-size: 13.5px;
    line-height: 1.7;
}
.ai-h2 {
    font-family: 'Sora', sans-serif;
    font-size: 16px;
    font-weight: 800;
    color: #1e1b4b;
    margin: 18px 0 8px;
    padding-bottom: 6px;
    border-bottom: 2px solid #ede9fe;
}
.ai-h3 {
    font-family: 'Sora', sans-serif;
    font-size: 14px;
    font-weight: 700;
    color: #5b21b6;
    margin: 14px 0 6px;
}
.ai-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    margin: 12px 0;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #e2e8f0;
}
.ai-table td {
    padding: 8px 12px;
    border: 1px solid #e2e8f0;
    vertical-align: top;
}
.ai-table tr:first-child td { background: #f1f5f9; font-weight: 700; }
.ai-table tr:nth-child(even) td { background: #f8fafc; }

/* ── DOCUMENT TYPE SELECTOR ──────────────────────────────── */
.doc-type-selector {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.doc-type-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    background: #f8fafc;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    color: #475569;
    font-family: inherit;
    transition: all 0.2s;
}
.doc-type-btn:hover { border-color: #7c3aed; color: #7c3aed; background: #f5f3ff; }
.doc-type-btn.active { border-color: #7c3aed; background: #f5f3ff; color: #5b21b6; }

/* ── MEDICAL CALCULATORS ─────────────────────────────────── */
.calc-tabs {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid #e2e8f0;
}
.calc-tab {
    padding: 7px 14px;
    border: 1.5px solid #e2e8f0;
    border-radius: 20px;
    background: #f8fafc;
    font-size: 13px;
    font-weight: 600;
    color: #475569;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s;
}
.calc-tab:hover  { border-color: #7c3aed; color: #7c3aed; }
.calc-tab.active { background: #7c3aed; border-color: #7c3aed; color: white; }

.calc-panel { display: none; }
.calc-panel.active { display: block; }
.calc-panel h3 { font-family: 'Sora', sans-serif; font-size: 16px; font-weight: 700; color: #0f172a; margin: 0 0 18px; }

.calc-checklist { display: flex; flex-direction: column; gap: 6px; }
.calc-check {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 14px;
    border: 1.5px solid #e2e8f0;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    color: #374151;
    background: #f8fafc;
    transition: all 0.15s;
    user-select: none;
}
.calc-check:hover { border-color: #7c3aed; background: #f5f3ff; }
.calc-check input[type=checkbox] { accent-color: #7c3aed; margin-top: 2px; flex-shrink: 0; }
.calc-check input:checked + span { color: #5b21b6; font-weight: 600; }
.calc-pts {
    margin-left: 6px;
    background: #ede9fe;
    color: #5b21b6;
    border-radius: 6px;
    padding: 1px 7px;
    font-size: 12px;
    font-weight: 700;
}

.calc-result {
    margin-top: 18px;
    min-height: 20px;
}
.calc-output {
    background: #f8fafc;
    border: 1.5px solid #e2e8f0;
    border-radius: 12px;
    padding: 20px;
    text-align: center;
}
.calc-big-num {
    font-family: 'Sora', sans-serif;
    font-size: 52px;
    font-weight: 900;
    line-height: 1;
    margin-bottom: 4px;
}
.calc-badge {
    display: inline-block;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    margin-top: 8px;
    text-align: center;
    max-width: 100%;
    word-break: break-word;
}

/* ── APPOINTMENTS ────────────────────────────────────────── */
.appt-form-card {
    background: #f8fafc;
    border: 1.5px solid #e2e8f0;
    border-radius: 14px;
    padding: 20px;
    margin-bottom: 8px;
}
.appt-form-card h3 {
    font-family: 'Sora', sans-serif;
    font-size: 15px;
    font-weight: 700;
    color: #0f172a;
    margin: 0 0 16px;
}
.appt-card {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    background: white;
    border: 1.5px solid #e2e8f0;
    border-radius: 12px;
    padding: 14px 16px;
    margin-bottom: 10px;
    transition: box-shadow 0.2s;
}
.appt-card:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.07); }
.appt-today { border-left: 4px solid #7c3aed !important; background: #faf5ff; }
.appt-past  { opacity: 0.55; }

.appt-time-col { text-align: center; min-width: 60px; flex-shrink: 0; }
.appt-date  { font-weight: 700; font-size: 13px; color: #0f172a; }
.appt-time  { font-size: 15px; font-weight: 800; color: #2563eb; font-family: 'Sora', sans-serif; }
.appt-today-badge {
    background: #7c3aed; color: white;
    font-size: 10px; font-weight: 700; border-radius: 8px;
    padding: 2px 6px; margin-top: 4px; display: inline-block;
}
.appt-soon-badge {
    background: #f59e0b; color: white;
    font-size: 10px; font-weight: 700; border-radius: 8px;
    padding: 2px 6px; margin-top: 4px; display: inline-block;
}
.appt-info   { flex: 1; min-width: 0; }
.appt-name   { font-size: 14px; font-weight: 700; color: #0f172a; margin-bottom: 3px; }
.appt-meta   { font-size: 12px; color: #64748b; margin-bottom: 3px; }
.appt-note-text { font-size: 12px; color: #64748b; background: #f1f5f9; padding: 4px 8px; border-radius: 6px; margin-top: 4px; }
.appt-del-btn {
    background: none; border: 1.5px solid #fee2e2; border-radius: 8px;
    color: #ef4444; width: 32px; height: 32px;
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    flex-shrink: 0; transition: all 0.2s; font-size: 13px;
    align-self: center;
}
.appt-del-btn:hover { background: #fef2f2; }

/* ── SIDEBAR SEPARATOR ────────────────────────────────────── */
#doctor-nav-group .nav-group-label {
    color: #a78bfa;
    border-top: 1px solid #ede9fe;
    padding-top: 10px;
    margin-top: 6px;
}

/* ── RESPONSIVE ──────────────────────────────────────────── */
@media (max-width: 600px) {
    .doc-welcome { flex-direction: column; }
    .doc-tool-grid { grid-template-columns: repeat(3, 1fr); }
    .doc-stats-row { grid-template-columns: repeat(2, 1fr); }
    .calc-tabs { gap: 4px; }
    .calc-tab  { padding: 6px 10px; font-size: 12px; }
    .calc-big-num { font-size: 40px; }
    .doc-type-selector { flex-direction: column; }
    .appt-card { flex-wrap: wrap; }
}


/* ══════════════════════════════════════════════
   NURABILT — Care Team & Doctor Directory
   ══════════════════════════════════════════════ */

/* Care Team Cards */
.care-team-card {
    display:flex;align-items:center;gap:14px;
    padding:14px 16px;background:#f8fafc;
    border:1.5px solid #e2e8f0;border-radius:14px;
    margin-bottom:10px;transition:all 0.2s;
}
.care-team-card:hover { border-color:#0f7fdb;background:#eff8ff; }
.care-team-avatar {
    width:46px;height:46px;border-radius:12px;
    background:linear-gradient(135deg,#0f7fdb,#00c89e);
    display:flex;align-items:center;justify-content:center;
    color:white;font-size:20px;flex-shrink:0;
}
.care-team-info { flex:1; }
.care-team-name { font-size:15px;font-weight:700;color:#0f172a; }
.care-team-spec { font-size:12px;color:#64748b;margin-top:2px; }
.care-team-next { font-size:11px;color:#7c3aed;font-weight:600;margin-top:3px; }
.care-team-badge {
    font-size:11px;font-weight:700;padding:3px 10px;
    background:#dcfce7;color:#16a34a;border-radius:20px;
}

/* Doctor Directory Cards */
.doctor-dir-card {
    display:flex;align-items:center;gap:14px;
    padding:16px;background:#f8fafc;
    border:1.5px solid #e2e8f0;border-radius:14px;
    margin-bottom:12px;transition:all 0.2s;
}
.doctor-dir-card:hover { border-color:#7c3aed;background:#f5f3ff;transform:translateY(-1px); }
.doctor-dir-avatar {
    width:52px;height:52px;border-radius:14px;
    background:linear-gradient(135deg,#7c3aed,#4c1d95);
    display:flex;align-items:center;justify-content:center;
    color:white;font-size:22px;flex-shrink:0;
}
.doctor-dir-info { flex:1; }
.doctor-dir-name { font-size:15px;font-weight:700;color:#0f172a; }
.doctor-dir-spec { font-size:12px;color:#7c3aed;font-weight:600;margin-top:2px; }
.doctor-dir-hospital, .doctor-dir-phone { font-size:12px;color:#64748b;margin-top:2px; }
.book-appt-btn {
    padding:9px 16px;background:linear-gradient(135deg,#7c3aed,#6d28d9);
    color:white;border:none;border-radius:10px;font-size:13px;font-weight:700;
    cursor:pointer;font-family:inherit;white-space:nowrap;transition:all 0.2s;
    display:flex;align-items:center;gap:6px;flex-shrink:0;
}
.book-appt-btn:hover { background:linear-gradient(135deg,#6d28d9,#5b21b6);transform:translateY(-1px); }

/* Role badge */
#role-badge { font-size:11px !important; }

/* Footer credit */
body { padding-bottom: 28px; }

/* Nav group label */
.nav-group-label {
    font-size:10px;font-weight:800;letter-spacing:1px;
    text-transform:uppercase;padding:12px 16px 4px;
    opacity:0.7;
}

/* ════════════════════════════════════════════════════════
   NURABILT v3 — Complete Design System Extensions
   Doctor Discovery, Schedule, Intake, Patient DB
   ════════════════════════════════════════════════════════ */

/* ── Toggle Switch ───────────────────────────────────── */
.toggle-switch { position:relative;display:inline-block;width:44px;height:24px;flex-shrink:0; }
.toggle-switch input { opacity:0;width:0;height:0; }
.toggle-slider {
    position:absolute;cursor:pointer;inset:0;
    background:#cbd5e1;border-radius:24px;transition:.3s;
}
.toggle-slider:before {
    content:"";position:absolute;height:18px;width:18px;
    left:3px;bottom:3px;background:white;border-radius:50%;transition:.3s;
    box-shadow:0 1px 4px rgba(0,0,0,0.2);
}
.toggle-switch input:checked + .toggle-slider { background:#16a34a; }
.toggle-switch input:checked + .toggle-slider:before { transform:translateX(20px); }

/* ── Doctor Grid (Find a Doctor) ─────────────────────── */
.doctor-grid {
    display:grid;
    grid-template-columns:repeat(auto-fill,minmax(280px,1fr));
    gap:16px;
}
.doctor-grid-card {
    background:white;border:1.5px solid #e2e8f0;border-radius:18px;
    padding:18px;display:flex;flex-direction:column;gap:12px;
    transition:all .2s;position:relative;overflow:hidden;
}
.doctor-grid-card::before {
    content:'';position:absolute;top:0;left:0;right:0;height:3px;
    background:linear-gradient(90deg,#7c3aed,#0f7fdb);
}
.doctor-grid-card:hover {
    border-color:#7c3aed;
    box-shadow:0 8px 32px rgba(124,58,237,0.12);
    transform:translateY(-2px);
}
.dgc-top { display:flex;gap:12px;align-items:flex-start; }
.dgc-avatar-wrap { display:flex;flex-direction:column;align-items:center;gap:6px;flex-shrink:0; }
.dgc-avatar {
    width:52px;height:52px;border-radius:14px;
    background:linear-gradient(135deg,#7c3aed,#4c1d95);
    display:flex;align-items:center;justify-content:center;
    color:white;font-size:22px;
}
.dgc-info { flex:1;min-width:0; }
.dgc-name { font-size:15px;font-weight:800;color:#0f172a;line-height:1.3; }
.dgc-spec { font-size:12px;font-weight:600;color:#7c3aed;margin-top:2px; }
.dgc-rating { margin-top:4px; }
.avail-badge {
    font-size:10px;font-weight:700;padding:2px 8px;border-radius:20px;
    display:inline-flex;align-items:center;gap:4px;
}
.avail-badge i { font-size:6px; }
.avail-yes { background:#dcfce7;color:#16a34a; }
.avail-no  { background:#fee2e2;color:#dc2626; }
.dgc-meta { display:flex;flex-direction:column;gap:4px; }
.dgc-meta div { font-size:12px;color:#64748b;display:flex;align-items:center;gap:6px; }
.dgc-meta i { width:12px;color:#94a3b8;flex-shrink:0; }
.dgc-slots-label { font-size:11px;font-weight:700;color:#374151;text-transform:uppercase;letter-spacing:0.5px; }
.dgc-slots { display:flex;flex-wrap:wrap;gap:6px; }
.slot-chip {
    font-size:11px;padding:3px 9px;background:#f5f3ff;
    border:1px solid #ddd6fe;border-radius:20px;color:#6d28d9;font-weight:600;
}
.dgc-book-btn {
    width:100%;padding:11px;
    background:linear-gradient(135deg,#7c3aed,#6d28d9);
    color:white;border:none;border-radius:11px;
    font-size:13px;font-weight:700;cursor:pointer;font-family:inherit;
    display:flex;align-items:center;justify-content:center;gap:7px;
    transition:all .2s;margin-top:auto;
}
.dgc-book-btn:hover { background:linear-gradient(135deg,#6d28d9,#5b21b6);transform:translateY(-1px); }

/* Slot select buttons in booking modal */
.slot-select-btn {
    padding:8px 12px;background:#f8fafc;border:1.5px solid #e2e8f0;
    border-radius:10px;font-size:11px;font-weight:600;cursor:pointer;
    font-family:inherit;color:#374151;line-height:1.4;text-align:center;
    transition:all .15s;
}
.slot-select-btn:hover { border-color:#7c3aed;background:#f5f3ff;color:#6d28d9; }
.slot-select-btn.selected {
    background:#7c3aed;border-color:#7c3aed;color:white;
}

/* ── Patient Database Table ───────────────────────────── */
.patient-db-table {
    width:100%;border-collapse:collapse;font-size:13px;
}
.patient-db-table thead tr {
    background:linear-gradient(135deg,#1e1b4b,#312e81);
    color:white;
}
.patient-db-table th {
    padding:11px 14px;text-align:left;font-size:11px;
    font-weight:700;letter-spacing:0.5px;text-transform:uppercase;white-space:nowrap;
}
.patient-db-table th:first-child { border-radius:10px 0 0 10px; }
.patient-db-table th:last-child  { border-radius:0 10px 10px 0; }
.patient-db-row { border-bottom:1px solid #f1f5f9;transition:background .15s; }
.patient-db-row:hover { background:#f8fafc; }
.patient-db-table td { padding:11px 14px;color:#374151;vertical-align:top; }
.blood-badge {
    display:inline-block;padding:2px 9px;border-radius:10px;
    background:#eff6ff;color:#0f7fdb;font-size:11px;font-weight:700;
}
.view-patient-btn {
    padding:5px 11px;background:#f5f3ff;border:1.5px solid #7c3aed;
    border-radius:7px;color:#7c3aed;font-size:11px;font-weight:700;
    cursor:pointer;font-family:inherit;display:inline-flex;align-items:center;gap:5px;
    transition:all .15s;
}
.view-patient-btn:hover { background:#7c3aed;color:white; }

/* ── Intake Form Cards ───────────────────────────────── */
.intake-form-card {
    background:white;border:1.5px solid #e2e8f0;border-radius:16px;
    padding:18px;margin-bottom:14px;transition:all .2s;
}
.intake-form-card:hover { border-color:#0f7fdb;box-shadow:0 4px 16px rgba(15,127,219,.08); }
.ifc-header {
    display:flex;justify-content:space-between;align-items:flex-start;
    margin-bottom:14px;padding-bottom:12px;border-bottom:1px solid #f1f5f9;
}
.ifc-patient { font-size:15px;font-weight:700;color:#0f172a; }
.ifc-date { font-size:11px;color:#94a3b8;margin-top:2px; }
.ifc-badge {
    font-size:10px;font-weight:700;padding:3px 10px;
    background:#eff6ff;color:#0f7fdb;border-radius:10px;flex-shrink:0;
}
.ifc-body { display:grid;grid-template-columns:1fr 1fr;gap:10px; }
.ifc-field { background:#f8fafc;border-radius:10px;padding:10px 12px; }
.ifc-field.allergy { background:#fef2f2;border:1px solid #fecaca; }
.ifc-label { font-size:11px;font-weight:700;color:#64748b;margin-bottom:4px;display:flex;align-items:center;gap:5px;text-transform:uppercase;letter-spacing:0.3px; }
.ifc-val { font-size:13px;color:#374151;line-height:1.5; }

/* ── Schedule Manager ────────────────────────────────── */
.form-group { margin-bottom:14px; }
.form-group label { display:block;font-size:12px;font-weight:700;color:#374151;margin-bottom:5px;text-transform:uppercase;letter-spacing:0.4px; }
.form-group input, .form-group select, .form-group textarea {
    width:100%;padding:10px 13px;border:1.5px solid #e2e8f0;
    border-radius:9px;font-size:13px;font-family:inherit;
    background:white;transition:border .15s;box-sizing:border-box;
}
.form-group input:focus, .form-group select:focus {
    outline:none;border-color:#7c3aed;box-shadow:0 0 0 3px rgba(124,58,237,0.1);
}
.doc-btn {
    background:linear-gradient(135deg,#7c3aed,#6d28d9) !important;
}
.doc-btn:hover { background:linear-gradient(135deg,#6d28d9,#5b21b6) !important; }
.doc-header {
    display:flex;align-items:center;gap:14px;
    padding-bottom:16px;margin-bottom:20px;
    border-bottom:2px solid #f5f3ff;
}
.doc-header i {
    font-size:20px;color:#7c3aed;background:#f5f3ff;
    padding:10px;border-radius:12px;flex-shrink:0;
}
.doc-header h2 { font-size:18px;font-weight:800;color:#1e1b4b;margin:0 0 3px; }
.doc-header p  { color:#64748b;font-size:13px;margin:0; }

/* ── Care Team Cards ─────────────────────────────────── */
.care-team-card {
    display:flex;align-items:center;gap:14px;
    padding:14px 16px;background:#f8fafc;
    border:1.5px solid #e2e8f0;border-radius:14px;
    margin-bottom:10px;transition:all .2s;
}
.care-team-card:hover { border-color:#0f7fdb;background:#eff8ff;transform:translateY(-1px); }
.care-team-avatar {
    width:48px;height:48px;border-radius:13px;flex-shrink:0;
    background:linear-gradient(135deg,#0f7fdb,#00c89e);
    display:flex;align-items:center;justify-content:center;
    color:white;font-size:20px;
}
.care-team-info { flex:1;min-width:0; }
.care-team-name { font-size:15px;font-weight:700;color:#0f172a; }
.care-team-spec { font-size:12px;color:#64748b;margin-top:2px; }
.care-team-next { font-size:11px;color:#7c3aed;font-weight:600;margin-top:3px;display:flex;align-items:center;gap:5px; }
.care-team-badge { background:#dcfce7;color:#16a34a;font-size:11px;font-weight:700;padding:3px 10px;border-radius:20px;flex-shrink:0; }

/* ── Login Required Modal ────────────────────────────── */
#login-required-modal { display:none; }

/* ── Role Badge ──────────────────────────────────────── */
#role-badge { white-space:nowrap; }

/* ── Global Footer ───────────────────────────────────── */
.nurabilt-footer {
    position:fixed;bottom:0;left:0;right:0;
    text-align:center;padding:6px;
    background:rgba(255,255,255,0.9);backdrop-filter:blur(6px);
    border-top:1px solid #f1f5f9;z-index:1;pointer-events:none;
}
.nurabilt-footer span {
    font-size:10px;color:#94a3b8;letter-spacing:0.5px;font-weight:500;
}
body { padding-bottom:30px; }

/* ── Wide page card ──────────────────────────────────── */
.page-card.wide { max-width:none; }
#patient-db-table-wrap { border-radius:12px;overflow:hidden;border:1.5px solid #e2e8f0; }

/* ── Responsive ─────────────────────────────────────── */
@media (max-width:768px) {
    .doctor-grid { grid-template-columns:1fr; }
    .ifc-body { grid-template-columns:1fr; }
    .patient-db-table { font-size:11px; }
    .patient-db-table th, .patient-db-table td { padding:8px 10px; }
}
/* ═══════════════════════════════════════════════════════
   NURABILT PORTAL SWITCH BAR
   ═══════════════════════════════════════════════════════ */
#nurabilt-switch-bar {
    background: #f8fafc;
    border-bottom: 1.5px solid #e2e8f0;
    padding: 8px 24px;
    position: sticky;
    top: 0;
    z-index: 50;
    box-shadow: 0 2px 8px rgba(0,0,0,.05);
}
.nsb-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.nsb-label {
    font-size: 11px;
    font-weight: 700;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: .4px;
    margin-right: 4px;
    white-space: nowrap;
}
.nsb-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 7px 16px;
    border-radius: 99px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    border: 2px solid transparent;
    transition: all .18s;
    white-space: nowrap;
    background: transparent;
}
.nsb-patient { color: #0f7fdb; border-color: #bfdbfe; background: #eff6ff; }
.nsb-patient:hover, .nsb-patient.nsb-active {
    background: #0f7fdb; color: white; border-color: #0f7fdb;
    box-shadow: 0 3px 12px rgba(15,127,219,.3);
}
.nsb-doctor { color: #7c3aed; border-color: #ddd6fe; background: #f5f3ff; }
.nsb-doctor:hover, .nsb-doctor.nsb-active {
    background: #7c3aed; color: white; border-color: #7c3aed;
    box-shadow: 0 3px 12px rgba(124,58,237,.3);
}

/* ── Portal CSS isolation ── */
body.mode-patient .doctor-section-wrap { display: none !important; }
body.mode-doctor  .patient-section-wrap { display: none !important; }

@media (max-width: 600px) {
    .nsb-label { display: none; }
    #nurabilt-switch-bar { padding: 6px 12px; }
}

/* ═══════════════════════════════════════════
   NEW STYLES — All 7 requirements
═══════════════════════════════════════════ */

/* Portal pill in header */
#portal-pill { display: none; }
#portal-pill button { transition: all .18s; }
#portal-pill button:hover { opacity: .85; }

/* Provider picker buttons on API Keys page */
.prov-btn {
    padding: 7px 14px;
    border: 1.5px solid #e2e8f0;
    border-radius: 9px;
    background: white;
    color: #374151;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: all .18s;
}
.prov-btn:hover { border-color: #7c3aed; color: #7c3aed; }

/* LLM badge — clickable */
#llm-badge { transition: opacity .15s; }
#llm-badge:hover { opacity: .82; }
.header-badge { cursor: pointer; }

/* History card expand */
.hexp { white-space: pre-wrap; word-break: break-word; }

/* Doctor history tabs wrap */
#doctor-hist-tabs { display: none; flex-wrap: wrap; gap: 4px; }
#doctor-hist-tabs .tab-btn { font-size: 11px; padding: 7px 12px; }

/* Switch bar — sticky below disclaimer */
#nurabilt-switch-bar { position: sticky; top: 0; z-index: 90; }

/* Mobile: hide portal pill text, keep icons */
@media (max-width: 540px) {
    #portal-pill button span { display: none; }
    #portal-pill button i { margin-right: 0; }
}
/* ══════════════════════════════════════════
   GOOGLE LOGIN BUTTON
══════════════════════════════════════════ */
.google-btn {
    width: 100%;
    padding: 11px 16px;
    background: white;
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    color: #374151;
    cursor: pointer;
    font-family: inherit;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all .18s;
    box-shadow: 0 1px 3px rgba(0,0,0,.06);
}
.google-btn:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
    box-shadow: 0 3px 10px rgba(0,0,0,.1);
    transform: translateY(-1px);
}
.google-btn:active { transform: translateY(0); }
.google-btn-doctor {
    border-color: #ddd6fe;
    background: #fdfcff;
}
.google-btn-doctor:hover {
    background: #f5f3ff;
    border-color: #c4b5fd;
    box-shadow: 0 3px 10px rgba(124,58,237,.12);
}

/* Google loading state */
.google-btn.loading {
    opacity: .7;
    pointer-events: none;
}
.google-btn.loading span::after {
    content: '…';
    animation: dots 1.2s infinite;
}
@keyframes dots {
    0%,100% { content:'…'; }
    33%      { content:''; }
    66%      { content:'.'; }
}

/* ═══════════════════════════════════════════════
   Patient Database — edit mode styles
═══════════════════════════════════════════════ */

/* Edit mode row — subtle purple tint + bigger row height */
.patient-db-row.db-edit-mode td { background: #faf5ff; }
.patient-db-row.db-edit-mode:hover td { background: #f5f0fe !important; }

/* Cell input field */
.patient-db-row.db-edit-mode td input {
    display: block;
    width: 100%;
    padding: 6px 8px;
    border: none;
    border-bottom: 2px solid #7c3aed;
    background: transparent;
    font-size: 12px;
    font-family: inherit;
    outline: none;
    box-sizing: border-box;
    transition: border-color .15s;
}
.patient-db-row.db-edit-mode td input:focus {
    border-bottom-color: #4c1d95;
    background: #ede9fe;
}

/* Custom column remove button in header */
.patient-db-table .col-remove-btn {
    background: none;
    border: none;
    color: #ef4444;
    cursor: pointer;
    font-size: 10px;
    margin-left: 4px;
    padding: 0 2px;
    opacity: .7;
    transition: opacity .15s;
}
.patient-db-table .col-remove-btn:hover { opacity: 1; }

/* Add column button in header */
.patient-db-table .col-add-btn {
    padding: 3px 9px;
    background: rgba(255,255,255,0.2);
    border: 1.5px solid rgba(255,255,255,0.5);
    border-radius: 6px;
    color: white;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    white-space: nowrap;
    transition: background .15s;
}
.patient-db-table .col-add-btn:hover { background: rgba(255,255,255,0.35); }

/* ═══════════════════════════════════════════════
   Portal switch bar — locked badge style
═══════════════════════════════════════════════ */
.nsb-btn.nsb-locked {
    opacity: 1 !important;
    cursor: default !important;
    pointer-events: none !important;
}