/* O-ring gland — on top of calc.css */
main.orn .stage-bar { justify-content: flex-start; gap: 8px; flex-wrap: wrap; }
main.orn .stage-bar .hist { margin-left: auto; }
main.orn .stage-bar .btn.small { padding: 4px 10px; font-size: 12.5px; }
#motionSeg[hidden] { display: none; }

#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.refused { animation: or-refuse .4s; }
@keyframes or-refuse { 30% { transform: translateX(-3px); } 60% { transform: translateX(3px); } }
#view .part { fill: url(#hatch); stroke: var(--steel-700); stroke-width: 1.1; stroke-linejoin: round; }
#view .part.mate { fill: var(--steel-50); }
#view .ring { stroke: var(--x-1f2226, #1f2226); stroke-width: 1; }
#view .ring.over { stroke: var(--bad); stroke-width: 2; }
#view .free { fill: none; stroke: var(--steel-550); stroke-width: 1.3; stroke-dasharray: 5 4; }
#view .band { fill: color-mix(in srgb, var(--sel) 13%, transparent); }
#view .dl { stroke: var(--x-7b848c, #7b848c); stroke-width: .9; }
#view .ext { stroke: var(--steel-400); stroke-width: .7; }
#view .parrow { stroke: var(--load); stroke-width: 1.8; }
#view .handle { cursor: grab; }
#view .handle .hit { fill: transparent; }
#view .handle .knob { fill: var(--surface); stroke: var(--sel); stroke-width: 1.8; }
#view .handle:hover .knob { fill: var(--sel); }
#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) 40%, transparent); } #view .pill.load text { fill: var(--load); font-weight: 600; }
#view .pill.bad rect { stroke: var(--bad); } #view .pill.bad text { fill: var(--bad); font-weight: 600; }
#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; }
#view .lgd text { font-size: 11px; fill: var(--text-3); }
#view .ins-bg { fill: var(--surface); stroke: var(--steel-200); }
#view .ins-t { font-size: 11px; fill: var(--text-3); }

.or-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; }
.or-live b { font-weight: 500; color: var(--text-3); margin-right: 4px; }

.or-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); }
.or-edit input { width: 82px; border: 0; outline: none; font: inherit; font-size: 13px; text-align: right; font-variant-numeric: tabular-nums; padding: 3px 2px; }
.or-edit span { font-size: 11.5px; color: var(--text-3); }
main.orn .stage { position: relative; }

