:root {
  --bg: #f5f7fa;
  --card: #ffffff;
  --border: #e4e8ee;
  --text: #1f2937;
  --muted: #6b7280;
  --accent: #ED7C30;
  --accent-dim: #fde8d4;
  --warm: #d9534f;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(16,24,40,0.06), 0 1px 2px rgba(16,24,40,0.04);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, system-ui, sans-serif;
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
}


main {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 20px;
  padding: 20px;
  align-items: start;
}

.panel { display: flex; flex-direction: column; gap: 16px; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow);
}
.card h2 {
  font-size: 12px;
  font-weight: 600;
  margin: 0 0 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}
.card-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 10px;
}
.card-head h2 { margin: 0; }
.muted { color: var(--muted); font-size: 12px; }

.field-row { display: flex; gap: 10px; }
.field { flex: 1; display: flex; flex-direction: column; gap: 4px; }
.field span { font-size: 12px; color: var(--muted); }
.field input, .field select {
  font: inherit;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--card);
  color: var(--text);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.field input:focus, .field select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

details {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
}
details summary { cursor: pointer; font-size: 12px; color: var(--muted); }
details[open] summary { margin-bottom: 8px; }

.layers { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; }
.layer-row {
  display: grid;
  grid-template-columns: 12px minmax(0,1fr) 64px 82px 26px;
  gap: 5px;
  align-items: center;
  padding: 6px 7px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fafbfc;
}
.layer-row .swatch {
  width: 12px;
  height: 30px;
  border-radius: 3px;
  border: 1px solid rgba(0,0,0,0.1);
}
.layer-row .mat-select {
  font: inherit;
  padding: 5px 6px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--card);
  outline: none;
  min-width: 0;
  width: 100%;
  text-overflow: ellipsis;
}
.layer-row .mat-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}
.layer-row .prop-box {
  display: inline-flex;
  align-items: center;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 5px;
  height: 30px;
  padding: 0 6px;
  gap: 4px;
  overflow: hidden;
}
.layer-row .prop-box:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}
.layer-row .prop-key {
  font-size: 12px;
  color: var(--muted);
  font-style: italic;
  font-family: 'Cambria Math', 'Georgia', serif;
}
.layer-row .prop-val {
  font-size: 12px;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  font-family: ui-monospace, 'Consolas', monospace;
  font-weight: 500;
  white-space: nowrap;
}
.layer-row .prop-suffix {
  font-size: 10px;
  color: var(--muted);
  font-weight: 500;
}
.layer-row .prop-box input {
  font: inherit;
  font-size: 12px;
  color: var(--text);
  border: none;
  outline: none;
  padding: 0;
  background: transparent;
  width: 44px;
  text-align: right;
  -moz-appearance: textfield;
  min-width: 0;
}
.layer-row .prop-box input::-webkit-outer-spin-button,
.layer-row .prop-box input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.layer-row .remove {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 0;
  cursor: pointer;
  color: var(--muted);
  width: 26px;
  height: 26px;
  font-size: 16px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.layer-row .remove:hover {
  background: #fee2e2;
  color: #b91c1c;
  border-color: #fecaca;
}

/* Custom material form */
.add-material {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
}
.add-material summary {
  cursor: pointer;
  font-size: 12px;
  color: var(--accent);
  font-weight: 500;
  padding: 2px 0;
  list-style: none;
}
.add-material summary::before {
  content: '+ ';
  font-weight: 600;
}
.add-material[open] summary {
  margin-bottom: 8px;
  color: var(--text);
}
.add-material[open] summary::before { content: '− '; }
.cm-form { display: flex; flex-direction: column; gap: 6px; }
.cm-form input[type="text"],
.cm-form input[type="number"] {
  font: inherit;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--card);
  width: 100%;
  outline: none;
}
.cm-form input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}
.cm-form .cm-inline { display: flex; gap: 6px; align-items: stretch; }
.cm-form .cm-inline input[type="number"] { flex: 1; }
.cm-form .cm-inline input[type="color"] {
  width: 40px;
  height: 32px;
  padding: 2px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--card);
  cursor: pointer;
}

