/* ==========================================================================
   ENERGY CALCULATOR — Industrial Instrumentation
   --------------------------------------------------------------------------
   Aesthetic: laboratory test equipment + modern code editor.
   Phosphor-green readouts on recessed displays. Schematic corner brackets.
   Technical-drawing dot grid. JetBrains Mono for data, Geist for prose.
   Sharp 1px borders. LED-dot status indicators. Sunken / raised states.
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Geist:wght@300;400;500;600;700&family=JetBrains+Mono:ital,wght@0,300;0,400;0,500;0,600;0,700;1,400&display=swap');

/* --------------------------------------------------------------------------
   1.  TOKENS
   -------------------------------------------------------------------------- */
:root {
  /* surfaces */
  --bg-void:        #06090f;   /* deepest — body */
  --bg-grid:        #0a0e16;   /* body w/ dot grid */
  --bg-surface:     #0f1521;   /* cards, sections */
  --bg-elevated:    #18202f;   /* hover, active component row */
  --bg-recessed:    #03060a;   /* output displays — sunken */
  --bg-input:       #0a121f;   /* form fields */
  --bg-glass:       rgba(15, 21, 33, 0.85);

  /* lines */
  --line-faint:     #131c2a;   /* dividers */
  --line:           #21304a;   /* default border */
  --line-bright:    #364866;   /* hover border */
  --line-deep:      #08111e;   /* shadow side of recessed bevel */

  /* text */
  --text:           #e2ecf7;
  --text-soft:      #b0bdd0;
  --text-dim:       #6e7e95;
  --text-faint:     #455672;
  --text-mute:      #2c3a52;

  /* accents */
  --phosphor:       #9ee8b3;   /* computed values, CRT-green */
  --phosphor-low:   #4f9469;
  --cyan:           #6cc7ff;   /* focus, action */
  --cyan-low:       #2a5d85;
  --amber:          #f5c265;   /* warn */
  --coral:          #ff8579;   /* danger */
  --violet:         #b29cff;   /* special highlight */

  /* type */
  --font-display:   'Geist', system-ui, sans-serif;
  --font-mono:      'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  /* sizing */
  --w-max:          1480px;
  --r-sm:           2px;
  --r-md:           3px;
  --r-lg:           4px;

  /* shadows */
  --shadow-recess:  inset 0 1px 0 var(--line-deep), inset 0 0 0 1px rgba(0,0,0,0.4);
  --shadow-raise:   0 1px 0 rgba(255,255,255,0.04), 0 0 0 1px var(--line);
  --shadow-glow-c:  0 0 0 1px var(--cyan), 0 0 18px rgba(108, 199, 255, 0.18);
  --shadow-glow-p:  0 0 8px rgba(158, 232, 179, 0.4);
}

/* --------------------------------------------------------------------------
   2.  RESET / BASE
   -------------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; tab-size: 4; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: var(--font-display);
  font-size: 13px;
  line-height: 1.5;
  font-feature-settings: 'ss01', 'cv11';      /* Geist stylistic alternates */
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;

  /* Engineering dot-grid background — layered: faint dots + soft radial vignette */
  background-color: var(--bg-grid);
  background-image:
    radial-gradient(circle at 1px 1px, rgba(108, 199, 255, 0.04) 1px, transparent 0),
    radial-gradient(ellipse 60% 50% at 50% 0%, rgba(108, 199, 255, 0.05), transparent 70%),
    linear-gradient(180deg, var(--bg-grid), var(--bg-void) 800px);
  background-size: 24px 24px, 100% 100%, 100% 100%;
  background-attachment: fixed;
}

h1, h2, h3, h4, h5 { margin: 0; font-weight: 500; letter-spacing: -0.012em; }

button { font: inherit; }

/* selection: phosphor */
::selection { background: rgba(158, 232, 179, 0.25); color: var(--text); }

/* --------------------------------------------------------------------------
   3.  TOPBAR — equipment chassis label
   -------------------------------------------------------------------------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 0.7rem 1.25rem;
  background: var(--bg-glass);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  border-bottom: 1px solid var(--line);
  /* faint highlight along top edge — chassis seam */
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.03), 0 1px 0 var(--line-deep);
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 0.65rem;
  position: relative;
  padding-left: 1.5rem;
}
/* Brand mark — energy bolt, drawn in CSS */
.brand::before {
  content: "";
  position: absolute;
  left: 0; top: 50%;
  width: 14px; height: 18px;
  transform: translateY(-50%);
  background: linear-gradient(135deg, var(--phosphor), var(--cyan));
  clip-path: polygon(50% 0%, 100% 38%, 60% 38%, 88% 100%, 0% 60%, 40% 60%);
  filter: drop-shadow(0 0 4px rgba(158, 232, 179, 0.5));
}

.brand h1 {
  font-family: var(--font-mono);
  font-size: 0.92rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text);
}
.brand .sub {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--text-faint);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  position: relative;
  padding-left: 0.6rem;
}
.brand .sub::before {
  content: "/";
  color: var(--text-mute);
  position: absolute;
  left: 0;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

/* --------------------------------------------------------------------------
   4.  FORM CONTROLS — base
   -------------------------------------------------------------------------- */
button, select, input, textarea {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text);
  background: var(--bg-input);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 0.4rem 0.65rem;
  outline: none;
  transition: border-color .12s ease, box-shadow .12s ease, background .12s ease;
}

input[type="number"], input[type="text"] {
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
}

