/**
 * AquaMatrix Lab - Production Design System & Compiled Laboratory Stylesheet
 * 100/100 Core Web Vitals • CLS = 0.00 Ad Shields • Benchtop Print Engine
 */

:root,
[data-theme="dark"] {
  color-scheme: dark;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;

  /* Palette: Laboratory Dark / Emerald / Cyan */
  --bg-app: #080d1a;
  --bg-surface: #0f172a;
  --bg-surface-elevated: #1e293b;
  --bg-surface-subtle: #162032;
  --bg-card: #0f172a;

  --border-subtle: #243247;
  --border-medium: #334155;
  --border-glow: rgba(6, 182, 212, 0.35);

  --text-main: #f8fafc;
  --text-muted: #cbd5e1;
  --text-subtle: #94a3b8;

  --accent-cyan: #22d3ee;
  --accent-cyan-hover: #06b6d4;
  --accent-cyan-light: #67e8f9;
  --accent-cyan-glow: rgba(34, 211, 238, 0.15);

  --accent-emerald: #10b981;
  --accent-emerald-hover: #059669;
  --accent-emerald-glow: rgba(16, 185, 129, 0.15);

  --accent-amber: #f59e0b;
  --accent-rose: #f43f5e;
  --accent-purple: #8b5cf6;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;

  --shadow-card: 0 4px 20px -2px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.05);
  --shadow-glow: 0 0 25px -5px rgba(6, 182, 212, 0.25);
  --shadow-emerald: 0 0 25px -5px rgba(16, 185, 129, 0.25);

  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s ease;
}

/* Light Mode Overrides if toggled */
[data-theme="light"] {
  color-scheme: light;
  --bg-app: #f8fafc;
  --bg-surface: #ffffff;
  --bg-surface-elevated: #f1f5f9;
  --bg-surface-subtle: #e2e8f0;
  --bg-card: #ffffff;
  --border-subtle: #e2e8f0;
  --border-medium: #cbd5e1;
  --border-glow: rgba(6, 182, 212, 0.35);
  --text-main: #0f172a;
  --text-muted: #475569;
  --text-subtle: #64748b;
}

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

html {
  font-family: var(--font-sans);
  background-color: #080d1a;
  background-color: var(--bg-app);
  color: #f8fafc;
  color: var(--text-main);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
  text-rendering: optimizeLegibility;
  max-width: 100%;
  overflow-x: hidden;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-color: #080d1a;
  background-color: var(--bg-app);
  color: #f8fafc;
  color: var(--text-main);
  max-width: 100%;
  overflow-x: hidden;
  position: relative;
  background-image:
    radial-gradient(at 15% 15%, rgba(6, 182, 212, 0.06) 0px, transparent 50%),
    radial-gradient(at 85% 85%, rgba(16, 185, 129, 0.05) 0px, transparent 50%);
  background-attachment: fixed;
}

/* Accessible High-Contrast Link Styles */
.card h3 a,
.category-card h3 a {
  color: #f8fafc;
  color: var(--text-main);
  transition: color var(--transition-fast);
}

.card h3 a:hover,
.category-card h3 a:hover {
  color: #22d3ee;
  color: var(--accent-cyan);
}

.site-footer,
.site-footer p,
.site-footer div,
.site-footer li,
.site-footer span {
  color: #cbd5e1;
}

.site-footer strong {
  color: #f8fafc;
}

.site-footer a {
  color: #38bdf8;
  transition: color var(--transition-fast);
}

.site-footer a:hover {
  color: #22d3ee;
}

/* Typography */
h1,
h2,
h3,
h4,
h5,
h6 {
  color: var(--text-main);
  line-height: 1.25;
  font-weight: 700;
  letter-spacing: -0.02em;
}

h1 {
  font-size: clamp(1.85rem, 3.5vw, 2.75rem);
}

h2 {
  font-size: clamp(1.4rem, 2.5vw, 1.85rem);
}

h3 {
  font-size: clamp(1.15rem, 1.8vw, 1.35rem);
}

p {
  margin-bottom: 1rem;
  color: var(--text-muted);
}

p:last-child {
  margin-bottom: 0;
}

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

a:hover {
  color: var(--accent-cyan-light);
}

/* Container */
.container {
  width: 100%;
  max-width: 1240px;
  margin-left: auto;
  margin-right: auto;
  padding-left: 1.25rem;
  padding-right: 1.25rem;
}

