/* ============================================================
   MediConnect AI — Global Stylesheet
   ============================================================ */
:root {
  /* Palette */
  --primary: #0ea5e9;
  --primary-dark: #0284c7;
  --primary-light: #e0f2fe;
  --secondary: #8b5cf6;
  --secondary-dark: #7c3aed;
  --accent: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
  --info: #3b82f6;

  /* Neutrals */
  --bg: #0a0f1e;
  --surface: #111827;
  --surface-2: #1a2234;
  --surface-3: #1f2d42;
  --border: rgba(255,255,255,0.08);
  --border-strong: rgba(255,255,255,0.15);
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  /* Typography */
  --font-sans: 'Inter', system-ui, sans-serif;
  --font-display: 'Plus Jakarta Sans', 'Inter', sans-serif;

  /* Spacing */
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 20px;
  --radius-xl: 28px;

  /* Shadows */
  --shadow: 0 4px 24px rgba(0,0,0,0.4);
  --shadow-lg: 0 8px 48px rgba(0,0,0,0.6);
  --glow-primary: 0 0 40px rgba(14,165,233,0.3);
  --glow-secondary: 0 0 40px rgba(139,92,246,0.3);

  /* Transitions */
  --transition: all 0.25s cubic-bezier(0.4,0,0.2,1);
}

/* ---- Reset ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; height: auto; }
ul { list-style: none; }
input, textarea, select, button { font-family: inherit; }

/* ============================================================
   SCROLLBAR
   ============================================================ */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--surface); }
::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 3px; }

/* ============================================================
   FLASH MESSAGES
   ============================================================ */
