:root {
  color-scheme: light;
  --ink: #17201b;
  --muted: #5e6a63;
  --panel: rgba(255, 255, 255, 0.92);
  --line: rgba(23, 32, 27, 0.14);
  --green: #2f7d57;
  --blue: #315d8f;
  --amber: #b56a17;
  --red: #b64132;
  --bg: #eef2ef;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-height: 100%;
  margin: 0;
}

body {
  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  color: var(--ink);
  background: var(--bg);
}

button {
  font: inherit;
}

.app-shell {
  position: relative;
  min-height: 100vh;
  padding: 16px;
}

.start-screen {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 18px;
  background: #eef2ef;
}

.start-screen[hidden] {
  display: none;
}

.start-shell {
  width: min(760px, 100%);
  display: grid;
  gap: 24px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 22px 60px rgba(23, 32, 27, 0.14);
}

.start-copy {
  display: grid;
  gap: 10px;
}

.start-copy h1 {
  max-width: none;
  font-size: 34px;
}

.start-copy p:not(.eyebrow) {
  max-width: 580px;
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.start-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.start-card {
  display: grid;
  gap: 8px;
  min-height: 128px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  text-align: left;
  background: #fff;
  cursor: pointer;
}

.start-card:hover {
  border-color: rgba(49, 93, 143, 0.42);
  background: #f7faf8;
}

.start-card span {
  font-size: 18px;
  font-weight: 900;
}

.start-card small {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.start-card-primary {
  border-color: rgba(49, 93, 143, 0.42);
  background: #eef4f8;
}

.workflow-faucet .steps,
.workflow-faucet .controls,
.workflow-faucet .parts {
  display: none;
}

.start-active .simulator {
  pointer-events: none;
}

.simulator {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 392px;
  min-height: calc(100vh - 32px);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #dfe6e2;
}

.scene {
  position: relative;
  min-height: 620px;
}

.scene canvas {
  display: block;
  width: 100%;
  height: 100%;
  outline: none;
}

.camera-pad {
  position: absolute;
  left: 14px;
  top: 14px;
  z-index: 3;
  display: grid;
  grid-template-columns: repeat(3, 34px);
  grid-template-rows: repeat(5, 34px);
  gap: 5px;
  padding: 8px;
  border: 1px solid rgba(23, 32, 27, 0.14);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 10px 28px rgba(23, 32, 27, 0.12);
  backdrop-filter: blur(12px);
}

.camera-pad button {
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid rgba(23, 32, 27, 0.12);
  border-radius: 6px;
  color: #26312b;
  background: rgba(255, 255, 255, 0.86);
  font-size: 11px;
  font-weight: 900;
  cursor: pointer;
}

.camera-pad button:hover {
  border-color: rgba(49, 93, 143, 0.34);
  background: #eef4f8;
}

#viewUpBtn {
  grid-column: 2;
}

#viewLeftBtn {
  grid-column: 1;
  grid-row: 2;
}

#viewResetBtn {
  grid-column: 2;
  grid-row: 2;
}

#viewRightBtn {
  grid-column: 3;
  grid-row: 2;
}

#viewDownBtn {
  grid-column: 2;
  grid-row: 3;
}

#wallHideBtn {
  grid-column: 2;
  grid-row: 4;
}

#zoomOutBtn {
  grid-column: 1;
  grid-row: 5;
}

#wallXrayBtn {
  grid-column: 2;
  grid-row: 5;
}

#zoomInBtn {
  grid-column: 3;
  grid-row: 5;
}

#wallHideBtn.active,
#wallXrayBtn.active {
  color: #fff;
  border-color: rgba(181, 106, 23, 0.48);
  background: var(--amber);
}

.panel {
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  padding: 18px;
  border-left: 1px solid var(--line);
  background: var(--panel);
  backdrop-filter: blur(18px);
}

.brand-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.brand-actions {
  display: grid;
  justify-items: end;
  gap: 6px;
}

.brand-links {
  display: flex;
  gap: 5px;
}

.account-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 6px 10px;
  border: 1px solid rgba(49, 93, 143, 0.22);
  border-radius: 7px;
  color: var(--blue);
  background: #fff;
  font-size: 12px;
  font-weight: 900;
  text-decoration: none;
}

.account-link span {
  display: inline-grid;
  min-width: 17px;
  height: 17px;
  margin-left: 4px;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: var(--blue);
  font-size: 9px;
}

.save-plan-button {
  min-height: 29px;
  padding: 0 10px;
  border: 1px solid rgba(47, 125, 87, 0.28);
  border-radius: 7px;
  color: var(--green);
  background: rgba(47, 125, 87, 0.07);
  font-size: 11px;
  font-weight: 900;
  cursor: pointer;
}

