/* ==========================================================================
   ROASPilotCalc — Oceanic Blue-Teal (#0284c7) & Emerald Profit (#10b981)
   Standalone High-Contrast Ecommerce Paid Ads Dashboard Stylesheet
   Zero External Dependencies • Responsive Mobile & Desktop • Print Ready
   ========================================================================== */

:root {
  /* Core Brand Palette */
  --bg-page: #f1f5f9;
  --bg-surface: #ffffff;
  --bg-subtle: #f8fafc;
  --bg-muted: #e2e8f0;

  --primary: #0284c7;
  --primary-hover: #0369a1;
  --primary-dark: #075985;
  --primary-soft: #e0f2fe;
  --primary-border: #bae6fd;

  --teal-accent: #0d9488;
  --emerald: #10b981;
  --emerald-dark: #047857;
  --emerald-soft: #d1fae5;
  --emerald-border: #6ee7b7;

  --amber: #d97706;
  --amber-dark: #b45309;
  --amber-soft: #fef3c7;
  --amber-border: #fcd34d;

  --rose: #e11d48;
  --rose-dark: #be123c;
  --rose-soft: #ffe4e6;
  --rose-border: #fda4af;

  --text-main: #0f172a;
  --text-secondary: #334155;
  --text-muted: #64748b;
  --border-color: #cbd5e1;
  --border-light: #e2e8f0;

  --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow-sm: 0 2px 6px -1px rgba(15, 23, 42, 0.07), 0 1px 3px -1px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 10px 25px -5px rgba(15, 23, 42, 0.08), 0 4px 10px -3px rgba(15, 23, 42, 0.04);
  --shadow-focus: 0 0 0 3px rgba(2, 132, 199, 0.22);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-pill: 9999px;

  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  --container-max: 1220px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  color: var(--text-main);
  background-color: var(--bg-page);
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: color 0.15s ease;
}

a:hover {
  color: var(--primary-hover);
}

img,
svg {
  vertical-align: middle;
}

.container {
  width: 100%;
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 20px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ==========================================================================
   SwiftKitHub Global Top Bar & Internal Linking Mesh
   ========================================================================== */
.skh-topbar {
  background: #0f172a;
  color: #cbd5e1;
  font-size: 0.81rem;
  border-bottom: 1px solid rgba(148, 163, 184, 0.2);
}

.skh-topbar-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  min-height: 38px;
  padding-top: 6px;
  padding-bottom: 6px;
}

.skh-breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  line-height: 1.4;
}

.skh-breadcrumb a {
  color: #e2e8f0;
  font-weight: 600;
}

.skh-breadcrumb a:hover {
  color: #38bdf8;
  text-decoration: underline;
}

.skh-breadcrumb span {
  color: #94a3b8;
  font-weight: 500;
}

.skh-sep {
  color: #64748b;
  user-select: none;
}

.skh-all-link {
  color: #38bdf8;
  font-weight: 700;
  white-space: nowrap;
}

.skh-all-link:hover {
  color: #7dd3fc;
  text-decoration: underline;
}

.related-calculators-section {
  margin-top: 32px;
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 30px 34px;
  box-shadow: var(--shadow-sm);
}

.related-calculators-section h2 {
  margin: 0 0 6px;
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-main);
}

.related-calculators-section > p {
  margin: 0 0 20px;
  font-size: 0.92rem;
  color: var(--text-secondary);
}

.related-subheading {
  margin: 20px 0 12px;
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--primary-dark);
}

.related-subheading:first-of-type {
  margin-top: 0;
}

.related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 14px;
}

.related-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 15px 17px;
  border-radius: var(--radius-md);
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  color: var(--text-main);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease, background-color 0.15s ease;
}

.related-card:hover {
  background: #ffffff;
  border-color: var(--primary);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
  color: var(--text-main);
}

.related-card-title {
  font-size: 0.94rem;
  font-weight: 700;
  color: var(--primary-dark);
  margin-bottom: 5px;
  line-height: 1.35;
}

.related-card:hover .related-card-title {
  color: var(--primary);
}

.related-card-desc {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.48;
}