button {
  cursor: pointer;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-size: 0.7rem;
  font-weight: 500;
  padding: 0.45rem 0.85rem;
  background: var(--bg-input);
  position: relative;
}
button:hover {
  border-color: var(--line-bright);
  background: var(--bg-elevated);
  color: var(--cyan);
}
button:active { transform: translateY(1px); }

select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 1.6rem;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--text-dim) 50%),
    linear-gradient(-45deg, transparent 50%, var(--text-dim) 50%);
  background-position: calc(100% - 11px) 50%, calc(100% - 6px) 50%;
  background-size: 5px 5px;
  background-repeat: no-repeat;
}
select:hover { border-color: var(--line-bright); }

input:focus, select:focus, textarea:focus {
  border-color: var(--cyan);
  background: var(--bg-elevated);
  box-shadow: var(--shadow-glow-c);
}

input[disabled] {
  color: var(--text-faint);
  background: var(--bg-recessed);
  cursor: not-allowed;
}

input::placeholder { color: var(--text-mute); }

/* numeric spinner — keep but de-emphasize */
input[type=number]::-webkit-inner-spin-button,
input[type=number]::-webkit-outer-spin-button { opacity: 0.4; }

/* --------------------------------------------------------------------------
   5.  TIERS — two big horizontal stripes with engraved labels
   -------------------------------------------------------------------------- */
.tier {
  max-width: var(--w-max);
  margin: 0 auto;
  padding: 2rem 1.25rem 1rem;
  counter-reset: section-counter;
  transition: padding .2s ease;
}

/* Collapsed: only the header shows. Click anywhere on the header to expand. */
.tier.collapsed {
  padding-bottom: 0.85rem;
  border-bottom: 1px solid var(--line-faint);
}
.tier.collapsed > section,
.tier.collapsed > .quick-grid {
  display: none;
}
.tier.collapsed .tier-header { margin-bottom: 0; }

.tier-quick { padding-bottom: 1.5rem; border-bottom: 1px solid var(--line-faint); }

.tier-header {
  cursor: pointer;
  user-select: none;
  position: relative;
  margin-bottom: 1.25rem;
  padding-left: 4.5rem;
  min-height: 3.2rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

/* Big numeric tier badge — left margin, JetBrains Mono ultrabold */
body { counter-reset: tier-counter; }
.tier { counter-increment: tier-counter; }
.tier-header::before {
  content: counter(tier-counter, decimal-leading-zero);
  position: absolute;
  left: 0; top: 50%;
  transform: translateY(-50%);
  font-family: var(--font-mono);
  font-size: 2.4rem;
  font-weight: 700;
  color: var(--text-mute);
  letter-spacing: -0.04em;
  line-height: 1;
}
/* Hairline under the number */
.tier-header::after {
  content: "";
  position: absolute;
  left: 0; bottom: 0.2rem;
  width: 3.5rem;
  height: 1px;
  background: linear-gradient(90deg, var(--cyan-low), transparent);
}

.tier-header h2 {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 500;
  letter-spacing: -0.02em;
  color: var(--text);
  position: relative;
  padding-right: 1.6rem;
  display: inline-block;
}
/* Chevron — points right when collapsed, down when expanded */
.tier-header h2::after {
  content: "";
  position: absolute;
  right: 4px; top: 50%;
  width: 8px; height: 8px;
  border-right: 2px solid var(--text-dim);
  border-bottom: 2px solid var(--text-dim);
  transform: translate(0, -65%) rotate(-45deg);   /* right-pointing */
  transition: transform .25s ease, border-color .15s ease;
}
.tier:not(.collapsed) .tier-header h2::after {
  transform: translate(0, -30%) rotate(45deg);    /* down-pointing */
}
.tier-header:hover h2::after { border-color: var(--cyan); }
.tier-header:hover h2 { color: var(--cyan); }
.tier-header .tier-sub {
  margin: 0.15rem 0 0;
  color: var(--text-dim);
  font-size: 0.85rem;
  max-width: 60ch;
}

/* --------------------------------------------------------------------------
   6.  QUICK-CONVERTER GRID — instrument panel of small calculators
   -------------------------------------------------------------------------- */
.quick-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 0.85rem;
}

.calc-card {
  position: relative;
  background: var(--bg-surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 0;
  display: flex;
  flex-direction: column;
  transition: border-color .15s ease, transform .15s ease;
}
.calc-card:hover {
  border-color: var(--line-bright);
}

/* Schematic corner brackets — top-left + bottom-right */
.calc-card::before,
.calc-card::after {
  content: "";
  position: absolute;
  width: 9px;
  height: 9px;
  pointer-events: none;
  transition: border-color .15s ease;
}
.calc-card::before {
  top: -1px; left: -1px;
  border-top: 1px solid var(--cyan-low);
  border-left: 1px solid var(--cyan-low);
}
.calc-card::after {
  bottom: -1px; right: -1px;
  border-bottom: 1px solid var(--cyan-low);
  border-right: 1px solid var(--cyan-low);
}
.calc-card:hover::before, .calc-card:hover::after {
  border-color: var(--cyan);
}

.calc-card > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.65rem 0.85rem;
  border-bottom: 1px solid var(--line-faint);
  background: linear-gradient(180deg, rgba(108, 199, 255, 0.03), transparent);
}
.calc-card > header h4 {
  font-family: var(--font-display);
  font-size: 0.86rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--text);
}
.calc-card > header .formula {
  color: var(--text-faint);
  font-family: var(--font-mono);
  font-size: 0.66rem;
  letter-spacing: 0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 60%;
  text-align: right;
}

