/* ============================================================
   PAWS Business Case Modeller — Design System
   NFCA visual identity, matching fife-shieldbelt.netlify.app
   ============================================================ */

/* ── Google Fonts ── */
@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@600;700;900&family=Source+Sans+3:wght@300;400;600&family=JetBrains+Mono:wght@400;600&display=swap');

/* ── Colour Palette ── */
:root {
  --c-forest:   #1a3d2b;
  --c-mid:      #2d6a4f;
  --c-leaf:     #52b788;
  --c-gold:     #b5830a;
  --c-gold-lt:  #f4c542;
  --c-cream:    #faf7f0;
  --c-stone:    #e8e4dc;
  --c-ink:      #1c1c1c;
  --c-muted:    #6b7280;
  --c-positive: #166534;
  --c-negative: #9b2226;
  --c-warn:     #92400e;

  --radius-sm:  6px;
  --radius-md:  10px;
  --radius-lg:  16px;
  --shadow-sm:  0 1px 4px rgba(0,0,0,.08);
  --shadow-md:  0 4px 16px rgba(0,0,0,.10);
  --transition: 180ms ease;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: 'Source Sans 3', system-ui, sans-serif;
  font-size: 15px;
  color: var(--c-ink);
  background: var(--c-cream);
  line-height: 1.55;
  min-height: 100vh;
}

/* ── Typography ── */
h1, h2, h3, h4 {
  font-family: 'Playfair Display', Georgia, serif;
  line-height: 1.2;
  color: var(--c-forest);
}

.mono {
  font-family: 'JetBrains Mono', monospace;
}

/* ── Header ── */
.site-header {
  background: var(--c-forest);
  color: var(--c-cream);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 12px rgba(0,0,0,.3);
}

.header-main {
  max-width: 1160px;
  margin: 0 auto;
  padding: 0 20px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.header-logo {
  height: 38px;
  width: auto;
}

.header-logo-fallback {
  font-family: 'Playfair Display', serif;
  font-weight: 900;
  font-size: 1.1rem;
  color: var(--c-gold-lt);
  letter-spacing: .04em;
}

.header-title {
  font-family: 'Playfair Display', Georgia, serif;
  font-weight: 700;
  font-size: 1.1rem;
  color: #fff;
  line-height: 1.2;
}

.header-title span {
  display: block;
  font-family: 'Source Sans 3', sans-serif;
  font-weight: 300;
  font-size: 0.72rem;
  color: var(--c-leaf);
  letter-spacing: .04em;
  margin-top: 1px;
}

.header-back {
  color: var(--c-gold-lt);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  transition: color var(--transition);
}
.header-back:hover { color: #fff; }

.header-subtitle {
  background: var(--c-mid);
  text-align: center;
  padding: 5px 20px;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--c-leaf);
  letter-spacing: .08em;
  text-transform: uppercase;
}

/* ── App Layout ── */
.app-wrapper {
  max-width: 1160px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 360px 1fr;
  min-height: calc(100vh - 85px);
}

/* ── Left Panel (Controls) ── */
.panel-controls {
  background: var(--c-cream);
  border-left: 3px solid var(--c-forest);
  border-right: 1px solid var(--c-stone);
  overflow-y: auto;
  position: sticky;
  top: 85px;
  height: calc(100vh - 85px);
}

.panel-controls-inner {
  padding: 20px 0 40px;
}

.panel-controls-header {
  padding: 4px 20px 16px;
  border-bottom: 2px solid var(--c-stone);
  margin-bottom: 8px;
}

.panel-controls-header h2 {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--c-forest);
}

.panel-controls-header p {
  font-size: 0.8rem;
  color: var(--c-muted);
  margin-top: 3px;
}

/* ── Right Panel (Results) ── */
.panel-results {
  padding: 24px 24px 60px;
  overflow-y: auto;
}

/* ── Mobile anchor ── */
.mobile-anchor {
  display: none;
  text-align: center;
  padding: 10px;
  background: var(--c-forest);
  color: var(--c-gold-lt);
  font-weight: 600;
  font-size: 0.9rem;
  text-decoration: none;
}

/* ── Input Section (collapsible) ── */
.input-section {
  border-bottom: 1px solid var(--c-stone);
}

