/* pressure vessel — on top of calc.css */
main.ves .stage-bar { justify-content: flex-start; gap: 8px; flex-wrap: wrap; }
main.ves .stage-bar .hist { margin-left: auto; }
.stage { position: relative; }
#view { display: block; width: 100%; height: auto; flex: 1; min-height: 0; user-select: none; touch-action: none; }
#view.dragging, #view.dragging * { cursor: grabbing !important; }
#view .handle { cursor: grab; }
#view .handle.v { cursor: ns-resize; }
#view .handle.h { cursor: ew-resize; }
#view .handle .knob { fill: var(--surface); stroke: var(--sel); stroke-width: 1.8; }
#view .handle:hover .knob { fill: var(--sel); }
#view .handle .hit { fill: transparent; }

#view .fluid { fill: var(--steel-50); }
#view .wall { stroke-linejoin: round; }
#view .head { cursor: pointer; outline: none; }
#view .head .hit { fill: transparent; }
#view .head:hover .wall, #view .head:focus-visible .wall { stroke-width: 2.2; }
#view [data-comp] { cursor: pointer; }
#view .cl { stroke: var(--steel-500); stroke-width: .7; stroke-dasharray: 12 3 2 3; fill: none; }
#view .tan { stroke: var(--steel-400); stroke-width: .7; stroke-dasharray: 4 3; }
#view .dimln { stroke: var(--steel-550); stroke-width: .8; fill: none; }
#view .ext { stroke: var(--steel-400); stroke-width: .7; }
#view .parrow { stroke: var(--load); stroke-width: 1.1; opacity: .75; }
#view .weld { fill: var(--steel-350); stroke: var(--steel-650); stroke-width: .6; }
#view .leader { stroke: var(--steel-400); stroke-width: .8; fill: none; }
#view .need { stroke: var(--bad); stroke-width: 1.2; stroke-dasharray: 4 3; }
#view .inset-bg { fill: var(--surface-2); stroke: var(--line); }
#view .cap { font-size: calc(11px * var(--tk, 1)); fill: var(--text-3); }
#view .cap.small { font-size: calc(10.5px * var(--tk, 1)); }
#view .need-t { font-size: calc(11px * var(--tk, 1)); fill: var(--bad); font-variant-numeric: tabular-nums; }
#view .ca-t { font-size: calc(11px * var(--tk, 1)); fill: var(--ochre); font-variant-numeric: tabular-nums; }

#view .pill rect { fill: var(--surface); stroke: var(--steel-300); }
#view .pill text { font-size: calc(11.5px * var(--tk, 1)); font-weight: 500; fill: var(--text-2); font-variant-numeric: tabular-nums; }
#view .pill.editable { cursor: pointer; outline: none; }
#view .pill.editable:hover rect, #view .pill.editable:focus-visible rect { stroke: var(--sel); stroke-width: 1.4; }
#view .pill.load rect { stroke: color-mix(in srgb, var(--load) 40%, transparent); } #view .pill.load text { fill: var(--load); font-weight: 600; }
#view .pill.ms-good rect { stroke: color-mix(in srgb, var(--good) 45%, transparent); } #view .pill.ms-good text { fill: var(--good); }
#view .pill.ms-warn rect { stroke: color-mix(in srgb, var(--warn) 50%, transparent); } #view .pill.ms-warn text { fill: var(--x-8f5e12, #8f5e12); }
#view .pill.ms-bad rect { stroke: color-mix(in srgb, var(--bad) 50%, transparent); } #view .pill.ms-bad text { fill: var(--bad); }
#view .pill.cur rect { stroke-width: 1.6; }
#view .pill.cur text { font-weight: 600; }

/* head picker */
.hd-menu { position: absolute; z-index: 9; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 10px 30px rgba(20, 22, 28, .12); padding: 6px; display: grid; gap: 2px; min-width: 190px; }
.hd-menu[hidden] { display: none; }
.hd-menu .hd-t { font-size: 11.5px; color: var(--text-3); padding: 2px 8px 4px; }
.hd-menu button { display: flex; align-items: center; gap: 10px; border: 0; background: none; padding: 5px 10px; border-radius: 7px; font-size: 13px; color: var(--text); cursor: pointer; text-align: left; }
.hd-menu button svg path { fill: none; stroke: var(--ink); stroke-width: 2.2; stroke-linecap: round; }
.hd-menu button:hover:not(:disabled), .hd-menu button:focus-visible { background: var(--fill-1); outline: none; }
.hd-menu button[aria-pressed="true"] { background: var(--sel-bg); font-weight: 600; }
.hd-menu button:disabled { color: var(--text-3); cursor: default; }
.hd-menu button:disabled svg path { stroke: var(--faint); }
.hd-menu p { margin: 4px 8px 2px; font-size: 11.5px; color: var(--text-3); }