/* panel */
.f.tol { grid-template-columns: minmax(0, 1fr) 190px; }
.f.tol > label { grid-template-columns: 26px minmax(0, 1fr); }
main.orn .f.sel > label { display: block; }
.tol3 { display: grid; grid-template-columns: 82px 50px 50px; gap: 4px; }
.tol3 .num input { padding-right: 6px; text-align: right; }
.tol3 .dev input { font-size: 12px; color: var(--text-2); }
.tol-h { display: grid; grid-template-columns: minmax(0, 1fr) 82px 50px 50px; gap: 4px; padding-left: 0; font-size: 11px; color: var(--text-3); margin: -2px 0 2px; }
.tol-h span { text-align: right; padding-right: 6px; }
.tol-h span:first-child { grid-column: 1; }
#panel input.bad { color: var(--bad); }
#panel .num:has(input.bad) { border-color: var(--bad); }
.grp-h .aside b { font-weight: 600; color: var(--text); }
.mats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; margin-bottom: 8px; }
.mat { display: grid; gap: 1px; text-align: left; padding: 6px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); cursor: pointer; font-size: 12.5px; color: var(--text); }
.mat span { font-size: 11.5px; color: var(--text-3); }
.mat:hover { border-color: var(--line-2); }
.mat.on { border-color: var(--text); box-shadow: inset 0 0 0 1px var(--text); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip.on { border-color: var(--text); color: var(--text); background: var(--surface); }
.chip small { color: var(--text-3); font-size: 11px; margin-left: 2px; }
.seg.full { display: flex; width: 100%; }
.seg.full button { flex: 1; }
ul.plain { margin: 0; padding-left: 18px; font-size: 12.5px; color: var(--text-2); }
ul.plain li { margin: 2px 0; }

/* margins table: icon + name */
table.orms td.chk { display: flex; align-items: center; gap: 10px; white-space: normal; }
table.orms td.chk .th { flex: none; width: 46px; height: 46px; margin: -6px 0; border-radius: 8px; }
table.orms td.chk:focus-visible { outline: 2px solid var(--sel); outline-offset: -2px; border-radius: 6px; }
table.orms td.note { color: var(--text-3); font-size: 12px; white-space: normal; min-width: 180px; }
table.orms tr.guide td { color: var(--text-2); }
table.orms .both { display: none; text-align: right; }
table.orms .both small { display: block; font-size: 11.5px; color: var(--text-3); }
table.orms th.both small { display: block; font-weight: 400; }
.gtag { font-style: normal; font-size: 11px; color: var(--text-3); border: 1px solid var(--line); border-radius: 999px; padding: 1px 8px; margin-left: 4px; white-space: nowrap; }
.or-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); }
.or-pv[hidden] { display: none; }
.or-pv svg { display: block; width: 220px; height: auto; margin: 4px 0 6px; }
.or-pv .pv-h { font-weight: 600; font-size: 12px; }
.or-pv .pv-c { color: var(--text-2); line-height: 1.35; }
.or-pv .pv-m { margin-top: 4px; color: var(--text-3); }
@media print { .or-pv { display: none !important; } }

/* charts */
.or-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.or-row svg { display: block; width: 100%; height: auto; user-select: none; }
#extChart { touch-action: none; }
.or-row .frame { fill: var(--surface); stroke: var(--line); }
.or-row .grid { stroke: var(--fill-1); }
.or-row .zline { stroke: var(--text-3); stroke-width: 1; }
.or-row text { fill: var(--text-2); }
.or-row .ch-t { font-size: 10.5px; fill: var(--text-3); font-variant-numeric: tabular-nums; }
.or-row .ch-a { font-size: 11px; fill: var(--text-2); }
.or-row .ch-h { font-size: 12px; font-weight: 600; fill: var(--text); }
.or-row .ch-l { font-size: 11px; font-weight: 600; fill: var(--text-2); }
.or-row .ch-l.on { fill: var(--text); }
.or-row .halo { paint-order: stroke; stroke: var(--halo); stroke-width: 3.5px; stroke-linejoin: round; }
.or-row .badt { fill: var(--bad); font-weight: 600; }
.or-row .okreg { fill: color-mix(in srgb, var(--good) 8%, transparent); }
.or-row .recband { fill: none; stroke: color-mix(in srgb, var(--good) 45%, transparent); stroke-dasharray: 3 3; }
.or-row .nomline { stroke: var(--text-2); stroke-width: 1; stroke-dasharray: 2 3; }
.or-row .limline { stroke: var(--warn); stroke-width: 1.2; stroke-dasharray: 4 3; }
.or-row .sbar { fill: var(--steel-350); }
.or-row .sbar.end { fill: var(--steel-700); }
.or-row .sbar.bad { fill: var(--bad); }
.or-row .lgd2 text { font-size: 11px; fill: var(--text-3); }
.or-row .ecurve { fill: none; stroke: var(--steel-400); stroke-width: 1.3; }
.or-row .ecurve.on { stroke: var(--text); stroke-width: 2; }
.or-row .pline { cursor: ns-resize; }
.or-row .pline .hit { fill: transparent; }
.or-row .pline .pl { stroke: var(--load); stroke-width: 1.4; }
.or-row .pill.axis { cursor: ns-resize; }
.or-row .pill.axis rect { fill: var(--surface); stroke: color-mix(in srgb, var(--load) 50%, transparent); }
.or-row .pill.axis text { font-size: 11px; font-weight: 600; fill: var(--load); }
.or-row .xdot { fill: var(--surface); stroke: var(--text); stroke-width: 2; }

