/* ============================================================
   PharmaTrace AI — Main Stylesheet
   Theme: Light, Blue-Dominant, Medical SaaS
   Font: Sora (Google Fonts)
   ============================================================ */

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

/* ── Variables ─────────────────────────────────────────────── */
:root {
  --sidebar-bg:         #0b1437;
  --sidebar-border:     rgba(255,255,255,0.06);
  --sidebar-text:       #8fa8d0;
  --sidebar-hover-bg:   rgba(255,255,255,0.07);
  --sidebar-active-bg:  rgba(59,130,246,0.18);
  --sidebar-active:     #60a5fa;
  --sidebar-icon:       #5b7ba8;
  --sidebar-w:          248px;

  --primary:            #1d4ed8;
  --primary-hover:      #1e40af;
  --primary-light:      #dbeafe;
  --primary-muted:      #93c5fd;

  --accent:             #0891b2;
  --accent-light:       #e0f2fe;

  --bg:                 #f0f4fb;
  --bg-card:            #ffffff;
  --bg-hover:           #f8faff;
  --bg-subtle:          #f8fafc;

  --text:               #0f172a;
  --text-2:             #1e293b;
  --text-muted:         #64748b;
  --text-light:         #94a3b8;

  --border:             #e2e8f0;
  --border-focus:       #3b82f6;

  --success:            #059669;
  --success-bg:         #d1fae5;
  --success-text:       #065f46;

  --warning:            #d97706;
  --warning-bg:         #fef3c7;
  --warning-text:       #92400e;

  --danger:             #dc2626;
  --danger-bg:          #fee2e2;
  --danger-text:        #991b1b;

  --info:               #0891b2;
  --info-bg:            #cffafe;
  --info-text:          #164e63;

  --purple:             #7c3aed;
  --purple-bg:          #ede9fe;

  --orange:             #ea580c;
  --orange-bg:          #ffedd5;

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

  --shadow-xs:          0 1px 2px rgba(0,0,0,0.06);
  --shadow:             0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md:          0 4px 8px rgba(0,0,0,0.08), 0 2px 4px rgba(0,0,0,0.04);
  --shadow-lg:          0 12px 24px rgba(0,0,0,0.09), 0 4px 8px rgba(0,0,0,0.05);
  --shadow-xl:          0 24px 48px rgba(0,0,0,0.12);

  --topbar-h:           62px;
  --font:               'Sora', -apple-system, sans-serif;
  --transition:         0.18s ease;
  --transition-slow:    0.3s ease;
}

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

/* ── Scrollbar ─────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-light); }

/* ============================================================
   APP LAYOUT
   ============================================================ */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ───────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  border-right: 1px solid var(--sidebar-border);
  overflow-y: auto;
  overflow-x: hidden;
  transition: transform var(--transition-slow);
}
.sidebar::-webkit-scrollbar { width: 3px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); }

.sidebar-logo {
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--sidebar-border);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.sidebar-logo-icon {
  width: 36px; height: 36px;
  background: var(--primary);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.sidebar-logo-icon svg { width: 20px; height: 20px; fill: white; }
.sidebar-logo-text { flex: 1; }
.sidebar-logo-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: -0.01em;
  line-height: 1.2;
}
.sidebar-logo-sub {
  font-size: 0.7rem;
  color: var(--sidebar-icon);
  font-weight: 400;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 0;
}

.sidebar-section-title {
  padding: 14px 20px 6px;
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--sidebar-icon);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 16px 9px 20px;
  color: var(--sidebar-text);
  font-size: 0.84rem;
  font-weight: 500;
  border-radius: 0;
  transition: all var(--transition);
  position: relative;
  text-decoration: none;
  white-space: nowrap;
}
.sidebar-item:hover {
  background: var(--sidebar-hover-bg);
  color: #fff;
}
.sidebar-item.active {
  background: var(--sidebar-active-bg);
  color: var(--sidebar-active);
}
.sidebar-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--sidebar-active);
  border-radius: 0 2px 2px 0;
}
.sidebar-item-icon {
  width: 18px; height: 18px;
  flex-shrink: 0;
  opacity: 0.7;
}
.sidebar-item.active .sidebar-item-icon { opacity: 1; }
.sidebar-item:hover .sidebar-item-icon { opacity: 1; }

.sidebar-badge {
  margin-left: auto;
  background: var(--danger);
  color: white;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 10px;
  line-height: 1;
}
.sidebar-badge.info { background: var(--accent); }
.sidebar-badge.warning { background: var(--warning); }

.sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--sidebar-border);
}
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background var(--transition);
}
.sidebar-user:hover { background: var(--sidebar-hover-bg); }
.sidebar-user-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--primary);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
}
.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-name {
  font-size: 0.8rem;
  font-weight: 600;
  color: #e2e8f0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-user-role {
  font-size: 0.7rem;
  color: var(--sidebar-icon);
}