/* live strip */
.v-live { display: flex; flex-wrap: wrap; gap: 4px 18px; padding: 8px 14px; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--text-2); font-variant-numeric: tabular-nums; min-height: 34px; align-items: center; }
.v-live b { font-weight: 500; color: var(--text-3); margin-right: 4px; }
.v-live .x-ok { color: var(--good); font-weight: 500; }
.v-live .x-no { color: var(--bad); font-weight: 500; }

/* in-place editor */
.v-edit { position: absolute; transform: translate(-50%, -50%); z-index: 5; display: flex; align-items: center; gap: 4px; background: var(--surface); border: 1.5px solid var(--sel); border-radius: 9px; padding: 2px 10px 2px 6px; box-shadow: 0 6px 18px rgba(20, 22, 28, .14); }
.v-edit input { width: 92px; border: 0; outline: none; font: inherit; font-size: 13px; text-align: right; font-variant-numeric: tabular-nums; padding: 3px 2px; }
.v-edit span { font-size: 11.5px; color: var(--text-3); }

/* examples menu */
.ex-wrap { position: relative; }
.ex-menu { position: absolute; top: calc(100% + 6px); left: 0; z-index: 8; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 10px 30px rgba(20, 22, 28, .12); padding: 6px; display: grid; gap: 2px; min-width: 320px; }
.ex-menu[hidden] { display: none; }
.ex-menu button { border: 0; background: none; text-align: left; padding: 7px 10px; border-radius: 7px; cursor: pointer; font-size: 13px; color: var(--text); display: grid; gap: 1px; }
.ex-menu button small { color: var(--text-3); font-size: 11.5px; }
.ex-menu button:hover, .ex-menu button:focus { background: var(--fill-1); outline: none; }

/* panel bits */
.f.segf { grid-template-columns: minmax(0, 1fr) auto; }
.f.segf .seg button { padding: 4px 9px; font-size: 12.5px; }
.f.segf.stack { grid-template-columns: minmax(0, 1fr); gap: 4px; }
.f.segf.stack .seg { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); width: 100%; }
.f.sel { grid-template-columns: 96px minmax(0, 1fr); }
.facts { display: grid; grid-template-columns: auto 1fr; gap: 3px 12px; font-size: 12.5px; color: var(--text-2); margin: 6px 0 0; font-variant-numeric: tabular-nums; }
.facts dt { color: var(--text-3); }
.facts dd { margin: 0; text-align: right; }
.sec-tag { font-style: normal; font-size: 11px; color: var(--text-3); border: 1px solid var(--line); border-radius: 999px; padding: 0 7px; margin-left: 4px; }