/* Keep cursor as grabbing across the whole drag, even when SVG re-renders */
body.dragging-swap, body.dragging-swap * { cursor: grabbing !important; }

.add-btn {
  width: 100%;
  padding: 8px;
  font: inherit;
  background: var(--accent-dim);
  color: var(--accent);
  border: 1px dashed var(--accent);
  border-radius: 6px;
  cursor: pointer;
}
.add-btn:hover { background: #f9d4b8; }

.summary .metric {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: baseline;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px dashed var(--border);
}
.summary .metric:last-child { border-bottom: none; }
.summary .metric span { font-size: 12px; color: var(--muted); }
.summary .metric strong {
  font-variant-numeric: tabular-nums;
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}
.summary .metric em {
  font-style: normal;
  font-size: 11px;
  color: var(--muted);
}

.viz-wrap {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}

/* Tabs */
.tabs {
  display: flex;
  gap: 2px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--border);
}
.tab {
  font: inherit;
  background: transparent;
  border: 1px solid transparent;
  border-bottom: none;
  padding: 8px 16px;
  cursor: pointer;
  color: var(--muted);
  font-weight: 500;
  border-radius: 6px 6px 0 0;
  margin-bottom: -1px;
  transition: color .12s ease, background .12s ease;
}
.tab:hover { color: var(--text); background: #f3f6f9; }
.tab.active {
  color: var(--accent);
  background: var(--card);
  border-color: var(--border);
  border-bottom-color: var(--card);
  font-weight: 600;
}
.tab-panel.hidden { display: none; }

/* Learn content */
.learn {
  max-width: 780px;
  margin: 0 auto;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
}
.learn h2 {
  font-size: 16px;
  font-weight: 600;
  margin: 24px 0 8px;
  color: var(--text);
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border);
}
.learn h2:first-child { margin-top: 4px; }
.learn p { margin: 0 0 10px; }
.learn ul { padding-left: 20px; margin: 6px 0 12px; }
.learn li { margin: 4px 0; }
.learn em { color: var(--text); }

.learn .glossary { margin: 8px 0 12px; }
.learn .glossary dt {
  margin-top: 12px;
  font-weight: 600;
  color: var(--accent);
}
.learn .glossary dt:first-child { margin-top: 0; }
.learn .glossary dd {
  margin: 4px 0 0 0;
  color: #374151;
}

.learn .formula {
  font-family: ui-monospace, 'Cascadia Mono', 'Consolas', 'Monaco', monospace;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 4px;
  padding: 10px 14px;
  display: block;
  margin: 8px 0 12px;
  font-size: 14px;
}

.learn .ref-table {
  border-collapse: collapse;
  width: 100%;
  margin: 8px 0 12px;
  font-size: 13px;
}
.learn .ref-table th,
.learn .ref-table td {
  text-align: left;
  padding: 6px 10px;
  border-bottom: 1px solid var(--border);
}
.learn .ref-table th {
  color: var(--muted);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: #f8fafc;
}
.learn .ref-table tr:last-child td { border-bottom: none; }
.learn .ref-table .mono { font-family: ui-monospace, 'Consolas', monospace; }
.learn .ref-table .mat-sw {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 2px;
  border: 1px solid rgba(0,0,0,0.1);
  margin-right: 8px;
  vertical-align: -2px;
}

.learn .small { font-size: 12px; }
.learn .muted { color: var(--muted); }

