.animate-spin {
  animation: spin 1s linear infinite;
  display: inline-block;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

:root {
  /* Light Mode Palette */
  --bg-color: #F8FAFC;
  --surface-bg: rgba(255, 255, 255, 0.85);
  --surface-border: rgba(255, 255, 255, 0.5);
  --text-main: #0F172A;
  --text-muted: #64748B;
  --primary: #3B82F6;
  --primary-hover: #2563EB;
  --primary-light: #DBEAFE;
  --primary-gradient: linear-gradient(135deg, #3B82F6 0%, #8B5CF6 100%);
  --border: #E2E8F0;
  
  --danger: #EF4444;
  --danger-light: #FEE2E2;
  --warning: #F59E0B;
  --warning-light: #FEF3C7;
  --success: #10B981;
  --success-light: #D1FAE5;
  --info: #0EA5E9;
  --info-light: #E0F2FE;
  
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  --shadow-glass: 0 8px 32px 0 rgba(31, 38, 135, 0.07);
  
  --radius-sm: 8px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-full: 9999px;

  --input-bg: #FFFFFF;
  --card-bg: rgba(255, 255, 255, 0.95);
  
  --glass-blur: blur(12px);
}

body.dark-mode {
  --bg-color: #0F172A;
  --surface-bg: rgba(30, 41, 59, 0.7);
  --surface-border: rgba(255, 255, 255, 0.1);
  --text-main: #F8FAFC;
  --text-muted: #94A3B8;
  --primary: #60A5FA;
  --primary-hover: #3B82F6;
  --primary-light: rgba(59, 130, 246, 0.2);
  --border: #334155;
  
  --danger-light: rgba(239, 68, 68, 0.2);
  --warning-light: rgba(245, 158, 11, 0.2);
  --success-light: rgba(16, 185, 129, 0.2);
  --info-light: rgba(14, 165, 233, 0.2);

  --input-bg: #1E293B;
  --card-bg: rgba(30, 41, 59, 0.85);
  --shadow-glass: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
}

/* Base Styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: 'Inter', sans-serif;
  background-color: var(--bg-color);
  background-image: 
    radial-gradient(at 0% 0%, rgba(59, 130, 246, 0.1) 0px, transparent 50%),
    radial-gradient(at 100% 0%, rgba(139, 92, 246, 0.1) 0px, transparent 50%);
  background-attachment: fixed;
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background-color 0.3s, color 0.3s;
  overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'Outfit', sans-serif;
  font-weight: 600;
  letter-spacing: -0.02em;
}

/* View Management */
.active-view {
  display: block;
  animation: fadeInView 0.5s ease;
}

.hidden-view {
  display: none !important;
}

@keyframes fadeInView {
  from { opacity: 0; transform: scale(0.98); }
  to { opacity: 1; transform: scale(1); }
}

/* ================== BUTTONS ================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-full);
  font-family: 'Outfit', sans-serif;
  font-weight: 600;
  font-size: 1rem;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  outline: none;
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none !important;
}

.btn-primary {
  background: var(--primary-gradient);
  color: white;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(59, 130, 246, 0.4);
}

.btn-secondary {
  background: var(--input-bg);
  color: var(--text-main);
  border: 1px solid var(--border);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary);
}

.btn-outline {
  background: transparent;
  color: var(--primary);
  border: 2px solid var(--primary);
}

.btn-outline:hover:not(:disabled) {
  background: var(--primary);
  color: white;
}

.btn-large {
  padding: 14px 28px;
  font-size: 1.1rem;
}

.btn-massive {
  padding: 16px 32px;
  font-size: 1.2rem;
  width: 100%;
}

.full-width {
  width: 100%;
}

.icon-btn {
  background: var(--input-bg);
  color: var(--text-main);
  border: 1px solid var(--border);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  cursor: pointer;
  transition: all 0.2s;
}

.icon-btn:hover {
  background: var(--primary-light);
  color: var(--primary);
  border-color: var(--primary);
}

/* ================== AUTH NAV ================== */
.nav-auth-group {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.btn-ghost-sm {
  background: transparent;
  color: var(--text-muted);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-full);
  font-family: 'Outfit', sans-serif;
  font-weight: 600;
  font-size: 0.88rem;
  padding: 8px 18px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
  min-height: 38px;
}

.btn-ghost-sm:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.nav-user-pill, .app-user-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--primary-light);
  border: 1px solid var(--primary);
  border-radius: var(--radius-full);
  padding: 5px 14px 5px 6px;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--primary);
}

.nav-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  flex-shrink: 0;
}

.nav-logout-btn {
  background: transparent;
  border: none;
  color: var(--primary);
  cursor: pointer;
  font-size: 1rem;
  padding: 2px;
  display: flex;
  align-items: center;
  opacity: 0.7;
  transition: opacity 0.2s;
}

.nav-logout-btn:hover { opacity: 1; }

.app-user-pill {
  padding: 4px 12px 4px 5px;
  font-size: 0.82rem;
}

/* ================== AUTH MODAL ================== */
.auth-card {
  position: relative;
  width: 96%;
  max-width: 440px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 0 0 24px;
  box-shadow: var(--shadow-lg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  overflow: hidden;
}

.auth-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: var(--input-bg);
  border: 1px solid var(--border);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 1rem;
  z-index: 10;
  transition: all 0.2s;
}

.auth-close:hover { background: var(--danger-light); color: var(--danger); border-color: var(--danger); }

.auth-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  background: var(--card-bg);
}

.auth-tab {
  flex: 1;
  background: transparent;
  border: none;
  padding: 18px 0;
  font-family: 'Outfit', sans-serif;
  font-weight: 600;
  font-size: 1rem;
  color: var(--text-muted);
  cursor: pointer;
  position: relative;
  transition: color 0.2s;
}

.auth-tab::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: var(--primary);
  border-radius: 3px 3px 0 0;
  transform: scaleX(0);
  transition: transform 0.25s ease;
}

