#history-open{margin:0;white-space:nowrap}
.history-dialog{width:min(920px,calc(100vw - 32px));max-height:calc(100dvh - 32px);padding:24px;border:1px solid #dce4e9;border-radius:16px;color:#18384b;overflow:auto;box-sizing:border-box}
.history-dialog::backdrop{background:rgba(12,33,45,.5)}
.history-heading{display:flex;align-items:center;justify-content:space-between;gap:16px}.history-heading h2{margin:0}.history-status{min-height:1.5em}.history-versions{display:grid;gap:8px;margin:16px 0}.history-version{white-space:normal;text-align:left}.history-version[aria-pressed=true]{outline:2px solid #218452;outline-offset:1px}.history-inspector{border-top:1px solid #dce4e9;margin-top:20px;padding-top:12px}.history-controls{display:flex;align-items:end;flex-wrap:wrap;gap:12px;margin:16px 0}.history-controls label{margin:0;display:grid;gap:5px;max-width:100%;min-width:120px}.history-controls select{max-width:100%}.history-controls input{width:130px}.history-evidence pre{white-space:pre-wrap;overflow-wrap:anywhere;padding:12px;background:#f3f7f8;border-radius:8px}.history-value{font-size:1.4rem;overflow-wrap:anywhere}.history-provenance,.history-inspector details{overflow-wrap:anywhere}.history-dialog :focus-visible{outline:3px solid #218452;outline-offset:3px}
@media(max-width:600px){.history-dialog{padding:16px}.history-heading{align-items:start;flex-direction:column}.history-controls{display:grid;grid-template-columns:minmax(0,1fr)}.history-controls label,.history-controls input,.history-controls select{width:100%;box-sizing:border-box}}

.history-grid-pane{margin:16px 0}.history-grid-actions{display:flex;flex-wrap:wrap;gap:8px}.history-grid-status{overflow-wrap:anywhere}.history-grid-scroll{max-height:400px;overflow:auto;border:1px solid #dce4e9;border-radius:8px;margin:12px 0}.history-grid{border-collapse:collapse;table-layout:fixed;width:max-content;min-width:100%;font-size:.85rem}.history-grid caption{text-align:left;padding:8px;position:sticky;left:0}.history-grid th,.history-grid td{padding:0;border:1px solid #dce4e9;min-width:96px;width:96px;max-width:160px}.history-grid th{background:#edf3f5;padding:8px;position:sticky;top:0;z-index:1}.history-grid tbody th{left:0;min-width:56px;width:56px;z-index:2}.history-grid-cell{display:block;width:100%;min-height:40px;max-width:160px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;text-align:left;border:0;border-radius:0;padding:8px;background:#fff;color:#18384b;font:inherit}.history-grid-cell.has-formula{background:#eff8f3}.history-grid td[aria-selected=true]{outline:2px solid #218452;outline-offset:-2px}.history-grid-cell:hover{background:#e3f1e9}.history-grid-cell:focus-visible{outline-offset:-3px}.history-grid-pane[hidden]{display:none}

.history-browse-actions,.history-findings-actions{display:flex;gap:8px;flex-wrap:wrap}.history-findings-pane{margin:16px 0}.history-findings-pane[hidden]{display:none}.history-findings-status,.history-finding{overflow-wrap:anywhere}.history-findings-list{max-height:400px;overflow:auto;margin:12px 0;border:1px solid #dce4e9;border-radius:8px}.history-findings-list:empty{border:0}.history-finding{padding:12px;border-bottom:1px solid #dce4e9}.history-finding:last-child{border-bottom:0}.history-finding h3{margin:0;font-size:1rem}.history-finding p{margin:6px 0}.history-finding button{white-space:normal;text-align:left;max-width:100%}.history-finding pre{white-space:pre-wrap;overflow-wrap:anywhere;background:#f3f7f8;padding:10px;border-radius:6px}.history-defined-name{font-weight:600}

.history-reference-pane{margin:16px 0}.history-reference-pane[hidden]{display:none}.history-reference-status,.history-reference{overflow-wrap:anywhere}.history-reference-list{max-height:400px;overflow:auto;padding:12px;border:1px solid #dce4e9;border-radius:8px}.history-reference{padding:10px 0;border-top:1px solid #dce4e9}.history-reference p{margin:6px 0}.history-reference button{white-space:normal;text-align:left;max-width:100%}.history-reference-limit{padding:8px;background:#fff8e6;border-radius:6px;overflow-wrap:anywhere}

.history-reference-list details{margin:10px 0;overflow-wrap:anywhere}.history-reference-list pre{white-space:pre-wrap;overflow-wrap:anywhere;background:#f3f7f8;padding:10px;border-radius:6px}

.history-defined-reference{padding:10px 0;border-top:1px solid #dce4e9}.history-defined-reference h4{margin:4px 0;font-size:.95rem}.history-defined-reference p{margin:6px 0}

.history-saved,.history-save{margin:16px 0}.history-saved summary,.history-save summary{cursor:pointer}.history-save label{display:grid;gap:6px;margin-top:12px}.history-save textarea{box-sizing:border-box;width:100%;max-width:100%}.history-saved-item{padding:12px 0;border-bottom:1px solid #dce4e9}.history-saved-item button{max-width:100%;white-space:normal;text-align:left;overflow-wrap:anywhere}.history-saved-question{font-weight:600;white-space:pre-wrap;overflow-wrap:anywhere}


.history-analytics{margin:16px 0;padding:12px;border:1px solid #dce4e9;border-radius:8px}
.history-analytics summary{cursor:pointer;font-weight:600}
.history-analytics [hidden],.history-analytics[hidden]{display:none}
.history-analytics-controls{margin-bottom:12px}
.history-analytics .history-browse-actions{align-items:end}
.history-analytics .history-browse-actions label{display:grid;gap:5px;margin:0}
.history-analytics-change{padding:12px 0;border-top:1px solid #dce4e9;overflow-wrap:anywhere}
.history-analytics-change h4,.history-analytics-change p{margin:0 0 8px}
.history-analytics-change pre{padding:8px;border-radius:6px;background:#f3f7f8;white-space:pre-wrap;overflow-wrap:anywhere}
.history-analytics table{width:100%;border-collapse:collapse;font-size:.9rem;text-align:left}
.history-analytics th,.history-analytics td{padding:8px;border-bottom:1px solid #dce4e9;vertical-align:top;overflow-wrap:anywhere}

.history-workflow{margin:16px 0;padding:12px;border:1px solid #dce4e9;border-radius:8px}
.history-workflow summary{cursor:pointer;font-weight:600}
.history-workflow[hidden]{display:none}
.history-workflow-editor:empty{display:none}
.history-workflow-form{display:flex;gap:8px;flex-wrap:wrap;align-items:end;padding:12px 0}
.history-workflow-form h3{flex-basis:100%;margin:0}
.history-workflow-form label{display:grid;gap:4px;min-width:0}
.history-workflow-form input[type=checkbox]{justify-self:start}
.history-workflow-form textarea{min-width:min(24rem,80vw)}
.history-workflow-row{display:flex;align-items:baseline;gap:8px;flex-wrap:wrap;padding:6px 0;border-bottom:1px solid #dce4e9}
.history-workflow-row button,.history-workflow a{overflow-wrap:anywhere}
.history-workflow .history-analytics-change>button{margin:0 6px 6px 0}
.history-review-log{padding-inline-start:24px}
.history-review-log p{white-space:pre-wrap}
#review-portfolio{margin-bottom:12px}

.history-review-draft{white-space:pre-wrap;overflow-wrap:anywhere}

.history-scenario{margin:12px 0}
.history-scenario-fields{border:0;padding:0;margin:0;min-inline-size:0}
.history-scenario-fields legend,.history-scenario-fields h3{font-size:1rem;font-weight:600;margin:10px 0}
.history-scenario-fields .history-controls{margin:6px 0}
.history-scenario-fields [type=submit]{margin-left:8px}
.history-scenario-table{border-collapse:collapse;width:100%}
.history-scenario-table caption,.history-scenario-table th,.history-scenario-table td{text-align:left;padding:8px}
.history-scenario-table thead th{background:#edf3f5}
.history-scenario-table tbody tr+tr{border-top:1px solid #dce4e9}
.history-scenario-table td:nth-child(n+2):nth-child(-n+4){text-align:right;font-variant-numeric:tabular-nums;white-space:nowrap}

.history-dialog[data-guided] .history-saved,
.history-dialog[data-guided] .history-retire,
.history-dialog[data-guided] .history-heading + .muted,
.history-dialog[data-guided=scenario] .history-browse-actions,
.history-dialog[data-guided=scenario] .history-scenario form > fieldset,
.history-dialog[data-guided=scenario] .history-scenario > summary,
.history-dialog[data-guided=scenario] .history-save{display:none}
.history-dialog[data-guided=scenario] .history-scenario > p:first-of-type{display:none}
.history-dialog[data-guided] .history-status{margin:8px 0}
.history-dialog[data-guided] .history-save button{margin-right:8px}
.history-scenario-graph{margin-top:16px}
.history-scenario-graph[hidden]{display:none}
.scenario-graph-canvas{position:relative;overflow:auto;background:#f8fafb;border:1px solid #dce4e9;border-radius:8px}
.dependency-card-edges{position:absolute;inset:0;width:100%;height:100%;pointer-events:none}
.scenario-map-levels{position:relative;isolation:isolate;width:max-content;min-width:100%;display:grid;gap:38px;padding:20px 16px;box-sizing:border-box}
.scenario-map-level{position:relative;display:flex;justify-content:center;gap:12px}
.scenario-map-cell{width:160px;min-height:85px;display:grid;gap:4px;padding:8px;text-align:left;white-space:normal;overflow-wrap:anywhere}
.scenario-map-cell span{font-size:.82rem}
[data-map-kind=input]{--map-fill:#eaf4fd;--map-ink:#123c60;--map-border:#78a8cf}
[data-map-kind=calculation]{--map-fill:#f0f4f5;--map-ink:#1b3948;--map-border:#a2b7c1}
[data-map-kind=gate]{--map-fill:#fff4d9;--map-ink:#633c02;--map-border:#c49b48}
[data-map-kind=output]{--map-fill:#f3eafd;--map-ink:#482c68;--map-border:#a98cc2}
[data-map-kind=reference]{--map-fill:#fff;--map-ink:#405763;--map-border:#9baeb8}
.scenario-map-cell[data-map-kind]{background:var(--map-fill);color:var(--map-ink);border-color:var(--map-border)}
.scenario-map-cell[data-map-kind=input]{border-radius:16px}
.scenario-map-cell[data-map-kind=calculation]{border-radius:8px}
.scenario-map-cell[data-map-kind=gate]{border-style:dashed;border-radius:8px}
.scenario-map-cell[data-map-kind=output]{border-radius:4px}
.scenario-map-cell[data-map-kind=reference]{border-style:dotted}
:is(#trace-graph,.scenario-saved-trace [data-trace-part=graph]) g.node[data-map-kind] :is(rect,polygon,path){fill:var(--map-fill);stroke:var(--map-border)}
:is(#trace-graph,.scenario-saved-trace [data-trace-part=graph]) g.node[data-map-kind] text{fill:var(--map-ink)}
:is(#trace-graph,.scenario-saved-trace [data-trace-part=graph]) g.node[data-map-kind].is-selected :is(rect,polygon,path){stroke:var(--map-ink);stroke-width:3px}
.trace-map-legend{display:flex;flex-wrap:wrap;gap:6px;list-style:none;padding:0;margin:0 0 8px;font-size:.8rem}
.trace-map-legend[hidden]{display:none}
.trace-map-legend li{background:var(--map-fill);color:var(--map-ink);border:1px solid var(--map-border);border-radius:4px;padding:2px 6px}
.scenario-map-cell[aria-pressed=true]{outline:3px solid #217654;outline-offset:2px}
.scenario-map-changed{box-shadow:inset 0 -4px #007665}
.scenario-node-editor:not(:empty){padding:12px;margin-top:8px;border:1px solid #dce4e9;border-radius:8px}
.scenario-node-editor h3{margin:0}
#app .audit-review-dialog.audit-review-embedded[open]{position:static;width:100%;max-width:none;max-height:none;margin:0;box-sizing:border-box;background:#fff;border:1px solid #dce4e9;border-radius:8px}
.audit-guided-actions{display:flex;flex-wrap:wrap;gap:8px;margin-top:12px}
.audit-guided-progress{font-weight:600}

.history-dialog[data-guided=scenario] :is(.history-analytics,.history-workflow){display:none}
.scenario-saved-trace{margin-top:16px}
.scenario-saved-trace .trace-tools{flex-wrap:wrap}
.scenario-saved-trace [data-trace-part=location]{flex-basis:100%;margin:0}
.scenario-saved-trace .trace-layout{display:block}
.scenario-saved-trace .trace-pan{min-height:240px;max-height:min(60vh,640px);overflow:auto;background:#f1f6f9}
.scenario-saved-trace [data-trace-part=graph] svg{display:block;max-width:none;margin:0 auto}
.scenario-saved-trace [data-trace-part=graph] .node .label{text-anchor:middle}
.scenario-saved-trace [data-trace-part=graph] .cluster rect{fill:#f1f6f9;stroke:#bdcfd9;rx:10px}
.scenario-saved-trace [data-trace-part=graph] .edgeLabel rect{fill:#fff;opacity:.95}
.scenario-saved-trace [data-trace-part=detail]:not(:empty){margin-top:8px}

.dependency-card-pan{overflow:auto}
.dependency-card-pan .scenario-map-levels{background:#f8fafb}
.dependency-card-more{margin:8px 16px}
.dependency-decision{border-inline-start:3px solid #c49b48;padding-inline-start:6px;color:#633c02}
.dependency-decision-branches{color:#633c02}
.scenario-saved-trace [data-trace-part=graph] :is(.edgePath path,.flowchart-link){fill:none;stroke:#397d91;stroke-width:2px}
.scenario-saved-trace [data-trace-part=graph] marker path{fill:#397d91}
.history-scenario-graph>button:first-child{float:right;margin-top:0}
.dependency-card-formula{font-family:var(--mono,monospace);color:#405763}
.scenario-map-cell :is(.dependency-decision,.dependency-decision-branches){display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:3;overflow:hidden}
.dependency-card-pan .scenario-map-levels{padding-inline:28px}
/* Keep the output in the viewport when a formula references many cells. */
.scenario-map-levels{width:100%}
.scenario-map-level{flex-wrap:wrap}
.scenario-map-cell{max-width:100%}
