/* ===========================================================================
   Bioforcetech Web Design System — applied to the plant configurator.
   Two typefaces (Archivo + IBM Plex Sans, IBM Plex Mono for numbers/IDs),
   one accent (#14507D), warm-neutral ground, dark ink theme. Sharp containers
   (0 radius); only controls earn 3 px. Rules do the work of shadows.
=========================================================================== */
:root {
  /* Type */
  --font-display: Archivo, system-ui, sans-serif;
  --font-text: "IBM Plex Sans", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  /* Light theme */
  --ink: #1b1f21;
  --text: #23282b;
  --muted: #6b7275;
  --rule: #dcdad4;
  --surface: #f7f7f4;
  --surface-warm: #f2f1ed;
  --highlight: #eaf1f7;
  --paper: #ffffff;
  --accent: #14507d;
  --accent-light: #3b85c4;
  --accent-hover: #0f3d60;
  --accent-press: #0b2e49;
  --focus: #3b85c4;
  --disabled: #e4e2dc;
  --disabled-text: #9a9d99;
  --input-border: #c9c6be;
  --success: #1e7a4f;
  --warning: #9a6408;
  --critical: #a3301f;
  --brand-tint: #acc7e1;

  /* Dark theme (the ink ground promoted to a full theme) */
  --d-bg: #1b1f21;
  --d-surface: #23282b;
  --d-surface-raised: #2b3134;
  --d-rule: #343a3d;
  --d-text: #dce6ee;
  --d-muted: #9fb4c2;
  --d-label: #8fb6d6;
  --d-accent: #3b85c4;

  /* Radius / elevation / motion */
  --radius: 3px;
  --shadow-raised: 0 1px 2px rgb(27 31 33 / 0.06);
  --shadow-overlay: 0 8px 24px rgb(27 31 33 / 0.12);
  --ease: cubic-bezier(0.2, 0, 0, 1);
  --dur-fast: 120ms;
  --dur-mid: 180ms;

  color-scheme: light;
  background: var(--surface-warm);
  color: var(--text);
  font-family: var(--font-text);
  -webkit-font-smoothing: antialiased;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  overflow-x: hidden;
  background: var(--surface-warm);
  color: var(--text);
  font-family: var(--font-text);
}

body.auth-page {
  display: grid;
  place-items: center;
  padding: 20px;
  background: var(--surface-warm);
}

h1,
h2,
h3,
h4 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(1.5rem, 2.4vw, 2.1rem);
  line-height: 1.08;
}

h2 {
  font-size: 1.5rem;
  line-height: 1.15;
}

button {
  font: inherit;
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    animation: none !important;
  }
}

/* ---------------------------------------------------------------------------
   App shell — scrolling left column, sticky calculator panel
--------------------------------------------------------------------------- */
.app-shell {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(380px, 1fr);
  grid-template-rows: 100vh auto;
  width: 100%;
}

.viewer-stage {
  grid-column: 1;
  grid-row: 1;
  position: relative;
  width: 100%;
  height: 100vh;
  overflow: hidden;
  background: linear-gradient(180deg, #f4f4f1 0%, #eef0ec 60%, #e7e9e4 100%);
}

.impact-section {
  grid-column: 1;
  grid-row: 2;
}

.calculator-panel {
  grid-column: 2;
  grid-row: 1 / 3;
  position: sticky;
  top: 0;
  align-self: start;
}

#plant-canvas {
  display: block;
  width: 100%;
  height: 100%;
}

/* Floating chrome over the viewer */
.topbar,
.viewer-toolbar,
.plant-name-sign,
.measurement-overlay,
.measurement-hint,
.loading,
.auth-gate,
.scroll-cue {
  position: absolute;
  z-index: 2;
}

.topbar {
  top: 20px;
  left: 20px;
  right: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  pointer-events: none;
}

/* Ink chrome cards — flat, 1 px rule, no blur (DS: chrome is ink or paper) */
.plant-data-card,
.model-status-card,
.session-chip,
.configuration-switcher,
.viewer-toolbar {
  border: 1px solid var(--d-rule);
  background: var(--ink);
  box-shadow: var(--shadow-overlay);
}

.plant-data-card {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 20px;
  min-width: 540px;
  padding: 12px 16px;
  border-radius: 0;
}

.model-status-card {
  display: grid;
  grid-template-columns: minmax(135px, 1.1fr) repeat(3, minmax(0, 1fr));
  align-items: center;
  width: 100%;
  min-width: 0;
  padding: 14px 18px;
  border-radius: 0;
}

.status-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
  padding-right: 16px;
}

.status-brand img {
  width: 52px;
  height: 52px;
  flex: 0 0 auto;
  object-fit: contain;
}

.status-brand > div {
  min-width: 0;
}

.status-brand .eyebrow {
  margin-bottom: 4px;
}

.status-brand #viewer-limit-note {
  margin: 0;
  color: var(--d-muted);
  font-size: 0.62rem;
  line-height: 1.3;
}

.status-metric {
  min-width: 0;
  padding: 2px 16px;
  border-left: 1px solid var(--d-rule);
}

.status-value {
  display: flex;
  align-items: baseline;
  gap: 7px;
  min-width: 0;
}