.auth-tab.active { color: var(--primary); }
.auth-tab.active::after { transform: scaleX(1); }

.auth-form-wrap {
  padding: 28px 32px 4px;
}

.auth-brand {
  font-family: 'Outfit', sans-serif;
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.auth-sub {
  font-size: 0.92rem;
  color: var(--text-muted);
  line-height: 1.55;
  margin-bottom: 24px;
}

.auth-field {
  margin-bottom: 18px;
}

.auth-field label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 8px;
}

.auth-field label i { color: var(--primary); }

.auth-pwd-wrap {
  position: relative;
}

.auth-pwd-wrap .styled-input {
  padding-right: 44px;
}

.pwd-toggle {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  padding: 0;
  transition: color 0.2s;
}

.pwd-toggle:hover { color: var(--primary); }

.auth-error {
  background: var(--danger-light);
  color: var(--danger);
  border: 1px solid var(--danger);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 0.88rem;
  font-weight: 500;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.auth-switch {
  text-align: center;
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-top: 16px;
}

.auth-switch a {
  color: var(--primary);
  font-weight: 600;
  text-decoration: none;
}

.auth-switch a:hover { text-decoration: underline; }

.auth-forgot {
  text-align: right;
  margin-top: -8px;
  margin-bottom: 8px;
}

.auth-forgot a {
  font-size: 0.82rem;
  color: var(--primary);
  text-decoration: none;
  font-weight: 500;
  transition: opacity 0.2s;
}

.auth-forgot a:hover {
  text-decoration: underline;
  opacity: 0.8;
}

.auth-security {
  text-align: center;
  font-size: 0.76rem;
  color: var(--text-muted);
  opacity: 0.6;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 0 32px;
  margin-top: 12px;
}

/* ================== LANDING PAGE ================== */
.landing-page {
  min-height: 100vh;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 40px;
}

/* ---------- Nav ---------- */
.landing-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 28px 0 24px;
  border-bottom: 1px solid var(--border);
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: 'Outfit', sans-serif;
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-main);
}

.logo i {
  color: var(--primary);
  font-size: 1.8rem;
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 20px;
}

.nav-tagline {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 500;
}

.btn-nav {
  padding: 9px 22px;
  font-size: 0.9rem;
}

/* ---------- Hero ---------- */
.hero {
  text-align: center;
  padding: 100px 20px 80px;
  max-width: 780px;
  margin: 0 auto;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, rgba(236,72,153,0.12) 0%, rgba(139,92,246,0.12) 100%);
  color: #8B5CF6;
  border: 1px solid rgba(139,92,246,0.25);
  padding: 8px 20px;
  border-radius: 20px;
  font-size: 0.88rem;
  font-weight: 600;
  margin-bottom: 32px;
  letter-spacing: 0.01em;
}

.hero h1 {
  font-size: 4rem;
  line-height: 1.12;
  letter-spacing: -0.03em;
  margin-bottom: 28px;
  color: var(--text-main);
}

.hero-desc {
  font-size: 1.15rem;
  color: var(--text-muted);
  line-height: 1.75;
  margin-bottom: 48px;
  max-width: 560px;
  margin-inline: auto;
  margin-bottom: 48px;
}

.hero-actions {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 16px;
  margin-bottom: 40px;
  flex-wrap: wrap;
}

.btn-hero {
  padding: 16px 32px;
  font-size: 1.05rem;
  border-radius: var(--radius-full);
  min-height: 52px;
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-full);
  font-weight: 500;
  font-size: 0.95rem;
  transition: all 0.2s;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 14px 24px;
  min-height: 52px;
  font-family: 'Outfit', sans-serif;
}

.btn-ghost:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.hero-trust {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 0.88rem;
  color: var(--text-muted);
  font-weight: 500;
}

.hero-trust span { display: inline-flex; align-items: center; gap: 5px; }
.hero-trust i { color: var(--primary); font-size: 1rem; }
.trust-dot { color: var(--border); font-size: 1.2rem; line-height: 1; }

/* ---------- Stats Bar ---------- */
.stats-bar {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px 20px;
  margin: 0 0 100px;
  box-shadow: var(--shadow-glass);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
}

.stat-item {
  flex: 1;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.stat-num {
  font-family: 'Outfit', sans-serif;
  font-size: 2rem;
  font-weight: 800;
  background: var(--primary-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1;
}

.stat-label {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-weight: 500;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.stat-divider {
  width: 1px;
  height: 48px;
  background: var(--border);
  flex-shrink: 0;
  margin: 0 12px;
}

/* ---------- Sections ---------- */
.section-label {
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--primary);
  margin-bottom: 14px;
}

.section-title {
  font-size: 2.4rem;
  letter-spacing: -0.03em;
  line-height: 1.15;
  margin-bottom: 16px;
  color: var(--text-main);
}

.section-sub {
  font-size: 1.05rem;
  color: var(--text-muted);
  line-height: 1.65;
  max-width: 520px;
  margin-bottom: 60px;
}

/* ---------- How It Works ---------- */
.how-section {
  padding: 0 0 100px;
  text-align: center;
}

.how-section .section-sub { margin-inline: auto; }

.steps-grid {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
}

.step-card {
  flex: 1;
  max-width: 300px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px 28px 36px;
  text-align: center;
  box-shadow: var(--shadow-glass);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  position: relative;
}

.step-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-lg);
}

.step-number {
  font-family: 'Outfit', sans-serif;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  color: var(--primary);
  text-transform: uppercase;
  margin-bottom: 16px;
  opacity: 0.7;
}

.step-icon {
  width: 64px;
  height: 64px;
  background: var(--primary-light);
  color: var(--primary);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  margin: 0 auto 20px;
}

.step-card h3 {
  font-size: 1.2rem;
  margin-bottom: 12px;
  color: var(--text-main);
}

.step-card p {
  font-size: 0.95rem;
  color: var(--text-muted);
  line-height: 1.65;
}

