/* Rock mass classification — on top of calc.css */
main.rm { --rm-rock: var(--rock); --rm-rock-2: var(--x-ddd8cf, #ddd8cf); --rm-joint: var(--x-8d867b, #8d867b); --rm-void: var(--surface-2); --rm-bolt: var(--moment); --rm-short: var(--bad); --rm-shot: var(--x-9aa7b4, #9aa7b4); --rm-need: var(--warn); --rm-plot: var(--surface); --rm-grid: var(--fill-1); --rm-pill: var(--surface); --rm-pill-line: var(--steel-300); --rm-c1: var(--bg); --rm-c2: var(--x-f1f4e3, #f1f4e3); --rm-c3: var(--warn-bg); --rm-c4: var(--x-f6e5cc, #f6e5cc); --rm-c5: var(--x-f3dac2, #f3dac2); --rm-c6: var(--x-efceb8, #efceb8); --rm-c7: var(--x-eac2b0, #eac2b0); --rm-c8: var(--x-e3b3a6, #e3b3a6); --rm-c9: var(--steel-blue); }
main.rm .tabs { grid-template-columns: repeat(4, 1fr); }
main.rm .stage-bar { justify-content: flex-start; gap: 8px; flex-wrap: wrap; }
main.rm .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 .knob { fill: var(--rm-pill); stroke: var(--sel); stroke-width: 1.8; }
#view .handle:hover .knob, #view .handle:focus .knob { fill: var(--sel); }

/* the section */
.rm-rock { fill: var(--rm-rock); }
.rm-void { fill: var(--rm-void); stroke: var(--ink); stroke-width: 1.4; stroke-linejoin: round; }
.rm-joint { fill: none; stroke: var(--rm-joint); stroke-width: .8; stroke-linecap: round; opacity: .55; pointer-events: none; }
.rm-joint.r { stroke-width: .7; opacity: .45; }
.rm-shot { fill: var(--rm-shot); stroke: none; opacity: .85; pointer-events: none; }
.rm-bolt { stroke: var(--rm-bolt); stroke-width: 2; stroke-linecap: round; pointer-events: none; }
.rm-bolt.short { stroke: var(--rm-short); }
.rm-plate { fill: var(--rm-bolt); pointer-events: none; }
.rm-need { fill: none; stroke: var(--rm-need); stroke-width: 1.3; stroke-dasharray: 6 4; pointer-events: none; }
.rm-dim { fill: none; stroke: var(--steel-550); stroke-width: .9; pointer-events: none; }
.rm-cl { fill: none; stroke: var(--steel-500); stroke-width: .7; stroke-dasharray: 8 3 1.5 3; pointer-events: none; }
.rm-floor { fill: none; stroke: var(--ink); stroke-width: 1.4; }
.rm-surf { fill: none; stroke: var(--ink); stroke-width: 1.1; stroke-dasharray: 2 3; }
.rm-name { font-size: 12.5px; font-weight: 600; fill: var(--text); }
.rm-role { font-size: 11px; fill: var(--text-3); }
.rm-nm { cursor: text; }
.rm-nm:hover .rm-name, .rm-nm:focus .rm-name { fill: var(--sel); }
.rm-nm:focus { outline: none; }
.rm-halo-t { paint-order: stroke; stroke: var(--rm-rock); stroke-width: 4px; stroke-linejoin: round; }
.rm-legend { font-size: 11px; fill: var(--text-2); }

/* pills */
#view .pill rect { fill: var(--rm-pill); stroke: var(--rm-pill-line); }
#view .pill text { font-size: 11.5px; font-weight: 500; fill: var(--text-2); font-variant-numeric: tabular-nums; }
#view .pill.bolt rect { stroke: color-mix(in srgb, var(--moment) 50%, transparent); } #view .pill.bolt text { fill: var(--x-2c4a91, #2c4a91); font-weight: 600; }
#view .pill.need rect { stroke: color-mix(in srgb, var(--warn) 55%, transparent); } #view .pill.need text { fill: var(--wip-ink); font-weight: 600; }
#view .pill.bad rect { stroke: color-mix(in srgb, var(--bad) 55%, transparent); } #view .pill.bad text { fill: var(--x-b0321f, #b0321f); font-weight: 600; }
#view .pill.qq rect { stroke: rgba(23, 24, 26, .35); } #view .pill.qq text { fill: var(--text); font-weight: 600; }
#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; }
.rm-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); }
.rm-edit input { width: 82px; border: 0; outline: none; font: inherit; font-size: 13px; text-align: right; font-variant-numeric: tabular-nums; padding: 3px 2px; background: transparent; color: var(--text); }
.rm-edit-name input { width: 200px; text-align: center; }
.rm-edit span { font-size: 11.5px; color: var(--text-3); white-space: nowrap; }

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

