/* LCA Graph app. Self-contained; borrows the Clove Circle worksheet palette. */
.lg {
  --ink: #1a3d2e; --text: #344a3c; --muted: #5e7a6a; --line: #d3ddd6; --paper: #fff; --wash: #f4f8f5;
  --green: #3d8b68; --green-pale: #d4eddf; --amber: #b57a17; --amber-pale: #fbeed3;
  --red: #a32d2d; --red-pale: #f7dcdc; --blue: #185fa5; --blue-pale: #dbe8f7;
  color: var(--text); font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 15px; line-height: 1.55; max-width: 1500px; margin: 0 auto;
}
.lg *, .lg *::before, .lg *::after { box-sizing: border-box; }
.lg h1, .lg h2, .lg h3, .lg h4 { font-family: Fraunces, Georgia, serif; color: var(--ink); margin: 0; line-height: 1.2; }
.lg code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; }
.lg button, .lg select, .lg input { font: inherit; }
.lg button { cursor: pointer; }
.lg a { color: var(--green); }

/* header */
.lg-header { border-bottom: 1px solid var(--line); padding-bottom: 12px; margin-bottom: 14px; display: flex; gap: 20px; justify-content: space-between; flex-wrap: wrap; align-items: flex-start; }
.lg-eyebrow { font-size: 11px; letter-spacing: .18em; text-transform: uppercase; font-weight: 700; color: var(--green); }
.lg-header h1 { font-size: 26px; margin: 4px 0 5px; }
.lg-header p { margin: 0; color: var(--muted); max-width: 78ch; font-size: 13.5px; }
.lg-chrome { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.lg-chrome button, .lg-chrome label.lg-btn, .lg-chrome select {
  font: 600 12px/1 Inter, system-ui, sans-serif; letter-spacing: .05em; text-transform: uppercase;
  padding: 10px 14px; border-radius: 7px; border: 1px solid var(--line); background: var(--paper); color: var(--text); cursor: pointer;
}
.lg-chrome select { text-transform: none; letter-spacing: 0; font-weight: 500; }
.lg-chrome button:hover, .lg-chrome label.lg-btn:hover { border-color: var(--green); color: var(--green); }
.lg-chrome input[type=file] { display: none; }

/* notes banner - deliberately loud */
.lg-notes { display: grid; gap: 8px; margin-bottom: 14px; }
.lg-notes-bar { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.lg-notes-count { font-size: 12.5px; font-weight: 600; color: var(--amber); letter-spacing: .02em; }
.lg-notes-bar button { font-size: 12px; padding: 5px 10px; border-radius: 7px; border: 1px solid var(--line); background: var(--paper); }
.lg-note-chip { font-size: 12px; padding: 3px 10px; border-radius: 999px; border: 1px solid #e2b95c; background: var(--amber-pale); color: var(--ink); }
.lg-note-chip-info { border-color: #a9c4e6; background: var(--blue-pale); }
.lg-note-chip-warning { border-color: #d99; background: var(--red-pale); }
.lg-note { border-radius: 10px; padding: 10px 14px; border: 1px solid; display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; font-size: 13.5px; }
.lg-note-quirk { background: var(--amber-pale); border-color: #e2b95c; }
.lg-note-warning { background: var(--red-pale); border-color: #d99; }
.lg-note-info { background: var(--blue-pale); border-color: #a9c4e6; }
.lg-note-tag { font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; font-weight: 800; padding-top: 3px; }
.lg-note-quirk .lg-note-tag { color: var(--amber); }
.lg-note-warning .lg-note-tag { color: var(--red); }
.lg-note-info .lg-note-tag { color: var(--blue); }
.lg-note b { color: var(--ink); }
.lg-note-nodes { grid-column: 2; display: flex; gap: 6px; flex-wrap: wrap; }
.lg-note-nodes button { font-size: 11.5px; padding: 2px 8px; border-radius: 999px; border: 1px solid rgba(0,0,0,.15); background: rgba(255,255,255,.6); }
.lg-note-nodes button:hover { border-color: var(--ink); }

/* rail */
.lg-rail { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 6px; margin-bottom: 14px; }
@media (max-width: 1100px) { .lg-rail { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.lg-step { text-align: left; border: 1px solid var(--line); background: var(--paper); border-radius: 9px; padding: 8px 10px; display: flex; gap: 8px; align-items: center; }
.lg-step-n { width: 22px; height: 22px; border-radius: 50%; background: var(--wash); color: var(--muted); font-size: 11px; font-weight: 700; display: grid; place-items: center; flex-shrink: 0; }
.lg-step-title { font-size: 12.5px; font-weight: 600; color: var(--ink); line-height: 1.2; }
.lg-step-state { font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.lg-step.is-active { border-color: var(--green); box-shadow: 0 0 0 2px var(--green-pale); }
.lg-step.is-solved .lg-step-n { background: var(--green); color: #fff; }
.lg-step.is-stale .lg-step-n { background: var(--amber-pale); color: var(--amber); }
.lg-step.is-locked { opacity: .55; }
.lg-step.is-error .lg-step-n { background: var(--red-pale); color: var(--red); }

/* kpis */
.lg-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; margin-bottom: 14px; }
.lg-kpi { background: var(--paper); border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; cursor: pointer; }
.lg-kpi:hover { border-color: var(--green); }
.lg-kpi-label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.lg-kpi-val { font-family: Fraunces, Georgia, serif; font-size: 22px; color: var(--ink); }
.lg-kpi.is-stale .lg-kpi-val { color: var(--muted); text-decoration: line-through dotted; }
.lg-kpi-note { font-size: 11px; color: var(--muted); }
.lg-kpi.is-changed .lg-kpi-note { color: var(--blue); }

/* grid */
.lg-grid { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr) 340px; align-items: start; }
@media (max-width: 1100px) { .lg-grid { grid-template-columns: minmax(0, 1fr); } }
.lg-panel { background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 16px; }
.lg-col { display: flex; flex-direction: column; gap: 14px; min-width: 0; }

/* diagram */
.lg-diagram-hint { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin: 0; }
.lg-swatch { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: middle; }
.lg-diagram-wrap { overflow-x: auto; background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 8px; }
.lg-diagram-wrap svg { display: block; height: auto; font-family: Inter, system-ui, sans-serif; }
.lg-stream-text { font-size: 10.5px; }
.lg-blk { fill: #fff; stroke: var(--green); stroke-width: 1.5; }
.lg-unit-cost_only .lg-blk { stroke-dasharray: 4 3; stroke: var(--muted); }
.lg-blk-pad, .lg-flow-pad { fill: transparent; stroke: transparent; stroke-width: 14; pointer-events: stroke; }
.lg-blk-pad { pointer-events: fill; }
.lg-blk-label { font-size: 12.5px; font-weight: 600; fill: var(--ink); }
.lg-blk-label.is-two-line { font-size: 11.5px; }
.lg-blk-sub { font-size: 10.5px; fill: var(--muted); }
.lg-flow { fill: none; stroke: #8aa398; stroke-width: 2; stroke-linejoin: round; transition: stroke-width .3s; }
.lg-flow.is-stale { stroke-dasharray: 5 4; opacity: .55; }
.is-recycle .lg-flow { stroke: var(--blue); }
.is-product .lg-flow { stroke: var(--green); }
.is-closes .lg-flow { stroke-dasharray: 2 3; }
.lg-stream-name { font-size: 10.5px; fill: var(--muted); }
.lg-stream-label { font-size: 11.5px; font-weight: 600; fill: var(--ink); }
.lg-stream-label.is-stale { fill: var(--muted); font-weight: 400; }
.lg-stream-label.is-changed { fill: var(--blue); }
.lg-hit { cursor: pointer; outline: none; }
.lg-hit.is-input .lg-blk { stroke: var(--amber); }
.lg-hit:hover .lg-blk, .lg-hit:focus .lg-blk { fill: var(--wash); }
.lg-hit:hover .lg-flow, .lg-hit:focus .lg-flow { stroke: var(--ink); }
.lg-hit.is-selected .lg-blk { stroke-width: 3; }
.lg-hit.is-selected .lg-flow { stroke: var(--ink); stroke-width: 3.5 !important; }
.lg-hit.is-stale .lg-blk { stroke-dasharray: 4 3; }
.is-focusing .lg-hit:not(.is-highlit) { opacity: .35; }

/* teaching card */
.lg-card-phase { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--green); font-weight: 700; }
.lg-card h2 { font-size: 21px; margin: 4px 0 8px; }
.lg-card-q { font-style: italic; color: var(--muted); margin: 0 0 10px; }
.lg-card p { margin: 0 0 10px; font-size: 14px; }
.lg-card-formula { background: var(--wash); border-radius: 8px; padding: 8px 12px; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12.5px; margin: 0 0 12px; white-space: pre-wrap; }
.lg-solve { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin: 12px 0; }
.lg-solve button { background: var(--green); color: #fff; border: 0; border-radius: 8px; padding: 11px 18px; font: 600 13px Inter, system-ui, sans-serif; letter-spacing: .04em; text-transform: uppercase; }
.lg-solve button[disabled] { background: var(--line); color: var(--muted); cursor: not-allowed; }
.lg-solve-msg { font-size: 13px; color: var(--muted); }
.lg-solve-msg.is-error { color: var(--red); }
.lg-closure { border-radius: 9px; padding: 10px 12px; margin: 10px 0; border: 1px solid var(--line); font-size: 13px; }
.lg-closure.is-ok { background: var(--green-pale); border-color: #a8d5bd; }
.lg-closure.is-bad { background: var(--red-pale); border-color: #e0a0a0; }
.lg-closure-row { display: flex; justify-content: space-between; gap: 10px; }
.lg-constraint { font-size: 13px; padding: 6px 10px; border-radius: 8px; margin: 6px 0; }
.lg-constraint.is-ok { background: var(--wash); color: var(--muted); }
.lg-constraint.is-soft { background: var(--amber-pale); color: var(--amber); }
.lg-constraint.is-hard { background: var(--red-pale); color: var(--red); }
.lg-try { background: var(--amber-pale); border: 1px solid #e2b95c; border-radius: 10px; padding: 10px 14px; font-size: 13.5px; }
.lg-try b { color: var(--amber); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; display: block; margin-bottom: 3px; }

/* worked table */
.lg-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.lg-table th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); padding: 6px 6px; border-bottom: 1px solid var(--line); }
.lg-table td { padding: 5px 6px; border-bottom: 1px solid #edf1ee; vertical-align: top; }
.lg-table td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.lg-table tr.is-clickable { cursor: pointer; }
.lg-table tr.is-clickable:hover td { background: var(--wash); }
.lg-table tr.is-picked td { background: var(--green-pale); }
.lg-table .is-stale { color: var(--muted); }
.lg-table code { color: var(--muted); }
.lg-table input { width: 90px; padding: 3px 6px; border: 1px solid var(--line); border-radius: 5px; text-align: right; }
.lg-table input:focus { outline: 2px solid var(--green-pale); border-color: var(--green); }
.lg-group { font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin: 14px 0 4px; }
.lg-badge { display: inline-block; font-size: 10px; padding: 1px 6px; border-radius: 999px; background: var(--amber-pale); color: var(--amber); font-weight: 700; margin-left: 6px; vertical-align: middle; }
.lg-badge-warning { background: var(--red-pale); color: var(--red); }
.lg-badge-info { background: var(--blue-pale); color: var(--blue); }
.lg-scroll { overflow-x: auto; }

/* fields */
.lg-field { padding: 8px 0; border-bottom: 1px solid #edf1ee; }
.lg-field:last-child { border-bottom: 0; }
.lg-field-label { font-size: 13px; font-weight: 600; color: var(--ink); display: block; margin-bottom: 4px; }
.lg-field-row { display: flex; gap: 6px; }
.lg-field-value { flex: 1; min-width: 0; padding: 7px 9px; border: 1px solid var(--line); border-radius: 7px; text-align: right; font-variant-numeric: tabular-nums; }
.lg-field-unit { padding: 7px 6px; border: 1px solid var(--line); border-radius: 7px; background: var(--wash); max-width: 120px; }
.lg-field.has-error .lg-field-value { border-color: var(--red); }
.lg-field.has-warning .lg-field-value { border-color: var(--amber); }
.lg-field-note { font-size: 12px; color: var(--muted); min-height: 0; }
.has-error .lg-field-note { color: var(--red); }
.has-warning .lg-field-note { color: var(--amber); }
.lg-field-source { font-size: 12px; color: var(--muted); margin: 3px 0 0; }
.lg-field-readout { font-family: Fraunces, Georgia, serif; font-size: 20px; color: var(--ink); }
.lg-field-readout.is-stale { color: var(--muted); }
.lg-formula-label { font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); display: block; margin-top: 6px; }
.lg-field-formula code { display: block; white-space: pre-wrap; word-break: break-word; background: var(--wash); border-radius: 6px; padding: 6px 8px; }
.lg-deps { list-style: none; padding: 0; margin: 4px 0 0; font-size: 12.5px; }
.lg-deps li { display: flex; justify-content: space-between; gap: 8px; padding: 2px 0; cursor: pointer; }
.lg-deps li:hover { color: var(--green); }
.lg-deps li.is-input .lg-dep-name::before { content: "●"; color: var(--amber); margin-right: 5px; font-size: 9px; vertical-align: middle; }
.lg-deps li.is-computed .lg-dep-name::before { content: "●"; color: #8aa398; margin-right: 5px; font-size: 9px; vertical-align: middle; }
.lg-insp-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 6px; }
.lg-insp-head h4 { font-size: 17px; }
.lg-insp-tag { font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.lg-empty { color: var(--muted); font-size: 13.5px; }
.lg-fields-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; }
.lg-fields-head h3 { font-size: 16px; }
.lg-mini { font-size: 12px; color: var(--muted); }

/* interpret: targets + sensitivity */
.lg-section { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.lg-section h3 { font-size: 17px; margin-bottom: 6px; }
.lg-inline { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 6px 0; }
.lg-inline select, .lg-inline input { padding: 6px 8px; border: 1px solid var(--line); border-radius: 7px; }
.lg-inline button { padding: 7px 12px; border-radius: 7px; border: 1px solid var(--green); background: var(--green); color: #fff; font-weight: 600; font-size: 12.5px; }
.lg-inline button.lg-secondary { background: var(--paper); color: var(--green); }
.lg-chips { display: flex; gap: 5px; flex-wrap: wrap; }
.lg-chip { font-size: 11.5px; padding: 2px 8px; border-radius: 999px; background: var(--wash); border: 1px solid var(--line); cursor: pointer; }
.lg-chip.is-missing { background: var(--red-pale); border-color: #e0a0a0; color: var(--red); }
.lg-chip:hover { border-color: var(--green); }
.lg-bar { position: relative; height: 14px; background: var(--wash); border-radius: 4px; min-width: 160px; }
.lg-bar span { position: absolute; top: 0; bottom: 0; border-radius: 4px; }
.lg-bar .lo { background: #e0a0a0; }
.lg-bar .hi { background: #a8d5bd; }
.lg-bar i { position: absolute; top: -2px; bottom: -2px; width: 2px; background: var(--ink); }
.lg-hist { display: flex; align-items: flex-end; gap: 1px; height: 70px; border-bottom: 1px solid var(--line); margin: 8px 0 4px; }
.lg-hist span { flex: 1; background: var(--green); opacity: .8; min-width: 2px; }
.lg-result { margin: 8px 0 14px; }
.lg-result h4 { font-size: 14px; margin-bottom: 4px; }
.lg-spec { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin: 8px 0; }
.lg-spec-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.lg-spec-head b { font-size: 14px; color: var(--ink); }
.lg-spec code { color: var(--muted); }
.lg-lint { font-size: 12.5px; }
.lg-lint li { margin: 2px 0; }
.lg-status { font-size: 12.5px; color: var(--muted); }
.lg-status.is-error { color: var(--red); }