.step-connector {
  flex-shrink: 0;
  color: var(--border);
  font-size: 1.6rem;
  padding: 0 20px;
  display: flex;
  align-items: center;
  margin-top: -20px; /* align with card center */
}

/* ---------- Features Grid ---------- */
.features-section {
  padding: 0 0 100px;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.feature-tile {
  display: flex;
  align-items: flex-start;
  gap: 18px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 28px 24px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.feature-tile:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
  border-color: var(--primary);
}

.feature-tile-icon {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  background: var(--primary-light);
  color: var(--primary);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}

.feature-tile-body h4 {
  font-size: 1rem;
  margin-bottom: 8px;
  color: var(--text-main);
  line-height: 1.3;
}

.feature-tile-body p {
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.6;
  margin: 0;
}

/* ---------- CTA Section ---------- */
.cta-section {
  padding: 0 0 80px;
}

.cta-card {
  background: var(--primary-gradient);
  border-radius: var(--radius-lg);
  padding: 72px 40px;
  text-align: center;
  color: white;
  box-shadow: 0 20px 60px rgba(59, 130, 246, 0.25);
}

.cta-card h2 {
  font-size: 2.4rem;
  letter-spacing: -0.03em;
  margin-bottom: 16px;
  color: white;
}

.cta-card p {
  font-size: 1.05rem;
  opacity: 0.85;
  margin-bottom: 40px;
  line-height: 1.65;
}

.cta-card .btn-primary {
  background: white;
  color: var(--primary);
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
}

.cta-card .btn-primary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(0,0,0,0.2);
}

/* ---------- Landing Footer ---------- */
.landing-footer {
  text-align: center;
  padding: 48px 20px 40px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: 'Outfit', sans-serif;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 4px;
}

.footer-brand i {
  color: var(--primary);
  font-size: 1.3rem;
}

.footer-copy {
  font-size: 0.9rem;
  color: var(--text-muted);
  font-weight: 500;
  line-height: 1.6;
}

.footer-disclaimer {
  font-size: 0.78rem;
  color: var(--text-muted);
  opacity: 0.7;
  line-height: 1.7;
  max-width: 500px;
}

.gradient-text {
  background: var(--primary-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}


/* ================== APP LAYOUT ================== */
.app-view {
  padding: 20px;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  min-height: 100vh;
}

.app-container {
  width: 100%;
  max-width: 1000px;
  background: var(--surface-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-glass);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  height: 90vh; /* Fixed height for inner scrolling */
}

/* Header */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--card-bg);
}

.logo-area {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: 'Outfit', sans-serif;
  font-size: 1.4rem;
  font-weight: 700;
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 12px;
}

.styled-select {
  appearance: none;
  background: var(--input-bg);
  color: var(--text-main);
  border: 1px solid var(--border);
  padding: 8px 32px 8px 12px;
  border-radius: var(--radius-full);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%236B7280%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E");
  background-repeat: no-repeat;
  background-position: right 12px top 50%;
  background-size: 10px auto;
  outline: none;
}

.styled-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

/* Tabs */
.tabs {
  display: flex;
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
}

.tab-btn {
  flex: 1;
  background: transparent;
  border: none;
  padding: 16px 0;
  font-family: 'Outfit', sans-serif;
  font-weight: 600;
  font-size: 1rem;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  position: relative;
  transition: color 0.2s;
}

.tab-btn i { font-size: 1.2rem; }

.tab-btn::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: var(--primary);
  border-radius: 3px 3px 0 0;
  transform: scaleX(0);
  transition: transform 0.3s ease;
}

.tab-btn.active {
  color: var(--primary);
}

.tab-btn.active::after {
  transform: scaleX(1);
}

/* Scroll Container */
.scroll-container {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.scroll-container::-webkit-scrollbar { width: 6px; }
.scroll-container::-webkit-scrollbar-track { background: transparent; }
.scroll-container::-webkit-scrollbar-thumb { background-color: var(--border); border-radius: 10px; }

.tab-content {
  display: none;
  animation: fadeIn 0.4s ease;
}

.tab-content.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ================== CARDS & UI ELEMENTS ================== */
.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 24px;
}

.glass-card {
  box-shadow: var(--shadow-glass);
}

.card-header {
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-header h3 {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1.2rem;
  color: var(--text-main);
}

.card-header i {
  color: var(--primary);
  font-size: 1.4rem;
}

/* Dashboard Grid */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 24px;
  margin-bottom: 24px;
}

.dashboard-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-bottom: 24px;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  background: var(--card-bg);
  border-radius: var(--radius-md);
  border: 1px dashed var(--border);
}

.empty-icon-wrap {
  width: 80px;
  height: 80px;
  background: var(--primary-light);
  color: var(--primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  margin: 0 auto 20px;
}

.empty-state h2 { margin-bottom: 12px; }
.empty-state p { color: var(--text-muted); margin-bottom: 24px; max-width: 400px; margin-inline: auto; }

/* Risk Score Dial */
.risk-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.risk-dial-container {
  position: relative;
  width: 150px;
  height: 150px;
  margin: 20px 0;
}

.risk-ring {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.ring-bg {
  fill: none;
  stroke: var(--border);
  stroke-width: 8;
}

.ring-progress {
  fill: none;
  stroke: var(--primary);
  stroke-width: 8;
  stroke-linecap: round;
  stroke-dasharray: 251.2; /* 2 * pi * r (40) */
  stroke-dashoffset: 251.2;
  transition: stroke-dashoffset 1s ease-out, stroke 0.3s;
}

.risk-score-value {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 3rem;
  font-weight: 800;
  font-family: 'Outfit', sans-serif;
  color: var(--text-main);
}

.risk-status {
  font-weight: 600;
  font-size: 1.1rem;
  padding: 6px 16px;
  border-radius: 20px;
  margin-top: 10px;
}

/* Triage Alerts */
.triage-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 300px;
  overflow-y: auto;
  padding-right: 8px;
}

.triage-alert {
  padding: 14px;
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  gap: 4px;
  border-left: 4px solid transparent;
}

.triage-alert strong { font-size: 1.05rem; }
.triage-alert span { font-size: 0.9rem; opacity: 0.9; }

.triage-alert.critical { background: var(--danger-light); color: var(--danger); border-color: var(--danger); }
.triage-alert.attention { background: var(--warning-light); color: var(--warning); border-color: var(--warning); }
.triage-alert.monitor { background: var(--info-light); color: var(--info); border-color: var(--info); }
.triage-alert.normal { background: var(--success-light); color: var(--success); border-color: var(--success); }

/* Coach Card */
.coach-text {
  line-height: 1.6;
  color: var(--text-muted);
  margin-bottom: 20px;
}

.next-step-box {
  background: var(--primary-light);
  padding: 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 20px;
}

.next-step-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--primary);
  margin-bottom: 4px;
}