@media (max-width: 768px) {
  .related-calculators-section {
    padding: 22px 20px;
  }
}

/* ==========================================================================
   Sticky Header & Navigation
   ========================================================================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-light);
  box-shadow: var(--shadow-xs);
}

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

.brand-logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 1.2rem;
  letter-spacing: -0.02em;
  color: var(--text-main);
}

.brand-logo:hover {
  color: var(--primary);
}

.brand-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--teal-accent) 100%);
  color: #ffffff;
  box-shadow: 0 3px 8px rgba(2, 132, 199, 0.28);
  flex-shrink: 0;
}

.brand-badge {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 2px 7px;
  border-radius: var(--radius-pill);
  background: var(--emerald-soft);
  color: var(--emerald-dark);
  border: 1px solid var(--emerald-border);
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 6px;
}

.main-nav a {
  padding: 7px 13px;
  border-radius: var(--radius-sm);
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text-secondary);
  transition: background-color 0.15s ease, color 0.15s ease;
}

.main-nav a:hover,
.main-nav a.active {
  background-color: var(--primary-soft);
  color: var(--primary-dark);
}

.nav-toggle {
  display: none;
  background: transparent;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 7px 10px;
  cursor: pointer;
  color: var(--text-main);
}

.nav-toggle:focus-visible {
  outline: none;
  box-shadow: var(--shadow-focus);
}

/* ==========================================================================
   AdSense Slots (Hidden by default unless configured or previewed)
   ========================================================================== */
.ad-slot {
  display: none;
  margin: 18px auto;
  max-width: var(--container-max);
  text-align: center;
}

.ad-slot.ad-slot-active {
  display: block;
}

.ad-placeholder-box {
  background: repeating-linear-gradient(
    -45deg,
    #f8fafc,
    #f8fafc 10px,
    #f1f5f9 10px,
    #f1f5f9 20px
  );
  border: 1px dashed var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px;
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.03em;
}

/* ==========================================================================
   Hero Section (Compact so Calculator stays Above the Fold)
   ========================================================================== */
.hero-section {
  padding: 28px 0 18px;
}

.hero-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.hero-title-group {
  max-width: 780px;
}

.eyebrow-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--primary-dark);
  background: var(--primary-soft);
  border: 1px solid var(--primary-border);
  padding: 4px 11px;
  border-radius: var(--radius-pill);
  margin-bottom: 10px;
}

.hero-title {
  margin: 0 0 8px;
  font-size: clamp(1.65rem, 3vw, 2.35rem);
  line-height: 1.18;
  font-weight: 800;
  letter-spacing: -0.025em;
  color: var(--text-main);
}

.hero-subtitle {
  margin: 0;
  font-size: 1rem;
  color: var(--text-secondary);
  max-width: 720px;
}

.trust-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.trust-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-pill);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
  box-shadow: var(--shadow-xs);
}

.trust-pill svg {
  color: var(--emerald);
}

/* ==========================================================================
   Presets Bar & Action Buttons
   ========================================================================== */
.presets-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  margin-bottom: 18px;
  box-shadow: var(--shadow-xs);
}

.presets-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.presets-label {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-right: 2px;
}

.preset-btn {
  appearance: none;
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  border-radius: var(--radius-pill);
  padding: 5px 12px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.preset-btn:hover {
  border-color: var(--primary);
  color: var(--primary-dark);
  background: var(--primary-soft);
}

.preset-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
}

.preset-btn:focus-visible,
.btn-action:focus-visible {
  outline: none;
  box-shadow: var(--shadow-focus);
}

.toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.btn-action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  padding: 6px 11px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-action:hover {
  border-color: var(--primary);
  color: var(--primary-dark);
  background: var(--bg-subtle);
}

.btn-action.btn-primary-soft {
  background: var(--primary-soft);
  border-color: var(--primary-border);
  color: var(--primary-dark);
}

.btn-action.btn-primary-soft:hover {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
}

/* ==========================================================================
   Main Calculator Grid (Inputs Left + KPI Dashboard Right)
   ========================================================================== */
