:root {
  --bg: #f4f2ee;
  --surface: #ffffff;
  --surface-subtle: #faf9f7;
  --border: rgba(0, 0, 0, 0.09);
  --border-subtle: rgba(0, 0, 0, 0.05);
  --text: #111318;
  --muted: #64717a;
  --accent: #e8720a;
  --accent-strong: #c45e00;
  --accent-bg: rgba(232, 114, 10, 0.07);
  --secondary: #0aaa87;
  --secondary-strong: #088c70;
  --danger: #d93025;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 8px 28px rgba(0, 0, 0, 0.08);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05), 0 2px 8px rgba(0, 0, 0, 0.05);
  --radius-xl: 20px;
  --radius-lg: 16px;
  --radius-md: 10px;
  --radius-sm: 8px;
  --container: 1240px;
  --display-font: "Fraunces", Georgia, serif;
  --body-font: "Space Grotesk", "Avenir Next", "Segoe UI", sans-serif;
}

[data-theme="dark"] {
  --bg: #0e1116;
  --surface: #161b22;
  --surface-subtle: #121620;
  --border: rgba(255, 255, 255, 0.09);
  --border-subtle: rgba(255, 255, 255, 0.05);
  --text: #e6edf3;
  --muted: #7d8590;
  --accent: #f28b2c;
  --accent-strong: #e8720a;
  --accent-bg: rgba(242, 139, 44, 0.1);
  --secondary: #12c99e;
  --secondary-strong: #0daa85;
  --danger: #f85149;
  --shadow: 0 1px 3px rgba(0,0,0,0.3), 0 8px 28px rgba(0,0,0,0.4);
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.2), 0 2px 8px rgba(0,0,0,0.25);
}

[data-theme="dark"] body {
  background:
    radial-gradient(ellipse at 15% 0%, rgba(242, 139, 44, 0.06) 0%, transparent 42%),
    radial-gradient(ellipse at 85% 0%, rgba(18, 201, 158, 0.04) 0%, transparent 36%),
    var(--bg);
}

[data-theme="dark"] .cost-bar {
  background: rgba(22, 27, 34, 0.96);
}

[data-theme="dark"] .texture {
  background-image: radial-gradient(circle, rgba(255,255,255,0.04) 1px, transparent 1px);
}

/* ── Theme toggle button ── */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  font-size: 0.9rem;
  line-height: 1;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
  flex-shrink: 0;
}

.theme-toggle:hover {
  color: var(--accent);
  border-color: rgba(232, 114, 10, 0.3);
  background: var(--accent-bg);
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: var(--body-font);
  background:
    radial-gradient(ellipse at 15% 0%, rgba(232, 114, 10, 0.08) 0%, transparent 42%),
    radial-gradient(ellipse at 85% 0%, rgba(10, 170, 135, 0.06) 0%, transparent 36%),
    var(--bg);
}

a {
  color: inherit;
}

/* Subtle dot-grid texture — barely visible, adds depth */
.texture {
  pointer-events: none;
  position: fixed;
  inset: 0;
  background-image: radial-gradient(circle, rgba(0, 0, 0, 0.055) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: linear-gradient(180deg, rgba(0,0,0,0.5) 0%, transparent 60%);
}

/* Remove old unused backdrop divs gracefully */
.backdrop { display: none; }

/* ── Consulting strip ── */
.consulting-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.4rem 1.8rem;
  margin: 0 0 2rem;
}
.consulting-strip-heading {
  font-family: var(--display-font);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 0.2rem;
}
.consulting-strip-sub {
  font-size: 0.87rem;
  color: var(--muted);
  margin: 0;
}
.consulting-strip-cta {
  flex-shrink: 0;
  background: var(--accent);
  color: #fff;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.6rem 1.2rem;
  border-radius: var(--radius-md);
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.15s;
}
.consulting-strip-cta:hover { background: var(--accent-strong); }
@media (max-width: 600px) {
  .consulting-strip { flex-direction: column; align-items: flex-start; }
}