.eyebrow,
.task-label,
.parts-title {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  max-width: 240px;
  font-size: 25px;
  line-height: 1.08;
}

h2 {
  font-size: 20px;
  line-height: 1.2;
}

.progress-pill {
  flex: 0 0 auto;
  padding: 7px 10px;
  border: 1px solid rgba(49, 93, 143, 0.24);
  border-radius: 999px;
  color: #214d79;
  background: rgba(49, 93, 143, 0.08);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.task-card {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.task-card p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.45;
}

.message {
  min-height: 38px;
  margin-top: 12px;
  padding: 10px 11px;
  border-radius: 6px;
  color: #244534;
  background: rgba(47, 125, 87, 0.1);
  font-size: 14px;
  line-height: 1.3;
}

.message.warn {
  color: #703c0e;
  background: rgba(181, 106, 23, 0.13);
}

.message.done {
  color: #174b32;
  background: rgba(47, 125, 87, 0.17);
}

.steps {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.step {
  display: grid;
  grid-template-columns: 30px 1fr;
  gap: 10px;
  align-items: center;
  min-height: 48px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.62);
}

.step-index {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 999px;
  color: var(--muted);
  background: rgba(23, 32, 27, 0.08);
  font-size: 13px;
  font-weight: 800;
}

.step strong {
  display: block;
  font-size: 14px;
  line-height: 1.2;
}

.step span:last-child {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.3;
}

.step.active {
  border-color: rgba(49, 93, 143, 0.42);
  background: rgba(49, 93, 143, 0.08);
}

.step.complete .step-index {
  color: #fff;
  background: var(--green);
}

.controls {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
}

.controls button {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--ink);
  background: #fff;
  cursor: pointer;
}

.controls button:last-child {
  color: #fff;
  border-color: #1e5c3d;
  background: var(--green);
}

.controls button:disabled {
  opacity: 0.48;
  cursor: not-allowed;
}

.cad-panel {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
}

.cad-controls {
  display: grid;
  gap: 10px;
}

.cad-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.cad-tabs button {
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--muted);
  background: #fff;
  font-size: 12px;
  font-weight: 850;
  cursor: pointer;
}

.cad-tabs button.active {
  color: #fff;
  border-color: var(--blue);
  background: var(--blue);
}

.cad-dimension-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.cad-dimension-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 3px 4px;
  min-width: 0;
}

.cad-dimension-field span {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 9px;
  font-weight: 850;
}

.cad-dimension-field input {
  width: 100%;
  min-width: 0;
  height: 30px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 6px;
  color: var(--ink);
  background: #fff;
  font: inherit;
  font-size: 11px;
  font-weight: 800;
}

.cad-dimension-field small {
  color: var(--muted);
  font-size: 9px;
  font-weight: 750;
}

.cad-plan {
  width: 100%;
  aspect-ratio: 300 / 210;
  border: 1px solid rgba(23, 32, 27, 0.12);
  border-radius: 7px;
  background: #f7faf8;
  touch-action: none;
}

.cad-plan-plumbing {
  background:
    linear-gradient(rgba(38, 49, 43, 0.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(38, 49, 43, 0.055) 1px, transparent 1px),
    #f7faf8;
  background-size: 18px 18px;
}

.pipe-builder {
  display: grid;
  gap: 9px;
}

.pipe-builder-workspace {
  display: grid;
  gap: 10px;
}

.pipe-builder-section,
.pipe-cad-card {
  display: grid;
  gap: 7px;
  padding: 9px;
  border: 1px solid rgba(23, 32, 27, 0.1);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.68);
}

.pipe-section-title {
  color: #26312b;
  font-size: 11px;
  font-weight: 950;
  letter-spacing: 0;
}

.fixture-anchor-controls {
  gap: 6px;
}

.fixture-surface-grid {
  display: grid;
  gap: 6px;
}

.fixture-surface-grid > div {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  align-items: center;
  gap: 6px;
}

.fixture-surface-grid > div > span {
  color: var(--muted);
  font-size: 9px;
  font-weight: 850;
}

.fixture-surface-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
}

.fixture-surface-toggle button {
  min-width: 0;
  min-height: 28px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  background: #fff;
  font-size: 9px;
  font-weight: 850;
  cursor: pointer;
}

.fixture-surface-toggle button.active {
  color: #fff;
  border-color: var(--blue);
  background: var(--blue);
}

.fixture-view-label {
  color: var(--muted);
  font-size: 9px;
  font-weight: 800;
}

.fixture-anchor-plan,
.fixture-anchor-elevation {
  display: block;
  width: 100%;
  border: 1px solid rgba(23, 32, 27, 0.1);
  border-radius: 5px;
  background: rgba(247, 250, 247, 0.82);
  touch-action: none;
}

