/* ============================================
   BIOGENIC DRIVER PORTAL — Unified Styles
   Light: Arctic Light (light2 prototype)
   Dark: Industrial Luxe Glass (dark prototype)
   ============================================ */

/* Fonts — both display families loaded; theme selects via --font-display */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=Outfit:wght@300;400;500;600;700;800&family=DM+Sans:opsz,wght@9..40,300;9..40,400;9..40,500;9..40,600;9..40,700&display=swap');

/* =============================================
   LIGHT THEME (Default) — light2 prototype
   ============================================= */
:root {
  --bg-page: #f8fafb;
  --bg-deep: #f8fafb;
  --bg-surface: #ffffff;
  --bg-surface-hover: #f4f7f9;
  --bg-surface-strong: #edf1f4;
  --bg-inset: #e4e9ee;
  --border-light: rgba(15, 23, 42, 0.06);
  --border-medium: rgba(15, 23, 42, 0.10);
  --border-heavy: rgba(15, 23, 42, 0.16);

  --card-bg: var(--bg-surface);

  --teal: #0369a1;
  --teal-light: #e8f4fb;
  --teal-mid: #a8d4ec;
  --teal-glow: rgba(3, 105, 161, 0.10);
  --green: #059669;
  --green-light: #ecfdf5;
  --green-mid: #a7f3d0;
  --amber: #c2410c;
  --amber-light: #fff4ed;
  --amber-mid: #fdba8c;
  --rust: #be123c;
  --rust-light: #ffe4e8;
  --rust-mid: #f5a3b0;
  --slate: #475569;

  /* Aliases for dark-theme HTML compat */
  --cyan: #0369a1;
  --cyan-dim: rgba(3, 105, 161, 0.10);
  --emerald: #059669;
  --emerald-dim: rgba(5, 150, 105, 0.10);
  --coral: #be123c;
  --coral-dim: rgba(190, 18, 60, 0.10);
  --amber-dim: rgba(194, 65, 12, 0.10);

  --text-primary: #0f172a;
  --text-secondary: #64748b;
  --text-tertiary: #94a3b8;
  --text-inverse: #ffffff;

  --font-display: 'Inter', sans-serif;
  --font-body: 'DM Sans', sans-serif;

  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-pill: 100px;

  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.04), 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow-card: 0 2px 8px rgba(15, 23, 42, 0.05), 0 1px 3px rgba(15, 23, 42, 0.04);
  --shadow-elevated: 0 8px 24px rgba(15, 23, 42, 0.08), 0 2px 8px rgba(15, 23, 42, 0.04);
  --shadow-teal: 0 4px 14px rgba(3, 105, 161, 0.18);
  --shadow-green: 0 4px 14px rgba(5, 150, 105, 0.18);
  --shadow-amber: 0 4px 14px rgba(194, 65, 12, 0.18);
  --shadow-rust: 0 4px 14px rgba(190, 18, 60, 0.18);

  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);

  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --nav-height: 72px;
}

/* =============================================
   DARK THEME — dark prototype mapped
   ============================================= */