.status-value strong {
  color: var(--d-accent);
  font-family: var(--font-display);
  font-size: 1.7rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.status-metric-reduction .status-value strong {
  color: var(--d-text);
}

.status-value span {
  overflow: hidden;
  font-family: var(--font-display);
  font-size: 0.82rem;
  font-weight: 600;
  text-overflow: ellipsis;
}

/* Status badges — 3 px radius, tinted ground, 1 px border, label text */
.status-value .capacity-label {
  flex: 0 0 auto;
  padding: 3px 6px;
  border: 1px solid rgba(59, 133, 196, 0.4);
  border-radius: var(--radius);
  color: var(--d-label);
  background: rgba(59, 133, 196, 0.12);
  font-family: var(--font-mono);
  font-size: 0.56rem;
  line-height: 1;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.status-value .capacity-label[data-mode="pilot"] {
  border-color: rgba(154, 100, 8, 0.5);
  color: #d4a24e;
  background: rgba(154, 100, 8, 0.16);
}

.status-value .capacity-label[data-mode="expansion"] {
  border-color: rgba(59, 133, 196, 0.4);
  color: var(--d-label);
  background: rgba(59, 133, 196, 0.12);
}

.status-metric small {
  display: block;
  min-height: 1em;
  margin-top: 6px;
  overflow: hidden;
  color: var(--d-muted);
  font-family: var(--font-mono);
  font-size: 0.62rem;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.plant-data-heading {
  padding-right: 18px;
  border-right: 1px solid var(--d-rule);
}

.plant-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  margin: 0;
}

.plant-metrics div {
  min-width: 0;
}

.plant-metrics dt {
  margin-bottom: 3px;
  color: var(--d-label);
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.plant-metrics dd {
  display: grid;
  gap: 1px;
  margin: 0;
}

.plant-metrics strong {
  color: var(--d-text);
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.plant-metrics span {
  color: var(--d-muted);
  font-size: 0.7rem;
  line-height: 1.2;
  white-space: nowrap;
}

.session-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 260px;
  padding: 8px;
  border-radius: 0;
  pointer-events: auto;
}

.session-chip span {
  min-width: 0;
  overflow: hidden;
  color: var(--d-text);
  font-size: 0.86rem;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.session-chip button,
.auth-card button {
  min-height: 36px;
  border: 1px solid var(--d-rule);
  border-radius: var(--radius);
  color: var(--d-text);
  background: transparent;
  cursor: pointer;
}

.session-chip button {
  flex: 0 0 auto;
  padding: 0 10px;
}

/* Eyebrow — grey caps, IBM Plex Sans 600 (never coloured) */
.eyebrow {
  margin: 0 0 3px;
  color: var(--d-muted);
  font-family: var(--font-text);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.plant-controls {
  display: grid;
  gap: 8px;
  pointer-events: auto;
}

.configuration-switcher {
  display: grid;
  grid-template-columns: repeat(3, minmax(102px, 1fr));
  gap: 8px;
  min-width: 338px;
  padding: 8px;
  border-radius: 0;
}

/* Toolbar — ink container, controls get 3 px radius */
.viewer-toolbar {
  top: 124px;
  left: 20px;
  display: grid;
  justify-items: center;
  gap: 8px;
  padding: 8px;
  border-radius: 0;
  pointer-events: auto;
}

.view-buttons {
  display: grid;
  gap: 8px;
}

.toolbar-divider {
  display: block;
  width: 28px;
  height: 1px;
  margin: 1px 0;
  background: var(--d-rule);
}

.configuration-switcher button,
.viewer-toolbar button {
  position: relative;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--d-rule);
  border-radius: var(--radius);
  color: var(--d-text);
  background: transparent;
  cursor: pointer;
  transition:
    border-color var(--dur-fast) var(--ease),
    background var(--dur-fast) var(--ease);
}

.viewer-toolbar button::before,
.viewer-toolbar button::after {
  position: absolute;
  z-index: 50;
  opacity: 0;
  pointer-events: none;
  transition:
    opacity var(--dur-fast) var(--ease),
    transform var(--dur-fast) var(--ease);
}

.viewer-toolbar button::before {
  content: "";
  top: 50%;
  left: calc(100% + 7px);
  border-width: 6px 7px 6px 0;
  border-style: solid;
  border-color: transparent var(--ink) transparent transparent;
  transform: translate(5px, -50%);
}

.viewer-toolbar button::after {
  content: attr(data-tooltip);
  top: 50%;
  left: calc(100% + 14px);
  min-width: max-content;
  max-width: 250px;
  padding: 9px 12px;
  border: 1px solid var(--d-rule);
  border-radius: var(--radius);
  color: var(--d-text);
  background: var(--ink);
  box-shadow: var(--shadow-overlay);
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1.15;
  text-align: left;
  white-space: nowrap;
  transform: translate(5px, -50%);
}

.viewer-toolbar button:hover::before,
.viewer-toolbar button:hover::after,
.viewer-toolbar button:focus::before,
.viewer-toolbar button:focus::after,
.viewer-toolbar button:focus-visible::before,
.viewer-toolbar button:focus-visible::after {
  opacity: 1;
  transform: translate(0, -50%);
}

.viewer-toolbar svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: butt;
  stroke-linejoin: miter;
}

.configuration-switcher button:hover,
.viewer-toolbar button:hover {
  border-color: var(--d-accent);
  background: rgba(59, 133, 196, 0.12);
}

.configuration-switcher button[aria-pressed="true"],
.viewer-toolbar button[aria-pressed="true"] {
  border-color: var(--d-accent);
  color: #fff;
  background: rgba(59, 133, 196, 0.22);
}

.viewer-toolbar button:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.viewer-toolbar button:disabled {
  opacity: 0.38;
  cursor: not-allowed;
}

/* Plant name sign — ink plate, accent rule marker */
.plant-name-sign {
  right: 20px;
  bottom: 20px;
  display: grid;
  justify-items: end;
  min-width: 300px;
  max-width: min(560px, calc(100% - 120px));
  padding: 20px 26px;
  border: 1px solid var(--d-rule);
  border-top: 2px solid var(--d-accent);
  color: var(--d-text);
  background: var(--ink);
  box-shadow: var(--shadow-overlay);
  text-align: right;
}

.plant-name-sign span {
  margin-top: 7px;
  color: var(--d-label);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.plant-name-sign input {
  width: 100%;
  min-width: 0;
  padding: 0 0 7px;
  border: 0;
  border-bottom: 1px solid var(--d-rule);
  border-radius: 0;
  outline: none;
  overflow: hidden;
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 3vw, 2.4rem);
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.01em;
  overflow-wrap: anywhere;
  color: var(--d-text);
  background: transparent;
  text-align: right;
}

.plant-name-sign input::placeholder {
  color: var(--d-text);
  opacity: 1;
}

.plant-name-sign input:focus {
  border-bottom-color: var(--d-accent);
}

.plant-name-sign input[aria-invalid="true"] {
  border-bottom-color: #e07a5f;
}

/* Measurement */
.measurement-overlay {
  inset: 0;
  z-index: 3;
  overflow: hidden;
  pointer-events: none;
}

.measurement-label {
  position: absolute;
  padding: 6px 10px;
  border: 1px solid var(--d-rule);
  color: var(--d-text);
  background: var(--ink);
  box-shadow: var(--shadow-overlay);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  transform: translate(-50%, -50%);
}

.measurement-hint {
  left: 50%;
  bottom: 24px;
  z-index: 4;
  margin: 0;
  padding: 9px 13px;
  border: 1px solid var(--d-rule);
  color: var(--d-text);
  background: var(--ink);
  box-shadow: var(--shadow-overlay);
  font-size: 0.72rem;
  font-weight: 500;
  transform: translateX(-50%);
  pointer-events: none;
}

.viewer-stage.is-measuring #plant-canvas {
  cursor: crosshair;
}

/* Loading + auth gate — ink ground */
.loading {
  inset: 0;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 18px;
  background: var(--d-bg);
  transition:
    opacity 320ms ease,
    visibility 320ms ease;
}

.loading.is-hidden {
  opacity: 0;
  visibility: hidden;
}

.auth-gate {
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: var(--surface-warm);
}

.auth-gate.is-hidden {
  display: none;
}

.auth-card {
  width: min(420px, calc(100vw - 40px));
  padding: 24px;
  border: 1px solid var(--rule);
  border-top: 2px solid var(--accent);
  color: var(--text);
  background: var(--paper);
  box-shadow: var(--shadow-overlay);
}

.auth-card h1,
.auth-card h2 {
  margin: 0;
}

.auth-card p:not(.eyebrow) {
  margin: 12px 0 18px;
  color: var(--muted);
  line-height: 1.6;
}

.auth-card .eyebrow {
  color: var(--muted);
}

.auth-card button {
  width: 100%;
  padding: 0 14px;
  min-height: 44px;
  border-color: var(--accent);
  color: #fff;
  background: var(--accent);
  font-weight: 600;
}

.loader-ring {
  width: 52px;
  height: 52px;
  border: 3px solid var(--d-rule);
  border-top-color: var(--d-accent);
  border-radius: 50%;
  animation: spin 900ms linear infinite;
}

.loading p {
  margin: 0;
  color: var(--d-muted);
}

/* ---------------------------------------------------------------------------
   Calculator panel — paper on warm ground
--------------------------------------------------------------------------- */
.calculator-panel {
  height: 100vh;
  min-width: 0;
  overflow-y: auto;
  padding: 26px 24px 34px;
  border-left: 1px solid var(--rule);
  color: var(--text);
  background: var(--surface-warm);
  font-family: var(--font-text);
  scrollbar-color: var(--input-border) transparent;
  scrollbar-width: thin;
}

.calculator-header {
  margin-bottom: 16px;
}

.calculator-header h2 {
  color: var(--text);
  font-family: var(--font-display);
  font-size: clamp(1.25rem, 1.8vw, 1.5rem);
  font-weight: 600;
  line-height: 1.15;
}

.plant-name-field {
  display: block;
  margin-top: 13px;
}

.plant-name-field > span {
  display: block;
  margin-bottom: 8px;
  color: var(--text);
  font-size: 0.81rem;
  font-weight: 600;
}

.plant-name-field input {
  width: 100%;
  min-height: 44px;
  padding: 11px 12px;
  border: 1px solid var(--input-border);
  border-radius: var(--radius);
  outline: none;
  color: var(--text);
  background: var(--paper);
  font: inherit;
  font-size: 0.9rem;
  transition:
    border-color var(--dur-mid) var(--ease),
    box-shadow var(--dur-mid) var(--ease);
}

.plant-name-field input::placeholder {
  color: var(--muted);
}

.plant-name-field input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(20, 80, 125, 0.12);
}

.dry-solids-summary {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  padding: 0 3px;
  color: var(--muted);
  font-size: 0.75rem;
}

.dry-solids-summary strong {
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

/* Figure grid — hairlines from 1 px gaps over a rule-coloured ground */
.calculator-results-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  margin-bottom: 16px;
  border: 1px solid var(--rule);
  background: var(--rule);
}

.calculator-result {
  min-width: 0;
  padding: 14px 12px;
  background: var(--paper);
}

.calculator-result-gold {
  border-top: 2px solid var(--accent);
}

.calculator-result > span,
.plant-output-card > span,
.sigma-summary > span {
  display: block;
  color: var(--muted);
  font-size: 0.64rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.calculator-result > div:nth-of-type(1) {
  display: flex;
  align-items: baseline;
  gap: 4px;
  margin-top: 9px;
}

.calculator-result strong {
  min-width: 0;
  color: var(--accent);
  font-family: var(--font-display);
  font-size: clamp(1.15rem, 1.7vw, 1.6rem);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
  line-height: 1;
}

.calculator-result em {
  color: var(--muted);
  font-size: 0.72rem;
  font-style: normal;
}

.calculator-result small {
  display: block;
  min-height: 2.4em;
  margin-top: 7px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.66rem;
  line-height: 1.2;
}

.calculator-card,
.json-output {
  border: 1px solid var(--rule);
  border-radius: 0;
  background: var(--paper);
}

.calculator-card {
  margin-bottom: 16px;
  padding: 20px;
}

/* Fieldsets */
.segmented-field {
  min-width: 0;
  margin: 0 0 16px;
  padding: 0;
  border: 0;
}

.segmented-field legend {
  margin-bottom: 8px;
  color: var(--text);
  font-size: 0.8rem;
  font-weight: 600;
}

/* Segmented control — 2-4 mutually exclusive options */
.segmented-control {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 3px;
  padding: 3px;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--surface);
}

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

.segmented-control button {
  min-width: 0;
  min-height: 34px;
  padding: 5px 7px;
  border: 0;
  border-radius: var(--radius);
  color: var(--muted);
  background: transparent;
  font-size: 0.75rem;
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease);
}