.calc-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.55rem 0.7rem;
  padding: 0.75rem 0.85rem 0.35rem;
}
.calc-body label {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}
.calc-body label > span {
  font-family: var(--font-display);
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
  font-weight: 500;
}
.calc-body input,
.calc-body select {
  font-size: 0.86rem;
  padding: 0.36rem 0.55rem;
  width: 100%;
}
.calc-body .full { grid-column: 1 / -1; }

/* --- Output panel: SUNKEN, recessed display, phosphor readout --- */
.calc-out {
  margin: 0.45rem 0.85rem 0.85rem;
  padding: 0.6rem 0.75rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  line-height: 1.55;
  color: var(--text-soft);
  /* Faint scanlines layered over recessed bg — vintage instrument display */
  background:
    repeating-linear-gradient(
      180deg,
      transparent 0, transparent 3px,
      rgba(108, 199, 255, 0.022) 3px, rgba(108, 199, 255, 0.022) 4px
    ),
    var(--bg-recessed);
  border: 1px solid var(--line-deep);
  border-radius: var(--r-sm);
  box-shadow: var(--shadow-recess);
  white-space: pre-wrap;
  min-height: 2.4em;
  position: relative;
  overflow: hidden;
}
.calc-out strong {
  color: var(--phosphor);
  font-weight: 600;
  text-shadow: var(--shadow-glow-p);
}
.calc-out .warn   { color: var(--amber); font-weight: 500; }
.calc-out .danger { color: var(--coral); font-weight: 500; }

/* --------------------------------------------------------------------------
   7.  SYSTEM BUILDER — labeled instrument panels stacked vertically
   -------------------------------------------------------------------------- */
.tier-system .builder-section {
  background: var(--bg-surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  margin-bottom: 0.85rem;
  position: relative;
  counter-increment: section-counter;
}

.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.85rem;
  padding: 0.85rem 1.1rem;
  border-bottom: 1px solid var(--line-faint);
  background: linear-gradient(90deg, rgba(108, 199, 255, 0.025), transparent 60%);
  position: relative;
}
/* Section number badge — chunky monospace pill */
.section-head::before {
  content: counter(section-counter, decimal-leading-zero);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--cyan);
  background: var(--bg-input);
  border: 1px solid var(--cyan-low);
  border-radius: var(--r-sm);
  padding: 0.22rem 0.5rem;
  line-height: 1;
  flex: 0 0 auto;
}
.section-head h3 {
  font-family: var(--font-display);
  font-size: 1.02rem;
  font-weight: 500;
  letter-spacing: -0.015em;
  color: var(--text);
  flex: 0 0 auto;
}
.section-head h3 + p {
  font-size: 0.78rem;
  color: var(--text-dim);
  margin: 0;
  padding-left: 0.85rem;
  border-left: 1px solid var(--line-faint);
  flex: 1 1 12rem;
  min-width: 0;
}

.section-body {
  padding: 0.95rem 1.1rem 1.1rem;
}
.section-body > p.muted {
  margin: 0;
  padding: 1.5rem 0;
  text-align: center;
  color: var(--text-faint);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border: 1px dashed var(--line-faint);
  border-radius: var(--r-sm);
}

/* Add button — ghost style with + sigil */
.add-btn {
  background: transparent;
  color: var(--cyan);
  border-color: var(--cyan-low);
  padding: 0.4rem 0.7rem;
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.06em;
}
.add-btn:hover {
  background: rgba(108, 199, 255, 0.08);
  border-color: var(--cyan);
  color: var(--cyan);
}

/* --------------------------------------------------------------------------
   8.  COMPONENT ROW — tabular ledger entry
   -------------------------------------------------------------------------- */
.component-row {
  background: var(--bg-input);
  border: 1px solid var(--line-faint);
  border-radius: var(--r-md);
  padding: 0.7rem 0.85rem 0.6rem;
  margin-bottom: 0.6rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.55rem 0.85rem;
  align-items: end;
  position: relative;
  transition: border-color .12s ease;
}
.component-row:hover {
  border-color: var(--line);
  background: linear-gradient(180deg, var(--bg-elevated), var(--bg-input));
}
/* Left index marker — tiny vertical phosphor stripe */
.component-row::before {
  content: "";
  position: absolute;
  left: -1px; top: 8px; bottom: 8px;
  width: 2px;
  background: var(--phosphor-low);
  opacity: 0.6;
  border-radius: 2px;
}
.component-row:hover::before { opacity: 1; }