/* Layout Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background-color: rgba(8, 13, 26, 0.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-subtle);
  padding: 0.85rem 0;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.03em;
}

.brand-logo svg {
  color: var(--accent-cyan);
  filter: drop-shadow(0 0 8px rgba(6, 182, 212, 0.5));
}

.brand-logo span.badge {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-full);
  background: var(--accent-cyan-glow);
  color: var(--accent-cyan);
  border: 1px solid var(--border-glow);
  letter-spacing: 0.05em;
}

/* Navigation Links */
.nav-menu {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  list-style: none;
}

.nav-link {
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 500;
  padding: 0.35rem 0.65rem;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}

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

/* Header Action Controls */
.header-actions {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

/* Dual-Unit Switcher Pill */
.unit-toggle-pill {
  display: inline-flex;
  align-items: center;
  background-color: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  padding: 3px;
  position: relative;
  user-select: none;
}

.unit-toggle-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.unit-toggle-btn.active {
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-emerald));
  color: #04101c;
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(6, 182, 212, 0.4);
}

/* Language Selector Dropdown */
.lang-selector-wrap {
  position: relative;
}

.lang-selector-btn {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  background-color: var(--bg-surface-elevated);
  border: 1px solid var(--border-medium);
  color: var(--text-main);
  padding: 0.35rem 0.65rem;
  border-radius: var(--radius-md);
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.lang-selector-btn:hover {
  border-color: var(--accent-cyan);
}

.lang-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.6);
  min-width: 140px;
  display: none;
  flex-direction: column;
  z-index: 1000;
  overflow: hidden;
}

.lang-dropdown.open {
  display: flex;
}

.lang-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 0.85rem;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.82rem;
  font-weight: 600;
  transition: all var(--transition-fast);
}

.lang-item:hover,
.lang-item.active {
  background: rgba(6, 182, 212, 0.12);
  color: var(--accent-cyan);
}

/* Dialect & Ultra-Local Region Selector inside Language Dropdown */
.lang-dropdown-divider {
  border-top: 1px solid var(--border-subtle);
  padding: 0.45rem 0.75rem 0.25rem;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent-cyan);
}

.lang-region-btn {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  padding: 0.45rem 0.85rem;
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.lang-region-btn:hover,
.lang-region-btn.active {
  background: rgba(6, 182, 212, 0.14);
  color: var(--accent-cyan);
}

.lang-dropdown {
  min-width: 215px;
}

.m3-helper-badge {
  display: inline-block;
  margin-left: 0.35rem;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  background: rgba(6, 182, 212, 0.12);
  color: var(--accent-cyan);
  border: 1px solid rgba(6, 182, 212, 0.25);
  vertical-align: middle;
}

.quick-pool-hub-card {
  margin-bottom: 2rem;
  background: linear-gradient(145deg, rgba(15, 23, 42, 0.96), rgba(30, 41, 59, 0.7));
  border: 1px solid var(--border-glow);
  box-shadow: var(--shadow-card), var(--shadow-glow);
}

[data-theme="light"] .quick-pool-hub-card {
  background: linear-gradient(145deg, #ffffff, #f1f5f9);
}

.pool-size-pills,
.sanitizer-toggle-row {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.btn-preset.btn-sanitizer.active {
  background: rgba(16, 185, 129, 0.22);
  border-color: var(--accent-emerald);
  color: var(--accent-emerald);
}

/* Preset Scenarios Quick Bar */
.preset-scenarios-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
  padding: 0.6rem 0.85rem;
  background: rgba(15, 23, 42, 0.65);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
}

.preset-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--accent-cyan);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-right: 0.25rem;
}

.btn-preset {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-medium);
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.28rem 0.65rem;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-preset:hover,
.btn-preset.active {
  border-color: var(--accent-cyan);
  color: #fff;
  background: rgba(6, 182, 212, 0.2);
}

/* Search Trigger Button */
.btn-search-trigger {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background-color: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  padding: 0.45rem 0.85rem;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-search-trigger:hover {
  border-color: var(--accent-cyan);
  color: var(--text-main);
}

.btn-search-trigger kbd {
  background: var(--bg-surface);
  border: 1px solid var(--border-medium);
  border-radius: 4px;
  padding: 0.1rem 0.4rem;
  font-size: 0.7rem;
  font-family: var(--font-mono);
}

/* Cards & Surfaces */
.card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-card);
  position: relative;
}

