/* Eco-Consultant: the habitat planning studio. The site model (activity.js) keeps its own daylight colors in both
 * themes, like a lit model table; the work-order panel and controls follow the site theme. */
html {
  --ec-accent: #426356; --ec-accent-ink: #ffffff; --ec-card: #ffffff; --ec-ink: #1f3329; --ec-dim: #4a5d52; --ec-line: #9fb5a8;
  --ec-panel1: #f3f8f4; --ec-panel2: #e2ede5; --ec-ok: #13704a; --ec-bad: #b3261e; --ec-lock: #6b4a00; --ec-on: #e3f1e7;
  --ec-before: #d9c7ad; --ec-before-line: #a88b63; --ec-after: #2f7d57; --ec-track: #e7ece8; --ec-max: #fff1c7;
}
html[data-theme="dark"] {
  --ec-accent: #8fd1ad; --ec-accent-ink: #10241a; --ec-card: #1e2622; --ec-ink: #e6f0ea; --ec-dim: #b6c7bd; --ec-line: #4c6457;
  --ec-panel1: #1d2823; --ec-panel2: #17201c; --ec-ok: #5fd39a; --ec-bad: #ff8a80; --ec-lock: #f4d35e; --ec-on: #24402f;
  --ec-before: #6f604f; --ec-before-line: #a08a6c; --ec-after: #5fd39a; --ec-track: #2a332e; --ec-max: #4a3f17;
}

.ec { position: absolute; inset: 0; display: grid; grid-template-columns: minmax(0, 1fr) 404px; gap: 10px; padding: 8px 10px;
  color: var(--ec-ink); font-size: 16px; overflow: hidden; }