/* summary */
.v-sum { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: stretch; }
.story { padding: 14px 20px; display: grid; align-content: center; gap: 6px; min-width: 0; }
.story p { margin: 0; font-size: 14px; line-height: 1.5; color: var(--text); max-width: 76ch; }
.story p.sub { font-size: 12.5px; color: var(--text-2); }
.v-notes { margin: 2px 0 0; padding-left: 18px; font-size: 12.5px; color: var(--warn); }
.v-mini { display: grid; grid-template-columns: repeat(3, minmax(140px, 1fr)); border-left: 1px solid var(--line); }
.v-mini .stat { border-left: 1px solid var(--line); border-top: 1px solid var(--line); }
.v-mini .stat:nth-child(3n+1) { border-left: 0; }
.v-mini .stat:nth-child(-n+3) { border-top: 0; }
@media (max-width: 1320px) {
  .v-sum { grid-template-columns: minmax(0, 1fr); }
  .v-mini { grid-template-columns: repeat(6, minmax(0, 1fr)); border-left: 0; border-top: 1px solid var(--line); }
  .v-mini .stat { border-top: 0; border-left: 1px solid var(--line); }
  .v-mini .stat:first-child { border-left: 0; }
}
@media (max-width: 1040px) {
  .v-mini { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .v-mini .stat { border-left: 1px solid var(--line); border-top: 1px solid var(--line); }
  .v-mini .stat:nth-child(3n+1) { border-left: 0; }
  .v-mini .stat:nth-child(-n+3) { border-top: 0; }
}
@media (max-width: 700px) {
  .v-mini { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .v-mini .stat { border-left: 1px solid var(--line); border-top: 1px solid var(--line); }
  .v-mini .stat:nth-child(odd) { border-left: 0; }
  .v-mini .stat:nth-child(-n+2) { border-top: 0; }
  .v-mini .stat:nth-child(3) { border-top: 1px solid var(--line); }
}
main.ves #summary { min-height: 170px; }

/* margins with row icons */
#checks tr[data-check] { cursor: pointer; }
#checks td.chk { display: flex; align-items: center; gap: 10px; white-space: normal; min-width: 180px; padding-top: 4px; padding-bottom: 4px; }
#checks td.chk .ri { flex: none; width: 46px; height: 46px; border-radius: 8px; background: var(--surface-2); display: block; }
#checks td.chk .th { display: block; }
#checks td.chk:focus-visible { outline: 2px solid var(--sel); outline-offset: -2px; border-radius: 6px; }
#checks td.note { white-space: normal; min-width: 170px; }
#checks td.clause { color: var(--text-3); font-size: 12.5px; }
#checks .guide-tag { font-size: 11px; color: var(--text-3); margin-left: 6px; }
.v-pv { position: fixed; z-index: 60; width: 236px; padding: 8px 8px 9px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 8px 28px rgba(20, 24, 30, .14); pointer-events: none; font-size: 12px; color: var(--text); }
.v-pv[hidden] { display: none; }
.v-pv svg { display: block; width: 220px; height: auto; margin: 4px 0 6px; }
.v-pv .pv-h { font-weight: 600; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.v-pv .pv-c { color: var(--text-2); line-height: 1.35; }
.v-pv .pv-m { margin-top: 4px; color: var(--text-3); }
@media print { .v-pv { display: none !important; } }

/* chart + stress */
.v-row { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 16px; align-items: stretch; }
#chart, #stress { display: block; width: 100%; height: auto; touch-action: none; user-select: none; }
#chart .drag { cursor: ew-resize; }
#chart .ccurve { cursor: pointer; }
.ch-t { font-size: 10.5px; fill: var(--text-3); font-variant-numeric: tabular-nums; }
.ch-a { font-size: 11px; fill: var(--text-2); }
.ch-l { font-size: 11px; font-weight: 600; }
#stress .sarr { stroke-width: 2.2; }
#stress .sarr.h { stroke: var(--moment); } #stress .sarr.a { stroke: var(--clamp); }
#stress .sl { font-size: 13px; font-weight: 600; } #stress .sl.h { fill: var(--moment); } #stress .sl.a { fill: var(--clamp); }
#stress .sb { font-size: 12px; fill: var(--text-2); font-weight: 500; font-variant-numeric: tabular-nums; }
@media (max-width: 1040px) { .v-row { grid-template-columns: minmax(0, 1fr); } }

/* steps: governing step marked */
details.step.gov > summary .t::after { content: "governs"; margin-left: 10px; font-size: 11px; font-weight: 600; color: var(--bad); letter-spacing: .03em; text-transform: uppercase; }
.step .where { font-size: 12px; color: var(--text-3); margin: 6px 0 0; line-height: 1.6; }
.refs-body .md-src li { margin: 5px 0; }

@media (max-width: 700px) {
  #checks th:nth-child(5), #checks td:nth-child(5), #checks th:nth-child(2), #checks td:nth-child(2), #checks th:nth-child(3), #checks td:nth-child(3) { display: none; }
  .margins td, .margins th { padding-left: 4px; padding-right: 4px; }
  .margins .ms { min-width: 54px; padding: 2px 6px; }
  #checks td.chk { min-width: 0; gap: 6px; }
  #checks td.chk .ri { width: 36px; height: 36px; }
  #checks td.chk .th { width: 36px; height: 36px; }
  .step .eq .katex { font-size: .86em; }
  .ex-menu { min-width: 270px; }
}
main.ves .f.sel { grid-template-columns: 104px minmax(0, 1fr); }
main.ves .f.sel > label { grid-template-columns: 0 minmax(0, 1fr); }
main.ves .f.segf > label { grid-template-columns: 0 minmax(0, 1fr); }
#view .ringbar { stroke-linejoin: round; }
#view .pill.pe rect { stroke: color-mix(in srgb, var(--moment) 40%, transparent); } #view .pill.pe text { fill: var(--moment); font-weight: 600; }
/* stacked select: the label above the control, so long labels never truncate */
main.ves .f.selw { display: grid; grid-template-columns: minmax(0, 1fr); gap: 4px; padding: 4px 0; }
main.ves .f.selw > label { display: block; color: var(--text-2); font-size: 13px; white-space: normal; }
/* examples with drawn thumbnails */
.ex-menu { min-width: 420px; }
.ex-menu button { grid-template-columns: 96px minmax(0, 1fr); align-items: center; gap: 12px; }
.ex-menu .ex-tw { width: 96px; height: 64px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--line); display: block; overflow: hidden; }
.ex-menu .ex-tw svg { display: block; }
.ex-menu .ex-tx { display: grid; gap: 1px; min-width: 0; }
.ex-menu .ex-tx > span { font-size: 13px; }
@media (max-width: 700px) {
  .ex-menu { min-width: 0; width: min(340px, calc(100vw - 48px)); grid-template-columns: 1fr 1fr; gap: 6px; }
  .ex-menu button { grid-template-columns: 1fr; gap: 6px; padding: 6px; }
  .ex-menu .ex-tw { width: 100%; height: auto; aspect-ratio: 3 / 2; }
  .ex-menu .ex-tw svg { width: 100%; height: 100%; }
  .ex-menu .ex-tx small { display: none; }
}

/* stress bar inside the shell rows */
#checks .sbar { display: inline-block; vertical-align: middle; width: 56px; height: 8px; border-radius: 4px; background: var(--fill-1); margin-right: 8px; position: relative; overflow: hidden; }
#checks .sbar i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 4px; }
#checks .sbar.good i { background: var(--good); opacity: .55; } #checks .sbar.warn i { background: var(--warn); opacity: .6; } #checks .sbar.bad i { background: var(--bad); }
.v-row.one { grid-template-columns: minmax(0, 1fr); }
.step .fbd { display: block; margin: 4px 0 6px; max-width: 100%; height: auto; }

/* field labels wrap to a second line instead of an ellipsis ("External pressure (0 = none)") */
main.ves .f > label span { white-space: normal; overflow: visible; text-overflow: clip; line-height: 1.25; }

/* MDMT facts: the part's temperature, then its curve, thickness and ratio on a quieter second line */
main.ves .facts .v-md { font-size: 11.5px; color: var(--text-3); font-weight: 400; }

/* the panel fades out at an edge it scrolls past (fadePanel in app.js) */
#panel.fade-b { -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 32px), transparent); mask-image: linear-gradient(to bottom, #000 calc(100% - 32px), transparent); }
#panel.fade-t { -webkit-mask-image: linear-gradient(to bottom, transparent, #000 28px); mask-image: linear-gradient(to bottom, transparent, #000 28px); }
#panel.fade-t.fade-b { -webkit-mask-image: linear-gradient(to bottom, transparent, #000 28px, #000 calc(100% - 32px), transparent); mask-image: linear-gradient(to bottom, transparent, #000 28px, #000 calc(100% - 32px), transparent); }

/* theme-auto:start · generated by scripts/theme/hexmap.py: dark values (the rule of scripts/theme/colour.py) for
   colours that are not tokens, written as var(--x-rrggbb, #rrggbb): light is the fallback, unchanged */
@media screen and (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --x-6e7177: #85827f; --x-8a3b2e: #d28a7c; --x-8f5e12: #cba06b; --x-9a6a12: #d0a66a; --x-b9a37a: #9a8868;
    --x-d6eadf: #27342e; --x-f6d3ce: #452f2c; --x-f6e6c4: #382d17;
  }
}
@media screen {
  :root[data-theme="dark"] {
    --x-6e7177: #85827f; --x-8a3b2e: #d28a7c; --x-8f5e12: #cba06b; --x-9a6a12: #d0a66a; --x-b9a37a: #9a8868;
    --x-d6eadf: #27342e; --x-f6d3ce: #452f2c; --x-f6e6c4: #382d17;
  }
}
/* theme-auto:end */