/* Preset assemblies grid (interactive Learn tab) */
.preset-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
  margin: 10px 0 16px;
}
.preset-card {
  text-align: left;
  font: inherit;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: border-color .12s ease, box-shadow .12s ease, transform .08s ease;
}
.preset-card:hover {
  border-color: var(--accent);
  box-shadow: 0 2px 6px rgba(30,136,229,0.10);
}
.preset-card:active { transform: translateY(1px); }
.preset-card .preset-title {
  font-weight: 600;
  font-size: 13px;
  color: var(--text);
}
.preset-card .preset-meta {
  font-size: 12px;
  color: var(--muted);
}
.preset-card .preset-u {
  margin-top: 6px;
  font-family: ui-monospace, 'Consolas', monospace;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
}
.preset-card .preset-tag {
  font-size: 10px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-top: 2px;
}

/* Annual heat loss calculator */
.energy-calc {
  background: linear-gradient(180deg, #fbfcfd 0%, #f3f6fa 100%);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 16px;
  margin: 10px 0 16px;
}
.energy-calc .ec-inputs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}
.ec-field { display: flex; flex-direction: column; gap: 4px; font-size: 12px; }
.ec-field > span:first-child { color: var(--muted); }
.ec-input {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 8px;
}
.ec-input input {
  font: inherit;
  font-size: 14px;
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  width: 100%;
  min-width: 0;
}
.ec-input em {
  font-style: normal;
  font-size: 11px;
  color: var(--muted);
}
.ec-outputs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
}
.ec-outputs .metric {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 10px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 6px;
}
.ec-outputs .metric span { font-size: 11px; color: var(--muted); }
.ec-outputs .metric strong {
  font-family: ui-monospace, 'Consolas', monospace;
  font-size: 18px;
  font-weight: 600;
  color: var(--accent);
}
.ec-outputs .metric em { font-style: normal; font-size: 11px; color: var(--muted); }

/* Custom-material badge in the materials table */
.learn .ref-table .badge {
  display: inline-block;
  background: var(--accent-dim);
  color: var(--accent);
  font-size: 10px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 8px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-left: 6px;
  vertical-align: middle;
}
.learn .ref-table th small {
  display: block;
  font-weight: 400;
  font-size: 10px;
  color: var(--muted);
  text-transform: none;
  letter-spacing: 0;
  margin-top: 2px;
}

/* sim-clock icon (next to digital sim time, since the analog clock now lives on the plot) */
.sim-clock-icon { font-size: 14px; opacity: 0.7; }

/* ---------- Scenario tab ---------- */
.scenario {
  font-size: 14px;
  color: var(--text);
}
.scenario h2 {
  font-size: 17px;
  font-weight: 600;
  margin: 0 0 6px;
}
.scenario > p {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 13px;
}
.scenario-controls {
  background: linear-gradient(180deg, #fbfcfd 0%, #f3f6fa 100%);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 16px;
  margin-bottom: 14px;
}
.scenario-controls .seg-toggle.scenario-mode {
  display: inline-flex;
  width: auto;
  margin-bottom: 14px;
}
.scenario-controls .seg-toggle.scenario-mode .seg {
  padding: 6px 14px;
  font-size: 12px;
  flex: 0 0 auto;
}
.scenario-params { margin-bottom: 12px; }
.scenario-params .sc-desc {
  font-size: 12px;
  font-style: italic;
  color: var(--muted);
  margin: 0 0 10px;
  font-family: 'Cambria Math', 'Georgia', serif;
}
.scenario-params .sc-param-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
}
.scenario-params .sc-param-row { display: flex; gap: 8px; }
.scenario-params .sc-param-row input[type="text"] {
  flex: 1;
  font: inherit;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--card);
  outline: none;
  font-family: ui-monospace, 'Consolas', monospace;
}
.scenario-params .sc-param-row input[type="text"]:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}
.sc-field { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.sc-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text);
  padding: 16px 0 0;
}
.sc-check input { width: 14px; height: 14px; accent-color: var(--accent); }

.scenario-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
  padding-top: 12px;
  border-top: 1px dashed var(--border);
}

#sc-run { margin-top: 4px; }