/* sizes */
.sz-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 10px; }
.sz-search input { width: 230px; max-width: 100%; border: 1px solid var(--line-2); border-radius: 8px; padding: 6px 10px; font-size: 13px; outline: none; background: var(--surface); }
.sz-search input:focus { border-color: var(--text); }
.sz-n { font-size: 12px; color: var(--text-3); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.sz-wrap { max-height: 360px; overflow: auto; border: 1px solid var(--line); border-radius: 8px; }
table.sz { width: 100%; border-collapse: collapse; font-size: 12.5px; font-variant-numeric: tabular-nums; }
table.sz th { position: sticky; top: 0; background: var(--surface-2); font-weight: 500; font-size: 11.5px; color: var(--text-3); text-align: right; padding: 6px 10px; border-bottom: 1px solid var(--line); }
table.sz td { text-align: right; padding: 4px 10px; border-bottom: 1px solid var(--fill-1); white-space: nowrap; }
table.sz .l { text-align: left; }
table.sz tr.on td { background: var(--sel-bg); font-weight: 500; }
table.sz .use { border: 1px solid var(--line-2); background: var(--surface); border-radius: 999px; padding: 1px 10px; font-size: 11.5px; cursor: pointer; color: var(--text-2); }
table.sz .use:hover { border-color: var(--text); color: var(--text); }

/* suggest dialog */
.sg-form { display: flex; gap: 10px; align-items: center; font-size: 13px; color: var(--text-2); }
.sg-form label { display: flex; gap: 8px; align-items: center; }
.sg-form .num input { width: 120px; }
.rec-card { grid-template-columns: 96px minmax(0, 1fr) auto; }
.rec-card.no { grid-template-columns: 96px minmax(0, 1fr) auto; }

main.orn .summary { min-height: 120px; }
@media (max-width: 1040px) {
  main.orn .work { display: contents; }
  main.orn > * { order: 3; }
  main.orn .stage { order: 0; }
  main.orn .summary { order: 1; }
  main.orn .panel { order: 2; }
  .or-row { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 560px) {
  table.orms td.note { display: none; }
  table.orms th:nth-child(5) { display: none; }
  table.orms .av { display: none; }
  table.orms .both { display: table-cell; }
  table.orms td.chk { gap: 8px; }
  .f.tol { grid-template-columns: minmax(0, 1fr); }
  .tol-h { grid-template-columns: 82px 50px 50px; }
  .tol-h span:first-child { display: none; }
  .sz-search input { width: 180px; }
  .mats { grid-template-columns: minmax(0, 1fr); }
}
#view .ring-i { stroke: none; }
#view .sqz { fill: color-mix(in srgb, var(--load) 22%, transparent); }
#view .parr { stroke: var(--load); stroke-width: 1.4; }
#view .axis { stroke: var(--x-7b848c, #7b848c); stroke-width: .9; stroke-dasharray: 14 3 2 3; }
#view .brk { fill: none; stroke: var(--x-7b848c, #7b848c); stroke-width: 1; }
#view .pill.sqzp rect { fill: color-mix(in srgb, var(--surface) 94%, transparent); stroke: color-mix(in srgb, var(--load) 45%, transparent); }
#view .pill.sqzp text { fill: var(--load-ink); font-weight: 600; }
#view .sqldr { fill: none; stroke: color-mix(in srgb, var(--load-ink) 55%, transparent); stroke-width: .8; }
#view .sqdot { fill: var(--load-ink); }
main.orn .tabs { grid-template-columns: repeat(5, minmax(0, 1fr)); }
/* the panel scrolls inside the stage's height; when there is more below, the bottom edge fades instead of cutting */
main.orn .panel-body { padding-bottom: 28px; }
main.orn .panel-body.more { -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 40px), transparent); mask-image: linear-gradient(to bottom, #000 calc(100% - 40px), transparent); }
/* the size list fades at its bottom edge too, and keeps its last row clear of the fade */
.sz-wrap { -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 28px), transparent); mask-image: linear-gradient(to bottom, #000 calc(100% - 28px), transparent); padding-bottom: 24px; }
@media (max-width: 560px) { table.sz .pm { display: none; } table.sz th, table.sz td { padding-left: 6px; padding-right: 6px; } }
/* the panel grows with its content instead of scrolling (nothing is ever cut at its bottom edge) */
main.orn .panel { contain: none; }
main.orn .panel-body { overflow: visible; }
main.orn .f > label span { white-space: normal; overflow: visible; text-overflow: clip; }
@media (max-width: 560px) {
  table.orms td, table.orms th { padding-left: 4px; padding-right: 4px; }
  table.orms .ms { min-width: 0; padding: 2px 6px; }
  table.orms td.chk { gap: 6px; }
}
@media (max-width: 560px) { .rec-card, .rec-card.no { grid-template-columns: minmax(0, 1fr); gap: 6px; } .rec-card .btn { justify-self: start; } }

/* examples with a drawn thumbnail of each preset's gland */
main.orn .stage { overflow: visible; }   /* the examples menu may reach past the stage card */
main.orn .ex-wrap { position: relative; }
main.orn .ex-menu { position: absolute; top: calc(100% + 6px); left: 0; z-index: 45; 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: 440px; max-width: calc(100vw - 32px); }
main.orn .ex-menu[hidden] { display: none; }
main.orn .ex-menu button { border: 0; background: none; text-align: left; padding: 7px 10px; border-radius: 7px; cursor: pointer; font: inherit; font-size: 13px; color: var(--text); display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 12px; align-items: center; }
main.orn .ex-menu .ex-th { width: 96px; height: 64px; display: block; }
main.orn .ex-menu .ex-th svg { display: block; border-radius: 6px; background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line); }
main.orn .ex-menu .ex-tx { display: grid; gap: 1px; min-width: 0; }
main.orn .ex-menu button small { color: var(--text-3); font-size: 11.5px; line-height: 1.35; }
main.orn .ex-menu button:hover, main.orn .ex-menu button:focus-visible { background: var(--fill-1); outline: none; }
@media (max-width: 560px) {
  main.orn .stage-bar { position: relative; } main.orn .stage-bar .ex-wrap { position: static; }
  main.orn .ex-menu { top: auto; left: 8px; right: 8px; margin-top: 6px; min-width: 0; max-width: none; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  main.orn .ex-menu button { grid-template-columns: minmax(0, 1fr); gap: 6px; align-items: start; border: 1px solid var(--line); }
  main.orn .ex-menu .ex-th { width: 100%; height: auto; } main.orn .ex-menu .ex-th svg { width: 100%; height: auto; }
}

/* the rubber of the ring keeps its colour as a material in dark: black NBR, brown-black FKM, green-black EPDM, red
   silicone (light uses the fallbacks in app.js's MATCOL, so light and exports are unchanged) */
@media screen and (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --or-nbr: #121315; --or-fkm: #2a1d21; --or-epdm: #16201c; --or-vmq: #93402f; }
  :root:not([data-theme="light"]) #view .or-sw { stroke: var(--text-4); stroke-width: .8; }
}
@media screen {
  :root[data-theme="dark"] { --or-nbr: #121315; --or-fkm: #2a1d21; --or-epdm: #16201c; --or-vmq: #93402f; }
  :root[data-theme="dark"] #view .or-sw { stroke: var(--text-4); stroke-width: .8; }
}

/* 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-1f2226: #cfccc8; --x-5b616b: #8c919a; --x-6e7177: #85827f; --x-7b848c: #6e767c;
  }
}
@media screen {
  :root[data-theme="dark"] {
    --x-1f2226: #cfccc8; --x-5b616b: #8c919a; --x-6e7177: #85827f; --x-7b848c: #6e767c;
  }
}
/* theme-auto:end */