.calc-grid {
  display: grid;
  grid-template-columns: 420px 1fr;
  gap: 20px;
  align-items: start;
}

.panel-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 22px;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-light);
}

.panel-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 8px;
}

.panel-title svg {
  color: var(--primary);
}

.input-section-label {
  font-size: 0.74rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--primary-dark);
  margin: 16px 0 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.input-section-label:first-of-type {
  margin-top: 0;
}

.input-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.field-group {
  margin-bottom: 12px;
}

.field-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 5px;
}

.field-hint {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-muted);
}

.input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.input-prefix,
.input-suffix {
  position: absolute;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-muted);
  pointer-events: none;
  user-select: none;
}

.input-prefix {
  left: 11px;
}

.input-suffix {
  right: 11px;
}

.num-input {
  width: 100%;
  height: 40px;
  padding: 6px 12px;
  font-family: var(--font-mono);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-main);
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

.num-input.has-prefix {
  padding-left: 26px;
}

.num-input.has-suffix {
  padding-right: 30px;
}

.num-input:hover {
  border-color: #94a3b8;
}

.num-input:focus {
  outline: none;
  background: #ffffff;
  border-color: var(--primary);
  box-shadow: var(--shadow-focus);
}

/* LTV Quick Chips */
.ltv-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.ltv-chip {
  appearance: none;
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  border-radius: 6px;
  padding: 3px 8px;
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.12s ease;
}

.ltv-chip:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.ltv-chip.active {
  background: var(--primary-soft);
  border-color: var(--primary);
  color: var(--primary-dark);
}

/* Range Slider */
.range-slider {
  width: 100%;
  accent-color: var(--primary);
  cursor: pointer;
  height: 6px;
  margin: 6px 0 4px;
}

.slider-marks {
  display: flex;
  justify-content: space-between;
  gap: 6px;
  margin-top: 4px;
}

.slider-mark-btn {
  appearance: none;
  border: 1px solid var(--border-light);
  background: var(--bg-subtle);
  color: var(--text-secondary);
  font-size: 0.74rem;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 6px;
  cursor: pointer;
  flex: 1;
  text-align: center;
  transition: all 0.12s ease;
}

.slider-mark-btn:hover,
.slider-mark-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
}

/* ==========================================================================
   KPI Dashboard Cards (Right Column)
   ========================================================================== */
.results-stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.alert-banner {
  display: none;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  background: var(--rose-soft);
  border: 1px solid var(--rose-border);
  color: var(--rose-dark);
  font-size: 0.88rem;
  font-weight: 600;
}

.alert-banner.visible {
  display: flex;
  align-items: center;
  gap: 10px;
}

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

.kpi-sub-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.kpi-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.kpi-card.kpi-primary {
  background: linear-gradient(145deg, #0284c7 0%, #0369a1 100%);
  border-color: #0369a1;
  color: #ffffff;
}

.kpi-card.kpi-primary .kpi-label,
.kpi-card.kpi-primary .kpi-note {
  color: rgba(255, 255, 255, 0.88);
}

.kpi-card.kpi-emerald {
  border-top: 4px solid var(--emerald);
}

.kpi-card.kpi-ocean {
  border-top: 4px solid var(--primary);
}

.kpi-card.kpi-profit-positive {
  background: linear-gradient(180deg, #ffffff 0%, #ecfdf5 100%);
  border-color: var(--emerald-border);
  border-top: 4px solid var(--emerald);
}

.kpi-card.kpi-profit-negative {
  background: linear-gradient(180deg, #ffffff 0%, #fff1f2 100%);
  border-color: var(--rose-border);
  border-top: 4px solid var(--rose);
}

.kpi-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.kpi-label {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.kpi-pill {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.2);
  color: #ffffff;
  white-space: nowrap;
}

.kpi-pill-emerald {
  background: var(--emerald-soft);
  color: var(--emerald-dark);
  border: 1px solid var(--emerald-border);
}

.kpi-pill-ocean {
  background: var(--primary-soft);
  color: var(--primary-dark);
  border: 1px solid var(--primary-border);
}

.kpi-pill-rose {
  background: var(--rose-soft);
  color: var(--rose-dark);
  border: 1px solid var(--rose-border);
}

.kpi-value {
  font-family: var(--font-mono);
  font-size: clamp(1.6rem, 2.5vw, 2.15rem);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.03em;
  margin: 4px 0 6px;
}

.kpi-sub-row .kpi-value {
  font-size: clamp(1.35rem, 2vw, 1.65rem);
}

.text-emerald {
  color: var(--emerald-dark);
}

.text-rose {
  color: var(--rose-dark);
}

.text-ocean {
  color: var(--primary-dark);
}

.kpi-note {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.4;
}

/* Target Margin Inline Control inside KPI Card */
.target-margin-control {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed var(--border-light);
}

.target-margin-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--text-secondary);
}

/* ==========================================================================
   Per-Order Unit Economics Visual Breakdown Card
   ========================================================================== */
.unit-breakdown-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
}

