:root {
  color-scheme: light;
  --canvas: #fff;
  --sidebar: #f4f4f4;
  --surface: #fff;
  --soft: #f7f7f7;
  --hover: #ededed;
  --border: #d5d5d5;
  --text: #191919;
  --muted: #535353;
  --accent: #252525;
  --accent-hover: #070707;
  --on-accent: #fff;
  --selected: #e7e7e7;
  --warning: #373737;
  --warning-bg: #ededed;
  --danger: #141414;
  --danger-bg: #e3e3e3;
  --focus: #383838;
  --shadow: 0 8px 30px #0002;
  --nav-width: 220px;
  --header-height: 46px;
  --gutter: clamp(22px, 3.5vw, 54px);
  --radius: 5px;
  font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--canvas); color: var(--text); }
:is(button, input, select, textarea) { color: inherit; font: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
main:focus { outline: none; }
a { color: var(--accent); text-underline-offset: .18em; }
h1, h2, h3, p, dl, dd { margin: 0; }
h1 { font-size: clamp(2rem, 1.5rem + 1.25vw, 3rem); line-height: 1.08; letter-spacing: -.042em; font-weight: 700; }
h2 { font-size: 1.21rem; line-height: 1.32; letter-spacing: -.018em; font-weight: 680; }
h3 { font-size: 1.08rem; line-height: 1.4; font-weight: 650; }
p + p { margin-top: .65em; }
small { font-size: .86em; }
.muted, .subtitle, .inline-note { color: var(--muted); }
.inline-note { font-size: .92rem; overflow-wrap: anywhere; }
.icon { width: 19px; height: 19px; flex: none; vertical-align: middle; }
button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 38px;
  padding: 7px 12px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface);
  font-weight: 600;
  line-height: 1.25;
  text-align: center;
  cursor: pointer;
}
button:hover:not(:disabled) { background: var(--soft); border-color: var(--muted); }
button:disabled { color: var(--muted); background: var(--soft); cursor: default; opacity: .68; }
button.primary:not(:disabled) { color: var(--on-accent); background: var(--accent); border-color: var(--accent); }
button.primary:hover:not(:disabled) { background: var(--accent-hover); border-color: var(--accent-hover); }
button.small { min-height: 32px; font-size: .9rem; }
button.quiet, button.icon-button { border-color: transparent; background: transparent; }
button.icon-button { width: 36px; min-height: 36px; padding: 0; }
button.icon-button:hover:not(:disabled) { background: var(--hover); border-color: transparent; }
.skip-link { position: fixed; z-index: 25; top: 8px; left: 8px; padding: 10px; background: var(--surface); transform: translateY(-150%); }
.skip-link:focus { transform: none; }
.screen-reader { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.sidebar {
  display: flex;
  flex-direction: column;
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--nav-width);
  border-right: 1px solid var(--border);
  background: var(--sidebar);
  z-index: 8;
}
.sidebar-top { display: flex; align-items: center; justify-content: space-between; min-height: var(--header-height); padding: 0 12px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); font-size: 19px; font-weight: 750; letter-spacing: -.035em; text-decoration: none; }
.brand-symbol { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 7px; background: var(--accent); color: var(--on-accent); font-size: 19px; line-height: 1; font-weight: 650; }
.project-link { display: inline-flex; align-items: center; min-height: 44px; margin-inline-start: auto; padding-inline-start: 4px; color: var(--muted); font-size: .86rem; white-space: nowrap; }
button.nav-toggle { display: none; }
.sidebar nav { display: flex; flex-direction: column; gap: 2px; padding: 14px 12px 16px; overflow: auto; flex: 1; }
.nav-group { display: grid; gap: 3px; }
.nav-group + .nav-group { border-top: 1px solid var(--border); margin-top: 15px; padding-top: 15px; }
.nav-group:last-child { margin-top: auto; }
.nav-group a { display: flex; gap: 10px; align-items: center; min-height: 42px; border-radius: 7px; padding: 7px 10px; color: var(--muted); text-decoration: none; line-height: 1.25; }
.nav-group a:hover { background: var(--hover); color: var(--text); }
.nav-group a[aria-current="page"] { background: var(--selected); color: var(--accent); font-weight: 680; }
.shell { margin-left: var(--nav-width); min-width: 0; }
.app-header {
  position: sticky;
  top: 0;
  z-index: 7;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: var(--header-height);
  padding: 5px var(--gutter);
  gap: 10px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
#breadcrumb { display: flex; min-width: 0; align-items: baseline; gap: 8px; color: var(--muted); }
#breadcrumb a { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); text-decoration: none; font-weight: 650; }
#breadcrumb a:hover { text-decoration: underline; }
#breadcrumb span:last-child { white-space: nowrap; }
.app-header > .actions { flex: none; }
.app-header button { min-height: 32px; padding-block: 4px; }
#save-state { font-size: .86rem; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; min-width: 0; }
main { width: 100%; max-width: 1540px; margin: 0 auto; padding: 32px var(--gutter) 58px; }
.page-heading { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px 22px; margin-bottom: 24px; min-height: 48px; }
.page-heading h1 { min-width: 0; overflow-wrap: anywhere; }
.page-heading .actions:empty { display: none; }
#activity, #message { margin: 12px var(--gutter) 0; }
#activity, #message, .notice { padding: 10px 13px; border-radius: 7px; }
#activity, #message { background: var(--selected); color: var(--accent); }
#message.error, .notice.error { background: var(--danger-bg); color: var(--danger); }
.notice { display: flex; align-items: baseline; gap: 8px; margin: 0 0 14px; background: var(--warning-bg); color: var(--warning); }
.notice.blue { background: var(--selected); color: var(--accent); }
.notice .symbol { flex: none; }
.section-note { margin: -8px 0 16px; color: var(--muted); font-size: .93rem; }

.help { display: inline; }
button.help-trigger.icon-button {
  display: inline-flex;
  width: 30px;
  min-height: 30px;
  vertical-align: middle;
  margin: -4px 0 -4px 3px;
  color: var(--muted);
}
.help-trigger .icon { width: 16px; height: 16px; }
.help-trigger[aria-expanded="true"] { background: var(--hover); color: var(--accent); }
.help-content {
  position: fixed;
  z-index: 20;
  display: grid;
  gap: 8px;
  width: max-content;
  max-width: min(380px, calc(100vw - 24px));
  max-height: min(280px, 65vh);
  overflow: auto;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
  color: var(--text);
  font: 400 .95rem/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: normal;
  text-align: left;
  white-space: normal;
  overflow-wrap: anywhere;
}

.grid-2 { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.grid-2.equal { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.card {
  min-width: 0;
  margin: 0 0 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}
.card-head { padding: 17px 20px; border-bottom: 1px solid var(--border); }
.card-head:only-child { border-bottom: 0; }
.card-body { padding: 17px 20px; min-width: 0; }
.card-body.compact { padding-block: 12px; }
.card-body > :is(p, .form-grid, .actions, details, label) + :is(p, .form-grid, .actions, details, label, button, .notice) { margin-top: 13px; }
.card > .table-scroll:first-child { border-radius: inherit; }
.card > details { margin: 12px 20px; }
.results-stack { min-width: 0; }
.empty { padding: 19px 20px; color: var(--muted); }
.empty strong { display: block; color: var(--text); }
.missing-list { margin: 0; padding-left: 1.3em; color: var(--muted); }
.missing-list li { margin: .25em 0; }

.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 0 0 18px; }
.metric { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 15px; min-width: 0; }
.card .metrics { padding: 0 20px; }
.metric .label { color: var(--muted); font-weight: 600; }
.metric .value { display: flex; align-items: baseline; flex-wrap: wrap; gap: 0 6px; font-weight: 650; font-size: clamp(1.28rem, 1rem + 1vw, 2.1rem); line-height: 1.25; margin-top: 8px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; letter-spacing: -.035em; }
.metric .unit { color: var(--muted); font-size: .84rem; font-weight: 500; letter-spacing: normal; }
.comparison-metrics .value { font-size: 1.28rem !important; }
.badge { display: inline-block; border-radius: 5px; background: var(--soft); color: var(--muted); font-size: .86rem; font-weight: 600; padding: 3px 7px; line-height: 1.35; overflow-wrap: anywhere; }
.badge.pass, .badge.info { background: var(--selected); color: var(--accent); }
.badge.warn { background: var(--warning-bg); color: var(--warning); }
.badge.fail { background: var(--danger-bg); color: var(--danger); }
.bar { width: 84px; height: 4px; margin-top: 6px; border-radius: 4px; background: var(--hover); overflow: hidden; }
.bar span { display: block; height: 100%; background: var(--accent); }
.bar .over { background: var(--danger); }

.table-scroll { overflow-x: auto; max-width: 100%; }
table { width: 100%; border-collapse: collapse; text-align: left; font-size: .92rem; }
th, td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-weight: 680; background: var(--soft); }
:is(th, td):first-child { padding-left: 20px; }
:is(th, td):last-child { padding-right: 20px; }
tbody tr:last-child td { border-bottom: 0; }
.table-scroll td small { display: block; margin-top: 2px; color: var(--muted); }
.number { text-align: right; font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
.changed td, .total-row td { background: var(--selected); }
.changed td:nth-child(3), .change-label, .positive { color: var(--accent); font-weight: 600; }
.negative, .experiment-table small.negative { color: var(--danger); }
.group-row td { background: var(--soft); color: var(--muted); font-weight: 650; }
.total-row td { font-weight: 650; }
code, pre { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
pre { max-height: 34rem; overflow: auto; margin: .5em 0; padding: 11px; background: var(--soft); border-radius: 6px; font-size: .86rem; white-space: pre-wrap; overflow-wrap: anywhere; }

.form-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.field-stack { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; }
.form-grid > :is(label, .numeric-field) { align-content: end; }
.form-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
label, .numeric-field { display: grid; gap: 5px; min-width: 0; font-weight: 580; font-size: .92rem; }
.label-line { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 0 7px; }
.label-line small, label small { color: var(--muted); font-weight: 400; }
input, select, textarea { width: 100%; min-width: 0; min-height: 38px; padding: 7px 9px; border: 1px solid var(--border); border-radius: 7px; background: var(--surface); }
input:not([type="checkbox"], [type="radio"]), select { block-size: 38px; }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: .88; }
input:not([type="checkbox"]):disabled, select:disabled { background: var(--soft); color: var(--muted); opacity: .78; }
input:focus, select:focus, textarea:focus { border-color: var(--focus); }
textarea { resize: vertical; min-height: 76px; }
input[type="checkbox"], input[type="radio"] { width: 17px; min-height: 17px; margin: 0; accent-color: var(--accent); flex: none; }
.check-label, .executor-choice { display: flex; align-items: flex-start; gap: 9px; padding: 4px 0; }
.check-label input, .executor-choice input { margin-top: 2px; }
.field-meta { color: var(--muted); font-size: .82rem; }
.schema-table { min-width: 560px; }
.schema-table input, .schema-table select { min-width: 70px; }
.schema-table td { padding: 8px; }
.operation-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--border); }
.operation-row:last-child { border-bottom: 0; }
.operation-row strong { overflow-wrap: anywhere; }

