/* ============================================================
   AjosPulse HMS - Main Stylesheet
   Design: Medical Dark with Cyan accents | Sora + DM Sans
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=Sora:wght@300;400;500;600;700&family=DM+Sans:wght@300;400;500;600&family=DM+Mono:wght@400;500&display=swap');

/* ── VARIABLES ─────────────────────────────────────────────── */
:root {
  --bg-0:     #060c14;
  --bg-1:     #0b1628;
  --bg-2:     #0f1e35;
  --bg-3:     #162847;
  --surface:  #1a3158;
  --surface-2:#1e3a65;
  --border:   rgba(56, 139, 253, 0.15);
  --border-2: rgba(56, 139, 253, 0.3);

  --cyan:     #0ea5e9;
  --cyan-2:   #38bdf8;
  --cyan-dim: rgba(14, 165, 233, 0.12);
  --teal:     #14b8a6;
  --green:    #22c55e;
  --amber:    #f59e0b;
  --red:      #ef4444;
  --purple:   #a855f7;

  --text-1:   #f0f6ff;
  --text-2:   #94b4d4;
  --text-3:   #5a7fa8;
  --text-inv: #060c14;

  --font-sans: 'DM Sans', system-ui, sans-serif;
  --font-head: 'Sora', system-ui, sans-serif;
  --font-mono: 'DM Mono', monospace;

  --radius-sm: 6px;
  --radius:    10px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  --shadow-sm: 0 1px 3px rgba(0,0,0,0.4);
  --shadow:    0 4px 20px rgba(0,0,0,0.4);
  --shadow-lg: 0 12px 40px rgba(0,0,0,0.5);
  --shadow-cyan: 0 0 20px rgba(14,165,233,0.15);

  --transition: 0.2s ease;
  --sidebar-w: 260px;
}

/* ── RESET ──────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; scroll-behavior: smooth; }
body {
  font-family: var(--font-sans);
  background: var(--bg-0);
  color: var(--text-1);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--cyan); text-decoration: none; }
a:hover { color: var(--cyan-2); }
img { max-width: 100%; }
button, input, select, textarea { font-family: inherit; }

/* ── SCROLLBAR ──────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-1); }
::-webkit-scrollbar-thumb { background: var(--surface); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--surface-2); }

/* ── LAYOUT ─────────────────────────────────────────────────── */
.app-layout { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-1);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  z-index: 100;
  transition: transform var(--transition);
}
.main-content {
  flex: 1;
  margin-left: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
.topbar {
  height: 64px;
  background: var(--bg-1);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 50;
  gap: 16px;
}
.page-content { padding: 28px 28px 40px; flex: 1; }

/* ── SIDEBAR ─────────────────────────────────────────────────── */
.sidebar-logo {
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border);
}
.logo-mark {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--text-1);
}
.logo-icon {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--cyan), var(--teal));
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
}
.logo-sub { font-size: 0.65rem; color: var(--text-3); letter-spacing: 0.08em; text-transform: uppercase; }

.sidebar-nav { flex: 1; padding: 12px 10px; overflow-y: auto; }
.nav-section { margin-bottom: 20px; }
.nav-section-label {
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-3);
  padding: 0 10px;
  margin-bottom: 6px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-2);
  font-size: 0.875rem;
  font-weight: 500;
  transition: all var(--transition);
  cursor: pointer;
  border: 1px solid transparent;
  text-decoration: none;
  position: relative;
}
.nav-item:hover { background: var(--bg-2); color: var(--text-1); }
.nav-item.active {
  background: var(--cyan-dim);
  border-color: var(--border-2);
  color: var(--cyan-2);
}
.nav-item.active::before {
  content: '';
  position: absolute;
  left: -10px;
  top: 50%; transform: translateY(-50%);
  width: 3px; height: 60%;
  background: var(--cyan);
  border-radius: 0 2px 2px 0;
}
.nav-icon { font-size: 1rem; flex-shrink: 0; }
.nav-badge {
  margin-left: auto;
  background: var(--cyan);
  color: var(--text-inv);
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 10px;
}

.sidebar-footer {
  padding: 14px 10px;
  border-top: 1px solid var(--border);
}
.user-widget {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius);
  background: var(--bg-2);
}
.user-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--cyan), var(--purple));
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700;
  color: white;
  flex-shrink: 0;
}
.user-info { flex: 1; min-width: 0; }
.user-name { font-size: 0.8rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 0.65rem; color: var(--text-3); text-transform: capitalize; }