.flash {
  position: fixed; top: 80px; right: 20px; z-index: 9999;
  display: flex; align-items: center; gap: 12px;
  padding: 14px 20px; border-radius: var(--radius);
  font-size: 0.9rem; font-weight: 500;
  max-width: 420px; min-width: 280px;
  backdrop-filter: blur(16px);
  box-shadow: var(--shadow);
  animation: slideInRight 0.35s ease;
}
.flash-success { background: rgba(16,185,129,0.15); border: 1px solid rgba(16,185,129,0.35); color: #34d399; }
.flash-error   { background: rgba(239,68,68,0.15);  border: 1px solid rgba(239,68,68,0.35);  color: #f87171; }
.flash-info    { background: rgba(59,130,246,0.15); border: 1px solid rgba(59,130,246,0.35); color: #60a5fa; }
.flash-close   { background: none; border: none; cursor: pointer; margin-left: auto; font-size: 1.2rem; opacity: 0.7; color: inherit; transition: var(--transition); }
.flash-close:hover { opacity: 1; }
@keyframes slideInRight { from { transform: translateX(120%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ============================================================
   NAVBAR
   ============================================================ */
.navbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 1000;
  background: rgba(10,15,30,0.85); backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  height: 64px;
  transition: var(--transition);
}
.nav-container {
  max-width: 1280px; margin: 0 auto; padding: 0 24px;
  height: 100%; display: flex; align-items: center; gap: 24px;
}
.nav-logo { display: flex; align-items: center; gap: 10px; }
.logo-icon {
  width: 36px; height: 36px; border-radius: 10px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  display: grid; place-items: center; font-size: 1rem; color: white;
}
.logo-text { font-family: var(--font-display); font-weight: 700; font-size: 1.15rem; }
.logo-ai { color: var(--primary); }

.nav-links { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.nav-link {
  padding: 8px 14px; border-radius: var(--radius-sm); color: var(--text-muted);
  font-size: 0.875rem; font-weight: 500; transition: var(--transition);
  display: flex; align-items: center; gap: 6px;
}
.nav-link:hover, .nav-link.active { color: var(--text); background: var(--surface-2); }
.nav-link i { font-size: 0.8rem; }

.nav-actions { display: flex; align-items: center; gap: 10px; }
.nav-user { position: relative; margin-left: auto; }
.nav-avatar {
  display: flex; align-items: center; gap: 10px; cursor: pointer;
  padding: 6px 12px; border-radius: var(--radius); transition: var(--transition);
}
.nav-avatar:hover { background: var(--surface-2); }
.avatar-circle {
  width: 34px; height: 34px; border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  display: grid; place-items: center; font-size: 0.85rem; font-weight: 700; color: white;
}
.avatar-info { display: flex; flex-direction: column; }
.avatar-name { font-size: 0.85rem; font-weight: 600; line-height: 1.2; }
.avatar-role { font-size: 0.7rem; color: var(--text-muted); text-transform: capitalize; }
.avatar-arrow { font-size: 0.7rem; color: var(--text-muted); transition: var(--transition); }

.user-dropdown {
  position: absolute; top: calc(100% + 8px); right: 0; width: 220px;
  background: var(--surface-2); border: 1px solid var(--border-strong);
  border-radius: var(--radius); box-shadow: var(--shadow-lg);
  overflow: hidden; display: none; z-index: 200;
  animation: fadeDown 0.2s ease;
}
.user-dropdown.open { display: block; }
@keyframes fadeDown { from { opacity:0; transform:translateY(-8px); } to { opacity:1; transform:translateY(0); } }
.dropdown-item {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 16px; font-size: 0.875rem; color: var(--text-muted);
  transition: var(--transition);
}
.dropdown-item:hover { background: var(--surface-3); color: var(--text); }
.dropdown-item i { width: 16px; text-align: center; }
.dropdown-danger:hover { color: var(--danger); }
.dropdown-divider { height: 1px; background: var(--border); margin: 4px 0; }

.nav-toggle { display: none; flex-direction: column; gap: 5px; background: none; border: none; cursor: pointer; padding: 4px; }
.nav-toggle span { display: block; width: 22px; height: 2px; background: var(--text-muted); border-radius: 2px; transition: var(--transition); }

/* Mobile nav panel — hidden on desktop, only shown via media query */
.nav-mobile-panel { display: none; }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 20px; border-radius: var(--radius-sm);
  font-size: 0.875rem; font-weight: 600; cursor: pointer;
  border: none; transition: var(--transition); white-space: nowrap;
  text-decoration: none;
}
.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white; box-shadow: 0 4px 14px rgba(14,165,233,0.3);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(14,165,233,0.45); }
.btn-secondary {
  background: linear-gradient(135deg, var(--secondary), var(--secondary-dark));
  color: white; box-shadow: 0 4px 14px rgba(139,92,246,0.3);
}
.btn-secondary:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(139,92,246,0.45); }
.btn-accent {
  background: linear-gradient(135deg, var(--accent), #059669); color: white;
}
.btn-ghost {
  background: transparent; color: var(--text-muted);
  border: 1px solid var(--border-strong);
}
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-danger { background: var(--danger); color: white; }
.btn-lg { padding: 14px 28px; font-size: 1rem; border-radius: var(--radius); }
.btn-sm { padding: 7px 14px; font-size: 0.8rem; }
.btn-block { width: 100%; justify-content: center; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none !important; }

/* ============================================================
   MAIN CONTENT
   ============================================================ */
.main-content { padding-top: 64px; min-height: calc(100vh - 64px); }

/* ============================================================
   PAGE HEADER (inner pages)
   ============================================================ */
.page-hero {
  background: linear-gradient(135deg, var(--surface) 0%, var(--surface-2) 100%);
  border-bottom: 1px solid var(--border);
  padding: 48px 24px 40px;
  text-align: center;
}
.page-hero h1 { font-family: var(--font-display); font-size: 2rem; font-weight: 800; }
.page-hero p { color: var(--text-muted); margin-top: 8px; }

/* ============================================================
   CONTAINER
   ============================================================ */
.container { max-width: 1200px; margin: 0 auto; padding: 0 24px; }
.container-sm { max-width: 760px; margin: 0 auto; padding: 0 24px; }
.section { padding: 80px 0; }

/* ============================================================
   CARDS
   ============================================================ */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 28px;
  transition: var(--transition);
}
.card:hover { border-color: var(--border-strong); }
.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.card-title { font-size: 1rem; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.card-icon {
  width: 40px; height: 40px; border-radius: var(--radius-sm);
  display: grid; place-items: center; font-size: 1.1rem;
}
.card-icon.blue { background: rgba(14,165,233,0.15); color: var(--primary); }
.card-icon.purple { background: rgba(139,92,246,0.15); color: var(--secondary); }
.card-icon.green { background: rgba(16,185,129,0.15); color: var(--accent); }
.card-icon.orange { background: rgba(245,158,11,0.15); color: var(--warning); }
.card-icon.red { background: rgba(239,68,68,0.15); color: var(--danger); }

/* ============================================================
   STATS GRID
   ============================================================ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px; margin-bottom: 28px;
}
.stat-card {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 22px;
  display: flex; flex-direction: column; gap: 6px;
  position: relative; overflow: hidden;
  transition: var(--transition);
}
.stat-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
}
.stat-card.blue::before { background: var(--primary); }
.stat-card.purple::before { background: var(--secondary); }
.stat-card.green::before { background: var(--accent); }
.stat-card.orange::before { background: var(--warning); }
.stat-card:hover { transform: translateY(-3px); border-color: var(--border-strong); }

.stat-label { font-size: 0.78rem; color: var(--text-muted); font-weight: 500; text-transform: uppercase; letter-spacing: 0.05em; }
.stat-value { font-size: 2rem; font-weight: 800; font-family: var(--font-display); line-height: 1.1; }
.stat-change { font-size: 0.76rem; font-weight: 500; }
.stat-change.up { color: var(--accent); }
.stat-change.down { color: var(--danger); }

/* ============================================================
   FORMS
   ============================================================ */
.form-group { margin-bottom: 18px; }
.form-label {
  display: block; font-size: 0.825rem; font-weight: 600;
  color: var(--text-muted); margin-bottom: 6px;
  text-transform: uppercase; letter-spacing: 0.04em;
}
.form-control {
  width: 100%; padding: 11px 14px;
  background: var(--surface-2); border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); color: var(--text); font-size: 0.9rem;
  transition: var(--transition); outline: none;
}
.form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(14,165,233,0.15); }
.form-control::placeholder { color: var(--text-dim); }
.form-control.is-invalid { border-color: var(--danger); }
.form-hint { font-size: 0.78rem; color: var(--text-dim); margin-top: 4px; }
.form-error { font-size: 0.8rem; color: var(--danger); margin-top: 4px; }
.input-group { position: relative; }
.input-group .form-control { padding-left: 40px; }
.input-group .input-icon {
  position: absolute; left: 13px; top: 50%; transform: translateY(-50%);
  color: var(--text-dim); font-size: 0.9rem;
}
.input-group .input-icon-right {
  position: absolute; right: 13px; top: 50%; transform: translateY(-50%);
  color: var(--text-dim); cursor: pointer;
}

/* ============================================================
   AUTH PAGES
   ============================================================ */
.auth-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: var(--bg);
  position: relative; overflow: hidden;
}
.auth-page::before {
  content: ''; position: absolute;
  top: -200px; left: -200px; width: 600px; height: 600px;
  background: radial-gradient(circle, rgba(14,165,233,0.12) 0%, transparent 70%);
  pointer-events: none;
}
.auth-page::after {
  content: ''; position: absolute;
  bottom: -200px; right: -200px; width: 600px; height: 600px;
  background: radial-gradient(circle, rgba(139,92,246,0.1) 0%, transparent 70%);
  pointer-events: none;
}
.auth-card {
  background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: var(--radius-xl); padding: 44px 40px;
  width: 100%; max-width: 480px; position: relative; z-index: 1;
  box-shadow: var(--shadow-lg);
}
.auth-logo {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 32px; justify-content: center;
}
.auth-title { font-family: var(--font-display); font-size: 1.6rem; font-weight: 800; text-align: center; }
.auth-subtitle { color: var(--text-muted); font-size: 0.875rem; text-align: center; margin-top: 4px; margin-bottom: 32px; }
.auth-divider {
  display: flex; align-items: center; gap: 12px; margin: 20px 0; color: var(--text-dim); font-size: 0.8rem;
}
.auth-divider::before, .auth-divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.auth-footer { text-align: center; margin-top: 24px; font-size: 0.875rem; color: var(--text-muted); }
.auth-footer a { color: var(--primary); font-weight: 600; }
.auth-footer a:hover { text-decoration: underline; }

/* Role tabs */
.role-tabs { display: flex; background: var(--surface-2); border-radius: var(--radius-sm); padding: 4px; margin-bottom: 28px; gap: 4px; }
.role-tab {
  flex: 1; padding: 9px; border-radius: 6px; text-align: center;
  font-size: 0.85rem; font-weight: 600; cursor: pointer; transition: var(--transition);
  color: var(--text-muted); border: none; background: none;
}
.role-tab.active { background: var(--primary); color: white; }

/* ============================================================
   DASHBOARD LAYOUT
   ============================================================ */
.dashboard {
  display: flex; min-height: calc(100vh - 64px);
}
.sidebar {
  width: 240px; flex-shrink: 0;
  background: var(--surface); border-right: 1px solid var(--border);
  padding: 24px 12px; display: flex; flex-direction: column; gap: 4px;
  position: sticky; top: 64px; height: calc(100vh - 64px); overflow-y: auto;
}
.sidebar-section-title {
  font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--text-dim); padding: 12px 8px 4px; font-weight: 700;
}
.sidebar-link {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: var(--radius-sm);
  color: var(--text-muted); font-size: 0.875rem; font-weight: 500;
  transition: var(--transition);
}
.sidebar-link:hover { background: var(--surface-2); color: var(--text); }
.sidebar-link.active { background: rgba(14,165,233,0.12); color: var(--primary); }
.sidebar-link i { width: 18px; text-align: center; }
.sidebar-badge {
  margin-left: auto; background: var(--primary); color: white;
  font-size: 0.68rem; font-weight: 700; padding: 2px 7px; border-radius: 99px;
}
.dashboard-content { flex: 1; padding: 32px; overflow-x: auto; }

