/* base plate and anchor rods — on top of calc.css */
main.bp .work { grid-template-rows: auto auto; }
main.bp .work > .stage { grid-column: 1; grid-row: 1; }
main.bp .work > .panel { grid-column: 2; grid-row: 1 / span 2; }
main.bp .work > .summary { grid-column: 1; grid-row: 2; }
main.bp .stage-bar { justify-content: flex-start; gap: 8px; flex-wrap: wrap; }
main.bp .stage-bar .hist { margin-left: auto; display: flex; gap: 2px; }
main.bp .stage { position: relative; }
#view { display: block; width: 100%; height: auto; user-select: none; -webkit-user-select: none; touch-action: none; }
#view.dragging, #view.dragging * { cursor: grabbing !important; }
#view .hit { fill: transparent; stroke: none; }
#view .edge-hit { stroke: transparent; stroke-width: 12; }

/* drawing */
.bp-h { font-size: 13px; font-weight: 600; fill: var(--text); }
.bp-sub, .bp-t { font-size: 11.5px; fill: var(--text-3); }
#view .conc { fill: var(--concrete); }
#view .conc-edge { fill: none; stroke: var(--steel-550); stroke-width: 1; }
#view .brk { fill: none; stroke: var(--steel-550); stroke-width: 1; }
#view .grout { fill: var(--x-e2e0d9, #e2e0d9); stroke: var(--x-a9a69c, #a9a69c); stroke-width: .8; }
#view .plate { fill: var(--steel-250); stroke: var(--steel-700); stroke-width: 1; }
#view .col { fill: var(--steel-350); stroke: var(--steel-700); stroke-width: 1; stroke-linejoin: round; }
#view .col-far { fill: var(--steel-150); stroke: var(--steel-700); stroke-width: 1; }
#view .weld { fill: var(--steel-700); }
#view .lug, #view .lug-plan { fill: var(--x-b9c0c8, #b9c0c8); stroke: var(--steel-700); stroke-width: .9; }
#view .hole { fill: var(--surface); stroke: var(--steel-700); stroke-width: .8; }
#view .nut { fill: var(--steel-50); stroke: var(--steel-700); stroke-width: .8; }
#view .shank { fill: var(--steel-550); }
#view .rod.t .shank, #view .rod-e.t .shank { fill: var(--load); }
#view .rod-e .nut { fill: var(--steel-300); }
#view .bear { fill: color-mix(in srgb, var(--load) 16%, transparent); stroke: var(--load); stroke-width: 1; }
#view .bear-plan { fill: color-mix(in srgb, var(--load) 12%, transparent); pointer-events: none; }
#view .fpmax { stroke: var(--load); stroke-width: .8; stroke-dasharray: 4 3; }
#view .arr line, #view .arr .arc { stroke: var(--load); stroke-width: 1.8; fill: none; }
#view .arr path { fill: var(--load); }
#view .arr.rx line { stroke: var(--rust); stroke-width: 1; }
#view .arr.rx path { fill: var(--rust); }
#view .cone-t .fill { fill: color-mix(in srgb, var(--warn) 12%, transparent); }
#view .cone-t line { stroke: var(--warn); stroke-width: 1.1; stroke-dasharray: 5 3; }
#view .cone-t-e { fill: color-mix(in srgb, var(--warn) 12%, transparent); stroke: var(--warn); stroke-width: 1; stroke-dasharray: 5 3; }
#view .cone-v, #view .cone-v-e { fill: color-mix(in srgb, var(--moment) 10%, transparent); stroke: var(--moment); stroke-width: 1; stroke-dasharray: 5 3; }
#view .yl line { stroke: var(--x-7c5aa6, #7c5aa6); stroke-width: 1; stroke-dasharray: 6 3; }
#view .dimg .dl, #view .dimg .ext { stroke: var(--text-4); stroke-width: .8; }
#view .dimg .ext { stroke: var(--faint); stroke-width: .7; }
#view .dimg .dh { fill: var(--text-4); stroke: none; }
#view .ext { stroke: var(--faint); stroke-width: .7; }
#view .bear, #view .cone-t, #view .cone-t-e, #view .cone-v, #view .cone-v-e, #view .yl, #view .arr, #view .rod, #view .rod-e, #view .col, #view .col-far, #view .plate, #view .conc, #view .grout, #view .brk { pointer-events: none; }
#view .handle .knob { fill: var(--surface); stroke: var(--sel); stroke-width: 1.6; }
#view .handle:hover .knob, #view .handle:focus .knob { fill: var(--sel); }
#view .rodh:hover + .rodh .hit, #view .rodh .hit:hover { fill: color-mix(in srgb, var(--sel) 8%, transparent); }

