/* ═══════════════════════════════════════════════════
   City Eye Center — Patient Portal Styles
   ═══════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=Noto+Kufi+Arabic:wght@400;500;600;700&display=swap');

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

:root {
  /* brand */
  --navy:      #0B1D3A;
  --blue:      #1565C0;
  --blue-mid:  #1976D2;
  --blue-lt:   #29B6F6;
  --teal:      #00ACC1;
  --white:     #FFFFFF;
  --off-white: #F0F4FB;
  --gray-lt:   #E4EBF5;
  --gray:      #8695A4;
  --text:      #0D1B2A;
  --text-md:   #3D5166;
  /* portal layout */
  --sidebar-w: 264px;
  --topbar-h:  66px;
  /* status */
  --success:   #00ACC1;
  --warning:   #F57C00;
  --danger:    #E53935;
  --info:      #1565C0;
  /* misc */
  --radius:    18px;
  --radius-sm: 10px;
  --shadow:    0 2px 14px rgba(11,29,58,.08);
  --shadow-md: 0 8px 32px rgba(11,29,58,.14);
  --border:    1px solid rgba(11,29,58,.07);
  --tr:        all .28s cubic-bezier(.4,0,.2,1);
}

html { scroll-behavior: smooth; }
body {
  font-family: 'Inter', 'Segoe UI', sans-serif;
  color: var(--text);
  background: var(--off-white);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
a { text-decoration: none; color: inherit; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, select, textarea { font-family: inherit; }
svg { display: block; }

/* ── SCROLLBAR ───────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--gray-lt); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--gray); }

/* ══════════════════════════════════════════════════
   LOGIN PAGE
══════════════════════════════════════════════════ */
.login-wrap {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 100vh;
}

/* left branded panel */
.login-brand {
  background: linear-gradient(145deg, var(--navy) 0%, #0d2b5e 60%, #0a3d6b 100%);
  display: flex; flex-direction: column;
  justify-content: center; align-items: center;
  padding: 60px 56px;
  position: relative; overflow: hidden;
}
.login-brand::before {
  content: '';
  position: absolute; inset: 0;
  background: radial-gradient(ellipse at 30% 40%, rgba(0,172,193,.18) 0%, transparent 60%),
              radial-gradient(ellipse at 80% 80%, rgba(21,101,192,.22) 0%, transparent 50%);
}
.lb-orb {
  position: absolute; border-radius: 50%;
  background: rgba(0,172,193,.08);
  animation: orb-pulse 6s ease-in-out infinite;
}
.lb-orb-1 { width:340px; height:340px; top:-80px; left:-80px; animation-delay:0s; }
.lb-orb-2 { width:240px; height:240px; bottom:-40px; right:-40px; animation-delay:2s; }
.lb-orb-3 { width:160px; height:160px; top:50%; right:10%; transform:translateY(-50%); animation-delay:4s; }
@keyframes orb-pulse { 0%,100%{transform:scale(1);opacity:.7} 50%{transform:scale(1.08);opacity:1} }

.lb-content { position:relative; z-index:1; text-align:center; }
.lb-logo { height: 52px; margin-bottom: 40px; }
.lb-badge {
  display: inline-flex; align-items: center; gap: 8px;
  background: rgba(0,172,193,.18); border: 1px solid rgba(0,172,193,.3);
  color: #7FD9E5; font-size: 12px; font-weight: 600; letter-spacing: .06em;
  padding: 6px 14px; border-radius: 20px; margin-bottom: 28px; text-transform: uppercase;
}
.lb-badge span { width:7px; height:7px; border-radius:50%; background:var(--teal); display:inline-block; }
.lb-title { font-size: 34px; font-weight: 800; color: #fff; line-height: 1.2; margin-bottom: 16px; }
.lb-title em { font-style:normal; color: var(--teal); }
.lb-sub { font-size: 15px; color: rgba(255,255,255,.6); line-height: 1.7; max-width: 340px; margin: 0 auto 48px; }
.lb-features { display: flex; flex-direction: column; gap: 14px; text-align: left; }
.lb-feature {
  display: flex; align-items: center; gap: 12px;
  color: rgba(255,255,255,.8); font-size: 14px;
}
.lb-feature-icon {
  width: 36px; height: 36px; border-radius: 10px;
  background: rgba(0,172,193,.15); border: 1px solid rgba(0,172,193,.2);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; color: var(--teal);
}
.lb-feature-icon svg { width:16px; height:16px; }

/* right form panel */
.login-form-panel {
  display: flex; flex-direction: column;
  justify-content: center; align-items: center;
  padding: 60px 56px; background: var(--white);
}
.lf-inner { width: 100%; max-width: 400px; }
.lf-heading { font-size: 26px; font-weight: 800; color: var(--navy); margin-bottom: 6px; }
.lf-sub { font-size: 14px; color: var(--text-md); margin-bottom: 40px; }

.form-group { margin-bottom: 20px; }
.form-label {
  display: block; font-size: 13px; font-weight: 600;
  color: var(--text); margin-bottom: 7px; letter-spacing: .01em;
}
.form-input {
  width: 100%; padding: 12px 16px;
  border: 1.5px solid var(--gray-lt); border-radius: var(--radius-sm);
  font-size: 14.5px; color: var(--text);
  background: var(--white); transition: var(--tr);
  outline: none;
}
.form-input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(21,101,192,.1); }
.form-input.error { border-color: var(--danger); }
.form-input::placeholder { color: var(--gray); }

.input-wrap { position: relative; }
.input-wrap .form-input { padding-right: 44px; }
.input-icon {
  position: absolute; right: 14px; top: 50%; transform: translateY(-50%);
  width: 18px; height: 18px; color: var(--gray); pointer-events: none;
}
.input-icon svg { width:18px; height:18px; }
.toggle-pwd {
  position: absolute; right: 14px; top: 50%; transform: translateY(-50%);
  color: var(--gray); cursor: pointer; width:18px; height:18px;
  display:flex; align-items:center; justify-content:center;
}
.toggle-pwd svg { width:18px; height:18px; }

.error-msg { font-size:12.5px; color:var(--danger); margin-top:6px; display:none; }
.error-msg.show { display:block; }

.btn-login {
  width: 100%; padding: 13px;
  background: linear-gradient(135deg, var(--blue) 0%, #0D47A1 100%);
  color: var(--white); font-size: 15px; font-weight: 700;
  border-radius: var(--radius-sm); letter-spacing: .02em;
  transition: var(--tr); margin-top: 8px;
  box-shadow: 0 4px 14px rgba(21,101,192,.3);
  display:flex; align-items:center; justify-content:center; gap:8px;
}
.btn-login:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(21,101,192,.4); }
.btn-login:active { transform: translateY(0); }
.btn-login:disabled { opacity:.6; pointer-events:none; }
.btn-login .spinner {
  width:16px; height:16px; border:2px solid rgba(255,255,255,.3);
  border-top-color:#fff; border-radius:50%;
  animation: spin .7s linear infinite;
}

.login-footer {
  margin-top: 32px; padding-top: 24px; border-top: var(--border);
  text-align: center; font-size: 13px; color: var(--text-md); line-height: 1.6;
}
.login-footer strong { color: var(--navy); }

/* ══════════════════════════════════════════════════
   PORTAL LAYOUT (sidebar + main)
══════════════════════════════════════════════════ */
.portal-layout {
  display: flex; min-height: 100vh;
}

/* ── SIDEBAR ─────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--navy);
  display: flex; flex-direction: column;
  position: fixed; left: 0; top: 0; bottom: 0;
  z-index: 100; transition: transform .3s cubic-bezier(.4,0,.2,1);
  overflow-y: auto; overflow-x: hidden;
}
.sidebar-logo {
  padding: 0 24px; height: var(--topbar-h);
  display: flex; align-items: center;
  border-bottom: 1px solid rgba(255,255,255,.06);
  flex-shrink: 0;
}
.sidebar-logo img { height: 36px; }

.sidebar-nav {
  padding: 20px 12px;
  display: flex; flex-direction: column; gap: 2px;
  flex: 1;
}
.nav-section-label {
  font-size: 10px; font-weight: 700; letter-spacing: .1em;
  color: rgba(255,255,255,.28); text-transform: uppercase;
  padding: 12px 12px 6px;
}
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px; border-radius: 12px;
  color: rgba(255,255,255,.6);
  font-size: 13.5px; font-weight: 500;
  transition: var(--tr); position: relative;
  text-decoration: none;
}
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }
.nav-item:hover { background: rgba(255,255,255,.07); color: rgba(255,255,255,.9); }
.nav-item.active {
  background: rgba(21,101,192,.25); color: #fff;
}
.nav-item.active::before {
  content: ''; position: absolute; left: 0; top: 8px; bottom: 8px;
  width: 3px; border-radius: 0 2px 2px 0;
  background: var(--teal);
}
.nav-item .nav-badge {
  margin-left: auto; background: var(--danger);
  color: #fff; font-size: 10px; font-weight: 700;
  padding: 2px 6px; border-radius: 20px; min-width: 18px; text-align: center;
}

.sidebar-footer {
  padding: 16px 12px; border-top: 1px solid rgba(255,255,255,.06);
  flex-shrink: 0;
}
.sidebar-user {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 12px;
  margin-bottom: 4px;
}
.user-avatar {
  width: 36px; height: 36px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: #fff;
  flex-shrink: 0; letter-spacing: .02em;
}
.user-info-text { overflow: hidden; }
.user-name-text {
  font-size: 13px; font-weight: 600; color: #fff;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.user-role-text { font-size: 11px; color: rgba(255,255,255,.45); }
.logout-btn {
  display: flex; align-items: center; gap: 10px;
  width: 100%; padding: 10px 14px; border-radius: 12px;
  color: rgba(255,255,255,.45); font-size: 13px; font-weight: 500;
  transition: var(--tr);
}
.logout-btn svg { width:16px; height:16px; }
.logout-btn:hover { background: rgba(229,57,53,.15); color: #ff8a80; }

/* sidebar overlay (mobile) */
.sidebar-overlay {
  display: none; position: fixed; inset: 0; z-index: 99;
  background: rgba(11,29,58,.5); backdrop-filter: blur(4px);
}
.sidebar-overlay.show { display: block; }

/* ── MAIN AREA ───────────────────────────────────── */
.portal-main {
  margin-left: var(--sidebar-w);
  flex: 1; display: flex; flex-direction: column;
  min-height: 100vh; min-width: 0;
}

/* ── TOPBAR ──────────────────────────────────────── */
.topbar {
  height: var(--topbar-h);
  background: var(--white);
  border-bottom: var(--border);
  display: flex; align-items: center;
  padding: 0 28px; gap: 12px;
  position: sticky; top: 0; z-index: 50;
}
.sidebar-toggle {
  width: 36px; height: 36px; display: none;
  align-items: center; justify-content: center;
  border-radius: 9px; color: var(--text-md);
  transition: var(--tr); flex-shrink: 0;
}
.sidebar-toggle svg { width:20px; height:20px; }
.sidebar-toggle:hover { background: var(--off-white); color: var(--text); }
.topbar-title { font-size: 16px; font-weight: 700; color: var(--navy); flex: 1; }
.topbar-right { display: flex; align-items: center; gap: 8px; }

.notif-btn-wrap { position: relative; }
.notif-btn {
  width: 38px; height: 38px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-md); transition: var(--tr);
}
.notif-btn svg { width:20px; height:20px; }
.notif-btn:hover { background: var(--off-white); color: var(--blue); }
.notif-badge {
  position: absolute; top: 4px; right: 4px;
  width: 17px; height: 17px; border-radius: 50%;
  background: var(--danger); color: #fff;
  font-size: 9px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--white);
}
.topbar-avatar {
  width: 36px; height: 36px; border-radius: 10px;
  font-size: 12px; font-weight: 700; color: #fff;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; letter-spacing: .02em;
}

/* ── NOTIFICATION PANEL ──────────────────────────── */
.notif-panel {
  position: fixed; top: calc(var(--topbar-h) + 6px); right: 20px;
  width: 360px; max-height: 480px;
  background: var(--white); border-radius: var(--radius);
  box-shadow: var(--shadow-md); border: var(--border);
  z-index: 200; overflow: hidden;
  opacity: 0; transform: translateY(-8px) scale(.97);
  pointer-events: none;
  transition: opacity .2s, transform .2s;
}
.notif-panel.open { opacity:1; transform:none; pointer-events:auto; }
.notif-panel-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: var(--border);
}
.notif-panel-title { font-size: 14px; font-weight: 700; color: var(--navy); }
#markAllRead {
  font-size: 12px; color: var(--blue); font-weight: 600;
  cursor: pointer; transition: color .2s;
}
#markAllRead:hover { color: var(--navy); }
#notifList { overflow-y: auto; max-height: 380px; }
.notif-item {
  display: flex; gap: 12px;
  padding: 14px 20px; cursor: pointer; transition: background .2s;
  border-bottom: var(--border);
}
.notif-item:last-child { border-bottom: none; }
.notif-item:hover { background: var(--off-white); }
.notif-item.unread { background: rgba(21,101,192,.04); }
.notif-icon-wrap {
  width: 36px; height: 36px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.notif-icon-wrap svg { width:16px; height:16px; }
.notif-appointment { background: rgba(21,101,192,.1); color: var(--blue); }
.notif-prescription { background: rgba(0,172,193,.1); color: var(--teal); }
.notif-general { background: rgba(11,29,58,.07); color: var(--text-md); }
.notif-body { flex: 1; min-width: 0; }
.notif-title { font-size: 13px; font-weight: 600; color: var(--navy); margin-bottom: 3px; }
.notif-msg { font-size: 12px; color: var(--text-md); line-height: 1.5; margin-bottom: 4px; }
.notif-time { font-size: 11px; color: var(--gray); }
.notif-empty { padding: 32px; text-align: center; color: var(--gray); font-size: 13px; }

/* ── PAGE CONTENT ────────────────────────────────── */
.portal-content { padding: 28px 32px; flex: 1; }

.page-header { margin-bottom: 28px; }
.page-title { font-size: 22px; font-weight: 800; color: var(--navy); margin-bottom: 4px; }
.page-sub { font-size: 14px; color: var(--text-md); }
.page-header-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap; margin-bottom: 28px;
}