/* ── Cache+batch warning ── */
.cache-batch-warning {
  font-size: 0.82rem;
  color: var(--accent);
  background: var(--accent-bg);
  border: 1px solid rgba(232,114,10,0.2);
  border-radius: var(--radius-md);
  padding: 0.6rem 0.9rem;
  margin-top: 0.75rem;
  line-height: 1.55;
}

/* ── Footer expanded layout ── */
.site-footer {
  flex-wrap: wrap;
  row-gap: 0.5rem;
}

.footer-links {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.footer-link {
  font-size: 0.72rem;
  color: var(--muted);
  text-decoration: none;
  opacity: 0.75;
  transition: opacity 0.15s, color 0.15s;
}

.footer-link:hover {
  opacity: 1;
  color: var(--accent);
}

/* ── Container ── */

.container {
  width: min(calc(100% - 2rem), var(--container));
  margin: 0 auto;
}

/* ── Sticky cost bar ── */

.cost-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 52px;
  z-index: 50;
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 12px rgba(0, 0, 0, 0.07);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  transform: translateY(-100%);
  transition: transform 280ms cubic-bezier(0.33, 1, 0.68, 1);
  display: flex;
  align-items: center;
}

.cost-bar.cost-bar-visible {
  transform: translateY(0);
}

.cost-bar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.cost-bar-brand {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-shrink: 0;
}

.cost-bar-mark {
  color: var(--accent);
  font-size: 0.72rem;
}

.cost-bar-name {
  font-family: var(--display-font);
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: var(--text);
}

.cost-bar-center {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
}

.cost-bar-label {
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.cost-bar-value {
  font-family: var(--display-font);
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.02em;
}

.cost-bar-action {
  padding: 0.4rem 0.85rem;
  font-size: 0.8rem;
  flex-shrink: 0;
}

/* ── Brand lockup ── */

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 2.2rem;
}

.brand-lockup-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
}

.brand-nav {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  margin-left: 0.5rem;
  padding-left: 1rem;
  border-left: 1px solid var(--border);
}

.brand-nav-link {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  transition: color 0.15s, background 0.15s, border-color 0.15s;
}

.brand-nav-link:hover {
  color: var(--accent);
  background: var(--accent-bg);
  border-color: rgba(232, 114, 10, 0.3);
}

.brand-nav-link[aria-current="page"] {
  color: var(--accent);
  background: var(--accent-bg);
  border-color: rgba(232, 114, 10, 0.3);
}

.footer-brand-link {
  text-decoration: none;
  color: inherit;
}

.footer-brand-link:hover {
  color: var(--accent);
}

.brand-mark {
  color: var(--accent);
  font-size: 0.95rem;
  line-height: 1;
}

.brand-name {
  font-family: var(--display-font);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text);
}

/* ── Hero ── */

.hero {
  position: relative;
  z-index: 1;
  padding: 4.5rem 0 2.4rem;
  animation: rise-in 600ms ease-out both;
}

.hero h1 {
  margin: 0;
  font-family: var(--display-font);
  font-size: clamp(2.6rem, 5vw, 4.8rem);
  line-height: 1.02;
  letter-spacing: -0.04em;
  font-weight: 700;
  color: var(--text);
}

.hero-copy {
  margin: 1.5rem 0 0;
  max-width: 640px;
  color: var(--muted);
  font-size: clamp(0.95rem, 1.4vw, 1.08rem);
  line-height: 1.8;
}

.hero-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1.6rem;
}

.hero-chips span {
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 0.8rem;
  padding: 0.48rem 0.9rem;
  box-shadow: var(--shadow-sm);
}

.model-pill {
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-subtle);
  color: var(--muted);
  font-size: 0.82rem;
  padding: 0.48rem 0.9rem;
}

/* ── Sentinel ── */

#costBarSentinel {
  height: 1px;
  margin: 0;
}

/* ── Layout ── */

.layout {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.4rem;
  padding-bottom: 4rem;
  align-items: start;
}

/* ── Panels ── */

.panel {
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.controls-panel {
  padding: 1.5rem;
  animation: rise-in 700ms ease-out both;
}

.results-panel {
  position: sticky;
  top: 1.2rem;
  align-self: start;
  padding: 1.5rem;
  animation: rise-in 820ms ease-out both;
}

.panel-heading,
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
}