/* ── Main Content ──────────────────────────────────────────── */
.main-content {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  flex: 1;
}

/* ── Topbar ────────────────────────────────────────────────── */
.topbar {
  height: var(--topbar-h);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: 0 1px 0 var(--border);
}
.topbar-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  flex: 1;
  letter-spacing: -0.02em;
}
.topbar-title span {
  font-weight: 400;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.topbar-search {
  position: relative;
  flex: 0 0 260px;
}
.topbar-search input {
  width: 100%;
  padding: 8px 12px 8px 36px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  font-size: 0.83rem;
  color: var(--text);
  transition: all var(--transition);
  outline: none;
}
.topbar-search input:focus {
  border-color: var(--border-focus);
  background: white;
  box-shadow: 0 0 0 3px rgba(59,130,246,0.1);
}
.topbar-search-icon {
  position: absolute;
  left: 10px; top: 50%; transform: translateY(-50%);
  color: var(--text-light);
  width: 16px; height: 16px;
}

.topbar-actions { display: flex; align-items: center; gap: 8px; }
.topbar-btn {
  width: 36px; height: 36px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted);
  transition: all var(--transition);
  position: relative;
}
.topbar-btn:hover {
  border-color: var(--primary-muted);
  color: var(--primary);
  background: var(--primary-light);
}
.topbar-btn svg { width: 17px; height: 17px; }
.topbar-notif-dot {
  position: absolute;
  top: 6px; right: 7px;
  width: 7px; height: 7px;
  background: var(--danger);
  border-radius: 50%;
  border: 2px solid white;
}

/* ── Page Content ──────────────────────────────────────────── */
.page-content {
  flex: 1;
  padding: 24px;
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}
.page-header-info h1 {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.03em;
  line-height: 1.2;
}
.page-header-info p {
  font-size: 0.83rem;
  color: var(--text-muted);
  margin-top: 3px;
}
.page-header-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 16px;
  font-size: 0.78rem;
  color: var(--text-muted);
}
.breadcrumb a { color: var(--text-muted); }
.breadcrumb a:hover { color: var(--primary); }
.breadcrumb-sep { color: var(--text-light); }
.breadcrumb-current { color: var(--text-2); font-weight: 500; }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 16px;
  border-radius: var(--radius);
  font-size: 0.83rem;
  font-weight: 600;
  border: 1px solid transparent;
  transition: all var(--transition);
  cursor: pointer;
  white-space: nowrap;
  line-height: 1.4;
}
.btn svg { width: 15px; height: 15px; flex-shrink: 0; }
.btn-sm { padding: 5px 11px; font-size: 0.78rem; }
.btn-sm svg { width: 13px; height: 13px; }
.btn-lg { padding: 11px 22px; font-size: 0.9rem; }

.btn-primary {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); color: white; }

.btn-secondary {
  background: var(--bg-card);
  color: var(--text-2);
  border-color: var(--border);
}
.btn-secondary:hover { background: var(--bg); border-color: var(--primary-muted); color: var(--primary); }