.breakdown-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
}

.breakdown-title {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 800;
  color: var(--text-main);
}

.breakdown-subtitle {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 600;
}

.stacked-bar {
  display: flex;
  height: 18px;
  width: 100%;
  border-radius: var(--radius-pill);
  overflow: hidden;
  background: var(--bg-muted);
  margin-bottom: 12px;
}

.bar-seg {
  height: 100%;
  transition: width 0.25s ease;
}

.seg-cogs {
  background: #64748b;
}

.seg-fees {
  background: #f59e0b;
}

.seg-ads {
  background: #0284c7;
}

.seg-profit {
  background: #10b981;
}

.seg-loss {
  background: #e11d48;
}

.breakdown-legend {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.legend-item {
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
}

.legend-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
}

.legend-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}

.legend-val {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  font-weight: 800;
  color: var(--text-main);
  margin-top: 2px;
}

/* ==========================================================================
   Interactive ROAS Scaling Matrix Table
   ========================================================================== */
.matrix-section {
  margin-top: 22px;
}

.matrix-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.matrix-title-wrap h2 {
  margin: 0 0 3px;
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--text-main);
}

.matrix-title-wrap p {
  margin: 0;
  font-size: 0.86rem;
  color: var(--text-muted);
}

.status-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  font-size: 0.74rem;
  font-weight: 700;
  white-space: nowrap;
}

.status-loss {
  background: var(--rose-soft);
  color: var(--rose-dark);
  border: 1px solid var(--rose-border);
}

.status-breakeven {
  background: var(--amber-soft);
  color: var(--amber-dark);
  border: 1px solid var(--amber-border);
}

.status-profitable {
  background: var(--primary-soft);
  color: var(--primary-dark);
  border: 1px solid var(--primary-border);
}

.status-sweetspot {
  background: var(--emerald-soft);
  color: var(--emerald-dark);
  border: 1px solid var(--emerald-border);
}

.table-scroll {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
}

.matrix-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  min-width: 720px;
  background: var(--bg-surface);
}

.matrix-table thead th {
  background: var(--bg-subtle);
  color: var(--text-secondary);
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 12px 14px;
  text-align: right;
  border-bottom: 2px solid var(--border-light);
}

.matrix-table thead th:first-child,
.matrix-table tbody td:first-child {
  text-align: left;
}

.matrix-table thead th:last-child,
.matrix-table tbody td:last-child {
  text-align: center;
}

.matrix-table tbody td {
  padding: 10px 14px;
  text-align: right;
  border-bottom: 1px solid var(--border-light);
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--text-main);
}

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

.matrix-table tbody tr.row-loss {
  background-color: rgba(255, 228, 230, 0.28);
}

.matrix-table tbody tr.row-breakeven {
  background-color: rgba(254, 243, 199, 0.45);
}

.matrix-table tbody tr.row-profitable {
  background-color: rgba(224, 242, 254, 0.25);
}

.matrix-table tbody tr.row-sweetspot {
  background-color: rgba(209, 250, 229, 0.32);
}

.matrix-table tbody tr.row-current {
  outline: 2px solid var(--primary);
  outline-offset: -2px;
}

.matrix-table tbody tr:hover {
  filter: brightness(0.985);
}