.card-glow {
  border-color: var(--border-glow);
  box-shadow: var(--shadow-card), var(--shadow-glow);
}

/* Anti-CLS Ad Slots Shields & AdSense Publisher Policy Moat */
.ad-slot-wrapper {
  position: relative;
  min-height: 280px;
  width: 100%;
  margin: 2.25rem 0;
  background-color: rgba(9, 14, 24, 0.7);
  border: 1px dashed var(--border-subtle);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  contain: layout style paint;
  overflow: hidden;
  text-align: center;
  box-sizing: border-box;
}

.ad-slot-wrapper.ad-banner {
  min-height: 90px;
  margin: 1.25rem 0;
}

@media (max-width: 768px) {
  .ad-slot-wrapper.ad-banner {
    min-height: 52px;
    margin: 0.75rem 0;
  }
}

.ad-slot-wrapper.ad-inline {
  min-height: 280px;
}

.ad-slot-wrapper.ad-deep-engagement {
  min-height: 280px;
  background: rgba(15, 23, 42, 0.5);
}

.ad-slot-wrapper.ad-halfpage {
  min-height: 600px;
  width: 300px;
  max-width: 100%;
  position: sticky;
  top: 5rem;
}

.ad-disclosure-bar {
  width: 100%;
  text-align: center;
  padding: 0.25rem 0.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.ad-disclosure-label {
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-subtle);
  opacity: 0.75;
}

.ad-unit-inner {
  width: 100%;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem;
}

.ad-placeholder-layout {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  padding: 0.75rem;
}

.ad-placeholder-title {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
}

.ad-placeholder-dims {
  font-size: 0.7rem;
  font-family: var(--font-mono);
  color: var(--text-subtle);
}

.ad-placeholder-badge {
  font-size: 0.65rem;
  color: var(--accent-cyan);
  background: rgba(6, 182, 212, 0.08);
  border: 1px solid rgba(6, 182, 212, 0.2);
  border-radius: 4px;
  padding: 0.1rem 0.45rem;
  margin-top: 0.2rem;
}

/* Category Grid Native In-Feed Ad Card */
.category-card.category-card-ad {
  min-height: 240px;
  background: rgba(15, 23, 42, 0.55);
  border: 1px dashed rgba(6, 182, 212, 0.3);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  margin: 0;
}

.category-card.category-card-ad:hover {
  transform: none;
  border-color: rgba(6, 182, 212, 0.5);
}

.category-card.category-card-ad .ad-badge {
  font-size: 0.65rem;
  letter-spacing: 0.08em;
  font-weight: 700;
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  align-self: flex-start;
}

/* AEO & GEO Answer Engine Direct Answer Snippet */
.aeo-summary-card {
  background: linear-gradient(135deg, rgba(6, 182, 212, 0.08), rgba(16, 185, 129, 0.05));
  border: 1px solid var(--border-glow);
  border-left: 4px solid var(--accent-cyan);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  margin-top: 1.25rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
}

.aeo-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--accent-cyan);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 0.45rem;
}

.aeo-text {
  font-size: 0.94rem;
  line-height: 1.6;
  color: var(--text-main);
  margin: 0;
}

.aeo-text strong {
  color: #ffffff;
}

.aeo-text em {
  display: block;
  font-style: normal;
  font-size: 0.84rem;
  color: var(--accent-emerald);
  margin-top: 0.45rem;
}

/* Calculator Grid Layout */
.calculator-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
  margin: 2rem 0;
}

@media (min-width: 992px) {
  .calculator-layout {
    grid-template-columns: 1.15fr 0.85fr;
  }
}

/* Form & Slider Controls */
.form-group {
  margin-bottom: 1.5rem;
}

.form-label-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 0.5rem;
}

.form-label {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-main);
}

.form-val-display {
  font-family: var(--font-mono);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--accent-cyan);
}

.slider-container {
  position: relative;
  display: flex;
  align-items: center;
  gap: 1rem;
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 8px;
  border-radius: 4px;
  background: var(--bg-surface-elevated);
  outline: none;
  transition: background var(--transition-fast);
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--accent-cyan);
  cursor: pointer;
  box-shadow: 0 0 10px rgba(6, 182, 212, 0.6);
  border: 2px solid #ffffff;
  transition: transform var(--transition-fast);
}

input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.15);
}

input[type="number"],
select,
input[type="text"] {
  width: 100%;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  padding: 0.55rem 0.85rem;
  font-size: 0.95rem;
  font-family: inherit;
  outline: none;
  transition: border-color var(--transition-fast);
}