.component-row label {
  display: flex;
  flex-direction: column;
  gap: 0.22rem;
  min-width: 0;
}
.component-row label > span {
  font-family: var(--font-display);
  font-size: 0.6rem;
  font-weight: 500;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.component-row input,
.component-row select {
  font-family: var(--font-mono);
  font-size: 0.84rem;
  padding: 0.36rem 0.55rem;
  width: 100%;
  background: var(--bg-recessed);
}

.component-row .row-meta {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  color: var(--text-dim);
  grid-column: 1 / -1;
  margin-top: 0.2rem;
  padding-top: 0.55rem;
  border-top: 1px dashed var(--line-faint);
  white-space: pre-wrap;
  letter-spacing: 0.01em;
}
.component-row .row-meta strong {
  color: var(--phosphor);
  font-weight: 600;
  text-shadow: var(--shadow-glow-p);
}
.component-row .row-meta strong.danger {
  color: var(--coral);
  text-shadow: 0 0 6px rgba(255, 133, 121, 0.4);
}
.component-row .row-meta strong.warn {
  color: var(--amber);
  text-shadow: 0 0 6px rgba(245, 194, 101, 0.3);
}

.component-row .row-actions {
  display: flex;
  gap: 0.4rem;
  align-items: center;
  grid-column: 1 / -1;
  justify-content: flex-end;
  margin-top: 0.2rem;
}

.component-row .danger-btn {
  border-color: rgba(255, 133, 121, 0.3);
  color: var(--coral);
  background: transparent;
  font-size: 0.66rem;
  padding: 0.35rem 0.7rem;
}
.component-row .danger-btn:hover {
  background: rgba(255, 133, 121, 0.08);
  border-color: var(--coral);
  color: var(--coral);
}

/* Inline conversion / wiring summary rows — like log entries */
#conversionsBody .component-row,
#wiringBody .component-row {
  grid-template-columns: 1fr;
  align-items: stretch;
  padding: 0.6rem 0.85rem;
}
#conversionsBody .flex-grow,
#wiringBody .flex-grow {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--text-soft);
  letter-spacing: 0.01em;
}

/* --------------------------------------------------------------------------
   9.  RESULTS DASHBOARD — readout cluster
   -------------------------------------------------------------------------- */
.results-section {
  background: linear-gradient(180deg, var(--bg-surface), var(--bg-grid));
}
.results-section .section-body {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.75rem;
}

.metric-card {
  position: relative;
  background: var(--bg-recessed);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 0.85rem 1rem 0.95rem;
  box-shadow: var(--shadow-recess);
  overflow: hidden;
}
/* Top-edge highlight — like a bezel */
.metric-card::before {
  content: "";
  position: absolute;
  left: 0; right: 0; top: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(108, 199, 255, 0.25), transparent);
}
.metric-card .label {
  font-family: var(--font-display);
  font-size: 0.62rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-dim);
  font-weight: 500;
}
.metric-card .value {
  font-family: var(--font-mono);
  font-size: 1.55rem;
  font-weight: 500;
  margin-top: 0.3rem;
  letter-spacing: -0.01em;
  color: var(--text);
  line-height: 1.1;
}
.metric-card .value.good {
  color: var(--phosphor);
  text-shadow: var(--shadow-glow-p);
}
.metric-card .value.warn {
  color: var(--amber);
  text-shadow: 0 0 8px rgba(245, 194, 101, 0.3);
}
.metric-card .value.danger {
  color: var(--coral);
  text-shadow: 0 0 8px rgba(255, 133, 121, 0.4);
  animation: pulse-danger 2.4s ease-in-out infinite;
}
@keyframes pulse-danger {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.78; }
}
.metric-card .sub {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-dim);
  margin-top: 0.45rem;
  letter-spacing: 0.005em;
}

/* --- Loss waterfall: full-width segmented bar with axis labels --- */
.loss-waterfall {
  grid-column: 1 / -1;
  background: var(--bg-recessed);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 0.85rem 1rem;
  box-shadow: var(--shadow-recess);
}
.loss-waterfall .label {
  font-family: var(--font-display);
  font-size: 0.62rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-dim);
  font-weight: 500;
  margin-bottom: 0.55rem;
}
.loss-waterfall .bar {
  display: flex;
  height: 30px;
  border-radius: 2px;
  overflow: hidden;
  background: var(--bg-void);
  border: 1px solid var(--line);
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.4);
  position: relative;
}
.loss-waterfall .seg {
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 500;
  color: rgba(0,0,0,0.85);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 0 0.5rem;
  border-right: 1px solid rgba(0,0,0,0.45);
  letter-spacing: 0.02em;
  position: relative;
}
.loss-waterfall .seg:last-child { border-right: 0; }
/* Top highlight for each segment — adds dimension */
.loss-waterfall .seg::before {
  content: "";
  position: absolute;
  left: 0; right: 0; top: 0;
  height: 30%;
  background: linear-gradient(180deg, rgba(255,255,255,0.18), transparent);
  pointer-events: none;
}