/* ── TOPBAR ELEMENTS ────────────────────────────────────────── */
.topbar-title {
  font-family: var(--font-head);
  font-size: 1.05rem;
  font-weight: 600;
  flex: 1;
}
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.topbar-btn {
  width: 36px; height: 36px;
  border-radius: var(--radius-sm);
  background: var(--bg-2);
  border: 1px solid var(--border);
  color: var(--text-2);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--transition);
  font-size: 14px;
  position: relative;
}
.topbar-btn:hover { background: var(--surface); border-color: var(--border-2); color: var(--text-1); }
.notif-dot {
  position: absolute;
  top: 5px; right: 5px;
  width: 7px; height: 7px;
  background: var(--red);
  border-radius: 50%;
  border: 1px solid var(--bg-1);
}

/* ── CARDS ──────────────────────────────────────────────────── */
.card {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
}
.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.card-title { font-family: var(--font-head); font-size: 0.9rem; font-weight: 600; color: var(--text-1); }
.card-sub { font-size: 0.75rem; color: var(--text-3); margin-top: 2px; }

/* Stat Cards */
.stat-card {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  position: relative;
  overflow: hidden;
  transition: all var(--transition);
}
.stat-card:hover { border-color: var(--border-2); transform: translateY(-1px); box-shadow: var(--shadow-cyan); }
.stat-card::before {
  content: '';
  position: absolute;
  top: 0; right: 0;
  width: 60px; height: 60px;
  background: var(--cyan-dim);
  border-radius: 0 var(--radius-lg) 0 60px;
  opacity: 0.5;
}
.stat-icon {
  width: 40px; height: 40px;
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  margin-bottom: 12px;
}
.stat-icon.blue  { background: rgba(14,165,233,0.12); color: var(--cyan); }
.stat-icon.green { background: rgba(34,197,94,0.12);  color: var(--green); }
.stat-icon.amber { background: rgba(245,158,11,0.12); color: var(--amber); }
.stat-icon.purple{ background: rgba(168,85,247,0.12); color: var(--purple); }
.stat-icon.teal  { background: rgba(20,184,166,0.12); color: var(--teal); }
.stat-value { font-family: var(--font-head); font-size: 1.75rem; font-weight: 700; line-height: 1; }
.stat-label { font-size: 0.75rem; color: var(--text-3); margin-top: 4px; }
.stat-change { font-size: 0.7rem; margin-top: 8px; display: flex; align-items: center; gap: 4px; }
.stat-change.up { color: var(--green); }
.stat-change.down { color: var(--red); }

/* ── GRID SYSTEM ────────────────────────────────────────────── */
.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-5 { grid-template-columns: repeat(5, 1fr); }

/* ── FORMS ──────────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-label {
  display: block;
  font-size: 0.775rem;
  font-weight: 500;
  color: var(--text-2);
  margin-bottom: 6px;
  letter-spacing: 0.02em;
}
.form-label.required::after { content: ' *'; color: var(--red); }
.form-control {
  width: 100%;
  padding: 9px 14px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-1);
  font-size: 0.875rem;
  transition: all var(--transition);
}
.form-control:focus {
  outline: none;
  border-color: var(--cyan);
  background: var(--bg-3);
  box-shadow: 0 0 0 3px rgba(14,165,233,0.1);
}
.form-control::placeholder { color: var(--text-3); }
select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 80px; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; }
.form-hint { font-size: 0.7rem; color: var(--text-3); margin-top: 4px; }
.form-error { font-size: 0.7rem; color: var(--red); margin-top: 4px; }

/* ── BUTTONS ────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 18px;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 500;
  border: none;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}
.btn-primary { background: var(--cyan); color: var(--text-inv); }
.btn-primary:hover { background: var(--cyan-2); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(14,165,233,0.3); }
.btn-secondary { background: var(--surface); color: var(--text-1); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--surface-2); border-color: var(--border-2); }
.btn-success { background: var(--green); color: white; }
.btn-success:hover { filter: brightness(1.1); }
.btn-danger { background: var(--red); color: white; }
.btn-danger:hover { filter: brightness(1.1); }
.btn-ghost { background: transparent; color: var(--text-2); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--bg-2); color: var(--text-1); }
.btn-sm { padding: 6px 12px; font-size: 0.8rem; }
.btn-lg { padding: 12px 24px; font-size: 1rem; }
.btn-icon { padding: 8px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none !important; }
.btn-ai { background: linear-gradient(135deg, var(--purple), var(--cyan)); color: white; }
.btn-ai:hover { filter: brightness(1.1); }

/* ── TABLES ─────────────────────────────────────────────────── */
.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
}
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}
.table thead tr { border-bottom: 1px solid var(--border); }
.table thead th {
  padding: 12px 16px;
  text-align: left;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-3);
  background: var(--bg-2);
  white-space: nowrap;
}
.table tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
}
.table tbody tr:last-child { border-bottom: none; }
.table tbody tr:hover { background: var(--bg-2); }
.table td { padding: 12px 16px; color: var(--text-2); vertical-align: middle; }
.table td strong { color: var(--text-1); }

