:root {
  /* High-Voltage Engineering Color Palette */
  --electric-blue-50: #EFF6FF;
  --electric-blue-100: #DBEAFE;
  --electric-blue-200: #BFDBFE;
  --electric-blue-300: #93C5FD;
  --electric-blue-400: #60A5FA;
  --electric-blue-500: #3B82F6;
  --electric-blue-600: #2563EB;
  --electric-blue-700: #1D4ED8;
  --electric-blue-800: #1E40AF;
  --electric-blue-900: #1E3A8A;

  --amber-volt-50: #FFFBEB;
  --amber-volt-100: #FEF3C7;
  --amber-volt-200: #FDE68A;
  --amber-volt-300: #FCD34D;
  --amber-volt-400: #FBBF24;
  --amber-volt-500: #F59E0B;
  --amber-volt-600: #D97706;
  --amber-volt-700: #B45309;

  --emerald-safe: #10B981;
  --emerald-glow: rgba(16, 185, 129, 0.25);
  --rose-danger: #EF4444;
  --rose-glow: rgba(239, 68, 68, 0.25);

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-display: 'Outfit', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Courier New', monospace;

  --radius-xs: 4px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-pill: 9999px;

  --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-smooth: 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Dark Theme (Default: Obsidian Grid Shield) */
[data-theme="dark"] {
  --bg-canvas: #060911;
  --bg-surface: #0C1222;
  --bg-surface-elevated: #131E35;
  --bg-surface-hover: #1B2A4A;
  --bg-glass: rgba(12, 18, 34, 0.88);

  --border-subtle: rgba(96, 165, 250, 0.12);
  --border-medium: rgba(96, 165, 250, 0.24);
  --border-strong: rgba(96, 165, 250, 0.48);

  --text-primary: #F8FAFC;
  --text-secondary: #CBD5E1;
  --text-muted: #94A3B8;
  --text-dim: #64748B;

  --accent-primary: var(--electric-blue-500);
  --accent-secondary: var(--amber-volt-500);
  --accent-gradient: linear-gradient(135deg, #3B82F6 0%, #2563EB 50%, #1D4ED8 100%);
  --amber-gradient: linear-gradient(135deg, #F59E0B 0%, #D97706 50%, #B45309 100%);
  --brand-gradient: linear-gradient(135deg, #3B82F6 0%, #F59E0B 100%);

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.45);
  --shadow-md: 0 6px 22px rgba(0, 0, 0, 0.55);
  --shadow-lg: 0 14px 40px rgba(0, 0, 0, 0.7);
  --shadow-glow: 0 0 28px rgba(59, 130, 246, 0.22);
  --shadow-amber-glow: 0 0 24px rgba(245, 158, 11, 0.22);

  --grid-pattern: radial-gradient(rgba(59, 130, 246, 0.1) 1px, transparent 1px);
}

/* Light Theme (Precision Architectural Drafting Vellum) */
[data-theme="light"] {
  --bg-canvas: #F8FAFC;
  --bg-surface: #FFFFFF;
  --bg-surface-elevated: #F1F5F9;
  --bg-surface-hover: #E2E8F0;
  --bg-glass: rgba(255, 255, 255, 0.94);

  --border-subtle: rgba(15, 23, 42, 0.08);
  --border-medium: rgba(15, 23, 42, 0.16);
  --border-strong: rgba(37, 99, 235, 0.35);

  --text-primary: #0F172A;
  --text-secondary: #334155;
  --text-muted: #64748B;
  --text-dim: #94A3B8;

  --accent-primary: #1D4ED8;
  --accent-secondary: #B45309;
  --accent-gradient: linear-gradient(135deg, #2563EB 0%, #1D4ED8 100%);
  --amber-gradient: linear-gradient(135deg, #D97706 0%, #B45309 100%);
  --brand-gradient: linear-gradient(135deg, #2563EB 0%, #D97706 100%);

  --shadow-sm: 0 1px 4px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 4px 16px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 10px 30px rgba(15, 23, 42, 0.12);
  --shadow-glow: 0 0 20px rgba(37, 99, 235, 0.14);
  --shadow-amber-glow: 0 0 18px rgba(217, 119, 6, 0.14);

  --grid-pattern: radial-gradient(rgba(37, 99, 235, 0.08) 1px, transparent 1px);
}

/* Reset & Base */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  background-color: var(--bg-canvas);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-image: var(--grid-pattern);
  background-size: 28px 28px;
  position: relative;
  overflow-x: hidden;
}

/* Blueprint Glow Header Effect */
.glow-backdrop {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 1200px;
  height: 480px;
  background: radial-gradient(circle at 50% 0%, rgba(59, 130, 246, 0.18) 0%, rgba(245, 158, 11, 0.08) 45%, transparent 75%);
  pointer-events: none;
  z-index: 0;
}

/* Container */
.container {
  width: 100%;
  max-width: 1240px;
  margin-left: auto;
  margin-right: auto;
  padding-left: 20px;
  padding-right: 20px;
  position: relative;
  z-index: 1;
}

/* Typography Helpers */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 800;
  line-height: 1.2;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

p {
  color: var(--text-secondary);
}

a {
  color: var(--accent-primary);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--electric-blue-300);
}

/* Header & Navbar */
header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-subtle);
  transition: all var(--transition-normal);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 72px;
  flex-wrap: nowrap;
}

.brand-wrapper {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  flex-shrink: 0;
  min-width: 200px;
}

.brand-emblem {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: var(--accent-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.2);
  flex-shrink: 0;
}

.brand-title {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 900;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  white-space: nowrap;
}

.brand-title span {
  color: var(--amber-volt-500);
}

.brand-badge {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  white-space: nowrap;
}

.nav-menu {
  display: flex;
  align-items: center;
  gap: 2px;
  justify-content: center;
  flex: 1;
  flex-wrap: nowrap;
}

.nav-link {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  transition: all var(--transition-fast);
  padding: 6px 9px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
}

.nav-link:hover, .nav-link.active {
  color: var(--text-primary);
  background: var(--bg-surface-elevated);
}

.nav-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  flex-shrink: 0;
  min-width: 220px;
  margin-left: 18px;
  padding-left: 18px;
  border-left: 1px solid var(--border-subtle);
}

.btn-nav-cta {
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

@media (max-width: 1180px) {
  .brand-badge {
    display: none;
  }
  .brand-wrapper {
    min-width: auto;
  }
  .nav-actions {
    min-width: auto;
    margin-left: 10px;
    padding-left: 12px;
  }
  .nav-link {
    font-size: 12.5px;
    padding: 5px 6px;
  }
  .btn-nav-cta {
    padding: 7px 11px;
    font-size: 12px;
  }
}

@media (max-width: 920px) {
  .nav-menu {
    display: none;
  }
  .nav-actions {
    border-left: none;
    padding-left: 0;
    margin-left: auto;
  }
}

/* Theme Toggle Button */
.theme-switch-btn {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 16px;
  flex-shrink: 0;
  transition: all var(--transition-fast);
}

.theme-switch-btn:hover {
  background: var(--bg-surface-hover);
  border-color: var(--border-medium);
  transform: translateY(-1px);
}

/* Standard Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 700;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition-normal);
  text-decoration: none;
  line-height: 1;
}

.btn-primary {
  background: var(--accent-gradient);
  color: #FFFFFF;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(37, 99, 235, 0.5);
  color: #FFFFFF;
}

.btn-amber {
  background: var(--amber-gradient);
  color: #060911;
  font-weight: 800;
  box-shadow: 0 4px 14px rgba(245, 158, 11, 0.35);
}

.btn-amber:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(245, 158, 11, 0.5);
  color: #060911;
}

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

.btn-outline:hover {
  background: var(--bg-surface-elevated);
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}

/* Cards & Panels */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 24px;
  transition: all var(--transition-normal);
  position: relative;
  overflow: hidden;
}

.card-elevated {
  background: var(--bg-surface-elevated);
  border-color: var(--border-medium);
  box-shadow: var(--shadow-sm);
}

.card:hover {
  border-color: var(--border-strong);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

/* Pills & Badges */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-radius: var(--radius-pill);
  border: 1px solid transparent;
}

.pill-blue {
  background: rgba(59, 130, 246, 0.12);
  color: var(--electric-blue-400);
  border-color: rgba(59, 130, 246, 0.25);
}

.pill-amber {
  background: rgba(245, 158, 11, 0.12);
  color: var(--amber-volt-400);
  border-color: rgba(245, 158, 11, 0.25);
}

.pill-emerald {
  background: rgba(16, 185, 129, 0.12);
  color: var(--emerald-safe);
  border-color: rgba(16, 185, 129, 0.25);
}

.pill-rose {
  background: rgba(239, 68, 68, 0.12);
  color: var(--rose-danger);
  border-color: rgba(239, 68, 68, 0.25);
}

/* Interactive Calculator Rig */
.calculator-rig {
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-xl);
  padding: 32px;
  box-shadow: var(--shadow-lg), var(--shadow-glow);
  position: relative;
  overflow: hidden;
  margin-bottom: 48px;
}