.panel-heading h2,
.section-header h3 {
  margin: 0;
  font-family: var(--display-font);
  letter-spacing: -0.03em;
  color: var(--text);
}

.panel-heading h2 {
  font-size: 1.6rem;
}

.section-header h3 {
  font-size: 1.1rem;
}

.panel-heading p,
.section-header p {
  color: var(--muted);
  margin: 0.25rem 0 0;
}

.panel-heading-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.5rem;
}

.section-kicker {
  margin: 0 0 0.5rem;
  color: var(--secondary-strong);
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-weight: 600;
}

/* ── Form ── */

.input-stack {
  display: grid;
  gap: 0.8rem;
  margin-top: 1.1rem;
}

.input-card,
.result-card,
.metric-card,
.scenario-card,
.summary-item {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  background: var(--surface-subtle);
}

.input-card,
.result-card {
  padding: 1.1rem;
}

/* Quick setup card — slightly distinguished */
.setup-card {
  border-color: rgba(232, 114, 10, 0.22);
  background: rgba(232, 114, 10, 0.03);
}

/* ── Advanced accordion ── */

.advanced-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.1rem 0;
}

.advanced-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-family: var(--body-font);
  font-size: 0.82rem;
  font-weight: 500;
  padding: 0.52rem 1rem;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: border-color 150ms ease, color 150ms ease, box-shadow 150ms ease;
  white-space: nowrap;
}

.advanced-toggle:hover {
  border-color: rgba(0, 0, 0, 0.18);
  color: var(--text);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.advanced-chevron {
  flex-shrink: 0;
  color: var(--muted);
  transition: transform 280ms ease;
}

.advanced-hint {
  margin: 0;
  font-size: 0.78rem;
  color: var(--muted);
}

.advanced-body {
  display: grid;
  gap: 0.8rem;
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  transition: max-height 400ms ease, opacity 260ms ease;
}

.advanced-body.advanced-open {
  max-height: 5000px;
  opacity: 1;
}

/* ── Field grid ── */

.field-grid {
  display: grid;
  gap: 0.8rem;
  margin-top: 0.95rem;
}

.field-grid-two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.field-grid-three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.38rem;
}

.field-label {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.84rem;
  font-weight: 500;
  color: var(--text);
}

.field-hint {
  font-size: 0.76rem;
  color: var(--muted);
  line-height: 1.4;
  margin-top: -0.1rem;
}

.badge-optional {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.1rem 0.4rem;
  margin-left: 0.5rem;
  vertical-align: middle;
}

/* ── Inputs & selects ── */

input,
select,
button {
  font: inherit;
}

input,
select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  min-height: 2.9rem;
  padding: 0.72rem 0.9rem;
  transition:
    border-color 150ms ease,
    box-shadow 150ms ease;
  appearance: auto;
}

input:hover,
select:hover {
  border-color: rgba(0, 0, 0, 0.18);
}

input:focus,
select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-bg);
}

.ghost-button {
  cursor: pointer;
  border: 1px solid rgba(232, 114, 10, 0.35);
  border-radius: 999px;
  background: var(--accent-bg);
  color: var(--accent-strong);
  padding: 0.55rem 1rem;
  font-size: 0.85rem;
  font-weight: 500;
  transition:
    background 140ms ease,
    border-color 140ms ease,
    box-shadow 140ms ease;
}

.ghost-button:hover {
  background: rgba(232, 114, 10, 0.13);
  border-color: rgba(232, 114, 10, 0.55);
  box-shadow: 0 2px 8px rgba(232, 114, 10, 0.15);
}

.helper-text {
  margin: 0.7rem 0 0;
  font-size: 0.8rem;
  line-height: 1.65;
  color: var(--muted);
}

/* ── Tooltips ── */

.tooltip-trigger {
  flex-shrink: 0;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1rem;
  height: 1rem;
  border: 1px solid rgba(0, 0, 0, 0.2);
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  font-size: 0.6rem;
  font-weight: 700;
  cursor: default;
  padding: 0;
  line-height: 1;
  transition: border-color 130ms ease, color 130ms ease;
}

