/* YILIVO Smart Project Estimator V0.4 — commercial estimator IA */
:root {
  --bg: #e8f1f4;
  --panel: #fbf8f2;
  --panel-solid: #f7f3eb;
  --line: rgba(28, 52, 62, 0.12);
  --text: #1c2a32;
  --muted: #4d616b;
  --accent: #0c8a82;
  --accent-dim: rgba(12, 138, 130, 0.12);
  --warn: #b67914;
  --crit: #c2453c;
  --info: #2a6f9e;
  --ip: #0c8a82;
  --analog: #c4841d;
  --pbx: #7a4ec4;
  --gw: #d2652d;
  --swc: #2a6f9e;
  --cam: #3b82c4;
  --pa: #1a9a6a;
  --emg: #c2453c;
  --yilivo: #0c8a82;
  --third: #2a6f9e;
  --install: #9a6b2f;
  --shadow: 0 10px 28px rgba(28, 42, 50, 0.08);
  --fs-product: 18px;
  --fs-module: 13px;
  --fs-section: 13px;
  --fs-body: 14px;
  --fs-helper: 13px;
  --fs-kpi: 22px;
  --fs-kpi-label: 11px;
  --lh: 1.4;
  font-family: "Segoe UI", "Helvetica Neue", "PingFang SC", "Noto Sans SC", sans-serif;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-size: var(--fs-body);
  line-height: var(--lh);
}
button, input, select, textarea { font: inherit; color: inherit; }

#app {
  height: 100%;
  display: grid;
  grid-template-rows: auto auto auto auto minmax(0, 1fr) auto;
  min-height: 0;
}
#workspace-root {
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
#workspace-root > #stage-scene,
#workspace-root > #stage-wide { flex: 1; min-height: 0; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 18px;
  background: #fffdf8;
  border-bottom: 1px solid var(--line);
  min-height: 64px;
}
.brand { display: flex; align-items: center; gap: 14px; min-width: 0; }
.mark {
  flex: none;
  background: #12343a;
  color: #e8f4f2;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 8px 10px;
  border-radius: 4px;
}
.divider { width: 1px; height: 36px; background: var(--line); flex: none; }
.titles { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.titles strong {
  font-size: var(--fs-product);
  font-weight: 700;
  letter-spacing: 0.01em;
  line-height: 1.2;
}
.titles .product-zh {
  font-size: var(--fs-module);
  color: var(--text);
  font-weight: 600;
  line-height: 1.3;
}
.titles em {
  font-style: normal;
  color: var(--muted);
  font-size: var(--fs-helper);
  line-height: 1.35;
}
.top-actions { display: flex; gap: 8px; flex: none; }

.btn {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 4px;
  padding: 7px 11px;
  cursor: pointer;
  font-size: 14px;
  line-height: 1.3;
}
.btn.ghost:hover, .btn.ghost[aria-pressed="true"] {
  border-color: var(--accent);
  background: var(--accent-dim);
  color: #0a5f5a;
}
.btn.proceed {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  font-weight: 650;
}
.btn.proceed:hover { filter: brightness(1.05); }

.layer-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 18px;
  border-bottom: 1px solid var(--line);
  background: #fffdf8;
}
.layer-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.layer-tab {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 4px;
  padding: 8px 12px;
  cursor: pointer;
  font-size: 14px;
}
.layer-tab.active {
  border-color: var(--accent);
  background: var(--accent-dim);
  color: #0a5f5a;
  font-weight: 700;
}
.project-id {
  margin-left: auto;
  color: var(--muted);
  font-size: var(--fs-helper);
  font-variant-numeric: tabular-nums;
}

.internal-banner {
  background: #8a2a24;
  color: #fff;
  font-size: 14px;
  padding: 8px 18px;
  font-weight: 650;
}