.input-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 20px;
  cursor: pointer;
  user-select: none;
  transition: background var(--transition);
}
.input-section-header:hover { background: rgba(26,61,43,.04); }

.input-section-header h3 {
  font-family: 'Source Sans 3', sans-serif;
  font-weight: 600;
  font-size: 0.85rem;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--c-forest);
}

.section-number {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  color: var(--c-gold);
  font-weight: 600;
  margin-right: 8px;
}

.section-chevron {
  color: var(--c-muted);
  font-size: 0.75rem;
  transition: transform var(--transition);
}
.input-section.open .section-chevron { transform: rotate(180deg); }

.input-section-body {
  padding: 4px 20px 16px;
  display: none;
}
.input-section.open .input-section-body { display: block; }

/* ── Slider Row ── */
.slider-row {
  margin-bottom: 16px;
}

.slider-row label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 6px;
  font-size: 0.85rem;
  color: var(--c-ink);
  font-weight: 400;
}

.slider-value {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--c-gold);
  background: rgba(181,131,10,.08);
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  min-width: 64px;
  text-align: right;
}

/* FIX [2 mobile]: height 44px gives a full ≥44px touch target on iOS;
   touch-action prevents accidental page scroll while dragging. */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 44px;
  background: transparent;
  outline: none;
  cursor: pointer;
  touch-action: manipulation;
}
input[type="range"]::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 2px;
  background: var(--c-stone);
  background: var(--c-stone, #e8e4dc);
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  margin-top: -10px;
  background: #1a3d2b;
  background: var(--c-forest, #1a3d2b);
  border: 2px solid var(--c-leaf, #52b788);
  cursor: pointer;
  transition: transform var(--transition), background var(--transition);
}
input[type="range"]::-webkit-slider-thumb:hover {
  background: var(--c-mid, #2d6a4f);
  transform: scale(1.15);
}
input[type="range"]::-moz-range-track {
  height: 4px;
  border-radius: 2px;
  background: var(--c-stone, #e8e4dc);
}
input[type="range"]::-moz-range-thumb {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #1a3d2b;
  background: var(--c-forest, #1a3d2b);
  border: 2px solid var(--c-leaf);
  cursor: pointer;
}

.slider-track-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.68rem;
  color: var(--c-muted);
  margin-top: 4px;
}

/* ── Number Input ── */
.number-input-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.number-input-row label {
  font-size: 0.85rem;
  color: var(--c-ink);
  min-width: 80px;
}

input[type="number"] {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.9rem;
  width: 80px;
  padding: 6px 10px;
  border: 1.5px solid var(--c-stone);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--c-ink);
  outline: none;
  transition: border-color var(--transition);
}
input[type="number"]:focus { border-color: var(--c-mid); }

/* ── Select ── */
select {
  width: 100%;
  padding: 8px 12px;
  border: 1.5px solid var(--c-stone);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--c-ink);
  font-family: 'Source Sans 3', sans-serif;
  font-size: 0.9rem;
  outline: none;
  cursor: pointer;
  transition: border-color var(--transition);
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236b7280' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 34px;
}
select:focus { border-color: var(--c-mid); }

.select-label {
  font-size: 0.85rem;
  color: var(--c-ink);
  display: block;
  margin-bottom: 6px;
}

/* ── Chip Badges ── */
.species-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--c-forest);
  color: var(--c-cream);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 20px;
  margin-top: 8px;
}

.difficulty-label {
  display: inline-flex;
  align-items: center;
  background: var(--c-mid);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 20px;
  margin-top: 8px;
  transition: background var(--transition);
}
.difficulty-label.easy    { background: var(--c-positive); }
.difficulty-label.moderate { background: var(--c-mid); }
.difficulty-label.challenging { background: var(--c-warn); }
.difficulty-label.difficult { background: #7f1d1d; }
.difficulty-label.severe  { background: var(--c-negative); }

.stat-chips {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  flex-wrap: wrap;
}

.stat-chip {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 20px;
  background: rgba(82,183,136,.15);
  color: var(--c-positive);
  border: 1px solid var(--c-leaf);
}

.stat-chip.planting {
  background: rgba(181,131,10,.1);
  color: var(--c-gold);
  border-color: var(--c-gold);
}

/* ── Helper Text ── */
.helper-text {
  font-size: 0.78rem;
  color: var(--c-muted);
  line-height: 1.5;
  margin-top: 8px;
  font-style: italic;
}

.auto-calc-text {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  color: var(--c-mid);
  margin-top: 6px;
  background: rgba(45,106,79,.07);
  padding: 5px 8px;
  border-radius: var(--radius-sm);
  border-left: 2px solid var(--c-leaf);
}

/* ── Checkbox ── */
.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  font-size: 0.85rem;
  color: var(--c-ink);
  cursor: pointer;
}
.checkbox-row input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--c-forest);
  cursor: pointer;
}