/* ============================================================
   TABLES
   ============================================================ */
.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--border); }
table { width: 100%; border-collapse: collapse; }
thead tr { background: var(--surface-2); border-bottom: 1px solid var(--border-strong); }
th { padding: 12px 16px; text-align: left; font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-dim); }
td { padding: 14px 16px; font-size: 0.875rem; border-bottom: 1px solid var(--border); }
tbody tr:last-child td { border-bottom: none; }
tbody tr { transition: var(--transition); }
tbody tr:hover { background: var(--surface-2); }

/* ============================================================
   BADGES
   ============================================================ */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 99px; font-size: 0.72rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.05em;
}
.badge-active, .badge-success, .badge-completed { background: rgba(16,185,129,0.15); color: #34d399; }
.badge-pending, .badge-warning { background: rgba(245,158,11,0.15); color: #fbbf24; }
.badge-inactive, .badge-danger, .badge-cancelled { background: rgba(239,68,68,0.15); color: #f87171; }
.badge-info, .badge-primary { background: rgba(14,165,233,0.15); color: var(--primary); }
.badge-purple { background: rgba(139,92,246,0.15); color: #a78bfa; }

/* ============================================================
   ADMIN SETTINGS — AI Provider Cards
   ============================================================ */
.ai-provider-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 20px; }
.ai-provider-card {
  background: var(--surface-2); border: 2px solid var(--border);
  border-radius: var(--radius-lg); padding: 24px; cursor: pointer;
  transition: var(--transition); position: relative; overflow: hidden;
}
.ai-provider-card:hover { border-color: var(--border-strong); }
.ai-provider-card.selected.openai { border-color: #10a37f; box-shadow: 0 0 20px rgba(16,163,127,0.2); }
.ai-provider-card.selected.gemini { border-color: #4285F4; box-shadow: 0 0 20px rgba(66,133,244,0.2); }
.ai-provider-card.selected.claude { border-color: #d97757; box-shadow: 0 0 20px rgba(217,119,87,0.2); }
.provider-header { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.provider-icon { width: 48px; height: 48px; border-radius: 12px; display: grid; place-items: center; font-size: 1.4rem; }
.provider-icon.openai { background: rgba(16,163,127,0.15); color: #10a37f; }
.provider-icon.gemini { background: rgba(66,133,244,0.15); color: #4285F4; }
.provider-icon.claude { background: rgba(217,119,87,0.15); color: #d97757; }
.provider-name { font-size: 1rem; font-weight: 700; }
.provider-model { font-size: 0.75rem; color: var(--text-dim); }
.provider-select-indicator {
  position: absolute; top: 16px; right: 16px; width: 20px; height: 20px;
  border-radius: 50%; border: 2px solid var(--border-strong); transition: var(--transition);
}
.ai-provider-card.selected .provider-select-indicator { border-color: var(--primary); background: var(--primary); }
.ai-provider-card.selected .provider-select-indicator::after {
  content: '✓'; position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%);
  font-size: 0.65rem; font-weight: 900; color: white;
}

/* Settings Tabs */
.settings-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 28px; }
.settings-tab {
  padding: 10px 18px; font-size: 0.875rem; font-weight: 600;
  color: var(--text-muted); border: none; background: none; cursor: pointer;
  border-bottom: 2px solid transparent; margin-bottom: -1px; transition: var(--transition);
}
.settings-tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.settings-panel { display: none; }
.settings-panel.active { display: block; }

/* ============================================================
   TRIAGE CHAT UI
   ============================================================ */
.triage-container { max-width: 820px; margin: 0 auto; padding: 24px; height: calc(100vh - 180px); display: flex; flex-direction: column; gap: 16px; }
.chat-box {
  flex: 1; overflow-y: auto; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 20px; display: flex; flex-direction: column; gap: 16px;
}
.chat-bubble { max-width: 75%; }
.chat-bubble.user { align-self: flex-end; }
.chat-bubble.ai { align-self: flex-start; }
.bubble-content {
  padding: 12px 16px; border-radius: var(--radius); font-size: 0.9rem; line-height: 1.6;
}
.chat-bubble.ai .bubble-content { background: var(--surface-2); border: 1px solid var(--border); border-radius: 4px 16px 16px 16px; }
.chat-bubble.user .bubble-content { background: linear-gradient(135deg, var(--primary), var(--primary-dark)); color: white; border-radius: 16px 4px 16px 16px; }
.bubble-meta { font-size: 0.7rem; color: var(--text-dim); margin-top: 4px; }
.chat-bubble.user .bubble-meta { text-align: right; }
.ai-typing span { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--text-dim); animation: typing 1.2s infinite; }
.ai-typing span:nth-child(2) { animation-delay: 0.2s; }
.ai-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes typing { 0%,80%,100%{transform:scale(0.6);opacity:0.4;} 40%{transform:scale(1);opacity:1;} }
.chat-input-row { display: flex; gap: 10px; }
.chat-input-row .form-control { border-radius: 12px; }
.gravity-badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 14px; border-radius: 99px; font-size: 0.8rem; font-weight: 700;
}
.gravity-low { background: rgba(16,185,129,0.15); color: #34d399; }
.gravity-medium { background: rgba(245,158,11,0.15); color: #fbbf24; }
.gravity-high { background: rgba(239,68,68,0.15); color: #f87171; }

/* ============================================================
   LANDING PAGE
   ============================================================ */
.hero {
  min-height: 100vh; display: flex; align-items: center;
  background: var(--bg); position: relative; overflow: hidden;
  padding: 80px 24px 40px;
}
.hero-bg-orbs { position: absolute; inset: 0; pointer-events: none; }
.orb {
  position: absolute; border-radius: 50%; filter: blur(80px);
  animation: float 8s ease-in-out infinite;
}
.orb-1 { width: 500px; height: 500px; background: rgba(14,165,233,0.12); top: -100px; left: -100px; }
.orb-2 { width: 400px; height: 400px; background: rgba(139,92,246,0.1); bottom: -50px; right: -50px; animation-delay: 3s; }
.orb-3 { width: 300px; height: 300px; background: rgba(16,185,129,0.08); top: 40%; right: 20%; animation-delay: 1.5s; }
@keyframes float { 0%,100%{transform:translateY(0) scale(1);} 50%{transform:translateY(-30px) scale(1.05);} }

.hero-content { position: relative; z-index: 1; max-width: 1200px; margin: 0 auto; text-align: center; }
.hero-badge {
  display: inline-flex; align-items: center; gap: 8px;
  background: rgba(14,165,233,0.12); border: 1px solid rgba(14,165,233,0.3);
  color: var(--primary); padding: 6px 16px; border-radius: 99px;
  font-size: 0.8rem; font-weight: 600; margin-bottom: 28px;
  animation: fadeUp 0.6s ease both;
}
.hero-badge .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--primary); animation: pulse 2s infinite; }
@keyframes pulse { 0%,100%{opacity:1;} 50%{opacity:0.4;} }
.hero h1 {
  font-family: var(--font-display); font-size: clamp(2.8rem, 5vw, 5rem);
  font-weight: 800; line-height: 1.05; margin-bottom: 24px;
  animation: fadeUp 0.6s ease 0.1s both;
}
.hero h1 .gradient-text {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.hero-desc {
  font-size: 1.15rem; color: var(--text-muted); max-width: 600px; margin: 0 auto 36px;
  animation: fadeUp 0.6s ease 0.2s both;
}
.hero-actions { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; animation: fadeUp 0.6s ease 0.3s both; }
.hero-stats { display: flex; gap: 40px; justify-content: center; margin-top: 56px; flex-wrap: wrap; animation: fadeUp 0.6s ease 0.4s both; }
.hero-stat-item { text-align: center; }
.hero-stat-value { font-family: var(--font-display); font-size: 2rem; font-weight: 800; color: var(--text); }
.hero-stat-label { font-size: 0.8rem; color: var(--text-muted); }

/* Features */
.features-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 20px; }
.feature-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 28px; transition: var(--transition);
  position: relative; overflow: hidden;
}
.feature-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; bottom: 0;
  background: linear-gradient(135deg, transparent 60%, rgba(14,165,233,0.04));
  pointer-events: none;
}
.feature-card:hover { transform: translateY(-4px); border-color: rgba(14,165,233,0.3); box-shadow: var(--glow-primary); }
.feature-icon {
  width: 52px; height: 52px; border-radius: 14px; margin-bottom: 18px;
  display: grid; place-items: center; font-size: 1.4rem;
}
.feature-card h3 { font-size: 1.05rem; font-weight: 700; margin-bottom: 10px; }
.feature-card p { font-size: 0.875rem; color: var(--text-muted); line-height: 1.7; }

/* Pricing */
.pricing-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 20px; align-items: start; }
.pricing-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 32px; transition: var(--transition);
}
.pricing-card.featured {
  border-color: var(--primary); background: linear-gradient(135deg, rgba(14,165,233,0.05), var(--surface));
  box-shadow: var(--glow-primary); transform: scale(1.03);
}
.pricing-badge-label {
  background: var(--primary); color: white; font-size: 0.72rem; font-weight: 700;
  padding: 3px 12px; border-radius: 99px; display: inline-block; margin-bottom: 14px;
}
.pricing-name { font-size: 1.1rem; font-weight: 700; margin-bottom: 6px; }
.pricing-price { font-size: 2.8rem; font-weight: 800; font-family: var(--font-display); margin-bottom: 4px; }
.pricing-price span { font-size: 1rem; font-weight: 400; color: var(--text-muted); }
.pricing-period { font-size: 0.8rem; color: var(--text-dim); margin-bottom: 24px; }
.pricing-features { display: flex; flex-direction: column; gap: 10px; margin-bottom: 28px; }
.pricing-feature { display: flex; align-items: center; gap: 10px; font-size: 0.875rem; color: var(--text-muted); }
.pricing-feature i { color: var(--accent); font-size: 0.85rem; }
.pricing-feature.disabled { opacity: 0.4; }
.pricing-feature.disabled i { color: var(--text-dim); }

/* Section title */
.section-title { font-family: var(--font-display); font-size: clamp(1.8rem, 3vw, 2.6rem); font-weight: 800; text-align: center; }
.section-subtitle { color: var(--text-muted); text-align: center; margin-top: 10px; max-width: 560px; margin-left: auto; margin-right: auto; }
.section-header { margin-bottom: 48px; }

/* ============================================================
   FOOTER
   ============================================================ */
.footer {
  background: var(--surface); border-top: 1px solid var(--border);
  padding: 60px 24px 0;
}
.footer-container {
  max-width: 1200px; margin: 0 auto;
  display: grid; grid-template-columns: 280px 1fr; gap: 40px;
  padding-bottom: 48px;
}
.footer-brand {}
.footer-logo { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.footer-tagline { color: var(--text-muted); font-size: 0.875rem; line-height: 1.6; margin-bottom: 20px; }
.footer-socials { display: flex; gap: 10px; }
.social-link {
  width: 36px; height: 36px; border-radius: var(--radius-sm);
  background: var(--surface-2); border: 1px solid var(--border);
  display: grid; place-items: center; color: var(--text-muted);
  transition: var(--transition); font-size: 0.9rem;
}
.social-link:hover { background: var(--primary); border-color: var(--primary); color: white; }
.footer-links { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.footer-col h4 { font-size: 0.85rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text); margin-bottom: 14px; }
.footer-col a { display: block; font-size: 0.85rem; color: var(--text-muted); padding: 4px 0; transition: var(--transition); }
.footer-col a:hover { color: var(--primary); }
.footer-bottom {
  border-top: 1px solid var(--border); padding: 20px 0;
  max-width: 1200px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  font-size: 0.8rem; color: var(--text-dim);
}
.ai-badge {
  background: rgba(14,165,233,0.12); border: 1px solid rgba(14,165,233,0.25);
  color: var(--primary); padding: 2px 10px; border-radius: 99px; font-size: 0.75rem; font-weight: 600;
}
.footer-powered { display: flex; align-items: center; gap: 6px; }

/* ============================================================
   ANIMATIONS
   ============================================================ */
@keyframes fadeUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeIn  { from { opacity: 0; } to { opacity: 1; } }

/* ============================================================
   SWEETALERT2 OVERRIDES
   ============================================================ */
.swal-custom-popup {
  border: 1px solid var(--border-strong) !important;
  border-radius: var(--radius-lg) !important;
  box-shadow: var(--shadow-lg) !important;
}
.swal2-confirm { border-radius: var(--radius-sm) !important; font-weight: 600 !important; }

/* ============================================================
   RESPONSIVE
   ============================================================ */

/* ── Tablet (≤1024px) ──────────────────────────────────────── */
@media (max-width: 1024px) {
  .sidebar { width: 200px; }
  .dashboard-content { padding: 24px; }
  .footer-container { grid-template-columns: 220px 1fr; gap: 28px; }
  .pricing-card.featured { transform: none; }
}

/* ── Mobile (≤768px) ───────────────────────────────────────── */
@media (max-width: 768px) {

  /* --- Navbar --- */
  .nav-links   { display: none !important; }
  .nav-actions { display: none !important; }
  .nav-user    { display: none !important; }
  .nav-toggle  { display: flex; margin-left: auto; }
  .nav-container { padding: 0 16px; gap: 0; }
  .nav-logo { flex: 1; }

  /* Mobile dropdown panel (toggled by hamburger) */
  .nav-mobile-panel {
    position: fixed; top: 64px; left: 0; right: 0;
    background: rgba(10,15,30,0.98); backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    padding: 12px 16px 20px; z-index: 999;
    flex-direction: column; gap: 4px;
    animation: fadeDown 0.2s ease;
    max-height: calc(100vh - 64px); overflow-y: auto;
  }
  .nav-mobile-panel.open { display: flex; }
  .nav-mobile-panel .nav-link {
    padding: 12px 14px; font-size: 0.9rem;
    border-radius: var(--radius-sm); color: var(--text-muted);
  }
  .nav-mobile-panel .nav-link:hover { background: var(--surface-2); color: var(--text); }
  .nav-mobile-panel .btn   { width: 100%; justify-content: center; margin-top: 4px; }
  .nav-mobile-panel .nav-avatar { display: flex; padding: 12px 14px; border-top: 1px solid var(--border); margin-top: 8px; }

  /* --- Sidebar → sticky horizontal scroll bar --- */
  .dashboard { flex-direction: column; }
  .sidebar {
    width: 100%; height: auto;
    position: sticky; top: 64px; z-index: 100;
    flex-direction: row; flex-wrap: nowrap;
    overflow-x: auto; overflow-y: hidden;
    padding: 8px 12px; gap: 4px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    border-right: none; border-bottom: 1px solid var(--border);
  }
  .sidebar::-webkit-scrollbar { display: none; }
  .sidebar-section-title { display: none; }
  .sidebar-link {
    white-space: nowrap; flex-shrink: 0;
    padding: 8px 12px; font-size: 0.8rem;
  }
  .sidebar-link i { font-size: 0.85rem; }

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

  /* --- Stats grid: 2 cols on mobile --- */
  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .stat-value  { font-size: 1.5rem; }

  /* --- Settings tabs: horizontal scroll --- */
  .settings-tabs {
    overflow-x: auto; flex-wrap: nowrap;
    scrollbar-width: none; -webkit-overflow-scrolling: touch;
    padding-bottom: 0;
  }
  .settings-tabs::-webkit-scrollbar { display: none; }
  .settings-tab { white-space: nowrap; flex-shrink: 0; padding: 10px 14px; font-size: 0.8rem; }

  /* --- Tables --- */
  .table-wrap { border-radius: var(--radius-sm); }
  th, td { padding: 10px 12px; font-size: 0.8rem; }

  /* --- Auth card --- */
  .auth-card { padding: 28px 18px; margin: 0 12px; }
  .auth-page { padding: 16px; align-items: flex-start; padding-top: 80px; }

  /* --- Hero --- */
  .hero { padding: 90px 16px 40px; }
  .hero h1 { font-size: clamp(2rem, 8vw, 3rem); }
  .hero-desc { font-size: 1rem; }
  .hero-actions { flex-direction: column; align-items: center; }
  .hero-actions .btn { width: 100%; max-width: 320px; justify-content: center; }
  .hero-stats { gap: 20px; }
  .hero-stat-value { font-size: 1.5rem; }

  /* --- Triage --- */
  .triage-container { padding: 12px; height: calc(100vh - 140px); }

  /* --- Footer --- */
  .footer { padding: 40px 16px 0; }
  .footer-container { grid-template-columns: 1fr; gap: 28px; }
  .footer-links { grid-template-columns: repeat(2, 1fr); gap: 20px; }
  .footer-bottom { flex-direction: column; gap: 8px; text-align: center; }

  /* --- Misc --- */
  .ai-provider-grid { grid-template-columns: 1fr; }
  .section { padding: 48px 0; }
  .container, .container-sm { padding: 0 16px; }
  .page-hero { padding: 32px 16px 28px; }
  .page-hero h1 { font-size: 1.5rem; }
  .card { padding: 18px; }
  .flash { right: 12px; left: 12px; max-width: none; }


}

/* ── Small phones (≤480px) ─────────────────────────────────── */
@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .footer-links { grid-template-columns: 1fr; }
  .features-grid { grid-template-columns: 1fr; }
  .pricing-grid  { grid-template-columns: 1fr; }
  .auth-card { padding: 24px 14px; margin: 0 8px; }
  .role-tabs { flex-wrap: wrap; }
  .btn-lg { padding: 12px 20px; font-size: 0.9rem; }
  th, td { padding: 8px 10px; font-size: 0.75rem; }
}