input[type="number"]:focus,
select:focus,
input[type="text"]:focus {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 0 2px var(--accent-cyan-glow);
}

/* Results & Metric Cards */
.results-card {
  background: linear-gradient(145deg, rgba(15, 23, 42, 0.95), rgba(6, 78, 59, 0.25));
  border: 1px solid var(--border-glow);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  box-shadow: var(--shadow-card), var(--shadow-emerald);
}

.primary-stat-box {
  background: rgba(8, 13, 26, 0.65);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  margin-bottom: 1.5rem;
  text-align: center;
}

.primary-stat-label {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.primary-stat-value {
  font-family: var(--font-mono);
  font-size: 2.75rem;
  font-weight: 800;
  color: var(--accent-emerald);
  line-height: 1.1;
  margin: 0.35rem 0;
  text-shadow: 0 0 20px rgba(16, 185, 129, 0.4);
}

.status-pill {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.status-pill.balanced {
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
  border: 1px solid #10b981;
}

.status-pill.warning {
  background: rgba(245, 158, 11, 0.2);
  color: #fbbf24;
  border: 1px solid #f59e0b;
}

.status-pill.danger {
  background: rgba(244, 63, 94, 0.2);
  color: #fb7185;
  border: 1px solid #f43f5e;
}

/* Chemical Dose Table */
.dose-table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.25rem 0;
  font-size: 0.88rem;
}

.dose-table th {
  text-align: left;
  padding: 0.6rem 0.75rem;
  color: var(--text-subtle);
  font-weight: 600;
  border-bottom: 1px solid var(--border-medium);
  font-size: 0.75rem;
  text-transform: uppercase;
}

.dose-table td {
  padding: 0.75rem;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-main);
}

.dose-table tr:last-child td {
  border-bottom: none;
}

.dose-amount {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--accent-cyan);
}

/* Chemical Sequencer & Wait-Time Timeline */
.sequencer-card {
  margin-top: 1.5rem;
  padding: 1.25rem;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
}

.timeline-list {
  list-style: none;
  padding: 0;
  margin: 1rem 0 0;
  position: relative;
}

.timeline-item {
  position: relative;
  padding-left: 2.25rem;
  margin-bottom: 1.25rem;
}

.timeline-item:last-child {
  margin-bottom: 0;
}

.timeline-item::before {
  content: "";
  position: absolute;
  left: 0.65rem;
  top: 1.5rem;
  bottom: -0.75rem;
  width: 2px;
  background: var(--border-medium);
}

.timeline-item:last-child::before {
  display: none;
}

.timeline-bullet {
  position: absolute;
  left: 0;
  top: 0.15rem;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  background: var(--bg-card);
  border: 2px solid var(--accent-cyan);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--accent-cyan);
}

.timeline-time {
  font-size: 0.75rem;
  font-family: var(--font-mono);
  color: var(--accent-cyan);
  font-weight: 700;
  text-transform: uppercase;
}

.timeline-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main);
  margin: 0.15rem 0 0.25rem;
}

.timeline-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.wait-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.35);
  color: #f59e0b;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  margin-top: 0.35rem;
}

/* Generic vs Brand Name Arbitrage Card */
.arbitrage-card {
  margin-top: 1.5rem;
  padding: 1.25rem;
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.05) 0%, rgba(15, 23, 42, 0.6) 100%);
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: var(--radius-md);
}

.arbitrage-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.65rem 0;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 0.88rem;
}

.arbitrage-row:last-child {
  border-bottom: none;
}

.badge-savings {
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.4);
  font-weight: 700;
  font-size: 0.78rem;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
}

/* Action Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-weight: 600;
  font-size: 0.9rem;
  padding: 0.65rem 1.25rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  border: none;
  transition: all var(--transition-fast);
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-emerald));
  color: #04101c;
  box-shadow: 0 2px 12px rgba(6, 182, 212, 0.35);
}

.btn-primary:hover {
  box-shadow: 0 4px 18px rgba(6, 182, 212, 0.5);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-medium);
  color: var(--text-main);
}

.btn-secondary:hover {
  border-color: var(--accent-cyan);
  background: var(--bg-surface-subtle);
}

/* Toast Notification */
.toast-container {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-glow);
  color: var(--text-main);
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card), var(--shadow-glow);
  font-size: 0.88rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  animation: toastIn 0.25s ease-out;
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }

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