.kpi {
  display: grid;
  grid-template-columns: 1.4fr 1.4fr 1.3fr 1fr;
  background: #fff;
  border-bottom: 1px solid var(--line);
}
.kpi article {
  padding: 10px 18px;
  border-right: 1px solid var(--line);
  min-width: 0;
}
.kpi article:last-child { border-right: 0; }
.kpi .k {
  display: block;
  font-size: var(--fs-kpi-label);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
}
.kpi .v {
  display: block;
  margin-top: 2px;
  font-size: var(--fs-kpi);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
  letter-spacing: -0.02em;
}
.kpi .hint {
  display: block;
  color: var(--muted);
  font-size: var(--fs-helper);
  margin-top: 3px;
  line-height: 1.35;
}

.stage {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr) 320px;
  min-height: 0;
  overflow: hidden;
}
.panel {
  background: var(--panel);
  padding: 14px 14px 18px;
  overflow: auto;
  min-height: 0;
}
.left-panel { border-right: 1px solid var(--line); }
.right-panel {
  border-left: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 14px 16px;
}
.module-label {
  margin: 0 0 8px;
  font-size: var(--fs-module);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
}
.panel section + section { margin-top: 16px; }
.panel h2 {
  margin: 0 0 10px;
  font-size: var(--fs-section);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
}

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; font-size: 14px; }
.field span { display: flex; justify-content: space-between; color: var(--muted); font-size: var(--fs-helper); }
.field b { color: var(--text); }
.field input[type="range"] { width: 100%; accent-color: var(--accent); }
.field select,
.field input[type="number"],
.field input[type="text"],
.qty input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 7px 8px;
  background: #fff;
  font-size: 14px;
}
.field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 7px 8px;
  background: #fff;
  resize: vertical;
  font-size: 14px;
  line-height: 1.4;
}

.schemes { display: grid; grid-template-columns: 1fr; gap: 6px; }
.scheme {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 4px;
  padding: 8px 8px;
  cursor: pointer;
  text-align: center;
  font-size: 14px;
}
.scheme.active, .scheme:hover {
  border-color: var(--accent);
  background: var(--accent-dim);
  font-weight: 650;
}
.scheme-note {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: var(--fs-helper);
  line-height: 1.4;
}
.tiers { grid-template-columns: 1fr 1fr 1fr !important; }
.assumption-grid { display: grid; grid-template-columns: 1fr; gap: 0; }
.system-list { display: flex; flex-direction: column; gap: 6px; }
.system-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 9px;
  font-size: 14px;
}
.system-card.off { opacity: 0.55; }
.system-card label { display: flex; align-items: flex-start; gap: 8px; cursor: pointer; font-weight: 650; }
.system-card .sys-note { display: block; font-weight: 400; color: var(--muted); font-size: var(--fs-helper); margin-top: 2px; line-height: 1.35; }
.system-card.regulated { border-color: rgba(182, 121, 20, 0.45); }

.more-panel {
  margin-top: 16px;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}
.more-panel > summary {
  cursor: pointer;
  font-size: var(--fs-section);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
  list-style: none;
  padding: 4px 0 8px;
}
.more-panel > summary::-webkit-details-marker { display: none; }
.more-panel > summary::after { content: " ▾"; }
.more-panel[open] > summary::after { content: " ▴"; }

.zone-list { display: flex; flex-direction: column; gap: 8px; }
.zone-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 9px;
}
.zone-card.off { opacity: 0.55; }
.zone-card header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 650;
}
.zone-card header label { display: flex; align-items: center; gap: 7px; cursor: pointer; }
.zone-card .view {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 4px;
  padding: 4px 8px;
  cursor: pointer;
  font-size: 13px;
}
.zone-card .controls { display: grid; gap: 5px; margin-top: 8px; }
.zone-card .controls label {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: var(--fs-helper);
  color: var(--muted);
}
.zone-card .controls input[type="number"] { width: 64px; }
.zone-card .summary { margin: 6px 0 0; color: var(--muted); font-size: var(--fs-helper); }