/* pills */
#view .pill rect, #pmChart .pill rect { fill: var(--surface); stroke: var(--steel-300); }
#view .pill text, #pmChart .pill text { font-size: 11.5px; font-weight: 500; fill: var(--text-2); font-variant-numeric: tabular-nums; }
#view .pill.dimv rect { stroke: var(--steel-200); }
#view .pill.load rect, #pmChart .pill.load rect { stroke: color-mix(in srgb, var(--load) 35%, transparent); }
#view .pill.load text, #pmChart .pill.load text { fill: var(--load); font-weight: 600; }
#view .pill.rr text { fill: var(--text); font-weight: 600; }
#view .pill.cone rect { stroke: color-mix(in srgb, var(--warn) 45%, transparent); }
#view .pill.cone text { fill: var(--x-8a5a12, #8a5a12); }
#view .pill.editable { cursor: text; }
#view .pill.editable:hover rect { stroke: var(--sel); stroke-width: 1.4; }
#view .pill.editable:focus { outline: none; }
#view .pill.editable:focus rect { stroke: var(--sel); stroke-width: 1.6; }

/* legend under the drawing */
.bp-legend { display: flex; flex-wrap: wrap; gap: 4px 16px; padding: 8px 14px; border-top: 1px solid var(--line); font-size: 12px; color: var(--text-2); }
.bp-legend > span { display: inline-flex; align-items: center; gap: 6px; }
.bp-legend .lg-note { color: var(--text-3); }
.lg-bear { fill: color-mix(in srgb, var(--load) 16%, transparent); stroke: var(--load); }
.lg-rod { fill: var(--load); }
.lg-cone { fill: color-mix(in srgb, var(--warn) 12%, transparent); stroke: var(--warn); stroke-dasharray: 4 2; }
.lg-conev { fill: color-mix(in srgb, var(--moment) 10%, transparent); stroke: var(--moment); stroke-dasharray: 4 2; }
.lg-yl { stroke: var(--x-7c5aa6, #7c5aa6); stroke-dasharray: 5 2; }

/* the value editor on the drawing */
.bp-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 8px 2px 4px; box-shadow: 0 6px 18px rgba(20, 22, 28, .14); }
.bp-edit input { width: 82px; border: 0; outline: none; font: inherit; font-size: 13px; text-align: right; font-variant-numeric: tabular-nums; padding: 3px 2px; }
.bp-edit span { font-size: 11.5px; color: var(--text-3); }

/* panel */
.bp-seg { margin-bottom: 6px; }
.bp-seg button:disabled { opacity: .45; cursor: not-allowed; }
.bp-kv { display: flex; flex-wrap: wrap; gap: 2px 14px; font-size: 12px; color: var(--text-2); padding: 4px 0 2px; }
#panel input.bad { color: var(--bad); }
#panel .num:has(input.bad) input { border-color: var(--bad); }
.small-note .srcs a, .bp-kv .srcs a { text-decoration: none; color: var(--text-2); font-size: 11px; }
.small-note a { color: var(--text-2); }
#panel .f .seg { flex: 1; }

/* summary */
.bp-say { font-size: 12.5px; color: var(--text-2); margin-top: 6px; max-width: 36ch; line-height: 1.4; }
.bp-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.bp-stats .stat .v { white-space: nowrap; }
main.bp .summary { grid-template-columns: minmax(240px, auto) minmax(0, 1fr); }

/* margins: name and detail on two lines, so the table fits its card */
#checks td.chk .mui-t { display: grid; gap: 1px; }
#checks .nm { font-weight: 500; color: var(--text); }
#checks .det { font-size: 11.5px; color: var(--text-3); white-space: normal; line-height: 1.35; }
#checks .det .ph { display: none; }
#checks tr.na .nm { color: var(--text-3); font-weight: 400; }
#checks td.chk { white-space: normal; min-width: 0; }
#checks { width: 100%; }

/* chart */
#pmChart { display: block; width: 100%; height: auto; touch-action: none; user-select: none; }
#pmChart .grid { stroke: var(--grid); }
#pmChart .grid.zero { stroke: var(--steel-350); }
#pmChart .ch-t { font-size: 11px; fill: var(--text-3); font-variant-numeric: tabular-nums; }
#pmChart .ch-a { font-size: 11.5px; fill: var(--text-2); }
#pmChart .ch-l { font-size: 11px; font-weight: 600; }
#pmChart .halo { paint-order: stroke; stroke: var(--halo); stroke-width: 3.5px; stroke-linejoin: round; }
#pmChart .okreg { fill: color-mix(in srgb, var(--good) 8%, transparent); stroke: none; }
#pmChart .pmc { fill: none; stroke-width: 1.4; stroke-linejoin: round; opacity: .9; }
#pmChart .pme { fill: none; stroke: var(--text); stroke-width: 2; stroke-linejoin: round; }
#pmChart .pmdot { fill: var(--surface); stroke: var(--text); stroke-width: 1.5; }
#pmChart .pmguide { stroke: var(--load); stroke-width: .8; stroke-dasharray: 3 3; }
#pmChart .pmpt .hit { fill: transparent; }
#pmChart .pmpt .dot { fill: var(--surface); stroke: var(--load); stroke-width: 2.2; }
#pmChart .pmpt.bad .dot { fill: var(--bad-bg); stroke: var(--bad); }
#pmChart.dragging, #pmChart.dragging * { cursor: grabbing !important; }

/* reserve the summary's height so the cards below do not jump when the script fills it */
@media (min-width: 1041px) { main.bp #summary { min-height: 150px; } }
@media (max-width: 1040px) {
  main.bp .work > .stage, main.bp .work > .panel, main.bp .work > .summary { grid-column: 1; grid-row: auto; }
  main.bp .work > .summary { order: 2; }
  main.bp .work > .panel { order: 3; }
  main.bp .summary { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 760px) {
  #checks .c-act, #checks .c-al { display: none; }
  #checks .det .ph { display: inline; }
  .bp-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  main.bp .stage-bar .hist { margin-left: 0; }
}
@media (max-width: 420px) {
  .bp-stats { grid-template-columns: minmax(0, 1fr); }
}
main.bp .tabs.five { grid-template-columns: repeat(5, minmax(0, 1fr)); }
#pmChart .grid { fill: var(--grid); stroke: none; }
#pmChart .grid.zero { fill: var(--steel-350); }
#view .leader { stroke: var(--steel-500); stroke-width: .8; }
/* P–M chart (T061/T076): feasible region, governing envelope coloured by mode, dimmed non-governing limits, the ray */
#pmChart .okreg { fill: color-mix(in srgb, var(--good) 13%, transparent); stroke: none; }
#pmChart .pmc { fill: none; stroke-width: 1.3; stroke-linejoin: round; opacity: .9; }
#pmChart .pmg:not(.gov) .pmc { opacity: .32; }
#pmChart .pmg:not(.gov):hover .pmc { opacity: 1; stroke-width: 1.8; }
#pmChart .pmhit { fill: none; stroke: transparent; stroke-width: 10; }
#pmChart .pme { fill: none; stroke-width: 3; stroke-linejoin: round; stroke-linecap: round; }
#pmChart .ch-l.dim { opacity: .62; }
#pmChart .pmlead { stroke-width: .8; }
#pmChart .pmlead.dim { opacity: .55; }
#pmChart .pmray { stroke: var(--text-2); stroke-width: 1; stroke-dasharray: 4 3; }
#pmChart .pmhitpt { fill: var(--surface); stroke-width: 1.8; }
#pmChart .pmms rect { fill: var(--surface); stroke-width: 1.1; }
#pmChart .pmms text { font-size: 11px; font-weight: 600; font-variant-numeric: tabular-nums; }
#pmChart .pmoff text { font-size: 11px; font-weight: 600; }
#pmChart .pmmsl { stroke-width: 1; }
/* T077: rod layouts, custom rods, plate outlines */
.bp-pats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin-bottom: 8px; }
.bp-pat { display: grid; justify-items: center; gap: 2px; padding: 6px 2px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); cursor: pointer; font-size: 11.5px; color: var(--text-2); }
.bp-pat[aria-pressed="true"] { border-color: var(--sel); color: var(--sel); background: var(--sel-bg); }
.bp-pat:hover { border-color: var(--line-2, #cfd3d8); }
.bp-pts { display: grid; gap: 4px; margin: 6px 0; }
.bp-pt { display: grid; grid-template-columns: 20px minmax(0, 1fr) minmax(0, 1fr) 24px; gap: 6px; align-items: center; font-size: 12px; color: var(--text-3); }
.bp-pt .num input { width: 100%; }
.bp-ptact { display: flex; flex-wrap: wrap; gap: 4px 10px; }
.bp-ptact .ghost { color: var(--sel); font-size: 12.5px; padding: 4px 2px; }
.bp-paste { display: grid; gap: 6px; margin-top: 6px; }
.bp-paste textarea { width: 100%; border: 1px solid var(--line); border-radius: 7px; padding: 6px 8px; font: 12.5px/1.4 ui-monospace, Menlo, monospace; }
.bp-paste textarea.bad { border-color: var(--bad); }
#view .bc { fill: none; stroke: var(--steel-500); stroke-width: .8; stroke-dasharray: 5 3; pointer-events: none; }
@media (max-width: 640px) { .bp-pats { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.bp-pat { padding: 6px 8px; }
/* the panel scrolls inside the stage's height: its last line fades out instead of being cut */
#panel { -webkit-mask-image: linear-gradient(#000 calc(100% - 28px), transparent); mask-image: linear-gradient(#000 calc(100% - 28px), transparent); padding-bottom: 28px; }
@media (max-width: 1040px) { #panel { -webkit-mask-image: none; mask-image: none; padding-bottom: 16px; } }
#view .rod-e .nut.lev { fill: var(--steel-350); }
@media (max-width: 760px) { .stage-bar #patSeg { grid-auto-flow: row; grid-template-columns: repeat(4, auto); } }

/* until app.js draws it, the drawing holds its usual size, so nothing under it jumps on load (layout shift) */
#view:empty { aspect-ratio: 950 / 510; }
@media (max-width: 560px) { #view:empty { aspect-ratio: 378 / 892; } }

/* 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-2f68b8: #7aaaf0; --x-3a9cc9: #7cc6ec; --x-3f8f55: #83c391; --x-5c4a78: #a495bf; --x-6e7177: #85827f;
    --x-7a4b55: #ba8f97; --x-7c5aa6: #b79bde; --x-8a5a12: #c89e6b; --x-8fcfe8: #77a9bd; --x-9a7fc0: #c4aee6;
    --x-a9a69c: #5c5a53; --x-b9c0c8: #44494f; --x-e0b43c: #eeca71; --x-e2e0d9: #353330; --x-e8958d: #fbb5ad;
  }
}
@media screen {
  :root[data-theme="dark"] {
    --x-2f68b8: #7aaaf0; --x-3a9cc9: #7cc6ec; --x-3f8f55: #83c391; --x-5c4a78: #a495bf; --x-6e7177: #85827f;
    --x-7a4b55: #ba8f97; --x-7c5aa6: #b79bde; --x-8a5a12: #c89e6b; --x-8fcfe8: #77a9bd; --x-9a7fc0: #c4aee6;
    --x-a9a69c: #5c5a53; --x-b9c0c8: #44494f; --x-e0b43c: #eeca71; --x-e2e0d9: #353330; --x-e8958d: #fbb5ad;
  }
}
/* theme-auto:end */