.theme-dark {
  --bg-page: #060b18;
  --bg-deep: #060b18;
  --bg-surface: #0c1225;
  --bg-surface-hover: rgba(255, 255, 255, 0.07);
  --bg-surface-strong: rgba(255, 255, 255, 0.09);
  --bg-inset: rgba(255, 255, 255, 0.08);
  --border-light: rgba(255, 255, 255, 0.08);
  --border-medium: rgba(255, 255, 255, 0.15);
  --border-heavy: rgba(255, 255, 255, 0.18);

  --card-bg: rgba(255, 255, 255, 0.04);

  --teal: #00d4ff;
  --teal-light: rgba(0, 212, 255, 0.15);
  --teal-mid: rgba(0, 212, 255, 0.3);
  --teal-glow: rgba(0, 212, 255, 0.15);
  --green: #00e676;
  --green-light: rgba(0, 230, 118, 0.15);
  --green-mid: rgba(0, 230, 118, 0.3);
  --amber: #ffb800;
  --amber-light: rgba(255, 184, 0, 0.15);
  --amber-mid: rgba(255, 184, 0, 0.3);
  --rust: #ff4757;
  --rust-light: rgba(255, 71, 87, 0.15);
  --rust-mid: rgba(255, 71, 87, 0.3);
  --slate: rgba(255, 255, 255, 0.55);

  --cyan: #00d4ff;
  --cyan-dim: rgba(0, 212, 255, 0.15);
  --emerald: #00e676;
  --emerald-dim: rgba(0, 230, 118, 0.15);
  --coral: #ff4757;
  --coral-dim: rgba(255, 71, 87, 0.15);
  --amber-dim: rgba(255, 184, 0, 0.15);

  --text-primary: rgba(255, 255, 255, 0.92);
  --text-secondary: rgba(255, 255, 255, 0.55);
  --text-tertiary: rgba(255, 255, 255, 0.3);
  --text-inverse: #060b18;

  --font-display: 'Outfit', sans-serif;

  --radius-md: 16px;
  --radius-lg: 22px;

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-card: 0 8px 32px rgba(0, 0, 0, 0.4);
  --shadow-elevated: 0 12px 40px rgba(0, 0, 0, 0.5);
  --shadow-teal: 0 0 20px rgba(0, 212, 255, 0.2), 0 0 40px rgba(0, 212, 255, 0.1);
  --shadow-green: 0 0 20px rgba(0, 230, 118, 0.2);
  --shadow-amber: 0 0 20px rgba(255, 184, 0, 0.2);
  --shadow-rust: 0 4px 16px rgba(255, 71, 87, 0.3);
}

/* =============================================
   RESET & BASE
   ============================================= */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-body);
  background: var(--bg-page);
  color: var(--text-primary);
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  line-height: 1.55;
}

body.theme-dark {
  line-height: 1.5;
}

a {
  color: inherit;
  text-decoration: none;
}

input, textarea, select, button {
  font-family: var(--font-body);
  font-size: 1rem;
  border: none;
  outline: none;
  background: none;
  color: var(--text-primary);
}

/* =============================================
   BACKGROUND LAYERS
   ============================================= */

/* --- Light: texture + dots --- */
.bg-texture {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.3;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.02'/%3E%3C/svg%3E");
}

.bg-dots {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image: radial-gradient(circle, rgba(15, 23, 42, 0.025) 1px, transparent 1px);
  background-size: 24px 24px;
}

/* --- Dark: mesh + grid --- */
.bg-mesh {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.bg-mesh::before {
  content: '';
  position: absolute;
  top: -40%;
  left: -20%;
  width: 80%;
  height: 80%;
  background: radial-gradient(ellipse, rgba(0, 212, 255, 0.06) 0%, transparent 70%);
  animation: meshDrift1 25s ease-in-out infinite alternate;
}

.bg-mesh::after {
  content: '';
  position: absolute;
  bottom: -30%;
  right: -20%;
  width: 70%;
  height: 70%;
  background: radial-gradient(ellipse, rgba(0, 230, 118, 0.04) 0%, transparent 70%);
  animation: meshDrift2 30s ease-in-out infinite alternate;
}

@keyframes meshDrift1 {
  0% { transform: translate(0, 0) scale(1); }
  100% { transform: translate(15%, 10%) scale(1.1); }
}

@keyframes meshDrift2 {
  0% { transform: translate(0, 0) scale(1); }
  100% { transform: translate(-10%, -15%) scale(1.15); }
}

.bg-grid {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.015) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.015) 1px, transparent 1px);
  background-size: 60px 60px;
}

/* Theme visibility */
.theme-light .bg-mesh,
.theme-light .bg-grid { display: none; }

.theme-dark .bg-texture,
.theme-dark .bg-dots { display: none; }