/* ── Toggle Switch ── */
.toggle-row {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 12px;
}

.toggle-label {
  font-size: 0.85rem;
  color: var(--c-muted);
  font-weight: 400;
}
.toggle-label.active {
  color: var(--c-forest);
  font-weight: 600;
}

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 26px;
  flex-shrink: 0;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; }

.toggle-track {
  position: absolute;
  inset: 0;
  background: var(--c-stone);
  border-radius: 13px;
  cursor: pointer;
  transition: background var(--transition);
}
.toggle-track::after {
  content: '';
  position: absolute;
  left: 3px;
  top: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition);
}
.toggle-switch input:checked + .toggle-track { background: var(--c-forest); }
.toggle-switch input:checked + .toggle-track::after { transform: translateX(22px); }

.agent-fee-notice {
  font-size: 0.8rem;
  color: var(--c-warn);
  background: rgba(146,64,14,.07);
  border-left: 3px solid var(--c-warn);
  padding: 6px 10px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin-top: 8px;
  display: none;
  font-family: 'JetBrains Mono', monospace;
}
.agent-fee-notice.visible { display: block; }

/* ── Advanced Settings accordion ── */
.advanced-accordion {
  margin-top: 12px;
  border: 1px solid var(--c-stone);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.advanced-accordion-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 14px;
  background: rgba(26,61,43,.04);
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--c-muted);
  user-select: none;
}
.advanced-accordion-header:hover { background: rgba(26,61,43,.08); }

.advanced-accordion-body {
  padding: 12px 14px;
  background: #fff;
  display: none;
}
.advanced-accordion.open .advanced-accordion-body { display: block; }

.advanced-field {
  margin-bottom: 10px;
}
.advanced-field label {
  display: block;
  font-size: 0.78rem;
  color: var(--c-muted);
  margin-bottom: 4px;
}
.advanced-field input[type="number"] {
  width: 100%;
  font-size: 0.82rem;
  padding: 5px 8px;
}

/* ── Results Panel ── */
.results-header {
  margin-bottom: 24px;
}

.results-header h2 {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--c-forest);
  margin-bottom: 4px;
}

.results-header p {
  color: var(--c-muted);
  font-size: 0.85rem;
}

/* ── Result Hero ── */
.result-hero {
  background: var(--c-forest);
  color: #fff;
  border-radius: var(--radius-lg);
  padding: 28px 32px;
  margin-bottom: 24px;
  position: relative;
  overflow: hidden;
}
.result-hero::before {
  content: '';
  position: absolute;
  top: -40px; right: -40px;
  width: 160px; height: 160px;
  border-radius: 50%;
  background: rgba(82,183,136,.12);
}

.result-hero-label {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--c-leaf);
  margin-bottom: 8px;
}

.result-hero-number {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 3.2rem;
  font-weight: 900;
  line-height: 1;
  color: #fff;
  transition: color var(--transition);
}
.result-hero-number.positive { color: var(--c-gold-lt); }
.result-hero-number.negative { color: #fca5a5; }

.result-hero-sub {
  margin-top: 8px;
  font-size: 0.82rem;
  color: rgba(255,255,255,.65);
}

.result-hero-placeholder {
  font-size: 1rem;
  color: rgba(255,255,255,.5);
  font-style: italic;
  padding: 8px 0;
}

/* ── Result Card ── */
.result-card {
  background: #fff;
  border: 1px solid var(--c-stone);
  border-radius: var(--radius-md);
  padding: 20px 20px 16px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 20px;
}

.result-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.result-card-title {
  font-family: 'Source Sans 3', sans-serif;
  font-weight: 600;
  font-size: 0.82rem;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--c-forest);
}

.result-card-badge {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  padding: 3px 8px;
  border-radius: 20px;
  background: rgba(82,183,136,.12);
  color: var(--c-positive);
  font-weight: 600;
}