.fixture-anchor-plan {
  aspect-ratio: 300 / 210;
}

.fixture-anchor-elevation {
  aspect-ratio: 300 / 128;
}

.fixture-wall {
  fill: rgba(223, 229, 223, 0.56);
  stroke: rgba(23, 32, 27, 0.26);
  stroke-width: 1.2;
}

.fixture-anchor {
  cursor: grab;
  touch-action: none;
}

.fixture-anchor:active {
  cursor: grabbing;
}

.fixture-anchor text {
  fill: #26312b;
  font-size: 9px;
  font-weight: 900;
  pointer-events: none;
}

.fixture-anchor-faucet circle {
  fill: #f6d44a;
  stroke: #17201b;
  stroke-width: 1.5;
}

.fixture-anchor-faucet path,
.fixture-anchor-supply line {
  fill: none;
  stroke: #17201b;
  stroke-width: 1.4;
  pointer-events: none;
}

.fixture-anchor-supply .hot {
  fill: #b3392f;
  stroke: #70231d;
  stroke-width: 1.5;
}

.fixture-anchor-supply .cold {
  fill: #2f6eaa;
  stroke: #214d79;
  stroke-width: 1.5;
}

.fixture-anchor-drain circle:first-child {
  fill: #8b9290;
  stroke: #4d5652;
  stroke-width: 1.5;
}

.fixture-anchor-drain circle:nth-child(2) {
  fill: #f7faf7;
  pointer-events: none;
}

.fixture-anchor-readout {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
}

.fixture-anchor-readout span {
  overflow: hidden;
  padding: 4px;
  border: 1px solid rgba(23, 32, 27, 0.08);
  border-radius: 4px;
  color: var(--muted);
  font-size: 8.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fixture-3d-controls {
  gap: 8px;
}

.fixture-3d-view {
  display: block;
  width: 100%;
  aspect-ratio: 300 / 220;
  border: 1px solid rgba(23, 32, 27, 0.12);
  border-radius: 6px;
  background: rgba(239, 245, 242, 0.88);
  touch-action: none;
}

.fixture-3d-wall {
  fill: rgba(187, 204, 197, 0.18);
  stroke: rgba(38, 49, 43, 0.48);
  stroke-width: 1.2;
}

.fixture-3d-base {
  fill: rgba(153, 177, 166, 0.24);
  stroke: rgba(38, 49, 43, 0.5);
  stroke-width: 1.2;
}

.fixture-3d-top {
  fill: rgba(229, 235, 231, 0.48);
  stroke: rgba(38, 49, 43, 0.42);
  stroke-width: 1.1;
}

.fixture-3d-frame,
.fixture-3d-depth {
  fill: none;
  stroke: rgba(38, 49, 43, 0.36);
  stroke-width: 1;
  stroke-dasharray: 4 3;
  pointer-events: none;
}

.fixture-3d-port,
.fixture-3d-faucet {
  cursor: grab;
  touch-action: none;
}

.fixture-3d-port:active,
.fixture-3d-faucet:active {
  cursor: grabbing;
}

.fixture-3d-port text,
.fixture-3d-faucet text {
  fill: #26312b;
  font-size: 9px;
  font-weight: 900;
  pointer-events: none;
}

.fixture-3d-port-halo {
  fill: rgba(255, 255, 255, 0.78);
  stroke: rgba(23, 32, 27, 0.22);
  stroke-width: 1;
}

.fixture-3d-port-core {
  stroke-width: 1.8;
}

.fixture-3d-port.hot .fixture-3d-port-core {
  fill: #b3392f;
  stroke: #70231d;
}

.fixture-3d-port.cold .fixture-3d-port-core {
  fill: #2f6eaa;
  stroke: #214d79;
}

.fixture-3d-port.drain .fixture-3d-port-core {
  fill: #747e79;
  stroke: #414a46;
}

.fixture-3d-port-hole {
  fill: #f7faf7;
  pointer-events: none;
}

.fixture-3d-faucet circle {
  fill: #f6d44a;
  stroke: #17201b;
  stroke-width: 1.5;
}

.fixture-3d-faucet path {
  fill: none;
  stroke: #17201b;
  stroke-width: 1.4;
  pointer-events: none;
}

.fixture-3d-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  color: var(--muted);
  font-size: 8.5px;
  font-weight: 750;
}

.fixture-3d-legend span:last-child {
  margin-left: auto;
}

.fixture-3d-readouts {
  display: grid;
  gap: 5px;
}

.fixture-3d-readout {
  display: grid;
  grid-template-columns: 62px minmax(0, 1fr);
  align-items: center;
  gap: 4px 6px;
  padding-top: 5px;
  border-top: 1px solid rgba(23, 32, 27, 0.08);
}

