/* Free-tool pages (the G-code viewer first). Builds on the css/editorial.css tokens. Spec §8. */
:root {
  --gv-feed: #0d7a3e;      /* = --accent */
  --gv-rapid: #b8741a;     /* amber, dashed */
  --gv-pass: #4a6f8f;      /* slate: passes the control generates */
  --gv-profile: #8a897f;   /* R5: lighter than --gv-feed (luminance 0.248 vs 0.144), still >=3:1 on white/paper */
  --gv-hi: #c2410c;        /* hover highlight */
  --gv-mono: ui-monospace, 'Cascadia Mono', Consolas, 'Courier New', monospace; /* program panel only */
  --gv-line-h: 20px;       /* must equal LINE_H in js/gcode/shell/program-panel.js */
}

/* Tool-page nav: back link + language switcher on one row (same as calculator.html's inline styles) */
:root {
  --ic-arrow-l: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M19 12H6M12 5l-7 7 7 7'/%3E%3C/svg%3E");
}
.nav-right { display: flex; align-items: center; gap: 1.25rem; }
.nav-back {
  display: inline-flex; align-items: center; gap: 0.4rem;
  color: var(--muted); text-decoration: none;
  font-family: var(--font-mono); font-weight: 400; font-size: 0.72rem;
  letter-spacing: 0.1em; text-transform: uppercase;
  transition: color 0.2s ease;
}
.nav-back:hover { color: var(--ink); }
.nav-back::before {
  content: ''; width: 1em; height: 1em; flex: none;
  background-color: currentColor;
  -webkit-mask: var(--ic-arrow-l) center / contain no-repeat;
          mask: var(--ic-arrow-l) center / contain no-repeat;
  transition: transform 0.25s ease;
}
.nav-back:hover::before { transform: translateX(-3px); }
@media (max-width: 768px) { .nav-back { display: none; } }

.gv { background: var(--paper); }
.gv [hidden] { display: none !important; }   /* a class display rule must never beat the hidden attribute */
.gv-head { text-align: center; padding: clamp(2.5rem, 6vw, 4.5rem) 16px clamp(1.5rem, 3vw, 2.5rem); border-bottom: 1px solid var(--line); }
.gv-eyebrow { font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.18em; text-transform: uppercase; color: var(--muted); margin: 0 0 1rem; }
.gv-head h1 { font-family: var(--font-display); font-weight: 300; font-size: clamp(1.7rem, 3.6vw, 2.5rem); line-height: 1.1; letter-spacing: -0.02em; color: var(--ink); margin: 0 0 0.8rem; }
.gv-lede { max-width: 640px; margin: 0 auto 0.6rem; color: var(--ink-soft); font-size: 1.05rem; line-height: 1.6; }
.gv-privacy { color: var(--muted); font-size: 0.85rem; margin: 0; }
.gv-wrap { max-width: 1320px; margin: 0 auto; padding: 0 16px; }
@media (min-width: 720px) { .gv-wrap { padding: 0 clamp(1.25rem, 3vw, 2.5rem); } }

.gv-bar { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; padding: 1rem 0; }
.gv-btn { display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.55rem 0.9rem; border: 1px solid var(--line-strong); background: var(--panel); color: var(--ink); font-family: var(--font-body); font-size: 0.9rem; font-weight: 500; border-radius: 2px; cursor: pointer; }
.gv-btn:hover { border-color: var(--accent-deep); color: var(--accent-deep); }
.gv-btn-primary { background: var(--ink); color: #fff; border-color: var(--ink); }
.gv-btn-primary:hover { background: var(--accent-deep); border-color: var(--accent-deep); color: #fff; }
/* Keyboard file open (item 2): the input stays in the layout and focusable, unlike display:none. */
.gv-visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; opacity: 0; }
.gv-file-label:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.gv-settings { flex-basis: 100%; }
.gv-settings summary { cursor: pointer; color: var(--muted); font-size: 0.9rem; }
.gv-settings-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 0.6rem 1rem; padding: 0.8rem 0; }
.gv-settings-grid label { display: flex; flex-direction: column; gap: 0.25rem; font-size: 0.8rem; color: var(--muted); }
.gv-settings-grid select, .gv-settings-grid input, .gv-settings-grid output { display: block; font-family: var(--font-body); font-size: 0.9rem; padding: 0.4rem 0.5rem; border: 1px solid var(--line-strong); background: var(--panel); color: var(--ink); border-radius: 2px; min-width: 0; }
.gv-banner { margin: 0 0 1rem; padding: 0.7rem 0.9rem; border: 1px solid var(--line-strong); background: var(--accent-soft); font-size: 0.9rem; }