/* =============================================
   PAGE LAYOUT
   ============================================= */
.page {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  min-height: 100dvh;
  padding-bottom: calc(var(--nav-height) + var(--safe-bottom) + 16px);
}

.page--no-nav {
  padding-bottom: 0;
}

.page-content {
  padding: 0 16px;
  max-width: 480px;
  margin: 0 auto;
}

/* =============================================
   TOP HEADER
   ============================================= */
.top-header {
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(248, 250, 251, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-light);
  max-width: 100%;
}

.theme-dark .top-header {
  background: rgba(6, 11, 24, 0.8);
}

.top-header__back {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  background: var(--card-bg);
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
  text-decoration: none;
}

.theme-dark .top-header__back {
  box-shadow: none;
}

.top-header__back:hover {
  background: var(--bg-surface-strong);
  border-color: var(--border-medium);
}

.theme-dark .top-header__back:hover {
  background: var(--bg-surface-hover);
  border-color: var(--border-medium);
}

.top-header__back svg {
  width: 18px;
  height: 18px;
  stroke: var(--text-primary);
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.top-header__title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-primary);
}

.theme-dark .top-header__title {
  font-size: 1.1rem;
}

.top-header__actions {
  margin-left: auto;
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.top-header__theme-toggle,
.top-header__action-btn {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--card-bg);
  border: 1px solid var(--border-light);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  box-shadow: var(--shadow-sm);
}

.theme-dark .top-header__theme-toggle,
.theme-dark .top-header__action-btn {
  box-shadow: none;
}

.theme-dark .top-header__theme-toggle {
  color: var(--amber);
}

.top-header__theme-toggle:hover,
.top-header__action-btn:hover {
  background: var(--bg-surface-strong);
  border-color: var(--border-medium);
  color: var(--text-primary);
}

.theme-dark .top-header__theme-toggle:hover,
.theme-dark .top-header__action-btn:hover {
  background: var(--bg-surface-hover);
  border-color: var(--border-medium);
}

.top-header__theme-toggle svg,
.top-header__action-btn svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Theme toggle icon visibility */
.theme-light .icon-sun { display: none; }
.theme-light .icon-moon { display: block; }
.theme-dark .icon-sun { display: block; }
.theme-dark .icon-moon { display: none; }

/* =============================================
   AVATAR
   ============================================= */
.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.75rem;
  color: var(--text-inverse);
  flex-shrink: 0;
}

.theme-light .avatar { background: var(--teal); }
.theme-dark .avatar { background: linear-gradient(135deg, var(--cyan), var(--emerald)); }

/* =============================================
   CARD
   ============================================= */
.card {
  background: var(--card-bg);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 20px;
  box-shadow: var(--shadow-card);
  transition: all 0.25s var(--ease-out-expo);
}

.card:hover {
  box-shadow: var(--shadow-elevated);
  border-color: var(--border-medium);
}

.theme-dark .card {
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.theme-dark .card:hover {
  background: var(--bg-surface-hover);
}

.card--flat:hover {
  box-shadow: var(--shadow-card);
  border-color: var(--border-light);
}

.theme-dark .card--flat:hover {
  background: var(--card-bg);
}

.card--no-hover:hover {
  box-shadow: var(--shadow-card);
  border-color: var(--border-light);
  background: var(--card-bg);
}

.card--inset {
  background: var(--bg-surface-strong);
  border-color: var(--border-light);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.04);
}

/* Card with colored left edge */
.card--edge-teal {
  border-left: 3px solid var(--teal);
}

.card--edge-green {
  border-left: 3px solid var(--green);
}

.card--edge-amber {
  border-left: 3px solid var(--amber);
}

.card--edge-rust {
  border-left: 3px solid var(--rust);
}

/* Dark: edge cards get inset glow */
.theme-dark .card--edge-teal {
  box-shadow: var(--shadow-card), inset 3px 0 12px rgba(0, 212, 255, 0.08);
}