/* ── BADGES ─────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 20px;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  white-space: nowrap;
}
.badge-blue   { background: rgba(14,165,233,0.12); color: var(--cyan); }
.badge-green  { background: rgba(34,197,94,0.12);  color: var(--green); }
.badge-amber  { background: rgba(245,158,11,0.12); color: var(--amber); }
.badge-red    { background: rgba(239,68,68,0.12);  color: var(--red); }
.badge-purple { background: rgba(168,85,247,0.12); color: var(--purple); }
.badge-teal   { background: rgba(20,184,166,0.12); color: var(--teal); }
.badge-gray   { background: var(--bg-3); color: var(--text-3); }

/* ── AI PANEL ───────────────────────────────────────────────── */
.ai-panel {
  background: linear-gradient(135deg, rgba(168,85,247,0.08), rgba(14,165,233,0.08));
  border: 1px solid rgba(168,85,247,0.2);
  border-radius: var(--radius-lg);
  padding: 20px;
}
.ai-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}
.ai-icon {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--purple), var(--cyan));
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
}
.ai-title { font-weight: 600; font-size: 0.9rem; }
.ai-disclaimer {
  font-size: 0.7rem;
  color: var(--amber);
  background: rgba(245,158,11,0.08);
  border: 1px solid rgba(245,158,11,0.2);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  margin-bottom: 14px;
}
.ai-response {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  font-size: 0.85rem;
  line-height: 1.7;
  color: var(--text-2);
  min-height: 80px;
  white-space: pre-wrap;
}
.ai-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.8rem;
  margin-bottom: 14px;
}
.toggle-switch {
  position: relative;
  width: 36px; height: 20px;
  flex-shrink: 0;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: var(--bg-3);
  border-radius: 10px;
  transition: .3s;
}
.toggle-slider::before {
  content: '';
  position: absolute;
  height: 14px; width: 14px;
  left: 3px; top: 3px;
  background: var(--text-3);
  border-radius: 50%;
  transition: .3s;
}
input:checked + .toggle-slider { background: var(--cyan); }
input:checked + .toggle-slider::before { transform: translateX(16px); background: white; }

/* ── VITAL CARDS ─────────────────────────────────────────────── */
.vital-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 12px; }
.vital-card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 12px;
  text-align: center;
}
.vital-icon { font-size: 1.2rem; margin-bottom: 6px; }
.vital-value { font-family: var(--font-mono); font-size: 1.2rem; font-weight: 500; }
.vital-unit { font-size: 0.7rem; color: var(--text-3); }
.vital-label { font-size: 0.7rem; color: var(--text-3); margin-top: 4px; }
.vital-card.abnormal { border-color: rgba(239,68,68,0.3); background: rgba(239,68,68,0.05); }
.vital-card.abnormal .vital-value { color: var(--red); }

/* ── TABS ───────────────────────────────────────────────────── */
.tabs { display: flex; border-bottom: 1px solid var(--border); margin-bottom: 20px; gap: 4px; }
.tab-btn {
  padding: 10px 18px;
  background: none;
  border: none;
  color: var(--text-3);
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 500;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: all var(--transition);
  font-family: inherit;
}
.tab-btn:hover { color: var(--text-1); }
.tab-btn.active { color: var(--cyan); border-bottom-color: var(--cyan); }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ── PATIENT CARD ────────────────────────────────────────────── */
.patient-header {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 20px;
  background: var(--bg-2);
  border-bottom: 1px solid var(--border);
  margin: -20px -20px 20px;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.patient-avatar {
  width: 56px; height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--teal), var(--cyan));
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; font-weight: 700;
  color: white;
  flex-shrink: 0;
}
.patient-name { font-family: var(--font-head); font-size: 1.1rem; font-weight: 600; }
.patient-meta { font-size: 0.8rem; color: var(--text-3); margin-top: 4px; }
.patient-uhid {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--cyan);
  background: var(--cyan-dim);
  padding: 2px 8px;
  border-radius: 4px;
  margin-top: 6px;
  display: inline-block;
}