.next-step-value {
  font-weight: 600;
  color: var(--text-main);
}

.correlation-text {
  line-height: 1.6;
  color: var(--text-muted);
  font-style: italic;
  padding-left: 16px;
  border-left: 3px solid var(--primary);
}

/* Feedback Section */
.feedback-card {
  text-align: center;
  background: var(--input-bg);
  padding: 20px;
}

.feedback-card h3 {
  font-size: 1rem;
  margin-bottom: 16px;
  color: var(--text-muted);
}

.feedback-actions {
  display: flex;
  justify-content: center;
  gap: 16px;
}

.feedback-btn {
  background: var(--card-bg);
  border: 1px solid var(--border);
  width: 50px;
  height: 50px;
  border-radius: 50%;
  font-size: 1.5rem;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.feedback-btn:hover, .feedback-btn.active {
  transform: scale(1.1);
}

#btnFeedbackUp:hover, #btnFeedbackUp.active { color: var(--success); border-color: var(--success); background: var(--success-light); }
#btnFeedbackDown:hover, #btnFeedbackDown.active { color: var(--danger); border-color: var(--danger); background: var(--danger-light); }

.feedback-thanks {
  margin-top: 16px;
  font-weight: 600;
  color: var(--success);
  animation: fadeIn 0.3s;
}

.hidden { display: none !important; }

/* ================== NEW SCAN ================== */
.api-card { padding: 16px 24px; }

.styled-input {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--input-bg);
  color: var(--text-main);
  font-family: inherit;
  font-size: 1rem;
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
}

.styled-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.form-group label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  margin-bottom: 8px;
}

.helper-text {
  display: block;
  margin-top: 6px;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.scan-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
  margin-bottom: 24px;
}

@media (min-width: 768px) {
  .scan-layout { grid-template-columns: 1fr 1fr; }
}

.scan-step {
  height: 100%;
  display: flex;
  flex-direction: column;
}

.step-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.step-num {
  width: 28px;
  height: 28px;
  background: var(--primary);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
}

.optional-tag {
  font-size: 0.75rem;
  background: var(--border);
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 500;
  color: var(--text-muted);
  margin-left: 8px;
  vertical-align: middle;
}

.input-wrapper {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.input-wrapper textarea {
  flex: 1;
  resize: none;
}

.voice-btn {
  position: absolute;
  bottom: 12px;
  right: 12px;
  background: var(--primary);
  color: white;
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  transition: transform 0.2s, box-shadow 0.2s;
}

.voice-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 4px 8px rgba(59, 130, 246, 0.4);
}

.voice-status {
  font-size: 0.85rem;
  color: var(--primary);
  margin-top: 8px;
  display: none;
  font-weight: 500;
}

.upload-area {
  flex: 1;
  border: 2px dashed var(--border);
  border-radius: var(--radius-sm);
  background: var(--input-bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 30px 20px;
  text-align: center;
  cursor: pointer;
  position: relative;
  transition: all 0.2s ease;
}

.upload-area:hover, .upload-area.dragover {
  border-color: var(--primary);
  background: var(--primary-light);
}

.upload-area input[type="file"] {
  position: absolute;
  top: 0; left: 0; width: 100%; height: 100%;
  opacity: 0; cursor: pointer;
}

.upload-icon-pulse {
  font-size: 3rem;
  color: var(--primary);
  margin-bottom: 12px;
  transition: transform 0.3s;
}

.upload-area:hover .upload-icon-pulse { transform: scale(1.1); }

.upload-area h4 { margin-bottom: 4px; }
.upload-area p { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 12px; }
.file-formats { font-size: 0.75rem; color: var(--text-muted); background: var(--border); padding: 4px 8px; border-radius: 4px; }

.file-name {
  margin-top: 16px;
  font-weight: 600;
  color: var(--primary);
  word-break: break-all;
}

.analyze-action {
  text-align: center;
  padding: 0 20px;
}

.warning-banner {
  background: var(--danger-light);
  color: var(--danger);
  padding: 10px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  margin-bottom: 12px;
}

/* ================== HISTORY ================== */
.history-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.history-item {
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--input-bg);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: all 0.2s;
}

.history-item:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-sm);
  transform: translateX(4px);
}

.history-date { font-weight: 600; color: var(--text-main); display: block; margin-bottom: 4px; }
.history-score { font-size: 0.9rem; color: var(--text-muted); }

/* ================== FOOTER ================== */
.watermark-footer {
  text-align: center;
  padding: 16px;
  background: var(--card-bg);
  border-top: 1px solid var(--border);
  font-size: 0.85rem;
  color: var(--text-muted);
}

.watermark-heart { color: #EC4899; animation: heartbeat 1.5s infinite; }

@keyframes heartbeat {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.2); }
}

/* ================== CHAT WIDGET ================== */
.chat-toggle {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--primary-gradient);
  color: white;
  border: none;
  font-size: 1.8rem;
  box-shadow: var(--shadow-lg);
  cursor: pointer;
  z-index: 100;
  transition: transform 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chat-toggle:hover { transform: scale(1.05); }