/* --- Warnings: alert ribbon with LED-dot indicators --- */
.warnings-list {
  grid-column: 1 / -1;
  background: var(--bg-recessed);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 0.85rem 1rem 0.95rem;
  box-shadow: var(--shadow-recess);
}
.warnings-list > .label {
  font-family: var(--font-display);
  font-size: 0.62rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-dim);
  font-weight: 500;
  margin-bottom: 0.5rem;
}
.warnings-list ul {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.warnings-list li {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  padding: 0.45rem 0.6rem 0.45rem 2rem;
  background: var(--bg-input);
  border: 1px solid var(--line-faint);
  border-left-width: 2px;
  border-radius: var(--r-sm);
  position: relative;
  letter-spacing: 0.01em;
}
.warnings-list li::before {
  content: "";
  position: absolute;
  left: 0.7rem; top: 50%;
  transform: translateY(-50%);
  width: 7px; height: 7px;
  border-radius: 50%;
  box-shadow: 0 0 0 2px var(--bg-input);
}
.warnings-list li.warn {
  color: var(--amber);
  border-left-color: var(--amber);
}
.warnings-list li.warn::before {
  background: var(--amber);
  box-shadow: 0 0 0 2px var(--bg-input), 0 0 8px rgba(245, 194, 101, 0.5);
}
.warnings-list li.danger {
  color: var(--coral);
  border-left-color: var(--coral);
  background: linear-gradient(90deg, rgba(255, 133, 121, 0.06), var(--bg-input));
}
.warnings-list li.danger::before {
  background: var(--coral);
  box-shadow: 0 0 0 2px var(--bg-input), 0 0 10px rgba(255, 133, 121, 0.6);
  animation: led-pulse 1.4s ease-in-out infinite;
}
.warnings-list li.ok {
  color: var(--phosphor);
  border-left-color: var(--phosphor);
}
.warnings-list li.ok::before {
  background: var(--phosphor);
  box-shadow: 0 0 0 2px var(--bg-input), 0 0 8px rgba(158, 232, 179, 0.5);
}
.warnings-list li.muted {
  color: var(--text-faint);
  border-left-color: var(--line);
}
.warnings-list li.muted::before {
  background: var(--text-mute);
  box-shadow: 0 0 0 2px var(--bg-input);
}

@keyframes led-pulse {
  0%, 100% { transform: translateY(-50%) scale(1);   opacity: 1; }
  50%      { transform: translateY(-50%) scale(1.3); opacity: 0.7; }
}

/* --------------------------------------------------------------------------
   10. HINT SPANS — dotted underline cue for hover tooltips
   -------------------------------------------------------------------------- */
.hint {
  cursor: help;
  border-bottom: 1px dotted var(--text-faint);
  padding-bottom: 1px;
  transition: border-color .12s ease, color .12s ease;
}
.hint:hover {
  border-bottom-color: var(--cyan);
  color: var(--text-soft) !important;
}

/* --------------------------------------------------------------------------
   10b. LOAD PLANNER (Tier 3) — bank cards, layouts table, scenarios, sustain
   -------------------------------------------------------------------------- */

.section-body-tight { padding-top: 0; padding-bottom: 0.85rem; border-top: 1px dashed var(--line-faint); margin-top: -0.6rem; }

/* mini metric grid used inside planner sections */
.planner-totals {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.6rem;
  margin-top: 0.7rem;
}

/* Bank voltage comparison cards (clickable) */
.bank-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.7rem;
}
.bank-card {
  background: var(--bg-recessed);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 0.7rem 0.85rem 0.85rem;
  cursor: pointer;
  position: relative;
  transition: border-color .15s ease, transform .12s ease, box-shadow .15s ease;
  box-shadow: var(--shadow-recess);
}
.bank-card:hover {
  border-color: var(--line-bright);
  transform: translateY(-1px);
}
.bank-card.is-winner {
  border-color: var(--phosphor-low);
  background:
    linear-gradient(180deg, rgba(158, 232, 179, 0.06), transparent 50%),
    var(--bg-recessed);
  box-shadow: var(--shadow-recess), 0 0 14px rgba(158, 232, 179, 0.15);
}
.bank-card.is-selected {
  border-color: var(--cyan);
  box-shadow: var(--shadow-recess), 0 0 14px rgba(108, 199, 255, 0.18);
}
.bank-card.is-winner.is-selected {
  border-color: var(--phosphor);
}
.bank-card.is-incompatible {
  opacity: 0.55;
  border-style: dashed;
  border-color: var(--coral);
}
.bank-card.is-incompatible:hover {
  opacity: 0.85;
}
.bank-tag.danger {
  background: rgba(255, 133, 121, 0.12);
  color: var(--coral);
  border: 1px solid var(--coral);
}

/* Range slider (operating-point control) */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  background: linear-gradient(90deg, var(--bg-recessed), var(--phosphor-low) 25%, var(--amber) 70%, var(--coral));
  border-radius: 3px;
  border: 1px solid var(--line);
  outline: none;
  padding: 0;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px; height: 16px;
  background: var(--phosphor);
  border-radius: 50%;
  border: 2px solid var(--bg-void);
  box-shadow: 0 0 8px rgba(158, 232, 179, 0.5), inset 0 0 0 1px var(--line);
  cursor: ew-resize;
}
input[type="range"]::-moz-range-thumb {
  width: 16px; height: 16px;
  background: var(--phosphor);
  border-radius: 50%;
  border: 2px solid var(--bg-void);
  box-shadow: 0 0 8px rgba(158, 232, 179, 0.5);
  cursor: ew-resize;
}

/* W chain (real-world solar power flow) */
.w-chain {
  margin-top: 0.85rem;
  padding: 0.85rem 1rem;
  background: var(--bg-recessed);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-recess);
}
.w-chain-label {
  font-family: var(--font-display);
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-dim);
  font-weight: 500;
  margin-bottom: 0.55rem;
}
.w-chain-list {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.w-chain-row {
  display: grid;
  grid-template-columns: 8rem 5rem 1fr;
  gap: 0.6rem;
  align-items: baseline;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  padding: 0.18rem 0.4rem;
  border-radius: 2px;
}
.w-chain-row.dim    { color: var(--text-dim); }
.w-chain-row.good   { color: var(--phosphor); text-shadow: var(--shadow-glow-p); border-top: 1px dashed var(--line); padding-top: 0.4rem; margin-top: 0.2rem; font-weight: 500; }
.w-chain-row.danger { color: var(--coral); }
.w-chain-name { color: inherit; }
.w-chain-w    { text-align: right; font-variant-numeric: tabular-nums; }
.w-chain-sub  { color: var(--text-faint); font-size: 0.72rem; }

/* Diagnostics — "why isn't this working?" cards */
.diag-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.diag-ok {
  display: flex; align-items: center; gap: 0.55rem;
  padding: 0.85rem 1.1rem;
  border: 1px solid var(--phosphor-low);
  background:
    linear-gradient(90deg, rgba(158, 232, 179, 0.06), transparent 80%),
    var(--bg-recessed);
  border-radius: var(--r-md);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--phosphor);
  text-shadow: var(--shadow-glow-p);
}
.diag-ok-icon {
  display: inline-flex;
  width: 22px; height: 22px;
  align-items: center; justify-content: center;
  border-radius: 50%;
  background: var(--phosphor);
  color: var(--bg-void);
  font-weight: 700;
  flex: 0 0 auto;
  text-shadow: none;
}

