/* Rivets — on top of calc.css */
main.rv .tabs { grid-template-columns: repeat(4, 1fr); }
main.rv .stage-bar { justify-content: flex-start; gap: 8px; flex-wrap: wrap; }
main.rv .stage-bar .hist { margin-left: auto; }
#view { display: block; width: 100%; height: auto; user-select: none; touch-action: none; }
#view .hit { fill: transparent; stroke: none; }
#view .handle { cursor: grab; }
#view .handle.hx { cursor: ew-resize; }
#view .handle.hy { cursor: ns-resize; }
#view .handle.hd { cursor: nwse-resize; }
#view .handle .knob { fill: var(--surface); stroke: var(--sel); stroke-width: 1.8; }
#view .handle:hover .knob, #view .handle:focus .knob { fill: var(--sel); }

/* joint */
.rv-pl1 { fill: var(--steel-100); stroke: var(--steel-700); stroke-width: 1; }
.rv-pl2 { fill: var(--steel-200); fill-opacity: .88; stroke: var(--x-4b5563, #4b5563); stroke-width: 1; }
.rv-head { fill: var(--steel-350); stroke: var(--steel-750); stroke-width: 1; }
.rv-dot { fill: var(--x-8f979f, #8f979f); stroke: none; }
.rv-shank { fill: var(--steel-350); stroke: var(--steel-750); stroke-width: .9; stroke-linejoin: round; }
.rv-shank.blind { fill: var(--steel-300); }
.rv-mandrel { fill: none; stroke: var(--steel-650); stroke-width: 1.2; stroke-dasharray: 2 2; }
.rv-plane { fill: none; stroke: var(--sel); stroke-width: .9; stroke-dasharray: 5 3; opacity: .7; }
.rv-load line { stroke: var(--load, #e0562b); stroke-width: 1.8; }
.rv-load path { fill: var(--load, #e0562b); stroke: none; }
.rv-dim { fill: none; stroke: var(--slate); stroke-width: .9; }
.rv-fail { fill: none; stroke-width: 2; stroke-dasharray: 6 3; pointer-events: none; }
.rv-axt { font-size: 11px; fill: var(--text-3); font-variant-numeric: tabular-nums; }
.rv-name { font-size: 12.5px; font-weight: 600; fill: var(--text); }
.rv-role { font-size: 11px; fill: var(--text-3); }
.rv-nm { cursor: pointer; }
.rv-nm:hover .rv-name, .rv-nm:focus .rv-name { fill: var(--sel); }

/* pills */
#view .pill rect { fill: var(--surface); stroke: var(--steel-300); }
#view .pill text { font-size: 11.5px; font-weight: 500; fill: var(--text-2); font-variant-numeric: tabular-nums; }
#view .pill.load rect { stroke: color-mix(in srgb, var(--load) 45%, transparent); } #view .pill.load text { fill: var(--load-ink); font-weight: 600; }
#view .pill.desig rect { stroke: color-mix(in srgb, var(--sel) 45%, transparent); } #view .pill.desig text { fill: var(--x-1e4fbf, #1e4fbf); font-weight: 600; }
#view .pill.bad rect { stroke: color-mix(in srgb, var(--bad) 50%, transparent); } #view .pill.bad text { fill: var(--x-b0321f, #b0321f); }
#view .pill.lim rect { stroke: color-mix(in srgb, var(--bad) 35%, transparent); } #view .pill.lim text { fill: var(--x-b0321f, #b0321f); }
#view .pill.editable { cursor: text; }
#view .pill.editable:hover rect, #view .pill.editable:focus rect { stroke: var(--sel); stroke-width: 1.4; }
#view .pill.editable:focus { outline: none; }

/* editors in the drawing */
.stage { position: relative; }
.rv-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); }
.rv-edit input { width: 82px; border: 0; outline: none; font: inherit; font-size: 13px; text-align: right; font-variant-numeric: tabular-nums; padding: 3px 2px; }
.rv-edit-name input { width: 180px; text-align: center; }
.rv-edit span { font-size: 11.5px; color: var(--text-3); white-space: nowrap; }

/* live strip and flags */
.rv-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: 38px; align-items: center; }
.rv-live b { font-weight: 500; color: var(--text-3); margin-right: 5px; }
.rv-live i { font-style: normal; color: var(--text-3); }
.rv-flags { display: inline-flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.rv-flags span { display: inline-flex; align-items: center; font-size: 11.5px; line-height: 1; color: var(--text-3); border: 1px solid var(--line); border-radius: 999px; padding: 4px 10px; white-space: nowrap; }
.rv-flags span.bad, .rv-flags span.rv-err { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 35%, transparent); white-space: normal; }

/* panel */
.rv-seg { margin-bottom: 6px; }
.rv-chips { display: flex; flex-wrap: wrap; gap: 4px; margin: 2px 0 8px; }
.rv-chip { display: inline-flex; align-items: center; line-height: 1.2; border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 3px 10px; font-size: 12px; color: var(--text-2); cursor: pointer; font-variant-numeric: tabular-nums; font-family: inherit; }
.rv-chip:hover { border-color: var(--line-2); }
.rv-chip.on { border-color: var(--text); color: var(--text); font-weight: 500; }
#panel input.bad { color: var(--bad); }
#panel .num:has(input.bad) input { border-color: var(--bad); }
#panel select { max-width: 100%; }
#panel .f.sel { grid-template-columns: auto minmax(0, 1fr); }
#panel .f.sel select { min-width: 0; width: 100%; }
#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); }

/* summary */
.rv-say { margin-top: 6px; font-size: 12.5px; color: var(--text-2); line-height: 1.4; max-width: 38ch; }
.rv-des { font-weight: 600; color: var(--x-1e4fbf, #1e4fbf); }
.rv-tag { display: inline-flex; align-items: center; font-size: 10.5px; line-height: 1; color: var(--good); border: 1px solid color-mix(in srgb, var(--good) 35%, transparent); border-radius: 999px; padding: 3px 7px; margin-left: 6px; white-space: nowrap; vertical-align: 1px; }

/* chart, sizes */
#rChart { touch-action: none; user-select: none; }
#rChart .cdrag { cursor: ew-resize; }
table.rv-bear { width: 100%; border-collapse: collapse; font-size: 12.5px; font-variant-numeric: tabular-nums; }
.rv-bear th { font-weight: 500; font-size: 11.5px; color: var(--text-3); text-align: right; padding: 6px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.rv-bear td { text-align: right; padding: 5px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.rv-bear th.l, .rv-bear td.l { text-align: left; }


.rv-bear tr.sel td { background: var(--sel-bg); }
#checks td.note { white-space: normal; min-width: 200px; line-height: 1.4; }

@media (max-width: 760px) {
  table.rv-bear thead { display: none; }
  table.rv-bear, .rv-bear tbody, .rv-bear tr, .rv-bear td { display: block; width: 100%; }
  .rv-bear tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
  .rv-bear td { border: 0; padding: 0; text-align: left; white-space: normal; }
  .rv-bear td:nth-child(1) { font-weight: 500; }
  .rv-bear td:nth-child(2) { grid-column: 2; grid-row: 1; text-align: right; color: var(--text-3); }
  .rv-bear td:nth-child(3)::before { content: "αd "; color: var(--text-3); }
  .rv-bear td:nth-child(4)::before { content: "k1 "; color: var(--text-3); }
  .rv-bear td:nth-child(5)::before { content: "αb "; color: var(--text-3); }
  .rv-bear td:nth-child(6)::before { content: "plate 1 "; color: var(--text-3); }
  .rv-bear td:nth-child(7)::before { content: "plate 2 "; color: var(--text-3); }
  #checks thead { display: none; }
  #checks, #checks tbody { display: block; width: 100%; }
  #checks tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 10px; padding: 9px 0; border-bottom: 1px solid var(--line); }
  #checks td { display: block; border: 0; padding: 0; text-align: left; white-space: normal; }
  #checks td.chk { grid-column: 1; grid-row: 1; }
  #checks td:nth-child(5) { grid-column: 2; grid-row: 1; align-self: center; }
  #checks td:nth-child(2) { grid-column: 1; grid-row: 2; font-size: 12.5px; }
  #checks td:nth-child(3) { grid-column: 2; grid-row: 2; font-size: 12.5px; text-align: right; }
  #checks td:nth-child(2)::before { content: "actual "; color: var(--text-3); }
  #checks td:nth-child(3)::before { content: "allowed "; color: var(--text-3); }
  #checks td:nth-child(4) { grid-column: 1 / -1; grid-row: 3; font-size: 12px; color: var(--text-3); min-width: 0; }
}
@media print { .rv-edit { display: none !important; } }

/* 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-1e4fbf: #749ff5; --x-4b5563: #939ca9; --x-6e7177: #85827f; --x-8a5a32: #c79c7b; --x-8f979f: #61676d;
    --x-9a6a12: #d0a66a; --x-b0321f: #ef8470;
  }
}
@media screen {
  :root[data-theme="dark"] {
    --x-1e4fbf: #749ff5; --x-4b5563: #939ca9; --x-6e7177: #85827f; --x-8a5a32: #c79c7b; --x-8f979f: #61676d;
    --x-9a6a12: #d0a66a; --x-b0321f: #ef8470;
  }
}
/* theme-auto:end */