/* ── STAT CARDS ──────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 18px; margin-bottom: 28px;
}
.stat-card {
  background: var(--white); border-radius: var(--radius);
  padding: 22px 24px; border: var(--border);
  box-shadow: var(--shadow); transition: var(--tr);
  display: flex; align-items: center; gap: 16px;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.stat-icon {
  width: 52px; height: 52px; border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.stat-icon svg { width: 22px; height: 22px; }
.stat-icon.blue  { background: rgba(21,101,192,.1);  color: var(--blue); }
.stat-icon.teal  { background: rgba(0,172,193,.1);   color: var(--teal); }
.stat-icon.warn  { background: rgba(245,124,0,.1);   color: var(--warning); }
.stat-icon.navy  { background: rgba(11,29,58,.08);   color: var(--navy); }
.stat-icon.green { background: rgba(46,125,50,.1);   color: #2E7D32; }
.stat-num  { font-size: 26px; font-weight: 800; color: var(--navy); line-height: 1; }
.stat-label{ font-size: 12.5px; color: var(--text-md); margin-top: 3px; font-weight: 500; }

/* ── CARDS ───────────────────────────────────────── */
.card {
  background: var(--white); border-radius: var(--radius);
  border: var(--border); box-shadow: var(--shadow);
  overflow: hidden;
}
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 24px; border-bottom: var(--border);
}
.card-title { font-size: 15px; font-weight: 700; color: var(--navy); }
.card-body { padding: 20px 24px; }