.gv-main { display: grid; grid-template-columns: 1fr; gap: 1rem; padding: 0; }   /* editorial.css pads every <section> */
.gv-drawing { order: -1; }                                     /* phones: drawing first */
@media (min-width: 960px) {
  .gv-main { grid-template-columns: minmax(300px, 0.8fr) 1.6fr; }
  .gv-drawing { order: 0; }
}
.gv-program, .gv-drawing { background: var(--panel); border: 1px solid var(--line); min-width: 0; }
.gv-panel-head { display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; padding: 0.5rem 0.75rem; border-bottom: 1px solid var(--line); font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.gv-link { background: none; border: 0; padding: 0; color: var(--accent-deep); cursor: pointer; font-family: var(--font-body); font-size: 0.85rem; font-weight: 500; letter-spacing: 0; text-transform: none; }

.gv-code, .gv-editor { height: min(62vh, 560px); overflow: auto; font-family: var(--gv-mono); font-size: 13px; line-height: var(--gv-line-h); }
.gv-code { position: relative; }
.gv-code:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.gv-code-spacer { position: relative; }
.gv-code-window { position: absolute; left: 0; right: 0; top: 0; will-change: transform; }
.gv-line { display: flex; height: var(--gv-line-h); white-space: pre; }
.gv-line:hover, .gv-line.is-hi { background: var(--accent-soft); }
.gv-line.has-warn .gv-no { color: var(--gv-rapid); font-weight: 700; }
.gv-no { flex: 0 0 3.5em; text-align: right; padding-right: 0.8em; color: var(--faint); user-select: none; }
.gv-tx { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; color: var(--ink); }
.gv-editor { display: block; width: 100%; border: 0; padding: 0 0.75rem; resize: vertical; background: var(--panel); color: var(--ink); box-sizing: border-box; }
.gv-drop-hint { padding: 1.5rem 1rem; text-align: center; color: var(--muted); font-size: 0.9rem; }
.gv-dragging .gv-program, .gv-dragging .gv-drawing { outline: 2px dashed var(--accent); outline-offset: -4px; }

.gv-tools { display: flex; flex-wrap: wrap; gap: 0.4rem 0.9rem; align-items: center; padding: 0.5rem 0.75rem; border-bottom: 1px solid var(--line); font-size: 0.82rem; }
.gv-check { display: inline-flex; align-items: center; gap: 0.35rem; color: var(--ink-soft); }
.gv-swatch { display: inline-block; width: 18px; height: 0; border-top: 2px solid; }
.gv-swatch.feed { border-color: var(--gv-feed); }
.gv-swatch.rapid { border-color: var(--gv-rapid); border-top-style: dashed; }
.gv-swatch.pass { border-color: var(--gv-pass); }
.gv-swatch.profile { border-color: var(--gv-profile); border-top-width: 4px; }   /* R5: solid, matches the drawn stroke */
.gv-svg { display: block; width: 100%; height: min(62vh, 560px); background: var(--panel); touch-action: none; cursor: crosshair; }
.gv-svg:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
@media (max-width: 720px) {
  /* The drawing must not trap the whole page's scroll on phones (item 3). */
  .gv-svg { height: min(50vh, 380px); }
}
.gv-zoom {
  display: inline-flex; align-items: center; justify-content: center;
  width: 1.7rem; height: 1.7rem; padding: 0; line-height: 1;
  border: 1px solid var(--line-strong); background: var(--panel); color: var(--ink);
  font-family: var(--font-body); font-size: 1rem; border-radius: 2px; cursor: pointer;
}
.gv-zoom:hover { border-color: var(--accent-deep); color: var(--accent-deep); }
.gv-zoom:focus-visible, .gv-link:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.gv-path { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.gv-feed { stroke: var(--gv-feed); stroke-width: 1.6; }
.gv-rapid { stroke: var(--gv-rapid); stroke-width: 1.1; stroke-dasharray: 5 4; }
.gv-pass { stroke: var(--gv-pass); stroke-width: 1.1; }
.gv-profile { stroke: var(--gv-profile); stroke-width: 4; }         /* solid: opacity blended it below 3:1 (item 18) */
.gv-hi { stroke: var(--gv-hi); stroke-width: 3; }
.gv-marker path { stroke: var(--gv-hi); stroke-width: 1.6; stroke-linecap: round; }
.gv-axis { stroke: var(--line-strong); stroke-width: 1; stroke-dasharray: 10 4 2 4; }
.gv-tick { stroke: var(--line-strong); stroke-width: 1; }
.gv-tick-label { fill: var(--ink-soft); font-family: var(--font-mono); }
.gv-start { fill: var(--ink); }
.gv-label { fill: var(--ink-soft); font-family: var(--font-mono); }
.gv-readout { margin: 0; padding: 0.4rem 0.75rem; border-top: 1px solid var(--line); font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-size: 12px; color: var(--muted); min-height: 1.6em; }

.gv-results { display: grid; grid-template-columns: 1fr; gap: 1.5rem; padding: 2rem 0; }
.gv-time, .gv-checks { min-width: 0; }   /* let the table scroll inside its box on phones */
@media (min-width: 960px) { .gv-results { grid-template-columns: 1.4fr 1fr; } }
.gv-results h2, .gv-cta h2 { font-family: var(--font-display); font-weight: 400; font-size: 1.35rem; margin: 0 0 0.4rem; color: var(--ink); }
.gv-note { color: var(--muted); font-size: 0.85rem; line-height: 1.5; margin: 0.4rem 0; }
.gv-table-wrap { overflow-x: auto; }
.gv-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; font-variant-numeric: tabular-nums; }
.gv-table th, .gv-table td { text-align: left; padding: 0.45rem 0.5rem; border-bottom: 1px solid var(--line); white-space: nowrap; }
.gv-table th { font-weight: 500; color: var(--muted); font-size: 0.78rem; }
.gv-table tfoot td { font-weight: 600; border-bottom: 0; }
.gv-check-list { list-style: none; margin: 0; padding: 0; }
.gv-w { display: flex; gap: 0.6rem; align-items: baseline; padding: 0.45rem 0; border-bottom: 1px solid var(--line); font-size: 0.9rem; }
.gv-w::before { content: ''; flex: 0 0 8px; height: 8px; border-radius: 50%; background: var(--faint); }
.gv-w.is-warn::before { background: var(--gv-rapid); }
.gv-w.is-error::before { background: var(--gv-hi); }
.gv-w.is-ok::before { background: var(--gv-feed); }
.gv-w-line { background: none; border: 0; padding: 0; color: var(--accent-deep); cursor: pointer; font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-size: 0.82rem; white-space: nowrap; }

.gv-cta { border-top: 1px solid var(--line); padding: 2rem 0 3rem; }
.gv-cta p { max-width: 640px; color: var(--ink-soft); line-height: 1.6; }
.gv-survey { margin-top: 1.5rem; display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.gv-survey p { margin: 0 0.5rem 0 0; color: var(--muted); font-size: 0.9rem; }
.gv-chip { border: 1px solid var(--line-strong); background: var(--panel); border-radius: 999px; padding: 0.35rem 0.85rem; font-family: var(--font-body); font-size: 0.85rem; cursor: pointer; color: var(--ink); }
.gv-chip:hover { border-color: var(--accent-deep); color: var(--accent-deep); }
.gv-thanks { margin: 0; color: var(--accent-deep); font-size: 0.9rem; }

.gv-footer { padding: 2rem 16px; border-top: 1px solid var(--line); display: flex; flex-direction: column; align-items: center; gap: 0.8rem; }
.gv-footer img { display: block; height: 12px; width: auto; }
.gv-footer-legal { display: flex; flex-wrap: wrap; justify-content: center; gap: 1.5rem; }
.gv-footer-legal a { font-size: 0.8rem; color: var(--muted); text-decoration: none; }
.gv-footer-legal a:hover { color: var(--accent-deep); }

.gv-print-head, .gv-print-foot { display: none; }
@media print {
  @page { size: A4; margin: 14mm; }
  body, .gv { background: #fff !important; }
  .navbar, .gv-head, .gv-bar, .gv-banner, .gv-program, .gv-readout, .gv-cta, .gv-footer, .consent-banner { display: none !important; }
  /* Print keeps the layer legend (swatches + names), without the Fit/zoom/1:1 controls or the
     checkboxes themselves (item 8). */
  .gv-tools-controls, .gv-tools input[type="checkbox"] { display: none !important; }
  .gv-print-head { display: flex !important; justify-content: space-between; align-items: center; gap: 12px; border-bottom: 2px solid var(--primary-light); padding-bottom: 8px; margin-bottom: 12px; font-size: 11px; color: #444; }
  .gv-print-head img { height: 16px; width: auto; }
  .gv-print-foot { display: block !important; margin-top: 12px; padding-top: 8px; border-top: 1px solid #ddd; font-size: 10px; color: #777; text-align: center; }
  .gv-main { display: block; }
  .gv-drawing { border: 1px solid #ccc; break-inside: avoid; }
  .gv-svg { height: 95mm; }
  .gv-results { display: block; padding: 0; }
  .gv-time, .gv-checks { break-inside: avoid; margin-top: 10px; }
  .gv-table-wrap { overflow: visible; }
  .gv-hi { display: none !important; }   /* R13: a hover or pin never prints in the highlight colour */
}

/* ---- milling viewer (milling-gcode-viewer.html) ---- */
.gv-cross { margin: 0.4rem 0 0; font-size: 0.85rem; }
.gv-tools-controls .gv-link + .gv-link { margin-left: 0.55rem; }   /* Fit Top Front Right Iso */
.gv-cross a { color: var(--accent-deep); }
.gv-banner-action { margin-left: 0.4rem; }
.gv-3d { position: relative; width: 100%; height: min(62vh, 560px); background: var(--panel); touch-action: none; }
.gv-3d-canvas { display: block; cursor: crosshair; }
.gv-3d-canvas:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
@media (max-width: 720px) { .gv-3d { height: min(50vh, 380px); } }
.gv-swatch.hi { border-color: var(--gv-hi); border-top-width: 3px; }
.gv-play { display: flex; align-items: center; gap: 0.6rem; padding: 0.4rem 0.75rem; border-top: 1px solid var(--line); }
.gv-play input[type="range"] { flex: 1; min-width: 0; accent-color: var(--accent); }
.gv-play-pos { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.gv-dims, .gv-offsets { margin: 0; padding: 0.3rem 0.75rem 0.5rem; font-size: 12px; }
.gv-offsets { display: flex; flex-wrap: wrap; gap: 0.3rem 0.8rem; }
.gv-offsets[hidden] { display: none; }
.gv-offset { display: inline-flex; align-items: center; gap: 0.3rem; }
.gv-offset .gv-swatch { border-top: 0; height: 10px; width: 10px; }
.gv-table-rows tbody tr { cursor: pointer; }
.gv-table-rows tbody tr:hover td { background: var(--accent-soft); }
.gv-table-rows tbody tr.is-iso td { background: var(--accent-soft); font-weight: 600; }
.gv-table-rows tbody tr:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.gv-print-shot { display: none; }
@media print {
  .gv-3d, .gv-play { display: none !important; }
  .gv-print-shot { display: block !important; width: 100%; max-height: 110mm; object-fit: contain; }
}

/* ---- free-tools.html: one card per tool ---- */
/* Tools grouped by who they are for: the wide group spans both columns, single-card groups share a row. */
.ft-groups { display: grid; grid-template-columns: 1fr; gap: 2rem 1.25rem; padding: 2rem 0 1rem; }
.ft-group { display: flex; flex-direction: column; min-width: 0; }
.ft-group-title { margin: 0 0 0.75rem; font-weight: 400; }
.ft-cards { display: grid; grid-template-columns: 1fr; gap: 1.25rem; flex: 1; }
@media (min-width: 720px) {
  .ft-groups { grid-template-columns: 1fr 1fr; }
  .ft-group.is-wide { grid-column: 1 / -1; }
  .ft-group.is-wide .ft-cards { grid-template-columns: 1fr 1fr; }
}
.ft-card { display: block; padding: 1.5rem; background: var(--panel); border: 1px solid var(--line); color: var(--ink); text-decoration: none; transition: border-color 0.2s ease; }
.ft-card:hover { border-color: var(--accent); }
.ft-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ft-card h2, .ft-card h3 { margin: 0 0 0.5rem; font-family: var(--font-display); font-weight: 300; font-size: 1.5rem; }
.ft-card p { margin: 0 0 1rem; color: var(--ink-soft); }
.ft-open { color: var(--accent-deep); font-weight: 500; }

/* ---- laser-dxf-checker.html: the laser DXF check (spec §10) ---- */
:root { --lc-mark: #1d4ed8; --lc-branch: #7c3aed; }
.lc-table .lc-row { cursor: pointer; }
.lc-table .lc-row:hover td, .lc-table .lc-row.is-sel td { background: var(--accent-soft); }
.lc-table .lc-row:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.lc-name { max-width: 16rem; overflow: hidden; text-overflow: ellipsis; }
.lc-table select, .lc-roles select, .lc-qty, .lc-speeds input { font: inherit; font-size: 0.85rem; padding: 0.2rem 0.3rem; border: 1px solid var(--line-strong); background: var(--panel); color: var(--ink); }
.lc-qty { width: 4.5rem; }
.lc-status { font-size: 1rem; }
.lc-status.is-ok { color: var(--gv-feed); }
.lc-status.is-warn { color: var(--gv-rapid); }
.lc-status.is-error { color: var(--gv-hi); }
.lc-status.is-busy { font-size: 0.8rem; font-style: italic; color: var(--muted); }
.lc-detail { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 1.25rem; margin-top: 1.5rem; }
@media (max-width: 900px) { .lc-detail { grid-template-columns: minmax(0, 1fr); } }
.lc-view { min-width: 0; border: 1px solid var(--line); background: var(--panel); }
.lc-svg { display: block; width: 100%; height: 420px; background: #fff; touch-action: none; cursor: grab; }
@media (max-width: 600px) { .lc-svg { height: 300px; } }
.lc-c { fill: none; stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.lc-cut { stroke: var(--ink); }
.lc-mark { stroke: var(--lc-mark); }
.lc-bend { stroke: var(--gv-rapid); stroke-dasharray: 6 4; }
.lc-ignore { stroke: var(--faint); }
.lc-c.lc-open { stroke: var(--gv-hi); }
.lc-c.is-hi { stroke: var(--gv-hi); stroke-width: 3; }
.lc-text { fill: var(--muted); font-family: var(--font-body); }
.lc-m { fill: none; stroke-width: 2; vector-effect: non-scaling-stroke; }
.lc-m-open, .lc-m-self { stroke: var(--gv-hi); }
.lc-m-gap { stroke: var(--gv-rapid); }
.lc-m-branch { stroke: var(--lc-branch); }
.lc-pick { margin: 0; padding: 1rem 0.75rem; text-align: center; color: var(--muted); font-size: 0.9rem; }
.lc-legend { display: flex; flex-wrap: wrap; gap: 0.4rem 1rem; margin: 0; padding: 0.5rem 0.75rem; border-top: 1px solid var(--line); font-size: 0.8rem; color: var(--muted); }
.lc-key { display: inline-block; width: 18px; border-top: 2px solid; vertical-align: middle; margin-right: 0.35rem; }
.lc-key.cut { border-color: var(--ink); }
.lc-key.mark { border-color: var(--lc-mark); }
.lc-key.bend { border-color: var(--gv-rapid); border-top-style: dashed; }
.lc-key.ignore { border-color: var(--faint); }
.lc-dot { display: inline-block; width: 9px; height: 9px; border: 2px solid; border-radius: 50%; vertical-align: middle; margin-right: 0.35rem; }
.lc-dot.open { border-color: var(--gv-hi); }
.lc-dot.gap { border-color: var(--gv-rapid); }
.lc-side { min-width: 0; }
.lc-side h2 { margin: 0 0 0.5rem; font-family: var(--font-mono); font-weight: 400; font-size: 0.78rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.lc-side .gv-check-list { margin-bottom: 1.25rem; }
.lc-chip { display: inline-block; width: 14px; height: 14px; border: 1px solid var(--line-strong); vertical-align: middle; }
.lc-settings { margin-top: 1.5rem; }
.lc-settings h3 { margin: 0.5rem 0 0.25rem; font-size: 0.9rem; font-weight: 500; }
.lc-speeds input { width: 7rem; }
.lc-notice { margin: 0.75rem 0 0; font-size: 0.72rem; color: var(--muted); }
.lc-print-all { display: none; }
@media print {
  .lc-detail, .lc-settings, .gv-drop-hint, .lc-table td:last-child, .lc-table th:last-child { display: none !important; }
  .lc-print-all { display: block !important; }
  .lc-print-file { break-inside: avoid; margin: 0 0 12px; }
  .lc-print-file h3 { margin: 0 0 4px; font-size: 12px; }
  .lc-print-svg { display: block; width: 100%; height: 80mm; border: 1px solid #ccc; }
}

/* ---- dwg-quantities.html: quantities from DWG (spec §5) ---- */
.dq-panel { padding: 0; }   /* editorial.css pads every <section> */
.dq-tabs { display: flex; gap: 0.25rem; overflow-x: auto; overflow-y: hidden; border-bottom: 1px solid var(--line-strong); margin: 0 0 1rem; }
.dq-tab { display: inline-flex; align-items: center; gap: 0.4rem; flex: none; max-width: 16rem; padding: 0.5rem 0.8rem; border: 1px solid transparent; border-bottom: 0; background: none; color: var(--muted); font-family: var(--font-body); font-size: 0.88rem; cursor: pointer; white-space: nowrap; }
.dq-tab .dq-tab-name { overflow: hidden; text-overflow: ellipsis; }
.dq-tab:hover { color: var(--ink); }
.dq-tab[aria-selected="true"] { background: var(--panel); color: var(--ink); border-color: var(--line-strong); margin-bottom: -1px; }
.dq-tab:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.dq-mark { font-size: 0.95rem; }
.dq-mark.is-ok { color: var(--gv-feed); }
.dq-mark.is-warn { color: var(--gv-rapid); }
.dq-mark.is-error { color: var(--gv-hi); }
.dq-mark.is-busy { font-size: 0.78rem; font-style: italic; color: var(--muted); }
.dq-status { display: flex; flex-wrap: wrap; gap: 0.4rem 0.8rem; align-items: center; font-size: 0.85rem; color: var(--muted); margin: 0 0 0.6rem; }
.dq-status select { font: inherit; font-size: 0.85rem; padding: 0.2rem 0.3rem; border: 1px solid var(--line-strong); background: var(--panel); color: var(--ink); }
.dq-error { margin: 0 0 1rem; padding: 0.8rem 0.9rem; border: 1px solid var(--gv-hi); background: rgba(194, 65, 12, 0.06); color: var(--ink); font-size: 0.9rem; }
.dq-warnings { margin: 0 0 1rem; }
.dq-warnings select { margin-left: 0.4rem; font: inherit; font-size: 0.85rem; padding: 0.15rem 0.3rem; border: 1px solid var(--line-strong); background: var(--panel); color: var(--ink); }
.dq-work { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 1.25rem; }
@media (max-width: 900px) { .dq-work { grid-template-columns: minmax(0, 1fr); } }
.dq-view { min-width: 0; border: 1px solid var(--line); background: var(--panel); }
.dq-canvas-box { position: relative; }
.dq-canvas { display: block; width: 100%; height: min(62vh, 520px); background: var(--panel); touch-action: none; cursor: crosshair; }
@media (max-width: 720px) { .dq-canvas { height: min(50vh, 360px); } }
.dq-canvas:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.dq-tip { position: absolute; z-index: 2; pointer-events: none; max-width: 16rem; padding: 0.35rem 0.55rem; background: var(--ink); color: var(--paper); font-size: 0.78rem; line-height: 1.45; border-radius: 2px; font-variant-numeric: tabular-nums; }
.dq-tip b { font-weight: 600; }
.dq-simplified { margin: 0; padding: 0.4rem 0.75rem; border-top: 1px solid var(--line); }
.dq-sel { min-width: 0; }
.dq-sel h2, .dq-tables h2 { margin: 0 0 0.5rem; font-family: var(--font-mono); font-weight: 400; font-size: 0.78rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.dq-sel-count { margin: 0.2rem 0 0.4rem; font-weight: 600; font-size: 0.9rem; }
.dq-sel-actions { display: flex; gap: 0.8rem; align-items: center; margin: 0.6rem 0; }
.dq-sel-cta { margin: 1rem 0 0; padding: 0.7rem 0.8rem; border-left: 2px solid var(--accent); background: var(--accent-soft); font-size: 0.85rem; line-height: 1.5; color: var(--ink-soft); }
.dq-sel-cta a { color: var(--accent-deep); font-weight: 500; white-space: nowrap; }
.dq-tables { margin-top: 1.75rem; }
.dq-tables h2 { margin-top: 1.5rem; }
.dq-tables h3 { margin: 0.8rem 0 0.3rem; font-size: 0.9rem; font-weight: 500; color: var(--ink); }
.dq-layers tbody tr, .dq-blocks tbody tr { cursor: pointer; }
.dq-layers tbody tr:hover td, .dq-blocks tbody tr:hover td,
.dq-layers tbody tr.is-hover td, .dq-blocks tbody tr.is-hover td { background: var(--accent-soft); }
.dq-layers tbody tr.is-hi td, .dq-blocks tbody tr.is-hi td { background: var(--accent-soft); font-weight: 600; }
.dq-layers tbody tr:focus-visible, .dq-blocks tbody tr:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.dq-summary .dq-layers tbody tr, .dq-summary .dq-blocks tbody tr { cursor: default; }
.dq-name { max-width: 18rem; overflow: hidden; text-overflow: ellipsis; }
.dq-badge { display: inline-block; margin-right: 0.3rem; padding: 0 0.4rem; border: 1px solid var(--line-strong); border-radius: 999px; font-size: 0.72rem; color: var(--muted); }
.dq-badge.is-bad { border-color: var(--gv-rapid); color: var(--gv-rapid); }
.dq-num { text-align: right !important; }
.dq-settings { margin-top: 1.5rem; }
@media print { .dq-tabs, .dq-view, .dq-sel, .dq-settings, .dq-status select { display: none !important; } .dq-work { display: block; } }

/* ---- coverage-precheck.html: the coverage diagram pre-check (spec §6) ---- */
.cp-indicative { display: inline-block; margin: 0.6rem 0 0; padding: 0.2rem 0.7rem; border: 1px solid var(--gv-rapid); border-radius: 999px; color: var(--ink-soft); font-size: 0.82rem; }
.cp-template-link { margin-left: 0.3rem; }
.cp-template-names { margin: 0 0 1rem; }
.cp-names { list-style: none; margin: 0; padding: 0; columns: 2 16rem; column-gap: 1.5rem; font-size: 0.85rem; color: var(--ink-soft); }
.cp-names li { padding: 0.15rem 0; break-inside: avoid; }
.cp-names code { font-family: var(--gv-mono); font-size: 0.8rem; color: var(--ink); }
.cp-busy { font-style: italic; }
.cp-panel { padding: 0; }
.cp-status .cp-file { font-weight: 600; color: var(--ink); }
.cp-step, .cp-results { padding: 1.25rem 0; border-top: 1px solid var(--line); }   /* editorial.css pads every <section> */
.cp-step h2, .cp-results h2 { font-family: var(--font-display); font-weight: 400; font-size: 1.35rem; margin: 0 0 0.3rem; color: var(--ink); }
.cp-results h3 { margin: 1.5rem 0 0.5rem; font-family: var(--font-mono); font-weight: 400; font-size: 0.78rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.cp-map select, .cp-terms select { font: inherit; font-size: 0.85rem; padding: 0.2rem 0.3rem; border: 1px solid var(--line-strong); background: var(--panel); color: var(--ink); max-width: 16rem; }
.cp-swatch { display: inline-block; width: 10px; height: 10px; margin-right: 0.45rem; border-radius: 2px; vertical-align: middle; }
.cp-other { margin-top: 0.6rem; font-size: 0.85rem; color: var(--muted); }
.cp-other summary { cursor: pointer; }
.cp-terms input[aria-invalid="true"] { border-color: var(--gv-hi); }
.cp-hint { color: var(--faint); font-size: 0.75rem; line-height: 1.35; }
.cp-terms .cp-check { flex-direction: row; align-items: center; gap: 0.5rem; }
.cp-results-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 0.5rem; }
.cp-export { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.cp-table-head { display: flex; justify-content: space-between; align-items: baseline; gap: 0.5rem; }
.cp-table-head .gv-link:disabled { color: var(--faint); cursor: default; }                   /* until the union is back */
.cp-summary .cp-block th { padding-top: 0.9rem; color: var(--ink); font-weight: 600; font-size: 0.82rem; background: var(--paper-2, transparent); }
.cp-summary .cp-fig { white-space: normal; min-width: 12rem; }
.cp-row-note { display: block; color: var(--muted); font-size: 0.75rem; white-space: normal; }
.cp-mark { font-weight: 700; text-align: center !important; }
.cp-mark.is-ok { color: var(--gv-feed); }
.cp-mark.is-over { color: var(--gv-hi); }
.cp-art summary { cursor: pointer; color: var(--accent-deep); font-size: 0.78rem; list-style: none; }
.cp-art summary::-webkit-details-marker { display: none; }
.cp-art[open] summary { font-weight: 600; }
.cp-art-text { display: block; max-width: 22rem; white-space: normal; font-size: 0.78rem; color: var(--ink-soft); line-height: 1.45; }
.cp-linked { cursor: pointer; }
.cp-linked:hover td, .cp-linked:focus td { background: var(--accent-soft); }
.cp-linked.is-hi td { background: var(--accent-soft); font-weight: 600; }
.cp-linked:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.cp-view { margin: 1.25rem 0 0.5rem; border: 1px solid var(--line); background: var(--panel); min-width: 0; }
.cp-legend { display: flex; flex-wrap: wrap; gap: 0.3rem 1rem; list-style: none; margin: 0; padding: 0.45rem 0.75rem; border-top: 1px solid var(--line); font-size: 0.8rem; color: var(--ink-soft); }
.cp-schedule .cp-sch-head td { padding-top: 0.9rem; font-weight: 600; color: var(--ink); }
.cp-schedule .cp-sch-domisi td, .cp-schedule .cp-sch-total td, .cp-schedule .cp-sch-sum td { font-weight: 600; border-bottom-color: var(--line-strong); }
.cp-schedule .cp-sch-space td:first-child, .cp-schedule .cp-sch-gross td:first-child { padding-left: 1.2rem; }
.cp-schedule .cp-sch-cap td:first-child { padding-left: 2.2rem; color: var(--muted); font-size: 0.8rem; }
.cp-note { color: var(--muted); font-size: 0.8rem; white-space: normal !important; min-width: 10rem; }
.cp-coords { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1rem; }
@media (min-width: 900px) { .cp-coords { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
.cp-coord caption { text-align: left; padding: 0 0 0.3rem; font-size: 0.85rem; font-weight: 500; color: var(--ink); }
.cp-warnings { margin: 0 0 1rem; }
.cp-warnings .gv-w-line { margin-left: auto; }
.cp-disclaimer { margin: 1rem 0 0; padding: 0.6rem 0.8rem; border-left: 2px solid var(--gv-rapid); background: var(--accent-soft); font-size: 0.85rem; color: var(--ink-soft); }
.cp-print-disclaimer { display: none; }
@media print {
  .cp-bar, .cp-template-names, .cp-busy, .cp-status select, .cp-status label, .cp-step, .cp-export, .cp-table-head .gv-link, .gv-tools-controls, .cp-warnings .gv-w-line { display: none !important; }
  .cp-results { border-top: 0; padding-top: 0; }
  .cp-art summary { color: #444; }
  .cp-art-text { display: none; }
  .cp-view { break-inside: avoid; border: 1px solid #ccc; }
  .cp-canvas { height: 110mm !important; }
  .cp-summary, .cp-coord { break-inside: avoid; }
  .cp-coords { grid-template-columns: 1fr 1fr; }
  .cp-disclaimer { display: none; }
  .cp-print-disclaimer { display: block !important; position: fixed; bottom: 0; left: 0; right: 0; margin: 0; padding: 2mm 0; background: #fff; border-top: 1px solid #ccc; font-size: 9px; color: #555; text-align: center; }
  .cp .gv-wrap { padding-bottom: 12mm; }
}

/* ---- steel-takeoff.html: steel take-off and galvanizing quote (spec §6) ---- */
.st-panel { padding: 0; }   /* editorial.css pads every <section> */
.st-busy { font-style: italic; }
.st-h { margin: 1.5rem 0 0.5rem; font-family: var(--font-mono); font-weight: 400; font-size: 0.78rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.st-summary { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); margin: 0; border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
.st-fig { margin: 0; padding: 0.6rem 0.8rem; background: var(--panel); min-width: 0; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.st-fig dt { font-size: 0.75rem; color: var(--muted); }
.st-fig dd { margin: 0.15rem 0 0; font-size: 0.95rem; color: var(--ink); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.st-fig.st-big dd { font-family: var(--font-display); font-size: 1.35rem; font-weight: 400; }
.st-fig.st-warn dd { color: var(--gv-rapid); }
.st-fig.st-bad dd { color: var(--gv-hi); }
.st-skipped { margin: 0.6rem 0 0; font-size: 0.85rem; color: var(--ink-soft); }
.st-skipped summary { cursor: pointer; color: var(--muted); }
.st-skipped ul { margin: 0.4rem 0 0; padding-left: 1.2rem; max-height: 12rem; overflow: auto; overflow-wrap: anywhere; }
.st-settings { padding: 0; }
.st-fields { margin: 0.4rem 0; padding: 0.2rem 0.9rem 0.6rem; border: 1px solid var(--line); background: var(--panel); min-width: 0; }
.st-fields legend { padding: 0 0.3rem; font-size: 0.8rem; color: var(--ink-soft); }
.st-fields input[aria-invalid="true"] { border-color: var(--gv-hi); }
.st-check { display: inline-flex; align-items: center; gap: 0.5rem; margin: 0.2rem 1.5rem 0.2rem 0; font-size: 0.85rem; color: var(--ink-soft); cursor: pointer; }
.st-table-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 0.5rem; }
.st-sort { display: inline-flex; align-items: center; gap: 0.5rem; font-size: 0.85rem; color: var(--muted); }
.st-sort select { font: inherit; padding: 0.3rem 0.4rem; border: 1px solid var(--line-strong); background: var(--panel); color: var(--ink); border-radius: 2px; }
.st-table-hint { margin: 0 0 0.5rem; }
.st-group th, .st-group td { background: var(--paper-2); }
.st-group th { text-align: left; }
.st-expand { padding: 0; border: 0; background: none; color: var(--ink); font: inherit; font-weight: 600; cursor: pointer; }
.st-expand:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.st-piece { cursor: pointer; }
.st-piece td:first-child { padding-left: 1.6rem; }
.st-piece:hover td, .st-piece.is-sel td { background: var(--accent-soft); }
.st-piece:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.st-piece.is-out td { color: var(--muted); }
.st-sub { color: var(--muted); }
.st-mark { text-align: center !important; }
.st-warn { color: var(--gv-rapid); font-weight: 600; }
.st-bad { color: var(--gv-hi); font-weight: 600; }
.st-note { color: var(--gv-rapid); }
.st-view { margin: 1.25rem 0 0.5rem; padding: 0; border: 1px solid var(--line); background: var(--panel); min-width: 0; }
.st-view .gv-panel-head { flex-wrap: wrap; }
.st-view #st3dHead { text-transform: none; letter-spacing: 0; }   /* a mark keeps its case */
.st-3d-box { position: relative; width: 100%; height: min(56vh, 460px); overflow: hidden; background: var(--panel); }
@media (max-width: 720px) { .st-3d-box { height: min(50vh, 340px); } }
.st-3d-canvas { display: block; cursor: grab; touch-action: none; }
.st-3d-canvas:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
#st3dModel[aria-pressed="true"] { text-decoration: underline; }
.st-costs th { text-align: left; }
.st-costs tbody th { font-weight: 400; color: var(--ink); font-size: 0.88rem; }
.st-costs .st-sum th, .st-costs .st-sum td { border-top: 1px solid var(--line-strong); }
.st-costs .st-total th, .st-costs .st-total td { font-weight: 700; border-top: 2px solid var(--ink); }
.st-costs .st-min th { color: var(--gv-rapid); }
.st-costs .st-unpriced th, .st-costs .st-unpriced td { color: var(--gv-rapid); }
.st-unpriced-note[hidden] { display: none; }
@media (max-width: 480px) {
  /* 375 px: the labels wrap, so the amount column stays inside the box */
  .st-costs th, .st-costs td { padding-inline: 0.3rem; font-size: 0.82rem; }
  .st-costs tbody th { white-space: normal; min-width: 7rem; }
}
.st-cost-none td { color: var(--muted); font-style: italic; white-space: normal; }
.st-outputs { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 1rem 0 0.5rem; }
.st-print-note { display: none; }
.st-v1 { margin: 1rem 0; }
@media print {
  .st-settings, .st-sort, .st-table-hint, .st-view, .st-outputs, .st-piece, .st-skipped, .st-v1, #stDropHint, #stBusy { display: none !important; }
  .st-print-note { display: block !important; }
  .st-summary { grid-template-columns: repeat(3, 1fr); }
  .st-group th, .st-group td { background: none; }
  .st-table, .st-costs { break-inside: avoid; }
}

/* ---- ifc-plans.html: DXF floor plans from IFC (spec §6) ---- */
.ip-indicative { display: inline-block; margin: 0.6rem 0 0; padding: 0.2rem 0.7rem; border: 1px solid var(--gv-rapid); border-radius: 999px; color: var(--ink-soft); font-size: 0.82rem; }
.ip-settings { padding: 0.25rem 0 0.5rem; }   /* editorial.css pads every <section> */
.ip-settings h2, .ip-panel h2 { margin: 0.5rem 0 0; font-family: var(--font-mono); font-weight: 400; font-size: 0.78rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.ip-settings input[aria-invalid="true"] { border-color: var(--gv-hi); }
.ip-settings .ip-check { flex-direction: row; align-items: center; gap: 0.5rem; align-self: end; padding-bottom: 0.45rem; color: var(--ink-soft); font-size: 0.85rem; }
.ip-busy { font-style: italic; }
.ip-panel { padding: 0; }
.ip-status .ip-file { font-weight: 600; color: var(--ink); }
.ip-table-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 0.5rem; margin: 1rem 0 0.5rem; }
.ip-storeys tbody tr { cursor: pointer; }
.ip-storeys tbody tr:hover td, .ip-storeys tbody tr.is-sel td { background: var(--accent-soft); }
.ip-storeys tbody tr.is-sel td:first-child { font-weight: 600; }
.ip-storeys tbody tr:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.ip-storeys .ip-empty { color: var(--muted); font-style: italic; }
.ip-storeys .ip-warn { color: var(--gv-rapid); font-weight: 600; }
.ip-storeys .gv-btn { padding: 0.25rem 0.6rem; font-size: 0.8rem; }
.ip-view { margin: 1.25rem 0 0.5rem; border: 1px solid var(--line); background: var(--panel); min-width: 0; }
.ip-legend { display: flex; flex-wrap: wrap; gap: 0.3rem 1rem; list-style: none; margin: 0; padding: 0.45rem 0.75rem; border-top: 1px solid var(--line); font-size: 0.8rem; color: var(--ink-soft); }
.ip-swatch { display: inline-block; width: 18px; height: 0; margin-right: 0.4rem; border-top: 2px solid; vertical-align: middle; }
.ip-panel .ip-h { margin-top: 1.5rem; }
.ip-warnings { margin: 0.3rem 0 1rem; }
.ip-v1 { margin: 1rem 0; }
.ip-legend li { display: flex; }
.ip-toggle { display: inline-flex; align-items: center; padding: 0.1rem 0.3rem; margin: 0 -0.3rem; border: 1px solid transparent; border-radius: 2px; background: none; color: inherit; font: inherit; cursor: pointer; }
.ip-toggle:hover { border-color: var(--line-strong); }
.ip-toggle[aria-pressed="false"] { color: var(--muted); text-decoration: line-through; }
.ip-toggle[aria-pressed="false"] .ip-swatch { opacity: 0.35; }
.ip-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.ip-legend-note { margin: 0; padding: 0 0.75rem 0.5rem; }

/* ---- ifc-plans.html: the 3D tab ---- */
.ip-tabs { display: flex; border-bottom: 1px solid var(--line); }
.ip-tab { margin-bottom: -1px; padding: 0.55rem 1rem; border: 0; border-bottom: 2px solid transparent; background: none; color: var(--muted); font-family: var(--font-body); font-size: 0.9rem; font-weight: 500; cursor: pointer; }
.ip-tab:hover { color: var(--ink); }
.ip-tab[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); }
.ip-tab:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.ip-3d-head { flex-wrap: wrap; }
.ip-3d-head #ip3dHead { text-transform: none; letter-spacing: 0; }   /* the unit keeps its case: "1,10 m", not "1,10 M" */
.ip-3d-bar { padding: 0.4rem 0.75rem; border-bottom: 1px solid var(--line); color: var(--ink-soft); font-size: 0.85rem; }
.ip-3d-check { display: inline-flex; align-items: center; gap: 0.5rem; cursor: pointer; }
.ip-3d-box { position: relative; width: 100%; height: min(62vh, 520px); overflow: hidden; background: var(--panel); }
@media (max-width: 720px) { .ip-3d-box { height: min(50vh, 360px); } }
.ip-3d-canvas { display: block; cursor: crosshair; touch-action: none; }
.ip-3d-canvas:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.ip-3d-note { position: absolute; inset: 0; z-index: 1; display: flex; align-items: center; justify-content: center; margin: 0; padding: 1rem; background: var(--panel); color: var(--muted); font-size: 0.9rem; text-align: center; }
.ip-3d-note[hidden] { display: none; }
@media print { .ip-tabs, #ip3dView, .ip-legend-note { display: none !important; } #ipPlanView { display: block !important; } }