.fixture-3d-readout > div:first-child {
  display: grid;
  gap: 1px;
}

.fixture-3d-readout b {
  color: #26312b;
  font-size: 9px;
}

.fixture-3d-readout > div:first-child span,
.fixture-3d-readout small,
.fixture-3d-faucet-readout {
  color: var(--muted);
  font-size: 8.5px;
}

.fixture-3d-readout small {
  grid-column: 1 / -1;
}

.fixture-3d-faucet-readout {
  padding-top: 5px;
  border-top: 1px solid rgba(23, 32, 27, 0.08);
}

.pipe-market-toggle {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px;
}

.pipe-market-toggle button,
.pipe-spec-grid button,
.pipe-module-grid button,
.pipe-layer-grid button,
.pipe-builder-actions button,
.pipe-transform-pad button,
.pipe-rotate-pad button,
.pipe-gizmo-toolbar button {
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--muted);
  background: #fff;
  font-weight: 850;
  cursor: pointer;
}

.pipe-market-toggle button {
  min-height: 30px;
  font-size: 11.5px;
}

.pipe-spec-grid,
.pipe-module-grid,
.pipe-layer-grid,
.pipe-builder-actions,
.pipe-transform-pad,
.pipe-rotate-pad,
.pipe-gizmo-toolbar {
  display: grid;
  gap: 5px;
}

.pipe-spec-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.pipe-module-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.pipe-layer-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.pipe-builder-actions {
  grid-template-columns: repeat(auto-fit, minmax(58px, 1fr));
}