.section-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 20px;
}

/* ── APPOINTMENT CARDS ───────────────────────────── */
.apt-card {
  background: var(--white); border-radius: var(--radius);
  border: var(--border); box-shadow: var(--shadow);
  padding: 20px 22px; transition: var(--tr);
  border-left: 4px solid transparent;
}
.apt-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.apt-card.upcoming  { border-left-color: var(--blue); }
.apt-card.completed { border-left-color: var(--gray); }
.apt-card.cancelled { border-left-color: var(--danger); }

.apt-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.apt-doctor { font-size: 15px; font-weight: 700; color: var(--navy); }
.apt-specialty { font-size: 12.5px; color: var(--text-md); margin-top: 2px; }
.apt-meta { display: flex; flex-direction: column; gap: 7px; }
.apt-meta-item {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--text-md);
}
.apt-meta-item svg { width: 14px; height: 14px; color: var(--gray); flex-shrink: 0; }
.apt-countdown {
  margin-top: 14px; padding-top: 14px; border-top: var(--border);
  font-size: 12.5px; font-weight: 600;
  display: flex; align-items: center; gap: 6px;
}
.apt-countdown.soon   { color: var(--warning); }
.apt-countdown.normal { color: var(--blue); }
.apt-countdown.past   { color: var(--gray); }
.apt-countdown svg { width:14px; height:14px; }

