:root {
  --bg: #f4f2ee;
  --panel: #ffffff;
  --ink: #1f2328;
  --muted: #667085;
  --line: #e4e0d8;
  --accent: #c2410c;
  --accent-soft: #fde7d7;
  --ok: #15803d;
  --warn: #b45309;
  --chip: #f1ede6;
  --shadow: 0 1px 2px rgba(0, 0, 0, .06), 0 4px 16px rgba(0, 0, 0, .06);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #17191c; --panel: #202327; --ink: #e8e6e3; --muted: #9aa1ab; --line: #33373d;
    --accent: #fb923c; --accent-soft: #3b2415; --chip: #2a2e33;
  }
}
:root[data-theme="dark"] {
  --bg: #17191c; --panel: #202327; --ink: #e8e6e3; --muted: #9aa1ab; --line: #33373d;
  --accent: #fb923c; --accent-soft: #3b2415; --chip: #2a2e33;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font: 14px/1.45 Inter, system-ui, -apple-system, Segoe UI, sans-serif;
  color: var(--ink);
  background: var(--bg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
button { font: inherit; color: inherit; }

/* header */
.top {
  display: flex; align-items: center; gap: 20px;
  padding: 10px 18px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--accent); }
.brand h1 { font-size: 16px; margin: 0; color: var(--ink); letter-spacing: -.01em; }
.brand .sub { margin: 0; font-size: 12px; color: var(--muted); }
.tabs { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }
.tab {
  border: 0; background: none; padding: 8px 14px; border-radius: 8px; cursor: pointer;
  color: var(--muted); font-weight: 500;
}
.tab:hover { background: var(--chip); color: var(--ink); }
.tab.active { background: var(--accent-soft); color: var(--accent); }
.total-chip {
  font-weight: 700; font-size: 15px; padding: 6px 12px; border-radius: 999px;
  background: var(--chip); font-variant-numeric: tabular-nums;
}

/* layout */
.app { flex: 1; display: flex; min-height: 0; }
.side {
  width: 300px; flex: none; overflow-y: auto; padding: 14px 16px 30px;
  background: var(--panel); border-right: 1px solid var(--line);
}
.content { flex: 1; min-width: 0; position: relative; display: flex; }
.pane { display: none; flex: 1; flex-direction: column; min-width: 0; min-height: 0; }
.pane.active { display: flex; }
.pane.scroll { overflow-y: auto; }

/* sidebar controls */
.group { margin-bottom: 18px; }
.group h2 {
  font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted);
  margin: 0 0 8px; font-weight: 600;
}
details.group > summary {
  font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted);
  font-weight: 600; cursor: pointer; list-style: none; margin-bottom: 8px; display: flex; justify-content: space-between;
}
details.group > summary::after { content: '+'; font-size: 14px; }
details.group[open] > summary::after { content: '−'; }
details.group > summary::-webkit-details-marker { display: none; }
.field { margin-bottom: 10px; }
.field label { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 4px; }
.field .val { font-weight: 600; font-variant-numeric: tabular-nums; }
.field .hint { font-size: 11px; color: var(--muted); margin-top: 2px; }
.field.row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.field.row label { margin: 0; }
.field select, .field input[type=number] {
  width: 100%; padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px;
  background: var(--bg); color: var(--ink); font: inherit;
}
.field.row input[type=number] { width: 72px; text-align: right; }
input[type=range] { width: 100%; accent-color: var(--accent); }
.seg { display: flex; background: var(--chip); border-radius: 8px; padding: 3px; gap: 3px; }
.seg button {
  flex: 1; border: 0; background: none; padding: 6px 6px; border-radius: 6px; cursor: pointer;
  font-size: 12.5px; color: var(--muted); font-weight: 500;
}
.seg button.on { background: var(--panel); color: var(--ink); box-shadow: var(--shadow); }
.seg.small button { padding: 4px 10px; font-size: 12px; }
.buttons { display: flex; gap: 8px; flex-wrap: wrap; }
.btn {
  border: 1px solid var(--line); background: var(--panel); padding: 7px 12px; border-radius: 8px;
  cursor: pointer; font-size: 13px;
}
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn.primary { background: var(--accent); color: #fff; border-color: var(--accent); }

.hint-inline { font-size: 11px; color: var(--muted); font-weight: 400; text-align: right; }
.door-grid { display: grid; gap: 4px; }
.dg-row { display: grid; grid-template-columns: 70px repeat(var(--nb, 3), 1fr); gap: 4px; align-items: center; }
.dg-head span { font-size: 11px; color: var(--muted); text-align: center; }
.dg-wall { font-size: 12.5px; }
.dg-cell { display: flex; justify-content: center; align-items: center; height: 28px; background: var(--chip); border-radius: 6px; cursor: pointer; margin: 0 !important; }
.dg-cell:has(input:checked) { background: var(--accent-soft); outline: 1.5px solid var(--accent); }
.dg-cell input { accent-color: var(--accent); width: 16px; height: 16px; cursor: pointer; }
.dg-cell.dg-bad { opacity: .45; }
.dg-cover:has(input:checked) { background: #e5e7eb; outline-color: #6b7280; }
.dg-cover input { accent-color: #6b7280; }

/* viewport */
.viewport { position: relative; flex: 1; min-height: 0; overflow: hidden; background: #dfe9f1; }
.viewport canvas { display: block; }
.label-layer { position: absolute; inset: 0; pointer-events: none; }
.toolbar {
  position: absolute; top: 12px; right: 12px; z-index: 3; display: flex; gap: 10px; align-items: center;
  background: rgba(255, 255, 255, .88); backdrop-filter: blur(6px); padding: 6px 8px; border-radius: 10px;
  box-shadow: var(--shadow); color: #1f2328; flex-wrap: wrap; justify-content: flex-end; max-width: calc(100% - 24px);
}
.toolbar .seg { background: #ece8e1; }
.toolbar .seg button { color: #667085; }
.toolbar .seg button.on { background: #fff; color: #1f2328; }
.toolbar .explode { display: flex; align-items: center; gap: 6px; font-size: 12px; }
.toolbar .explode input { width: 110px; }
.toolbar .chk { font-size: 12px; display: flex; gap: 4px; align-items: center; }
.views { display: flex; gap: 2px; }
.views button {
  border: 0; background: #ece8e1; padding: 4px 8px; border-radius: 6px; cursor: pointer; font-size: 12px; color: #1f2328;
}
.views button:hover { background: #fde7d7; }
.step-card {
  position: absolute; left: 12px; top: 12px; z-index: 3; width: min(380px, calc(100% - 24px));
  background: rgba(255, 255, 255, .92); backdrop-filter: blur(6px); color: #1f2328;
  border-radius: 12px; padding: 12px 14px; box-shadow: var(--shadow); border-left: 4px solid #c2410c;
}
.step-card h3 { margin: 2px 0 4px; font-size: 15px; }
.step-card p { margin: 0; font-size: 13px; color: #3d4450; max-height: 32vh; overflow-y: auto; }
.step-num { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: #c2410c; font-weight: 600; }
.warnings { position: absolute; left: 12px; bottom: 12px; z-index: 3; display: flex; flex-direction: column; gap: 4px; max-width: 60%; }
.warnings div { background: #fff7e6; color: #8a4b08; border: 1px solid #f4d39a; border-radius: 8px; padding: 5px 9px; font-size: 12px; }
.tooltip {
  position: absolute; z-index: 5; pointer-events: none; display: none;
  background: rgba(20, 22, 26, .9); color: #fff; padding: 6px 9px; border-radius: 6px; font-size: 12px; line-height: 1.35;
  max-width: 260px;
}
.dim-label {
  background: rgba(255, 255, 255, .9); color: #1f2328; padding: 1px 6px; border-radius: 4px; font-size: 12px; font-weight: 600;
  border: 1px solid #9aa1ab;
}
.ship-label {
  background: rgba(255, 255, 255, .92); color: #1f2328; padding: 4px 7px; border-radius: 6px; font-size: 11.5px;
  border: 1px solid #d0cbc2; display: flex; flex-direction: column; text-align: center; white-space: nowrap;
  transform: translateY(-50%);
}
.ship-label span { color: #59606b; font-size: 10.5px; }

/* playback */
.playbar {
  display: flex; align-items: center; gap: 8px; padding: 10px 14px 18px; background: var(--panel);
  border-top: 1px solid var(--line); position: relative; flex-wrap: wrap;
}
.playbar input[type=range] { flex: 1; min-width: 160px; }
.icon {
  border: 1px solid var(--line); background: var(--panel); width: 34px; height: 30px; border-radius: 8px; cursor: pointer;
  font-size: 12px; flex: none;
}
.icon.play { background: var(--accent); color: #fff; border-color: var(--accent); }
.step-ticks { position: absolute; left: 0; right: 0; bottom: 3px; height: 12px; pointer-events: none; }
.step-ticks span { position: absolute; font-size: 9.5px; color: var(--muted); transform: translateX(-50%); white-space: nowrap; }

/* house / toilet house sub-tabs */
[hidden] { display: none !important; }
.subtabs { flex: none; margin: 8px 12px; align-self: flex-start; max-width: calc(100% - 24px); overflow-x: auto; }
.subtabs button { white-space: nowrap; }
.tpane { display: none; flex: 1; flex-direction: column; min-width: 0; min-height: 0; }
.tpane.active { display: flex; }
.tpane.scroll { overflow-y: auto; }
.doc .lede { font-size: 15px; line-height: 1.55; }
.doc ol li { margin-bottom: 6px; }
table.cmp td { width: 25%; }
.schem { margin: 16px 0; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.schem svg { width: 100%; height: auto; display: block; }
.schem figcaption { font-size: 12px; color: var(--muted); margin-top: 4px; }
.s-ground { fill: none; stroke: #b59a68; stroke-width: 3; }
.s-water { fill: #3a9fb0; opacity: .25; }
.s-tide { stroke: #2b7f8f; stroke-width: 1.5; stroke-dasharray: 6 4; }
.s-tide.lo { opacity: .6; }
.s-house { fill: var(--chip); stroke: var(--ink); stroke-width: 1.5; }
.s-roof { stroke: var(--ink); stroke-width: 3; }
.s-bowl { fill: #fff; stroke: var(--ink); }
.s-vent { stroke: #8a8f96; stroke-width: 3; }
.s-pipe { fill: none; stroke: var(--accent); stroke-width: 4; stroke-linejoin: round; }
.s-pit { fill: none; stroke: #8a8f96; stroke-width: 3; }
.s-valve { fill: var(--ink); }
.s-dim { stroke: var(--muted); stroke-dasharray: 2 3; }
.s-lab { font-size: 12px; fill: var(--muted); font-family: inherit; }

/* step-by-step guides */
:root {
  --g-wood: #ecd2a2; --g-wood-s: #9a7442; --g-wood2: #dcb97d; --g-hl: #f8b26a; --g-hl2: #fbd08f;
  --g-conc: #dedbd5; --g-conc-s: #8f8a82; --g-steel: #b5bcc4; --g-steel-s: #59616b; --g-earth: #ece0c2;
  --g-water: #b3dfe6; --g-ply: #f4e5c6; --g-tin: #6b7785; --g-pipe: #f1f1ee; --g-pipe-s: #6b7280;
  --g-plastic: #7bb3d6; --g-mesh: #6b7280; --g-shot: #e7eef4; --g-screen: #30363d; --g-tank: #8fb79a; --g-tank-s: #2f5a3c;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --g-wood: #a88a5c; --g-wood-s: #e2c48f; --g-wood2: #8f7247; --g-hl: #c76d22; --g-hl2: #a6631f;
    --g-conc: #5d5b58; --g-conc-s: #a7a29a; --g-steel: #6d7680; --g-steel-s: #c4cbd3; --g-earth: #5a5040;
    --g-water: #2c5f69; --g-ply: #7e6b4c; --g-tin: #aab6c3; --g-pipe: #4a4e54; --g-pipe-s: #c9ced6;
    --g-plastic: #3f7da6; --g-mesh: #b8bec6; --g-shot: #2a2e33; --g-screen: #c3cbd4; --g-tank: #3d6b4a; --g-tank-s: #a9d2b2;
  }
}
:root[data-theme="dark"] {
  --g-wood: #a88a5c; --g-wood-s: #e2c48f; --g-wood2: #8f7247; --g-hl: #c76d22; --g-hl2: #a6631f;
  --g-conc: #5d5b58; --g-conc-s: #a7a29a; --g-steel: #6d7680; --g-steel-s: #c4cbd3; --g-earth: #5a5040;
  --g-water: #2c5f69; --g-ply: #7e6b4c; --g-tin: #aab6c3; --g-pipe: #4a4e54; --g-pipe-s: #c9ced6;
  --g-plastic: #3f7da6; --g-mesh: #b8bec6; --g-shot: #2a2e33; --g-screen: #c3cbd4; --g-tank: #3d6b4a; --g-tank-s: #a9d2b2;
}
.guide { max-width: 1040px; }
.guide .lede { color: var(--ink); }
.g-toc { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 4px 18px; padding: 12px 16px; margin: 14px 0 6px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px; list-style: none; counter-reset: none; }
.g-toc li { margin: 0; font-size: 13.5px; }
.g-toc a { color: var(--ink); text-decoration: none; display: flex; gap: 8px; padding: 3px 0; }
.g-toc a:hover { color: var(--accent); }
.g-toc .n { color: var(--accent); font-weight: 700; min-width: 22px; font-variant-numeric: tabular-nums; }
.g-progress { font-size: 12px; color: var(--muted); margin: 4px 0 0; }
.g-part { margin-top: 44px; scroll-margin-top: 10px; }
.g-part > header { border-top: 3px solid var(--accent); padding-top: 12px; margin-bottom: 8px; }
.g-part > header .k { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--accent); font-weight: 700; }
.g-part > header h2 { margin: 2px 0 4px; font-size: 22px; }
.g-part > header p { margin: 0; color: var(--muted); max-width: 820px; }
.g-step { display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 0 14px; margin: 22px 0; }
.g-step > .num { width: 30px; height: 30px; border-radius: 50%; background: var(--accent); color: #fff; font-weight: 700; font-size: 13px;
  display: flex; align-items: center; justify-content: center; font-variant-numeric: tabular-nums; margin-top: 1px; }
.g-step.done > .num { background: var(--ok); }
.g-step > .body { min-width: 0; }
.g-step h3 { margin: 4px 0 6px; font-size: 16px; display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.g-step h3 label { margin-left: auto; font-size: 12px; font-weight: 500; color: var(--muted); display: flex; gap: 5px; align-items: center; cursor: pointer; }
.g-step h3 input { accent-color: var(--ok); width: 15px; height: 15px; }
.g-step.done h3 label { color: var(--ok); }
.g-step p, .g-step li { max-width: 820px; }
.g-step ol, .g-step ul { padding-left: 20px; margin: 6px 0; }
.g-step ol li, .g-step ul li { margin-bottom: 5px; }
.g-figs { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); gap: 12px; margin: 12px 0; }
.g-figs.one { grid-template-columns: 1fr; }
.gfig { margin: 0; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 10px; min-width: 0; break-inside: avoid; }
.gfig figcaption { font-size: 12.5px; color: var(--muted); margin-top: 6px; line-height: 1.4; }
.gfig figcaption b { color: var(--ink); }
.gfig-art { overflow-x: auto; }
.gfig-art svg { width: 100%; height: auto; display: block; min-width: 0; margin: 0 auto; }
.g-figs > .gfig.wide { grid-column: 1 / -1; }
.gfig.wide .gfig-art svg { min-width: 560px; }
.gshot { aspect-ratio: 8 / 5; border-radius: 6px; overflow: hidden; background: var(--g-shot); position: relative; }
.gshot img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gshot:not(.ready)::after { content: 'Drawing the 3D view…'; position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: 12px; color: var(--muted); animation: gpulse 1.4s ease-in-out infinite; }
@keyframes gpulse { 50% { opacity: .45; } }
.g-tip, .g-warn, .g-check, .g-need { border-radius: 10px; padding: 9px 12px 9px 14px; margin: 10px 0; max-width: 860px; font-size: 13.5px; }
.g-tip { background: var(--chip); border-left: 4px solid #3b82f6; }
.g-warn { background: #fff7e6; border-left: 4px solid #d97706; color: #6b3d06; }
.g-check { background: var(--chip); border-left: 4px solid var(--ok); }
.g-need { background: var(--panel); border: 1px solid var(--line); }
.g-tip > b:first-child, .g-warn > b:first-child, .g-check > b:first-child, .g-need > b:first-child { display: block; margin-bottom: 2px; }
.g-check ul, .g-need ul { margin: 4px 0 2px; padding-left: 18px; }
.g-check li, .g-need li { margin-bottom: 3px; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .g-warn { background: #3a2a12; color: #f6d9a8; } }
:root[data-theme="dark"] .g-warn { background: #3a2a12; color: #f6d9a8; }
.g-tools { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; margin: 10px 0; }
.g-tools div { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; font-size: 13px; }
.g-tools div b { display: block; }
.g-tools div span { color: var(--muted); font-size: 12px; }
.g-gloss { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 4px 20px; margin: 8px 0; font-size: 13.5px; }
.g-gloss div { padding: 3px 0; border-bottom: 1px dashed var(--line); }
.g-cut { font-size: 12.5px; }
.g-cut td.n { width: 70px; }
.g-same { font-size: 12.5px; color: var(--muted); margin: 2px 0 6px; }
details.g-bay { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; margin: 8px 0; }
details.g-bay > summary { cursor: pointer; padding: 9px 12px; font-weight: 600; font-size: 13.5px; }
details.g-bay > summary span { color: var(--muted); font-weight: 400; }
details.g-bay > div { padding: 0 12px 12px; }
details.g-bay .gfig { border: 0; padding: 0; }
/* drawing styles */
.gd text { font-family: Inter, system-ui, sans-serif; font-size: 12px; fill: var(--ink); }
.gd .lab { fill: var(--ink); }
.gd .labh { fill: var(--ink); paint-order: stroke; stroke: var(--panel); stroke-width: 3.5px; stroke-linejoin: round; }
.gd .note { fill: var(--muted); font-size: 11.5px; }
.gd .ttl { font-weight: 700; font-size: 12.5px; fill: var(--ink); }
.gd .dimt { font-weight: 600; font-size: 11.5px; fill: var(--ink); paint-order: stroke; stroke: var(--panel); stroke-width: 3.5px; stroke-linejoin: round; }
.gd .small { font-size: 10px; }
.gd .ext { stroke: var(--muted); stroke-width: .8; fill: none; }
.gd .dim { stroke: var(--ink); stroke-width: 1; fill: none; }
.gd .dimx { stroke: var(--muted); stroke-width: 1; fill: none; stroke-dasharray: 3 2; }
.gd .lead { stroke: var(--muted); stroke-width: 1; fill: none; }
.gd .leaddot { fill: var(--ink); }
.gd .ln { stroke: var(--ink); stroke-width: 1.2; fill: none; }
.gd .wood { fill: var(--g-wood); stroke: var(--g-wood-s); stroke-width: 1; }
.gd .wood2 { fill: var(--g-wood2); stroke: var(--g-wood-s); stroke-width: 1; }
.gd .wood.hl, .gd .wood2.hl, .gd .hl { fill: var(--g-hl); stroke: var(--accent); }
.gd .wood.hl2 { fill: var(--g-hl2); stroke: var(--accent); }
.gd .grain { stroke: var(--g-wood-s); stroke-width: .6; fill: none; opacity: .6; }
.gd .conc { fill: var(--g-conc); stroke: var(--g-conc-s); stroke-width: 1; }
.gd .block { fill: var(--g-conc); stroke: var(--g-conc-s); stroke-width: 1.2; }
.gd .block.cut { fill: var(--g-hl2); }
.gd .grout { fill: var(--g-conc-s); opacity: .55; }
.gd .earth { fill: var(--g-earth); stroke: none; }
.gd .ground { stroke: #a8895a; stroke-width: 2; fill: none; }
.gd .water { fill: var(--g-water); stroke: none; opacity: .85; }
.gd .tide { stroke: #2b7f8f; stroke-width: 1.2; stroke-dasharray: 6 4; fill: none; }
.gd .ply { fill: var(--g-ply); stroke: var(--g-wood-s); stroke-width: 1; }
.gd .plastic { fill: var(--g-plastic); stroke: none; }
.gd .plasticl { stroke: var(--g-plastic); stroke-width: 2; fill: none; }
.gd .mesh { stroke: var(--g-mesh); stroke-width: 1.4; fill: none; stroke-dasharray: 1.5 4.5; }
.gd .meshl { stroke: var(--g-mesh); stroke-width: 1; fill: none; }
.gd .rebar { stroke: var(--g-steel-s); stroke-width: 3; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.gd .tin { stroke: var(--g-tin); stroke-width: 2.2; fill: none; }
.gd .tin.top { stroke: var(--accent); }
.gd .tinf { fill: none; stroke: var(--g-tin); stroke-width: 1.2; }
.gd .tinfill { fill: var(--g-steel); fill-opacity: .35; stroke: var(--g-tin); stroke-width: 1; }
.gd .steelf { fill: var(--g-steel); stroke: var(--g-steel-s); stroke-width: 1; }
.gd .tie { fill: var(--g-steel); }
.gd .nailhead { fill: var(--g-steel-s); }
.gd .nail { stroke: var(--g-steel-s); stroke-width: 2.4; fill: none; stroke-linecap: round; }
.gd .nail.head { stroke-width: 3; }
.gd .screw { stroke: var(--g-steel-s); stroke-width: 3; fill: none; }
.gd .thread { stroke: var(--g-steel-s); stroke-width: 1; }
.gd .bolt { stroke: var(--g-steel-s); stroke-width: 6; fill: none; }
.gd .washer { fill: #222; stroke: none; }
.gd .hole { fill: var(--panel); stroke: var(--g-conc-s); stroke-width: .8; stroke-dasharray: 2 2; }
.gd .bit { stroke: var(--g-steel-s); stroke-width: 5; stroke-dasharray: 5 3; }
.gd .tool { fill: var(--muted); stroke: none; }
.gd .dust { stroke: var(--muted); stroke-width: 1.5; fill: none; stroke-dasharray: 2 4; }
.gd .tape { fill: #f5c542; stroke: #a67c00; }
.gd .tapehook { fill: var(--g-steel-s); }
.gd .tick { stroke: var(--ink); stroke-width: 1; }
.gd .mark { stroke: var(--accent); stroke-width: 2; fill: none; stroke-linecap: round; }
.gd .kerf { fill: var(--accent); opacity: .25; }
.gd .square { fill: #f2b84b; fill-opacity: .55; stroke: #a66b00; stroke-width: 1.2; }
.gd .outline { fill: none; stroke: var(--ink); stroke-width: 1.6; }
.gd .diag { stroke: var(--accent); stroke-width: 1.6; fill: none; stroke-dasharray: 6 4; }
.gd .level { fill: #f5c542; stroke: #a67c00; stroke-width: 1; }
.gd .vial { fill: #c9f2c4; stroke: #4c8a45; }
.gd .bubble { fill: #fff; stroke: #4c8a45; }
.gd .arr { stroke: var(--accent); stroke-width: 1.8; fill: none; }
.gd .arr.head { stroke-linejoin: round; }
.gd .b-cem { fill: #b9b9b9; stroke: var(--ink); stroke-width: 1; }
.gd .b-sand { fill: #ead39b; stroke: var(--ink); stroke-width: 1; }
.gd .b-grav { fill: #c7c1b2; stroke: var(--ink); stroke-width: 1; }
.gd .b-water { fill: #a7d5f0; stroke: var(--ink); stroke-width: 1; }
.gd .pipe { fill: var(--g-pipe); stroke: var(--g-pipe-s); stroke-width: 1.2; }
.gd .pipe.fit { fill: var(--g-steel); fill-opacity: .4; }
.gd .pipeline { stroke: var(--accent); stroke-width: 6; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.gd .pipeline.vent { stroke: #8a8f96; stroke-width: 4; }
.gd .primer { fill: #8b5cf6; opacity: .35; }
.gd .cement { fill: #6b7280; opacity: .45; }
.gd .string { stroke: #d6336c; stroke-width: 1.2; fill: none; }
.gd .glass { fill: #bfe3f2; stroke: #6aa5bf; stroke-width: 1; }
.gd .screen { fill: url(#gScreen); stroke: var(--g-tin); stroke-width: 1; }
.gd .alu { fill: #d5dbe0; stroke: #7a8590; stroke-width: 1; }
.gd .ghost { fill: none; stroke: var(--muted); stroke-width: 1; stroke-dasharray: 4 3; }
.gd .scr { stroke: var(--g-screen); stroke-width: 2.6; fill: none; stroke-dasharray: 2.5 1.5; }
.gd .scr.hl { stroke: var(--accent); fill: none; }
.gd .scrf { fill: var(--g-screen); fill-opacity: .14; stroke: var(--g-screen); stroke-width: 1; stroke-dasharray: 2 2; }
.gd .foam { fill: #f3cf55; stroke: #b08a14; stroke-width: .8; }
.gd .tankf { fill: var(--g-tank); stroke: var(--g-tank-s); stroke-width: 1.2; }
.gd .pipe.hl { fill: var(--g-hl); stroke: var(--accent); }
.gd .dirty { fill: #b08a5a; opacity: .8; }
.gd .areafill { fill: var(--accent); fill-opacity: .08; stroke: var(--accent); stroke-width: 1; stroke-dasharray: 4 3; }
@media print {
  .g-step { break-inside: avoid; }
  .g-part { break-before: page; }
  .gshot::after { content: none !important; }
  .g-step h3 label { display: none; }
}

/* shipping */
.ship-wrap { flex: 1; display: flex; min-height: 0; }
.ship-wrap .viewport { flex: 1.4; }
.ship-table { flex: 1; overflow-y: auto; padding: 16px 18px; background: var(--panel); border-left: 1px solid var(--line); min-width: 300px; }

/* documents */
.doc { max-width: 1100px; margin: 0 auto; padding: 22px 24px 60px; width: 100%; }
.doc h2 { font-size: 20px; margin: 4px 0 12px; letter-spacing: -.01em; }
.doc h3 { font-size: 15px; margin: 26px 0 8px; }
.doc p, .doc li { color: var(--ink); }
.doc .muted { color: var(--muted); }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; margin: 12px 0 18px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.card .k { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.card .v { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; margin-top: 2px; }
.card .s { font-size: 12px; color: var(--muted); }
table.t { width: 100%; border-collapse: collapse; background: var(--panel); border-radius: 10px; overflow: hidden; border: 1px solid var(--line); font-size: 13px; }
table.t th, table.t td { padding: 6px 9px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
table.t th { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; background: var(--chip); }
table.t td.n, table.t th.n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.t tr.sec td { background: var(--bg); font-weight: 700; font-size: 12px; color: var(--accent); }
table.t tr.tot td { font-weight: 700; background: var(--chip); }
table.t td .use { color: var(--muted); font-size: 12px; }
table.t input.price { width: 76px; text-align: right; padding: 3px 5px; border: 1px solid var(--line); border-radius: 5px; background: var(--bg); color: var(--ink); font: inherit; }
.badge { display: inline-block; font-size: 10px; font-weight: 600; padding: 1px 5px; border-radius: 4px; background: #fef3c7; color: #92400e; margin-left: 4px; vertical-align: 1px; }
.badge.quote { background: #dcfce7; color: #166534; }
.table-wrap { overflow-x: auto; }
.cutlist { display: grid; gap: 4px; }
.cut-row { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.cut-row .lab { width: 70px; flex: none; color: var(--muted); font-variant-numeric: tabular-nums; }
.cut-bar { flex: 1; display: flex; height: 22px; border-radius: 4px; overflow: hidden; background: repeating-linear-gradient(45deg, var(--chip), var(--chip) 4px, var(--line) 4px, var(--line) 8px); border: 1px solid var(--line); }
.cut-bar div { background: #e9c896; border-right: 2px solid var(--panel); color: #3b2a14; font-size: 10.5px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; padding: 3px 4px; }
.cut-bar div.s { background: #cfa76a; }
.doc ul { padding-left: 20px; }
.doc li { margin-bottom: 6px; }
.note-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 12px; }
.note { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.note h4 { margin: 0 0 4px; font-size: 14px; }
.note p { margin: 0; font-size: 13px; color: var(--muted); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0; }

/* photos */
.app.no-side .side { display: none; }
.photo-all { display: flex; gap: 6px; align-items: center; font-size: 13px; color: var(--muted); }
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.photo { margin: 0; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; display: flex; flex-direction: column; }
.photo.unused { opacity: .6; }
.photo .ph { display: block; aspect-ratio: 4 / 3; overflow: hidden; background: #fff; }
.photo .ph img { width: 100%; height: 100%; object-fit: contain; display: block; }
.photo .ph.none { display: flex; align-items: center; justify-content: center; color: #9aa1ab; font-size: 12px; }
.photo figcaption { padding: 8px 10px 10px; display: flex; flex-direction: column; gap: 2px; flex: 1; }
.photo .pn { font-weight: 600; font-size: 13px; margin-bottom: 4px; }
.photo .pq { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--muted); }
.photo .pq b { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; }
.photo .pc { margin-top: auto; padding-top: 6px; font-size: 10.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

@media (max-width: 1400px) and (min-width: 861px) {
  .step-card { top: auto; bottom: 12px; }
  .warnings { bottom: auto; top: 64px; }
}
@media (max-width: 860px) {
  body { overflow: auto; }
  .app { flex-direction: column; }
  .side { width: 100%; border-right: 0; border-bottom: 1px solid var(--line); max-height: none; }
  .content { min-height: 80vh; order: -1; }
  .tabs { flex-wrap: nowrap; overflow-x: auto; order: 3; width: 100%; flex: none; }
  .tab { white-space: nowrap; padding: 7px 10px; }
  .brand { flex: 1; }
  .ship-wrap { flex-direction: column; }
  .ship-wrap .viewport { min-height: 55vh; }
  .ship-table { border-left: 0; min-width: 0; }
  .viewport { min-height: 60vh; }
  .step-card { top: auto; bottom: 8px; left: 8px; width: calc(100% - 16px); padding: 8px 10px; }
  .step-card p { font-size: 12px; max-height: 18vh; }
  .step-ticks { display: none; }
  .playbar { padding-bottom: 10px; }
  .warnings { display: none; }
  .top { gap: 10px; padding: 10px 16px; }
  .doc { padding: 16px 16px 40px; }
  .photo-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
  .g-step { grid-template-columns: 26px minmax(0, 1fr); gap: 0 10px; }
  .g-step > .num { width: 26px; height: 26px; font-size: 12px; }
}
@media print {
  .top .tabs, .side, .total-chip, .actions { display: none !important; }
  body { overflow: visible; height: auto; }
  .subtabs { display: none !important; }
  .pane, .tpane { display: none !important; }
  .pane.active, .tpane.active { display: block !important; }
  .photo { break-inside: avoid; }
}