.segmented-control [data-system][aria-pressed="true"],
.segmented-control [data-mode][aria-pressed="true"] {
  color: #fff;
  background: var(--accent);
}

/* Sliders */
.slider-field {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-top: 20px;
  margin-bottom: 9px;
  color: var(--text);
  font-size: 0.8rem;
  font-weight: 600;
}

.slider-field output {
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 0.95rem;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.slider-field output small {
  color: var(--muted);
  font-size: 0.62rem;
  font-weight: 400;
}

.slider-field[for="wet-tons"],
.slider-field[for="dry-content"] {
  font-size: 0.9rem;
}

.slider-field[for="wet-tons"] output,
.slider-field[for="dry-content"] output {
  font-size: 1.15rem;
}

.slider-field[for="wet-tons"] output small,
.slider-field[for="dry-content"] output small {
  font-size: 0.7rem;
}

.calculator-slider {
  width: 100%;
  height: 4px;
  margin: 5px 0 0;
  border-radius: 999px;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  background: linear-gradient(
    to right,
    var(--accent) 0%,
    var(--accent) var(--fill, 50%),
    var(--rule) var(--fill, 50%),
    var(--rule) 100%
  );
  cursor: pointer;
}

.calculator-slider::-webkit-slider-thumb {
  width: 18px;
  height: 18px;
  border: 2px solid var(--paper);
  border-radius: 50%;
  appearance: none;
  -webkit-appearance: none;
  background: var(--accent);
  box-shadow: var(--shadow-raised);
}

.calculator-slider::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border: 2px solid var(--paper);
  border-radius: 50%;
  background: var(--accent);
  box-shadow: var(--shadow-raised);
}