.btn-success {
  background: var(--success);
  color: white;
  border-color: var(--success);
}
.btn-success:hover { background: #047857; }

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

.btn-warning {
  background: var(--warning);
  color: white;
  border-color: var(--warning);
}
.btn-warning:hover { background: #b45309; }

.btn-outline {
  background: transparent;
  color: var(--primary);
  border-color: var(--primary);
}
.btn-outline:hover { background: var(--primary-light); }

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border-color: transparent;
}
.btn-ghost:hover { background: var(--bg); color: var(--text); }

.btn-icon {
  padding: 8px;
  background: var(--bg);
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.btn-icon:hover { background: var(--primary-light); color: var(--primary); border-color: var(--primary-muted); }
.btn-icon svg { width: 16px; height: 16px; }

/* ============================================================
   CARDS
   ============================================================ */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.card-title {
  font-size: 0.93rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
}
.card-title-icon {
  display: flex; align-items: center; gap: 8px;
}
.card-title-icon svg { width: 17px; height: 17px; color: var(--primary); }
.card-body { padding: 20px; }
.card-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  background: var(--bg-subtle);
}

/* KPI Cards */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  box-shadow: var(--shadow);
  transition: box-shadow var(--transition), transform var(--transition);
  position: relative;
  overflow: hidden;
}
.kpi-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.kpi-card::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--kpi-color, var(--primary));
}
.kpi-icon {
  width: 44px; height: 44px;
  border-radius: var(--radius);
  background: var(--kpi-bg, var(--primary-light));
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.kpi-icon svg { width: 22px; height: 22px; color: var(--kpi-color, var(--primary)); }
.kpi-info { flex: 1; min-width: 0; }
.kpi-label { font-size: 0.75rem; font-weight: 500; color: var(--text-muted); margin-bottom: 4px; }
.kpi-value { font-size: 1.6rem; font-weight: 800; color: var(--text); letter-spacing: -0.03em; line-height: 1; }
.kpi-value span { font-size: 0.9rem; font-weight: 500; }
.kpi-trend {
  font-size: 0.72rem;
  font-weight: 600;
  margin-top: 6px;
  display: flex; align-items: center; gap: 3px;
}
.kpi-trend.up { color: var(--success); }
.kpi-trend.down { color: var(--danger); }
.kpi-trend svg { width: 12px; height: 12px; }

/* ============================================================
   TABLES
   ============================================================ */
.table-wrapper {
  overflow-x: auto;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.83rem;
}
thead { background: var(--bg-subtle); }
th {
  padding: 11px 14px;
  text-align: left;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
  border-bottom: 1px solid var(--border);
}
td {
  padding: 12px 14px;
  color: var(--text-2);
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
tr:last-child td { border-bottom: none; }
tbody tr { transition: background var(--transition); }
tbody tr:hover { background: var(--bg-hover); }

.td-main { font-weight: 600; color: var(--text); }
.td-code {
  font-family: 'Courier New', monospace;
  font-size: 0.78rem;
  background: var(--bg);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid var(--border);
  color: var(--accent);
}
.td-actions { display: flex; align-items: center; gap: 4px; }

/* ── Filter Bar ──────────────────────────────────────────── */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-subtle);
  flex-wrap: wrap;
}
.filter-bar-search {
  position: relative;
  flex: 1;
  min-width: 200px;
}
.filter-bar-search input {
  width: 100%;
  padding: 8px 12px 8px 34px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: white;
  font-size: 0.82rem;
  color: var(--text);
  outline: none;
  transition: border-color var(--transition);
}
.filter-bar-search input:focus { border-color: var(--border-focus); }
.filter-bar-search-icon {
  position: absolute;
  left: 10px; top: 50%; transform: translateY(-50%);
  color: var(--text-light);
  width: 15px; height: 15px;
}
.filter-select {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: white;
  font-size: 0.82rem;
  color: var(--text);
  outline: none;
  cursor: pointer;
  font-family: var(--font);
  transition: border-color var(--transition);
}
.filter-select:focus { border-color: var(--border-focus); }

/* ============================================================
   STATUS BADGES
   ============================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  white-space: nowrap;
}
.badge-dot {
  width: 5px; height: 5px;
  border-radius: 50%;
  flex-shrink: 0;
}
.badge-success { background: var(--success-bg); color: var(--success-text); }
.badge-success .badge-dot { background: var(--success); }
.badge-warning { background: var(--warning-bg); color: var(--warning-text); }
.badge-warning .badge-dot { background: var(--warning); }
.badge-danger { background: var(--danger-bg); color: var(--danger-text); }
.badge-danger .badge-dot { background: var(--danger); }
.badge-info { background: var(--info-bg); color: var(--info-text); }
.badge-info .badge-dot { background: var(--info); }
.badge-primary { background: var(--primary-light); color: var(--primary); }
.badge-primary .badge-dot { background: var(--primary); }
.badge-purple { background: var(--purple-bg); color: var(--purple); }
.badge-orange { background: var(--orange-bg); color: var(--orange); }
.badge-gray { background: var(--bg); color: var(--text-muted); border: 1px solid var(--border); }

/* ============================================================
   FORMS
   ============================================================ */
.form-group { margin-bottom: 18px; }
.form-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: 6px;
}
.form-label .required { color: var(--danger); margin-left: 2px; }
.form-control {
  width: 100%;
  padding: 9px 13px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  background: white;
  font-size: 0.84rem;
  color: var(--text);
  font-family: var(--font);
  transition: all var(--transition);
  outline: none;
}
.form-control:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(59,130,246,0.1);
}
.form-control::placeholder { color: var(--text-light); }
.form-control.is-error { border-color: var(--danger); }
textarea.form-control { resize: vertical; min-height: 90px; }
select.form-control { cursor: pointer; }
.form-hint { font-size: 0.75rem; color: var(--text-muted); margin-top: 5px; }
.form-error { font-size: 0.75rem; color: var(--danger); margin-top: 5px; }

.form-row { display: grid; gap: 16px; grid-template-columns: 1fr 1fr; }
.form-row-3 { grid-template-columns: 1fr 1fr 1fr; }
.form-row-1 { grid-template-columns: 1fr; }