/* ── PRESCRIPTION CARDS ──────────────────────────── */
.rx-card {
  background: var(--white); border-radius: var(--radius);
  border: var(--border); box-shadow: var(--shadow);
  overflow: hidden; transition: var(--tr);
}
.rx-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }

.rx-card-header {
  padding: 18px 22px 14px;
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  border-bottom: var(--border);
}
.rx-card.active    .rx-card-header { background: rgba(0,172,193,.04); }
.rx-card.refill-due .rx-card-header { background: rgba(245,124,0,.05); }
.rx-card.completed  .rx-card-header { background: rgba(11,29,58,.03); }

.rx-doctor  { font-size: 14px; font-weight: 700; color: var(--navy); }
.rx-date-str{ font-size: 12px; color: var(--text-md); margin-top: 3px; }

.rx-medications { padding: 14px 22px; display: flex; flex-direction: column; gap: 12px; }
.med-item {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 12px 14px; border-radius: 12px;
  background: var(--off-white); border: var(--border);
}
.med-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--teal); flex-shrink: 0; margin-top: 5px;
}
.med-name  { font-size: 13.5px; font-weight: 600; color: var(--navy); }
.med-details { font-size: 12px; color: var(--text-md); margin-top: 3px; line-height: 1.5; }
.med-instr { font-size: 11.5px; color: var(--gray); margin-top: 4px; font-style: italic; }

.rx-footer {
  padding: 12px 22px 18px;
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; flex-wrap: wrap; border-top: var(--border);
}
.rx-refill {
  font-size: 12px; font-weight: 600;
  display: flex; align-items: center; gap: 5px;
}
.rx-refill.due   { color: var(--warning); }
.rx-refill.ok    { color: var(--success); }
.rx-refill.none  { color: var(--gray); }
.rx-refill svg   { width:13px; height:13px; }

/* ── RECORDS TIMELINE ────────────────────────────── */
.timeline { display: flex; flex-direction: column; gap: 0; }
.timeline-item {
  display: flex; gap: 0; position: relative;
  padding-bottom: 24px;
}
.timeline-item:last-child { padding-bottom: 0; }
.timeline-left {
  display: flex; flex-direction: column; align-items: center;
  width: 52px; flex-shrink: 0; padding-top: 2px;
}
.timeline-dot {
  width: 36px; height: 36px; border-radius: 50%;
  background: linear-gradient(135deg, var(--teal), var(--blue));
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 0 0 4px rgba(0,172,193,.12); flex-shrink: 0;
  color: #fff;
}
.timeline-dot svg { width: 16px; height: 16px; }
.timeline-line {
  flex: 1; width: 2px;
  background: linear-gradient(to bottom, var(--teal), transparent);
  margin-top: 6px;
}
.timeline-item:last-child .timeline-line { display: none; }
.timeline-card {
  flex: 1; background: var(--white); border-radius: var(--radius);
  border: var(--border); box-shadow: var(--shadow);
  overflow: hidden; margin-left: 4px;
}
.timeline-card-head {
  padding: 16px 20px 14px; border-bottom: var(--border);
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
}
.timeline-card-date { font-size: 12.5px; font-weight: 600; color: var(--blue); letter-spacing:.01em; }
.timeline-card-type { font-size: 13px; font-weight: 700; color: var(--navy); margin-top: 1px; }
.timeline-card-doctor { font-size: 12px; color: var(--text-md); margin-top: 2px; }
.timeline-card-body { padding: 16px 20px; }