.scenario-plot {
  width: 100%;
  height: auto;
  display: block;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 14px;
  touch-action: none;
}

.scenario-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
}
.scenario-summary .metric {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.scenario-summary .metric span { font-size: 11px; color: var(--muted); }
.scenario-summary .metric strong {
  font-family: ui-monospace, 'Consolas', monospace;
  font-size: 16px;
  font-weight: 600;
  color: var(--accent);
}
.scenario-summary .metric em {
  font-style: normal;
  font-size: 11px;
  color: var(--muted);
}

/* Equations panel — big, simple, dependency-focused */
.equations {
  background: linear-gradient(180deg, #fbfcfd 0%, #f3f6fa 100%);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 18px 22px;
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.eq {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  font-family: 'Cambria Math', 'Cambria', 'Georgia', 'Times New Roman', serif;
  font-size: 22px;
  line-height: 1.25;
  color: var(--text);
}
.eq .eq-formula {
  font-weight: 500;
  letter-spacing: 0.01em;
}
.eq .eq-formula sub { font-size: 0.62em; }
.eq .eq-value {
  margin-left: auto;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, system-ui, sans-serif;
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
}
.eq .eq-value strong {
  font-family: ui-monospace, 'Cascadia Mono', 'Consolas', monospace;
  font-size: 16px;
  font-weight: 600;
  color: var(--accent);
  margin-right: 2px;
}
.eq .frac {
  display: inline-flex;
  flex-direction: column;
  vertical-align: -0.45em;
  text-align: center;
  margin: 0 4px;
  font-size: 18px;
  line-height: 1.1;
}
.eq .frac .num {
  border-bottom: 1.5px solid currentColor;
  padding: 0 8px 1px;
}
.eq .frac .den {
  padding: 2px 8px 0;
}
.viz-wrap svg {
  width: 100%;
  height: auto;
  display: block;
  touch-action: none;
  user-select: none;
}

/* Drag handles inside the SVG */
.drag-handle-x { cursor: ew-resize; }
.drag-handle-x .grip { transition: opacity .12s ease, stroke-width .12s ease; }
.drag-handle-x:hover .grip { opacity: 0.95; stroke-width: 2.5; }
.drag-handle-x:active .grip { opacity: 1; stroke-width: 3; }

.drag-handle-y { cursor: ns-resize; }
.drag-handle-y .grip { transition: stroke-width .12s ease; }
.drag-handle-y:hover .grip { stroke-width: 3.5; }
.drag-handle-y:active .grip { stroke-width: 4; }

/* Swap-drag zone on each layer body */
.swap-zone { cursor: grab; }
.swap-zone:active { cursor: grabbing; }
.legend {
  display: flex;
  gap: 18px;
  margin-top: 10px;
  font-size: 12px;
  color: var(--muted);
  flex-wrap: wrap;
}
.lg-item { display: inline-flex; align-items: center; gap: 6px; }
.sw {
  display: inline-block;
  width: 14px;
  height: 12px;
  border-radius: 2px;
  border: 1px solid var(--border);
}
.sw.temp { background: var(--warm); border-color: var(--warm); }
.sw.airzone { background: repeating-linear-gradient(45deg, #e8eef5 0 4px, #f5f7fa 4px 8px); }
.sw.flow { background: var(--accent); border-color: var(--accent); }

.hint {
  margin-top: 8px;
  font-size: 12px;
  color: var(--muted);
  font-style: italic;
}

footer {
  padding: 12px 24px;
  border-top: 1px solid var(--border);
  background: var(--card);
  font-size: 12px;
  color: var(--muted);
  text-align: center;
}

/* Plot-area toolbar (Wall/Roof + Steady/Transient toggles above the chart) */
.plot-toolbar {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.plot-toolbar .seg-toggle {
  width: 220px;
  flex: 0 0 auto;
}

/* Sim toolbar — appears when Transient mode is active */
.sim-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  padding: 10px 14px;
  background: linear-gradient(180deg, #fbfcfd 0%, #f3f6fa 100%);
  border: 1px solid var(--border);
  border-radius: 8px;
  flex-wrap: wrap;
}
.sim-toolbar[hidden] { display: none; }
.sim-btn {
  font: inherit;
  font-weight: 500;
  padding: 7px 14px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  color: var(--text);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background .12s, border-color .12s, box-shadow .12s;
}
.sim-btn:hover { background: #f3f6f9; }
.sim-btn.primary {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}
.sim-btn.primary:hover { background: #d4621a; }
.sim-btn .ico { font-size: 14px; line-height: 1; }
.sim-field { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.sim-field select {
  font: inherit;
  padding: 5px 8px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--card);
  color: var(--text);
  outline: none;
}
.sim-field select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-dim); }
.sim-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text);
}
.sim-check input[type="checkbox"] { width: 14px; height: 14px; accent-color: var(--accent); }
.sim-check input[type="number"] {
  font: inherit;
  font-size: 11px;
  width: 64px;
  padding: 2px 4px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--card);
  outline: none;
}
.sim-clock {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  font-family: ui-monospace, 'Consolas', monospace;
  font-weight: 500;
}
.clock-face { display: block; }
#sim-time { letter-spacing: 0.02em; }

/* Segmented toggle (Wall / Roof) */
.seg-toggle {
  display: flex;
  background: #eef2f7;
  border-radius: 8px;
  padding: 3px;
  gap: 2px;
  border: 1px solid var(--border);
}
.seg {
  flex: 1;
  font: inherit;
  font-weight: 500;
  font-size: 13px;
  background: transparent;
  border: none;
  padding: 7px 12px;
  cursor: pointer;
  color: var(--muted);
  border-radius: 6px;
  transition: background .15s ease, color .15s ease, box-shadow .15s ease;
}
.seg:hover { color: var(--text); }
.seg.active {
  background: var(--card);
  color: var(--accent);
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(0,0,0,0.06);
}

/* Robustness — panel layout stability */
.panel { min-width: 0; }
.card { min-width: 0; }
.field input,
.field select,
.layer-row select,
.layer-row input {
  width: 100%;
  min-width: 0;
}
.summary .metric strong { white-space: nowrap; }
.tab { white-space: nowrap; }
.add-btn { min-height: 34px; }
.layer-row .remove { flex: 0 0 28px; }

/* Make the diagram tab scrollable on cramped screens, never push controls off */
.tab-panel { min-height: 0; }
.tab-panel[data-panel="learn"] {
  max-height: calc(100vh - 200px);
  overflow-y: auto;
  padding-right: 8px;
}

@media (max-width: 900px) {
  main { grid-template-columns: 1fr; }
  .eq { font-size: 18px; }
  .eq .frac { font-size: 15px; }
}

/* Header */
:root {
  --accent-header: #ED7C30;
  --bg-header:     #ffffff;
  --text-nav:      #2c2c2c;
  --header-height: 89px;
}
.header-row {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  height: var(--header-height);
  background: var(--bg-header);
  border-bottom: 3px solid var(--accent-header);
  box-shadow: 0 1px 4px rgba(0,0,0,0.07);
  width: 100%;
}
.header-logo-left img {
  width: 180px;
  height: 70px;
  object-fit: contain;
  display: block;
}
.header-title-block {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  pointer-events: none;
}
.header-title-block h1 {
  font-size: 1.2rem;
  font-weight: 500;
  color: #1a1a1a;
  letter-spacing: -0.01em;
  font-family: 'Poppins', sans-serif;
  white-space: nowrap;
  margin: 0;
}
.header-sub {
  font-size: 0.75rem;
  color: #6b7280;
  font-family: 'Poppins', sans-serif;
  margin: 2px 0 0;
  white-space: nowrap;
}
.header-menu {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}