/* ============================================================
   MODALS
   ============================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,0.55);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-slow);
}
.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}
.modal {
  background: white;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  transform: translateY(16px) scale(0.98);
  transition: transform var(--transition-slow);
}
.modal-overlay.active .modal { transform: translateY(0) scale(1); }
.modal-lg { max-width: 760px; }
.modal-xl { max-width: 960px; }

.modal-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: flex-start;
  gap: 12px;
}
.modal-header-icon {
  width: 40px; height: 40px;
  border-radius: var(--radius);
  background: var(--primary-light);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.modal-header-icon svg { width: 20px; height: 20px; color: var(--primary); }
.modal-header-info { flex: 1; }
.modal-title { font-size: 1rem; font-weight: 700; color: var(--text); }
.modal-subtitle { font-size: 0.79rem; color: var(--text-muted); margin-top: 2px; }
.modal-close {
  width: 32px; height: 32px;
  border: none;
  background: var(--bg);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted);
  transition: all var(--transition);
  flex-shrink: 0;
  margin-left: auto;
}
.modal-close:hover { background: var(--danger-bg); color: var(--danger); }
.modal-close svg { width: 16px; height: 16px; }

.modal-body { padding: 20px 24px; }
.modal-footer {
  padding: 14px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  background: var(--bg-subtle);
}

/* ============================================================
   DRAWER
   ============================================================ */
.drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,0.4);
  backdrop-filter: blur(2px);
  z-index: 900;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-slow);
}
.drawer-overlay.active { opacity: 1; visibility: visible; }

.drawer {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: 500px;
  background: white;
  z-index: 901;
  box-shadow: -8px 0 32px rgba(0,0,0,0.12);
  transform: translateX(100%);
  transition: transform var(--transition-slow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.drawer-overlay.active .drawer { transform: translateX(0); }

.drawer-header {
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}
.drawer-title { font-size: 1rem; font-weight: 700; color: var(--text); flex: 1; }
.drawer-close {
  width: 32px; height: 32px;
  border: 1px solid var(--border);
  background: transparent;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted);
  transition: all var(--transition);
}
.drawer-close:hover { background: var(--danger-bg); color: var(--danger); border-color: transparent; }
.drawer-close svg { width: 16px; height: 16px; }

.drawer-body { flex: 1; overflow-y: auto; padding: 20px; }
.drawer-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  flex-shrink: 0;
  background: var(--bg-subtle);
}

/* ============================================================
   TIMELINE
   ============================================================ */
.timeline { position: relative; }
.timeline::before {
  content: '';
  position: absolute;
  left: 19px; top: 8px; bottom: 8px;
  width: 2px;
  background: var(--border);
}
.timeline-item {
  display: flex;
  gap: 14px;
  padding-bottom: 20px;
  position: relative;
}
.timeline-item:last-child { padding-bottom: 0; }
.timeline-dot {
  width: 20px; height: 20px;
  border-radius: 50%;
  background: white;
  border: 2px solid var(--primary);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  z-index: 1;
  position: relative;
}
.timeline-dot svg { width: 10px; height: 10px; color: var(--primary); }
.timeline-dot.success { border-color: var(--success); }
.timeline-dot.success svg { color: var(--success); }
.timeline-dot.warning { border-color: var(--warning); }
.timeline-dot.warning svg { color: var(--warning); }
.timeline-dot.danger { border-color: var(--danger); }
.timeline-dot.danger svg { color: var(--danger); }
.timeline-dot.filled { background: var(--primary); }
.timeline-dot.filled svg { color: white; }
.timeline-dot.filled.success { background: var(--success); border-color: var(--success); }
.timeline-dot.filled.warning { background: var(--warning); border-color: var(--warning); }

.timeline-content { flex: 1; padding-top: 0; }
.timeline-event-title {
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text);
}
.timeline-event-meta {
  font-size: 0.76rem;
  color: var(--text-muted);
  margin-top: 2px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.timeline-event-meta span { display: flex; align-items: center; gap: 3px; }
.timeline-event-detail {
  margin-top: 8px;
  padding: 10px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.79rem;
  color: var(--text-2);
  line-height: 1.7;
}
.timeline-event-doc {
  margin-top: 6px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  background: var(--primary-light);
  color: var(--primary);
  border-radius: var(--radius-sm);
  font-size: 0.74rem;
  font-weight: 600;
}

/* ============================================================
   TABS
   ============================================================ */
.tabs {
  display: flex;
  border-bottom: 2px solid var(--border);
  gap: 0;
  margin-bottom: 20px;
  overflow-x: auto;
}
.tab-btn {
  padding: 10px 18px;
  font-size: 0.83rem;
  font-weight: 600;
  color: var(--text-muted);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 6px;
}
.tab-btn:hover { color: var(--text); }
.tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}
.tab-btn .count {
  background: var(--primary-light);
  color: var(--primary);
  font-size: 0.68rem;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 10px;
}
.tab-pane { display: none; }
.tab-pane.active { display: block; }