.eye-measurements {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 14px;
}
.eye-measurement-card {
  background: var(--off-white); border-radius: 12px; padding: 12px 14px;
  border: var(--border);
}
.em-label { font-size: 10px; font-weight: 700; color: var(--gray); text-transform: uppercase; letter-spacing:.06em; margin-bottom: 8px; }
.em-row { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 4px; }
.em-eye-label { font-size: 11.5px; color: var(--text-md); font-weight: 500; }
.em-value { font-size: 13px; font-weight: 700; color: var(--navy); }
.em-iop-high { color: var(--warning); }

.diagnosis-block { margin-top: 12px; padding: 12px 14px; background: rgba(21,101,192,.06); border-radius: 10px; border-left: 3px solid var(--blue); }
.diagnosis-label { font-size: 11px; font-weight: 700; color: var(--blue); letter-spacing:.06em; text-transform: uppercase; margin-bottom: 4px; }
.diagnosis-text { font-size: 13px; color: var(--navy); font-weight: 600; }
.diagnosis-notes { font-size: 12px; color: var(--text-md); margin-top: 6px; line-height: 1.6; }

/* ── PROFILE PAGE ────────────────────────────────── */
.profile-hero {
  background: linear-gradient(135deg, var(--navy) 0%, #0d2b5e 100%);
  border-radius: var(--radius); padding: 32px 36px; margin-bottom: 24px;
  display: flex; align-items: center; gap: 24px;
  position: relative; overflow: hidden;
}
.profile-hero::before {
  content:''; position:absolute; right:-40px; top:-40px;
  width:240px; height:240px; border-radius:50%;
  background: rgba(0,172,193,.1);
}
.profile-hero-avatar {
  width: 72px; height: 72px; border-radius: 20px;
  font-size: 24px; font-weight: 800; color: #fff;
  display: flex; align-items: center; justify-content: center;
  position: relative; z-index: 1; flex-shrink: 0;
  border: 3px solid rgba(255,255,255,.15);
}
.profile-hero-info { position: relative; z-index: 1; }
.profile-name  { font-size: 22px; font-weight: 800; color: #fff; margin-bottom: 4px; }
.profile-pid   { font-size: 13px; color: rgba(255,255,255,.55); margin-bottom: 10px; }
.profile-badges { display: flex; gap: 8px; flex-wrap: wrap; }
.profile-badge {
  display: inline-flex; align-items: center; gap: 5px;
  background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.15);
  color: rgba(255,255,255,.8); font-size: 12px; font-weight: 500;
  padding: 5px 12px; border-radius: 20px;
}
.profile-badge svg { width:12px; height:12px; }

.info-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}
.info-item { }
.info-label {
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em;
  color: var(--gray); margin-bottom: 4px;
}
.info-value { font-size: 14px; font-weight: 600; color: var(--text); }
.info-value.highlight { color: var(--danger); }

/* ── ADMIN DASHBOARD ─────────────────────────────── */
.patients-table-wrap { overflow-x: auto; }
.patients-table {
  width: 100%; border-collapse: collapse; font-size: 13.5px;
}
.patients-table th {
  text-align: left; font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .07em;
  color: var(--gray); padding: 12px 16px;
  border-bottom: var(--border); white-space: nowrap;
  background: var(--off-white);
}
.patients-table th:first-child { border-radius: var(--radius-sm) 0 0 0; }
.patients-table th:last-child  { border-radius: 0 var(--radius-sm) 0 0; }
.patients-table td {
  padding: 13px 16px; border-bottom: var(--border);
  color: var(--text); vertical-align: middle;
}
.patients-table tr:last-child td { border-bottom: none; }
.patients-table tr:hover td { background: rgba(21,101,192,.03); cursor: pointer; }
.patients-table .pt-name { font-weight: 600; color: var(--navy); }
.patients-table .pt-pid  { font-size: 12px; color: var(--text-md); margin-top: 1px; }
.pt-avatar {
  width: 34px; height: 34px; border-radius: 9px;
  font-size: 12px; font-weight: 700; color: #fff;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.pt-name-cell { display: flex; align-items: center; gap: 10px; }

/* patient detail panel */
.patient-detail-backdrop {
  position: fixed; inset: 0; z-index: 300;
  background: rgba(11,29,58,.45); backdrop-filter: blur(4px);
  display: none; align-items: stretch; justify-content: flex-end;
}
.patient-detail-backdrop.open { display: flex; }
.patient-detail-panel {
  width: 560px; max-width: 95vw; background: var(--white);
  height: 100vh; overflow-y: auto;
  box-shadow: -8px 0 40px rgba(11,29,58,.15);
  animation: slideInRight .3s cubic-bezier(.4,0,.2,1);
}
@keyframes slideInRight { from{transform:translateX(100%)} to{transform:translateX(0)} }
.panel-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 24px; border-bottom: var(--border);
  position: sticky; top: 0; background: var(--white); z-index: 2;
}
.panel-title { font-size: 16px; font-weight: 700; color: var(--navy); }
.panel-close {
  width: 34px; height: 34px; border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-md); transition: var(--tr);
}
.panel-close svg { width:18px; height:18px; }
.panel-close:hover { background: var(--off-white); color: var(--danger); }
.panel-body { padding: 24px; }