/* ── TOKEN / QUEUE ───────────────────────────────────────────── */
.token-card {
  text-align: center;
  padding: 20px;
}
.token-number {
  font-family: var(--font-head);
  font-size: 4rem;
  font-weight: 700;
  color: var(--cyan);
  line-height: 1;
}
.token-status { font-size: 0.8rem; color: var(--text-3); margin-top: 8px; }
.queue-list { display: flex; flex-direction: column; gap: 8px; }
.queue-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--bg-2);
  border-radius: var(--radius);
  transition: background var(--transition);
}
.queue-item.current { background: var(--cyan-dim); border: 1px solid var(--border-2); }
.queue-token {
  width: 32px; height: 32px;
  border-radius: var(--radius-sm);
  background: var(--bg-3);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  font-size: 0.875rem;
  flex-shrink: 0;
}
.queue-item.current .queue-token { background: var(--cyan); color: var(--text-inv); }

/* ── MODALS ─────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition);
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  transform: translateY(20px);
  transition: transform var(--transition);
}
.modal-overlay.open .modal { transform: translateY(0); }
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--bg-1);
  z-index: 1;
}
.modal-title { font-family: var(--font-head); font-weight: 600; font-size: 1rem; }
.modal-body { padding: 24px; }
.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* ── PAYMENT SECTION ─────────────────────────────────────────── */
.payment-methods { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; margin-bottom: 16px; }
.payment-method-btn {
  padding: 12px 10px;
  background: var(--bg-2);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  text-align: center;
  transition: all var(--transition);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-2);
}
.payment-method-btn:hover { border-color: var(--border-2); color: var(--text-1); }
.payment-method-btn.selected { border-color: var(--cyan); background: var(--cyan-dim); color: var(--cyan); }
.payment-method-icon { font-size: 1.5rem; display: block; margin-bottom: 6px; }
.upi-upload-area {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
  color: var(--text-3);
  font-size: 0.85rem;
}
.upi-upload-area:hover { border-color: var(--cyan); color: var(--text-1); background: var(--cyan-dim); }

/* ── PROGRESS / LOADING ─────────────────────────────────────── */
.spinner {
  width: 20px; height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--cyan);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-dots::after {
  content: '...';
  animation: dots 1.5s infinite;
}
@keyframes dots {
  0%   { content: '.'; }
  33%  { content: '..'; }
  66%  { content: '...'; }
}
.pulse { animation: pulse 2s infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.4; } }

/* ── ALERTS ─────────────────────────────────────────────────── */
.alert {
  display: flex;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius);
  font-size: 0.875rem;
  margin-bottom: 16px;
}
.alert-info    { background: rgba(14,165,233,0.08); border: 1px solid rgba(14,165,233,0.2); color: var(--cyan-2); }
.alert-success { background: rgba(34,197,94,0.08);  border: 1px solid rgba(34,197,94,0.2);  color: var(--green); }
.alert-warning { background: rgba(245,158,11,0.08); border: 1px solid rgba(245,158,11,0.2); color: var(--amber); }
.alert-danger  { background: rgba(239,68,68,0.08);  border: 1px solid rgba(239,68,68,0.2);  color: var(--red); }

/* ── TOAST NOTIFICATIONS ─────────────────────────────────────── */
#toast-container {
  position: fixed;
  top: 20px; right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 0.85rem;
  font-weight: 500;
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow-lg);
  transform: translateX(100%);
  animation: toastIn 0.3s ease forwards, toastOut 0.3s ease 3.7s forwards;
  pointer-events: all;
  max-width: 320px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.toast-success { background: rgba(34,197,94,0.15); border: 1px solid rgba(34,197,94,0.3); color: var(--green); }
.toast-error   { background: rgba(239,68,68,0.15); border: 1px solid rgba(239,68,68,0.3); color: var(--red); }
.toast-info    { background: rgba(14,165,233,0.15); border: 1px solid rgba(14,165,233,0.3); color: var(--cyan-2); }
@keyframes toastIn  { to   { transform: translateX(0); } }
@keyframes toastOut { from { opacity: 1; } to { opacity: 0; transform: translateX(100%); } }

