/* Process capability and SPC — on top of calc.css */
main.pc .tabs { grid-template-columns: repeat(3, 1fr); }
main.pc .stage-bar { justify-content: flex-start; gap: 8px; flex-wrap: wrap; }
main.pc .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.hl { cursor: ew-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); }

/* the histogram */
.pc-plot { fill: var(--surface); stroke: var(--faint); stroke-width: 1; }
.pc-grid { fill: var(--fill-1); stroke: none; }
.pc-tick { font-size: 11px; fill: var(--text-3); font-variant-numeric: tabular-nums; }
.pc-axt { font-size: 11.5px; fill: var(--text-3); }
.pc-bar { fill: var(--x-cfd6e4, #cfd6e4); stroke: none; }
.pc-bar.out { fill: var(--x-e7b1a9, #e7b1a9); }
.pc-tail { fill: color-mix(in srgb, var(--bad) 16%, transparent); stroke: none; }
.pc-cw { fill: none; stroke: var(--ink); stroke-width: 2; }
.pc-co { fill: none; stroke: var(--steel-600); stroke-width: 1.4; stroke-dasharray: 6 4; }
.pc-mean { fill: none; stroke: var(--moment); stroke-width: 1.1; stroke-dasharray: 3 3; }
.pc-3s { fill: none; stroke: var(--ink); stroke-width: 1.4; }
.pc-lim { fill: none; stroke: var(--bad); stroke-width: 1.6; }
.pc-ll { font-size: 11px; font-weight: 500; fill: var(--text-3); }
.pc-ll.w { fill: var(--ink); }

/* 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.lim rect { stroke: color-mix(in srgb, var(--bad) 50%, transparent); } #view .pill.lim text { fill: var(--x-b0321f, #b0321f); font-weight: 600; }
#view .pill.mp rect { stroke: color-mix(in srgb, var(--moment) 45%, transparent); } #view .pill.mp text { fill: var(--x-2c4a91, #2c4a91); font-weight: 600; }
#view .pill.kp text { font-weight: 600; }
#view .pill.kp.good text { fill: var(--olive); } #view .pill.kp.warn text { fill: var(--x-8a5a0e, #8a5a0e); } #view .pill.kp.bad 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; }
.pc-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); }
.pc-edit input { width: 82px; border: 0; outline: none; font: inherit; font-size: 13px; text-align: right; font-variant-numeric: tabular-nums; padding: 3px 2px; }
.pc-edit span { font-size: 11.5px; color: var(--text-3); white-space: nowrap; }

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

/* panel */
.pc-seg { margin-bottom: 6px; }
.pc-ta { width: 100%; box-sizing: border-box; min-height: 220px; resize: vertical; font: 12.5px/1.45 ui-monospace, SFMono-Regular, Menlo, monospace; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; background: var(--surface); color: var(--text); tab-size: 8; white-space: pre; overflow-wrap: normal; }
.pc-ta.bad { border-color: var(--bad); }
.pc-text { width: 100%; box-sizing: border-box; font: inherit; font-size: 13px; border: 1px solid var(--line); border-radius: 8px; padding: 6px 9px; background: var(--surface); color: var(--text); }
#panel input.bad { color: var(--bad); }
#panel .num:has(input.bad) input { border-color: var(--bad); }
#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 */
.pc-say { margin-top: 6px; font-size: 12.5px; color: var(--text-2); line-height: 1.4; max-width: 40ch; }
.pc-big { font-weight: 600; color: var(--x-8f4a20, #8f4a20); }

/* charts and the rank table */
.pc-two { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }
#checks td.note { white-space: normal; min-width: 200px; line-height: 1.4; }

@media (max-width: 1100px) { .pc-two { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 760px) {
  #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 { .pc-edit { display: none !important; } }

/* control charts and gauge */
#ccChart { display: block; width: 100%; height: auto; }
.pc-ucl { fill: none; stroke: var(--bad); stroke-width: 1.1; stroke-dasharray: 6 4; }
.pc-cl { fill: none; stroke: var(--text-2); stroke-width: 1.1; }
.pc-run { fill: none; stroke: var(--x-8f979f, #8f979f); stroke-width: 1.1; }
.pc-dot { fill: var(--ink); stroke: var(--halo); stroke-width: 1; }
.pc-dot.bad { fill: var(--bad); }
.pc-cll { font-size: 11px; fill: var(--text-3); font-variant-numeric: tabular-nums; }
.pc-cll.u { fill: var(--x-b0321f, #b0321f); }
.pc-g { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
.pc-g th { font-weight: 500; color: var(--text-3); text-align: right; padding: 4px 8px; border-bottom: 1px solid var(--line); }
.pc-g td { text-align: right; padding: 5px 8px; border-bottom: 1px solid var(--fill-1); }
.pc-g .l { text-align: left; }
.pc-g tbody tr:nth-child(3) td { font-weight: 600; }
.pc-goff { font-size: 13px; color: var(--text-2); }
.linkish { border: 0; background: none; padding: 0; font: inherit; color: var(--sel); text-decoration: underline; cursor: pointer; }

/* 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-2c4a91: #81a0e0; --x-6e7177: #85827f; --x-8a5a0e: #c89e6a; --x-8f4a20: #d19372; --x-8f979f: #61676d;
    --x-b0321f: #ef8470; --x-cfd6e4: #353a43; --x-e7b1a9: #ad837d;
  }
}
@media screen {
  :root[data-theme="dark"] {
    --x-2c4a91: #81a0e0; --x-6e7177: #85827f; --x-8a5a0e: #c89e6a; --x-8f4a20: #d19372; --x-8f979f: #61676d;
    --x-b0321f: #ef8470; --x-cfd6e4: #353a43; --x-e7b1a9: #ad837d;
  }
}
/* theme-auto:end */