.panel-patient-hero {
  display: flex; align-items: center; gap: 16px;
  background: linear-gradient(135deg, var(--navy), #0d2b5e);
  border-radius: var(--radius); padding: 20px 22px; margin-bottom: 20px;
}
.panel-avatar {
  width: 52px; height: 52px; border-radius: 14px;
  font-size: 18px; font-weight: 800; color: #fff;
  display: flex; align-items: center; justify-content: center;
}
.panel-patient-name { font-size: 17px; font-weight: 800; color: #fff; margin-bottom: 2px; }
.panel-patient-sub  { font-size: 12px; color: rgba(255,255,255,.55); }

.panel-tabs { display: flex; gap: 2px; margin-bottom: 20px; background: var(--off-white); border-radius: 12px; padding: 4px; }
.panel-tab {
  flex: 1; padding: 8px 4px; border-radius: 9px;
  font-size: 12.5px; font-weight: 600; color: var(--text-md);
  text-align: center; cursor: pointer; transition: var(--tr);
}
.panel-tab.active { background: var(--white); color: var(--blue); box-shadow: 0 1px 4px rgba(11,29,58,.08); }

.panel-tab-content { display: none; }
.panel-tab-content.active { display: block; }

.panel-section-title {
  font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em;
  color: var(--gray); margin-bottom: 12px; margin-top: 18px;
}
.panel-section-title:first-child { margin-top: 0; }

.panel-info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; margin-bottom: 16px; }
.panel-info-item { }
.panel-info-label { font-size: 11px; font-weight: 700; color: var(--gray); text-transform: uppercase; letter-spacing:.06em; margin-bottom: 3px; }
.panel-info-value { font-size: 13px; font-weight: 600; color: var(--navy); }

.mini-apt-card, .mini-rx-card, .mini-rec-card {
  background: var(--off-white); border-radius: 12px;
  padding: 12px 14px; border: var(--border); margin-bottom: 8px;
}
.mini-apt-doctor { font-size: 13px; font-weight: 700; color: var(--navy); }
.mini-apt-details { font-size: 12px; color: var(--text-md); margin-top: 3px; }

/* ── FORMS ───────────────────────────────────────── */
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.form-section-title {
  font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em;
  color: var(--gray); margin: 18px 0 12px; padding-bottom: 8px; border-bottom: var(--border);
}
.form-section-title:first-child { margin-top: 0; }
select.form-input { appearance: none; cursor: pointer; }
textarea.form-input { resize: vertical; min-height: 80px; }
.form-hint { font-size: 11.5px; color: var(--gray); margin-top: 5px; }

/* medication rows in admin form */
.med-row {
  display: grid; grid-template-columns: 2fr 1fr 1fr 1fr auto;
  gap: 10px; align-items: end; margin-bottom: 10px;
}
.remove-med-btn {
  width: 34px; height: 38px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: var(--danger); transition: var(--tr); flex-shrink: 0;
}
.remove-med-btn:hover { background: rgba(229,57,53,.1); }
.remove-med-btn svg { width:16px; height:16px; }
.add-med-btn {
  display: flex; align-items: center; gap: 6px;
  color: var(--blue); font-size: 13px; font-weight: 600;
  padding: 6px 0; transition: color .2s; cursor: pointer;
}
.add-med-btn svg { width:16px; height:16px; }
.add-med-btn:hover { color: var(--navy); }

/* ── MODALS ──────────────────────────────────────── */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 400;
  background: rgba(11,29,58,.5); backdrop-filter: blur(6px);
  display: none; align-items: center; justify-content: center; padding: 20px;
}
.modal-backdrop.open { display: flex; }
.modal {
  background: var(--white); border-radius: var(--radius);
  width: 100%; max-width: 560px; max-height: 90vh;
  overflow-y: auto; box-shadow: 0 24px 64px rgba(11,29,58,.25);
  animation: modalIn .25s cubic-bezier(.34,1.56,.64,1);
}
.modal-lg { max-width: 720px; }
@keyframes modalIn { from{opacity:0;transform:scale(.94)} to{opacity:1;transform:scale(1)} }
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 22px 28px; border-bottom: var(--border);
  position: sticky; top: 0; background: var(--white); z-index: 2;
}
.modal-title { font-size: 17px; font-weight: 800; color: var(--navy); }
.modal-close {
  width: 34px; height: 34px; border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-md); transition: var(--tr);
}
.modal-close svg { width:18px; height:18px; }
.modal-close:hover { background: var(--off-white); color: var(--danger); }
.modal-body { padding: 24px 28px; }
.modal-footer {
  display: flex; justify-content: flex-end; gap: 10px;
  padding: 18px 28px; border-top: var(--border);
  position: sticky; bottom: 0; background: var(--white);
}