.roas-cell-tag {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  font-family: var(--font-sans);
  font-size: 0.68rem;
  font-weight: 700;
  border-radius: 4px;
  background: var(--primary);
  color: #ffffff;
  vertical-align: middle;
}

.roas-cell-be-tag {
  background: var(--amber);
}

/* ==========================================================================
   Recommended Tools & Affiliate Partner Cards Section
   ========================================================================== */
.partners-section {
  margin-top: 28px;
  padding: 24px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.partners-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.partners-header h2 {
  margin: 0 0 4px;
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text-main);
}

.partners-header p {
  margin: 0;
  font-size: 0.88rem;
  color: var(--text-secondary);
}

.ftc-note {
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--bg-page);
  border: 1px solid var(--border-light);
  padding: 4px 10px;
  border-radius: var(--radius-pill);
}

.partners-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.partner-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px;
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}

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

.partner-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.partner-name {
  margin: 0;
  font-size: 1.08rem;
  font-weight: 800;
  color: var(--text-main);
}

.partner-badge {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: var(--radius-pill);
  background: var(--emerald-soft);
  color: var(--emerald-dark);
  border: 1px solid var(--emerald-border);
  white-space: nowrap;
}

.partner-desc {
  margin: 0 0 16px;
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.55;
}

.partner-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: var(--primary);
  color: #ffffff;
  font-size: 0.88rem;
  font-weight: 700;
  text-align: center;
  transition: background-color 0.15s ease;
}

.partner-cta:hover {
  background: var(--primary-hover);
  color: #ffffff;
}

/* ==========================================================================
   SEO Guide & Editorial Content Section
   ========================================================================== */
.content-section {
  margin-top: 32px;
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 34px 36px;
  box-shadow: var(--shadow-sm);
}

.prose h2 {
  margin: 0 0 14px;
  font-size: 1.55rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-main);
}

.prose h3 {
  margin: 28px 0 10px;
  font-size: 1.18rem;
  font-weight: 800;
  color: var(--text-main);
}

.prose p {
  margin: 0 0 14px;
  color: var(--text-secondary);
  line-height: 1.72;
}

.prose ul,
.prose ol {
  margin: 0 0 18px;
  padding-left: 22px;
  color: var(--text-secondary);
}

.prose li {
  margin-bottom: 8px;
  line-height: 1.65;
}

.formula-box {
  background: var(--bg-subtle);
  border-left: 4px solid var(--primary);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 14px 18px;
  margin: 16px 0 20px;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  color: var(--text-main);
  overflow-x: auto;
}

.benchmark-table-wrap {
  width: 100%;
  overflow-x: auto;
  margin: 16px 0 22px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
}

.benchmark-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
  min-width: 620px;
}

.benchmark-table th {
  background: var(--bg-subtle);
  text-align: left;
  padding: 11px 14px;
  font-weight: 800;
  color: var(--text-main);
  border-bottom: 2px solid var(--border-light);
}

.benchmark-table td {
  padding: 10px 14px;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-light);
}

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

/* ==========================================================================
   Interactive FAQ Accordion
   ========================================================================== */
.faq-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 16px;
}

.faq-item {
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  background: var(--bg-subtle);
  overflow: hidden;
  transition: border-color 0.15s ease;
}

.faq-item.open {
  border-color: var(--primary-border);
  background: var(--bg-surface);
}

.faq-question {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 18px;
  background: transparent;
  border: none;
  text-align: left;
  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-main);
  cursor: pointer;
}

.faq-question:hover {
  color: var(--primary);
}

.faq-question:focus-visible {
  outline: none;
  box-shadow: var(--shadow-focus);
}

.faq-chevron {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  color: var(--primary);
  transition: transform 0.2s ease;
}

.faq-item.open .faq-chevron {
  transform: rotate(180deg);
}

.faq-answer {
  display: none;
  padding: 0 18px 16px;
  color: var(--text-secondary);
  font-size: 0.94rem;
  line-height: 1.68;
}

.faq-item.open .faq-answer {
  display: block;
}

/* ==========================================================================
   Supporting Legal / Contact Pages
   ========================================================================== */