/* ============================================================
   FILE UPLOAD
   ============================================================ */
.upload-area {
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: 32px 20px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
  background: var(--bg-subtle);
  position: relative;
}
.upload-area:hover, .upload-area.dragover {
  border-color: var(--primary-muted);
  background: var(--primary-light);
}
.upload-area input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}
.upload-icon {
  width: 44px; height: 44px;
  margin: 0 auto 12px;
  background: var(--primary-light);
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
}
.upload-icon svg { width: 22px; height: 22px; color: var(--primary); }
.upload-text {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: 4px;
}
.upload-hint { font-size: 0.76rem; color: var(--text-muted); }
.upload-hint span { color: var(--primary); font-weight: 600; }

.uploaded-files { margin-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.uploaded-file {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.uploaded-file-icon {
  width: 32px; height: 32px;
  border-radius: var(--radius-sm);
  background: var(--primary-light);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.uploaded-file-icon svg { width: 16px; height: 16px; color: var(--primary); }
.uploaded-file-info { flex: 1; min-width: 0; }
.uploaded-file-name {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.uploaded-file-size { font-size: 0.73rem; color: var(--text-muted); }
.uploaded-file-status { display: flex; align-items: center; gap: 4px; }

/* ============================================================
   SCANNER MODAL
   ============================================================ */
.scanner-viewport {
  position: relative;
  background: #000;
  border-radius: var(--radius);
  overflow: hidden;
  aspect-ratio: 4/3;
  display: flex;
  align-items: center;
  justify-content: center;
}
.scanner-frame {
  position: absolute;
  width: 60%; height: 40%;
  border: 2px solid var(--primary);
  border-radius: 4px;
}
.scanner-frame::before, .scanner-frame::after {
  content: '';
  position: absolute;
  width: 16px; height: 16px;
  border-color: var(--primary);
  border-style: solid;
}
.scanner-frame::before { top: -2px; left: -2px; border-width: 3px 0 0 3px; }
.scanner-frame::after { bottom: -2px; right: -2px; border-width: 0 3px 3px 0; }
.scanner-line {
  position: absolute;
  left: 20%; right: 20%;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--danger), transparent);
  animation: scanLine 2s linear infinite;
}
@keyframes scanLine {
  0% { top: 30%; }
  50% { top: 70%; }
  100% { top: 30%; }
}
.scanner-tip {
  position: absolute;
  bottom: 12px;
  left: 50%; transform: translateX(-50%);
  background: rgba(0,0,0,0.7);
  color: white;
  font-size: 0.75rem;
  padding: 5px 12px;
  border-radius: 20px;
  white-space: nowrap;
}
.scanner-result {
  margin-top: 12px;
  padding: 12px 14px;
  background: var(--primary-light);
  border: 1px solid var(--primary-muted);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  gap: 10px;
}
.scanner-result-icon {
  width: 28px; height: 28px;
  background: var(--primary);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.scanner-result-icon svg { width: 14px; height: 14px; color: white; }
.scanner-result-text { font-size: 0.82rem; font-weight: 600; color: var(--primary); }
.scanner-result-code { font-size: 0.75rem; color: var(--text-muted); font-family: monospace; }

.barcode-input-wrapper {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}
.barcode-input-wrapper input {
  flex: 1;
  padding: 9px 13px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.84rem;
  outline: none;
  font-family: monospace;
  letter-spacing: 0.05em;
  background: var(--bg);
  color: var(--text);
  transition: border-color var(--transition);
}
.barcode-input-wrapper input:focus {
  border-color: var(--border-focus);
  background: white;
}

/* ============================================================
   AI OPERATIONS
   ============================================================ */
.ai-chat-container {
  display: flex;
  flex-direction: column;
  height: calc(100vh - var(--topbar-h) - 120px);
  min-height: 400px;
}
.ai-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.ai-message {
  display: flex;
  gap: 10px;
  max-width: 80%;
}
.ai-message.user { align-self: flex-end; flex-direction: row-reverse; }
.ai-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  font-size: 0.75rem;
  font-weight: 800;
  color: white;
}
.ai-message.user .ai-avatar {
  background: linear-gradient(135deg, var(--success), var(--accent));
}
.ai-bubble {
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 0.83rem;
  line-height: 1.6;
  max-width: 100%;
}
.ai-message:not(.user) .ai-bubble {
  background: white;
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 4px 16px 16px 16px;
}
.ai-message.user .ai-bubble {
  background: var(--primary);
  color: white;
  border-radius: 16px 4px 16px 16px;
}
.ai-action-card {
  margin-top: 10px;
  padding: 12px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.ai-action-card-title {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
}
.ai-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  margin: 3px;
  border: 1px solid var(--primary-muted);
  background: var(--primary-light);
  color: var(--primary);
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
}
.ai-action-btn:hover { background: var(--primary); color: white; }

.ai-chat-input-area {
  background: white;
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  padding: 12px 14px;
  display: flex;
  gap: 10px;
  align-items: flex-end;
}
.ai-chat-input {
  flex: 1;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.84rem;
  font-family: var(--font);
  resize: none;
  min-height: 44px;
  max-height: 120px;
  outline: none;
  color: var(--text);
  transition: border-color var(--transition);
}
.ai-chat-input:focus { border-color: var(--border-focus); }
.ai-send-btn {
  width: 40px; height: 40px;
  background: var(--primary);
  border: none;
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  color: white;
  transition: background var(--transition);
  flex-shrink: 0;
}
.ai-send-btn:hover { background: var(--primary-hover); }
.ai-send-btn svg { width: 18px; height: 18px; }

.ai-typing {
  display: flex;
  gap: 4px;
  padding: 8px 12px;
  background: white;
  border: 1px solid var(--border);
  border-radius: 4px 16px 16px 16px;
  width: fit-content;
}
.ai-typing-dot {
  width: 6px; height: 6px;
  background: var(--text-light);
  border-radius: 50%;
  animation: typingBounce 1.2s infinite;
}
.ai-typing-dot:nth-child(2) { animation-delay: 0.2s; }
.ai-typing-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes typingBounce {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(-6px); }
}

/* ============================================================
   RECALL / RISK CARDS
   ============================================================ */
.risk-banner {
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 20px;
}
.risk-banner.critical {
  background: #fff1f2;
  border: 1.5px solid #fca5a5;
}
.risk-banner.warning {
  background: #fffbeb;
  border: 1.5px solid #fcd34d;
}
.risk-banner.info {
  background: var(--info-bg);
  border: 1.5px solid #67e8f9;
}
.risk-banner-icon {
  width: 40px; height: 40px;
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.risk-banner.critical .risk-banner-icon { background: var(--danger-bg); }
.risk-banner.critical .risk-banner-icon svg { color: var(--danger); }
.risk-banner.warning .risk-banner-icon { background: var(--warning-bg); }
.risk-banner.warning .risk-banner-icon svg { color: var(--warning); }
.risk-banner-icon svg { width: 20px; height: 20px; }
.risk-banner-title { font-size: 0.9rem; font-weight: 700; color: var(--text); margin-bottom: 3px; }
.risk-banner-text { font-size: 0.81rem; color: var(--text-2); line-height: 1.6; }

.recall-card {
  border: 1.5px solid var(--danger);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.recall-card-header {
  background: var(--danger-bg);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.recall-card-header svg { width: 18px; height: 18px; color: var(--danger); }
.recall-card-title { font-size: 0.88rem; font-weight: 700; color: var(--danger-text); }
.recall-card-body { padding: 16px; background: white; }

/* ============================================================
   DOCUMENT PREVIEW
   ============================================================ */
.doc-preview {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.doc-preview-toolbar {
  padding: 8px 14px;
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.doc-preview-area {
  padding: 20px;
  background: white;
  min-height: 300px;
  position: relative;
}
.doc-redact-overlay {
  position: absolute;
  background: rgba(220,38,38,0.15);
  border: 1px dashed var(--danger);
  border-radius: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.doc-safe-overlay {
  position: absolute;
  background: rgba(5,150,105,0.1);
  border: 1px dashed var(--success);
  border-radius: 2px;
}

/* ============================================================
   TOAST NOTIFICATIONS
   ============================================================ */
.toast-container {
  position: fixed;
  bottom: 24px; right: 24px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}
.toast {
  background: var(--text);
  color: white;
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 0.83rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 320px;
  pointer-events: all;
  transform: translateX(100%);
  opacity: 0;
  transition: all 0.3s ease;
}
.toast.show { transform: translateX(0); opacity: 1; }
.toast.success { background: var(--success); }
.toast.warning { background: var(--warning); }
.toast.danger { background: var(--danger); }
.toast.info { background: var(--accent); }
.toast svg { width: 17px; height: 17px; flex-shrink: 0; }

/* ============================================================
   INFO PAIRS (key-value)
   ============================================================ */
.info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.info-pair {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  border-right: 1px solid var(--border);
}
.info-pair:nth-child(even) { border-right: none; }
.info-pair:nth-last-child(-n+2) { border-bottom: none; }
.info-key { font-size: 0.73rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 3px; }
.info-val { font-size: 0.85rem; font-weight: 500; color: var(--text-2); }
.info-val strong { color: var(--text); font-weight: 700; }

/* ============================================================
   CHARTS
   ============================================================ */
.chart-wrapper { position: relative; }
.chart-wrapper canvas { max-height: 280px; }

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty-state {
  padding: 48px 20px;
  text-align: center;
  color: var(--text-muted);
}
.empty-state-icon {
  width: 56px; height: 56px;
  background: var(--bg);
  border-radius: var(--radius-lg);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 14px;
}
.empty-state-icon svg { width: 26px; height: 26px; color: var(--text-light); }
.empty-state-title { font-size: 0.95rem; font-weight: 700; color: var(--text-2); margin-bottom: 6px; }
.empty-state-text { font-size: 0.82rem; color: var(--text-muted); margin-bottom: 16px; line-height: 1.7; }

/* ============================================================
   LOADING
   ============================================================ */
.spinner {
  width: 22px; height: 22px;
  border: 2.5px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
.spinner-sm { width: 16px; height: 16px; border-width: 2px; }
@keyframes spin { to { transform: rotate(360deg); } }

.loading-overlay {
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0.8);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  border-radius: inherit;
}

/* ============================================================
   VERIFY PAGE (Patient-facing)
   ============================================================ */
.verify-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  text-align: center;
  transition: background 0.6s ease;
}
.verify-page.verified { background: linear-gradient(160deg, #064e3b 0%, #065f46 50%, #047857 100%); }
.verify-page.unverified { background: linear-gradient(160deg, #1e293b 0%, #334155 100%); }
.verify-page.risky { background: linear-gradient(160deg, #7f1d1d 0%, #991b1b 50%, #b91c1c 100%); }

.verify-card {
  background: rgba(255,255,255,0.1);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: var(--radius-xl);
  padding: 36px 28px;
  max-width: 420px;
  width: 100%;
  color: white;
}
.verify-icon {
  width: 80px; height: 80px;
  border-radius: 50%;
  margin: 0 auto 20px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,0.2);
}
.verify-icon svg { width: 44px; height: 44px; }
.verify-status {
  font-size: 1.5rem;
  font-weight: 800;
  margin-bottom: 8px;
  letter-spacing: -0.03em;
}
.verify-sub { font-size: 0.9rem; opacity: 0.8; margin-bottom: 24px; line-height: 1.6; }
.verify-product-name { font-size: 1.1rem; font-weight: 700; margin-bottom: 4px; }
.verify-brand { font-size: 0.85rem; opacity: 0.75; margin-bottom: 20px; }

.verify-details {
  background: rgba(255,255,255,0.1);
  border-radius: var(--radius-lg);
  padding: 16px;
  text-align: left;
  margin-bottom: 20px;
}
.verify-detail-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  font-size: 0.83rem;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}
.verify-detail-row:last-child { border-bottom: none; }
.verify-detail-key { opacity: 0.7; }
.verify-detail-val { font-weight: 600; }
.verify-code {
  font-family: monospace;
  font-size: 1rem;
  letter-spacing: 0.15em;
  padding: 10px 16px;
  background: rgba(255,255,255,0.15);
  border-radius: var(--radius);
  margin-top: 14px;
  display: inline-block;
}
.verify-footer {
  margin-top: 20px;
  font-size: 0.76rem;
  opacity: 0.6;
  line-height: 1.6;
}
.verify-logo {
  margin-top: 28px;
  font-size: 0.8rem;
  opacity: 0.5;
  letter-spacing: 0.05em;
  font-weight: 700;
  text-transform: uppercase;
}

/* ============================================================
   DOCTOR PORTAL
   ============================================================ */
.doctor-layout .sidebar {
  background: #0d2137;
}
.doctor-layout .sidebar-logo-icon {
  background: #0891b2;
}
.doctor-layout .sidebar-item.active {
  color: #38bdf8;
}
.doctor-layout .sidebar-item.active::before {
  background: #38bdf8;
}

/* ============================================================
   MISC UTILITIES
   ============================================================ */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.flex-1 { flex: 1; }
.min-w-0 { min-width: 0; }
.w-full { width: 100%; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-muted); font-size: 0.82rem; }
.text-sm { font-size: 0.8rem; }
.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }
.mt-1 { margin-top: 6px; }
.mt-2 { margin-top: 12px; }
.mt-3 { margin-top: 18px; }
.mt-4 { margin-top: 24px; }
.mb-1 { margin-bottom: 6px; }
.mb-2 { margin-bottom: 12px; }
.mb-3 { margin-bottom: 18px; }
.mb-4 { margin-bottom: 24px; }
.p-4 { padding: 20px; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.grid-4 { display: grid; grid-template-columns: 1fr 1fr 1fr 1fr; gap: 16px; }

.divider { height: 1px; background: var(--border); margin: 16px 0; }

.highlight-box {
  padding: 14px 16px;
  border-radius: var(--radius);
  font-size: 0.83rem;
  line-height: 1.7;
}
.highlight-box.primary { background: var(--primary-light); border-left: 3px solid var(--primary); }
.highlight-box.success { background: var(--success-bg); border-left: 3px solid var(--success); }
.highlight-box.warning { background: var(--warning-bg); border-left: 3px solid var(--warning); }
.highlight-box.danger { background: var(--danger-bg); border-left: 3px solid var(--danger); }

.product-img-placeholder {
  width: 42px; height: 42px;
  background: var(--primary-light);
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.product-img-placeholder svg { width: 20px; height: 20px; color: var(--primary); }

.lot-tag {
  font-family: monospace;
  font-size: 0.75rem;
  padding: 2px 7px;
  background: var(--info-bg);
  color: var(--info-text);
  border-radius: 4px;
  border: 1px solid #67e8f9;
  font-weight: 600;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1024px) {
  :root { --sidebar-w: 220px; }
  .form-row { grid-template-columns: 1fr; }
  .form-row-3 { grid-template-columns: 1fr 1fr; }
  .grid-4 { grid-template-columns: 1fr 1fr; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  :root { --sidebar-w: 0px; }
  .sidebar {
    transform: translateX(-248px);
    width: 248px;
  }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .page-content { padding: 16px; }
  .page-header { flex-direction: column; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .drawer { width: 100%; }
  .topbar-search { display: none; }
}

@media (max-width: 480px) {
  .kpi-grid { grid-template-columns: 1fr; }
  .tabs { font-size: 0.78rem; }
  .verify-card { padding: 24px 18px; }
}

/* ── Animations ────────────────────────────────────────────── */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.fade-in { animation: fadeIn 0.3s ease forwards; }
.fade-in-1 { animation-delay: 0.05s; }
.fade-in-2 { animation-delay: 0.1s; }
.fade-in-3 { animation-delay: 0.15s; }
.fade-in-4 { animation-delay: 0.2s; }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}
.pulse { animation: pulse 2s ease infinite; }

/* ── Login Page ─────────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  display: flex;
  background: var(--bg);
}
.login-left {
  flex: 0 0 460px;
  background: var(--bg-card);
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 60px 50px;
  border-right: 1px solid var(--border);
}
.login-right {
  flex: 1;
  background: linear-gradient(145deg, #0b1437 0%, #0d2137 40%, #1a3a6e 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  position: relative;
  overflow: hidden;
}
.login-right::before {
  content: '';
  position: absolute;
  width: 600px; height: 600px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(29,78,216,0.15) 0%, transparent 70%);
  top: -200px; right: -200px;
}
.login-right::after {
  content: '';
  position: absolute;
  width: 400px; height: 400px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(8,145,178,0.12) 0%, transparent 70%);
  bottom: -100px; left: -100px;
}
.login-hero-content {
  position: relative;
  z-index: 1;
  color: white;
  max-width: 400px;
}
.login-hero-title {
  font-size: 2.4rem;
  font-weight: 800;
  margin-bottom: 16px;
  line-height: 1.15;
  letter-spacing: -0.04em;
}
.login-hero-title span { color: #60a5fa; }
.login-hero-text { font-size: 0.95rem; opacity: 0.7; line-height: 1.8; margin-bottom: 32px; }
.login-hero-features { display: flex; flex-direction: column; gap: 12px; }
.login-hero-feature {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.85rem;
  opacity: 0.8;
}
.login-hero-feature-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #60a5fa;
  flex-shrink: 0;
}

.login-logo { display: flex; align-items: center; gap: 10px; margin-bottom: 40px; }
.login-logo-icon {
  width: 42px; height: 42px;
  background: var(--primary);
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
}
.login-logo-icon svg { width: 22px; height: 22px; fill: white; }
.login-logo-name { font-size: 1.2rem; font-weight: 800; color: var(--text); letter-spacing: -0.03em; }
.login-logo-sub { font-size: 0.7rem; color: var(--text-muted); letter-spacing: 0.08em; text-transform: uppercase; font-weight: 500; }

.login-title { font-size: 1.5rem; font-weight: 800; color: var(--text); letter-spacing: -0.03em; margin-bottom: 6px; }
.login-sub { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 32px; }

.demo-accounts {
  margin-top: 24px;
  padding: 16px;
  background: var(--bg);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}
.demo-accounts-title {
  font-size: 0.73rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 10px;
}
.demo-account {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition);
}
.demo-account:hover { background: var(--primary-light); }
.demo-account-email { font-size: 0.8rem; font-weight: 600; color: var(--text-2); flex: 1; }
.demo-account-role { font-size: 0.72rem; color: var(--text-muted); }

@media (max-width: 900px) {
  .login-right { display: none; }
  .login-left { flex: 1; }
}