/* ── BUTTONS ─────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 18px; border-radius: var(--radius-sm);
  font-size: 13.5px; font-weight: 600; letter-spacing: .01em;
  transition: var(--tr); cursor: pointer; border: none;
  white-space: nowrap;
}
.btn svg { width: 15px; height: 15px; flex-shrink: 0; }

.btn-primary {
  background: linear-gradient(135deg, var(--blue) 0%, #0D47A1 100%);
  color: #fff;
  box-shadow: 0 3px 10px rgba(21,101,192,.3);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 5px 16px rgba(21,101,192,.4); }

.btn-teal {
  background: linear-gradient(135deg, var(--teal) 0%, #00838F 100%);
  color: #fff; box-shadow: 0 3px 10px rgba(0,172,193,.3);
}
.btn-teal:hover { transform: translateY(-1px); box-shadow: 0 5px 16px rgba(0,172,193,.4); }

.btn-ghost {
  background: transparent; color: var(--blue);
  border: 1.5px solid var(--blue);
}
.btn-ghost:hover { background: rgba(21,101,192,.06); }

.btn-ghost-gray {
  background: transparent; color: var(--text-md);
  border: 1.5px solid var(--gray-lt);
}
.btn-ghost-gray:hover { background: var(--off-white); }

.btn-danger-ghost { background: transparent; color: var(--danger); border: 1.5px solid rgba(229,57,53,.3); }
.btn-danger-ghost:hover { background: rgba(229,57,53,.07); }

.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-lg { padding: 12px 24px; font-size: 15px; }

.btn:disabled { opacity:.5; pointer-events: none; }

/* icon only btn */
.btn-icon {
  width: 34px; height: 34px; border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  transition: var(--tr); cursor: pointer; border: none;
}
.btn-icon svg { width:16px; height:16px; }
.btn-icon.blue { color: var(--blue); }
.btn-icon.red  { color: var(--danger); }
.btn-icon:hover { background: var(--off-white); }

/* FAB */
.fab {
  position: fixed; bottom: 28px; right: 28px;
  width: 54px; height: 54px; border-radius: 16px;
  background: linear-gradient(135deg, var(--blue), #0D47A1);
  color: #fff; box-shadow: 0 6px 20px rgba(21,101,192,.4);
  display: flex; align-items: center; justify-content: center;
  transition: var(--tr); z-index: 50;
}
.fab svg { width: 22px; height: 22px; }
.fab:hover { transform: translateY(-2px) scale(1.05); box-shadow: 0 10px 28px rgba(21,101,192,.5); }

/* ── BADGES ──────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center;
  padding: 3px 9px; border-radius: 20px;
  font-size: 11.5px; font-weight: 700; letter-spacing: .02em;
  white-space: nowrap;
}
.badge-success { background: rgba(0,172,193,.1);  color: #007C8A; }
.badge-info    { background: rgba(21,101,192,.1);  color: var(--blue); }
.badge-warning { background: rgba(245,124,0,.12); color: #C65F00; }
.badge-danger  { background: rgba(229,57,53,.1);  color: #C62828; }
.badge-neutral { background: var(--gray-lt);       color: var(--text-md); }

/* ── SEARCH BAR ──────────────────────────────────── */
.search-bar {
  position: relative; display: inline-flex; align-items: center;
}
.search-bar svg { position:absolute; left:12px; width:16px; height:16px; color:var(--gray); pointer-events:none; }
.search-input {
  padding: 9px 14px 9px 38px;
  border: 1.5px solid var(--gray-lt); border-radius: var(--radius-sm);
  font-size: 13.5px; color: var(--text); background: var(--white);
  transition: var(--tr); outline: none; width: 240px;
}
.search-input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(21,101,192,.08); }
.search-input::placeholder { color: var(--gray); }

/* ── EMPTY STATE ─────────────────────────────────── */
.empty-state {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 56px 24px; text-align: center;
}
.empty-icon {
  width: 64px; height: 64px; border-radius: 20px;
  background: var(--gray-lt); color: var(--gray);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 16px;
}
.empty-icon svg { width: 28px; height: 28px; }
.empty-title { font-size: 15px; font-weight: 700; color: var(--navy); margin-bottom: 6px; }
.empty-sub   { font-size: 13px; color: var(--text-md); max-width: 280px; line-height: 1.6; }

/* ── LOADING ─────────────────────────────────────── */
.spinner { border:2px solid var(--gray-lt); border-top-color:var(--blue); border-radius:50%; animation:spin .7s linear infinite; }
@keyframes spin { to{transform:rotate(360deg)} }
.page-loading {
  display:flex; align-items:center; justify-content:center;
  height:200px;
}
.page-loading .spinner { width:36px; height:36px; border-width:3px; }

