:root {
  color-scheme: light;
  --ink: #192520;
  --muted: #63726b;
  --line: #d9e2dc;
  --paper: #f3f6f3;
  --panel: #fff;
  --green: #166f4a;
  --green-dark: #10553a;
  --green-pale: #e5f2ea;
  --red: #aa3831;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
.calculator-library { margin-top: 20px; }
main > * { min-width: 0; }
.setup-tab-panel, .structured-input-body, .structured-input-fields { min-width: 0; }
.library-toolbar { display: flex; align-items: end; flex-wrap: wrap; gap: 10px; }
.library-toolbar > label { display: grid; gap: 7px; min-width: min(340px, 100%); font-size: .85rem; font-weight: 650; }
.library-toolbar select { padding: 10px 12px; min-height: 42px; border: 1px solid var(--line); border-radius: 8px; color: var(--ink); background: white; font: inherit; }
.library-link { display: inline-block; padding: 10px 6px; color: var(--green-dark); font-size: .9rem; font-weight: 650; text-decoration: none; }
.library-link:hover { text-decoration: underline; }
.library-status { display: block; margin-top: 12px; color: var(--muted); font-size: .85rem; }
.current-model-heading { display: flex; align-items: center; gap: 12px; margin: 20px 0 12px; }
.current-model-heading h1 { margin: 0; font-size: 1.4rem; }
.model-mode-badge { border-radius: 20px; padding: 5px 10px; background: var(--green-pale); color: var(--green-dark); font-size: .75rem; font-weight: 650; }
.calculator-empty { padding: clamp(28px, 6vw, 70px); text-align: center; }
.calculator-empty h1 { font-size: clamp(1.6rem, 4vw, 2.3rem); margin: 10px 0; }
.calculator-empty p:not(.eyebrow) { color: var(--muted); }
.calculator-launcher { width: min(1200px, 100%); margin: 40px auto 24px; }
.launcher-heading { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: end; gap: 20px; }
.launcher-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.calculator-launcher .library-status { margin: 24px 0 0; }
.calculator-launcher .launcher-grid { grid-template-columns: repeat(auto-fill, minmax(min(100%, 265px), 1fr)); gap: 20px; margin-top: 20px; }
.calculator-app-card { position: relative; cursor: pointer; transition: transform .18s ease, box-shadow .18s ease; }
.app-uninstall { position: absolute; top: 14px; right: 14px; display: grid; place-items: center; width: 36px; height: 36px; padding: 7px; border: 0; color: #87918b; background: transparent; opacity: 0; transition: opacity .15s, color .15s; }
.app-uninstall svg, .uninstall-dialog-icon svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.calculator-app-card:hover .app-uninstall, .calculator-app-card:focus-within .app-uninstall { opacity: 1; }
button.app-uninstall:hover, button.app-uninstall:focus-visible { color: var(--red); background: #fff1f0; }
.uninstall-app-dialog { border-radius: 20px; padding: 28px; }
.uninstall-dialog-icon { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 14px; background: #fff1f0; color: var(--red); margin-bottom: 8px; }
.uninstall-app-dialog p { margin: 0; line-height: 1.6; overflow-wrap: anywhere; }
button.uninstall-confirm { color: white; background: var(--red); border-color: var(--red); }
button.uninstall-confirm:hover:not(:disabled) { color: white; background: #862c27; }
.app-loading { display: grid; justify-items: center; align-content: center; gap: 18px; min-height: 55vh; padding: 40px 20px; text-align: center; }
.app-loading h1 { margin: 0; font-size: 1.5rem; }
.app-loading p { margin: 0; color: var(--muted); }
.app-loading-spinner { width: 88px; height: 88px; border: 7px solid #dcebe2; border-top-color: var(--green); border-radius: 50%; animation: app-spin .85s linear infinite; }
@keyframes app-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .app-loading-spinner { animation-duration: 2s; } }
@media (hover: none) { .app-uninstall { opacity: 1; } }
.calculator-app-card:hover { transform: translateY(-3px); box-shadow: 0 10px 28px #223d2d12; }
.calculator-app-icon { display: grid; place-items: center; width: 68px; height: 68px; border-radius: 18px; margin-bottom: 22px; color: white; font-size: 1.35rem; font-weight: 750; letter-spacing: -.04em; background: linear-gradient(145deg, #49b983, #166f4a); box-shadow: inset 0 1px 1px #ffffff66, 0 5px 12px #166f4a24; }
.calculator-app-icon[data-tone="1"] { background: linear-gradient(145deg, #66a9e2, #3065a2); }
.calculator-app-icon[data-tone="2"] { background: linear-gradient(145deg, #c49be2, #8254ae); }
.calculator-app-icon[data-tone="3"] { background: linear-gradient(145deg, #ebbc68, #b97730); }
.calculator-app-icon[data-tone="4"] { background: linear-gradient(145deg, #eb9d96, #b95b69); }
.calculator-app-card .asset-description { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden; }
.calculator-app-card .asset-actions .primary { flex: 1; }
.calculator-app-card .asset-actions a.primary { padding:9px 14px; border:1px solid var(--green); border-radius:8px; background:var(--green); color:white; text-align:center; text-decoration:none; font-size:.84rem; font-weight:700; }
.calculator-app-card .asset-actions a.primary:hover { background:var(--green-dark); }
.calculator-return { margin-top: 14px; }
.calculator-return .library-link { padding-left: 0; }
.calculator-input-heading { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 20px; margin-bottom: 14px; }
.calculator-input-heading .current-model-heading { flex: 1 1 220px; min-width: 0; margin: 0; }
.calculator-input-heading h1 { overflow-wrap: anywhere; }
.calculator-input-heading .setup-tabs { flex: 0 1 auto; min-width: 0; margin: 0 0 0 auto; justify-content: flex-end; flex-wrap: wrap; }
.calculator-launcher > .empty-state { margin-top: 20px; }
@media (prefers-reduced-motion: reduce) { .calculator-app-card { transition: none; } .calculator-app-card:hover { transform: none; } }
@media (max-width: 480px) { .calculator-launcher { margin-top: 26px; } .launcher-actions { gap: 6px; } }
@media (max-width: 1000px) { .app-topbar { flex-wrap: wrap; } .app-section-toggle { order: 3; width: 100%; overflow-x: auto; } }
body { margin: 0; background: var(--paper); color: var(--ink); }
.app-topbar { position: sticky; top: 0; z-index: 1000; display: flex; align-items: center; justify-content: space-between; gap: 20px; width: 100%; padding: 12px clamp(18px, 3vw, 44px); border-bottom: 1px solid var(--line); background: #fff; box-shadow: 0 3px 12px #223d2d0b; }
.app-brand { color: var(--ink); font-size: 1.35rem; font-weight: 800; letter-spacing: -.025em; line-height: 1.2; text-decoration: none; }
.app-section-toggle { display: inline-flex; flex: 0 0 auto; gap: 4px; padding: 4px; border: 1px solid var(--line); border-radius: 11px; background: #eef2ee; }
.app-section-toggle a { padding: 9px 15px; border-radius: 8px; color: var(--muted); font-size: .9rem; font-weight: 650; text-decoration: none; white-space: nowrap; }
.app-section-toggle a:hover { color: var(--green-dark); }
.app-section-toggle a.active { background: var(--green); color: white; box-shadow: 0 1px 4px #152b1c17; }
.app-account { display: inline-flex; align-items: center; justify-content: flex-end; gap: 10px; flex: 0 0 auto; }
.app-account form { margin: 0; }
.account-profile { color: var(--muted); font-size: .84rem; font-weight: 650; white-space: nowrap; }
.account-link { color: var(--green-dark); font-size: .9rem; font-weight: 700; text-decoration: none; white-space: nowrap; }
.account-link:hover { text-decoration: underline; }
.account-button { padding: 7px 10px; font-size: .84rem; }
main { width: calc(100% - 36px); margin-inline: auto; }
.eyebrow { font-size: .72rem; letter-spacing: .12em; color: var(--green); font-weight: 750; margin: 0 0 6px; }
main { display: grid; gap: 16px; padding-bottom: 32px; }
.panel { border: 1px solid var(--line); border-radius: 14px; background: var(--panel); padding: 20px; box-shadow: 0 3px 14px #223d2d0b; }
.calculation-panel > .reports-panel { margin-top: 22px; padding-top: 22px; border-top: 1px solid var(--line); }
.calculation-panel > .output-panel { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); }
.update-results { display: inline-flex; align-items: center; justify-content: center; gap: 8px; white-space: nowrap; }
.update-results svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
button.primary.editor-run-model { display: inline-grid; place-items: center; flex: 0 0 40px; width: 40px; height: 40px; padding: 0; line-height: 1; }
.editor-run-model svg { display: block; width: 20px; height: 20px; fill: currentColor; }
.panel-title, .report-heading { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.panel-title h2, .report-heading h2 { margin: 0; font-size: 1.2rem; }
.report-heading { align-items: end; margin: 20px 0 14px; }
.report-heading p { color: var(--muted); margin: 5px 0 0; font-size: .9rem; }
.editor-content { display: grid; grid-template-columns: minmax(190px, .28fr) minmax(0, 1fr); gap: 18px; margin-top: 14px; align-items: start; }
.saved-model-bar { grid-column: 1 / -1; display: flex; align-items: end; flex-wrap: wrap; gap: 9px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: #f8faf8; }
.saved-model-bar label { display: grid; gap: 5px; min-width: 190px; color: var(--muted); font-size: .78rem; font-weight: 650; }
.central-model-public-links { display: inline-flex; flex: 0 0 auto; flex-wrap: wrap; align-items: center; gap: 7px; padding: 0 4px 9px; }
.central-model-public-links[hidden] { display: none; }
.central-model-public-links a { color: var(--green-dark); font-size: .82rem; font-weight: 700; text-decoration: none; }
.central-model-public-links a:hover { text-decoration: underline; }
.saved-model-bar select, .model-dialog input { min-height: 39px; border: 1px solid var(--line); border-radius: 7px; background: white; padding: 8px 10px; color: var(--ink); font: inherit; }
.saved-model-status { flex: 1 1 180px; min-height: 1em; padding: 0 4px 9px; color: var(--muted); font-size: .78rem; }
.domain-module-manager { display: grid; grid-template-columns: minmax(150px, 1fr) auto; align-items: end; gap: 8px 10px; margin-top: 13px; padding: 11px; border: 1px solid var(--line); border-radius: 10px; background: #f8faf8; }
.domain-module-manager > label { display: grid; gap: 5px; min-width: 0; color: var(--muted); font-size: .78rem; font-weight: 650; }
.domain-module-manager select { width: 100%; min-height: 39px; border: 1px solid var(--line); border-radius: 7px; background: white; padding: 8px 10px; color: var(--ink); font: inherit; }
.domain-module-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.domain-module-actions button { padding: 8px 10px; font-size: .8rem; }
.domain-module-manager .saved-model-status { grid-column: 1 / -1; padding: 0 2px; }
.domain-module-dialog { width: min(720px, calc(100% - 32px)); max-height: min(90vh, 900px); overflow: auto; }
.domain-module-dialog form { gap: 11px; }
.domain-module-dialog textarea { width: 100%; min-height: 280px; resize: vertical; border: 1px solid var(--line); border-radius: 8px; padding: 12px; color: var(--ink); background: #fbfcfb; font: 12px/1.5 ui-monospace, SFMono-Regular, Consolas, monospace; }
.model-dialog { width: min(420px, calc(100% - 32px)); border: 1px solid var(--line); border-radius: 14px; padding: 22px; color: var(--ink); box-shadow: 0 18px 70px #12271d35; }
.model-dialog::backdrop { background: #12271d75; backdrop-filter: blur(2px); }
.model-dialog form { display: grid; gap: 14px; }
.model-dialog h2 { margin: -8px 0 4px; font-size: 1.2rem; }
.model-dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
.model-dialog .error { margin: 0; font-size: .86rem; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
legend, .field-label { font-weight: 700; font-size: .92rem; }
.module-options { display: grid; grid-template-columns: 1fr; gap: 8px; margin-top: 14px; }
.unresolved-module-actions:not([hidden]) { display: grid; gap: 8px; margin-top: 10px; padding: 10px; border: 1px solid #e2c7b1; border-radius: 9px; background: #fffaf5; }
.unresolved-module-actions > .hint, .unresolved-module-item .hint { margin: 0; }
.unresolved-module-item { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; font-size: .82rem; }
.module-panel h2 { margin: 0; font-size: 1.1rem; }
.module-choice { display: flex; align-items: flex-start; gap: 10px; border: 1px solid var(--line); padding: 11px; border-radius: 9px; cursor: pointer; }
.module-choice:has(input:checked) { border-color: #78ad8d; background: var(--green-pale); }
.module-choice input { margin: 3px 0 0; accent-color: var(--green); }
.module-choice span { display: grid; gap: 3px; }
.module-choice small { color: var(--muted); font-size: .76rem; }
.inputs-fieldset { min-width: 0; }
.input-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-top: 10px; }
.structured-input-editor { grid-column: 1 / -1; min-width: 0; padding: 14px; border: 1px solid #cad9ce; border-radius: 11px; background: #fbfdfb; }
.structured-input-editor > legend { padding: 0 6px; }
.structured-input-body, .structured-input-fields { display: grid; gap: 12px; }
.input-card-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 330px), 1fr)); gap: 11px; }
.input-card { min-width: 0; padding: 13px; border: 1px solid var(--line); border-radius: 10px; background: white; }
.input-card-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 11px; }
.input-card-header h3 { min-width: 0; margin: 0; overflow-wrap: anywhere; font-size: .96rem; }
.input-card-remove { flex: 0 0 auto; padding: 6px 9px; border-color: #ead4d2; color: var(--red); font-size: .78rem; }
.input-card-add { justify-self: start; margin-top: 11px; border-color: #b8d0c0; color: var(--green-dark); }
.structured-nested-object, .structured-nested-collection { min-width: 0; padding: 11px; border: 1px solid #e0e9e3; border-radius: 9px; }
.structured-nested-object > legend, .structured-nested-collection > legend { padding: 0 5px; color: var(--muted); font-size: .8rem; }
.structured-field { min-width: 0; }
.structured-field input:not([type="hidden"]) { width: min(260px, 100%); min-height: 42px; border: 1px solid var(--line); border-radius: 8px; background: white; padding: 10px 12px; font: inherit; }
.structured-field-id { display: none; }
.setup-tabs { width: fit-content; margin: 12px 0 4px; }
.setup-tab-panel[hidden], .run-option-fields[hidden] { display: none; }
.scenario-result-picker { width: fit-content; margin: 12px 0; }
.scenario-result-picker[hidden] { display: none; }
.scenario-heading { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin: 14px 0 10px; }
.scenario-heading h2 { margin: 0; font-size: 1.08rem; }
.scenario-heading .hint { margin-top: 4px; }
.scenario-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 390px), 1fr)); gap: 12px; }
.scenario-grid > .empty { grid-column: 1 / -1; }
.scenario-card { min-width: 0; padding: 15px; border: 1px solid #cad9ce; border-radius: 12px; background: linear-gradient(145deg, #fff, #f8fbf8); box-shadow: 0 3px 12px #223d2d0b; }
.scenario-card-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.scenario-card-header h3 { margin: 0; overflow-wrap: anywhere; font-size: 1rem; }
.scenario-card-header p { margin: 4px 0 0; }
.scenario-delete { display: grid; flex: 0 0 auto; place-items: center; width: 36px; height: 36px; padding: 7px; border-color: #ead4d2; color: var(--red); }
.scenario-delete:hover:not(:disabled) { border-color: var(--red); background: #fff5f4; color: #861b21; }
.scenario-delete svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.scenario-fields { margin-top: 14px; }
.scenario-dialog { width: min(560px, calc(100% - 32px)); max-height: min(88vh, 760px); overflow: auto; }
.scenario-dialog form { gap: 12px; }
.scenario-input-picker { padding: 11px; border: 1px solid var(--line); border-radius: 9px; }
.scenario-input-picker legend { padding: 0 6px; }
.scenario-input-picker .hint { margin: -2px 0 9px; }
.scenario-input-options { display: grid; gap: 6px; max-height: 300px; overflow-y: auto; }
.scenario-input-option { display: flex; align-items: flex-start; gap: 9px; padding: 9px 10px; border: 1px solid transparent; border-radius: 8px; cursor: pointer; }
.scenario-input-option:hover { border-color: var(--line); background: #f7faf7; }
.scenario-input-option input { width: 16px; height: 16px; min-height: 16px; margin: 3px 0 0; padding: 0; border: 0; border-radius: 3px; background: transparent; accent-color: var(--green); }
.scenario-input-option span { display: grid; gap: 3px; }
.scenario-input-option strong { font-size: .86rem; }
.scenario-input-option small { color: var(--muted); font-size: .74rem; }
.run-option-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; grid-column: 1 / -1; }
.run-option-fields .hint { grid-column: 1 / -1; }
.run-option-fields input { width: min(260px, 100%); min-height: 42px; border: 1px solid var(--line); border-radius: 8px; background: white; padding: 10px 12px; font: inherit; }
.monte-carlo-table { min-width: 1080px; }
.curve-editor { grid-column: 1 / -1; min-width: 0; border: 1px solid var(--line); border-radius: 10px; background: #fbfcfb; padding: 13px 15px 15px; }
.curve-editor legend { padding: 0 7px; color: var(--ink); font-size: .95rem; font-weight: 750; }
.curve-meta { margin: -2px 0 12px; }
.curve-interpolation { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; color: var(--muted); font-size: .82rem; }
.curve-interpolation select { min-height: 36px; border: 1px solid var(--line); border-radius: 7px; background: white; padding: 6px 9px; font: inherit; }
.curve-point-headings, .curve-point-row { display: grid; grid-template-columns: minmax(150px, .9fr) minmax(150px, 1fr) 42px; align-items: center; gap: 10px; }
.curve-point-headings { margin-bottom: 6px; color: var(--muted); font-size: .72rem; font-weight: 650; letter-spacing: .04em; text-transform: uppercase; }
.curve-point-list { display: grid; gap: 8px; }
.curve-point-row input { width: 100%; min-width: 0; min-height: 40px; border: 1px solid var(--line); border-radius: 7px; background: white; padding: 8px 10px; font: inherit; }
.curve-remove-point { width: 40px; height: 40px; padding: 0; color: var(--red); font-size: 1.25rem; line-height: 1; }
.curve-add-point { margin-top: 10px; border-style: dashed; color: var(--green-dark); font-size: .84rem; font-weight: 650; }
.run-controls { display: flex; align-items: center; gap: 16px; margin-top: 16px; }
.run-controls .status { margin: 0; }
.field-label { display: grid; align-content: start; gap: 7px; min-width: 0; font-weight: 650; }
.input-meta { color: var(--muted); font-size: .74rem; font-weight: 400; }
.input-control-wrap { display: flex; align-items: center; width: min(260px, 100%); min-height: 42px; border: 1px solid var(--line); border-radius: 8px; padding-right: 12px; }
.input-control-wrap input { width: 100%; min-width: 0; border: 0; background: transparent; padding: 10px 12px; font: inherit; outline: none; }
.input-control-wrap span { color: var(--muted); }
.field-label select { width: min(260px, 100%); min-height: 42px; border: 1px solid var(--line); border-radius: 8px; background: white; padding: 10px 12px; font: inherit; }
.field-label input[type="file"] { width: min(360px, 100%); min-height: 42px; border: 1px solid var(--line); border-radius: 8px; background: white; padding: 7px; font: inherit; }
.field-label textarea { width: 100%; min-height: 104px; resize: vertical; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; font: 12px/1.5 ui-monospace, SFMono-Regular, Consolas, monospace; }
.hint, .muted { color: var(--muted); font-size: .84rem; line-height: 1.45; }
.hint { margin: 8px 0 0; font-weight: 400; }
.status { min-height: 1.4em; margin: 18px 0 0; color: var(--muted); font-size: .88rem; }
.error { color: var(--red); }
.run-error { margin: 16px 0; padding: 20px 22px; border: 2px solid #861b21; border-radius: 12px; background: #b4232a; color: white; font-size: 1.05rem; font-weight: 750; line-height: 1.45; box-shadow: 0 4px 16px #8f141d35; }
button, select { color: inherit; font: inherit; }
button { border: 1px solid var(--line); background: white; border-radius: 8px; padding: 9px 13px; cursor: pointer; }
button:hover:not(:disabled) { border-color: var(--green); color: var(--green-dark); }
button:disabled { opacity: .45; cursor: not-allowed; }
button.primary { background: var(--green); color: white; border-color: var(--green); padding: 11px 17px; font-weight: 700; }
button.primary:hover:not(:disabled) { background: var(--green-dark); color: white; }
.sign-in-action { display:inline-block; padding:10px 17px; border-radius:8px; background:var(--green); color:white; text-decoration:none; font-weight:700; }
.sign-in-action:hover { background:var(--green-dark); }
details summary { cursor: pointer; font-weight: 700; }
.editor-summary { display: flex; align-items: center; justify-content: space-between; gap: 14px; list-style: none; }
.editor-summary::-webkit-details-marker { display: none; }
.editor-summary::before { content: "▸"; color: var(--green); }
.editor-panel[open] .editor-summary::before { content: "▾"; }
.example-picker { display: flex; align-items: center; gap: 8px; margin-left: auto; padding-left: 16px; border-left: 1px solid var(--line); color: var(--muted); font-size: .82rem; font-weight: 550; }
.example-picker[hidden] { display: none; }
.example-picker select { max-width: min(240px, 45vw); border: 1px solid var(--line); border-radius: 7px; background: white; padding: 7px 9px; color: var(--ink); font: inherit; }
.example-picker a { color: var(--green-dark); font-size: .82rem; font-weight: 650; white-space: nowrap; }
.code-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.code-toolbar .hint { margin: 6px 0; }
.code-view-actions { display: flex; align-items: center; gap: 8px; }
.view-toggle { display: flex; gap: 4px; padding: 4px; border-radius: 9px; background: #eef2ee; }
.view-toggle button { border: 0; background: transparent; padding: 7px 11px; color: var(--muted); font-size: .82rem; }
.view-toggle button.active { background: white; color: var(--green-dark); font-weight: 700; box-shadow: 0 1px 4px #152b1c17; }
.generated-code-unlock { display: inline-flex; align-items: center; gap: 7px; padding: 7px 10px; color: var(--green-dark); font-size: .82rem; font-weight: 650; white-space: nowrap; }
.generated-code-unlock svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.generated-code-status, .blockly-error { margin: 8px 0; padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px; background: #f7faf7; color: var(--muted); font-size: .82rem; line-height: 1.4; }
.blockly-error { border-color: #e8c9c6; background: #fff7f6; color: var(--red); }
.visual-view[hidden], #code-view[hidden], #structure-view[hidden] { display: none; }
.view-toggle[hidden] { display:none; }
.blockly-container { position: relative; width: 100%; height: 600px; min-height: 600px; margin-top: 8px; overflow: hidden; border: 1px solid var(--line); border-radius: 9px; background: #fbfcfb; }
.editor-shell { position: relative; min-height: 600px; margin-top: 8px; overflow: hidden; border: 1px solid var(--line); border-radius: 9px; background: #fbfcfb; }
.editor-shell .syntax-highlight, .editor-shell textarea { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; padding: 14px; border: 0; border-radius: 0; background: transparent; font: 13px/1.55 ui-monospace, SFMono-Regular, Consolas, monospace; tab-size: 2; white-space: pre; overflow: auto; }
.editor-shell .syntax-highlight { position: relative; min-height:600px; height:auto; pointer-events: none; color: #24332b; overflow-x:auto; overflow-y:hidden; }
.editor-shell .syntax-highlight code { font: inherit; }
.editor-shell textarea { z-index: 1; min-height:600px; resize:none; overflow-x:auto; overflow-y:hidden; color: transparent; -webkit-text-fill-color: transparent; caret-color: #24332b; outline: none; }
.editor-shell textarea::selection { background: #86b9db75; -webkit-text-fill-color: transparent; }
.editor-file-toolbar { display:flex; align-items:center; gap:10px; margin-bottom:10px; padding:6px; border:1px solid var(--line); border-radius:10px; background:#edf2ee; }
.editor-files { display:flex; flex:1; min-width:0; flex-wrap:wrap; gap:6px; }
.editor-file-tab { display:flex; align-items:center; border:1px solid transparent; border-radius:7px; color:var(--muted); }
.editor-file-tab.active { border-color:#b5cebb; background:white; color:var(--green-dark); box-shadow:0 1px 3px #1e40230d; }
.editor-file-tab > button { border:0; background:transparent; padding:8px 10px; font-size:.8rem; font-weight:600; }
.editor-file-actions { display:flex; gap:2px; padding:3px 5px 3px 0; }
.editor-file-actions button { display:grid; place-items:center; width:28px; height:28px; padding:5px; border:0; background:transparent; color:inherit; }
.editor-file-actions button:hover:not(:disabled) { background:#dde9e1; }
.editor-file-actions button[aria-label^="Delete"]:hover:not(:disabled) { background:#ffeded; color:var(--red); }
.editor-file-actions svg { width:17px; height:17px; fill:none; stroke:currentColor; stroke-width:1.6; stroke-linecap:round; stroke-linejoin:round; }
#new-domain-module { margin:0 0 12px; }
.tok-keyword { color: #7842a3; font-weight: 650; }
.tok-string { color: #15703c; }
.tok-number { color: #bd5c18; }
.tok-comment { color: #87918b; font-style: italic; }
.tok-property { color: #174f90; }
.tok-api-token { color: #087267; font-weight: 600; }
.tok-identifier { color: #283b32; }
.tok-punctuation { color: #6e7b73; }
.editor-help { margin-top: 7px; }
.structure-view { margin-top: 8px; min-height: 600px; overflow: auto; border: 1px solid var(--line); border-radius: 9px; background: #fbfcfb; }
.structure-view[hidden] { display: none; }
.structure-view svg { display: block; min-width: 760px; width: 100%; height: auto; }
.structure-column-label { fill: #66766e; font: 700 10px Inter, ui-sans-serif, sans-serif; letter-spacing: 1px; }
.structure-edge { fill: none; stroke-width: 1.8; opacity: .9; }
.structure-edge-ownership { stroke: #4f67a7; }
.structure-edge-transaction { stroke: #bd5b29; stroke-width: 2.1; }
.structure-edge-agreement { stroke: #89958e; stroke-dasharray: 5 4; }
.structure-node rect { stroke: #cdd8d0; stroke-width: 1; }
.structure-node { cursor: pointer; outline: none; }
.structure-node:hover rect, .structure-node:focus rect { stroke: #52645a; stroke-width: 2; }
.structure-node.is-selected rect { fill: #fff; stroke: #101c15; stroke-width: 3; }
.structure-node-title { fill: #1c2b23; font: 600 10px ui-monospace, SFMono-Regular, Consolas, monospace; }
.structure-node-detail { fill: #66766e; font: 9px Inter, ui-sans-serif, sans-serif; }
.structure-edge.is-dimmed { stroke: #aeb9b2; stroke-width: .8; opacity: .08; }
.structure-edge.is-highlighted { stroke: #111c15; stroke-width: 3.2; opacity: 1; marker-end: url(#structure-arrow-highlight); }
.structure-help { margin: 8px 12px 0; }
.structure-legend { display: flex; flex-wrap: wrap; gap: 16px; padding: 8px 12px 12px; color: var(--muted); font-size: .8rem; }
.structure-legend span { display: inline-flex; align-items: center; gap: 7px; }
.legend-edge { display: inline-block; width: 23px; height: 0; border-top: 2px solid; }
.legend-edge.ownership { border-color: #4f67a7; }
.legend-edge.transaction { border-color: #bd5b29; border-top-width: 3px; }
.legend-edge.agreement { border-color: #89958e; border-top-style: dashed; }
.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 9px; margin: 14px 0 18px; }
.metric-card { display: grid; gap: 6px; min-width: 0; padding: 12px 14px; border: 1px solid var(--line); border-radius: 9px; background: #fbfcfb; }
.metric-card span { overflow: hidden; color: var(--muted); font-size: .72rem; text-overflow: ellipsis; text-transform: capitalize; white-space: nowrap; }
.metric-card strong { overflow-wrap: anywhere; font-size: 1rem; font-variant-numeric: tabular-nums; }
.model-output-name { margin: 0 0 6px; color: var(--muted); font: 600 .82rem ui-monospace, SFMono-Regular, Consolas, monospace; overflow-wrap: anywhere; }
.model-output-chart { display: block; width: 100%; min-width: 620px; height: auto; margin: 4px 0 14px; }
.chart-toggle-heading, .chart-toggle-cell { width: 58px; min-width: 58px; text-align: center !important; }
.chart-toggle-cell label { display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.chart-toggle-cell input { width: 16px; height: 16px; margin: 0; accent-color: var(--green); cursor: pointer; }
.report-table-chart { margin: 12px 0 16px; overflow-x: auto; border: 1px solid var(--line); border-radius: 9px; background: #fbfcfb; padding: 12px 14px 10px; }
.report-chart { display: block; width: 100%; min-width: 620px; height: auto; }
.report-chart-grid { stroke: #e2e9e4; stroke-width: 1; stroke-dasharray: 3 4; }
.report-chart-axis { fill: #63726b; font: 11px Inter, ui-sans-serif, sans-serif; }
.report-chart-line { fill: none; stroke: var(--series-color); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.report-chart-point { fill: white; stroke: var(--series-color); stroke-width: 1.8; }
.report-chart-legend { display: flex; flex-wrap: wrap; justify-content: center; gap: 9px 17px; padding-top: 4px; color: var(--muted); font-size: .78rem; }
.report-chart-legend span { display: inline-flex; align-items: center; gap: 6px; }
.report-chart-swatch { display: inline-block; width: 18px; height: 3px; border-radius: 3px; background: var(--series-color); }
.report-chart-color-0 { --series-color: #176f4a; }
.report-chart-color-1 { --series-color: #ba5c27; }
.report-chart-color-2 { --series-color: #4167a8; }
.report-chart-color-3 { --series-color: #9b4f88; }
.report-chart-color-4 { --series-color: #88711b; }
.report-chart-color-5 { --series-color: #187b83; }
.report-chart-color-6 { --series-color: #b23e4b; }
.report-chart-color-7 { --series-color: #6e5b9f; }
.report-chart-empty { margin: 10px 0; }
.model-output-grid { stroke: #e2e9e4; stroke-width: 1; stroke-dasharray: 3 4; }
.model-output-line { fill: none; stroke: #176f4a; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.model-output-point { fill: white; stroke: #176f4a; stroke-width: 1.8; }
.model-output-axis { fill: #63726b; font: 11px Inter, ui-sans-serif, sans-serif; }
.model-output-table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 8px; }
.model-output-table th { position: sticky; top: 0; background: #f4f7f4; }
.focused-output-heading { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin: 14px 0 20px; }
.focused-output-heading h2 { margin: 0; font-size: 1.2rem; }
.focused-output-account-id { margin: 2px 0 0; color: #87938d; font-size: .68rem; }
.focused-output-heading p:last-child { margin: 5px 0 0; color: var(--muted); font-size: .9rem; }
.focused-series { margin: 18px 0 24px; }
.tabs { display: flex; flex-wrap: wrap; gap: 6px; padding: 5px; border-radius: 10px; background: #eef2ee; }
.tabs .tab { border: 0; background: transparent; color: var(--muted); padding: 9px 12px; }
.tabs .tab.active { background: white; color: var(--green-dark); box-shadow: 0 1px 4px #152b1c17; font-weight: 700; }
.report-controls, .step-controls { display: flex; align-items: center; gap: 10px; }
.range-label { color: var(--muted); font-size: .82rem; font-variant-numeric: tabular-nums; }
.inline-control { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: .82rem; white-space: nowrap; }
.inline-control select { border: 1px solid var(--line); border-radius: 7px; background: white; padding: 7px 9px; }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th, td { padding: 10px 9px; text-align: left; border-bottom: 1px solid #e7ece8; }
thead th { color: var(--muted); font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; }
tbody td { font-size: .9rem; }
tfoot th { font-size: .9rem; padding-top: 12px; }
.num { text-align: right; white-space: nowrap; }
.section th { background: #f4f7f4; color: var(--green-dark); }
.category-summary th { border-top: 1px solid var(--border); background: #f7f8f6; font-weight: 700; }
.empty { color: var(--muted); text-align: center; padding: 24px; }
.liquidity-chart { display: block; width: 100%; height: auto; margin: 8px 0 2px; overflow: visible; }
.liquidity-zero-line { stroke: #9aa89f; stroke-width: 1; }
.liquidity-grid-line { stroke: #e2e9e4; stroke-width: 1; stroke-dasharray: 3 4; }
.liquidity-bar.positive { fill: #78ad8d; }
.liquidity-bar.negative { fill: #d78377; }
.liquidity-balance-line { fill: none; stroke: #176f4a; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.liquidity-point { fill: white; stroke: #176f4a; stroke-width: 2; }
.liquidity-axis-label { fill: #63726b; font: 11px Inter, ui-sans-serif, sans-serif; }
.liquidity-legend { display: flex; justify-content: center; gap: 22px; color: var(--muted); font-size: .8rem; }
.liquidity-legend span { display: inline-flex; align-items: center; gap: 7px; }
.legend-balance { width: 18px; height: 3px; background: #176f4a; }
.legend-flow { width: 10px; height: 10px; border-radius: 2px; background: #78ad8d; }
.step-controls button { width: 40px; height: 38px; font-size: 1.15rem; }
.output-panel pre { max-height: 480px; overflow: auto; padding: 14px; border-radius: 9px; background: #15221a; color: #deefe4; font: 12px/1.5 ui-monospace, SFMono-Regular, Consolas, monospace; }

@media (max-width: 720px) {
  main { width: calc(100% - 24px); }
  .app-topbar { align-items: stretch; flex-direction: column; gap: 10px; padding: 11px 12px; }
  .app-brand { font-size: 1.15rem; }
  .app-section-toggle { align-self: flex-start; }
  .app-account { align-self: flex-start; }
  .panel { padding: 15px; }
  .editor-content { grid-template-columns: 1fr; }
  .saved-model-bar { align-items: stretch; }
  .saved-model-bar label { flex: 1 1 100%; }
  .saved-model-status { flex-basis: 100%; padding: 0; }
  .domain-module-manager { grid-template-columns: 1fr; align-items: stretch; }
  .domain-module-manager .saved-model-status { grid-column: auto; }
  .panel-title, .report-heading { align-items: flex-start; flex-direction: column; }
  .scenario-heading { align-items: flex-start; flex-direction: column; }
  .report-controls { flex-wrap: wrap; }
  .tabs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tabs .tab { padding-inline: 7px; }
  table { min-width: 480px; }
  .reports-panel { overflow-x: auto; }
  .structure-view, .blockly-container { height: 600px; min-height: 600px; }
  .code-toolbar { align-items: flex-start; flex-direction: column; }
  .code-view-actions { width: 100%; flex-wrap: wrap; }
  .liquidity-legend { gap: 12px; flex-wrap: wrap; }
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .focused-output-heading { align-items: flex-start; flex-direction: column; }
  .curve-point-headings, .curve-point-row { grid-template-columns: minmax(112px, 1fr) minmax(100px, 1fr) 36px; gap: 7px; }
  .curve-remove-point { width: 36px; }
}

@media (max-width: 420px) {
  .metric-grid { grid-template-columns: 1fr; }
}
.input-heading-actions { display:flex; align-items:center; gap:14px; margin-left:auto; flex-wrap:wrap; }
.case-actions { display:flex; align-items:center; gap:2px; border:1px solid #dce5df; padding:3px; border-radius:12px; background:#f6f9f6; }
.case-actions button { display:grid; place-items:center; width:36px; height:36px; padding:7px; border:0; border-radius:8px; background:transparent; }
.case-actions button:hover:enabled { background:#dfeee3; }
.case-actions button:disabled { opacity:.35; cursor:default; }
.case-actions svg,.case-delete svg { width:21px; height:21px; fill:none; stroke:currentColor; stroke-width:1.7; stroke-linecap:round; stroke-linejoin:round; }
.case-status { color:#65766a; font-size:.8rem; margin:0 0 12px; }
dialog.case-list-dialog { width:min(950px, calc(100vw - 40px)); max-width:950px; padding:28px; border-radius:20px; }
#case-filter { width:100%; margin:10px 0 20px; }
.case-table-scroll { max-height:55vh; overflow:auto; }
.case-table { width:100%; border-collapse:collapse; text-align:left; font-size:.88rem; }
.case-table td,.case-table th { padding:12px; border-bottom:1px solid #e3eae5; }
.case-table th { position:sticky; top:0; background:#f5f8f5; }
.case-table th button { padding:0; border:0; background:none; font-weight:600; text-align:left; white-space:nowrap; }
.case-table th[aria-sort=ascending] button::after { content:' ↑'; }
.case-table th[aria-sort=descending] button::after { content:' ↓'; }
.case-row-actions { white-space:nowrap; }
.case-row-actions button { padding:6px 9px; margin-right:4px; }
.case-delete { color:#78857c; vertical-align:middle; }
.case-delete:hover { color:#ce3838; background:#fff0f0; }
.asset-card.calculator-app-card.own-app { background:#edf4fa; border-color:#d6e3ee; }
.calculator-preview-heading { margin:8px 4px -8px; color:#53685b; font-size:1rem; font-weight:650; }
.report-chart,.model-output-chart,.liquidity-chart { max-height:170px; }
#reports .report-chart-axis,#reports .model-output-axis,#reports .liquidity-axis-label { font-size:12px; }
#reports .report-chart-legend,#reports .liquidity-legend { font-size:15px; gap:6px 12px; }
.report-chart-container { padding:7px 10px 5px; }
.file-picker { display:grid; grid-template-columns:30px 1fr; align-items:center; gap:7px 10px; min-height:100px; padding:12px 14px; border:1.5px dashed #b7cbbf; border-radius:12px; background:#f8fbf9; transition:background .15s,border-color .15s; }
.file-picker.is-dragging { background:#e2f1e7; border-color:#166f4a; box-shadow:0 0 0 3px #166f4a18; }
.file-picker:focus-within { border-color:#166f4a; }
.file-picker-icon { grid-row:1 / 3; color:#59836a; }
.file-picker-icon svg { width:26px; height:26px; fill:none; stroke:currentColor; stroke-width:1.7; stroke-linecap:round; stroke-linejoin:round; }
.file-picker button.file-upload-button { justify-self:start; padding:6px 11px; border:1px solid #bfd3c5; border-radius:7px; background:white; color:#10553a; font-size:.8rem; font-weight:650; }
.file-drop-hint { color:#7a8a80; font-size:.7rem; }
.file-picker-name { grid-column:1 / -1; color:#4a6052; font-size:.76rem; overflow-wrap:anywhere; }
.file-picker-error { grid-column:1 / -1; color:#aa3831; font-size:.76rem; }