.card-placeholder {
  color: var(--c-muted);
  font-size: 0.88rem;
  font-style: italic;
  padding: 12px 0;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 60px;
}

.card-placeholder-arrow {
  color: var(--c-stone);
  font-size: 1.1rem;
}

/* ── Funding Bar ── */
.funding-bar {
  display: flex;
  height: 28px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin-bottom: 12px;
  box-shadow: var(--shadow-sm);
}

.funding-segment {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
  color: #fff;
  transition: width var(--transition);
  white-space: nowrap;
  overflow: hidden;
  padding: 0 6px;
  font-family: 'JetBrains Mono', monospace;
}
.funding-segment.timber  { background: var(--c-forest); }
.funding-segment.grant   { background: var(--c-mid); }
.funding-segment.esg     { background: var(--c-gold); }
.funding-segment.other   { background: var(--c-muted); }

.funding-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 8px;
}
.funding-legend-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.75rem;
  color: var(--c-ink);
}
.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  flex-shrink: 0;
}

/* ── Sweat Row ── */
.sweat-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  background: rgba(232,228,220,.35);
}
.sweat-row + .sweat-row { border-top: 1px solid var(--c-stone); }

.sweat-row-label {
  font-size: 0.82rem;
  color: var(--c-muted);
}
.sweat-row-value {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--c-ink);
}
.sweat-saving-badge {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  font-weight: 700;
  background: rgba(82,183,136,.18);
  color: var(--c-positive);
  padding: 2px 8px;
  border-radius: 20px;
  border: 1px solid var(--c-leaf);
}

/* ── Canvas Chart placeholder ── */
.chart-canvas-wrap {
  position: relative;
  width: 100%;
  margin-top: 12px;
}

.chart-canvas-wrap canvas {
  width: 100%;
  height: auto;
  border-radius: var(--radius-sm);
}

/* ── Divider ── */
.divider {
  height: 1px;
  background: var(--c-stone);
  margin: 20px 0;
}

/* ── Responsive: Mobile (<900px) ── */
@media (max-width: 899px) {
  .app-wrapper {
    grid-template-columns: 1fr;
  }

  .panel-controls {
    position: static;
    height: auto;
    max-height: none;
    overflow-y: visible;
    border-left: none;
    border-top: 3px solid var(--c-forest);
    border-right: none;
    border-bottom: 2px solid var(--c-stone);
  }

  .panel-results {
    padding: 20px 16px 48px;
  }

  .mobile-anchor {
    display: block;
  }

  .result-hero-number {
    font-size: 2.4rem;
  }

  .header-title { font-size: 0.95rem; }
  .header-back { font-size: 0.78rem; }
}

/* ── Utility ── */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.text-positive { color: var(--c-positive); }
.text-negative { color: var(--c-negative); }
.text-warn     { color: var(--c-warn); }
.text-muted    { color: var(--c-muted); }
.text-gold     { color: var(--c-gold); }

.mt-4  { margin-top: 4px; }
.mt-8  { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }

/* ── Hero layout ── */
.hero-top-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 4px;
}