/* ── TOAST ───────────────────────────────────────── */
.toast {
  position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%) translateY(20px);
  padding: 12px 22px; border-radius: 12px;
  font-size: 14px; font-weight: 600; color: #fff;
  box-shadow: 0 8px 24px rgba(0,0,0,.18); z-index: 9999;
  opacity: 0; transition: all .3s; white-space: nowrap;
  pointer-events: none;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast-success { background: linear-gradient(135deg, #00838F, var(--teal)); }
.toast-error   { background: linear-gradient(135deg, #C62828, var(--danger)); }
.toast-info    { background: linear-gradient(135deg, #0D47A1, var(--blue)); }

/* ── PATIENT ID CARD ─────────────────────────────── */
.id-card {
  background: linear-gradient(135deg, var(--navy) 0%, #0d2b5e 55%, #0a3d6b 100%);
  border-radius: var(--radius); padding: 24px 26px;
  color: #fff; position: relative; overflow: hidden;
}
.id-card::before {
  content:''; position:absolute; right:-30px; bottom:-30px;
  width:200px; height:200px; border-radius:50%;
  background:rgba(0,172,193,.1);
}
.id-card::after {
  content:''; position:absolute; right:60px; top:-40px;
  width:140px; height:140px; border-radius:50%;
  background:rgba(21,101,192,.12);
}
.id-card-top { display:flex; align-items:center; justify-content:space-between; margin-bottom:20px; position:relative; z-index:1; }
.id-card-logo { height:28px; opacity:.9; }
.id-card-chip {
  font-size:11px; font-weight:700; letter-spacing:.08em;
  background:rgba(255,255,255,.12); border:1px solid rgba(255,255,255,.2);
  padding:4px 10px; border-radius:20px; color:rgba(255,255,255,.7);
  text-transform:uppercase;
}
.id-card-body { position:relative; z-index:1; }
.id-card-name { font-size:20px; font-weight:800; margin-bottom:4px; }
.id-card-pid  { font-size:12px; color:rgba(255,255,255,.5); letter-spacing:.04em; margin-bottom:18px; }
.id-card-grid { display:grid; grid-template-columns:repeat(3,1fr); gap:8px; }
.id-field { }
.id-field-label { font-size:9px; font-weight:700; text-transform:uppercase; letter-spacing:.1em; color:rgba(255,255,255,.4); margin-bottom:2px; }
.id-field-value { font-size:12.5px; font-weight:600; color:rgba(255,255,255,.85); }

/* ── TABS ────────────────────────────────────────── */
.tabs { display:flex; gap:2px; border-bottom: var(--border); margin-bottom:20px; }
.tab-btn {
  padding:10px 18px; font-size:13.5px; font-weight:600;
  color:var(--text-md); border-bottom:2px solid transparent;
  transition:var(--tr); cursor:pointer; border-radius:0;
}
.tab-btn.active { color:var(--blue); border-bottom-color:var(--blue); }
.tab-btn:hover:not(.active) { color:var(--text); }
.tab-content { display:none; }
.tab-content.active { display:block; }

/* ── RESPONSIVE ──────────────────────────────────── */
@media (max-width: 1024px) {
  .portal-content { padding: 22px 20px; }
  .section-grid { grid-template-columns: 1fr; }
  .med-row { grid-template-columns: 1fr 1fr; }
  .med-row > *:last-child { grid-column: 1/-1; }
}

@media (max-width: 768px) {
  /* sidebar collapses to off-canvas */
  .sidebar {
    transform: translateX(calc(-1 * var(--sidebar-w)));
    box-shadow: 8px 0 32px rgba(11,29,58,.2);
  }
  .sidebar.open { transform: translateX(0); }
  .portal-main { margin-left: 0; }
  .sidebar-toggle { display: flex; }

  /* login */
  .login-wrap { grid-template-columns: 1fr; }
  .login-brand { display: none; }
  .login-form-panel { padding: 40px 28px; }

  /* topbar */
  .topbar { padding: 0 16px; }

  /* content */
  .portal-content { padding: 16px; }

  /* stats */
  .stats-grid { grid-template-columns: 1fr 1fr; }

  /* page header */
  .page-header-row { flex-direction: column; align-items: flex-start; }

  /* forms */
  .form-row { grid-template-columns: 1fr; }
  .form-row-3 { grid-template-columns: 1fr; }

  /* table — scroll */
  .patients-table-wrap { -webkit-overflow-scrolling: touch; }

  /* notif panel */
  .notif-panel { left: 12px; right: 12px; width: auto; }

  /* patient panel */
  .patient-detail-panel { width: 100vw; }

  /* eye measurements */
  .eye-measurements { grid-template-columns: 1fr; }

  /* id card grid */
  .id-card-grid { grid-template-columns: 1fr 1fr; }

  /* info grid */
  .info-grid { grid-template-columns: 1fr 1fr; }
  .panel-info-grid { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .info-grid  { grid-template-columns: 1fr; }
  .portal-content { padding: 12px; }
  .card-body { padding: 16px; }
  .modal-body { padding: 18px 20px; }
  .modal-footer { padding: 14px 20px; }
  .id-card-grid { grid-template-columns: 1fr 1fr; }
  .med-row { grid-template-columns: 1fr; }
}
