/* Engineering economics — on top of calc.css (light only, like every tool) */
main.ec .tabs { grid-template-columns: repeat(3, 1fr); }
main.ec .stage-bar { justify-content: flex-start; gap: 8px; flex-wrap: wrap; }
main.ec .stage-bar .hist { margin-left: auto; }
.stage { position: relative; }
#view .hit { fill: transparent; stroke: none; }
#view .handle { cursor: grab; }
#view .handle .knob { fill: var(--surface); stroke: var(--sel); stroke-width: 1.8; }
#view .handle:hover .knob, #view .handle:focus .knob { fill: var(--sel); }
#view .ec-arr { cursor: pointer; }
.ec-axt { font-size: 11px; fill: var(--text-3); font-variant-numeric: tabular-nums; }
.ec-name { font-size: 14px; font-weight: 600; fill: var(--text); }
.ec-sub, .ec-cap { font-size: 12px; fill: var(--text-2); }

/* pills */
#view .pill rect { fill: var(--surface); stroke: var(--steel-300); }
#view .pill text { font-size: 11.5px; font-weight: 500; fill: var(--text-2); font-variant-numeric: tabular-nums; }
#view .pill .ec-pv { font-weight: 600; }
#view .pill.invest rect { stroke: color-mix(in srgb, var(--load-ink) 45%, transparent); } #view .pill.invest .ec-pv { fill: var(--x-9c3616, #9c3616); }
#view .pill.cost rect { stroke: color-mix(in srgb, var(--load) 45%, transparent); } #view .pill.cost .ec-pv { fill: var(--load-ink); }
#view .pill.revenue rect { stroke: color-mix(in srgb, var(--good) 45%, transparent); } #view .pill.revenue .ec-pv { fill: var(--good-ink); }
#view .pill.salvage rect { stroke: color-mix(in srgb, var(--moment) 45%, transparent); } #view .pill.salvage .ec-pv { fill: var(--x-2c4a91, #2c4a91); }
#view .pill.editable { cursor: text; }
#view .pill.editable:hover rect, #view .pill.editable:focus rect { stroke: var(--sel); stroke-width: 1.4; }
#view .pill.editable:focus { outline: none; }

/* editor in the drawing */
.ec-edit { position: absolute; transform: translate(-50%, -50%); z-index: 5; display: flex; align-items: center; gap: 6px; background: var(--surface); border: 1.5px solid var(--sel); border-radius: 9px; padding: 2px 10px 2px 10px; box-shadow: 0 6px 18px rgba(20, 22, 28, .14); }
.ec-edit input { width: 96px; border: 0; outline: none; font: inherit; font-size: 13px; text-align: right; font-variant-numeric: tabular-nums; padding: 3px 2px; }
.ec-edit span { font-size: 11.5px; color: var(--text-3); white-space: nowrap; }