details { border: 1px solid var(--border); background: var(--soft); border-radius: 7px; }
details + details { margin-top: 9px; }
summary { min-height: 42px; padding: 10px 12px; font-weight: 650; cursor: pointer; }
details[open] { padding-bottom: 10px; }
details[open] > :not(summary) { margin-left: 12px; margin-right: 12px; }
details > .card { margin-bottom: 8px; }
.toolbar, .tabs { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 13px; }
.toolbar input { width: min(100%, 340px); }
.variant-choice { flex: 1 1 180px; max-width: 330px; }
.tabs button.selected, .record.active, .titans-case.selected { background: var(--selected); border-color: var(--accent); color: var(--accent); }
.catalog-layout { display: grid; grid-template-columns: minmax(190px, 1fr) minmax(0, 2fr); gap: 18px; }
.catalog-list { padding: 7px; max-height: 58vh; overflow: auto; }
.record, .titans-case { display: block; width: 100%; padding: 12px; text-align: left; overflow-wrap: anywhere; }
.record { border-color: transparent; }
.record b, .record small, .titans-case strong, .titans-case small { display: block; }
.record small, .titans-case small { margin-top: 4px; color: var(--muted); }
.record .badge { float: right; margin-left: 6px; font-size: .8rem; }
.sticky-actions { position: sticky; z-index: 6; bottom: 0; margin: 0 calc(-1 * var(--gutter)) -58px; padding: 10px var(--gutter); background: var(--surface); border-top: 1px solid var(--border); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.sticky-actions .muted { font-size: .86rem; }
.sticky-actions + * { margin-top: 16px; }

dialog { width: min(calc(100% - 24px), 780px); max-height: 90vh; padding: 0; border: 1px solid var(--border); border-radius: 12px; color: var(--text); background: var(--surface); box-shadow: var(--shadow); overflow: auto; }
dialog::backdrop { background: #0007; }
.dialog-head, .dialog-foot { position: sticky; z-index: 1; background: var(--surface); display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 13px 19px; }
.dialog-head { top: 0; border-bottom: 1px solid var(--border); }
.dialog-foot { bottom: 0; border-top: 1px solid var(--border); justify-content: flex-end; }
.dialog-body { padding: 18px 19px; }
.settings-row { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px 25px; padding: 14px 20px; }
.settings-row + .settings-row { border-top: 1px solid var(--border); }
.settings-row label { font-size: 1rem; }
.settings-row select { width: auto; max-width: 100%; }

.experiment-table { min-width: 1140px; }
.executor-choice small { display: block; }
.task-choices small { color: var(--muted); }
.role-route { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; margin: 12px 0; }
.role-route span { padding: 5px 8px; background: var(--soft); border-radius: 5px; }
.trace-entry { padding: 8px 0; border-bottom: 1px solid var(--border); }
.trace-entry small { color: var(--muted); }
.trace-entry pre { max-height: 240px; }
.experiment-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.experiment-summary span { padding: 9px 12px; background: var(--soft); border-radius: 7px; color: var(--muted); }
.experiment-summary b { display: block; font-size: 1.35rem; color: var(--text); }
#experiment-results, #experiment-results .card, #titans-case-detail, #titans-transfer-form, #titans-preview, #engineering-result { scroll-margin-top: calc(var(--header-height) + 16px); }
.titans-case-grid, .titans-mode-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
.titans-mode-grid > div { padding: 11px; border: 1px solid var(--border); border-radius: 7px; }
.titans-mode-grid label + label { margin-top: 8px; }
.observations-table { min-width: 44rem; }
.observations-table td:first-child .help { display: inline-flex; align-items: center; white-space: nowrap; }
.observation-fields { display: grid; grid-template-columns: minmax(6rem, 1fr) minmax(7rem, 1.2fr); gap: 3px 12px; }
.observation-fields dt { color: var(--muted); }
.observation-fields dd { overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.titans-source-table { min-width: 660px; }
.titans-source-table :is(th, td) { vertical-align: middle; }
.titans-comparison, .engineering-comparison { min-width: 760px; }
.titans-comparison th, .engineering-comparison th { min-width: 115px; }
.titans-summary-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; padding: 14px 20px; }
.titans-summary { background: var(--soft); border: 1px solid var(--border); border-radius: 8px; padding: 11px; }
.titans-summary dt { color: var(--muted); font-size: .9rem; margin-top: 8px; }
.titans-summary dd { font-size: 1.35rem; font-weight: 650; }
.titans-summary dd small { font-weight: 400; }
.titans-detail-table { margin: 0 12px 12px; }
.source-entry { padding: 8px 0; border-bottom: 1px solid var(--border); }
.source-entry > :is(a, small), .engineering-lineage small { display: block; overflow-wrap: anywhere; color: var(--muted); }
.source-entry > a { color: var(--accent); }
.engineering-lineage { padding-left: 18px; }
.engineering-economic-inputs { margin: 0 0 18px; }
.engineering-economic-inputs > .form-grid { margin-top: 10px; }
.engineering-comparison .badge { display: block; margin-top: 5px; }
body[data-guest] :is([data-go="experiments"], a[href="#experiments"], [data-edit-record], [data-action="new-record"], [data-action="import-catalogs"], [data-local-source]) { display: none !important; }

.legacy main { max-width: 1240px; }
.legacy .tabs button { flex: 0 1 auto; }
.legacy .card-body > .form-grid + button { margin-top: 12px; }
.legacy #cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 255px), 1fr)); gap: 12px; margin: 14px 0; }
.legacy #cards .card { margin: 0; }
.legacy .legacy-result { margin-top: 14px; }
.legacy-result .table-scroll { margin-top: 10px; }

@media (max-width: 1180px) {
  :root { --nav-width: 211px; --gutter: 26px; }
  .grid-2 > div .form-grid:not(.two) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1000px) {
  .grid-2, .grid-2.equal { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .catalog-layout { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .catalog-list { max-height: 250px; }
}
@media (max-width: 820px) {
  :root { --sidebar-height: 46px; --header-height: 92px; }
  .sidebar { position: sticky; inset: 0 0 auto; width: auto; border-right: 0; border-bottom: 1px solid var(--border); }
  .sidebar-top { min-height: var(--sidebar-height); padding-inline: var(--gutter); }
  .project-link { padding-inline: 10px; }
  button.nav-toggle { display: inline-flex; }
  .sidebar nav { display: none; position: absolute; top: 100%; left: 0; right: 0; padding: 6px var(--gutter) 14px; max-height: calc(100dvh - var(--sidebar-height)); background: var(--sidebar); border-bottom: 1px solid var(--border); box-shadow: var(--shadow); }
  .sidebar.nav-open nav { display: flex; }
  .nav-group:last-child { margin-top: 10px; }
  .shell { margin: 0; }
  .app-header { top: var(--sidebar-height); min-height: 46px; }
  .app-header button { min-height: 36px; }
  #save-state { display: none; }
  main { padding-top: 25px; }
  .nav-group a, button { min-height: 44px; }
  button.help-trigger.icon-button { width: 44px; min-height: 44px; margin-block: -8px; }
}
@media (max-width: 560px) {
  :root { --gutter: 15px; }
  .app-header { padding-block: 4px; gap: 6px; }
  .app-header .actions { gap: 5px; }
  #breadcrumb { display: block; font-size: .91rem; }
  #breadcrumb a { display: block; }
  #breadcrumb span { display: none; }
  .page-heading { margin-bottom: 17px; }
  .form-grid, .form-grid.four { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .experiment-summary, .titans-summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .titans-case-grid, .titans-mode-grid { grid-template-columns: minmax(0, 1fr); }
  .card-head, .card-body, .empty { padding: 13px; }
  .metric { padding: 11px; }
  .card > details { margin-inline: 13px; }
  :is(th, td):first-child { padding-left: 13px; }
  :is(th, td):last-child { padding-right: 13px; }
  .check-label span, .badge { word-break: normal; }
}

.report-only, .preview-toolbar { display: none; }
body.print-preview .preview-toolbar { display: flex; gap: 8px; flex-wrap: wrap; margin: 0 0 22px; }
body.print-preview :is(.sidebar, .app-header, #message, .page-heading) { display: none; }
body.print-preview .shell { margin: 0; }
body.print-preview .report-only { display: block; margin-bottom: 22px; }
body[data-export] .help-content[hidden], body.print-preview .help-content[hidden] { display: block !important; }
body[data-export] .help-trigger, body.print-preview .help-trigger { display: none; }
body[data-export] .help-content, body.print-preview .help-content { position: static; display: block; width: auto; max-width: none; max-height: none; overflow: visible; padding: 0; margin-top: 4px; border: 0; box-shadow: none; }
body[data-export] .help-content > span, body.print-preview .help-content > span { display: block; }
@media print {
  :root { color-scheme: light; --text: #111; --muted: #333; --canvas: #fff; --surface: #fff; --soft: #f5f5f5; --border: #d9d9d9; --accent: #252525; }
  .sidebar, .app-header, .sticky-actions, .skip-link, .no-print, #message, #activity, .page-heading, button { display: none !important; }
  .shell, main { margin: 0 !important; padding: 0; max-width: none; }
  .report-only, .help-content[hidden] { display: block !important; }
  .help-content { position: static; display: block; width: auto; max-width: none; max-height: none; overflow: visible; padding: 0; border: 0; box-shadow: none; font-size: 8pt; }
  .help-content > span { display: block; }
  .card { break-inside: auto; margin-bottom: 8pt; }
  .card-head { break-after: avoid; }
  .table-scroll { overflow: visible; }
  table { min-width: 0 !important; font-size: 8pt; }
  th, td { min-width: 0 !important; padding: 4pt; overflow-wrap: anywhere; }
  .metrics { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .metric .value { font-size: 13pt; }
  .print-variant { break-before: page; }
  .grid-2 { display: block; }
  @page { margin: 13mm; }
}

.metrics-heading { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 5px 12px; margin-bottom: 10px; }
.calculation-group { background: var(--surface); }
.calculation-group summary { padding-inline: 20px; }
.calculation-group[open] > .card-body { margin-inline: 0; border-top: 1px solid var(--border); }
.disabled-help { display: inline-flex; align-items: center; }
.disabled-help .help-label { display: none; }
.disabled-help .help-trigger.icon-button { margin-inline: 0; }
a.text-action { display: inline-flex; gap: 6px; align-items: center; font-weight: 650; }
.label-line .help-label label { display: inline; }
.legacy .toolbar select { flex: 1 1 210px; width: auto; max-width: 100%; }
.legacy .toolbar button { flex: none; }
.legacy form > .disabled-help { margin-top: 12px; }
.legacy .legacy-result .notice { margin-top: 12px; }
@media (max-width: 820px) {
  .legacy .app-header { top: 0; }
  button.small, button.nav-toggle.icon-button { min-height: 44px; }
}

.titans-case-grid {
  max-height: 20rem;
  overflow-y: auto;
  padding: 3px;
  align-content: start;
}
.titans-case-option .help { display: flex; align-items: center; gap: 2px; height: 100%; }
.titans-case-option .help-label { flex: 1; min-width: 0; }
.settings-link { margin: 4px 0 18px; }
input:is(:invalid, [aria-invalid="true"]):focus { border-color: var(--danger); }
.metric .label > .help, .label-line > .help { display: flex; align-items: center; gap: 2px; }
.metric .label > .help { justify-content: space-between; }
.label-line > .help { flex: 1; min-width: 0; }
.metric .label > .help > button, .label-line > .help > button { flex: none; }


.work-section { margin-bottom: 18px; }
.operation-overview { padding: 17px 20px; }
.operation-overview h2 { overflow-wrap: anywhere; }
.operation-overview .actions { margin-top: 10px; }
.operation-facts { display: flex; flex-wrap: wrap; gap: 6px 24px; margin-top: 9px; }
.operation-facts dt { color: var(--muted); }
.scenario-actions { justify-content: flex-end; }
button.destructive { border-color: var(--text); }
.key-form label { flex: 1 1 240px; }
.key-form input { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