/* ── Scenario tabs ── */
.scenario-tabs {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.tab-btn {
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.18);
  color: rgba(255,255,255,.6);
  border-radius: 20px;
  padding: 4px 14px;
  font-family: 'Source Sans 3', sans-serif;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
}
.tab-btn:hover { background: rgba(255,255,255,.18); color: #fff; }
.tab-btn.active {
  background: rgba(255,255,255,.22);
  color: #fff;
  border-color: rgba(255,255,255,.45);
}

/* ── Breakeven status badge ── */
.breakeven-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 13px;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: .01em;
}
.breakeven-badge.positive  { background: rgba(22,101,52,.3);   color: #86efac; }
.breakeven-badge.warn      { background: rgba(146,64,14,.35);  color: #fcd34d; }
.breakeven-badge.negative  { background: rgba(155,34,38,.3);   color: #fca5a5; }

/* ── Funding detail rows ── */
.funding-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--c-stone);
  font-size: 0.85rem;
}
.funding-row:last-child { border-bottom: none; }

/* FIX [T3-C]: negative timber notice at high difficulty */
.funding-timber-negative {
  margin-top: 10px;
  padding: 8px 12px;
  background: rgba(155,34,38,.06);
  border-left: 3px solid var(--c-negative, #9b2226);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 0.78rem;
  color: var(--c-muted, #6b7280);
  line-height: 1.5;
}
.funding-row-left {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--c-ink);
}

.funding-row-swatch {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  flex-shrink: 0;
}

.funding-row-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.funding-row-value {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 600;
  color: var(--c-ink);
  min-width: 78px;
  text-align: right;
}

.funding-row-pct {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.78rem;
  color: var(--c-muted);
  min-width: 36px;
  text-align: right;
}

/* ── Sweat equity comparison bars ── */
.compare-block {
  margin-bottom: 16px;
}

.compare-block-label {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--c-forest);
  margin-bottom: 7px;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.compare-bar-item {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 5px;
}

.compare-bar-name {
  font-size: 0.75rem;
  color: var(--c-muted);
  min-width: 68px;
}

.compare-bar-track {
  flex: 1;
  height: 22px;
  background: var(--c-stone);
  border-radius: 4px;
  overflow: hidden;
}

.compare-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 300ms ease;
  display: flex;
  align-items: center;
  padding: 0 6px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.7rem;
  font-weight: 700;
  color: rgba(255,255,255,.92);
  white-space: nowrap;
  overflow: hidden;
}

.compare-bar-value {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem;
  font-weight: 700;
  min-width: 62px;
  text-align: right;
  color: var(--c-ink);
}

.compare-saving-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(82,183,136,.1);
  border: 1px solid var(--c-leaf);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  margin-top: 6px;
}

.compare-saving-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--c-positive);
}

.compare-saving-value {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--c-positive);
}

/* ── Sweat total box ── */
.sweat-total-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 18px;
  background: rgba(181,131,10,.07);
  border: 2px solid var(--c-gold);
  border-radius: var(--radius-md);
  margin-top: 14px;
}

.sweat-total-label {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--c-gold);
}

.sweat-total-value {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--c-gold);
}

.sweat-flip-msg {
  margin-top: 9px;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--c-positive);
  background: rgba(22,101,52,.08);
  border-left: 3px solid var(--c-leaf);
  padding: 7px 10px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

/* ── Stat boxes (projection) ── */
.stat-boxes {
  display: flex;
  gap: 12px;
  margin-top: 16px;
  flex-wrap: wrap;
}

.stat-box {
  flex: 1;
  min-width: 130px;
  padding: 12px 16px;
  background: rgba(26,61,43,.04);
  border: 1px solid var(--c-stone);
  border-radius: var(--radius-md);
}

.stat-box-label {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--c-muted);
  margin-bottom: 5px;
}

.stat-box-value {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--c-positive);
}

/* ── Chart legend ── */
.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.78rem;
  color: var(--c-ink);
  margin-right: 2px;
}

.legend-swatch {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  flex-shrink: 0;
}

/* ── Breakdown table inside result card ── */
.breakdown-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.83rem;
}

.breakdown-table td {
  padding: 5px 8px;
  vertical-align: middle;
}

.breakdown-table tr.income-header td,
.breakdown-table tr.cost-header td {
  padding: 6px 8px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
}

.breakdown-table tr.total-row td {
  padding: 8px 8px;
  font-weight: 700;
  font-size: 0.9rem;
  border-top: 2px solid var(--c-forest);
}

.breakdown-table td.val {
  text-align: right;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 600;
}

.breakdown-table tr { border-top: 1px solid var(--c-stone); }
.breakdown-table tr:first-child { border-top: none; }

.breakdown-table .income-header td  { color: var(--c-positive); background: rgba(82,183,136,.06); padding-top: 8px; }
.breakdown-table .cost-header td    { color: var(--c-negative); background: rgba(155,34,38,.04);  padding-top: 8px; }
.breakdown-table .subtotal-row td   { font-weight: 700; background: rgba(26,61,43,.04); border-top: 2px solid var(--c-stone); }
.breakdown-table .total-row td      { font-weight: 700; background: rgba(26,61,43,.06); border-top: 2px solid var(--c-forest); font-size: 0.95rem; }
.breakdown-table .diy-row td        { color: var(--c-muted); font-size: 0.8rem; border-top: 1px solid var(--c-stone); }
.breakdown-table .sub-row td        { color: var(--c-muted); font-size: 0.78rem; }
.breakdown-table .sub-row td:first-child { padding-left: 18px; }