.page-shell {
  max-width: 860px;
  margin: 34px auto;
}

.contact-form {
  display: grid;
  gap: 14px;
  margin-top: 20px;
}

.form-control {
  width: 100%;
  padding: 10px 13px;
  font-family: var(--font-sans);
  font-size: 0.95rem;
  color: var(--text-main);
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
}

.form-control:focus {
  outline: none;
  background: #ffffff;
  border-color: var(--primary);
  box-shadow: var(--shadow-focus);
}

textarea.form-control {
  min-height: 130px;
  resize: vertical;
}

.btn-submit {
  justify-self: start;
  padding: 11px 22px;
  background: var(--primary);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.btn-submit:hover {
  background: var(--primary-hover);
}

/* ==========================================================================
   Toast Notification
   ========================================================================== */
.toast-msg {
  position: fixed;
  bottom: 22px;
  right: 22px;
  z-index: 200;
  background: var(--text-main);
  color: #ffffff;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.86rem;
  font-weight: 600;
  box-shadow: var(--shadow-md);
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast-msg.show {
  opacity: 1;
  transform: translateY(0);
}

/* ==========================================================================
   Footer
   ========================================================================== */
.site-footer {
  margin-top: 48px;
  background: #0f172a;
  color: #cbd5e1;
  padding: 36px 0 28px;
  font-size: 0.88rem;
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 28px;
  padding-bottom: 24px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.2);
}

.footer-brand {
  font-size: 1.12rem;
  font-weight: 800;
  color: #ffffff;
  margin-bottom: 8px;
  display: inline-block;
}

.footer-disclosure {
  font-size: 0.8rem;
  color: #94a3b8;
  line-height: 1.6;
  margin-top: 8px;
}

.footer-heading {
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #ffffff;
  margin: 0 0 10px;
}

.footer-links {
  list-style: none;
  margin: 0;
  padding: 0;
}

.footer-links li {
  margin-bottom: 7px;
}

.footer-links a {
  color: #cbd5e1;
}

.footer-links a:hover {
  color: #38bdf8;
}

.footer-bottom {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 10px;
  padding-top: 18px;
  font-size: 0.8rem;
  color: #94a3b8;
}

/* ==========================================================================
   Responsive Breakpoints
   ========================================================================== */
@media (max-width: 1024px) {
  .calc-grid {
    grid-template-columns: 1fr;
  }

  .partners-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .nav-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .main-nav {
    display: none;
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    background: #ffffff;
    border-bottom: 1px solid var(--border-color);
    padding: 12px 20px;
    box-shadow: var(--shadow-md);
  }

  .main-nav.open {
    display: flex;
  }

  .kpi-hero-row,
  .kpi-sub-row {
    grid-template-columns: 1fr;
  }

  .breakdown-legend {
    grid-template-columns: 1fr 1fr;
  }

  .content-section {
    padding: 24px 20px;
  }

  .footer-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .input-row-2 {
    grid-template-columns: 1fr;
  }

  .presets-bar {
    flex-direction: column;
    align-items: stretch;
  }
}

/* ==========================================================================
   Print Stylesheet (Clean Agency / Media Buyer PDF Export)
   ========================================================================== */
@media print {
  body {
    background: #ffffff;
    color: #000000;
    font-size: 11pt;
  }

  .skh-topbar,
  .site-header,
  .presets-bar,
  .ad-slot,
  .partners-section,
  .related-calculators-section,
  .site-footer,
  .toast-msg {
    display: none !important;
  }

  .calc-grid {
    grid-template-columns: 1fr 1fr;
    gap: 14px;
  }

  .panel-card,
  .kpi-card,
  .unit-breakdown-card,
  .content-section {
    box-shadow: none !important;
    border: 1px solid #cbd5e1 !important;
    break-inside: avoid;
  }

  .kpi-card.kpi-primary {
    background: #f8fafc !important;
    color: #0f172a !important;
  }

  .kpi-card.kpi-primary .kpi-label,
  .kpi-card.kpi-primary .kpi-note {
    color: #334155 !important;
  }
}