.tooltip-trigger:hover,
.tooltip-trigger:focus {
  border-color: var(--secondary-strong);
  color: var(--secondary-strong);
  outline: none;
}

.tooltip-box {
  position: absolute;
  left: 50%;
  top: calc(100% + 0.5rem);
  transform: translateX(-50%);
  width: 260px;
  background: var(--text);
  color: rgba(255, 255, 255, 0.88);
  border-radius: var(--radius-md);
  font-size: 0.78rem;
  font-weight: 400;
  line-height: 1.65;
  padding: 0.7rem 0.9rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  opacity: 0;
  pointer-events: none;
  transition: opacity 140ms ease;
  z-index: 20;
  text-align: left;
  white-space: normal;
}

.tooltip-box.tooltip-above {
  top: auto;
  bottom: calc(100% + 0.5rem);
}

.tooltip-box.tooltip-visible {
  opacity: 1;
}

/* ── Metrics ── */

.metric-grid,
.scenario-grid,
.summary-grid {
  display: grid;
  gap: 0.8rem;
}

.metric-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 1rem;
}

.metric-card {
  padding: 1rem;
  background: var(--surface);
}

.metric-card-primary {
  background: linear-gradient(135deg, rgba(232, 114, 10, 0.07) 0%, rgba(10, 170, 135, 0.04) 100%);
  border-color: rgba(232, 114, 10, 0.18);
}

.metric-label {
  margin: 0;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--secondary-strong);
  font-weight: 600;
}

.metric-value,
.scenario-card strong,
.summary-item strong {
  display: block;
  margin-top: 0.45rem;
  font-size: clamp(1.3rem, 2.6vw, 1.9rem);
  letter-spacing: -0.04em;
  color: var(--text);
}

.metric-value {
  font-family: var(--display-font);
}

.metric-note {
  margin: 0.3rem 0 0;
  font-size: 0.75rem;
  color: var(--muted);
}

/* ── Cost narrative ── */

.cost-narrative {
  margin: 0.9rem 0 0;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--surface-subtle);
  font-size: 0.85rem;
  line-height: 1.7;
  color: var(--muted);
}

.cost-narrative:empty {
  display: none;
}

/* ── Scenario ── */

.scenario-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 1rem;
}

.scenario-card {
  padding: 0.9rem;
  background: var(--surface);
}

.scenario-card-highlight {
  border-color: rgba(232, 114, 10, 0.25);
  background: rgba(232, 114, 10, 0.05);
}

.scenario-label {
  display: block;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  font-weight: 600;
}

.scenario-note {
  display: block;
  margin-top: 0.3rem;
  font-size: 0.72rem;
  color: var(--muted);
}

/* ── Summary ── */

.summary-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 1rem;
}

.summary-item {
  padding: 0.85rem;
  background: var(--surface);
}

.summary-label {
  display: block;
  font-size: 0.75rem;
  color: var(--muted);
  margin-bottom: 0.25rem;
}

/* ── Breakdown bars ── */

.breakdown-list {
  display: grid;
  gap: 0.7rem;
  margin-top: 1rem;
}

.breakdown-row {
  display: grid;
  gap: 0.32rem;
}

.breakdown-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
}

.breakdown-name {
  font-size: 0.88rem;
  color: var(--text);
}

.breakdown-value {
  color: var(--accent-strong);
  font-weight: 600;
  font-size: 0.88rem;
}

.breakdown-track {
  overflow: hidden;
  border-radius: 999px;
  height: 0.45rem;
  background: rgba(0, 0, 0, 0.07);
}

.breakdown-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--secondary));
  transform-origin: left center;
  animation: expand 600ms ease both;
}

.breakdown-group-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text);
  margin: 1rem 0 0.4rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.breakdown-group-label--operating {
  color: var(--muted);
}

.breakdown-group-note {
  font-size: 0.68rem;
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
  color: var(--muted);
}