/* ── Loading overlay ── */
#loading-overlay {
  position: fixed;
  inset: 0;
  background: var(--c-forest);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  color: var(--c-cream);
  transition: opacity 300ms ease;
}
.loading-inner { text-align: center; padding: 20px; }
.loading-icon  { font-size: 2.5rem; margin-bottom: 16px; }
.loading-inner h2 {
  font-family: 'Playfair Display', Georgia, serif;
  color: var(--c-cream);
  font-size: 1.3rem;
  margin-bottom: 8px;
  font-weight: 700;
}
.loading-inner p { color: var(--c-leaf); font-size: 0.85rem; }

/* ── Advanced Settings — section labels + reset button ── */
.adv-section-label {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--c-muted);
  margin: 14px 0 6px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--c-stone);
}
.adv-section-label:first-of-type { margin-top: 0; }

.reset-btn {
  display: block;
  width: 100%;
  padding: 9px 14px;
  background: transparent;
  border: 1.5px solid var(--c-gold);
  border-radius: var(--radius-sm);
  color: var(--c-gold);
  font-family: 'Source Sans 3', sans-serif;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  transition: background var(--transition), color var(--transition);
}
.reset-btn:hover {
  background: var(--c-gold);
  color: #fff;
}

/* ── FIX [1c Samsung/Edge]: CSS variable fallback hex on critical elements ── */
.result-hero {
  color: #1c1c1c;
  color: var(--c-ink);
  background: #1a3d2b;
  background: var(--c-forest);
}
.result-card {
  background: #fff;
}
.breakeven-badge.positive { background: #166534; background: var(--c-positive); }
.breakeven-badge.warn     { background: #92400e; background: var(--c-warn);     }
.breakeven-badge.negative { background: #9b2226; background: var(--c-negative); }
.stat-box-value           { color: #1a3d2b; color: var(--c-forest); }

/* ── FIX [9 a11y]: visible focus rings for keyboard navigation ── */
:focus-visible {
  outline: 2px solid #f4c542;
  outline: 2px solid var(--c-gold-lt);
  outline-offset: 2px;
}
/* Remove default outline only when :focus-visible is supported */
:focus:not(:focus-visible) { outline: none; }

/* ── FIX [8 print]: hide controls panel; show all result sections ── */
@media print {
  .panel-controls,
  .site-header,
  #loading-overlay,
  .see-results-btn {
    display: none !important;
  }
  .app-wrapper {
    display: block !important;
  }
  .panel-results {
    width: 100% !important;
    max-height: none !important;
    overflow: visible !important;
    padding: 0 !important;
  }
  canvas {
    max-width: 100% !important;
  }
  .result-card,
  .result-hero {
    break-inside: avoid;
    box-shadow: none;
    border: 1px solid #e8e4dc;
  }
}

/* ══════════════════════════════════════════════════════════════
   SISTER TOOL NUDGE
══════════════════════════════════════════════════════════════ */
.sister-nudge {
  margin-bottom: 16px;
  padding: 10px 14px;
  background: rgba(26,61,43,.06);
  border: 1px solid rgba(26,61,43,.18);
  border-radius: var(--radius);
  font-size: 0.82rem;
  color: var(--c-forest, #1a3d2b);
  line-height: 1.5;
}
.sister-nudge strong { font-weight: 700; }
.sister-nudge-link {
  display: inline-block;
  margin-top: 4px;
  font-weight: 600;
  color: var(--c-forest, #1a3d2b);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.sister-nudge-link:hover { color: var(--c-gold, #c9960c); }

/* ══════════════════════════════════════════════════════════════
   SITE FOOTER
══════════════════════════════════════════════════════════════ */
.site-footer {
  background: var(--c-forest, #1a3d2b);
  color: rgba(255,255,255,.7);
  padding: 14px 24px;
  font-size: 0.78rem;
}
.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}
.footer-copy { color: rgba(255,255,255,.55); }
.footer-link {
  color: var(--c-gold-lt, #f4c542);
  font-weight: 600;
  text-decoration: none;
  transition: opacity var(--transition);
}
.footer-link:hover { opacity: .8; }

@media print {
  .site-footer { display: none !important; }
}