.diag-card {
  border: 1px solid var(--line);
  background: var(--bg-recessed);
  border-radius: var(--r-md);
  padding: 0.85rem 1.1rem;
  box-shadow: var(--shadow-recess);
}
.diag-card.diag-danger {
  border-color: var(--coral);
  background:
    linear-gradient(90deg, rgba(255, 133, 121, 0.06), transparent 70%),
    var(--bg-recessed);
}
.diag-card.diag-warn {
  border-color: var(--amber);
  background:
    linear-gradient(90deg, rgba(245, 194, 101, 0.05), transparent 70%),
    var(--bg-recessed);
}
.diag-head {
  display: flex; align-items: center; gap: 0.65rem;
  margin-bottom: 0.45rem;
}
.diag-icon {
  display: inline-flex;
  width: 22px; height: 22px;
  align-items: center; justify-content: center;
  border-radius: 50%;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.85rem;
  flex: 0 0 auto;
}
.diag-danger .diag-icon {
  background: var(--coral); color: var(--bg-void);
  box-shadow: 0 0 10px rgba(255, 133, 121, 0.5);
  animation: led-pulse 1.4s ease-in-out infinite;
}
.diag-warn .diag-icon {
  background: var(--amber); color: var(--bg-void);
  box-shadow: 0 0 8px rgba(245, 194, 101, 0.4);
}
.diag-title {
  font-family: var(--font-display);
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--text);
  letter-spacing: -0.005em;
}
.diag-card.diag-danger .diag-title { color: var(--coral); }
.diag-card.diag-warn   .diag-title { color: var(--amber); }
.diag-detail {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-soft);
  line-height: 1.55;
  letter-spacing: 0.005em;
  margin-bottom: 0.55rem;
}
.diag-fix {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  padding: 0.5rem 0.7rem;
  background: var(--bg-input);
  border: 1px solid var(--line-faint);
  border-left: 2px solid var(--phosphor-low);
  border-radius: 2px;
}
.diag-fix-label {
  color: var(--phosphor);
  font-weight: 600;
  letter-spacing: 0.06em;
  font-size: 0.7rem;
}
.diag-fix-text { color: var(--text-soft); }

/* Bottom-of-planner save-config buttons */
.planner-rec-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem 0.85rem;
  margin-top: 0.6rem;
  padding-top: 0.85rem;
  border-top: 1px dashed var(--line-faint);
}
.save-config-btn {
  font-size: 0.74rem;
  padding: 0.5rem 0.95rem;
  background: rgba(108, 199, 255, 0.06);
  border-color: var(--cyan-low);
  color: var(--cyan);
}
.save-config-btn:hover {
  background: rgba(108, 199, 255, 0.14);
  border-color: var(--cyan);
}
.save-config-status {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  letter-spacing: 0.01em;
  flex: 1 1 auto;
  min-width: 0;
  word-break: break-all;
}
.save-config-status.good   { color: var(--phosphor); text-shadow: var(--shadow-glow-p); }
.save-config-status.warn   { color: var(--amber); }
.save-config-status.danger { color: var(--coral); }
.bank-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.55rem;
  padding-bottom: 0.45rem;
  border-bottom: 1px solid var(--line-faint);
}
.bank-v {
  font-family: var(--font-mono);
  font-size: 1.2rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
}
.bank-tag {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  padding: 0.18rem 0.45rem;
  border-radius: var(--r-sm);
  background: rgba(158, 232, 179, 0.12);
  color: var(--phosphor);
  border: 1px solid var(--phosphor-low);
}
.bank-tag.pinned {
  background: rgba(108, 199, 255, 0.10);
  color: var(--cyan);
  border-color: var(--cyan-low);
}
.bank-stats {
  margin: 0;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.18rem 0.85rem;
}
.bank-stats dt {
  font-family: var(--font-display);
  font-size: 0.62rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-dim);
  padding: 0.05rem 0;
}
.bank-stats dd {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-soft);
  text-align: right;
  padding: 0.05rem 0;
}
.bank-stats dd.good   { color: var(--phosphor); text-shadow: var(--shadow-glow-p); }
.bank-stats dd.warn   { color: var(--amber); }
.bank-stats dd.danger { color: var(--coral); }

/* Pack runtime scenarios (12h / 24h / 48h cards) */
.scenarios-wrap { display: flex; flex-direction: column; gap: 0.6rem; }
.scenarios-intro {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-dim);
}
.scenarios-intro strong { color: var(--phosphor); text-shadow: var(--shadow-glow-p); }
.scenarios-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.6rem;
}
.scenario-card {
  background: var(--bg-recessed);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 0.7rem 0.9rem 0.85rem;
  box-shadow: var(--shadow-recess);
  display: flex; flex-direction: column; gap: 0.3rem;
}
.scenario-h {
  font-family: var(--font-display);
  font-size: 0.62rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-dim);
  font-weight: 600;
}
.scenario-pack {
  font-family: var(--font-mono);
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--phosphor);
  letter-spacing: -0.01em;
  text-shadow: var(--shadow-glow-p);
}
.scenario-pack-wh {
  font-size: 0.85rem;
  color: var(--text-soft);
  font-weight: 500;
  text-shadow: none;
}
.scenario-cells {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  color: var(--text-dim);
}
.scenario-mass {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  color: var(--text-faint);
}