/* ── LOGIN PAGE ─────────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  background: var(--bg-0);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  position: relative;
  overflow: hidden;
}
.login-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 20% 20%, rgba(14,165,233,0.08) 0%, transparent 60%),
    radial-gradient(ellipse 60% 80% at 80% 80%, rgba(20,184,166,0.06) 0%, transparent 60%);
  pointer-events: none;
}
.login-grid-bg {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(var(--border) 1px, transparent 1px),
    linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 50px 50px;
  mask-image: radial-gradient(ellipse at center, black 20%, transparent 80%);
  opacity: 0.5;
}
.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 36px 32px;
  position: relative;
  box-shadow: var(--shadow-lg), 0 0 60px rgba(14,165,233,0.06);
}
.login-logo {
  text-align: center;
  margin-bottom: 28px;
}
.login-logo-mark {
  width: 56px; height: 56px;
  background: linear-gradient(135deg, var(--cyan), var(--teal));
  border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  font-size: 26px;
  margin: 0 auto 12px;
}
.login-title { font-family: var(--font-head); font-size: 1.4rem; font-weight: 700; }
.login-subtitle { font-size: 0.8rem; color: var(--text-3); margin-top: 4px; }
.login-tabs { display: flex; gap: 4px; background: var(--bg-2); border-radius: var(--radius); padding: 4px; margin-bottom: 24px; }
.login-tab-btn {
  flex: 1; padding: 8px; border: none;
  background: none; color: var(--text-3);
  border-radius: var(--radius-sm);
  cursor: pointer; font-size: 0.8rem; font-weight: 500;
  transition: all var(--transition);
  font-family: inherit;
}
.login-tab-btn.active { background: var(--surface); color: var(--text-1); }
.pwa-install-banner {
  display: none;
  background: var(--cyan-dim);
  border: 1px solid var(--border-2);
  border-radius: var(--radius);
  padding: 12px 16px;
  font-size: 0.8rem;
  margin-bottom: 16px;
  align-items: center;
  gap: 12px;
}
.pwa-install-banner.visible { display: flex; }

/* ── PAGE HEADER ─────────────────────────────────────────────── */
.page-header { margin-bottom: 24px; display: flex; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; gap: 12px; }
.page-title { font-family: var(--font-head); font-size: 1.3rem; font-weight: 700; }
.page-desc { font-size: 0.8rem; color: var(--text-3); margin-top: 4px; }

/* ── SEARCH BAR ──────────────────────────────────────────────── */
.search-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0 14px;
  transition: all var(--transition);
}
.search-bar:focus-within { border-color: var(--cyan); }
.search-bar input {
  background: none;
  border: none;
  color: var(--text-1);
  font-size: 0.875rem;
  padding: 10px 0;
  flex: 1;
  outline: none;
}
.search-bar input::placeholder { color: var(--text-3); }

/* ── PHARMACY INVENTORY ──────────────────────────────────────── */
.stock-bar { height: 6px; background: var(--bg-3); border-radius: 3px; margin-top: 4px; }
.stock-fill { height: 100%; border-radius: 3px; }
.stock-fill.good    { background: var(--green); }
.stock-fill.medium  { background: var(--amber); }
.stock-fill.low     { background: var(--red); }

/* ── PRINT STYLES ────────────────────────────────────────────── */
@media print {
  .sidebar, .topbar, .btn, .ai-panel { display: none !important; }
  .main-content { margin-left: 0 !important; }
  body { background: white; color: black; }
  .card { border: 1px solid #ddd; }
}

/* ── RESPONSIVE ──────────────────────────────────────────────── */
@media (max-width: 768px) {
  :root { --sidebar-w: 0px; }
  .sidebar {
    transform: translateX(-260px);
    width: 260px;
  }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .grid-4, .grid-5 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .page-content { padding: 16px; }
  .modal { max-width: 100%; }
  .form-row { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .login-card { padding: 24px 20px; }
}

/* ── UTILITY ─────────────────────────────────────────────────── */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mb-4 { margin-bottom: 16px; }
.text-sm { font-size: 0.8rem; }
.text-xs { font-size: 0.7rem; }
.text-muted { color: var(--text-3); }
.text-cyan { color: var(--cyan); }
.text-green { color: var(--green); }
.text-red { color: var(--red); }
.text-amber { color: var(--amber); }
.font-head { font-family: var(--font-head); }
.font-mono { font-family: var(--font-mono); }
.w-full { width: 100%; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.divider { height: 1px; background: var(--border); margin: 16px 0; }