.calculator-rig::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--electric-blue-500), var(--amber-volt-500));
}

.appliance-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
  margin: 20px 0;
}

.appliance-card {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px;
  cursor: pointer;
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: space-between;
  user-select: none;
}

.appliance-card:hover {
  border-color: var(--border-medium);
  background: var(--bg-surface-hover);
}

.appliance-card.selected {
  border-color: var(--amber-volt-500);
  background: rgba(245, 158, 11, 0.08);
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.15);
}

.appliance-icon {
  font-size: 22px;
  margin-right: 10px;
}

.appliance-info {
  flex: 1;
}

.appliance-name {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-primary);
}

.appliance-watts {
  font-size: 11.5px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.calc-results-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-top: 24px;
}

.calc-stat-box {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.calc-stat-label {
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.calc-stat-val {
  font-family: var(--font-mono);
  font-size: 26px;
  font-weight: 900;
  color: var(--text-primary);
  line-height: 1.1;
}

.calc-stat-val.highlight-blue {
  color: var(--electric-blue-400);
}

.calc-stat-val.highlight-amber {
  color: var(--amber-volt-400);
}

/* Callout Box */
.callout {
  border-radius: var(--radius-md);
  padding: 18px 20px;
  margin: 24px 0;
  border-left: 4px solid;
}

.callout-nec {
  background: rgba(245, 158, 11, 0.08);
  border-color: var(--amber-volt-500);
}

.callout-nec h4 {
  color: var(--amber-volt-400);
  font-size: 14.5px;
  margin-bottom: 6px;
}

.callout-safety {
  background: rgba(239, 68, 68, 0.08);
  border-color: var(--rose-danger);
}

.callout-safety h4 {
  color: var(--rose-danger);
  font-size: 14.5px;
  margin-bottom: 6px;
}

.callout-info {
  background: rgba(59, 130, 246, 0.08);
  border-color: var(--electric-blue-500);
}

.callout-info h4 {
  color: var(--electric-blue-400);
  font-size: 14.5px;
  margin-bottom: 6px;
}

/* Data Tables */
.data-table-wrap {
  width: 100%;
  overflow-x: auto;
  margin: 20px 0 28px 0;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
}

.data-table-modern {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
  background: var(--bg-surface);
}

.data-table-modern th {
  background: var(--bg-surface-elevated);
  color: var(--text-primary);
  font-weight: 700;
  text-align: left;
  padding: 12px 16px;
  border-bottom: 2px solid var(--border-medium);
  white-space: nowrap;
}

.data-table-modern td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-secondary);
}