/* Institutional E-E-A-T Card (Curator Sabana Sarmin) */
.curator-card {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  background: linear-gradient(145deg, #0d1527, #0b1e1d);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  margin: 3rem 0;
}

@media (min-width: 640px) {
  .curator-card {
    flex-direction: row;
    align-items: center;
  }
}

.curator-avatar-wrap {
  position: relative;
  width: 76px;
  height: 76px;
  flex-shrink: 0;
}

.curator-avatar {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: linear-gradient(135deg, #065f46, #0e7490);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.6rem;
  color: #ffffff;
  border: 2px solid var(--accent-emerald);
}

.curator-avatar-img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--accent-emerald);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.25);
  display: block;
}

.curator-verified-badge {
  position: absolute;
  bottom: -2px;
  right: -2px;
  background: #10b981;
  color: #000;
  border-radius: 50%;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 6px #10b981;
}

.curator-info h4 {
  font-size: 1.15rem;
  color: var(--text-main);
  margin-bottom: 0.2rem;
}

.curator-info .curator-role {
  font-size: 0.82rem;
  color: var(--accent-cyan);
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.curator-info p {
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.consensus-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.75rem;
}

.consensus-chip {
  background: rgba(6, 182, 212, 0.1);
  border: 1px solid rgba(6, 182, 212, 0.3);
  color: var(--accent-cyan);
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-sm);
}

/* Accordion (Mathematical Proof & Dissociation Formula) */
.accordion-item {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  margin-bottom: 0.75rem;
  overflow: hidden;
  background: var(--bg-surface);
}

.accordion-header {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.25rem;
  background: transparent;
  border: none;
  color: var(--text-main);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
}

.accordion-header:hover {
  background: var(--bg-surface-elevated);
}

.accordion-content {
  display: none;
  padding: 1.25rem;
  border-top: 1px solid var(--border-subtle);
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.6;
}

.accordion-content.open {
  display: block;
}

.formula-box {
  background: #060a14;
  border: 1px solid var(--border-glow);
  border-radius: var(--radius-sm);
  padding: 1rem;
  margin: 1rem 0;
  font-family: var(--font-mono);
  font-size: 0.88rem;
  color: #38bdf8;
  overflow-x: auto;
}

/* Search Modal Overlay */
.search-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(6px);
  z-index: 2000;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: 5vh 1rem 1rem;
}

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

.search-dialog {
  width: 100%;
  max-width: 640px;
  background: var(--bg-surface);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-lg);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.75);
  overflow: hidden;
  animation: modalPop 0.2s ease-out;
}

@keyframes modalPop {
  from {
    opacity: 0;
    transform: scale(0.96);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

.search-input-wrap {
  display: flex;
  align-items: center;
  padding: 0.85rem 1.25rem;
  border-bottom: 1px solid var(--border-subtle);
}

.search-input-wrap input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-main);
  font-size: 1.1rem;
  outline: none;
  padding-left: 0.75rem;
}

.search-results-list {
  max-height: 60vh;
  overflow-y: auto;
  list-style: none;
  padding: 0.5rem;
}

.search-result-item {
  display: block;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  color: var(--text-main);
  transition: background var(--transition-fast);
}

.search-result-item:hover,
.search-result-item.highlighted {
  background: var(--bg-surface-elevated);
}

.search-result-title {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-main);
}

.search-result-category {
  font-size: 0.75rem;
  color: var(--accent-cyan);
  text-transform: uppercase;
  font-weight: 700;
}

/* Category Grid on Home */
.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
  margin: 2.5rem 0;
}

.category-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  transition: all var(--transition-normal);
  display: flex;
  flex-direction: column;
}

.category-card:hover {
  border-color: var(--accent-cyan);
  transform: translateY(-3px);
  box-shadow: var(--shadow-glow);
}

.category-card-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  background: var(--accent-cyan-glow);
  color: var(--accent-cyan);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1rem;
}

/* Cookie Consent Banner */
.cookie-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(15, 23, 42, 0.97);
  border-top: 1px solid var(--border-medium);
  padding: 1rem 1.5rem;
  z-index: 1500;
  display: none;
  backdrop-filter: blur(8px);
}

.cookie-banner.show {
  display: block;
}

.cookie-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  align-items: flex-start;
}