/* Layouts table (S × P comparison) */
.layouts-wrap {
  margin-top: 0.85rem;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--bg-recessed);
  box-shadow: var(--shadow-recess);
}
.layouts-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-mono);
  font-size: 0.76rem;
}
.layouts-table thead th {
  font-family: var(--font-display);
  font-size: 0.6rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-align: left;
  color: var(--text-dim);
  font-weight: 500;
  padding: 0.6rem 0.7rem;
  background: var(--bg-input);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.layouts-table tbody td {
  padding: 0.5rem 0.7rem;
  border-bottom: 1px solid var(--line-faint);
  color: var(--text-soft);
  white-space: nowrap;
}
.layouts-table tbody tr:last-child td { border-bottom: 0; }
.layouts-table tbody tr.is-best {
  background: linear-gradient(90deg, rgba(158, 232, 179, 0.07), transparent);
  border-left: 2px solid var(--phosphor);
}
.layouts-table tbody tr.is-best td:first-child {
  color: var(--phosphor);
  font-weight: 600;
  text-shadow: var(--shadow-glow-p);
}
.layouts-table td.good   { color: var(--phosphor); text-shadow: var(--shadow-glow-p); }
.layouts-table td.warn   { color: var(--amber); }
.layouts-table td.danger { color: var(--coral); }

.array-note {
  margin-top: 0.85rem;
  padding: 0.85rem 1rem;
  background: var(--bg-input);
  border: 1px solid var(--line-faint);
  border-left: 2px solid var(--phosphor);
  border-radius: var(--r-sm);
}
.array-note.warn { border-left-color: var(--amber); }
.array-note .note-h {
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 0.45rem;
}
.array-note .note-b {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-dim);
  line-height: 1.55;
}
.array-note .note-b strong.good   { color: var(--phosphor); text-shadow: var(--shadow-glow-p); }
.array-note .note-b strong.warn   { color: var(--amber); }
.array-note .note-b strong.danger { color: var(--coral); }

/* Sustainability projection */
.sustain-head {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  padding: 0.7rem 0.85rem;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  background: var(--bg-recessed);
  box-shadow: var(--shadow-recess);
  display: flex; align-items: center; gap: 0.55rem; flex-wrap: wrap;
  margin-bottom: 0.85rem;
}
.sustain-head.good {
  border-color: var(--phosphor-low);
  background:
    linear-gradient(90deg, rgba(158, 232, 179, 0.08), transparent 70%),
    var(--bg-recessed);
}
.sustain-head.danger {
  border-color: var(--coral);
  background:
    linear-gradient(90deg, rgba(255, 133, 121, 0.08), transparent 70%),
    var(--bg-recessed);
}
.sustain-icon {
  display: inline-flex;
  width: 22px; height: 22px;
  align-items: center; justify-content: center;
  border-radius: 50%;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.85rem;
  flex: 0 0 auto;
}
.sustain-head.good .sustain-icon {
  background: var(--phosphor); color: var(--bg-void);
  box-shadow: 0 0 10px rgba(158, 232, 179, 0.4);
}
.sustain-head.danger .sustain-icon {
  background: var(--coral); color: var(--bg-void);
  box-shadow: 0 0 10px rgba(255, 133, 121, 0.5);
  animation: led-pulse 1.4s ease-in-out infinite;
}
.sustain-head .sustain-msg { color: var(--text-soft); }
.sustain-head strong { color: var(--text); font-weight: 600; }
.sustain-head.good strong   { color: var(--phosphor); text-shadow: var(--shadow-glow-p); }
.sustain-head.danger strong { color: var(--coral); }

.sustain-timeline {
  display: grid;
  grid-template-columns: repeat(14, 1fr);
  gap: 4px;
  height: 110px;
  padding: 0.6rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--bg-recessed);
  box-shadow: var(--shadow-recess);
}
.sustain-cell {
  display: flex;
  flex-direction: column-reverse;
  align-items: stretch;
  position: relative;
  background: var(--bg-void);
  border-radius: 1px;
  overflow: hidden;
  cursor: help;
}
.sustain-fill {
  width: 100%;
  border-top: 1px solid rgba(255,255,255,0.08);
  transition: height .25s ease, background .25s ease;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.12);
  position: relative;
  z-index: 2;
}
/* Evening (6pm) refill overlay — outline-only, sits behind the morning bar */
.sustain-fill-evening {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  border: 1px dashed rgba(108, 199, 255, 0.4);
  border-bottom: 0;
  background: transparent;
  pointer-events: none;
  z-index: 1;
  transition: height .25s ease;
}