.pipe-gizmo-toolbar {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.pipe-transform-pad {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.pipe-rotate-pad {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.pipe-spec-grid button,
.pipe-module-grid button,
.pipe-layer-grid button,
.pipe-builder-actions button,
.pipe-transform-pad button,
.pipe-rotate-pad button,
.pipe-gizmo-toolbar button {
  display: grid;
  gap: 3px;
  min-height: 54px;
  padding: 7px 5px;
  text-align: left;
}

.pipe-builder-actions button {
  min-height: 34px;
  place-items: center;
  text-align: center;
  font-size: 10.5px;
}

.pipe-gizmo-toolbar button {
  min-height: 34px;
  place-items: center;
  text-align: center;
  color: #26312b;
  font-size: 10.5px;
}

.pipe-gizmo-toolbar button.active {
  color: #fff;
  border-color: var(--amber);
  background: var(--amber);
}

.pipe-transform-pad button {
  min-height: 32px;
  place-items: center;
  text-align: center;
  font-size: 10.5px;
}

.pipe-rotate-pad button {
  min-height: 32px;
  place-items: center;
  text-align: center;
  color: #26312b;
  font-size: 10.5px;
}

.pipe-module-grid button {
  grid-template-columns: 1fr;
  grid-template-rows: 40px auto;
  align-items: center;
  justify-items: center;
  min-height: 76px;
  padding: 7px 4px;
  text-align: center;
}

.pipe-module-icon {
  width: 58px;
  max-width: 100%;
  height: 36px;
}

.pipe-module-icon g {
  fill: none;
  stroke: currentColor;
  stroke-width: 3.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.pipe-module-icon rect,
.pipe-module-icon circle {
  fill: rgba(255, 255, 255, 0.88);
  stroke: currentColor;
}

.pipe-module-grid button:last-child {
  grid-column: auto;
}

.pipe-spec-grid span,
.pipe-module-grid span,
.pipe-layer-grid span {
  color: var(--ink);
  font-size: 13px;
  font-weight: 900;
}

.pipe-module-grid span {
  font-size: 10px;
  line-height: 1.05;
}

.pipe-spec-grid small,
.pipe-module-grid small,
.pipe-layer-grid small {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.2;
}

.pipe-module-grid small {
  display: none;
}

.pipe-market-toggle button.active,
.pipe-spec-grid button.active,
.pipe-module-grid button.active,
.pipe-layer-grid button.active,
.pipe-builder-actions button.active {
  color: #fff;
  border-color: var(--blue);
  background: var(--blue);
  box-shadow: 0 0 0 2px rgba(49, 93, 143, 0.22);
}

.pipe-spec-grid button.active span,
.pipe-spec-grid button.active small,
.pipe-module-grid button.active span,
.pipe-module-grid button.active small,
.pipe-layer-grid button.active span,
.pipe-layer-grid button.active small {
  color: #fff;
}

.pipe-builder-readout {
  display: grid;
  gap: 4px;
  min-height: 24px;
  padding: 6px 8px;
  border: 1px solid rgba(23, 32, 27, 0.1);
  border-radius: 7px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.76);
  font-size: 10.5px;
  font-weight: 800;
}

.pipe-builder-readout small {
  color: rgba(94, 106, 99, 0.92);
  font-size: 10px;
  line-height: 1.25;
}

.pipe-spec-note {
  display: grid;
  gap: 2px;
  padding: 8px;
  border: 1px solid rgba(49, 93, 143, 0.18);
  border-radius: 7px;
  background: rgba(49, 93, 143, 0.06);
}

.pipe-spec-note b {
  color: #214d79;
  font-size: 11.5px;
}

.pipe-spec-note span {
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.35;
}

.pipe-spec-note span strong {
  color: inherit;
  font-size: 9.5px;
  letter-spacing: 0;
}

.pipe-spec-note-blocked {
  border-color: rgba(180, 112, 16, 0.32);
  background: rgba(255, 248, 230, 0.9);
}

.pipe-spec-note-blocked b,
.pipe-spec-note-blocked span strong {
  color: #8a5208;
}

.market-compatibility {
  display: grid;
  gap: 5px;
  border-color: rgba(40, 121, 91, 0.28);
  background: rgba(40, 121, 91, 0.06);
}

.market-compatibility > span,
.market-compatibility > small {
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.35;
}

.market-compatibility.blocked,
.market-compatibility.warning {
  border-color: rgba(180, 112, 16, 0.28);
  background: rgba(255, 248, 230, 0.9);
}

.market-compatibility.blocked .drain-flow-badge,
.market-compatibility.warning .drain-flow-badge {
  color: #8a5208;
}

.drain-flow-check {
  border-color: rgba(180, 112, 16, 0.22);
  background: rgba(255, 251, 241, 0.82);
}

.drain-flow-check.pass {
  border-color: rgba(40, 121, 91, 0.28);
  background: rgba(40, 121, 91, 0.06);
}

.drain-flow-check.review {
  border-color: rgba(190, 79, 49, 0.3);
  background: rgba(190, 79, 49, 0.06);
}

.drain-flow-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.drain-flow-badge {
  padding: 3px 6px;
  border: 1px solid rgba(94, 106, 99, 0.24);
  border-radius: 4px;
  color: #5e6a63;
  font-size: 9px;
  font-weight: 900;
}

.drain-flow-check.pass .drain-flow-badge {
  border-color: rgba(40, 121, 91, 0.35);
  color: #28795b;
}

.drain-flow-check.review .drain-flow-badge {
  border-color: rgba(190, 79, 49, 0.36);
  color: #a54128;
}

.drain-flow-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 5px;
}

.drain-flow-grid span {
  display: grid;
  min-width: 0;
  gap: 1px;
  padding: 5px;
  border: 1px solid rgba(23, 32, 27, 0.08);
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.62);
}

.drain-flow-grid b {
  overflow: hidden;
  color: #26312b;
  font-size: 10.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.drain-flow-grid small,
.drain-flow-note {
  color: var(--muted);
  font-size: 9px;
  line-height: 1.25;
}

.cad-route-presets {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 5px;
}

.cad-route-presets button {
  min-height: 28px;
  padding: 0 6px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--muted);
  background: #fff;
  font-size: 10.5px;
  font-weight: 850;
  cursor: pointer;
}

.cad-route-presets button.active {
  color: #fff;
  border-color: #26312b;
  background: #26312b;
}

.cad-cabinet {
  fill: rgba(223, 230, 226, 0.7);
  stroke: #26312b;
  stroke-width: 1.6;
}

.cad-cabinet-muted {
  fill: rgba(223, 230, 226, 0.34);
  stroke-dasharray: 4 3;
}

.cad-countertop {
  fill: rgba(49, 93, 143, 0.05);
  stroke: rgba(49, 93, 143, 0.35);
  stroke-dasharray: 4 3;
  stroke-width: 1;
}

.cad-sink {
  fill: rgba(197, 201, 201, 0.86);
  stroke: #315d8f;
  stroke-width: 1.6;
  cursor: move;
}

.cad-faucet {
  fill: #b56a17;
  stroke: #fff;
  stroke-width: 1.5;
}

.cad-sink-context {
  fill: rgba(197, 201, 201, 0.18);
  stroke: rgba(49, 93, 143, 0.28);
  stroke-width: 1.2;
  stroke-dasharray: 3 3;
  pointer-events: none;
}

.cad-axis {
  stroke: rgba(38, 49, 43, 0.6);
  stroke-width: 1.2;
}

.cad-axis-arrow {
  fill: rgba(38, 49, 43, 0.72);
}

.cad-axis-label,
.cad-axis-tick {
  fill: #26312b;
  font-size: 8.5px;
  font-weight: 850;
  text-anchor: middle;
}

.cad-axis-z-label {
  writing-mode: vertical-rl;
}

.cad-axis-tick {
  fill: var(--muted);
  text-anchor: start;
}

.cad-route {
  fill: none;
  stroke-width: 3.2;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.82;
  pointer-events: none;
}

.cad-route-hotFeed {
  stroke: #b52b24;
}

.cad-route-coldFeed,
.cad-route-softenerIn {
  stroke: #1f5f9f;
}

.cad-route-softenerOut {
  stroke: #28795b;
}

.cad-route-planned {
  stroke-dasharray: 5 4;
  opacity: 0.48;
}

.cad-route-handle {
  fill: #fff;
  stroke-width: 2.5;
  cursor: ns-resize;
  pointer-events: auto;
}

.cad-route-bend-handle {
  fill: #f7faf8;
  stroke-width: 2.3;
  cursor: move;
  pointer-events: auto;
}

.cad-dim {
  stroke: rgba(23, 32, 27, 0.42);
  stroke-width: 1;
}

.cad-dim-label,
.cad-object-label {
  fill: #26312b;
  font-size: 10px;
  font-weight: 800;
  text-anchor: middle;
  dominant-baseline: middle;
}

.cad-dim-label-vertical {
  writing-mode: vertical-rl;
}

.cad-object-label {
  fill: #214d79;
  pointer-events: none;
}

.cad-handle {
  fill: #b56a17;
  stroke: #fff;
  stroke-width: 1.2;
  cursor: ew-resize;
}

.cad-handle-south {
  cursor: ns-resize;
}

.cad-handle-sink {
  cursor: nwse-resize;
}

.cad-readout {
  display: grid;
  gap: 3px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
}

.cad-z-readout {
  gap: 5px;
}

.cad-z-row {
  display: grid;
  grid-template-columns: 10px minmax(64px, 0.8fr) auto minmax(76px, 1fr) 34px;
  align-items: center;
  gap: 6px;
}

.cad-z-row b {
  color: var(--ink);
  font-size: 11px;
}

.cad-z-row em {
  position: relative;
  height: 4px;
  border-radius: 999px;
  background: rgba(23, 32, 27, 0.12);
}

.cad-z-row em::after {
  content: "";
  position: absolute;
  top: -3px;
  left: var(--z);
  width: 4px;
  height: 10px;
  border-radius: 999px;
  background: #26312b;
}

.cad-z-slider {
  width: 100%;
  min-width: 74px;
  accent-color: var(--blue);
}

.cad-pipe-workspace {
  fill: rgba(49, 93, 143, 0.045);
  stroke: rgba(49, 93, 143, 0.24);
  stroke-width: 1;
  stroke-dasharray: 4 3;
}

.cad-pipe-layer {
  stroke: rgba(181, 106, 23, 0.26);
  stroke-width: 1.2;
  stroke-dasharray: 3 3;
}

.cad-pipe-layer.active {
  stroke: rgba(181, 106, 23, 0.82);
  stroke-width: 2;
  stroke-dasharray: none;
}

.cad-builder-port-line {
  stroke: rgba(49, 93, 143, 0.62);
  stroke-width: 2;
  stroke-linecap: round;
}

.cad-builder-node {
  fill: #315d8f;
  stroke: #fff;
  stroke-width: 1.4;
}

.cad-builder-pick {
  cursor: pointer;
}

.cad-builder-node.selected {
  fill: #b56a17;
  stroke: #17201b;
  stroke-width: 1.8;
}

.cad-builder-label {
  fill: #26312b;
  font-size: 7px;
  font-weight: 900;
  paint-order: stroke;
  stroke: rgba(255, 255, 255, 0.86);
  stroke-width: 2px;
}

.cad-route-key {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: #26312b;
}

.cad-route-key-hotFeed {
  background: #b52b24;
}

.cad-route-key-coldFeed,
.cad-route-key-softenerIn {
  background: #1f5f9f;
}

.cad-route-key-softenerOut {
  background: #28795b;
}

.cad-route-drainWaste {
  stroke: #6f7775;
  stroke-width: 5;
}

.cad-route-softenerWaste {
  stroke: #5f6c72;
  stroke-width: 3.5;
  stroke-dasharray: 7 4;
}

.cad-route-key-drainWaste,
.cad-route-key-softenerWaste {
  background: #6f7775;
}

.parts {
  margin-top: auto;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.parts-list {
  display: grid;
  gap: 8px;
}

.part-chip {
  display: grid;
  gap: 4px;
  min-height: 58px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--ink);
  background: #fff;
  text-align: left;
  cursor: pointer;
}

.part-chip span {
  font-weight: 800;
}

.part-chip small {
  color: var(--muted);
  font-size: 12px;
}

.part-chip.active {
  color: #fff;
  border-color: var(--blue);
  background: var(--blue);
}

.part-chip.active small {
  color: rgba(255, 255, 255, 0.82);
}

.part-chip.done {
  color: #1f5e40;
  border-color: rgba(47, 125, 87, 0.24);
  background: rgba(47, 125, 87, 0.1);
  cursor: default;
}

.part-chip.done small {
  color: #3e755b;
}

.tool-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  padding-top: 8px;
  border-top: 1px solid rgba(23, 32, 27, 0.08);
}