@media (min-width: 768px) {
  .cookie-inner {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}

/* Dual Input Slider Number Sync Input */
.slider-num-sync {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--accent-cyan);
  font-family: var(--font-mono);
  font-size: 0.88rem;
  font-weight: 700;
  padding: 0.15rem 0.4rem;
  width: 5.5rem;
  text-align: right;
  transition: all var(--transition-fast);
}

.slider-num-sync:focus {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 0 2px var(--accent-cyan-glow);
  outline: none;
}

.slider-num-sync::-webkit-inner-spin-button,
.slider-num-sync::-webkit-outer-spin-button {
  opacity: 0.4;
}

/* Theme Toggle Button */
.btn-theme-toggle {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  width: 34px;
  height: 34px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
  padding: 0;
}

.btn-theme-toggle:hover {
  color: var(--text-main);
  border-color: var(--accent-cyan);
  background: var(--bg-surface-subtle);
}

/* Mobile Navigation Hamburger */
.btn-mobile-nav-toggle {
  display: none;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  padding: 0.35rem 0.5rem;
  cursor: pointer;
  align-items: center;
  justify-content: center;
}

@media (max-width: 850px) {
  .btn-mobile-nav-toggle {
    display: flex;
  }

  .site-header .header-inner {
    flex-wrap: wrap;
    row-gap: 0.5rem;
  }

  .header-actions {
    gap: 0.4rem;
    margin-left: auto;
  }

  .nav-menu {
    display: none;
    width: 100%;
    order: 3;
    flex-direction: column;
    align-items: stretch;
    padding: 0.75rem 0;
    margin-top: 0.5rem;
    border-top: 1px solid var(--border-subtle);
    gap: 0.35rem;
  }

  .nav-menu.is-open {
    display: flex;
  }

  .nav-link {
    display: block;
    padding: 0.6rem 0.85rem;
    font-size: 0.95rem;
    border-radius: var(--radius-sm);
  }

  .unit-toggle-pill {
    padding: 2px;
  }

  .unit-toggle-btn {
    padding: 0.25rem 0.45rem;
    font-size: 0.72rem;
  }

  .btn-search-trigger {
    padding: 0.35rem 0.5rem;
  }

  .btn-search-trigger kbd {
    display: none;
  }
}

@media (max-width: 520px) {
  .site-header .header-inner {
    gap: 0.35rem;
  }

  .header-actions {
    gap: 0.3rem;
  }

  .btn-search-trigger span {
    display: none;
  }

  .site-brand span {
    font-size: 1.05rem;
  }

  .unit-toggle-btn {
    padding: 0.2rem 0.35rem;
    font-size: 0.68rem;
  }

  .lang-selector-btn {
    padding: 0.3rem 0.45rem;
    font-size: 0.75rem;
  }

  .calc-jump-nav {
    display: none;
  }

  .ad-slot-wrapper.ad-banner {
    min-height: 52px;
    margin: 0.5rem 0;
  }
}

/* SEO Anchor Jump Navigation Bar */
.calc-jump-nav {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem 0.75rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.65rem 1rem;
  margin-bottom: 1.5rem;
  font-size: 0.82rem;
}

.calc-jump-nav span {
  color: var(--text-subtle);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
}

.calc-jump-nav a {
  color: var(--accent-cyan);
  text-decoration: none;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm);
  background: rgba(6, 182, 212, 0.08);
  transition: all 0.15s ease;
}

.calc-jump-nav a:hover {
  background: rgba(6, 182, 212, 0.18);
  text-decoration: underline;
}

/* High-Authority Reference Data Tables */
.ref-data-table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
  font-size: 0.88rem;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.ref-data-table th {
  background: var(--bg-surface);
  text-align: left;
  padding: 0.75rem 1rem;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-muted);
  border-bottom: 2px solid var(--border-medium);
}

.ref-data-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-main);
  vertical-align: middle;
}

.ref-data-table tr:last-child td {
  border-bottom: none;
}

.ref-data-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

/* Embed Iframe Mode (Organic Backlink Generation Engine) */
body.is-embed {
  background: transparent !important;
  padding: 0 !important;
  margin: 0 !important;
}

body.is-embed .site-header,
body.is-embed .site-footer,
body.is-embed .ad-slot-wrapper,
body.is-embed .calc-jump-nav,
body.is-embed #formula-math,
body.is-embed #reference-tables,
body.is-embed #worked-example,
body.is-embed #step-by-step,
body.is-embed #safety-ppe,
body.is-embed .curator-card,
body.is-embed #faqs,
body.is-embed .cookie-banner,
body.is-embed .no-print {
  display: none !important;
}