.selection {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  font-size: 14px;
  min-height: 72px;
}
.selection.empty { color: var(--muted); }
.selection strong { display: block; margin-bottom: 4px; }
.selection .meta { color: var(--muted); font-size: var(--fs-helper); }

.alerts { display: flex; flex-direction: column; gap: 8px; }
.alert {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 9px;
  font-size: var(--fs-helper);
  line-height: 1.4;
  background: #fff;
}
.alert.critical { border-color: rgba(194, 69, 60, 0.45); background: rgba(194, 69, 60, 0.08); color: #8a2a24; }
.alert.warning { border-color: rgba(182, 121, 20, 0.4); background: rgba(182, 121, 20, 0.08); color: #7a5410; }
.alert.info { color: var(--muted); }

.stats { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; margin: 0; }
.stats dt { color: var(--muted); font-size: var(--fs-helper); }
.stats dd { margin: 0; font-variant-numeric: tabular-nums; font-size: 14px; text-align: right; font-weight: 650; }

#viewport {
  position: relative;
  background: #cfe6ee;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}
#viewport canvas { display: block; width: 100%; height: 100%; }
.view-toolbar {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 4;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
  max-width: calc(100% - 24px);
}
.view-toolbar .btn { background: rgba(255, 253, 248, 0.92); font-size: 13px; padding: 5px 8px; }
#hud-labels { position: absolute; inset: 0; pointer-events: none; }
#hud-labels .lbl {
  position: absolute;
  transform: translate(-50%, -120%);
  background: rgba(20, 36, 42, 0.72);
  color: #fff;
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 3px;
  white-space: nowrap;
}
#legend {
  position: absolute;
  left: 10px;
  bottom: 10px;
  z-index: 3;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  background: rgba(255, 253, 248, 0.92);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 6px 8px;
  font-size: 12px;
  color: var(--muted);
  max-width: calc(100% - 20px);
}
#legend .sw { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px; }
.sw.ip { background: var(--ip); }
.sw.analog { background: var(--analog); }
.sw.pbx { background: var(--pbx); }
.sw.gw { background: var(--gw); }
.sw.swc { background: var(--swc); }
.sw.cam { background: var(--cam); }
.sw.pa { background: var(--pa); }
.sw.emg { background: var(--emg); }
.sw.wifi { background: #14b8a6; }
.sw.tv { background: #1e3a5f; }
.sw.acc { background: #b45309; }

#demo-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 5;
  background: rgba(12, 42, 48, 0.78);
  color: #fff;
  font-size: 13px;
  letter-spacing: 0.04em;
  padding: 6px 10px;
  border-radius: 4px;
  pointer-events: none;
  max-width: min(360px, calc(100% - 200px));
  line-height: 1.3;
}

/* Right-hand zone summaries (not a BOM dump) */
.zone-summaries { display: flex; flex-direction: column; gap: 8px; }
.zone-summary {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 11px;
  cursor: pointer;
}
.zone-summary:hover, .zone-summary.open { border-color: var(--accent); }
.zone-summary header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}
.zone-summary h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.3;
}
.zone-summary .expand-hint {
  color: var(--muted);
  font-size: 12px;
  flex: none;
}
.zone-kpis {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 6px;
  margin-top: 8px;
}
.zone-kpis span {
  background: #f6f3ec;
  border-radius: 4px;
  padding: 6px 7px;
  font-size: 13px;
  line-height: 1.3;
}
.zone-kpis b { display: block; font-size: 16px; font-variant-numeric: tabular-nums; }
.zone-types { margin: 7px 0 0; color: var(--muted); font-size: var(--fs-helper); line-height: 1.4; }
.zone-devices {
  display: none;
  margin-top: 8px;
  border-top: 1px solid var(--line);
  padding-top: 8px;
}
.zone-summary.open .zone-devices { display: block; }
.zone-devices h4 {
  margin: 8px 0 4px;
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.zone-devices ul { margin: 0; padding: 0; list-style: none; }
.zone-devices li {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 13px;
  padding: 3px 0;
  border-bottom: 1px solid rgba(28, 52, 62, 0.06);
}
.zone-devices .qty { font-variant-numeric: tabular-nums; font-weight: 650; }
.count-chip { margin: 0 0 2px; font-weight: 650; color: var(--text); }
.count-chip.ok { color: #0a5f5a; }
.count-chip.bad { color: #8a2a24; }

.budget-dock {
  margin-top: 4px;
  background: var(--accent-dim);
  border: 1px solid var(--accent);
  border-radius: 8px;
  padding: 12px;
}
.budget-dock .k {
  font-size: var(--fs-kpi-label);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
}
.budget-dock .v {
  font-size: 26px;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em;
  line-height: 1.15;
  margin: 2px 0 6px;
}
.budget-dock .parts { font-size: var(--fs-helper); color: var(--muted); line-height: 1.4; }
.dock-actions { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.dock-exclusions { font-size: var(--fs-helper); color: var(--muted); line-height: 1.4; }
.exclusions { margin-top: 4px; font-size: var(--fs-helper); color: var(--muted); line-height: 1.4; }
.exclusions ul { margin: 4px 0 0; padding-left: 16px; }

/* Wide estimate / engineering workspace */
.wide-stage {
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: var(--panel);
}
.wide-toolbar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 18px;
  border-bottom: 1px solid var(--line);
  background: #fffdf8;
}
.wide-titles { min-width: 0; flex: 1; }
.wide-titles h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.25;
}
.wide-titles .scheme-note { margin: 2px 0 0; }
.wide-body {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 1fr;
  overflow: hidden;
}
body.layer-engineering .wide-body { grid-template-columns: 300px minmax(0, 1fr); }
.eng-rail {
  border-right: 1px solid var(--line);
  overflow: auto;
}
.wide-main {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #fffdf8;
}
.tabs {
  display: flex;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--line);
  background: #fffdf8;
  flex: none;
}
.tab {
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  padding: 12px 16px;
  cursor: pointer;
  color: var(--muted);
  font-size: 14px;
}
.tab.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 700; }
.tab-body { display: none; overflow: auto; padding: 16px 18px; flex: 1; }
.tab-body.active { display: block; }