.tool-strip-item {
  min-height: 34px;
  padding: 6px 7px;
  border: 1px solid rgba(23, 32, 27, 0.12);
  border-radius: 6px;
  color: #3f4a43;
  background: #f7f8f7;
  font-size: 11px;
  font-weight: 750;
  cursor: pointer;
}

.tool-strip-item.current {
  color: #fff;
  border-color: var(--blue);
  background: var(--blue);
}

.tool-strip-item.done {
  color: #1f5e40;
  border-color: rgba(47, 125, 87, 0.24);
  background: rgba(47, 125, 87, 0.1);
}

.rotate-tools {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.rotate-tool {
  min-height: 32px;
  padding: 6px;
  border: 1px solid rgba(23, 32, 27, 0.12);
  border-radius: 6px;
  color: #26312b;
  background: #eef3f1;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
}

.rotate-tool:hover {
  border-color: rgba(47, 125, 87, 0.32);
  background: #e3ece8;
}

.debug-panel {
  position: fixed;
  left: 16px;
  bottom: 16px;
  z-index: 10;
  width: min(360px, calc(100vw - 32px));
  max-height: 42vh;
  overflow: auto;
  padding: 12px;
  border: 1px solid rgba(23, 32, 27, 0.2);
  border-radius: 8px;
  color: #17201b;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 16px 42px rgba(23, 32, 27, 0.16);
  backdrop-filter: blur(16px);
  font-size: 12px;
}

.hotspot-panel {
  position: fixed;
  right: 18px;
  top: 82px;
  z-index: 12;
  display: none;
  width: min(320px, calc(100vw - 36px));
  padding: 14px;
  border: 1px solid rgba(23, 32, 27, 0.16);
  border-radius: 8px;
  color: #17201b;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 18px 48px rgba(23, 32, 27, 0.18);
  backdrop-filter: blur(14px);
}

.hotspot-panel.visible {
  display: block;
}

.hotspot-close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  border: 1px solid rgba(23, 32, 27, 0.14);
  border-radius: 50%;
  color: #17201b;
  background: #fff;
  cursor: pointer;
}