.theme-dark .card--edge-green {
  box-shadow: var(--shadow-card), inset 3px 0 12px rgba(0, 230, 118, 0.08);
}

.theme-dark .card--edge-amber {
  box-shadow: var(--shadow-card), inset 3px 0 12px rgba(255, 184, 0, 0.08);
}

.theme-dark .card--edge-rust {
  box-shadow: var(--shadow-card), inset 3px 0 12px rgba(255, 71, 87, 0.08);
}

/* =============================================
   BUTTONS
   ============================================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.92rem;
  letter-spacing: 0.01em;
  padding: 13px 26px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: all 0.25s var(--ease-out-expo);
  position: relative;
  overflow: hidden;
  white-space: nowrap;
}

.theme-dark .btn {
  font-size: 0.95rem;
  padding: 14px 28px;
}

.btn:active {
  transform: scale(0.97);
}

.btn svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Primary — Teal / Cyan */
.btn--primary {
  background: var(--teal);
  color: var(--text-inverse);
  box-shadow: var(--shadow-teal);
}

.btn--primary:hover {
  background: #025e90;
  box-shadow: 0 6px 20px rgba(3, 105, 161, 0.25);
  transform: translateY(-1px);
}

.theme-dark .btn--primary {
  box-shadow: 0 4px 16px rgba(0, 212, 255, 0.3);
}

.theme-dark .btn--primary:hover {
  background: var(--teal);
  box-shadow: 0 0 20px rgba(0, 212, 255, 0.2), 0 0 40px rgba(0, 212, 255, 0.1);
}

/* Success — Green / Emerald */
.btn--success {
  background: var(--green);
  color: var(--text-inverse);
  box-shadow: var(--shadow-green);
}

.btn--success:hover {
  background: #047857;
  box-shadow: 0 6px 20px rgba(5, 150, 105, 0.25);
  transform: translateY(-1px);
}

.theme-dark .btn--success {
  box-shadow: 0 4px 16px rgba(0, 230, 118, 0.3);
}

.theme-dark .btn--success:hover {
  background: var(--green);
  box-shadow: 0 0 20px rgba(0, 230, 118, 0.2);
}

/* Warning — Amber */
.btn--warning {
  background: var(--amber);
  color: var(--text-inverse);
  box-shadow: var(--shadow-amber);
}

.btn--warning:hover {
  background: #a8380a;
  transform: translateY(-1px);
}

.theme-dark .btn--warning {
  box-shadow: 0 4px 16px rgba(255, 184, 0, 0.3);
}

.theme-dark .btn--warning:hover {
  background: var(--amber);
  box-shadow: 0 0 20px rgba(255, 184, 0, 0.2);
}

/* Danger — Rust / Coral */
.btn--danger {
  background: var(--rust);
  color: var(--text-inverse);
  box-shadow: var(--shadow-rust);
}

.btn--danger:hover {
  background: #9f1239;
  transform: translateY(-1px);
}

.theme-dark .btn--danger {
  color: #fff;
  box-shadow: 0 4px 16px rgba(255, 71, 87, 0.3);
}

.theme-dark .btn--danger:hover {
  background: var(--rust);
}

/* Outline (light) / Ghost (dark) */
.btn--outline,
.btn--ghost {
  background: var(--card-bg);
  border: 1.5px solid var(--border-medium);
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
}

.btn--outline:hover,
.btn--ghost:hover {
  background: var(--bg-surface-strong);
  border-color: var(--border-heavy);
}

.theme-dark .btn--outline,
.theme-dark .btn--ghost {
  border-width: 1px;
  border-color: var(--border-light);
  box-shadow: none;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.theme-dark .btn--outline:hover,
.theme-dark .btn--ghost:hover {
  background: var(--bg-surface-hover);
  border-color: var(--border-medium);
}

/* Size & shape variants */
.btn--block { width: 100%; }

.btn--sm {
  padding: 10px 20px;
  font-size: 0.85rem;
}

.btn--icon {
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: var(--radius-sm);
}

/* Loading state */
.btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  flex-shrink: 0;
}