/* panel */
.rm-seg { margin-bottom: 6px; }
.rm-lab { font-size: 12px; color: var(--text-3); margin: 8px 0 4px; }
.rm-chips { display: flex; flex-wrap: wrap; gap: 4px; margin: 2px 0 6px; }
.rm-chip { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 2px 10px; font-size: 12px; color: var(--text-2); cursor: pointer; font-variant-numeric: tabular-nums; }
.rm-chip:hover { border-color: var(--line-2); }
.rm-chip.on { border-color: var(--text); color: var(--text); font-weight: 500; }
.rm-desc { font-size: 12px; color: var(--text-3); line-height: 1.4; margin: -2px 0 8px; }
.rm-desc b { color: var(--text-2); font-weight: 500; }
#panel input.bad { color: var(--bad); }
#panel .num:has(input.bad) input { border-color: var(--bad); }
#panel .small-note a { color: inherit; }
#panel .f.sel select { min-width: 0; }
#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); }
.rm-check { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-2); margin: 6px 0; cursor: pointer; }
.rm-check input { margin: 0; }

/* summary */
.rm-say { margin-top: 6px; font-size: 12.5px; color: var(--text-2); line-height: 1.4; max-width: 38ch; }
.rm-big { font-weight: 600; color: var(--text); }
.rm-tag { display: inline-flex; align-items: center; font-size: 10.5px; color: var(--text-3); border: 1px solid var(--line); border-radius: 999px; padding: 0 7px; margin-left: 4px; white-space: nowrap; line-height: 1.5; }

/* three systems */
.rm-three { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.rm-sys h3 { font-size: 13px; font-weight: 600; margin: 0 0 6px; display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.rm-sys h3 span { font-weight: 500; color: var(--text-3); font-size: 12px; }
.rm-sys table { width: 100%; border-collapse: collapse; font-size: 12.5px; font-variant-numeric: tabular-nums; }
.rm-sys td { padding: 4px 0; border-bottom: 1px solid var(--line); vertical-align: top; color: var(--text-2); }
.rm-sys td:last-child { text-align: right; color: var(--text); font-weight: 500; white-space: nowrap; padding-left: 10px; }
.rm-sys tr.tot td { border-bottom: 0; font-weight: 600; color: var(--text); padding-top: 6px; }
.rm-sys tr.on td { color: var(--text); }
.rm-sys tr.on td:first-child::after { content: " · used"; color: var(--sel); font-weight: 500; }
.rm-sys small { color: var(--text-3); }

/* charts */
.rm-two { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }
#qChart, #psChart, #tnChart, #corrChart { touch-action: none; user-select: none; }
#qChart .cdrag, #psChart .cdrag { cursor: ns-resize; }
#psChart .cdrag { cursor: ew-resize; }
#checks td.note { white-space: normal; min-width: 200px; line-height: 1.4; }

@media (max-width: 1100px) { .rm-two { grid-template-columns: minmax(0, 1fr); } .rm-three { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
@media (max-width: 760px) {
  .rm-three { grid-template-columns: minmax(0, 1fr); }
  #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: "installed "; color: var(--text-3); }
  #checks td:nth-child(3)::before { content: "needed "; 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 { .rm-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-000000: #ffffff; --x-2c4a91: #81a0e0; --x-6e7177: #85827f; --x-8d867b: #767068; --x-9aa7b4: #525c65;
    --x-b0321f: #ef8470; --x-cfc9be: #45413a; --x-d8d2c6: #3f3b33; --x-ddd8cf: #3b3832; --x-e3b3a6: #967268;
    --x-eac2b0: #62463a; --x-efceb8: #4b3527; --x-f1f4e3: #282a1f; --x-f3dac2: #413121; --x-f6e5cc: #382d1d;
  }
}
@media screen {
  :root[data-theme="dark"] {
    --x-000000: #ffffff; --x-2c4a91: #81a0e0; --x-6e7177: #85827f; --x-8d867b: #767068; --x-9aa7b4: #525c65;
    --x-b0321f: #ef8470; --x-cfc9be: #45413a; --x-d8d2c6: #3f3b33; --x-ddd8cf: #3b3832; --x-e3b3a6: #967268;
    --x-eac2b0: #62463a; --x-efceb8: #4b3527; --x-f1f4e3: #282a1f; --x-f3dac2: #413121; --x-f6e5cc: #382d1d;
  }
}
/* theme-auto:end */