.hotspot-eyebrow {
  margin-bottom: 6px;
  color: #6b746e;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.hotspot-special-tag {
  display: inline-block;
  margin-left: 7px;
  padding: 2px 5px;
  border-radius: 4px;
  color: #fff;
  background: var(--amber);
  font-size: 10px;
  font-weight: 900;
}

.hotspot-title {
  padding-right: 32px;
  font-size: 16px;
  font-weight: 850;
}

.hotspot-coords {
  margin-top: 8px;
  padding: 7px 8px;
  border-radius: 6px;
  color: #17201b;
  background: rgba(246, 212, 74, 0.16);
  font-family: Consolas, "Liberation Mono", monospace;
  font-size: 12px;
}

.hotspot-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  margin-top: 10px;
}

.hotspot-action {
  min-height: 32px;
  padding: 6px 8px;
  border: 1px solid rgba(23, 32, 27, 0.14);
  border-radius: 6px;
  color: #26312b;
  background: #f7f8f7;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.hotspot-action:hover {
  border-color: rgba(181, 106, 23, 0.38);
  background: rgba(181, 106, 23, 0.1);
}

.hotspot-panel p {
  margin: 10px 0 0;
  color: #4f5b54;
  line-height: 1.5;
  font-size: 13px;
}

.debug-title {
  margin-bottom: 8px;
  font-weight: 800;
}

.debug-panel > .debug-title:first-child {
  cursor: pointer;
}

.debug-panel.collapsed {
  width: auto;
  max-height: none;
  padding: 9px 12px;
  overflow: hidden;
}

.debug-panel.collapsed > :not(.debug-title:first-child) {
  display: none;
}

.debug-panel.collapsed > .debug-title:first-child {
  margin-bottom: 0;
}

.debug-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 5px 0;
  border-top: 1px solid rgba(23, 32, 27, 0.08);
}

.debug-row span {
  color: #5e6a63;
  text-align: right;
}

.debug-selected-model {
  margin-inline: -4px;
  padding-inline: 4px;
  border-color: rgba(246, 212, 74, 0.42);
  border-radius: 6px;
  background: rgba(246, 212, 74, 0.14);
}