.chat-widget {
  position: fixed;
  bottom: 100px;
  right: 24px;
  width: 350px;
  height: 500px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-glass);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 101;
  opacity: 0;
  pointer-events: none;
  transform: translateY(20px);
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.chat-widget.open {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.chat-header {
  background: var(--primary-gradient);
  color: white;
  padding: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.chat-title { display: flex; align-items: center; gap: 10px; font-weight: 600; font-family: 'Outfit', sans-serif;}
.chat-avatar { background: rgba(255,255,255,0.2); width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; }

.chat-header button { background: none; border: none; color: white; cursor: pointer; font-size: 1.2rem; opacity: 0.8; transition: opacity 0.2s; }
.chat-header button:hover { opacity: 1; }

.chat-body {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.chat-msg { display: flex; flex-direction: column; max-width: 85%; }
.chat-msg.user { align-self: flex-end; }
.chat-msg.ai { align-self: flex-start; }

.msg-bubble {
  padding: 12px 16px;
  border-radius: 16px;
  font-size: 0.95rem;
  line-height: 1.4;
}

.chat-msg.user .msg-bubble {
  background: var(--primary);
  color: white;
  border-bottom-right-radius: 4px;
}

.chat-msg.ai .msg-bubble {
  background: var(--input-bg);
  border: 1px solid var(--border);
  color: var(--text-main);
  border-bottom-left-radius: 4px;
}

/* RAG Upgrades styling */
#chatClearBtn {
  transition: transform 0.2s ease, opacity 0.2s;
}
#chatClearBtn:hover {
  transform: rotate(-15deg) scale(1.1);
}

.rag-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
  border-top: 1px solid var(--border);
  padding-top: 8px;
  gap: 8px;
}

.rag-confidence-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 12px;
  border: 1px solid transparent;
}
.rag-confidence-badge[data-confidence="high"] {
  background: rgba(16, 185, 129, 0.1);
  color: var(--success);
  border-color: rgba(16, 185, 129, 0.2);
}
.rag-confidence-badge[data-confidence="medium"] {
  background: rgba(245, 158, 11, 0.1);
  color: var(--warning);
  border-color: rgba(245, 158, 11, 0.2);
}
.rag-confidence-badge[data-confidence="low"] {
  background: rgba(239, 68, 68, 0.1);
  color: var(--danger);
  border-color: rgba(239, 68, 68, 0.2);
}

.rag-sources-container {
  margin-top: 8px;
  border-top: 1px solid var(--border);
  padding-top: 8px;
  font-size: 0.8rem;
  text-align: left;
}

.rag-sources-toggle {
  color: var(--primary);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 600;
  user-select: none;
  font-size: 0.78rem;
}

.rag-sources-toggle i {
  transition: transform 0.2s ease;
}

.rag-sources-toggle.active i {
  transform: rotate(90deg);
}

.rag-sources-content {
  margin-top: 6px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 150px;
  overflow-y: auto;
  padding-right: 4px;
}

.rag-sources-content::-webkit-scrollbar {
  width: 4px;
}
.rag-sources-content::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}

.rag-source-item {
  background: var(--bg-color);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px;
  text-align: left;
}

.source-meta {
  display: block;
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: 500;
  margin-bottom: 2px;
}

.source-text {
  margin: 0;
  color: var(--text-main);
  line-height: 1.3;
  font-style: italic;
  font-size: 0.75rem;
}


.chat-footer {
  padding: 16px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 8px;
  background: var(--input-bg);
}

.chat-footer input {
  flex: 1;
  padding: 10px 16px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--bg-color);
  color: var(--text-main);
  outline: none;
}

.chat-footer input:focus { border-color: var(--primary); }

.chat-footer button {
  background: var(--primary);
  color: white;
  border: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

/* ================== MODAL ================== */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  /* Safety: hidden overlays must NEVER intercept pointer events */
  pointer-events: none;
}

/* Only intercept events when the overlay is actually visible */
.modal-overlay[style*="display: flex"],
.modal-overlay[style*="display:flex"] {
  pointer-events: auto;
}