.ec *, .ec *::before, .ec *::after { box-sizing: border-box; }
.ec p { margin: 0; line-height: 1.3; }
.ec input, .ec button, .ec select { font: inherit; font-size: 16px; color: inherit; }
.ec-left { display: flex; flex-direction: column; gap: 6px; min-width: 0; min-height: 0; }
.ec-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* site model */
.ec-scene { flex: none; min-width: 0; overflow: hidden; border-radius: 12px; box-shadow: 0 2px 6px rgba(0,0,0,.18); background: #cfe3d3; }
.ec-scene:focus-visible { outline: 3px solid #b77a00; outline-offset: 2px; }
.ec-svg { display: block; width: 100%; height: auto; }
.ec-svg text { font-family: var(--tlg-font, system-ui, sans-serif); }
.ec-svg .ec-tag { font-size: 17px; font-weight: 700; fill: #1f3329; }
.ec-svg .ec-lab { font-size: 17px; font-weight: 700; fill: #ffffff; paint-order: stroke; stroke: #1d1a14; stroke-width: 4px; stroke-linejoin: round; }
.ec-svg .ec-stamp-t { font-size: 18px; font-weight: 800; letter-spacing: .04em; fill: currentColor; }
.ec-stamp { color: #13704a; } .ec-stamp.is-bad { color: #b3261e; }
.ec-stamp rect { stroke: currentColor; }
.ec-stamp.is-ok, .ec-stamp.is-bad { animation: ec-pop .45s ease-out both; transform-box: fill-box; transform-origin: center; }
@keyframes ec-pop { from { opacity: 0; } to { opacity: 1; } }
.ec-cue { transition: opacity 1.1s ease-in-out; }
.ec-grow { animation: ec-grow 1.2s ease-out both; transform-box: fill-box; transform-origin: bottom; }
@keyframes ec-grow { from { opacity: 0; transform: scaleY(.2); } to { opacity: 1; transform: none; } }

/* measure cards */
.ec-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.ec-action { position: relative; display: flex; flex-direction: column; justify-content: space-between; gap: 2px; min-height: 0; padding: 4px 8px;
  text-align: left; border: 2px solid var(--ec-line); border-radius: 10px; background: var(--ec-card); cursor: pointer; line-height: 1.2; }
.ec-action:hover:not(:disabled) { border-color: var(--ec-accent); }
.ec-action[aria-pressed="true"] { border-color: var(--ec-accent); background: var(--ec-on); box-shadow: inset 0 0 0 1px var(--ec-accent); }
.ec-action:disabled { cursor: default; }
.ec-action:focus-visible, .ec-prop:focus-visible, .ec-run:focus-visible { outline: 3px solid #b77a00; outline-offset: 2px; }
.ec-action-top { display: flex; align-items: center; gap: 6px; }
.ec-action-name { font-weight: 700; flex: 1; min-width: 0; }
.ec-action-foot { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.ec-fxs { display: flex; flex-wrap: wrap; gap: 0 7px; font-variant-numeric: tabular-nums; }
.ec-fx { display: inline-flex; align-items: center; gap: 1px; white-space: nowrap; }
.ec-costpill { flex: none; padding: 0 8px; line-height: 20px; border-radius: 999px; background: var(--ec-panel2); border: 1px solid var(--ec-line); font-weight: 700; white-space: nowrap; }
.ec-check { position: relative; flex: none; width: 20px; height: 20px; border: 2px solid var(--ec-line); border-radius: 5px; background: var(--ec-card); }
.ec-action[aria-pressed="true"] .ec-check { border-color: var(--ec-accent); background: var(--ec-accent); }
.ec-action[aria-pressed="true"] .ec-check::after { content: ''; position: absolute; left: 5px; top: 1px; width: 5px; height: 10px; border: solid var(--ec-accent-ink); border-width: 0 3px 3px 0; transform: rotate(45deg); }
.ec-ico { width: 20px; height: 20px; flex: none; }
.ec-ico--a { width: 24px; height: 24px; }
.ec-ico--s { width: 18px; height: 18px; }

/* credits meter + forecast */
.ec-meterrow { display: grid; grid-template-columns: minmax(0, 1fr) 210px; gap: 10px; align-items: center; }
.ec-meter-top { display: flex; justify-content: space-between; gap: 8px; font-weight: 700; }
.ec-meter-v { font-variant-numeric: tabular-nums; }
.ec-meter { position: relative; height: 14px; margin-top: 4px; border-radius: 7px; background: var(--ec-track); border: 1px solid var(--ec-line); overflow: visible; }
.ec-meter-fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 7px; background: linear-gradient(90deg, #6fae7f, #3f8a5c); transition: width .3s ease; }
.ec-meter-fill.is-over { background: repeating-linear-gradient(135deg, #c8553d 0 6px, #a23b1e 6px 12px); }
.ec-meter-line { position: absolute; top: -5px; bottom: -5px; width: 0; border-left: 3px solid var(--ec-ink); }
.ec .ec-run { min-height: 48px; padding: 6px 12px; border: 0; border-radius: 10px; cursor: pointer; font-weight: 800;
  background: linear-gradient(#4f7a68, #2f5546); color: #fff; box-shadow: 0 3px 0 #1d3a2f, 0 4px 8px rgba(0,0,0,.2); }
.ec-run:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 1px 0 #1d3a2f; }
.ec .ec-run:disabled { background: #8a9a92; color: #fff; box-shadow: none; cursor: default; }
html[data-theme="dark"] .ec .ec-run:disabled { background: #46534c; color: #d5e0da; }
.ec-observation { font-weight: 600; min-height: 21px; }

/* proposals */
.ec-props { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ec-prop { display: flex; flex-direction: column; gap: 4px; padding: 8px 10px; text-align: left; border: 2px solid var(--ec-line); border-radius: 10px;
  background: var(--ec-card); cursor: pointer; line-height: 1.25; min-width: 0; }
.ec-prop[aria-pressed="true"] { border-color: var(--ec-accent); box-shadow: inset 0 0 0 1px var(--ec-accent); }
.ec-prop-head { display: flex; justify-content: space-between; align-items: center; gap: 6px; font-size: 18px; }
.ec-prop-tag { padding: 1px 8px; border-radius: 999px; font-size: 16px; font-weight: 700; border: 2px solid currentColor; }
.ec-prop.is-win .ec-prop-tag { color: var(--ec-ok); }
.ec-prop.is-over .ec-prop-tag { color: var(--ec-bad); }
.ec-prop.is-win { border-color: var(--ec-ok); }
.ec-prop-stats { display: flex; flex-wrap: wrap; gap: 2px 14px; font-variant-numeric: tabular-nums; }
.ec-prop-list { display: flex; flex-wrap: wrap; gap: 3px 10px; }
.ec-prop-m { display: inline-flex; align-items: center; gap: 3px; }
.ec-prop-rem { display: grid; gap: 2px; margin-top: 2px; padding-top: 4px; border-top: 1px solid var(--ec-track); }
.ec-prop-remk { font-weight: 700; color: var(--ec-dim); }
.ec-prop-row { display: grid; grid-template-columns: 18px minmax(0, 8.5em) minmax(0, 1fr) 2.2em; align-items: center; gap: 6px; }
.ec-prop-rn { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ec-prop-bar { position: relative; height: 9px; border-radius: 4px; background: var(--ec-track); }
.ec-prop-bar i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 4px; background: var(--ec-before-line); }
.ec-prop-row b { text-align: right; font-variant-numeric: tabular-nums; }
.ec-prop-show { color: var(--ec-dim); font-style: italic; visibility: hidden; }
.ec-prop[aria-pressed="true"] .ec-prop-show { visibility: visible; }

/* succession notes */
.ec-notes { display: grid; gap: 4px; padding: 8px 10px; border-left: 4px solid var(--ec-accent); background: var(--ec-panel1); border-radius: 0 8px 8px 0; }
.ec-notes-k { font-weight: 800; color: var(--ec-accent); }

/* panel */
.ec-panel { display: flex; flex-direction: column; gap: 5px; min-height: 0; overflow: auto; padding: 8px 10px; border: 3px solid var(--ec-accent);
  border-radius: 12px; background: linear-gradient(var(--ec-panel1), var(--ec-panel2)); }
.ec-kicker, .ec-k2 { font-weight: 800; letter-spacing: .04em; text-transform: uppercase; color: var(--ec-accent); }
.ec-lock { font-style: italic; color: var(--ec-lock); }
.ec-lock.is-sealed { font-weight: 700; font-style: normal; }
.ec-lock.is-sealed::before { content: ''; display: inline-block; width: 11px; height: 9px; margin-right: 6px; border: 2px solid currentColor; border-radius: 2px; vertical-align: -1px;
  box-shadow: 0 -5px 0 -2px transparent; background: linear-gradient(currentColor, currentColor) center/3px 3px no-repeat; }
.ec-ticket { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 2px 10px; margin: 0; padding: 6px 8px; border: 2px dashed var(--ec-line); border-radius: 8px; background: var(--ec-card); }
.ec-ticket dt { font-weight: 700; } .ec-ticket dd { margin: 0; }

/* ledger */
.ec-ledger { flex: none; border-radius: 8px; background: var(--ec-card); border: 1px solid var(--ec-line); padding: 4px 6px 6px; }
.ec-ledger:focus-visible { outline: 3px solid #b77a00; outline-offset: 2px; }
.ec-ledger table { width: 100%; border-collapse: collapse; }
.ec-ledger caption { text-align: left; font-weight: 700; padding: 2px 0 3px; }
.ec-ledger th, .ec-ledger td { padding: 1px 3px; text-align: left; font-weight: 400; border-bottom: 1px solid var(--ec-track); line-height: 1.25; }
.ec-ledger thead th { font-weight: 700; color: var(--ec-dim); }
.ec-ledger tbody th { white-space: nowrap; }
.ec-pn { display: flex; align-items: center; gap: 5px; }
.ec-ledger .ec-num { text-align: right; font-variant-numeric: tabular-nums; width: 1%; white-space: nowrap; }
.ec-ledger .ec-after { font-weight: 700; min-width: 3ch; }
.ec-ledger tr.is-zero { color: var(--ec-dim); }
.ec-ledger tr.is-max { background: var(--ec-max); }
.ec-maxtag { font-size: 16px; font-weight: 700; padding: 0 3px; border: 1px solid currentColor; border-radius: 4px; }
.ec-bars { position: relative; width: 30%; min-width: 46px; }
.ec-bar { position: absolute; left: 4px; height: 8px; border-radius: 3px; max-width: calc(100% - 8px); }
.ec-bar--b { top: calc(50% - 7px); background: var(--ec-before); border: 1px solid var(--ec-before-line); }
.ec-bar--a { top: calc(50% + 1px); background: var(--ec-after); transition: width 1s ease-in-out; }
.ec-index { margin-top: 4px; }
.ec-index-top { display: flex; justify-content: space-between; gap: 8px; font-weight: 700; }
.ec-index-top b { font-variant-numeric: tabular-nums; }
.ec-index.is-ok .ec-index-top b { color: var(--ec-ok); } .ec-index.is-bad .ec-index-top b { color: var(--ec-bad); }
.ec-index.is-ok .ec-index-top b::before { content: '✓ '; } .ec-index.is-bad .ec-index-top b::before { content: '✗ '; }
.ec-gauge { position: relative; height: 12px; margin: 4px 0 3px; border-radius: 6px; background: var(--ec-track); border: 1px solid var(--ec-line); }
.ec-gauge-start { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 6px; background: var(--ec-before); }
.ec-gauge-fill { position: absolute; left: 0; top: 2px; bottom: 2px; border-radius: 6px; background: var(--ec-after); transition: width 1s ease-in-out; }
.ec-gauge-target { position: absolute; top: -5px; bottom: -5px; width: 0; border-left: 3px dashed var(--ec-ink); }
.ec-index-note { color: var(--ec-dim); }

/* report */
.ec-report { display: grid; gap: 6px; }
.ec-field { display: grid; gap: 3px; min-width: 0; margin: 0; padding: 0; border: 0; }
.ec-flabel { font-weight: 700; padding: 0; line-height: 1.25; }
.ec-field--num { grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 8px; }
.ec-field--sel { grid-template-columns: minmax(0, 1fr) 176px; align-items: center; gap: 8px; }
.ec-numrow { display: flex; align-items: center; gap: 6px; }
.ec-numin { width: 96px; min-height: 42px; padding: 4px 8px; border: 2px solid var(--ec-line); border-radius: 8px; background: var(--ec-card); font-variant-numeric: tabular-nums; }
.ec-unit { min-width: 3.2em; }
.ec-select { min-height: 42px; padding: 4px 8px; border: 2px solid var(--ec-line); border-radius: 8px; background: var(--ec-card); width: 100%; }
.ec-numin:focus-visible, .ec-select:focus-visible { outline: 3px solid #b77a00; outline-offset: 1px; }
.ec-choice-g { display: grid; gap: 4px; }
.ec-choices--plan .ec-choice-g, .ec-choices--sequence .ec-choice-g { grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); }
.ec-choice { position: relative; display: block; min-width: 0; cursor: pointer; }
.ec-choice input { position: absolute; inset: 0; z-index: 1; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.ec-choice-b { display: flex; align-items: center; gap: 8px; min-height: 38px; padding: 2px 8px 2px 30px; position: relative; line-height: 1.2;
  border: 2px solid var(--ec-line); border-radius: 8px; background: var(--ec-card); pointer-events: none; }
.ec-choice-b::before { content: ''; position: absolute; left: 9px; top: calc(50% - 7px); width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--ec-line); background: var(--ec-card); }
.ec-choice.is-on .ec-choice-b { border-color: var(--ec-accent); background: var(--ec-accent); color: var(--ec-accent-ink); font-weight: 700; }
.ec-choice.is-on .ec-choice-b::before { border-color: var(--ec-accent-ink); background: radial-gradient(var(--ec-accent-ink) 0 3px, transparent 4px); }
.ec-choice input:focus-visible + .ec-choice-b { outline: 3px solid #b77a00; outline-offset: 2px; }
.ec-choice input:disabled { cursor: default; }
.ec :disabled + .ec-choice-b, .ec-numin:disabled, .ec-select:disabled { opacity: .78; }

.ec-verdict { display: flex; flex-wrap: wrap; gap: 2px 14px; font-weight: 700; padding: 5px 8px; border-radius: 8px; background: var(--ec-card); border: 2px solid var(--ec-line); }
.ec--mitigate .ec-verdict { padding: 0; border: 0; background: none; min-height: 21px; }
.ec--mitigate.is-revealed .ec-observation { display: none; }
.ec-vl.is-ok { color: var(--ec-ok); } .ec-vl.is-bad { color: var(--ec-bad); }
.ec-about { margin-top: auto; }
.ec-about summary { font-weight: 700; cursor: pointer; min-height: 28px; }
.ec-about p { padding-top: 4px; }

/* worked example */
.ec-ex { display: block; width: 100%; max-width: 440px; height: auto; }
.ec-ex text { font-family: var(--tlg-font, system-ui, sans-serif); fill: #1f3329; }
.ec-ex .ec-exk { font-size: 17px; font-weight: 700; }
.ec-ex .ec-ext { font-size: 18px; font-weight: 800; }

/* HTML copies of the scene labels, used only where the scene is too narrow for 16 px SVG text */
.ec-scenecap, .ec-legend { display: none; }
@media (max-width: 640px) {
  .ec-svg .ec-svglab, .ec-svg .ec-lab, .ec-svg .ec-stamp { display: none !important; }
  .ec-scenecap { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 4px 10px; font-weight: 700; }
  .ec-cap-t { color: var(--ec-dim); }
  .ec-cap-stamp { padding: 1px 8px; border: 2px solid currentColor; border-radius: 6px; font-weight: 800; letter-spacing: .03em; }
  .ec-cap-stamp.is-ok { color: var(--ec-ok); } .ec-cap-stamp.is-bad { color: var(--ec-bad); }
  .ec-cap-stamp[hidden] { display: none; }
  .ec-legend { display: grid; gap: 2px; margin: 0; padding: 0; list-style: none; }
  .ec-legend li { display: flex; align-items: center; gap: 8px; }
  .ec-legend i { flex: none; width: 16px; height: 16px; border-radius: 4px; border: 1px solid var(--ec-line); }
}

/* narrow screens: everything stacks and the stage scrolls */
@media (max-width: 900px) {
  .ec { position: static; display: flex; flex-direction: column; height: auto; overflow: visible; }
  .ec-panel { overflow: visible; }
  .ec-left { flex: none; }
}
@media (max-width: 560px) {
  .ec { padding: 8px 10px; }
  .ec-actions { grid-template-columns: 1fr; }
  .ec-meterrow { grid-template-columns: 1fr; }
  .ec-props { grid-template-columns: 1fr; }
  .ec-field--num, .ec-field--sel { grid-template-columns: 1fr; }
  .ec-ledger tbody th { white-space: normal; }
  .ec-bars { width: 22%; min-width: 44px; }
  .ec-maxtag { display: block; margin-top: 1px; }
}
@media (prefers-reduced-motion: reduce) { .ec *, .ec-svg * { animation: none !important; transition: none !important; } }