.data-table-modern tr:hover td {
  background: var(--bg-surface-hover);
}

/* Author & Review Card */
.eeat-author-card {
  display: flex;
  align-items: center;
  gap: 18px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-lg);
  padding: 18px 22px;
  margin-bottom: 32px;
  box-shadow: var(--shadow-sm);
}

.eeat-author-avatar {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: var(--accent-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  flex-shrink: 0;
  border: 2px solid var(--amber-volt-400);
}

/* Lead Modal */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(6, 9, 17, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-backdrop.active {
  display: flex;
}

.modal-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-xl);
  max-width: 520px;
  width: 100%;
  padding: 32px;
  box-shadow: var(--shadow-lg), var(--shadow-amber-glow);
  position: relative;
  animation: modalPop 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalPop {
  from { transform: scale(0.94); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.form-group {
  margin-bottom: 16px;
}

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

.form-control {
  width: 100%;
  padding: 11px 14px;
  background: var(--bg-canvas);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 14px;
  transition: all var(--transition-fast);
}

.form-control:focus {
  outline: none;
  border-color: var(--electric-blue-400);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

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

/* Footer */
footer {
  margin-top: auto;
  background: var(--bg-surface);
  border-top: 1px solid var(--border-subtle);
  padding: 64px 0 36px 0;
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 36px;
  margin-bottom: 48px;
}

.footer-col h4 {
  font-size: 14.5px;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 16px;
  letter-spacing: 0.02em;
}

.footer-links {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.footer-links a {
  color: var(--text-muted);
  font-size: 13.5px;
  transition: color var(--transition-fast);
}

.footer-links a:hover {
  color: var(--accent-primary);
}

.footer-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--border-subtle);
  padding-top: 24px;
  font-size: 12.5px;
  color: var(--text-dim);
  flex-wrap: wrap;
  gap: 12px;
}

@media (max-width: 860px) {
  .footer-grid {
    grid-template-columns: 1fr 1fr;
  }
  .form-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 540px) {
  .footer-grid {
    grid-template-columns: 1fr;
  }
}