.modal-card {
  width: 90%;
  max-width: 800px;
  background: var(--card-bg);
  border-radius: var(--radius-md);
  padding: 24px;
  box-shadow: var(--shadow-lg);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.chart-container {
  position: relative;
  height: 400px;
  width: 100%;
}

/* ================== LOADER ================== */
.loader-overlay {
  position: fixed;
  top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(15, 23, 42, 0.8);
  backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 3000;
}

.glass-loader {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 40px;
  border-radius: var(--radius-lg);
  text-align: center;
  color: white;
  max-width: 90%;
}

.spinner-rings {
  position: relative;
  width: 80px;
  height: 80px;
  margin: 0 auto 20px;
}

.spinner-rings .ring {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 4px solid transparent;
  border-top-color: var(--primary);
  animation: spin 1.2s cubic-bezier(0.5, 0, 0.5, 1) infinite;
}

.spinner-rings .ring:nth-child(2) { border-top-color: #8B5CF6; animation-delay: -0.15s; }
.spinner-rings .ring:nth-child(3) { border-top-color: #EC4899; animation-delay: -0.3s; }

@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

.loader-text { font-size: 1.2rem; font-weight: 600; font-family: 'Outfit', sans-serif; margin-bottom: 8px; }
.loader-subtext { font-size: 0.9rem; opacity: 0.8; }

/* ================== RESPONSIVE (SMARTPHONE) ================== */

/* ---------- Tablet (≤768px) ---------- */
@media (max-width: 768px) {

  /* --- Landing Page --- */
  .landing-page {
    padding: 0 20px;
  }

  .landing-nav {
    padding: 18px 0 14px;
    flex-wrap: wrap;
    gap: 12px;
  }

  .nav-tagline {
    display: none; /* hide on mobile to keep nav clean */
  }

  .hero {
    padding: 56px 0 48px;
  }

  .hero h1 {
    font-size: 2.4rem;
    line-height: 1.15;
    margin-bottom: 20px;
  }

  .hero-desc {
    font-size: 1rem;
    line-height: 1.7;
    margin-bottom: 36px;
  }

  .hero-desc .br-desktop { display: none; }

  .hero-actions {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .btn-hero, .btn-ghost {
    width: 100%;
    justify-content: center;
  }

  .hero-trust {
    gap: 8px;
    font-size: 0.82rem;
  }

  /* --- Stats Bar --- */
  .stats-bar {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    padding: 24px 16px;
    margin: 0 0 64px;
    border-radius: var(--radius-md);
  }

  .stat-divider {
    display: none;
  }

  .stat-item {
    padding: 16px 12px;
    border-bottom: 1px solid var(--border);
  }

  .stat-item:nth-child(1), .stat-item:nth-child(3) {
    border-right: 1px solid var(--border);
  }

  .stat-item:nth-child(3), .stat-item:nth-child(4) {
    border-bottom: none;
  }

  .stat-num { font-size: 1.6rem; }
  .stat-label { font-size: 0.75rem; }

  /* --- How It Works --- */
  .how-section {
    padding: 0 0 64px;
  }

  .section-title { font-size: 1.9rem; }
  .section-sub { font-size: 0.95rem; margin-bottom: 36px; }

  .steps-grid {
    flex-direction: column;
    gap: 16px;
  }

  .step-card {
    max-width: 100%;
    padding: 28px 24px;
    text-align: left;
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 18px;
  }

  .step-card-left {
    display: flex;
    flex-direction: column;
    align-items: center;
  }

  .step-icon {
    flex-shrink: 0;
    margin: 0;
    width: 52px;
    height: 52px;
    font-size: 1.5rem;
  }

  .step-number { margin-bottom: 8px; }

  .step-connector {
    display: none; /* hide arrows between vertical steps */
  }

  /* --- Features Grid --- */
  .features-section {
    padding: 0 0 64px;
  }

  .features-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .feature-tile {
    padding: 20px 18px;
    gap: 14px;
  }

  /* --- CTA --- */
  .cta-section { padding: 0 0 56px; }

  .cta-card {
    padding: 48px 24px;
  }

  .cta-card h2 { font-size: 1.8rem; }
  .cta-card p { font-size: 0.95rem; margin-bottom: 28px; }

  /* --- Landing Footer --- */
  .landing-footer {
    padding: 36px 16px 32px;
    gap: 10px;
  }

  .footer-disclaimer { font-size: 0.75rem; }

  /* --- App Shell --- */
  .app-view {
    padding: 0;
    min-height: 100vh;
    min-height: 100dvh;
  }

  .app-container {
    border-radius: 0;
    height: 100vh;
    height: 100dvh;
    border: none;
  }

  /* --- Header --- */
  .header {
    padding: 14px 18px;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
  }

  .logo-area {
    font-size: 1.2rem;
    flex: 1;
  }

  .logo-area i {
    font-size: 1.5rem;
  }

  .header-controls {
    display: flex;
    align-items: center;
    gap: 10px;
  }

  .styled-select {
    font-size: 0.8rem;
    padding: 7px 28px 7px 10px;
  }

  .icon-btn {
    width: 38px;
    height: 38px;
    font-size: 1.1rem;
  }

  /* --- Tabs (pill-style scrollable nav) --- */
  .tabs {
    overflow-x: auto;
    white-space: nowrap;
    padding: 10px 16px;
    gap: 6px;
    display: flex;
    scrollbar-width: none;
    -ms-overflow-style: none;
    border-bottom: 1px solid var(--border);
    background: var(--card-bg);
  }

  .tabs::-webkit-scrollbar { display: none; }

  .tab-btn {
    flex: none;
    padding: 10px 18px;
    border-radius: var(--radius-full);
    font-size: 0.88rem;
    gap: 6px;
    min-width: unset;
    background: transparent;
    border: 1.5px solid transparent;
    transition: background 0.2s, color 0.2s, border-color 0.2s;
  }

  .tab-btn::after { display: none; } /* remove underline indicator on mobile */

  .tab-btn.active {
    background: var(--primary-light);
    border-color: var(--primary);
    color: var(--primary);
  }

  .tab-btn i { font-size: 1.1rem; }
  .tab-btn span { display: inline; font-size: 0.85rem; }

  /* --- Scroll Container --- */
  .scroll-container {
    padding: 18px 16px 100px; /* extra bottom for floating chat button */
  }

  /* --- Cards --- */
  .card {
    padding: 18px 16px;
    margin-bottom: 18px;
    border-radius: var(--radius-md);
  }

  .card-header h3 {
    font-size: 1.05rem;
  }

  /* --- Dashboard Grid --- */
  .dashboard-grid {
    grid-template-columns: 1fr;
    gap: 16px;
    margin-bottom: 16px;
  }

  .dashboard-actions {
    flex-direction: column;
    gap: 10px;
    margin-bottom: 16px;
  }

  .dashboard-actions .btn {
    width: 100%;
    justify-content: center;
    padding: 14px 20px;
  }

  /* --- Risk Dial --- */
  .risk-dial-container {
    width: 130px;
    height: 130px;
  }

  .risk-score-value { font-size: 2.4rem; }
  .risk-status { font-size: 1rem; }

  /* --- Triage Alerts --- */
  .triage-list { max-height: unset; }

  .triage-alert {
    padding: 12px 14px;
  }

  /* --- Scan Layout --- */
  .scan-layout {
    grid-template-columns: 1fr;
    gap: 18px;
  }

  .upload-area {
    padding: 28px 16px;
    min-height: 160px;
  }

  .upload-icon-pulse { font-size: 2.5rem; }

  .analyze-action {
    padding: 0;
  }

  .analyze-action .btn-massive {
    padding: 16px 24px;
    font-size: 1.05rem;
    border-radius: var(--radius-md);
  }

  /* --- History --- */
  .history-item {
    padding: 14px 16px;
    flex-wrap: wrap;
    gap: 8px;
  }

  .history-item:hover {
    transform: none; /* avoid janky slide on touch */
  }

  /* --- Feedback --- */
  .feedback-card {
    padding: 18px 16px;
  }

  .feedback-btn {
    width: 52px;
    height: 52px;
    font-size: 1.6rem;
  }

  /* --- API Card --- */
  .api-card {
    padding: 14px 16px;
  }

  /* --- Empty State --- */
  .empty-state {
    padding: 48px 20px;
  }

  /* --- Chat Widget --- */
  .chat-toggle {
    bottom: 20px;
    right: 18px;
    width: 56px;
    height: 56px;
    font-size: 1.6rem;
  }

  .chat-widget {
    width: 100%;
    bottom: 0;
    right: 0;
    border-radius: 20px 20px 0 0;
    height: 80vh;
    height: 80dvh;
  }

  /* --- Modal --- */
  .modal-card {
    width: 95%;
    padding: 20px 16px;
    max-height: 90vh;
    overflow-y: auto;
  }

  .chart-container { height: 280px; }

  /* --- Footer --- */
  .watermark-footer {
    padding: 14px 16px;
    font-size: 0.8rem;
  }

  /* --- Buttons (touch-friendly) --- */
  .btn {
    min-height: 44px;
  }

  .btn-large {
    padding: 14px 24px;
    font-size: 1rem;
  }

  .step-num {
    width: 26px;
    height: 26px;
    font-size: 0.85rem;
  }

  .step-header { gap: 10px; margin-bottom: 14px; }
}

/* ---------- Small phones (≤480px) ---------- */
@media (max-width: 480px) {

  /* --- Landing --- */
  .hero h1 { font-size: 1.9rem; letter-spacing: -0.02em; }
  .hero-desc { font-size: 0.92rem; }
  .hero-badge { font-size: 0.78rem; padding: 6px 14px; }
  .section-title { font-size: 1.6rem; }

  .stats-bar { padding: 16px 12px; margin-bottom: 48px; }
  .stat-num { font-size: 1.4rem; }

  .step-card { padding: 20px 16px; gap: 14px; }
  .step-icon { width: 44px; height: 44px; font-size: 1.3rem; }

  .feature-tile { padding: 16px 14px; gap: 12px; }
  .feature-tile-icon { width: 40px; height: 40px; font-size: 1.2rem; }
  .feature-tile-body h4 { font-size: 0.9rem; }
  .feature-tile-body p { font-size: 0.82rem; }

  .cta-card { padding: 36px 18px; }
  .cta-card h2 { font-size: 1.5rem; }

  /* --- App Shell --- */
  /* Icon-only tabs on very small screens */
  .tab-btn span { display: none; }
  .tab-btn i { font-size: 1.3rem; }
  .tab-btn { padding: 10px 14px; }

  .logo-area { font-size: 1.1rem; }

  .header { padding: 12px 14px; }

  .scroll-container { padding: 14px 12px 100px; }

  .card {
    padding: 16px 14px;
    margin-bottom: 14px;
  }

  .risk-dial-container { width: 110px; height: 110px; }
  .risk-score-value { font-size: 2rem; }

  .modal-card { width: 100%; border-radius: var(--radius-md) var(--radius-md) 0 0; padding: 18px 14px; }
  .chart-container { height: 220px; }

  .empty-state { padding: 36px 16px; }

  .feedback-btn { width: 48px; height: 48px; font-size: 1.4rem; }

  .dashboard-actions .btn { font-size: 0.9rem; padding: 12px 16px; }
}

/* ---------- Safe-area insets (notched phones) ---------- */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  @media (max-width: 768px) {
    .watermark-footer {
      padding-bottom: calc(14px + env(safe-area-inset-bottom));
    }
    .chat-toggle {
      bottom: calc(20px + env(safe-area-inset-bottom));
    }
    .scroll-container {
      padding-bottom: calc(100px + env(safe-area-inset-bottom));
    }
    .tabs {
      padding-left: max(16px, env(safe-area-inset-left));
      padding-right: max(16px, env(safe-area-inset-right));
    }
    .landing-page {
      padding-left: max(20px, env(safe-area-inset-left));
      padding-right: max(20px, env(safe-area-inset-right));
    }
  }
}

/* ================== SAVE BANNER (guest nudge) ================== */
.save-banner {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(0);
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-lg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  padding: 12px 16px 12px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.9rem;
  color: var(--text-main);
  z-index: 9999;
  max-width: 90vw;
  animation: bannerIn 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.save-banner i { color: var(--warning); font-size: 1.2rem; flex-shrink: 0; }

.save-banner-cta {
  flex-shrink: 0;
  background: var(--primary-gradient);
  color: white;
  border: none;
  border-radius: var(--radius-full);
  padding: 7px 18px;
  font-family: 'Outfit', sans-serif;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  transition: opacity 0.2s;
}

.save-banner-cta:hover { opacity: 0.85; }

.save-banner-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1rem;
  display: flex;
  align-items: center;
  padding: 2px;
  flex-shrink: 0;
  transition: color 0.2s;
}

.save-banner-close:hover { color: var(--danger); }

.banner-hiding {
  animation: bannerOut 0.35s ease forwards;
}

@keyframes bannerIn {
  from { opacity: 0; transform: translateX(-50%) translateY(20px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

@keyframes bannerOut {
  from { opacity: 1; transform: translateX(-50%) translateY(0); }
  to   { opacity: 0; transform: translateX(-50%) translateY(20px); }
}

/* ================== MOBILE — AUTH NAV + MODAL ================== */
@media (max-width: 768px) {

  /* Nav: stack tagline + auth below logo */
  .landing-nav {
    flex-wrap: wrap;
    gap: 14px;
    padding: 16px 0 14px;
  }

  .nav-right {
    flex-wrap: wrap;
    gap: 10px;
    width: 100%;
    justify-content: space-between;
  }

  .nav-tagline {
    display: none; /* hidden on mobile — keeps nav clean */
  }

  .nav-auth-group {
    gap: 8px;
    flex-wrap: nowrap;
  }

  .btn-ghost-sm {
    padding: 7px 14px;
    font-size: 0.82rem;
  }

  .btn-nav {
    padding: 8px 16px;
    font-size: 0.85rem;
  }

  /* Auth modal — full-width bottom sheet on mobile */
  .auth-card {
    width: 100%;
    max-width: 100%;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    max-height: 95vh;
    overflow-y: auto;
  }

  /* When auth modal is open on mobile, centre it from bottom */
  #authModal {
    align-items: flex-end !important;
  }

  .auth-form-wrap {
    padding: 20px 20px 4px;
  }

  .auth-brand { font-size: 1.2rem; }
  .auth-sub { font-size: 0.88rem; margin-bottom: 20px; }
  .auth-field { margin-bottom: 14px; }

  /* Save banner on mobile */
  .save-banner {
    bottom: 80px; /* above floating chat button */
    border-radius: var(--radius-md);
    font-size: 0.82rem;
    padding: 10px 14px;
    gap: 10px;
  }

  .save-banner-cta { padding: 6px 14px; font-size: 0.8rem; }
}

@media (max-width: 480px) {
  .nav-auth-group { gap: 6px; }
  .btn-ghost-sm { padding: 6px 12px; }
  .btn-nav { padding: 7px 14px; font-size: 0.82rem; }
  .nav-user-pill { font-size: 0.78rem; padding: 4px 10px 4px 4px; }
  .nav-avatar { width: 24px; height: 24px; font-size: 0.8rem; }
}

/* ================== TOAST NOTIFICATIONS (Phase 1) ================== */
.app-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  padding: 14px 24px;
  border-radius: var(--radius-full);
  font-family: 'Inter', sans-serif;
  font-size: 0.9rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
  z-index: 9999;
  opacity: 0;
  transition: opacity 0.3s ease, transform 0.3s ease;
  max-width: 90%;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 8px 32px rgba(0,0,0,0.18);
}

.app-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.app-toast-error {
  background: rgba(239, 68, 68, 0.92);
  color: #fff;
}

.app-toast-success {
  background: rgba(16, 185, 129, 0.92);
  color: #fff;
}

.app-toast-info {
  background: rgba(59, 130, 246, 0.92);
  color: #fff;
}

/* ================== CONSENT MODAL (Phase 1) ================== */
.consent-card {
  width: 94%;
  max-width: 520px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px 36px 32px;
  box-shadow: var(--shadow-lg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  text-align: center;
}

.consent-icon {
  font-size: 3rem;
  color: var(--warning);
  margin-bottom: 16px;
}

.consent-card h2 {
  font-size: 1.5rem;
  margin-bottom: 20px;
  color: var(--text-main);
}

.consent-body {
  text-align: left;
  margin-bottom: 24px;
}

.consent-body p {
  font-size: 0.95rem;
  color: var(--text-muted);
  margin-bottom: 14px;
  line-height: 1.6;
}

.consent-body ul {
  list-style: none;
  padding: 0;
}

.consent-body li {
  font-size: 0.9rem;
  color: var(--text-main);
  padding: 10px 14px;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  line-height: 1.55;
}

.consent-body li strong {
  color: var(--primary);
}

/* ================== CONFIDENCE & VALIDATION (Phase 3) ================== */
.extra-info-section {
  margin-bottom: 16px;
}

.confidence-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-full);
  font-size: 0.88rem;
  font-weight: 600;
  margin-bottom: 12px;
}

.conf-high {
  background: var(--success-light);
  color: var(--success);
  border: 1px solid var(--success);
}

.conf-med {
  background: var(--warning-light);
  color: var(--warning);
  border: 1px solid var(--warning);
}

.conf-low {
  background: var(--danger-light);
  color: var(--danger);
  border: 1px solid var(--danger);
}

.limitations-note {
  background: var(--info-light);
  border: 1px solid var(--info);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: 0.88rem;
  color: var(--text-main);
  line-height: 1.6;
  margin-bottom: 12px;
}

.limitations-note i {
  color: var(--info);
}

.validation-note {
  font-size: 0.8rem;
  color: var(--warning);
  background: var(--warning-light);
  padding: 6px 10px;
  border-radius: 6px;
  margin-top: 6px;
  line-height: 1.5;
}

@media (max-width: 600px) {
  .consent-card {
    padding: 28px 20px 24px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
  }
  .consent-body {
    overflow-y: auto;
    padding-right: 4px;
    margin-bottom: 16px;
  }
  .app-toast {
    bottom: 80px;
    font-size: 0.82rem;
    padding: 10px 18px;
  }
}
/* ================================== KEYLESS & ADVANCED UI ================================== */
.keyless-status-banner {
    background: var(--success-light);
    border: 1px solid var(--success);
    border-radius: var(--radius-md);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 12px;
    animation: fadeIn 0.4s ease;
}

.status-icon {
    width: 40px;
    height: 40px;
    background: var(--success);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    flex-shrink: 0;
}

.status-text strong {
    display: block;
    font-size: 0.95rem;
    color: var(--success);
    margin-bottom: 2px;
}

.status-text p {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin: 0;
}

.advanced-settings-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 0.85rem;
    color: var(--text-muted);
    cursor: pointer;
    padding: 8px;
    margin-bottom: 12px;
    transition: color 0.2s;
    user-select: none;
}

.advanced-settings-toggle:hover {
    color: var(--primary);
}

.get-key-box {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
    text-align: center;
}

.get-key-box p {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-bottom: 10px;
}

.hidden {
    display: none !important;
}