/* live strip and flags */
.ec-live { display: flex; flex-wrap: wrap; gap: 4px 18px; padding: 8px 14px; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--text-2); font-variant-numeric: tabular-nums; min-height: 38px; align-items: center; }
.ec-live b { font-weight: 500; color: var(--text-3); margin-right: 5px; }
.ec-flags { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.ec-flags span { font-size: 11.5px; color: var(--text-3); border: 1px solid var(--line); border-radius: 999px; padding: 2px 10px; white-space: nowrap; line-height: 1.4; }
.ec-flags span.warn { color: var(--warn-ink); border-color: color-mix(in srgb, var(--warn) 40%, transparent); }
.ec-flags span.ec-err { color: var(--bad-ink); border-color: color-mix(in srgb, var(--bad) 35%, transparent); white-space: normal; }

/* panel */
.ec-seg { margin-bottom: 6px; }
.ec-lab { font-size: 12px; color: var(--text-3); margin: 8px 0 4px; }
.ec-item, .ec-alt { border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px 6px; margin-bottom: 8px; background: var(--surface); }
.ec-item.sel { border-color: var(--sel); background: var(--sel-bg); }
.ec-item-h { display: grid; grid-template-columns: 10px minmax(0, 1fr) 104px 26px; gap: 6px; align-items: center; margin-bottom: 6px; }
.ec-alt .ec-item-h { grid-template-columns: 10px minmax(0, 1fr) 26px; }
.ec-item-h input[type=text] { border: 1px solid transparent; border-radius: 7px; padding: 4px 6px; font: inherit; font-size: 13px; font-weight: 600; color: var(--text); background: transparent; outline: none; min-width: 0; width: 100%; }
.ec-item-h input[type=text]:hover { border-color: var(--line); }
.ec-item-h input[type=text]:focus { border-color: var(--text-2); background: var(--surface); }
.ec-item-h select { padding: 4px 6px; font-size: 12.5px; }
.ec-sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; vertical-align: -1px; margin-right: 6px; }
.ec-item-h .ec-sw { margin: 0; }
.ec-row3 { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr) minmax(0, 1fr); gap: 6px; }
.ec-row2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 6px; margin-top: 4px; }
.ec-cell { display: grid; gap: 2px; min-width: 0; }
.ec-cell > span:first-child { font-size: 11.5px; color: var(--text-3); white-space: nowrap; }
.ec-cell .num input { padding-top: 5px; padding-bottom: 5px; }
.ec-add { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 2px; }
.btn.small { padding: 4px 10px; font-size: 12.5px; }
.ec-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 12px; }
.ec-chip { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 3px 12px; font-size: 12.5px; color: var(--text-2); cursor: pointer; }
.ec-chip:hover { border-color: var(--line-2); color: var(--text); }
#panel input.bad, #alts input.bad { color: var(--bad); }
.num:has(input.bad) input { border-color: var(--bad); }
#panel.fade-b { -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 32px), transparent); mask-image: linear-gradient(to bottom, #000 calc(100% - 32px), transparent); }
#panel.fade-t { -webkit-mask-image: linear-gradient(to bottom, transparent, #000 28px); mask-image: linear-gradient(to bottom, transparent, #000 28px); }
#panel.fade-t.fade-b { -webkit-mask-image: linear-gradient(to bottom, transparent, #000 28px, #000 calc(100% - 32px), transparent); mask-image: linear-gradient(to bottom, transparent, #000 28px, #000 calc(100% - 32px), transparent); }

