/* Studio shell — top bar + context rail + full-bleed viewport + inspector.
   Loaded after styles.css; the old .app-shell/.controls/.stage/.toolbar/.readout
   rules remain in styles.css but are no longer referenced by the markup. */

.shell {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) auto;
  /* third row is the output dock; it collapses to 0 while the dock is hidden */
  grid-template-rows: 46px minmax(0, 1fr) auto;
  grid-template-areas:
    "top  top  top"
    "rail view insp"
    "rail dock insp";
  height: 100vh;
  overflow: hidden;
}

/* top bar */
.topbar {
  grid-area: top;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 12px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}
.topbar .brand { display: flex; align-items: center; align-self: center; padding: 0; border: 0; }
.topbar .brand img { height: 24px; width: auto; display: block; margin-right: 10px; }
.topbar .doc { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.topbar .doc strong { font-size: 0.9rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .doc span { font-size: 0.8rem; color: var(--muted); white-space: nowrap; }
.topbar-actions { margin-left: auto; display: flex; gap: 6px; }
.topbar-actions button {
  border: 1px solid var(--line);
  background: var(--field);
  color: var(--ink);
  border-radius: 7px;
  padding: 5px 10px;
  font-size: 0.8rem;
  cursor: pointer;
}
.topbar-actions button:hover { border-color: #b9cbbb; }
.topbar-actions button.primary { background: var(--green); border-color: var(--green); color: #fff; font-weight: 600; }
.topbar-actions button.primary:hover { background: var(--green-dark); }

/* context rail */
.rail {
  grid-area: rail;
  background: var(--panel);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding-top: 8px;
}
.rail button {
  width: 46px; height: 46px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  border: 0; background: none; color: var(--muted);
  border-radius: 8px; cursor: pointer; padding: 0;
}
.rail button svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.rail button em { font-style: normal; font-size: 0.58rem; letter-spacing: 0.02em; }
.rail button:hover { background: var(--field); color: var(--ink); }
.rail button.is-active { background: #e6f0e6; color: var(--green-dark); }

/* viewport */
.viewport { grid-area: view; position: relative; min-width: 0; min-height: 0; background: var(--bg); }
.viewport #scene { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.viewport .legend {
  position: absolute; left: 12px; bottom: 12px; margin: 0;
  display: flex; gap: 12px; padding: 6px 10px;
  background: rgba(255, 255, 255, 0.86); border: 1px solid var(--line);
  border-radius: 8px; font-size: 0.72rem; color: var(--muted);
  pointer-events: none;
}

/* inspector */
.inspector {
  grid-area: insp;
  width: 302px;
  background: var(--panel);
  border-left: 1px solid var(--line);
  display: flex; flex-direction: column; min-height: 0;
}
.inspector.hidden { display: none; }
.insp-head { display: flex; align-items: center; gap: 6px; padding: 8px; border-bottom: 1px solid var(--line); }
.insp-head input {
  flex: 1; min-width: 0; border: 1px solid var(--line); background: var(--field);
  border-radius: 7px; padding: 6px 9px; font-size: 0.8rem; color: var(--ink);
}
.insp-head button {
  border: 1px solid var(--line); background: var(--field); color: var(--muted);
  border-radius: 7px; width: 26px; height: 28px; cursor: pointer; font-size: 0.9rem; line-height: 1;
}
.insp-body { flex: 1; overflow-y: auto; padding: 6px 0 10px; }
.insp-foot {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px;
  padding: 8px 10px; border-top: 1px solid var(--line); background: var(--field);
}
.insp-foot button {
  border: 1px solid var(--line); background: var(--panel); color: var(--ink);
  border-radius: 7px; padding: 5px 10px; font-size: 0.76rem; cursor: pointer;
  /* beat the global button { width:100%; min-width:108px } so three fit the panel */
  width: auto; min-width: 0; min-height: 0; flex: none; font-weight: 500;
}
.insp-foot button:hover { border-color: #b9cbbb; }
.insp-foot .foot-actions { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.insp-foot .foot-actions button { padding: 5px 9px; }
/* status sits on its own line so the buttons never get pushed out of a narrow panel */
.preset-status {
  order: 2; flex: 1 0 100%; min-width: 0;
  font-size: 0.7rem; line-height: 1.3; color: var(--muted);
}
.preset-status:empty { display: none; }
.preset-status.bad { color: #b4472f; }
.insp-show {
  position: fixed; top: 56px; right: 10px; z-index: 40;
  border: 1px solid var(--line); background: var(--panel); color: var(--muted);
  border-radius: 7px; width: 26px; height: 28px; cursor: pointer;
}

/* parameter groups */
.grp { border-bottom: 1px solid var(--line); }
.grp-head {
  width: 100%; display: flex; align-items: center; gap: 7px;
  padding: 9px 10px; border: 0; background: none; cursor: pointer;
  font-size: 0.79rem; font-weight: 600; color: var(--ink); text-align: left;
  letter-spacing: 0.02em; text-transform: uppercase;
}
.grp-caret { width: 0; height: 0; border-left: 4px solid var(--muted); border-top: 3.5px solid transparent; border-bottom: 3.5px solid transparent; transform: rotate(90deg); transition: transform 0.12s; }
.grp.collapsed .grp-caret { transform: rotate(0deg); }
.grp-title { flex: 1; }
.grp-reset { color: transparent; font-size: 0.85rem; padding: 0 2px; border-radius: 5px; }
.grp:hover .grp-reset { color: var(--muted); }
.grp.has-dirty .grp-reset { color: var(--green); }
.grp-reset:hover { background: var(--field); }
.grp.collapsed .grp-body { display: none; }
.grp-body { padding: 0 10px 8px; }

/* parameter rows */
.row { padding: 5px 0; }
.row-top { display: flex; align-items: center; gap: 6px; }
.row-label { flex: 1; font-size: 0.78rem; color: var(--muted); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-fmt { font-size: 0.72rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.row-num, .row select, .row input[type="number"] {
  border: 1px solid var(--line); background: var(--field); color: var(--ink);
  border-radius: 6px; padding: 3px 6px; font-size: 0.76rem; font-variant-numeric: tabular-nums;
}
.row-num { width: 58px; text-align: right; }
.row-stack select { width: 100%; margin-top: 4px; }
.row-inline input[type="number"] { width: 76px; text-align: right; }
.row-inline .row-label { flex: 1; }
.row input[type="range"] { width: 100%; margin: 4px 0 0; accent-color: var(--green); }
.row-dot {
  width: 9px; height: 9px;
  min-width: 0; min-height: 0;   /* beat the global button min-width/height */
  flex: none; padding: 0; border-radius: 50%;
  border: 0; background: transparent; cursor: default;
}
.row.dirty .row-dot { background: var(--green); cursor: pointer; }
.row.dirty .row-label { color: var(--ink); font-weight: 600; }
.row-check { display: flex; align-items: center; gap: 7px; }
.row-check .row-label { flex: 1; }

/* summary panel */
.summary { padding: 10px; }
.sum-group { margin-bottom: 14px; }
.sum-group h3 {
  margin: 0 0 7px; font-size: 0.7rem; font-weight: 700; color: var(--muted);
  letter-spacing: 0.06em; text-transform: uppercase;
}
.sum-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.sum-grid > div { background: var(--field); border: 1px solid var(--line); border-radius: 8px; padding: 7px 9px; }
.sum-grid span { display: block; font-size: 0.68rem; color: var(--muted); }
.sum-grid strong { display: block; font-size: 0.92rem; font-variant-numeric: tabular-nums; }
.sum-grid em { display: block; font-style: normal; font-size: 0.62rem; color: var(--green); }
.sum-click { cursor: pointer; }
.sum-click:hover { border-color: var(--green); }
.sum-actions { display: grid; gap: 6px; }
.sum-actions button {
  border: 1px solid var(--line); background: var(--panel); color: var(--ink);
  border-radius: 7px; padding: 7px 10px; font-size: 0.78rem; cursor: pointer; text-align: left;
}
.sum-actions button:hover { border-color: var(--green); }

/* ── minimal icon buttons ────────────────────────────────────────────────
   styles.css forces `button { width:100%; min-width:108px; min-height:38px;
   font-weight:700 }` globally, which turned every close "×" into a large bold
   slab. Close/affordance buttons are square and quiet instead. */
#detailsClose, #powerClose, #mapClose, #nhbClose,
#inspCollapse, #inspShow {
  width: 28px; min-width: 28px;
  height: 28px; min-height: 28px;
  padding: 0;
  flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 1.05rem; font-weight: 400; line-height: 1;
  color: var(--muted);
  border-radius: 7px;
}
#detailsClose:hover, #powerClose:hover, #mapClose:hover, #nhbClose:hover {
  color: var(--ink); border-color: #b9cbbb;
}

/* modal headers: title stays on one line, actions stay compact */
.env-header, .details-header, .map-header { gap: 10px; flex-wrap: wrap; }
.env-header h2, .details-header h2 {
  font-size: 1rem; font-weight: 700; margin: 0; flex: 1 1 auto; min-width: 0;
}
.env-header-actions { flex: 0 0 auto; }
.env-header-actions button, .map-header button {
  min-width: 0; min-height: 32px; padding: 0 12px;
  font-size: 0.82rem; font-weight: 600; white-space: nowrap;
}
.map-header input, .map-header .map-latlon { min-width: 0; }

@media (max-width: 900px) {
  .shell { grid-template-columns: 48px minmax(0, 1fr); grid-template-areas: "top top" "rail view"; }
  .inspector { position: fixed; right: 0; top: 46px; bottom: 0; z-index: 30; box-shadow: var(--shadow); }
}


/* ---------------------------------------------------------------------------
   Output dock — the BOM / notes / schedules, docked under the model instead of
   covering it, so a parameter change and its cost consequence are visible at once.
   --------------------------------------------------------------------------- */
.dock {
  grid-area: dock;
  height: var(--dock-h, 300px);
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border-top: 1px solid var(--line);
}
.dock[hidden] { display: none; }

.dock-grip {
  height: 6px;
  flex: 0 0 auto;
  cursor: ns-resize;
  background: transparent;
  border-bottom: 1px solid transparent;
}
.dock-grip:hover, .dock-grip:focus-visible { background: var(--field); border-bottom-color: var(--line); outline: none; }
body.dock-resizing { cursor: ns-resize; user-select: none; }
body.dock-resizing #scene { pointer-events: none; }

.dock-head {
  display: flex; align-items: center; gap: 12px;
  padding: 0 10px 0 12px; height: 34px; flex: 0 0 auto;
  border-bottom: 1px solid var(--line);
}
.dock-head h2 {
  margin: 0; font-size: 0.76rem; font-weight: 600; color: var(--muted);
  letter-spacing: 0.03em; text-transform: uppercase;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 34%;
}
.dock-tabs { display: flex; gap: 2px; overflow-x: auto; flex: 1; min-width: 0; }
.dock-tabs button {
  width: auto; min-width: 0; min-height: 0; flex: none;
  border: 0; background: none; color: var(--muted);
  font-size: 0.76rem; font-weight: 500; cursor: pointer;
  padding: 6px 9px; border-radius: 6px 6px 0 0;
  border-bottom: 2px solid transparent; white-space: nowrap;
}
.dock-tabs button:hover { color: var(--ink); background: var(--field); }
.dock-tabs button.is-active { color: var(--green-dark); border-bottom-color: var(--green); font-weight: 600; }
.dock-head #detailsClose {
  width: 24px; min-width: 24px; height: 24px; min-height: 24px;
  flex: none; padding: 0; margin-left: auto;
  border: 0; background: none; color: var(--muted);
  font-size: 1rem; font-weight: 400; line-height: 1; border-radius: 6px; cursor: pointer;
}
.dock-head #detailsClose:hover { background: var(--field); color: var(--ink); }

.dock-body { flex: 1; min-height: 0; overflow: auto; padding: 12px 14px; }
.dock-pane[hidden] { display: none; }
.dock-pane > h2 { margin: 0 0 8px; font-size: 0.85rem; font-weight: 600; }
.dock-pane ul {
  display: grid; gap: 5px; margin: 0; padding-left: 18px;
  color: var(--muted); font-size: 0.82rem; line-height: 1.4;
}
.dock-pane table { width: 100%; font-size: 0.82rem; }
.dock-pane .design-actions { margin-bottom: 10px; }
.dock-pane .design-actions button { width: auto; min-width: 0; min-height: 0; flex: none; padding: 6px 12px; font-size: 0.8rem; }
.dock-pane #compareTable th { white-space: nowrap; }
.dock-pane #compareTable button {
  width: auto; min-width: 0; min-height: 0; flex: none;
  margin-left: 6px; padding: 2px 7px; font-size: 0.7rem; font-weight: 500;
  border: 1px solid var(--line); background: var(--field); color: var(--muted);
  border-radius: 5px; cursor: pointer;
}
.dock-pane #compareTable button:hover { color: var(--ink); border-color: #b9cbbb; }


/* Simulate modal: polysim is the primary action; the local stress test is secondary.
   The stress test no longer predicts climate (polysim does that from real hourly
   weather) — it only survives-or-not the frame and shows which kit engages when. */
.season-play-secondary {
  background: transparent;
  color: var(--ink);
  border-color: var(--line);
  font-weight: 600;
}
.season-play-secondary:hover { background: var(--field); border-color: #b9cbbb; color: var(--ink); }
/* ---- Simulate panel: run actions, live controls, scenario, results ---- */
.insp-body.sim { padding: 0 0 12px; }
/* #sitePanel is appended into #controlsRoot, so it flows with the groups */
#sitePanel { padding-bottom: 12px; }
#sitePanel .sim-group { border-bottom: 0; }
.sim-group { padding: 10px 12px; border-bottom: 1px solid var(--line); }
.sim-group h3 {
  margin: 0 0 8px; font-size: 0.72rem; font-weight: 600; color: var(--muted);
  letter-spacing: 0.03em; text-transform: uppercase;
}
.sim-note { margin: -4px 0 8px; font-size: 0.7rem; color: var(--muted); line-height: 1.35; }
.sim-actions { display: grid; gap: 6px; }
.sim-actions button {
  width: 100%; min-width: 0; min-height: 0; padding: 8px 10px;
  border-radius: 8px; font-size: 0.8rem; cursor: pointer; border: 1px solid var(--line);
}
.sim-primary { background: #7c3aed; border-color: #7c3aed; color: #fff; font-weight: 600; }
.sim-primary:hover { background: #6d28d9; border-color: #6d28d9; }
.sim-primary:disabled { opacity: 0.55; cursor: progress; }
.sim-secondary { background: var(--field); color: var(--ink); font-weight: 500; }
.sim-secondary:hover { border-color: #b9cbbb; }
.sim-results { padding: 10px 12px; }
.sim-results:empty { display: none; }
.map-loc {
  padding: 8px 10px; margin-bottom: 8px;
  border: 1px solid var(--line); border-radius: 8px; background: var(--field);
  font-size: 0.76rem; color: var(--ink); line-height: 1.35;
}
.insp-body.sim .control-row { display: grid; gap: 4px; margin-bottom: 10px; }
.insp-body.sim .control-row label { font-size: 0.76rem; color: var(--ink); display: flex; justify-content: space-between; gap: 8px; }
.insp-body.sim .control-row.disabled { opacity: 0.4; pointer-events: none; }
.insp-body.sim .control-row-toggle { grid-template-columns: 1fr auto; align-items: center; }
.insp-body.sim .control-toggle,
.insp-body.sim .control-actions button {
  width: auto; min-width: 0; min-height: 0; flex: none;
  padding: 4px 10px; font-size: 0.74rem; font-weight: 500;
  border: 1px solid var(--line); background: var(--panel); color: var(--ink);
  border-radius: 6px; cursor: pointer;
}
.insp-body.sim .control-actions { display: flex; gap: 6px; }
.insp-body.sim .env-sliders { display: grid; grid-template-columns: 1fr; gap: 10px; }
.insp-body.sim .env-sliders label { display: grid; gap: 3px; font-size: 0.76rem; color: var(--ink); }
.insp-body.sim .env-sliders label span { color: var(--green-dark); font-weight: 600; font-size: 0.72rem; }

/* ---- chart cards: the panel lists charts, the popup shows them ---- */
.chart-card {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px; margin-bottom: 6px;
  border: 1px solid var(--line); border-radius: 8px; background: var(--field);
}
.chart-card-text { display: grid; gap: 2px; min-width: 0; flex: 1; }
.chart-card-text strong { font-size: 0.78rem; font-weight: 600; }
.chart-card-text span { font-size: 0.68rem; color: var(--muted); line-height: 1.3; }
.chart-card .chart-open {
  width: auto; min-width: 0; min-height: 0; flex: none;
  padding: 5px 10px; font-size: 0.72rem; font-weight: 500;
  border: 1px solid var(--line); background: var(--panel); color: var(--ink);
  border-radius: 6px; cursor: pointer;
}
.chart-card .chart-open:hover { border-color: #b9cbbb; }

/* ---- chart popup ---- */
.chart-modal {
  position: fixed; inset: 0; z-index: 70;
  background: rgba(24, 32, 28, 0.55);
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
.chart-modal[hidden] { display: none; }
.chart-dialog {
  width: min(1240px, 100%); height: min(660px, 90vh);
  display: flex; flex-direction: column;
  background: var(--panel); border-radius: 14px; overflow: hidden;
  box-shadow: 0 24px 70px rgba(20, 30, 24, 0.4);
}
.chart-head {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px 10px 16px; border-bottom: 1px solid var(--line); flex: 0 0 auto;
}
.chart-titles { display: grid; gap: 2px; flex: 1; min-width: 0; }
.chart-titles strong { font-size: 0.92rem; }
.chart-titles span { font-size: 0.74rem; color: var(--muted); }
.chart-head button {
  width: auto; min-width: 0; min-height: 0; flex: none;
  border: 1px solid var(--line); background: var(--field); color: var(--ink);
  border-radius: 7px; padding: 5px 10px; font-size: 0.76rem; font-weight: 500; cursor: pointer;
}
.chart-head .chart-close {
  width: 28px; min-width: 28px; height: 28px; padding: 0;
  border: 0; background: none; color: var(--muted); font-size: 1.1rem; line-height: 1;
}
.chart-head .chart-close:hover { background: var(--field); color: var(--ink); }
.chart-plot { flex: 1; min-height: 0; padding: 8px 12px; }
.chart-plot canvas { width: 100%; height: 100%; display: block; cursor: crosshair; touch-action: none; }
.chart-plot canvas.is-panning { cursor: grabbing; }
.chart-foot {
  flex: 0 0 auto; padding: 8px 16px; border-top: 1px solid var(--line);
  font-size: 0.72rem; color: var(--muted);
}
.env-section-title {
  margin: 16px 0 6px; font-size: 0.78rem; font-weight: 600; color: var(--muted);
  letter-spacing: 0.03em; text-transform: uppercase;
}


/* Map picker header: the global button { width:100% } stacks these one per line. */
.map-header button {
  width: auto; min-width: 0; min-height: 38px; flex: none;
  padding: 0 14px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--field); color: var(--ink);
  font-size: 0.82rem; font-weight: 500; cursor: pointer;
}
.map-header button:hover { border-color: #b9cbbb; }
.map-header .map-use { background: var(--green); border-color: var(--green); color: #fff; font-weight: 600; }
.map-header .map-use:hover:not(:disabled) { background: var(--green-dark); border-color: var(--green-dark); }
.map-header .map-use:disabled { opacity: 0.5; cursor: not-allowed; }
.map-header #mapClose { margin-left: auto; }


/* Stress sliders that mirror a design parameter say so, and can be unlinked. */
.env-link {
  width: auto; min-width: 0; min-height: 0; flex: none;
  justify-self: start; padding: 1px 0; border: 0; background: none;
  font-size: 0.66rem; font-weight: 500; color: var(--muted);
  cursor: default; text-align: left;
}
.env-link.is-override { color: var(--green-dark); cursor: pointer; text-decoration: underline; }
.env-link[hidden] { display: none; }

.sum-note { margin: 6px 0 8px; font-size: 0.68rem; color: var(--muted); line-height: 1.35; }
.sum-note.is-estimate { color: #8a6d1f; }


/* ---- profit and loss ---- */
.sum-results { padding: 0 12px 12px; }
.pnl-basis {
  font-size: 0.68rem; color: var(--muted); line-height: 1.4;
  padding: 6px 8px; margin-bottom: 8px;
  background: var(--field); border: 1px solid var(--line); border-radius: 7px;
}
.pnl-block { margin-bottom: 10px; }
.pnl-block h4 {
  margin: 0 0 4px; font-size: 0.68rem; font-weight: 600; color: var(--muted);
  letter-spacing: 0.03em; text-transform: uppercase;
}
.pnl-row {
  display: flex; align-items: baseline; justify-content: space-between; gap: 10px;
  padding: 3px 0; font-size: 0.76rem; border-bottom: 1px dotted var(--line);
}
.pnl-row span { min-width: 0; }
.pnl-row em { display: block; font-style: normal; font-size: 0.64rem; color: var(--muted); }
.pnl-row b { font-variant-numeric: tabular-nums; white-space: nowrap; font-weight: 600; }
.pnl-row.is-subtotal { border-bottom: 0; border-top: 1px solid var(--line); margin-top: 2px; padding-top: 5px; }
.pnl-row.is-total { border: 0; margin-top: 2px; padding: 6px 8px; border-radius: 7px; font-size: 0.8rem; }
.pnl-row.is-good { background: #e8f2ea; }
.pnl-row.is-good b { color: var(--green-dark); }
.pnl-row.is-bad { background: #fbecea; }
.pnl-row.is-bad b { color: #b4472f; }

.search-hint {
  padding: 6px 10px; margin: 0; font-size: 0.68rem; line-height: 1.35;
  color: #8a6d1f; background: #fdf6e3; border-bottom: 1px solid var(--line);
}
.search-hint[hidden] { display: none; }

.row-hint {
  display: block; margin-top: 4px; padding: 5px 7px;
  font-size: 0.66rem; line-height: 1.4; color: #8a6d1f;
  background: #fdf6e3; border-radius: 6px;
}
.row-hint[hidden] { display: none; }
.row-hint b { color: #6d5516; }

/* a value outside the NHB minimum standard (set by the app via setCaution) */
.row-caution {
  display: block; margin-top: 4px; padding: 5px 7px;
  font-size: 0.66rem; line-height: 1.4; color: #9b2c1f;
  background: #fdecea; border-left: 3px solid #c2412d; border-radius: 6px;
}
.row-caution[hidden] { display: none; }
.row-caution b { color: #7a1f14; }
.row.below-standard .row-label { color: #9b2c1f; }

/* NHB pre-run check */
.nhb-wrap { padding: 14px 18px 18px; }
.nhb-summary { margin: 0 0 10px; font-size: 0.82rem; line-height: 1.45; color: #33403a; }
.nhb-summary.fail { color: #9b2c1f; }
.nhb-scroll { overflow-x: auto; }
.nhb-table { width: 100%; border-collapse: collapse; font-size: 0.74rem; }
.nhb-table th, .nhb-table td { text-align: left; padding: 6px 8px; border-bottom: 1px solid #dfe7df; vertical-align: top; }
.nhb-table th { font-size: 0.64rem; text-transform: uppercase; letter-spacing: 0.04em; color: #5b6b62; }
.nhb-table td.status { font-weight: 700; white-space: nowrap; }
.nhb-table tr.fail { background: #fdf1ef; }
.nhb-table tr.fail td.status { color: #b3261e; }
.nhb-table tr.pass td.status { color: #2f7c4f; }
.nhb-table tr.check td.status, .nhb-table tr.advice td.status { color: #8a6d1f; }
.nhb-table td.ref { color: #5b6b62; white-space: nowrap; }
.nhb-group td { background: #eef3ee; font-weight: 700; font-size: 0.68rem; color: #33403a; }
.nhb-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; margin-top: 14px; }
/* global button{width:100%} would stretch these across the dialog */
.nhb-actions button { width: auto; min-width: 0; padding: 8px 14px; }

/* a control whose value is computed from the others in the current layout mode */
.row.is-derived .row-label { color: var(--muted); }
.row.is-derived input, .row.is-derived .row-num { opacity: 0.6; cursor: not-allowed; }
.row.is-derived .row-fmt { color: var(--muted); font-style: italic; }

.harvest-note { font-size: 0.66rem; color: var(--muted); line-height: 1.4; margin-bottom: 6px; }
.harvest-wrap { overflow-x: auto; max-height: 260px; overflow-y: auto; }
.harvest-table { width: 100%; font-size: 0.7rem; border-collapse: collapse; }
.harvest-table th, .harvest-table td { padding: 3px 5px; text-align: right; white-space: nowrap; }
.harvest-table th:nth-child(2), .harvest-table td:nth-child(2) { text-align: left; }
.harvest-table thead th { position: sticky; top: 0; background: var(--panel); border-bottom: 1px solid var(--line); color: var(--muted); font-weight: 600; }
.harvest-table tbody tr { border-bottom: 1px dotted var(--line); }
.harvest-table tbody tr.is-best td:nth-child(5) { color: var(--green-dark); font-weight: 600; }
.harvest-table tbody tr.is-worst td:nth-child(5) { color: #b4472f; font-weight: 600; }
.harvest-table tfoot td { border-top: 1px solid var(--line); font-weight: 600; padding-top: 5px; }

.harvest-stale {
  margin: 0 0 6px; padding: 6px 8px; border-radius: 6px;
  background: #fdf6e3; color: #8a6d1f; font-size: 0.68rem; line-height: 1.4;
}

/* visual reference for the control under the pointer (app.js showParamVisual) */
.param-visual {
  position: absolute; left: 12px; bottom: 52px; z-index: 5;
  max-width: min(400px, calc(100% - 24px));
  display: flex; flex-direction: column; gap: 3px; padding: 8px 11px;
  background: rgba(255, 255, 255, 0.95); border-left: 3px solid #ff7a1a; border-radius: 8px;
  box-shadow: 0 6px 20px rgba(20, 30, 24, 0.15);
  font-size: 0.74rem; line-height: 1.45; color: #33403a; pointer-events: none;
}
.param-visual[hidden] { display: none; }
.param-visual strong { color: #b4520f; font-size: 0.8rem; }
.param-visual .pv-drives { color: #5b6b62; }
.param-visual b.fail { color: #b3261e; }
.param-visual b.ok { color: #2f7c4f; }

/* ---------------------------------------------------------------------------
   Rail, expanded: labelled heads grouped by design step (Site, Build, Climate,
   Grow, Business, Run), so each head holds a few short groups instead of one long
   scroll. It folds to the icon rail; the choice is remembered (ui.js).
   --------------------------------------------------------------------------- */
.shell { grid-template-columns: var(--rail-w, 172px) minmax(0, 1fr) auto; }
.shell.rail-collapsed { --rail-w: 56px; }
.rail { align-items: stretch; gap: 1px; padding: 6px 8px 8px; overflow-y: auto; overflow-x: hidden; }
.rail-cat {
  padding: 10px 8px 3px; font-size: 0.6rem; font-weight: 700; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--muted); white-space: nowrap;
}
.rail-cat:first-child { padding-top: 4px; }
.rail button {
  width: 100%; min-width: 0; height: 32px; flex: 0 0 auto;
  flex-direction: row; justify-content: flex-start; gap: 10px; padding: 0 9px;
}
.rail button em { font-size: 0.8rem; letter-spacing: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rail button.is-active { box-shadow: inset 3px 0 0 var(--green-dark); font-weight: 600; }
.rail .rail-toggle { margin-top: auto; }
.rail .rail-toggle svg { transition: transform 0.15s; }

/* folded: icons with a small caption; the step names become thin dividers */
.shell.rail-collapsed .rail { align-items: center; padding: 6px 0 8px; }
.shell.rail-collapsed .rail-cat { height: 1px; margin: 6px 12px; padding: 0; font-size: 0; background: var(--line); align-self: stretch; }
.shell.rail-collapsed .rail button { width: 46px; height: 44px; flex-direction: column; justify-content: center; gap: 2px; padding: 0; }
.shell.rail-collapsed .rail button em { font-size: 0.52rem; max-width: 44px; font-weight: 400; }
.shell.rail-collapsed .rail button.is-active { box-shadow: none; }
.shell.rail-collapsed .rail .rail-toggle svg { transform: rotate(180deg); }

/* phones and small tablets: always the icon rail */
@media (max-width: 900px) {
  .shell, .shell.rail-collapsed { grid-template-columns: 48px minmax(0, 1fr); }
  .rail { align-items: center; padding: 6px 0 8px; }
  .rail-cat { height: 1px; margin: 6px 10px; padding: 0; font-size: 0; background: var(--line); align-self: stretch; }
  .rail button { width: 42px; height: 42px; flex-direction: column; justify-content: center; gap: 2px; padding: 0; }
  .rail button em { font-size: 0.5rem; max-width: 40px; }
  .rail button.is-active { box-shadow: none; }
  .rail .rail-toggle { display: none; }
}

/* ==========================================================================
   Structural report: line drawings first, words second.
   The dg-* rules style the SVG figures in diagrams.js; the sr-* rules lay out
   the report in structuralReport.js.
   ========================================================================== */

.sreport {
  --dg-line: #2b3d32;
  --dg-fade: #d5ded6;
  --dg-acc: var(--green);
  --dg-hot: #b3261e;
  --dg-warn: #a9701a;
  font-size: 0.84rem;
  line-height: 1.55;
  max-width: 980px;
  padding-bottom: 20px;
}

/* --- figures ------------------------------------------------------------ */
.dg { display: block; width: 100%; height: auto; }
.dg text { font-family: inherit; font-size: 10px; fill: var(--muted); stroke: none; }
.dg line, .dg path, .dg rect, .dg circle, .dg polyline {
  stroke: var(--c, var(--dg-line));
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.dg .dg-solid { fill: var(--c, var(--dg-line)); stroke: none; }
.dg-frame { --c: var(--dg-line); }
.dg-dim { --c: var(--dg-fade); }
.dg-hi { --c: var(--dg-acc); stroke-width: 3.4; }
.dg-film { --c: #9db7a4; stroke-width: 1.2; stroke-dasharray: 5 4; }
.dg-ground { --c: #93a394; stroke-width: 1.4; }
.dg-soil { fill: #ece6d8; stroke: none; }
.dg-water { fill: #a8c9dc; stroke: none; }
.dg-node { --c: #7f8e83; }
.dg-net { --c: #9db7a4; stroke-width: 1; }
.dg-dim-line, .dg-dim { }
line.dg-dim { --c: #93a394; stroke-width: 1; stroke-dasharray: 3 3; }
.dg-dot { --c: var(--dg-acc); }
/* ".dg text" outranks a bare class name, so a label that needs its own colour has to
   name the element too, or it comes out muted grey like every other label */
.dg text.dg-dotnum { fill: #fff; font-size: 9px; font-weight: 700; }
.dg text.dg-note { font-size: 9.5px; }
.dg text.dg-loadlab { font-size: 10px; font-weight: 600; fill: #44544a; }
.dg-arrowhead { fill: currentColor; stroke: none; }

/* loads keep one meaning across every figure: push, lift, weigh */
.dg-load { stroke-width: 2; }
.dg-push { --c: #2e6f9e; color: #2e6f9e; }
.dg-lift { --c: #b3261e; color: #b3261e; }
.dg-weight { --c: #5c6b62; color: #5c6b62; }
.dg text.dg-lift-lab { fill: #b3261e; }

/* a failing part turns its own drawing red, so the eye finds it before the text */
.sr-part.is-over .dg-hi, .dg-detail.dg-alarm .dg-hi { --c: var(--dg-hot); }
.sr-part.is-near .dg-hi { --c: var(--dg-warn); }

/* --- the bar that says how hard a part is working ----------------------- */
.dg-gauge { margin: 6px 0 4px; max-width: 320px; }
.dg-gauge .dg-track { fill: #e8eee8; stroke: none; }
.dg-gauge .dg-fill { fill: var(--green); stroke: none; }
.dg-gauge.is-near .dg-fill { fill: #d19a2e; }
.dg-gauge.is-over .dg-fill { fill: var(--dg-hot); }
.dg-gauge .dg-limit { stroke: #55635a; stroke-width: 1.4; }
.dg-gauge .dg-limitlab { font-size: 8.5px; fill: #55635a; }
.dg-gauge .dg-gaugelab { font-size: 10px; fill: var(--ink); font-weight: 600; }

/* --- the report --------------------------------------------------------- */
.sreport h2 {
  font-size: 0.95rem;
  margin: 26px 0 10px;
  padding-bottom: 5px;
  border-bottom: 1px solid var(--line);
}
.sreport h3 { font-size: 0.9rem; margin: 0 0 1px; }
.sreport p { margin: 0 0 7px; }

.sr-verdict {
  border: 1px solid var(--line);
  border-left: 5px solid var(--green);
  border-radius: 10px;
  background: #f3f8f3;
  padding: 13px 16px;
}
.sr-verdict.is-near { border-left-color: #d19a2e; background: #fdf8ef; }
.sr-verdict.is-over { border-left-color: var(--dg-hot); background: #fdf2f1; }
.sr-head { font-size: 1.12rem; font-weight: 650; letter-spacing: -0.01em; }
.sr-sub { color: var(--muted); }
.sr-tally { display: flex; gap: 6px; margin: 8px 0 0; }

.sr-chip {
  display: inline-block;
  padding: 1px 9px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
}
.sr-chip.is-ok { background: #e2f0e7; color: #1f5f3a; }
.sr-chip.is-near { background: #faeed6; color: #8a5b12; }
.sr-chip.is-over { background: #fbe3e1; color: #8e1d17; }
.sr-chip.is-info { background: #eceeec; color: #5c6b62; }

.sr-keyfig { display: grid; grid-template-columns: minmax(0, 1fr) 190px; gap: 16px; align-items: center; }
.sr-legend { list-style: none; margin: 0; padding: 0; font-size: 0.8rem; }
.sr-legend li { display: flex; align-items: center; gap: 8px; padding: 2px 0; }
.sr-legend span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: var(--green);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  flex: none;
}
.sr-cap { color: var(--muted); font-size: 0.8rem; }
.sr-loads { margin: 8px 0; padding-left: 18px; }
.sr-loads li { margin-bottom: 3px; }
.sr-punch {
  background: #f3f8f3;
  border-left: 3px solid var(--green);
  padding: 8px 12px;
  border-radius: 0 8px 8px 0;
}

/* --- the storm odds (stormFigures.js) ----------------------------------- */
.sr-storms { margin-bottom: 6px; }
.sr-odds .sr-head { font-size: 1.2rem; }
.sr-odds-table { border-collapse: collapse; margin: 10px 0 4px; font-size: 0.8rem; }
.sr-odds-table th { text-align: left; font-weight: 600; color: var(--muted); padding: 2px 16px 3px 0; }
.sr-odds-table td { padding: 2px 16px 2px 0; }
.sr-odds-table tr.is-head td { font-size: 0.86rem; }
.st-fig text { font-size: 10px; fill: var(--muted); }
.dg text.st-lab { font-size: 10px; fill: #44544a; }
/* labels sit on busy lines; a halo in the page colour keeps them readable without a box */
.dg text.st-lab { paint-order: stroke; stroke: #fbfcfa; stroke-width: 3.5px; stroke-linejoin: round; }
.dg text.st-caplab { fill: var(--dg-hot); font-weight: 600; }
.dg .st-grid { --c: #e6ebe6; stroke-width: 1; }
.dg .st-area { fill: #dbe8f2; stroke: none; }
.dg .st-line { --c: #5a8fb8; stroke-width: 1; }
.dg .st-thr { --c: #93a394; stroke-width: 1; stroke-dasharray: 4 3; }
.dg .st-cap, .dg .st-capv { --c: var(--dg-hot); stroke-width: 1.8; }
.dg .st-peak { fill: #2e6f9e; stroke: #fff; stroke-width: 1.2; }
.dg .st-dot { fill: #2e6f9e; stroke: none; opacity: 0.75; }
.dg .st-fit { --c: #1f5f3a; stroke-width: 2; }
.dg .st-code { stroke-dasharray: 6 4; }
.dg .st-beyond { fill: #f4f1ea; stroke: none; }
.dg .st-hit { fill: var(--dg-hot); stroke: #fff; stroke-width: 1.5; }

.sr-part {
  display: grid;
  grid-template-columns: minmax(0, 240px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
  padding: 16px 0;
  border-top: 1px solid var(--line);
}
.sr-part .sr-art {
  background: #fafcfa;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 6px;
  /* a figure drawn at 200 units across will happily scale to the full width of a wide
     column, and its 9 px labels become headlines; hold every part drawing to a size
     that reads as a figure beside the text */
  max-width: 360px;
}
.sr-part .dg-detail { max-width: 270px; margin: 0 auto; }
.sr-also { color: var(--muted); font-size: 0.75rem; margin: 0 0 6px; }
.sr-job { margin-bottom: 5px; }
.sr-why { margin-bottom: 6px; }
.sr-fix {
  background: #fdf6ea;
  border-left: 3px solid #d19a2e;
  padding: 7px 11px;
  border-radius: 0 8px 8px 0;
  margin-bottom: 6px;
}
.sr-part.is-over .sr-fix { background: #fdf2f1; border-left-color: var(--dg-hot); }

.sr-note { color: var(--muted); font-size: 0.8rem; margin-bottom: 6px; }
.sr-numbers { margin-top: 4px; }
.sr-numbers > summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 0.78rem;
  padding: 3px 0;
}
.sr-numbers > summary:hover { color: var(--ink); }
.sr-facts { color: var(--muted); font-size: 0.78rem; }
.sr-table { width: 100%; border-collapse: collapse; font-size: 0.76rem; margin: 5px 0 9px; }
.sr-table th, .sr-table td { text-align: left; padding: 3px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
.sr-table th { color: var(--muted); font-weight: 600; }
.sr-table td:last-child, .sr-table th:last-child { white-space: nowrap; }
.sr-fail { color: var(--dg-hot); font-weight: 600; }
.sr-review { color: #8a5b12; font-weight: 600; }
.sr-pass { color: var(--green-dark); }
.sr-limits ul { margin: 6px 0; padding-left: 18px; }
.sr-limits li { margin-bottom: 4px; }
.sr-empty { color: var(--muted); }

@media (max-width: 760px) {
  .sr-part { grid-template-columns: minmax(0, 1fr); }
  .sr-part .sr-art { max-width: 320px; }
  .sr-keyfig { grid-template-columns: minmax(0, 1fr); }
}

/* the strength report gets a window of its own: the drawings need the room */
.report-dialog { width: min(1100px, 96vw); max-height: 92vh; display: flex; flex-direction: column; }
.report-scroll { overflow-y: auto; padding-right: 6px; }

/* ==========================================================================
   Assumptions window: every group gets a drawing of the thing its numbers
   describe, and the drawing moves the way the real thing moves. The loops run
   forwards and back, which shows a before and an after without a control to
   press. Anyone who has asked for less motion gets the still drawing.
   ========================================================================== */

.aw-card {
  display: grid;
  /* the drawing is the point of this window, so it gets real room: at 228px the
     labels inside a 240 unit viewBox rendered at about 9px, which is unreadable */
  grid-template-columns: minmax(300px, 420px) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
  padding: 14px 0;
  border-top: 1px solid var(--line);
}
.aw-card:first-child { border-top: 0; }
.aw-fig {
  --dg-line: #2b3d32;
  --dg-fade: #d5ded6;
  --dg-acc: var(--green);
  background: #fafcfa;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 6px;
  position: sticky;
  top: 0;
}
.aw-fig-svg { display: block; }
.aw-body h3 { margin: 2px 0 4px; font-size: 0.92rem; }
.aw-card .assume-note { margin: 0 0 8px; }
.aw-card .assume-table { margin-top: 2px; }

@media (max-width: 900px) {
  .aw-card { grid-template-columns: minmax(0, 1fr); }
  .aw-fig { max-width: 440px; position: static; }
}

/* --- the loops ---------------------------------------------------------- */
/* Each one plays forwards then backwards, slowly, so it reads as one idea. */

@keyframes aw-pull-r { from { transform: translateX(0); } to { transform: translateX(7px); } }
@keyframes aw-pull-l { from { transform: translateX(0); } to { transform: translateX(-7px); } }
@keyframes aw-stretch { from { transform: scaleX(1); } to { transform: scaleX(1.22); } }
@keyframes aw-needle { from { transform: translateY(0); } to { transform: translateY(-62px); } }
@keyframes aw-curtain { from { transform: scaleY(1); } to { transform: scaleY(0.12); } }
@keyframes aw-inside { 0%, 35% { opacity: 0; } 100% { opacity: 1; } }
@keyframes aw-flow { from { stroke-dashoffset: 0; } to { stroke-dashoffset: -56px; } }
@keyframes aw-sway { from { transform: rotate(-3.5deg); } to { transform: rotate(3.5deg); } }
@keyframes aw-slide { from { transform: translateX(0); } to { transform: translateX(13px); } }
@keyframes aw-settle { from { transform: translateY(0); } to { transform: translateY(5px); } }

.aw-fig-svg g[class*="aw-"], .aw-fig-svg rect[class*="aw-"] { transform-box: fill-box; }
.aw-pull { animation: aw-pull-r 3.2s ease-in-out infinite alternate; }
.aw-pull-l { animation: aw-pull-l 3.2s ease-in-out infinite alternate; }
.aw-stretch { transform-origin: center; animation: aw-stretch 3.2s ease-in-out infinite alternate; }
.aw-needle { animation: aw-needle 3.6s ease-in-out infinite alternate; }
.aw-curtain { transform-origin: bottom; animation: aw-curtain 4s ease-in-out infinite alternate; }
.aw-inside { animation: aw-inside 4s ease-in-out infinite alternate; }
.aw-streaks path { animation: aw-flow 1.6s linear infinite; }
.aw-vine { transform-origin: top center; animation: aw-sway 2.6s ease-in-out infinite alternate; animation-delay: var(--d, 0s); }
.aw-slide { animation: aw-slide 2.4s ease-in-out infinite alternate; }
.aw-settle { transform-origin: top center; animation: aw-settle 3s ease-in-out infinite alternate; }

@media (prefers-reduced-motion: reduce) {
  .aw-fig-svg *, .aw-fig-svg { animation: none !important; }
  .aw-fig-svg animate { display: none; }
}

/* the cover section of the strength report */
.sr-cover h3 { font-size: 0.86rem; margin: 16px 0 6px; }
.cv-wear td { vertical-align: top; padding-right: 14px; }
.cv-wear td:last-child { white-space: nowrap; }
.dg .cv-area { fill: #e3efe6; stroke: none; }
.dg .cv-clear { fill: #8fb89c; stroke: none; }
.dg .cv-dust { fill: #c9a86a; stroke: none; }
.dg .cv-drip { fill: #7fa6c6; stroke: none; }

/* ==========================================================================
   Strength dashboard (strengthDashboard.js) and the house map (houseMap.js)
   ========================================================================== */
.report-dialog { width: min(1280px, 97vw); height: min(900px, 94vh); max-height: none; }
#reportResults.report-scroll { flex: 1; min-height: 0; overflow: hidden; padding-right: 0; max-width: none; }
.sb { display: flex; flex-direction: column; height: 100%; min-height: 0; }
#report .sb { height: auto; }
.sb-head { display: flex; align-items: center; gap: 6px; padding: 0 0 10px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.sb-pick { font: inherit; font-size: 0.9rem; font-weight: 650; padding: 6px 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--field, #fff); min-width: 260px; }
.sb-step { border: 1px solid var(--line); background: var(--field, #fff); border-radius: 8px; width: 30px; height: 32px; font-size: 1.1rem; line-height: 1; cursor: pointer; color: var(--ink, #1c2a22); }
.sb-step:hover { background: #eef3ee; }
.sb-strip { display: flex; gap: 5px; margin-left: auto; flex-wrap: wrap; align-items: center; }
.sb-dot { width: 13px; height: 13px; border-radius: 50%; border: 0; padding: 0; cursor: pointer; background: #c9d1cb; }
.sb-dot.is-ok { background: #5fa77a; }
.sb-dot.is-near { background: #e0a93b; }
.sb-dot.is-over { background: #c9453a; }
.sb-dot.is-current { outline: 2px solid #1c2a22; outline-offset: 2px; }
.sb-body { flex: 1; min-height: 0; overflow: auto; padding-top: 10px; container-type: inline-size; }
.sb-grid { display: grid; gap: 10px; grid-template-columns: repeat(12, minmax(0, 1fr)); align-items: start; }
.sb-card { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; min-width: 0; text-align: left; font: inherit; color: inherit; }
.sb-card h2 { font-size: 1.05rem; margin: 0 0 4px; border: 0; padding: 0; }
.sb-card h3 { font-size: 0.82rem; margin: 0 0 6px; color: var(--muted); font-weight: 650; display: flex; align-items: center; gap: 8px; }
.sb-card .sr-verdict { margin: 0; border: 0; padding: 0; background: none; }
.sb-verdict { border-left: 4px solid #5fa77a; }
.sb-verdict.is-near { border-left-color: #e0a93b; background: #fffaf0; }
.sb-verdict.is-over { border-left-color: #c9453a; background: #fdf4f3; }
.sb-map { padding: 6px; }
.sb-art .dg, .sb-art svg { max-height: 240px; }
.sb-small svg { max-height: 150px; }
.sb-link { cursor: pointer; display: block; width: 100%; margin-top: 10px; background: #f7faf7; }
.sb-link:hover { border-color: #9fc2aa; }
.sb-source { grid-column: 1 / -1; font-size: 0.72rem; color: var(--muted); margin: 0; }
.sb-empty { padding: 40px 20px; text-align: center; color: var(--muted); }
.sb-empty.is-over { color: #8e1d17; }

/* what a part faces: icon, number, three words */
.sb-faces { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 4px; }
.sb-face { display: grid; grid-template-columns: 22px auto; grid-template-rows: auto auto; column-gap: 6px; align-items: center; padding: 5px 9px 5px 6px; border-radius: 8px; background: #f3f6f3; min-width: 108px; }
.sb-face .sb-ico { grid-row: 1 / 3; width: 22px; height: 22px; fill: none; stroke: #3d6b4f; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.sb-face b { font-size: 0.86rem; line-height: 1.1; }
.sb-face span { font-size: 0.68rem; color: var(--muted); line-height: 1.15; }

/* the big number */
.sb-big { font-size: 2.6rem; font-weight: 700; line-height: 1; margin: 6px 0 2px; color: #1f5f3a; }
.sb-big small { font-size: 0.9rem; font-weight: 600; margin-left: 6px; color: var(--muted); }
.sb-big.is-near { color: #8a5b12; }
.sb-big.is-over { color: #8e1d17; }
.sb-bigcap { color: var(--muted); font-size: 0.8rem; margin: 0 0 4px; }

/* hardest-worked parts */
.sb-rows { display: flex; flex-direction: column; gap: 4px; }
.sb-row { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr) 42px; gap: 8px; align-items: center; border: 0; background: none; padding: 4px; border-radius: 6px; font: inherit; font-size: 0.8rem; cursor: pointer; text-align: left; }
.sb-row:hover { background: #f1f5f1; }
.sb-rowname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-rowbar { position: relative; height: 9px; border-radius: 5px; background: #e8ede8; }
.sb-rowbar i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 5px; background: #5fa77a; }
.sb-rowbar i.is-near { background: #e0a93b; }
.sb-rowbar i.is-over { background: #c9453a; }
.sb-rowbar em { position: absolute; top: -3px; bottom: -3px; width: 2px; background: #1c2a22; }
.sb-row b { text-align: right; font-size: 0.78rem; }
.sb-row b.is-near { color: #8a5b12; }
.sb-row b.is-over { color: #8e1d17; }
.sb-legend { display: flex; gap: 14px; justify-content: center; font-size: 0.72rem; color: var(--muted); }
.sb-legend span::before { content: ""; display: inline-block; width: 18px; height: 4px; border-radius: 2px; margin-right: 5px; vertical-align: middle; background: #3f9a64; }
.sb-legend span.is-near::before { background: #d39a2a; }
.sb-legend span.is-over::before { background: #c0392b; }

/* layouts: the picture of the house takes the wide column, the verdict the narrow one */
.sb-g-overview .sb-map { grid-column: span 7; }
.sb-g-overview .sb-verdict { grid-column: span 5; }
.sb-g-overview .sb-worst { grid-column: span 5; }
.sb-g-overview .sb-loads { grid-column: span 7; }
.sb-g-part .sb-map { grid-column: span 7; }
.sb-g-part .sb-verdict { grid-column: span 5; }
.sb-g-part > .sb-card:nth-child(3) { grid-column: span 7; }
.sb-g-part .sb-about { grid-column: span 5; }
.sb-g-cover .sb-map { grid-column: span 7; }
.sb-g-cover .sb-verdict { grid-column: span 5; }
.sb-g-cover > .sb-card:nth-child(n + 3) { grid-column: span 6; }
.sb-g-storms .sb-verdict { grid-column: span 4; }
.sb-g-storms .sb-wide { grid-column: span 8; }
.sb-g-storms .sb-wide + .sb-wide { grid-column: span 12; }
@container (max-width: 760px) {
  .sb-grid > * { grid-column: 1 / -1 !important; }
}
.sb-about p { font-size: 0.8rem; }

/* chart pieces */
.dg .sb-overzone { fill: #fbecea; stroke: none; opacity: 0.55; }
.dg .sb-dot-ok { fill: #3f9a64; stroke: #fff; stroke-width: 1.5; }
.dg .sb-dot-near { fill: #d39a2a; stroke: #fff; stroke-width: 1.5; }
.dg .sb-dot-over { fill: #c0392b; stroke: #fff; stroke-width: 1.5; }
.dg .sb-roofline { --c: #8d9b91; stroke-width: 2.5; }
.dg .sb-filmline { --c: #1f7a4a; stroke-width: 2; stroke-dasharray: 5 3; }
.dg .sb-water { fill: #8fbfe0; stroke: none; opacity: 0.8; }
.dg .sb-support { fill: #5c6b62; stroke: none; }
.dg .sb-dim { --c: #93a394; stroke-width: 1; stroke-dasharray: 2 2; }
.dg .sb-runoff { --c: #5b9bd5; stroke-width: 1.6; }
.dg .sb-rain { --c: #5b9bd5; stroke-width: 1.4; }
.dg .sb-net { --c: #7d8f84; stroke-width: 1.2; stroke-dasharray: 1 3; }
.dg .sb-bar-wet { fill: #2e6f9e; stroke: none; }
.dg .sb-bar-dry { fill: #a9c6dc; stroke: none; }

/* the house map */
.hm { display: block; width: 100%; height: auto; max-height: 360px; }
.hm .hm-ground { fill: #f1f4ef; stroke: #e2e8e0; stroke-width: 1; }
.hm .hm-skin { fill: #cfe3d6; fill-opacity: 0.14; stroke: #b9cfc0; stroke-width: 0.8; }
.hm .hm-part { fill: none; stroke: #8d9b91; stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }
.hm .hm-thin { stroke-width: 0.9; }
.hm .hm-thick { stroke-width: 2.4; }
.hm .hm-joint { fill: #8d9b91; stroke: none; }
.hm .hm-block { fill: #ddd6c6; stroke: #b8b09c; stroke-width: 0.8; }
.hm .hm-part.hm-dim { stroke: #d6ddd7; }
.hm .hm-joint.hm-dim { fill: #d6ddd7; }
.hm .hm-block.hm-dim { fill: #efece4; stroke: #e0dccf; }
.hm .hm-skin.hm-dim { fill-opacity: 0.06; stroke: #e1e8e3; }
.hm .hm-ok { --t: #1f7a4a; }
.hm .hm-near { --t: #c98a1a; }
.hm .hm-over { --t: #c0392b; }
.hm .hm-lit.hm-part { stroke: var(--t); stroke-width: 3; }
.hm .hm-lit.hm-thin { stroke-width: 2.4; }
.hm .hm-lit.hm-joint { fill: var(--t); }
.hm .hm-lit.hm-block { fill: var(--t); fill-opacity: 0.75; stroke: var(--t); }
.hm .hm-skin.hm-lit { fill: var(--t); fill-opacity: 0.16; stroke: var(--t); stroke-width: 1.4; }
.hm .hm-grip { stroke: var(--t, #1f7a4a); stroke-width: 3.6; }
/* every part in its verdict's colour (the overview) */
.hm .hm-part.hm-ok:not(.hm-lit) { stroke: #57a376; }
.hm .hm-part.hm-near:not(.hm-lit) { stroke: #dca23a; stroke-width: 2.2; }
.hm .hm-part.hm-over:not(.hm-lit) { stroke: #c9453a; stroke-width: 2.8; }
.hm .hm-joint.hm-ok:not(.hm-lit) { fill: #57a376; }
.hm .hm-joint.hm-near:not(.hm-lit) { fill: #dca23a; }
.hm .hm-joint.hm-over:not(.hm-lit) { fill: #c9453a; }
.hm .hm-block.hm-ok:not(.hm-lit) { fill: #bfdcc8; stroke: #57a376; }
.hm .hm-block.hm-near:not(.hm-lit) { fill: #f3dcae; stroke: #dca23a; }
.hm .hm-block.hm-over:not(.hm-lit) { fill: #f0c4bf; stroke: #c9453a; }
.hm .hm-skin.hm-ok:not(.hm-lit) { fill: #57a376; fill-opacity: 0.08; }
.hm .hm-skin.hm-near:not(.hm-lit) { fill: #dca23a; fill-opacity: 0.12; }
.hm .hm-skin.hm-over:not(.hm-lit) { fill: #c9453a; fill-opacity: 0.12; }
/* where a small part is, and its close-up */
.hm .hm-ring { fill: none; stroke: var(--t); stroke-width: 2.2; }
.hm .hm-leader { stroke: var(--t); stroke-width: 1.2; stroke-dasharray: 3 3; fill: none; }
.hm .hm-bubble { fill: #fff; stroke: none; }
.hm .hm-bubble-rim { fill: none; stroke: var(--t); stroke-width: 2.4; }
.hm text.hm-tag { font-size: 14px; font-weight: 700; fill: var(--t); paint-order: stroke; stroke: #fff; stroke-width: 4px; }
/* what the cover faces */
.hm .hm-sun-disc { fill: #f4c542; }
.hm .hm-sun { stroke: #f4c542; stroke-width: 2; }
.hm .hm-cloud { fill: #dbe4ea; stroke: #b9c6cf; stroke-width: 1; }
.hm .hm-rain { stroke: #5b9bd5; stroke-width: 1.6; }
.hm .hm-wind, .hm .hm-wind-head { fill: none; stroke: #7aa6c8; stroke-width: 1.8; stroke-linecap: round; }

/* the global button and select rules stretch everything to full width with a 108 px
   minimum; inside the dashboard each control keeps its own size */
.sb button { width: auto; min-width: 0; min-height: 0; padding: 0; font-weight: inherit; flex: none; }
.sb .sb-pick { width: auto; flex: 0 1 340px; min-width: 200px; }
.sb .sb-step { width: 30px; height: 32px; padding: 0; }
.sb .sb-dot { width: 13px; height: 13px; padding: 0; border: 0; border-radius: 50%; }
.sb .sb-row { width: 100%; padding: 4px; font-weight: 400; }
.sb .sb-link { width: 100%; padding: 10px 12px; font-weight: 400; }

/* ==========================================================================
   Assumptions dashboard (assumptionsDashboard.js): the same frame as the
   strength dashboard (sb-*), with the house drawing, the moving figure and
   the editable numbers side by side.
   ========================================================================== */
.assume-dialog { width: min(1280px, 97vw); height: min(900px, 94vh); max-height: none; }
#assumeResults.assume-scroll { overflow: hidden; padding: 10px 18px 0; display: flex; flex-direction: column; }
.ab {
  --dg-line: #2b3d32;
  --dg-fade: #d5ded6;
  --dg-acc: var(--green);
  --dg-hot: #b3261e;
  --dg-warn: #a9701a;
}
.sb-dot.is-changed { background: #2e6f9e; }
.ab-key { display: flex; gap: 10px; margin-left: 10px; font-size: 0.7rem; color: var(--muted); }
.ab-key span::before { content: ""; display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 4px; vertical-align: -1px; background: #5fa77a; }
.ab-key span.is-near::before { background: #e0a93b; }
.ab-key span.is-changed::before { background: #2e6f9e; }
.ab-grid .ab-where { grid-column: 1 / span 5; grid-row: 1; }
.ab-grid .ab-values { grid-column: 6 / span 7; grid-row: 1 / span 2; }
.ab-grid .ab-what { grid-column: 1 / span 5; grid-row: 2; }
.ab-grid .ab-what .aw-fig { position: static; }
.ab-grid .ab-what svg { max-height: 280px; }
.ab-tag { font-weight: 600; color: #1f7a4a; background: #e8f2ea; border-radius: 10px; padding: 1px 8px; font-size: 0.72rem; }
.ab-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 2px 0 8px; }
.ab-chip { font-size: 0.72rem; padding: 2px 9px; border-radius: 10px; background: #eef1ee; color: #44544a; }
.ab-chip.is-ok { background: #e2f0e7; color: #1f5f3a; }
.ab-chip.is-near { background: #faeed6; color: #8a5b12; }
.ab-chip.is-changed { background: #e1ecf5; color: #1f4f78; }
.ab-note { font-size: 0.78rem; color: var(--muted); line-height: 1.45; margin: 0 0 8px; }
.ab-table { width: 100%; border-collapse: collapse; font-size: 0.8rem; }
.ab-table td { padding: 6px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
.ab-table tr.is-dirty { background: #eef5fb; }
.ab-table tr.is-dirty .ab-label { font-weight: 650; color: #1f4f78; }
.ab-label { display: block; font-weight: 550; }
.ab-scope { display: block; font-size: 0.7rem; color: var(--muted); }
.ab-source { display: block; font-size: 0.7rem; line-height: 1.35; color: var(--muted); margin-top: 2px; }
.ab-flag { font-size: 0.64rem; letter-spacing: 0.03em; padding: 0 5px; border-radius: 4px; background: #faeed6; color: #8a5b12; }
.ab-flag.is-approx { background: #eef1ee; color: #5c6b62; }
.ab-input { white-space: nowrap; width: 150px; }
.ab-input input { width: 86px; padding: 4px 6px; border: 1px solid var(--line); border-radius: 6px; font: inherit; font-size: 0.82rem; }
.ab-input input:focus { outline: 2px solid #9fc2aa; outline-offset: 0; }
.ab-unit { font-size: 0.72rem; color: var(--muted); margin-left: 4px; }
.ab-reset { width: 58px; text-align: right; }
.ab-reset button { border: 1px solid var(--line); background: #fff; border-radius: 6px; width: 28px; height: 26px; cursor: pointer; }
.ab-default { font-size: 0.68rem; color: #a3aea6; }
@container (max-width: 760px) {
  .ab-grid .ab-where, .ab-grid .ab-values, .ab-grid .ab-what { grid-column: 1 / -1; grid-row: auto; }
}

/* ==========================================================================
   The account inside the tool (toolAccount.js): save status, the account link,
   the sign-in box and the message along the bottom.
   ========================================================================== */
.topbar-actions { align-items: center; }
.topbar-actions button { width: auto; min-width: 0; min-height: 0; flex: none; }
.save-status { font-size: 0.74rem; color: var(--muted); white-space: nowrap; max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
.save-status.is-saved { color: #1f5f3a; }
.save-status.is-dirty { color: #8a5b12; }
.topbar-account { font-size: 0.8rem; font-weight: 650; color: var(--ink); text-decoration: none; border: 1px solid var(--line); border-radius: 7px; padding: 5px 10px; background: #fff; white-space: nowrap; }
.topbar-account:hover { border-color: #b9cbbb; }
.designs-note { font-size: 0.78rem; color: var(--muted); margin: -2px 0 8px; }
.dock-pane .design-actions { display: flex; gap: 6px; align-items: center; }
.dock-pane .design-actions input { flex: 1; min-width: 0; }

.auth-modal { z-index: 80; }
.auth-dialog { width: min(400px, 94vw); padding: 18px 22px 20px; }
.auth-reason { font-size: 0.85rem; color: var(--muted); margin: 0 0 12px; line-height: 1.45; }
.auth-error { color: #b3261e; background: #fdf2f1; border-radius: 8px; padding: 8px 10px; font-size: 0.84rem; margin: 0 0 10px; }
.auth-field { display: block; margin-bottom: 12px; }
.auth-field span { display: block; font-size: 0.8rem; font-weight: 600; margin-bottom: 4px; }
.auth-field input { width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px; font: inherit; background: #fff; }
.auth-fine { font-size: 0.74rem; color: var(--muted); margin: -4px 0 12px; line-height: 1.4; }
.auth-submit { width: 100%; background: var(--green); color: #fff; border-color: var(--green); }
.auth-submit:hover { background: var(--green-dark); }
.auth-switch { font-size: 0.82rem; text-align: center; margin: 12px 0 0; color: var(--muted); }

.toast { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 90; display: flex; align-items: center; gap: 12px; background: #1c2a22; color: #eef5ef; padding: 10px 14px; border-radius: 10px; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25); font-size: 0.86rem; max-width: min(620px, 92vw); }
.toast[hidden] { display: none; }
.toast button { width: auto; min-width: 0; min-height: 0; background: #fff; color: #1c2a22; border: 0; border-radius: 7px; padding: 5px 10px; font-weight: 650; font-size: 0.8rem; cursor: pointer; }
@media (max-width: 820px) {
  .save-status, #resetCamera { display: none; }
  .topbar .doc span { display: none; }
}

/* ==========================================================================
   Crop Intelligence (cropIntel.js): a utility beside the design — what a crop
   is worth, where and when. Tabs so it can hold more than price later.
   ========================================================================== */
.intel-dialog { width: min(980px, 96vw); max-height: 92vh; display: flex; flex-direction: column; }
.intel-scroll { overflow: auto; padding: 0 22px 20px; }

.ci-tabs { display: flex; align-items: center; gap: 6px; border-bottom: 1px solid var(--line); margin-bottom: 14px; position: sticky; top: 0; background: #fff; z-index: 2; padding-top: 2px; }
.ci-tabs button { width: auto; min-width: 0; min-height: 0; flex: none; background: none; border: 0; border-bottom: 2px solid transparent; border-radius: 0; padding: 8px 12px; font-size: 0.86rem; font-weight: 650; color: var(--muted); cursor: pointer; }
.ci-tabs button.is-on { color: var(--ink); border-bottom-color: var(--green); }
.ci-soon { margin-left: auto; font-size: 0.72rem; color: var(--muted); }

.ci-controls { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; }
.ci-field { display: flex; flex-direction: column; gap: 3px; flex: 1 1 180px; min-width: 0; }
.ci-field span { font-size: 0.74rem; font-weight: 650; color: var(--muted); }
.ci-field select { width: 100%; padding: 7px 9px; border: 1px solid var(--line); border-radius: 8px; font: inherit; background: #fff; }

.ci-head h3 { margin: 0 0 2px; font-size: 1.02rem; }
.ci-sub { margin: 0 0 10px; font-size: 0.79rem; color: var(--muted); line-height: 1.45; }
.ci-warn { font-size: 0.8rem; background: #fdf6e7; border-left: 3px solid #d9a441; padding: 7px 10px; border-radius: 0 7px 7px 0; margin: 0 0 10px; }
.ci-empty { padding: 26px 4px; color: var(--muted); font-size: 0.88rem; }
.ci-body.is-loading { opacity: 0.55; }

.ci-chart { width: 100%; height: auto; display: block; }
.ci-grid { stroke: #e8ece7; stroke-width: 1; }
.ci-ytick, .ci-xtick, .ci-axis { font-size: 10px; fill: var(--muted); }
.ci-xnow { fill: var(--ink); font-weight: 700; }
.ci-axis { font-size: 9.5px; }
.ci-band { fill: #2f6b46; opacity: 0.13; }
.ci-band-in { opacity: 0.22; }
.ci-mid { fill: none; stroke: #1f5f3a; stroke-width: 2.4; stroke-linejoin: round; }
.ci-dot { fill: #1f5f3a; }
.ci-whisker { stroke: #7b8b7f; stroke-width: 1; opacity: 0.45; }
.ci-hit { fill: transparent; }
.ci-col.is-on .ci-hit { fill: #1f5f3a; fill-opacity: 0.05; }
.ci-col.is-on .ci-whisker { opacity: 0.9; }
.ci-now .ci-dot { stroke: #1f5f3a; stroke-width: 2.5; fill: #fff; }
.ci-none { fill: #b4bcb5; font-size: 12px; }
.ci-depth { fill: #9fb3a4; opacity: 0.5; }
.ci-depth-label { font-size: 9px; }

.ci-detail { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; font-size: 0.82rem; background: #f6f8f5; border-radius: 9px; padding: 9px 12px; margin: 4px 0 10px; }
.ci-detail b:first-child { font-size: 0.88rem; }
.ci-detail-empty { color: var(--muted); }
.ci-n { color: var(--muted); font-size: 0.75rem; }
.ci-read { font-size: 0.87rem; line-height: 1.5; margin: 0 0 10px; }
.ci-source { font-size: 0.78rem; color: var(--muted); }
.ci-source summary { cursor: pointer; font-weight: 650; }
.ci-source p { line-height: 1.5; margin: 6px 0; }

@media (max-width: 720px) {
  .intel-scroll { padding: 0 14px 16px; }
  .ci-field { flex-basis: 100%; }
}
.ci-over { fill: #9aa79c; font-size: 9px; }
.ci-field span em { font-style: normal; font-weight: 400; color: var(--muted); opacity: 0.85; }
.ci-field select[disabled] { background: #f4f6f3; color: var(--muted); }
.ci-origin { margin: 0 0 10px; font-size: 0.73rem; color: var(--muted); }