.breakdown-note {
  font-size: 0.7rem;
  color: var(--muted);
  font-style: italic;
  margin-left: 0.3rem;
}

.definition-box {
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1rem 1.2rem;
  margin-bottom: 1.25rem;
  font-size: 0.83rem;
  color: var(--muted);
  line-height: 1.65;
}

.definition-box p {
  margin: 0 0 0.5rem;
}

.definition-box p:last-child {
  margin-bottom: 0;
}

.definition-box-title {
  font-weight: 600;
  color: var(--text);
  font-size: 0.82rem;
}

/* ── Charts ── */

.chart-container {
  position: relative;
  width: 100%;
}

.chart-container--donut {
  width: 180px;
  flex-shrink: 0;
  align-self: flex-start;
}

.breakdown-chart-layout {
  display: flex;
  gap: 1.5rem;
  align-items: flex-start;
  margin-top: 1rem;
}

.breakdown-chart-layout .breakdown-list {
  flex: 1;
  min-width: 0;
  margin-top: 0;
}

@media (max-width: 520px) {
  .breakdown-chart-layout {
    flex-direction: column;
  }
  .chart-container--donut {
    width: 100%;
    max-height: 200px;
  }
}

/* ── Insight ── */

.insight-copy {
  display: grid;
  gap: 0.6rem;
  margin-top: 0.75rem;
}

.insight-copy p {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.72;
  color: var(--muted);
}

/* ── Sources ── */

.source-list {
  display: grid;
  gap: 0.65rem;
  padding-left: 1rem;
  margin: 0.8rem 0 0;
  font-size: 0.85rem;
}

.source-list a {
  color: var(--muted);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: color 130ms ease, border-color 130ms ease;
}

.source-list a:hover {
  color: var(--accent-strong);
  border-color: rgba(196, 94, 0, 0.35);
}

/* ── Profitability ── */

.profit-positive { color: var(--secondary-strong); }
.profit-negative { color: var(--danger); }

/* ── Footer ── */

.site-footer {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 1.4rem 0 3rem;
  font-size: 0.78rem;
  color: var(--muted);
  opacity: 0.55;
}

.footer-mark {
  color: var(--accent);
  font-size: 0.65rem;
}

.footer-name {
  font-family: var(--display-font);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.footer-sep {
  opacity: 0.4;
}

.footer-disclaimer {
  font-size: 0.72rem;
  opacity: 0.7;
  max-width: 560px;
  line-height: 1.5;
}

/* ── Toast ── */

.toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(0.75rem);
  background: var(--text);
  color: rgba(255, 255, 255, 0.9);
  font-size: 0.85rem;
  padding: 0.62rem 1.3rem;
  border-radius: 999px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.22);
  opacity: 0;
  transition: opacity 240ms ease, transform 240ms ease;
  z-index: 100;
  pointer-events: none;
}

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

/* ── Animations ── */

@keyframes rise-in {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes expand {
  from { transform: scaleX(0); }
  to   { transform: scaleX(1); }
}

/* ── Responsive: tablet (≤1120px) ── */

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

  /* Results sit BELOW inputs — inputs always come first */
  .results-panel {
    position: static;
  }

  /* Cost bar always visible on tablet/mobile — it's how users track their number */
  .cost-bar {
    transform: translateY(0);
  }

  body {
    padding-top: 52px;
  }

  .field-grid-three {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* ── Responsive: mobile (≤720px) ── */

@media (max-width: 720px) {
  .hero {
    padding-top: 2.8rem;
  }

  .hero h1 {
    font-size: clamp(2.2rem, 8vw, 3rem);
  }

  .controls-panel,
  .results-panel {
    padding: 1rem;
  }

  .field-grid-two,
  .field-grid-three,
  .metric-grid,
  .scenario-grid,
  .summary-grid {
    grid-template-columns: 1fr;
  }

  .panel-heading,
  .section-header {
    flex-direction: column;
    gap: 0.6rem;
  }

  .ghost-button {
    width: 100%;
    text-align: center;
    justify-content: center;
  }

  .advanced-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.35rem;
  }

  .cost-bar-label {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