/* summary */
.ec-say { margin-top: 6px; font-size: 12.5px; color: var(--text-2); line-height: 1.4; max-width: 40ch; }
.ec-big { font-weight: 600; }
.ec-stats { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.ec-tag { display: inline-flex; align-items: center; font-size: 10.5px; color: var(--text-3); border: 1px solid var(--line); border-radius: 999px; padding: 0 7px; margin-right: 4px; white-space: nowrap; line-height: 1.6; }
.ec-tag.warn { color: var(--warn-ink); border-color: color-mix(in srgb, var(--warn) 40%, transparent); background: var(--warn-bg); }
.ec-tag.good { color: var(--good-ink); border-color: color-mix(in srgb, var(--good) 35%, transparent); background: var(--good-bg); }
#checks tr.adv td.chk { color: var(--text-2); }
#checks td.note { white-space: normal; min-width: 200px; line-height: 1.4; }

/* charts */
.ec-two { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }
#npvChart, #cumChart { touch-action: none; user-select: none; }
.ec-cdrag { cursor: ew-resize; }
.ec-dl { cursor: pointer; }
.ec-dl:hover text, .ec-dl:focus text { text-decoration: underline; }
.ec-dl:focus { outline: none; }

/* tables */
.ec-twrap { width: 100%; }
table.ec-tab { width: 100%; border-collapse: collapse; font-size: 12.5px; font-variant-numeric: tabular-nums; }
.ec-tab th { font-weight: 500; font-size: 11.5px; color: var(--text-3); text-align: right; padding: 5px 6px; border-bottom: 1px solid var(--line); line-height: 1.3; }
.ec-tab td { text-align: right; padding: 4px 6px; border-bottom: 1px solid var(--fill-1); white-space: nowrap; }
.ec-tab th.l, .ec-tab td.l { text-align: left; }
.ec-tab td.ec-pos { color: var(--good-ink); }
.ec-lcc tr.best td { background: var(--surface-2); }
.ec-lcc td.l { white-space: normal; }
.ec-dep { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.ec-dtab td, .ec-dtab th { padding: 3px 6px; }
.ec-alts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 12px; }
.ec-alt { margin: 0; }
.ec-alt-add { border-style: dashed; color: var(--text-2); font: inherit; font-size: 13px; cursor: pointer; min-height: 120px; background: var(--surface-2); }
.ec-alt-add:hover { border-color: var(--line-2); color: var(--text); }
.ec-althead { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: end; gap: 8px 16px; margin-bottom: 12px; }
.ec-althead .ec-chips { margin: 0; }
.ec-altrate { width: 170px; }
.ec-say2 { font-size: 13px; color: var(--text-2); margin: 10px 0 0; }

@media (max-width: 1100px) {
  .ec-two { grid-template-columns: minmax(0, 1fr); }
  .ec-alts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ec-dep { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 760px) {
  #checks thead { display: none; }
  #checks, #checks tbody { display: block; width: 100%; }
  #checks tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 10px; padding: 9px 0; border-bottom: 1px solid var(--line); }
  #checks td { display: block; border: 0; padding: 0; text-align: left; white-space: normal; }
  #checks td.chk { grid-column: 1; grid-row: 1; }
  #checks td:nth-child(5) { grid-column: 2; grid-row: 1; align-self: center; }
  #checks td:nth-child(2) { grid-column: 1; grid-row: 2; font-size: 12.5px; }
  #checks td:nth-child(3) { grid-column: 2; grid-row: 2; font-size: 12.5px; text-align: right; }
  #checks td:nth-child(2)::before { content: "actual "; color: var(--text-3); }
  #checks td:nth-child(3)::before { content: "allowed "; color: var(--text-3); }
  #checks td:nth-child(4) { grid-column: 1 / -1; grid-row: 3; font-size: 12px; color: var(--text-3); min-width: 0; }
  /* the year-by-year table keeps the year, the net, its present worth and the running total on a phone */
  .ec-cf th:not(:first-child):not(:nth-last-child(-n+4)), .ec-cf td:not(:first-child):not(:nth-last-child(-n+4)) { display: none; }
  .ec-cf th:nth-last-child(2), .ec-cf td:nth-last-child(2) { display: none; }
  .ec-lcc th:nth-child(4), .ec-lcc td:nth-child(4), .ec-lcc th:nth-child(6), .ec-lcc td:nth-child(6) { display: none; }
  .ec-alts { grid-template-columns: minmax(0, 1fr); }
  .ec-item-h { grid-template-columns: 10px minmax(0, 1fr) 26px; }
  .ec-item-h select { grid-column: 2; grid-row: 2; justify-self: start; width: auto; min-width: 140px; }
}
@media print { .ec-edit { display: none !important; } }

/* theme-auto:start · generated by scripts/theme/hexmap.py: dark values (the rule of scripts/theme/colour.py) for
   colours that are not tokens, written as var(--x-rrggbb, #rrggbb): light is the fallback, unchanged */
@media screen and (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --x-2c4a91: #81a0e0; --x-6e7177: #85827f; --x-8a5a0e: #c89e6a; --x-9c3616: #e0876d; --x-9cb1d9: #7b8cab;
    --x-c08a3a: #e3b577;
  }
}
@media screen {
  :root[data-theme="dark"] {
    --x-2c4a91: #81a0e0; --x-6e7177: #85827f; --x-8a5a0e: #c89e6a; --x-9c3616: #e0876d; --x-9cb1d9: #7b8cab;
    --x-c08a3a: #e3b577;
  }
}
/* theme-auto:end */