/* =============================================
   BADGE / TAG
   ============================================= */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.72rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.theme-dark .badge {
  font-weight: 500;
}

.badge--teal { background: var(--teal-light); color: var(--teal); }
.badge--green { background: var(--green-light); color: var(--green); }
.badge--amber { background: var(--amber-light); color: var(--amber); }
.badge--rust { background: var(--rust-light); color: var(--rust); }

.badge--neutral,
.badge--glass {
  background: var(--bg-surface-strong);
  color: var(--text-secondary);
  border: 1px solid var(--border-light);
}

.theme-dark .badge--neutral,
.theme-dark .badge--glass {
  background: var(--card-bg);
}

/* Dark color aliases */
.badge--cyan { background: var(--teal-light); color: var(--teal); }
.badge--emerald { background: var(--green-light); color: var(--green); }
.badge--coral { background: var(--rust-light); color: var(--rust); }

.badge__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.badge__dot--pulse {
  animation: dotPulse 2s ease-in-out infinite;
}

@keyframes dotPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.8); }
}

/* =============================================
   FORM INPUTS
   ============================================= */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin-bottom: 6px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.theme-dark .form-label {
  font-weight: 500;
  font-size: 0.82rem;
  letter-spacing: 0.03em;
}

.form-input {
  width: 100%;
  padding: 13px 16px;
  background: var(--card-bg);
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 1rem;
  transition: all 0.2s ease;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.03);
}

.theme-dark .form-input {
  padding: 14px 16px;
  border-width: 1px;
  box-shadow: none;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.form-input::placeholder {
  color: var(--text-tertiary);
}

.form-input:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px var(--teal-glow), inset 0 1px 2px rgba(0, 0, 0, 0.02);
}

.theme-dark .form-input:focus {
  box-shadow: 0 0 0 3px var(--teal-glow), inset 0 0 8px rgba(0, 212, 255, 0.05);
}

.form-input--sm {
  padding: 9px 12px;
  font-size: 0.9rem;
}

.theme-dark .form-input--sm {
  padding: 10px 12px;
}

textarea.form-input {
  resize: vertical;
  min-height: 80px;
  line-height: 1.5;
}

select.form-input {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%2364748b' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 40px;
}

.theme-dark select.form-input {
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='rgba(255,255,255,0.5)' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

/* =============================================
   TOGGLE SWITCH
   ============================================= */
.toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  user-select: none;
}

.toggle__input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle__track {
  position: relative;
  width: 50px;
  height: 28px;
  background: var(--bg-inset);
  border: 1.5px solid var(--border-light);
  border-radius: 14px;
  transition: all 0.3s var(--ease-out-expo);
  flex-shrink: 0;
}

.theme-dark .toggle__track {
  width: 52px;
  border-width: 1px;
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.1);
}

.toggle__thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  background: var(--bg-surface);
  border-radius: 50%;
  transition: all 0.3s var(--ease-spring);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