.debug-special-tag {
  display: inline-block;
  margin-left: 6px;
  padding: 2px 5px;
  border-radius: 4px;
  color: #fff;
  background: var(--amber);
  font-size: 10px;
  font-style: normal;
  font-weight: 900;
}

.debug-pin-toggle {
  justify-self: start;
  width: fit-content;
  padding: 4px 7px;
  border: 1px solid rgba(23, 32, 27, 0.14);
  border-radius: 5px;
  color: #26312b;
  background: #f7f8f7;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
}

.debug-pin-toggle:hover {
  border-color: rgba(181, 106, 23, 0.38);
  background: rgba(181, 106, 23, 0.1);
}

.debug-adjuster {
  display: grid;
  gap: 8px;
  margin: 10px 0;
  padding-top: 8px;
  border-top: 1px solid rgba(23, 32, 27, 0.12);
}

.debug-adjuster select,
.debug-adjuster textarea,
.debug-adjuster input,
.debug-actions button {
  width: 100%;
  border: 1px solid rgba(23, 32, 27, 0.18);
  border-radius: 6px;
  color: #17201b;
  background: rgba(255, 255, 255, 0.88);
  font: inherit;
}

.debug-adjuster select {
  padding: 6px 8px;
}

.debug-toggle {
  display: flex;
  gap: 7px;
  align-items: center;
  color: #3f4a43;
}

.debug-toggle input {
  width: auto;
  margin: 0;
}

.debug-adjuster textarea {
  resize: vertical;
  min-height: 110px;
  padding: 8px;
  font-family: Consolas, "Liberation Mono", monospace;
  font-size: 11px;
}

.debug-adjust-fields {
  display: grid;
  gap: 7px;
}

.debug-model-coords {
  display: grid;
  max-height: 180px;
  overflow: auto;
}

.debug-spec-row {
  display: grid;
  gap: 3px;
  padding: 7px 0;
  border-top: 1px solid rgba(23, 32, 27, 0.08);
}

.debug-spec-row strong {
  color: #17201b;
  font-size: 12px;
}

.debug-spec-row span {
  color: #5e6a63;
  font-family: Consolas, "Liberation Mono", monospace;
  font-size: 11px;
}

.debug-adjust-row {
  display: grid;
  grid-template-columns: 58px repeat(3, minmax(0, 1fr));
  gap: 6px;
  align-items: center;
}

.debug-adjust-row label {
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr);
  gap: 3px;
  align-items: center;
}

.debug-adjust-row input {
  min-width: 0;
  padding: 5px 4px;
}

.debug-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.debug-actions button {
  padding: 6px 8px;
  cursor: pointer;
}

.debug-loaded span {
  color: #2f7d57;
}

.debug-fallback span {
  color: #b56a17;
}

.debug-checking span {
  color: #315d8f;
}

@media (max-width: 980px) {
  .app-shell {
    padding: 0;
  }

  .simulator {
    grid-template-columns: 1fr;
    width: 100%;
    max-width: 100vw;
    min-height: 100vh;
    overflow-x: hidden;
    border: 0;
    border-radius: 0;
  }

  .scene {
    min-width: 0;
    min-height: 52vh;
  }

  .panel {
    min-width: 0;
    max-height: none;
    overflow-x: hidden;
    overflow-y: visible;
    border-left: 0;
    border-top: 1px solid var(--line);
  }
}

@media (max-width: 520px) {
  .start-screen {
    padding: 12px;
  }

  .start-shell {
    padding: 18px;
  }

  .start-copy h1 {
    font-size: 26px;
  }

  .start-actions {
    grid-template-columns: 1fr;
  }

  .panel {
    width: 100%;
    max-width: 100%;
    padding: 14px;
  }

  .cad-panel,
  .cad-controls,
  .pipe-builder,
  .pipe-builder-workspace,
  .pipe-builder-section,
  .pipe-cad-card {
    min-width: 0;
    max-width: 100%;
    overflow-x: hidden;
  }

  .cad-panel {
    width: 100%;
  }

  .fixture-surface-grid > div {
    grid-template-columns: 1fr;
    gap: 3px;
  }

  .fixture-anchor-readout {
    grid-template-columns: 1fr;
  }

  .pipe-layer-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .task-card p,
  .message {
    overflow-wrap: anywhere;
  }

  .brand-row {
    flex-direction: column;
  }

  .brand-actions {
    width: 100%;
    grid-template-columns: auto auto;
    justify-items: start;
  }

  .brand-links {
    grid-column: 1 / -1;
  }

  h1 {
    max-width: none;
    font-size: 22px;
  }

  .controls,
  .parts-list {
    grid-template-columns: 1fr;
  }
}