.calculator-slider:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 4px;
}

.slider-bounds {
  display: flex;
  justify-content: space-between;
  margin-top: 6px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.62rem;
}

.input-conversions {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--rule);
}

.input-conversions h3 {
  margin: 0 0 11px;
  color: var(--muted);
  font-family: var(--font-text);
  font-size: 0.64rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.input-conversions dl {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  margin: 0;
  border: 1px solid var(--rule);
  background: var(--rule);
}

.input-conversions dl > div {
  min-width: 0;
  padding: 10px 11px;
  background: var(--surface);
}

.input-conversions dt {
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 0.62rem;
}

.input-conversions dd {
  margin: 0;
  overflow: hidden;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Plant output — accent-marked callout */
.plant-output-card > span {
  margin-bottom: 8px;
}

.plant-output {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 15px 16px;
  border-left: 3px solid var(--accent);
  color: var(--text);
  background: var(--surface-warm);
}

.plant-output.with-sigma {
  border-left-color: var(--ink);
}

.plant-output strong {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
}

.plant-output output {
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 0.9rem;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.plant-output.with-sigma output {
  color: var(--text);
}

.sigma-summary {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 3px 12px;
  margin-top: 13px;
  padding: 12px 4px 0;
  border-top: 1px solid var(--rule);
}

.sigma-summary strong {
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
}

.sigma-summary small {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 0.68rem;
}

.equipment-modifiers {
  margin-top: 17px;
  padding-top: 16px;
  border-top: 1px solid var(--rule);
}

.equipment-modifiers > header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.equipment-modifiers h3 {
  margin: 0;
  color: var(--text);
  font-family: var(--font-text);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.equipment-modifiers > header span {
  color: var(--muted);
  font-size: 0.63rem;
}

.equipment-modifier + .equipment-modifier {
  margin-top: 18px;
  padding-top: 17px;
  border-top: 1px solid var(--rule);
}

.equipment-modifier label {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  color: var(--text);
  font-size: 0.8rem;
  font-weight: 600;
}

.equipment-modifier output {
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 0.86rem;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.modifier-slider-shell {
  --fill: 50%;
  --recommended: 50%;
  position: relative;
  height: 22px;
}

.modifier-slider {
  position: relative;
  z-index: 2;
  width: 100%;
  height: 4px;
  margin: 8px 0 0;
  border-radius: 999px;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  background: linear-gradient(
    to right,
    var(--accent) 0%,
    var(--accent) var(--fill),
    var(--rule) var(--fill),
    var(--rule) 100%
  );
  cursor: pointer;
}

.modifier-slider::-webkit-slider-thumb {
  width: 18px;
  height: 18px;
  border: 2px solid var(--paper);
  border-radius: 50%;
  appearance: none;
  -webkit-appearance: none;
  background: var(--accent);
  box-shadow: var(--shadow-raised);
}

.modifier-slider::-moz-range-thumb {
  width: 15px;
  height: 15px;
  border: 2px solid var(--paper);
  border-radius: 50%;
  background: var(--accent);
  box-shadow: var(--shadow-raised);
}

.modifier-slider:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 4px;
}

.modifier-slider-shell i {
  position: absolute;
  z-index: 1;
  top: 3px;
  left: var(--recommended);
  width: 2px;
  height: 16px;
  background: var(--accent-light);
  transform: translateX(-1px);
}

.modifier-scale {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.58rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.modifier-scale strong {
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 0.58rem;
  text-align: center;
}

.modifier-scale span:last-child {
  text-align: right;
}

.equipment-modifier > p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 600;
  text-align: right;
}

.equipment-modifier > p[data-mode="pilot"] {
  color: var(--warning);
}

.equipment-modifier > p[data-mode="expansion"] {
  color: var(--accent);
}

.assumptions-note {
  margin: 18px 2px;
  padding-left: 14px;
  border-left: 2px solid var(--rule);
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.6;
}

.json-output {
  overflow: hidden;
}

.json-output summary {
  padding: 13px 15px;
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
}

.json-output pre {
  max-height: 360px;
  overflow: auto;
  margin: 0;
  padding: 14px 16px;
  border-top: 1px solid var(--rule);
  color: var(--d-text);
  background: var(--ink);
  font-family: var(--font-mono);
  font-size: 0.66rem;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ---------------------------------------------------------------------------
   Scroll cue on the viewer
--------------------------------------------------------------------------- */
.scroll-cue {
  left: 20px;
  bottom: 20px;
  z-index: 3;
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  gap: 13px;
  width: auto;
  min-width: 220px;
  padding: 14px 20px;
  border: 1px solid var(--d-accent);
  color: #fff;
  background: var(--d-accent);
  box-shadow: var(--shadow-overlay);
  font-family: var(--font-text);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  transform: translateY(0);
  transition:
    transform 200ms var(--ease),
    opacity 200ms var(--ease);
}

.scroll-cue svg {
  width: 42px;
  height: 14px;
  fill: none;
  stroke: #fff;
  stroke-width: 1.5;
  stroke-linecap: butt;
  stroke-linejoin: miter;
  animation: scroll-bob 1.7s ease-in-out infinite;
}

.scroll-cue:hover {
  color: #fff;
  border-color: var(--d-accent);
  background: var(--d-accent);
  transform: translateY(-2px);
}

.viewer-stage.is-measuring .scroll-cue {
  opacity: 0;
  pointer-events: none;
}

@keyframes scroll-bob {
  0%,
  100% {
    transform: translateY(-2px);
  }
  50% {
    transform: translateY(2px);
  }
}

/* ---------------------------------------------------------------------------
   Contact modal
--------------------------------------------------------------------------- */

body.modal-open {
  overflow: hidden;
}

.contact-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 20px;
}

.contact-backdrop {
  position: absolute;
  inset: 0;
  background: rgb(27 31 33 / 0.5);
}

.contact-dialog {
  position: relative;
  z-index: 1;
  width: min(520px, 100%);
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  padding: 30px clamp(22px, 4vw, 36px) 28px;
  border: 1px solid var(--rule);
  border-top: 2px solid var(--accent);
  color: var(--text);
  background: var(--paper);
  box-shadow: var(--shadow-overlay);
  font-family: var(--font-text);
  animation: contact-pop 200ms var(--ease);
}

@keyframes contact-pop {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

.contact-close {
  position: absolute;
  top: 14px;
  right: 14px;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid var(--input-border);
  border-radius: var(--radius);
  color: var(--muted);
  background: var(--paper);
  cursor: pointer;
  transition:
    border-color var(--dur-mid) var(--ease),
    color var(--dur-mid) var(--ease);
}

.contact-close svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: butt;
}

.contact-close:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.contact-form-header {
  margin-bottom: 18px;
  padding-right: 34px;
}

.contact-eyebrow-sm {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.contact-form-header h2 {
  color: var(--text);
  font-family: var(--font-display);
  font-size: clamp(1.25rem, 2.4vw, 1.6rem);
  font-weight: 600;
  line-height: 1.15;
}

.contact-form-sub {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.6;
}

.contact-field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

.contact-field {
  display: block;
}

.contact-field > span {
  display: block;
  margin-bottom: 8px;
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 600;
}

.contact-field > span i {
  color: var(--critical);
  font-style: normal;
}

.contact-field input,
.contact-field textarea,
.contact-field select {
  width: 100%;
  min-height: 44px;
  padding: 11px 12px;
  border: 1px solid var(--input-border);
  border-radius: var(--radius);
  outline: none;
  color: var(--text);
  background: var(--paper);
  font: inherit;
  font-size: 0.88rem;
  font-variant-numeric: tabular-nums;
  transition:
    border-color var(--dur-mid) var(--ease),
    box-shadow var(--dur-mid) var(--ease);
}

.contact-cost-field {
  display: grid;
  grid-template-columns: minmax(92px, 0.38fr) minmax(0, 1fr);
  gap: 8px;
}

.contact-field textarea {
  min-height: 84px;
  line-height: 1.5;
  resize: vertical;
}

.contact-field select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b7275' stroke-width='1.5'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 11px center;
  background-size: 16px;
  cursor: pointer;
}

.contact-field input:focus,
.contact-field textarea:focus,
.contact-field select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(20, 80, 125, 0.12);
}

.contact-group {
  margin: 0 0 6px;
  padding: 0;
  border: 0;
}

.contact-group legend {
  margin-bottom: 10px;
  padding: 0;
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.contact-field-wide {
  grid-column: 1 / -1;
}

.contact-config-toggle {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 4px 0 10px;
  color: var(--text);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
}

.contact-config-toggle input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

.contact-config-preview {
  margin: 0;
  padding: 12px 13px;
  border: 1px solid var(--rule);
  color: var(--text);
  background: var(--surface);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}

/* Primary button (one per view) */
.contact-submit {
  width: 100%;
  min-height: 48px;
  margin-top: 14px;
  padding: 0 20px;
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  color: #fff;
  background: var(--accent);
  box-shadow: var(--shadow-raised);
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition:
    background var(--dur-fast) var(--ease),
    transform var(--dur-mid) var(--ease);
}

.contact-submit:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  transform: translateY(-1px);
}

.contact-submit:active {
  background: var(--accent-press);
  box-shadow: none;
}

.contact-submit:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.contact-form-note {
  margin: 11px 0 0;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.55;
  text-align: center;
}

.contact-success {
  padding: 14px 6px 6px;
  text-align: center;
}

.contact-success-icon {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  margin: 0 auto 16px;
  border: 1px solid rgba(30, 122, 79, 0.4);
  border-radius: 50%;
  background: rgba(30, 122, 79, 0.1);
}

.contact-success-icon svg {
  width: 26px;
  height: 26px;
  fill: none;
  stroke: var(--success);
  stroke-width: 1.75;
  stroke-linecap: butt;
  stroke-linejoin: miter;
}

.contact-success h2 {
  color: var(--text);
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 600;
}

.contact-success p {
  margin: 10px auto 20px;
  max-width: 360px;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.6;
}

@media (max-width: 520px) {
  .contact-field-grid {
    grid-template-columns: 1fr;
  }
}

/* ---------------------------------------------------------------------------
   Plant impact section (below the fold) — dark ink theme
--------------------------------------------------------------------------- */
.impact-section {
  color-scheme: dark;
  display: flex;
  align-items: center;
  min-height: 100vh;
  padding: clamp(48px, 6vw, 88px) clamp(20px, 5vw, 56px) clamp(56px, 7vw, 104px);
  color: var(--d-text);
  background: var(--d-bg);
  border-top: 2px solid var(--d-accent);
  font-family: var(--font-text);
}

.impact-inner {
  display: grid;
  gap: clamp(24px, 3.2vw, 40px);
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
}

.impact-header {
  text-align: center;
}

.impact-eyebrow {
  margin: 0 0 10px;
  color: var(--d-muted);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.impact-title {
  font-family: var(--font-display);
  font-size: clamp(1.9rem, 4.4vw, 3.1rem);
  font-weight: 600;
  line-height: 1.05;
  letter-spacing: -0.015em;
}

.impact-title #impact-plant-name {
  color: var(--d-accent);
  overflow-wrap: anywhere;
}

.impact-sub {
  margin: 12px 0 0;
  color: var(--d-muted);
  font-size: clamp(0.9rem, 1.6vw, 1.05rem);
  font-weight: 400;
}

/* Equipment cards — flat surfaces, 1 px rule, accent marker */
.impact-config {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  background: var(--d-rule);
  border: 1px solid var(--d-rule);
}

.config-card {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: clamp(20px, 2.6vw, 30px);
  background: var(--d-surface);
  transition: background var(--dur-mid) var(--ease);
}

.config-icon {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 60px;
  height: 60px;
  border: 1px solid var(--d-rule);
  border-radius: 0;
}

.config-icon svg {
  width: 32px;
  height: 32px;
  fill: none;
  stroke-width: 1.5;
  stroke-linecap: butt;
  stroke-linejoin: miter;
}

.config-icon img {
  display: block;
  width: 40px;
  height: 40px;
  object-fit: contain;
}

.config-card--bd {
  border-top: 2px solid var(--d-accent);
}

.config-card--bd .config-icon svg {
  stroke: var(--d-accent);
}

.config-card--bd .config-body strong {
  color: var(--d-accent);
}

.config-card--sigma {
  opacity: 0.5;
}

.config-card--sigma[data-active="true"] {
  opacity: 1;
  border-top: 2px solid var(--d-label);
}

.config-card--sigma .config-icon svg {
  stroke: var(--d-label);
}

.config-card--sigma[data-active="true"] .config-body strong {
  color: var(--d-label);
}

.config-body {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.config-body strong {
  color: var(--d-text);
  font-family: var(--font-display);
  font-size: clamp(2.4rem, 5vw, 3.4rem);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.015em;
  line-height: 1;
}

.config-body span {
  font-family: var(--font-display);
  font-size: clamp(0.95rem, 1.7vw, 1.15rem);
  font-weight: 600;
}

.config-body small {
  margin-top: 4px;
  color: var(--d-muted);
  font-size: 0.74rem;
  font-family: var(--font-mono);
}

/* Mass balance — flat panel separated by rules */
.mass-balance {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: stretch;
  gap: 1px;
  padding: 0;
  border: 1px solid var(--d-rule);
  background: var(--d-rule);
}

.mb-node {
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 8px;
  padding: clamp(20px, 2.6vw, 32px);
  background: var(--d-surface);
  text-align: center;
}

.mb-out {
  border-top: 2px solid var(--d-accent);
}

.mb-tag {
  color: var(--d-muted);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.mb-node strong {
  color: var(--d-text);
  font-family: var(--font-display);
  font-size: clamp(2rem, 5vw, 3.2rem);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.015em;
  line-height: 1;
}

.mb-out strong {
  color: var(--d-accent);
}

.mb-node em {
  color: var(--d-muted);
  font-size: 0.82rem;
  font-style: normal;
}

.mb-flow {
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 12px;
  min-width: 140px;
  padding: 20px;
  background: var(--d-surface);
}

.mb-reduction {
  display: grid;
  justify-items: center;
  gap: 2px;
  padding: 12px 18px;
  border: 1px solid var(--d-rule);
  border-radius: var(--radius);
  background: var(--d-surface-raised);
}

.mb-reduction strong {
  color: var(--d-accent);
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 3.4vw, 2.2rem);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.mb-reduction span {
  color: var(--d-muted);
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.mb-arrow {
  width: 100%;
  max-width: 160px;
  height: 24px;
  fill: none;
  stroke: var(--d-accent);
  stroke-width: 1.5;
  stroke-linecap: butt;
  stroke-linejoin: miter;
}

/* Benefit cards */
.benefit-group {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  background: var(--d-rule);
  border: 1px solid var(--d-rule);
}

.benefit-card {
  display: grid;
  gap: 6px;
  padding: clamp(20px, 2.6vw, 30px);
  background: var(--d-surface);
}

.benefit-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin-bottom: 8px;
  border: 1px solid var(--d-rule);
}

.benefit-icon svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: var(--d-accent);
  stroke-width: 1.5;
  stroke-linecap: butt;
  stroke-linejoin: miter;
}

.benefit-kicker {
  margin: 0;
  color: var(--d-muted);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.benefit-card > strong {
  color: var(--d-text);
  font-family: var(--font-display);
  font-size: clamp(2rem, 4.6vw, 2.9rem);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.015em;
  line-height: 1;
}

.benefit-card > span {
  color: var(--d-muted);
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 600;
}

.benefit-note {
  margin: 8px 0 0;
  color: var(--d-muted);
  font-size: 0.8rem;
  line-height: 1.55;
}

.benefit-card--carbon {
  border-top: 2px solid var(--d-label);
}

.benefit-card--carbon .benefit-icon svg {
  stroke: var(--d-label);
}

.benefit-card--carbon > strong {
  color: var(--d-label);
}

/* CTA band — dark band, accent-light top marker */
.impact-cta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 20px;
  padding: clamp(24px, 3vw, 36px) clamp(24px, 3.4vw, 44px);
  border: 1px solid var(--d-rule);
  border-top: 2px solid var(--d-accent);
  color: var(--d-text);
  background: var(--d-surface-raised);
}

.cta-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.2rem, 2.6vw, 1.6rem);
  font-weight: 600;
}

.cta-sub {
  margin: 6px 0 0;
  color: var(--d-muted);
  font-size: 0.9rem;
  font-weight: 400;
}

.cta-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

/* On dark, the primary button inverts to paper-on-ink */
.cta-button {
  flex: 0 0 auto;
  padding: 13px 22px;
  border: 1px solid var(--paper);
  border-radius: var(--radius);
  color: var(--ink);
  background: var(--paper);
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition:
    background var(--dur-fast) var(--ease),
    transform var(--dur-mid) var(--ease);
}

.cta-button:hover {
  transform: translateY(-1px);
  background: #e9eef2;
}

.cta-button:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

/* Secondary on dark — outline */
.cta-button-secondary {
  color: var(--d-text);
  background: transparent;
  border-color: var(--d-rule);
}

.cta-button-secondary:hover {
  background: rgba(220, 230, 238, 0.08);
}

/* ---------------------------------------------------------------------------
   Responsive
--------------------------------------------------------------------------- */
@media (max-width: 720px) {
  .impact-config,
  .benefit-group,
  .mass-balance {
    grid-template-columns: 1fr;
  }

  .mb-flow {
    min-width: 0;
  }

  .mb-arrow {
    transform: rotate(90deg);
    max-width: 60px;
  }

  .impact-cta {
    flex-direction: column;
    align-items: flex-start;
  }

  .cta-button {
    width: 100%;
    text-align: center;
  }
}

@media (max-width: 760px) {
  .topbar {
    top: 12px;
    left: 12px;
    right: 12px;
  }

  .plant-controls,
  .configuration-switcher {
    width: 100%;
    min-width: 0;
  }

  .model-status-card {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: 100%;
    padding: 10px 12px;
  }

  .status-brand {
    grid-column: 1 / -1;
    gap: 9px;
    padding: 0 0 9px;
  }

  .status-brand img {
    width: 42px;
    height: 42px;
  }

  .status-metric {
    padding: 2px 10px;
  }

  .status-metric:nth-of-type(2) {
    padding-left: 0;
    border-left: 0;
  }

  .status-value strong {
    font-size: 1.4rem;
  }

  .status-value span {
    font-size: 0.7rem;
  }

  .status-metric small {
    font-size: 0.56rem;
  }

  .plant-data-card {
    grid-template-columns: 1fr;
    gap: 10px;
    min-width: 0;
  }

  .plant-data-heading {
    padding-right: 0;
    padding-bottom: 8px;
    border-right: 0;
    border-bottom: 1px solid var(--d-rule);
  }

  .plant-metrics {
    gap: 10px;
  }

  .plant-metrics span {
    white-space: normal;
  }

  .session-chip {
    display: none;
  }

  .viewer-toolbar {
    top: auto;
    bottom: 16px;
    left: 50%;
    grid-auto-flow: column;
    align-items: center;
    gap: 8px;
    padding: 6px;
    max-width: calc(100% - 16px);
    overflow-x: auto;
    transform: translateX(-50%);
  }

  .view-buttons {
    grid-auto-flow: column;
    gap: 8px;
  }

  .toolbar-divider {
    width: 1px;
    height: 28px;
    margin: 0 1px;
  }

  .viewer-toolbar button {
    width: 40px;
    height: 40px;
  }

  .plant-name-sign {
    right: 12px;
    bottom: 76px;
    min-width: min(300px, calc(100% - 24px));
    max-width: calc(100% - 24px);
    padding: 16px 20px;
  }

  .measurement-hint {
    bottom: 76px;
  }
}

@media (max-width: 900px) {
  body {
    min-height: 100%;
    overflow: auto;
  }

  .app-shell {
    grid-template-columns: 1fr;
    grid-template-rows: none;
    height: auto;
  }

  .viewer-stage {
    grid-column: 1;
    grid-row: auto;
    height: 70vh;
    min-height: 520px;
  }

  .impact-section {
    grid-column: 1;
    grid-row: auto;
  }

  .calculator-panel {
    position: static;
    grid-column: 1;
    grid-row: auto;
    align-self: auto;
    height: auto;
    overflow: visible;
    border-top: 1px solid var(--rule);
    border-left: 0;
  }
}

@media (max-width: 520px) {
  .viewer-toolbar,
  .view-buttons {
    gap: 4px;
  }

  .viewer-toolbar button {
    width: 36px;
    height: 36px;
  }

  .viewer-toolbar svg {
    width: 20px;
    height: 20px;
  }

  .calculator-panel {
    padding: 22px 16px 30px;
  }

  .calculator-results-grid {
    grid-template-columns: 1fr;
  }

  .calculator-result small {
    min-height: 0;
  }

  .segmented-control-three {
    grid-template-columns: 1fr;
  }

  .slider-field {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }
}