.theme-dark .toggle__thumb {
  background: rgba(255, 255, 255, 0.5);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.toggle__input:checked + .toggle__track {
  background: var(--green-light);
  border-color: var(--green);
}

.theme-dark .toggle__input:checked + .toggle__track {
  background: var(--green-light);
  border-color: var(--green);
}

.toggle__input:checked + .toggle__track .toggle__thumb {
  transform: translateX(22px);
  background: var(--green);
  box-shadow: 0 1px 4px rgba(5, 150, 105, 0.3);
}

.theme-dark .toggle__input:checked + .toggle__track .toggle__thumb {
  transform: translateX(24px);
  box-shadow: 0 0 8px rgba(0, 230, 118, 0.4);
}

.toggle__label {
  font-size: 0.95rem;
  color: var(--text-primary);
}

/* Fail state toggle */
.toggle__input.toggle--fail:checked + .toggle__track {
  background: var(--rust-light);
  border-color: var(--rust);
}

.toggle__input.toggle--fail:checked + .toggle__track .toggle__thumb {
  background: var(--rust);
  box-shadow: 0 1px 4px rgba(190, 18, 60, 0.3);
}

.theme-dark .toggle__input.toggle--fail:checked + .toggle__track .toggle__thumb {
  box-shadow: 0 0 8px rgba(255, 71, 87, 0.4);
}

/* =============================================
   BOTTOM NAVIGATION
   ============================================= */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 200;
  height: var(--nav-height);
  padding-bottom: var(--safe-bottom);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding-left: 8px;
  padding-right: 8px;
  box-shadow: 0 -2px 12px rgba(15, 23, 42, 0.04);
}

.theme-dark .bottom-nav {
  background: rgba(6, 11, 24, 0.85);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  box-shadow: none;
}

.bottom-nav__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  position: relative;
}

.bottom-nav__item svg {
  width: 22px;
  height: 22px;
  stroke: var(--text-tertiary);
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: all 0.2s ease;
}

.bottom-nav__label {
  font-family: var(--font-display);
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--text-tertiary);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  transition: color 0.2s ease;
}

.theme-dark .bottom-nav__label {
  font-weight: 500;
}

.bottom-nav__item--active svg {
  stroke: var(--teal);
}

.bottom-nav__item--active .bottom-nav__label {
  color: var(--teal);
}

/* Active indicator bar */
.bottom-nav__item--active::before {
  content: '';
  position: absolute;
  top: -1px;
  left: 50%;
  transform: translateX(-50%);
  width: 24px;
  height: 3px;
  background: var(--teal);
  border-radius: 2px;
}

.theme-dark .bottom-nav__item--active::before {
  width: 20px;
  height: 2px;
  border-radius: 1px;
  box-shadow: 0 0 8px var(--teal);
}

/* =============================================
   PROGRESS BAR
   ============================================= */
.progress {
  width: 100%;
  height: 7px;
  background: var(--bg-inset);
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid var(--border-light);
}

.theme-dark .progress {
  height: 6px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.06);
  border: none;
}

.progress__fill {
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--teal), var(--green));
  transition: width 0.6s var(--ease-out-expo);
}

.theme-dark .progress__fill {
  box-shadow: 0 0 8px rgba(0, 212, 255, 0.3);
}

/* =============================================
   STAT BOX
   ============================================= */
.stat-box {
  text-align: center;
  padding: 12px;
}

.stat-box__value {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.8rem;
  letter-spacing: -0.02em;
  line-height: 1.1;
  color: var(--text-primary);
}

.stat-box__label {
  font-size: 0.72rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 4px;
  font-family: var(--font-display);
  font-weight: 600;
}

.theme-dark .stat-box__label {
  font-weight: 500;
}

/* =============================================
   DIVIDER
   ============================================= */
.divider {
  height: 1px;
  background: var(--border-light);
  margin: 16px 0;
}

/* =============================================
   SECTION TITLE
   ============================================= */
.section-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-tertiary);
  margin-bottom: 12px;
  padding-left: 2px;
}

.theme-dark .section-title {
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  color: var(--text-secondary);
}

/* =============================================
   STAGGER ANIMATIONS
   ============================================= */
.stagger-in > * {
  opacity: 0;
  transform: translateY(14px);
  animation: staggerFadeIn 0.5s var(--ease-out-expo) forwards;
}

.theme-dark .stagger-in > * {
  transform: translateY(16px);
}