.sustain-explainer {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-faint);
  margin: -0.25rem 0 0.6rem;
  padding: 0.35rem 0;
  letter-spacing: 0.01em;
}
.sustain-day-label {
  position: absolute;
  bottom: -1.05rem;
  left: 0; right: 0;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 0.55rem;
  color: var(--text-mute);
  letter-spacing: 0.04em;
}
.sustain-legend {
  display: flex; gap: 1rem; flex-wrap: wrap;
  margin-top: 1.6rem;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-dim);
}
.leg-item { display: inline-flex; align-items: center; gap: 0.35rem; }
.leg-dot {
  width: 9px; height: 9px; border-radius: 50%;
  display: inline-block;
}
.leg-dot.good   { background: var(--phosphor); box-shadow: 0 0 6px rgba(158, 232, 179, 0.4); }
.leg-dot.warn   { background: var(--amber); }
.leg-dot.danger { background: var(--coral); }
.leg-dot.empty  { background: #5a1a1a; border: 1px solid #2a0808; }

/* Recommendation card */
.recommendation-card {
  background:
    linear-gradient(180deg, rgba(108, 199, 255, 0.04), transparent 50%),
    var(--bg-recessed);
  border: 1px solid var(--cyan-low);
  border-radius: var(--r-md);
  padding: 1rem 1.2rem 1.1rem;
  box-shadow: var(--shadow-recess), 0 0 24px rgba(108, 199, 255, 0.08);
}
.rec-header {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-bottom: 0.85rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--line-faint);
  flex-wrap: wrap; gap: 0.5rem;
}
.rec-title {
  font-family: var(--font-display);
  font-size: 0.92rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--cyan);
}
.rec-eta {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--phosphor);
  text-shadow: var(--shadow-glow-p);
}
.rec-grid {
  display: grid;
  grid-template-columns: 12rem 1fr;
  gap: 0.45rem 1rem;
}
.rec-k {
  font-family: var(--font-display);
  font-size: 0.62rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-dim);
  padding-top: 0.18rem;
}
.rec-v {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text-soft);
}
.rec-v.good   { color: var(--phosphor); text-shadow: var(--shadow-glow-p); }
.rec-v.warn   { color: var(--amber); }
.rec-v.danger { color: var(--coral); }

@media (max-width: 700px) {
  .rec-grid { grid-template-columns: 1fr; gap: 0.15rem 0; }
  .rec-k { padding-top: 0.6rem; }
  .rec-v { padding-bottom: 0.4rem; border-bottom: 1px dashed var(--line-faint); }
}

/* --------------------------------------------------------------------------
   11. FOOTER
   -------------------------------------------------------------------------- */
.footer {
  text-align: center;
  color: var(--text-faint);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  padding: 2.5rem 1rem 3rem;
  border-top: 1px solid var(--line-faint);
  position: relative;
  margin-top: 1.5rem;
}
.footer p { margin: 0; max-width: 64ch; margin-inline: auto; }
.footer::before {
  content: "// END OF DOCUMENT";
  display: block;
  font-family: var(--font-mono);
  font-size: 0.6rem;
  color: var(--text-mute);
  letter-spacing: 0.18em;
  margin-bottom: 0.85rem;
}

/* --------------------------------------------------------------------------
   12. UTILITIES
   -------------------------------------------------------------------------- */
.hidden    { display: none !important; }
.muted     { color: var(--text-dim); }
.mono      { font-family: var(--font-mono); }
.flex-row  { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.flex-grow { flex: 1 1 auto; }

/* Scrollbar — minimal dark */
* { scrollbar-color: var(--line) transparent; scrollbar-width: thin; }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: var(--line); border-radius: 4px; }
*::-webkit-scrollbar-thumb:hover { background: var(--line-bright); }

/* --------------------------------------------------------------------------
   13. RESPONSIVE
   -------------------------------------------------------------------------- */
@media (max-width: 900px) {
  .tier { padding: 1.25rem 0.85rem 0.75rem; }
  .tier-header { padding-left: 3.5rem; }
  .tier-header::before { font-size: 1.9rem; }
  .tier-header h2 { font-size: 1.15rem; }
  .quick-grid { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 0.7rem; }
  .results-section .section-body { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
}

@media (max-width: 640px) {
  body { font-size: 12.5px; }
  .topbar { flex-wrap: wrap; padding: 0.6rem 0.85rem; gap: 0.85rem; }
  .topbar-actions { width: 100%; justify-content: flex-start; }
  .topbar-actions select { flex: 1 1 auto; }
  .tier { padding: 1rem 0.6rem; }
  .tier-header { padding-left: 3rem; min-height: 2.6rem; }
  .tier-header::before { font-size: 1.7rem; }
  .quick-grid { grid-template-columns: 1fr; gap: 0.6rem; }
  .calc-body { grid-template-columns: 1fr 1fr; }
  .section-head { padding: 0.7rem 0.85rem; gap: 0.5rem 0.85rem; }
  .section-head h3 + p { margin-left: 0; padding-left: 0; border-left: 0; flex-basis: 100%; }
  .section-body { padding: 0.75rem 0.6rem 0.85rem; }
  .component-row { padding: 0.6rem 0.7rem; gap: 0.45rem 0.65rem; }
  .metric-card { padding: 0.7rem 0.85rem 0.8rem; }
  .metric-card .value { font-size: 1.3rem; }
}

/* --------------------------------------------------------------------------
   14. PRINT (engineering hand-off)
   -------------------------------------------------------------------------- */
@media print {
  body { background: white; color: black; }
  .topbar, .add-btn, .row-actions, .footer { display: none; }
  .calc-card, .builder-section, .metric-card, .component-row {
    background: white; border: 1px solid #888; box-shadow: none;
  }
  .calc-out, .metric-card .value.good { color: #008844; text-shadow: none; }
}

/* --------------------------------------------------------------------------
   15. REDUCED MOTION
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