.topology { display: flex; flex-direction: column; gap: 10px; }
.topo-group {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fff;
}
.topo-group h3 {
  margin: 0 0 8px;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
}
.topo-nodes { display: flex; flex-wrap: wrap; gap: 6px; }
.node {
  border: 1px solid var(--line);
  background: #fbf8f2;
  color: var(--text);
  border-radius: 4px;
  padding: 6px 8px;
  font-size: 13px;
  cursor: pointer;
  text-align: left;
  min-width: 96px;
}
.node:hover, .node.selected { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.node .k { display: block; color: var(--muted); font-size: 11px; }
.node.ippbx { border-left: 3px solid var(--pbx); }
.node.fxs_gateway, .node.fxo_gateway, .node.sip_trunk_gateway, .node.pa_amplifier { border-left: 3px solid var(--gw); }
.node.core_switch, .node.access_switch { border-left: 3px solid var(--swc); }
.node.ip_phone, .node.comm_panel, .node.intercom { border-left: 3px solid var(--ip); }
.node.analog_phone { border-left: 3px solid var(--analog); }
.node.camera { border-left: 3px solid var(--cam); }
.node.pa_speaker { border-left: 3px solid var(--pa); }
.node.bathroom_emergency, .node.alarm, .node.sensor, .node.emergency_controller, .node.alarm_controller { border-left: 3px solid var(--emg); }
.node.wifi_ap { border-left: 3px solid #14b8a6; }
.node.iptv_tv, .node.iptv_display { border-left: 3px solid #1e3a5f; }
.node.access_reader, .node.video_intercom { border-left: 3px solid #b45309; }
.topo-link-note { font-size: var(--fs-helper); color: var(--muted); margin: 0; }

.bom { width: 100%; border-collapse: collapse; font-size: 14px; }
.bom th, .bom td { border-bottom: 1px solid var(--line); padding: 8px 8px; text-align: left; vertical-align: top; }
.bom th { color: var(--muted); font-weight: 700; font-size: 12px; letter-spacing: 0.06em; text-transform: uppercase; }
.bom .num { text-align: right; font-variant-numeric: tabular-nums; }
.bom .sku { color: var(--warn); font-size: 13px; }
.bom .note { color: var(--muted); font-size: 13px; display: block; margin-top: 2px; }
.bom-foot { color: var(--muted); font-size: var(--fs-helper); line-height: 1.45; }
.src { font-size: 13px; }
.src.yilivo { color: var(--yilivo); }
.src.third_party, .src.local, .src.cable { color: var(--third); }
.src.install, .src.labor, .src.other { color: var(--install); }

.budget-summary { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; margin-bottom: 16px; }
.budget-summary article {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
}
.budget-summary .k { font-size: var(--fs-kpi-label); letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.budget-summary .v { font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; margin-top: 3px; }
.budget-summary .grand { grid-column: 1 / -1; border-color: var(--accent); background: var(--accent-dim); }
.budget-summary .grand .v { font-size: 26px; }
.budget input[type="number"] { width: 90px; padding: 4px 6px; text-align: right; }
.commissioning { margin-top: 12px; max-width: 420px; }

.racks-head { margin: 0 0 10px; font-size: 14px; color: var(--muted); line-height: 1.45; }
.rack-card { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 8px; margin-bottom: 10px; }
.rack-card h3 { margin: 0 0 8px; font-size: 14px; }
.rack-schema {
  display: flex;
  flex-direction: column-reverse;
  gap: 1px;
  background: #1c2a32;
  border-radius: 4px;
  padding: 4px;
  max-height: 520px;
  overflow: auto;
}
.u-slot {
  min-height: 6px;
  border-radius: 1px;
  font-size: 11px;
  line-height: 1.1;
  color: #fff;
  padding: 0 4px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.u-slot.free { background: #2b3b46; color: #8aa0ab; }
.u-slot.ippbx { background: #7a4ec4; }
.u-slot.core_switch, .u-slot.access_switch { background: #2a6f9e; }
.u-slot.fxs_gateway, .u-slot.fxo_gateway, .u-slot.sip_trunk_gateway, .u-slot.pa_amplifier { background: #d2652d; }
.u-slot.ups { background: #5a6b3a; }
.u-slot.patch_panel, .u-slot.cable_manager { background: #54616a; }
.u-slot.emergency_controller, .u-slot.alarm_controller { background: #c2453c; }
.u-slot.nvr, .u-slot.wifi_controller, .u-slot.iptv_headend, .u-slot.iptv_middleware { background: #2a6f9e; }
.u-slot.access_controller, .u-slot.fire_panel { background: #c2453c; }

.compare { font-size: 14px; }
.compare table { width: 100%; border-collapse: collapse; }
.compare th, .compare td { border-bottom: 1px solid var(--line); padding: 8px 8px; text-align: right; }
.compare th:first-child, .compare td:first-child { text-align: left; }
.engineering-out { font-size: 14px; }
.engineering-out h3 {
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.engineering-out table { width: 100%; border-collapse: collapse; margin-bottom: 16px; }
.engineering-out th, .engineering-out td { border-bottom: 1px solid var(--line); padding: 7px 6px; text-align: left; font-size: 14px; }

.disclaimer {
  border-top: 1px solid var(--line);
  padding: 9px 18px;
  font-size: var(--fs-helper);
  color: var(--muted);
  background: #f3eee4;
  line-height: 1.45;
}

body.view-scene #stage-wide { display: none; }
body.view-scene #stage-scene { display: grid; }
body.view-wide #stage-scene { display: none; }
body.view-wide #stage-wide { display: flex; }

@media (max-width: 1280px) {
  .stage { grid-template-columns: 260px minmax(0, 1fr) 280px; }
  .titles strong { font-size: 16px; }
  .kpi { grid-template-columns: 1fr 1fr 1fr 1fr; }
  .kpi .v { font-size: 18px; }
  .budget-summary { grid-template-columns: 1fr 1fr 1fr; }
  body.layer-engineering .wide-body { grid-template-columns: 260px minmax(0, 1fr); }
  .top-actions { flex-wrap: wrap; justify-content: flex-end; }
}

@media (max-width: 1024px) {
  #app {
    height: auto;
    min-height: 100%;
    grid-template-rows: auto auto auto auto auto auto;
  }
  #workspace-root { overflow: visible; height: auto; }
  .stage {
    grid-template-columns: 1fr;
    grid-template-rows: auto 420px auto;
    overflow: visible;
    height: auto;
  }
  .left-panel, .right-panel { border: 0; border-bottom: 1px solid var(--line); max-height: none; overflow: visible; }
  #viewport { min-height: 420px; height: 420px; }
  .kpi { grid-template-columns: 1fr 1fr; }
  .titles strong { font-size: 16px; }
  body.layer-engineering .wide-body { grid-template-columns: 1fr; }
  body.view-wide #app { min-height: 100vh; height: auto; }
  body.view-wide #workspace-root,
  body.view-wide #stage-wide { height: auto; overflow: visible; }
  body.view-wide .wide-body, body.view-wide .wide-main, body.view-wide .tab-body.active { overflow: visible; height: auto; }
}

@media (max-width: 720px) {
  .topbar, .layer-bar, .wide-toolbar { flex-wrap: wrap; }
  .project-id { margin-left: 0; }
  .kpi { grid-template-columns: 1fr; }
  .kpi article { border-right: 0; border-bottom: 1px solid var(--line); }
  #viewport { min-height: 360px; }
  .view-toolbar { left: 10px; right: 10px; top: auto; bottom: 48px; justify-content: flex-start; }
  #demo-badge { max-width: calc(100% - 20px); }
  .dock-actions { grid-template-columns: 1fr; }
  .budget-summary { grid-template-columns: 1fr 1fr; }
  .tiers { grid-template-columns: 1fr !important; }
}

/* V0.5 industry switcher, landing and industry pages */
.industry-nav { display: flex; gap: 2px; margin-right: 10px; padding: 3px; background: #f1ece2; border-radius: 6px; }
.industry-nav a { padding: 6px 10px; border-radius: 4px; color: var(--muted); text-decoration: none; font-size: 14px; }
.industry-nav a.on { background: #fff; color: #0a5f5a; font-weight: 700; box-shadow: 0 1px 2px rgba(0,0,0,0.08); }
.industry-nav a:hover { color: var(--text); }
.landing { height: auto; min-height: 100%; }
.landing-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; padding: 24px 18px; max-width: 1180px; margin: 0 auto; }
.landing-card { display: block; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 18px; color: var(--text); text-decoration: none; box-shadow: var(--shadow); }
.landing-card:hover { border-color: var(--accent); }
.landing-card h2 { margin: 0; font-size: 20px; }
.landing-card .zh { margin: 2px 0 8px; color: var(--muted); font-weight: 600; }
.landing-card p { font-size: 14px; line-height: 1.45; }
.no-webgl-note { display: none; }
#viewport.no-webgl .no-webgl-note { display: block; position: absolute; inset: 40% 10% auto; text-align: center; color: var(--muted); font-size: 15px; }
.industry-page #hud-labels .lbl.on { background: #0c8a82; }
.bom tr.group td { background: #f3efe6; font-size: 14px; }
@media (max-width: 1280px) { .industry-nav a { padding: 5px 7px; font-size: 13px; } }
@media (max-width: 720px) { .industry-nav { flex-wrap: wrap; margin-right: 0; } }
/* V0.6 scene SKU library tab */
.library-out .bom tr.unused td { color: var(--muted); }
.library-out .dock-actions { margin: 8px 0 12px; }