.stagger-in > *:nth-child(1) { animation-delay: 0.04s; }
.stagger-in > *:nth-child(2) { animation-delay: 0.08s; }
.stagger-in > *:nth-child(3) { animation-delay: 0.12s; }
.stagger-in > *:nth-child(4) { animation-delay: 0.16s; }
.stagger-in > *:nth-child(5) { animation-delay: 0.2s; }
.stagger-in > *:nth-child(6) { animation-delay: 0.24s; }
.stagger-in > *:nth-child(7) { animation-delay: 0.28s; }
.stagger-in > *:nth-child(8) { animation-delay: 0.32s; }
.stagger-in > *:nth-child(9) { animation-delay: 0.36s; }
.stagger-in > *:nth-child(10) { animation-delay: 0.4s; }

@keyframes staggerFadeIn {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fade-in {
  animation: fadeIn 0.6s var(--ease-out-expo);
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* =============================================
   TEXT & COLOR UTILITIES
   ============================================= */
.text-teal { color: var(--teal); }
.text-green { color: var(--green); }
.text-amber { color: var(--amber); }
.text-rust { color: var(--rust); }
.text-cyan { color: var(--teal); }
.text-emerald { color: var(--green); }
.text-coral { color: var(--rust); }
.text-secondary { color: var(--text-secondary); }
.text-sm { font-size: 0.85rem; }
.text-xs { font-size: 0.75rem; }
.text-center { text-align: center; }
.text-right { text-align: right; }

/* =============================================
   LAYOUT UTILITIES
   ============================================= */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.gap-20 { gap: 20px; }
.w-full { width: 100%; }
.font-display { font-family: var(--font-display); }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-20 { margin-top: 20px; }
.mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.mb-20 { margin-bottom: 20px; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }

/* =============================================
   SCROLLBAR
   ============================================= */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(15, 23, 42, 0.08); border-radius: 2px; }

.theme-dark ::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.1); }

/* =============================================
   DATA TABLE
   ============================================= */
.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

.data-table th {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-tertiary);
  padding: 8px 10px;
  text-align: left;
  border-bottom: 1.5px solid var(--border-light);
}

.theme-dark .data-table th {
  font-weight: 600;
  font-size: 0.72rem;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  border-bottom-width: 1px;
}

.data-table td {
  padding: 10px;
  font-size: 0.9rem;
  border-bottom: 1px solid var(--border-light);
  vertical-align: middle;
}

.theme-dark .data-table td {
  border-bottom-color: rgba(255, 255, 255, 0.03);
}

.data-table .form-input--sm {
  padding: 8px 10px;
  font-size: 0.85rem;
}

/* =============================================
   TOAST NOTIFICATIONS
   ============================================= */
.toast {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%) translateY(-100px);
  z-index: 9999;
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.85rem;
  line-height: 1.3;
  max-width: calc(100vw - 40px);
  text-align: center;
  pointer-events: none;
  opacity: 0;
  transition: transform 0.3s ease, opacity 0.3s ease;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.toast--visible {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* Success toast */
.theme-light .toast--success {
  background: var(--green-light);
  color: var(--green);
  border: 1.5px solid var(--green-mid);
}

.theme-dark .toast--success {
  background: rgba(5, 150, 105, 0.2);
  color: #6ee7b7;
  border: 1.5px solid rgba(5, 150, 105, 0.4);
}

/* Error toast */
.theme-light .toast--error {
  background: var(--rust-light);
  color: var(--rust);
  border: 1.5px solid var(--rust-mid);
}

.theme-dark .toast--error {
  background: var(--rust-light);
  color: var(--rust);
  border: 1.5px solid rgba(255, 71, 87, 0.4);
}

/* Info toast */
.theme-light .toast--info {
  background: var(--teal-light);
  color: var(--teal);
  border: 1.5px solid var(--teal-mid);
}

.theme-dark .toast--info {
  background: var(--teal-light);
  color: var(--teal);
  border: 1.5px solid rgba(0, 212, 255, 0.4);
}

/* Safe area offset for notched devices */
@supports (padding-top: env(safe-area-inset-top)) {
  .toast {
    top: calc(16px + env(safe-area-inset-top, 0px));
  }
}