body.is-embed main.container {
  padding: 0.5rem !important;
  max-width: 100% !important;
}

body.is-embed .calculator-layout {
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

@media (max-width: 768px) {
  body.is-embed .calculator-layout {
    grid-template-columns: 1fr;
  }
}

/* ==========================================================================
   MOBILE STICKY CALCULATION HUD (Zero-CLS Mobile UX Anchor)
   ========================================================================== */
.mobile-sticky-hud {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 45;
  background: rgba(15, 23, 42, 0.94);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid rgba(56, 189, 248, 0.28);
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.45);
  transform: translateY(0);
  opacity: 1;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.25s ease;
  will-change: transform, opacity;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

.mobile-sticky-hud.hud-hidden {
  transform: translateY(105%);
  opacity: 0;
  pointer-events: none;
}

.mobile-sticky-hud .hud-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0.6rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.mobile-sticky-hud .hud-metric {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

.mobile-sticky-hud .hud-label {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted, #94a3b8);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 220px;
}

.mobile-sticky-hud .hud-value-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  min-width: 0;
}

.mobile-sticky-hud .hud-value {
  font-family: var(--font-mono, monospace);
  font-size: 1.15rem;
  font-weight: 700;
  color: #38bdf8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mobile-sticky-hud .hud-pill {
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 0.12rem 0.45rem;
  border-radius: 9999px;
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.35);
  white-space: nowrap;
  letter-spacing: 0.02em;
}

.mobile-sticky-hud .hud-pill.warning {
  background: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
  border-color: rgba(245, 158, 11, 0.35);
}

.mobile-sticky-hud .hud-pill.danger {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
  border-color: rgba(239, 68, 68, 0.35);
}

.mobile-sticky-hud .hud-btn {
  padding: 0.45rem 0.85rem;
  font-size: 0.8rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  white-space: nowrap;
  border-radius: var(--radius-sm, 6px);
  background: linear-gradient(135deg, #0284c7, #0369a1);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(2, 132, 199, 0.4);
  flex-shrink: 0;
  min-height: 40px;
}

.mobile-sticky-hud .hud-btn svg {
  transition: transform 0.2s ease;
}

.mobile-sticky-hud .hud-btn:hover svg {
  transform: translateY(2px);
}

@media (min-width: 992px) {
  .mobile-sticky-hud {
    display: none !important;
  }
}

/* Mobile Ergonomics & Whitespace Tightening */
@media (max-width: 768px) {
  .calculator-layout {
    gap: 1.25rem;
    margin: 1rem 0;
  }

  .form-group {
    margin-bottom: 1rem;
  }

  .form-label-row {
    margin-bottom: 0.35rem;
  }

  .tool-actions-bar {
    gap: 0.35rem;
  }

  .tool-actions-bar .btn {
    padding: 0.35rem 0.6rem;
    font-size: 0.78rem;
  }

  .aeo-summary-card {
    padding: 0.75rem 1rem;
    margin-top: 0.75rem;
  }
}

/* Benchtop Print Engine (@media print) */
@media print {
  body {
    background: #ffffff !important;
    color: #000000 !important;
    font-size: 11pt !important;
  }

  .site-header,
  .site-footer,
  .ad-slot-wrapper,
  .no-print,
  .search-modal-backdrop,
  .cookie-banner,
  .toast-container,
  .btn-search-trigger,
  .unit-toggle-pill,
  .btn-print-benchtop,
  .btn-copy-link {
    display: none !important;
  }

  .container {
    max-width: 100% !important;
    padding: 0 !important;
  }

  .card,
  .results-card,
  .curator-card {
    border: 1px solid #000000 !important;
    box-shadow: none !important;
    background: #ffffff !important;
    color: #000000 !important;
    padding: 1rem !important;
    margin-bottom: 1rem !important;
  }

  .primary-stat-value {
    color: #000000 !important;
    text-shadow: none !important;
  }

  .dose-table th,
  .dose-table td {
    color: #000000 !important;
    border-color: #666666 !important;
  }

  .benchtop-seal {
    display: block !important;
    border: 2px solid #000;
    padding: 0.5rem;
    margin-top: 1rem;
    text-align: center;
    font-weight: bold;
    font-size: 9pt;
  }

  a[href]:after {
    content: "" !important;
  }
}