/* ====================================================================
   Globe Tracker 3D Workbench: Dark-Mode Glassmorphism Design System
   ==================================================================== */

:root {
  --bg-dark: #090d16;
  --bg-panel: rgba(15, 23, 42, 0.82);
  --bg-panel-border: rgba(255, 255, 255, 0.12);
  --bg-panel-inner: rgba(30, 41, 59, 0.65);
  
  --primary: #38bdf8;
  --primary-hover: #0ea5e9;
  --primary-glow: rgba(56, 189, 248, 0.35);
  
  --accent: #a855f7;
  --accent-glow: rgba(168, 85, 247, 0.35);

  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;

  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  
  --font-sans: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body, html {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--bg-dark);
  font-family: var(--font-sans);
  color: var(--text-main);
  user-select: none;
}

#app {
  width: 100vw;
  height: 100vh;
  position: relative;
}

#canvas-container {
  width: 100%;
  height: 100%;
  position: absolute;
  top: 0;
  left: 0;
  z-index: 1;
}

/* ==================== Top Navigation ==================== */
.top-nav {
  position: absolute;
  top: 16px;
  left: 16px;
  right: 16px;
  height: 58px;
  background: var(--bg-panel);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--bg-panel-border);
  border-radius: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 20px;
  z-index: 10;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-icon {
  font-size: 24px;
  filter: drop-shadow(0 0 10px var(--primary-glow));
}

.brand-text h1 {
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -0.3px;
  color: var(--text-main);
}

.version-tag {
  font-size: 11.5px;
  color: var(--text-muted);
  font-weight: 500;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text-muted);
  padding: 7px 15px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.nav-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: var(--text-main);
}

.nav-btn.active {
  background: linear-gradient(135deg, #0284c7, #0369a1);
  border-color: #38bdf8;
  color: #ffffff;
  box-shadow: 0 0 16px var(--primary-glow);
}

.nav-btn-icon {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text-main);
  padding: 7px 12px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.nav-btn-icon:hover {
  background: rgba(255, 255, 255, 0.15);
}

/* ==================== Sidebar Panel ==================== */
.sidebar {
  position: absolute;
  top: 86px;
  left: 16px;
  bottom: 48px;
  width: 380px;
  background: var(--bg-panel);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--bg-panel-border);
  border-radius: 12px;
  z-index: 10;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
}

.sidebar::-webkit-scrollbar {
  width: 5px;
}
.sidebar::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 4px;
}

.panel-section {
  display: none;
  flex-direction: column;
  gap: 16px;
}

.panel-section.active {
  display: flex;
}

.section-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-main);
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

.btn-text {
  background: none;
  border: none;
  color: var(--primary);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.btn-text:hover { text-decoration: underline; }

.control-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: var(--bg-panel-inner);
  border: 1px solid rgba(255, 255, 255, 0.06);
  padding: 12px 14px;
  border-radius: 8px;
}

.control-label {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
}

.val-display {
  font-family: var(--font-mono);
  font-size: 12.5px;
  font-weight: 700;
  color: var(--primary);
}

input[type="range"] {
  width: 100%;
  accent-color: var(--primary);
  cursor: pointer;
}

.range-ticks {
  display: flex;
  justify-content: space-between;
  font-size: 10.5px;
  color: var(--text-dim);
}

.divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.08);
  margin: 4px 0;
}

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

.toggle-item {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-panel-inner);
  border: 1px solid rgba(255, 255, 255, 0.06);
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  color: var(--text-muted);
}
.toggle-item:hover { color: var(--text-main); }
.toggle-item input { accent-color: var(--primary); }

.export-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.btn-primary {
  background: linear-gradient(135deg, #0284c7, #2563eb);
  color: #ffffff;
  border: none;
  padding: 12px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 13.5px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  box-shadow: 0 4px 16px var(--primary-glow);
  transition: transform 0.15s ease, filter 0.15s ease;
}
.btn-primary:hover {
  transform: translateY(-1px);
  filter: brightness(1.1);
}
.btn-primary small { font-size: 11px; opacity: 0.85; font-weight: 500; }

.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--text-main);
  padding: 10px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  transition: all 0.15s ease;
}
.btn-secondary:hover { background: rgba(255, 255, 255, 0.14); }
.btn-secondary small { font-size: 10.5px; color: var(--text-muted); font-weight: 500; }

/* ==================== Spec Cards (BOM) ==================== */
.bom-category-title {
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--primary);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.spec-card {
  background: var(--bg-panel-inner);
  border: 1.5px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
}
.spec-card:hover {
  border-color: var(--primary);
  background: rgba(56, 189, 248, 0.08);
  transform: translateY(-2px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
}

.spec-dl-link {
  display: inline-block;
  color: var(--primary);
  font-weight: 600;
  text-decoration: none;
  font-style: normal;
  padding: 3px 8px;
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.3);
  border-radius: 5px;
  transition: all 0.15s ease;
}
.spec-dl-link:hover {
  background: var(--primary);
  color: #0f172a;
}

.spec-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.spec-icon { font-size: 22px; }
.spec-header h3 { font-size: 14px; font-weight: 700; color: var(--text-main); }
.spec-header small { font-size: 11px; color: var(--text-muted); }

.spec-tag {
  margin-left: auto;
  background: rgba(255, 255, 255, 0.1);
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 10.5px;
  font-weight: 700;
  color: var(--primary);
}

.spec-body {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 12px;
}

.spec-row {
  display: flex;
  justify-content: space-between;
  color: var(--text-muted);
}
.spec-row strong { color: var(--text-main); font-family: var(--font-mono); font-size: 11.5px; }
.spec-row code {
  background: rgba(0, 0, 0, 0.4);
  padding: 1px 5px;
  border-radius: 3px;
  font-family: var(--font-mono);
  color: var(--primary);
  font-size: 11px;
}

.spec-note {
  margin-top: 8px;
  padding-top: 6px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 11px;
  color: var(--text-dim);
  font-style: italic;
}

/* ==================== Planet Picker ==================== */
.planet-picker {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.planet-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-panel-inner);
  border: 1.5px solid rgba(255, 255, 255, 0.08);
  padding: 10px 14px;
  border-radius: 8px;
  color: var(--text-main);
  cursor: pointer;
  text-align: left;
  transition: all 0.2s;
}
.planet-btn:hover {
  border-color: rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.08);
}
.planet-btn.active {
  border-color: var(--primary);
  background: rgba(56, 189, 248, 0.12);
  box-shadow: 0 0 16px rgba(56, 189, 248, 0.2);
}

.planet-btn strong { font-size: 13.5px; display: block; }
.planet-btn small { font-size: 11px; color: var(--text-muted); }

.planet-swatch {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  box-shadow: inset -3px -3px 6px rgba(0,0,0,0.6);
}
.planet-swatch.venus { background: radial-gradient(circle at 35% 35%, #fed7aa, #d97706, #78350f); }
.planet-swatch.earth { background: radial-gradient(circle at 35% 35%, #93c5fd, #1d4ed8, #0f172a); }
.planet-swatch.mars { background: radial-gradient(circle at 35% 35%, #fca5a5, #b91c1c, #450a0a); }
.planet-swatch.moon { background: radial-gradient(circle at 35% 35%, #e2e8f0, #64748b, #1e293b); }
.planet-swatch.grid { background: radial-gradient(circle at 35% 35%, #38bdf8, #0369a1, #082f49); }

.help-text {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
}

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

.btn-outline {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text-main);
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-outline:hover { background: rgba(255, 255, 255, 0.14); }
.btn-outline.danger { border-color: rgba(239, 68, 68, 0.4); color: #fca5a5; }
.btn-outline.danger:hover { background: rgba(239, 68, 68, 0.2); }

/* ==================== Floating Live HUD ==================== */
.hud-panel {
  position: absolute;
  top: 86px;
  right: 16px;
  width: 320px;
  background: var(--bg-panel);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--bg-panel-border);
  border-radius: 12px;
  padding: 16px;
  z-index: 10;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
}

.hud-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.hud-title {
  font-size: 11.5px;
  font-weight: 800;
  letter-spacing: 0.6px;
  color: var(--text-muted);
}

.hud-badge {
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.4px;
}
.hud-badge.status-good {
  background: rgba(16, 185, 129, 0.18);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.4);
}

.hud-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.hud-item {
  background: var(--bg-panel-inner);
  border: 1px solid rgba(255, 255, 255, 0.05);
  padding: 8px 10px;
  border-radius: 6px;
  display: flex;
  flex-direction: column;
}

.hud-label {
  font-size: 11px;
  color: var(--text-dim);
  font-weight: 600;
}

.hud-val {
  font-family: var(--font-mono);
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-main);
  margin-top: 2px;
}
.hud-val.highlight { color: #34d399; }

.sim-stream {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 11.5px;
}

.sim-row {
  display: flex;
  justify-content: space-between;
  color: var(--text-muted);
}
.sim-row strong { color: var(--primary); }

/* ==================== Bottom Bar ==================== */
.bottom-bar {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 6px 18px;
  border-radius: 20px;
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  gap: 16px;
  z-index: 10;
}

/* ==================== Responsive ==================== */
@media (max-width: 900px) {
  .sidebar { width: 300px; }
  .hud-panel { display: none; }
}

/* ==================== 6-Sector Inverse Selector Components ==================== */
.highlight-box {
  background: rgba(56, 189, 248, 0.07);
  border: 1px solid rgba(56, 189, 248, 0.3);
  padding: 14px;
  border-radius: 10px;
}

.preset-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.chip-btn {
  background: var(--bg-panel-inner);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-muted);
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}
.chip-btn:hover {
  background: rgba(56, 189, 248, 0.2);
  color: var(--text-main);
  border-color: var(--primary);
}
.chip-btn.active {
  background: var(--primary);
  color: #0f172a;
  border-color: var(--primary);
  font-weight: 800;
}

/* Cartridge Match Card */
.cartridge-match-card {
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.9), rgba(15, 23, 42, 0.95));
  border: 1px solid rgba(56, 189, 248, 0.35);
  border-radius: 10px;
  padding: 14px;
  margin-top: 14px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.cartridge-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.cartridge-icon { font-size: 22px; }
.cartridge-header-text { flex: 1; }
.cartridge-sub {
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.5px;
  color: var(--primary);
  display: block;
}
.cartridge-header-text h3 {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-main);
  margin-top: 1px;
}

.match-tag {
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.5);
  font-size: 10px;
  font-weight: 800;
  padding: 3px 7px;
  border-radius: 6px;
  white-space: nowrap;
}
.match-tag.warning {
  background: rgba(245, 158, 11, 0.2);
  color: #fbbf24;
  border-color: rgba(245, 158, 11, 0.5);
}

.cartridge-details {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: rgba(0, 0, 0, 0.25);
  padding: 10px;
  border-radius: 6px;
  margin-bottom: 10px;
  font-size: 12px;
}
.cartridge-row {
  display: flex;
  justify-content: space-between;
  color: var(--text-muted);
}
.cartridge-row strong {
  color: var(--text-main);
  font-family: var(--font-mono);
  font-size: 11.5px;
}

.cartridge-override label {
  font-size: 11px;
  color: var(--text-dim);
  font-weight: 600;
  display: block;
  margin-bottom: 4px;
}

/* Coverage Bar Chart */
.coverage-chart-container {
  background: var(--bg-panel-inner);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 12px;
  margin-top: 14px;
}
.chart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.chart-header small { color: var(--primary); font-family: var(--font-mono); font-weight: 700; }

.coverage-bar {
  position: relative;
  display: flex;
  height: 24px;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.15);
}
.sector-segment {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 800;
  color: rgba(255, 255, 255, 0.7);
  transition: all 0.2s ease;
  cursor: pointer;
}
.seg-a { background: #3b82f6; }
.seg-b { background: #0ea5e9; }
.seg-c { background: #10b981; }
.seg-d { background: #eab308; color: #000; }
.seg-e { background: #f97316; }
.seg-f { background: #ec4899; }

.sector-segment.active {
  box-shadow: inset 0 0 0 2px #fff, 0 0 12px rgba(255, 255, 255, 0.8);
  font-size: 12px;
  color: #fff;
}

.chart-cursor {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 3px;
  background: #fff;
  box-shadow: 0 0 8px #38bdf8, 0 0 12px #fff;
  transform: translateX(-50%);
  pointer-events: none;
  transition: left 0.1s ease-out;
}

.chart-labels {
  display: flex;
  justify-content: space-between;
  font-size: 9.5px;
  color: var(--text-dim);
  font-family: var(--font-mono);
  margin-top: 6px;
}

/* Matrix Table */
.matrix-desc {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 12px;
  line-height: 1.5;
}
.matrix-table-wrap {
  overflow-x: auto;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}
.matrix-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11.5px;
}
.matrix-table th, .matrix-table td {
  padding: 10px 8px;
  text-align: left;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.matrix-table th {
  background: rgba(30, 41, 59, 0.9);
  color: var(--text-muted);
  font-weight: 700;
}
.matrix-table tbody tr {
  background: rgba(15, 23, 42, 0.6);
  cursor: pointer;
  transition: background 0.2s;
}
.matrix-table tbody tr:hover {
  background: rgba(56, 189, 248, 0.15);
}
.matrix-table tbody tr.active-row {
  background: rgba(16, 185, 129, 0.18);
  border-left: 3px solid #34d399;
}
.table-dl-btn {
  background: var(--primary);
  color: #0f172a;
  padding: 3px 7px;
  border-radius: 4px;
  text-decoration: none;
  font-weight: 800;
  font-size: 10.5px;
  white-space: nowrap;
}
.table-dl-btn:hover {
  background: #fff;
}

/* ====================================================================
   WASTELESS ECO-PRINT ENGINE (Zero Dark Ink Waste, Crisp B&W)
   ==================================================================== */
.print-eco-btn {
  background: #ffffff !important;
  color: #0f172a !important;
  border: 1.5px solid #cbd5e1 !important;
  font-weight: 800 !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25) !important;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.print-eco-btn:hover {
  background: #f1f5f9 !important;
  border-color: #94a3b8 !important;
  transform: translateY(-1px);
}

/* Live On-Screen Eco Print Preview Mode */
body.eco-print-mode,
body.eco-print-mode.wiring-body,
body.eco-print-mode.motherbase-body,
body.eco-print-mode.hub-body {
  background: #ffffff !important;
  color: #0f172a !important;
}

body.eco-print-mode .diagram-card,
body.eco-print-mode .specs-card,
body.eco-print-mode .tier-card,
body.eco-print-mode .layout-diagram-card,
body.eco-print-mode .hub-card,
body.eco-print-mode .inst-card,
body.eco-print-mode .svg-wrapper,
body.eco-print-mode .layout-svg-wrap {
  background: #ffffff !important;
  border: 1.5px solid #cbd5e1 !important;
  color: #0f172a !important;
  box-shadow: none !important;
}

body.eco-print-mode .diagram-title,
body.eco-print-mode .specs-title,
body.eco-print-mode .step-title,
body.eco-print-mode .card-title,
body.eco-print-mode h1, body.eco-print-mode h2, body.eco-print-mode h3, body.eco-print-mode h4 {
  color: #0f172a !important;
}

body.eco-print-mode .diagram-desc,
body.eco-print-mode .step-desc,
body.eco-print-mode .card-desc,
body.eco-print-mode p, body.eco-print-mode span {
  color: #334155 !important;
}

body.eco-print-mode .step-item {
  background: #f8fafc !important;
  border: 1px solid #e2e8f0 !important;
}

body.eco-print-mode .pin-table th {
  background: #f1f5f9 !important;
  color: #0f172a !important;
  border-bottom: 2px solid #cbd5e1 !important;
}

body.eco-print-mode .pin-table td {
  border-bottom: 1px solid #e2e8f0 !important;
  color: #0f172a !important;
}

body.eco-print-mode .alert-box {
  background: #f8fafc !important;
  border: 1.5px solid #cbd5e1 !important;
  color: #0f172a !important;
}

body.eco-print-mode svg rect[fill="#0f172a"],
body.eco-print-mode svg rect[fill="#090e1a"],
body.eco-print-mode svg rect[fill="#1e293b"],
body.eco-print-mode svg rect[fill="#831843"],
body.eco-print-mode svg rect[fill="#064e3b"],
body.eco-print-mode svg rect[fill="#78350f"],
body.eco-print-mode svg rect[fill="#312e81"],
body.eco-print-mode svg rect[fill="url(#psu-grad)"],
body.eco-print-mode svg rect[fill="url(#printer-grad)"] {
  fill: #f8fafc !important;
  stroke: #334155 !important;
  stroke-width: 2px !important;
}

body.eco-print-mode svg text {
  fill: #0f172a !important;
  font-weight: 700 !important;
}

/* @media print (Triggered when User presses Ctrl+P or Print button) */
@media print {
  @page {
    margin: 1.2cm;
    size: auto;
  }

  body, html,
  .wiring-body, .motherbase-body, .hub-body {
    background: #ffffff !important;
    color: #000000 !important;
    overflow: visible !important;
  }

  /* Hide interactive web-only chrome */
  .wiring-nav, .mb-nav, .top-nav, .tabs-nav, .sub-toggle-bar,
  #motherbase-canvas, .viewport-card, .view-btn, .hub-footer,
  .print-eco-btn, .wiring-nav-links, .mb-nav-links {
    display: none !important;
  }

  .wiring-container, .motherbase-container, .hub-container {
    max-width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
  }

  .tab-pane {
    display: block !important;
    opacity: 1 !important;
    page-break-after: always;
  }

  .diagram-card, .specs-card, .tier-card, .layout-diagram-card, .inst-card {
    background: #ffffff !important;
    border: 1px solid #94a3b8 !important;
    box-shadow: none !important;
    color: #000000 !important;
    page-break-inside: avoid;
    margin-bottom: 2rem !important;
    padding: 1.5rem !important;
  }

  .svg-wrapper, .layout-svg-wrap {
    background: #ffffff !important;
    border: 1px solid #94a3b8 !important;
  }

  svg {
    filter: none !important;
  }

  svg rect {
    stroke: #000000 !important;
  }

  svg rect[fill="#0f172a"],
  svg rect[fill="#090e1a"],
  svg rect[fill="#1e293b"],
  svg rect[fill="#831843"],
  svg rect[fill="#064e3b"],
  svg rect[fill="#78350f"],
  svg rect[fill="#312e81"] {
    fill: #ffffff !important;
  }

  svg text {
    fill: #000000 !important;
  }

  .pin-table {
    page-break-inside: avoid;
  }

  .pin-table th {
    background: #f1f5f9 !important;
    color: #000000 !important;
    border-bottom: 2px solid #000000 !important;
  }

  .pin-table td {
    color: #000000 !important;
    border-bottom: 1px solid #cbd5e1 !important;
  }

  .step-item {
    background: #ffffff !important;
    border: 1px solid #cbd5e1 !important;
    page-break-inside: avoid;
  }

  .step-num {
    background: #000000 !important;
    color: #ffffff !important;
  }

  .alert-box {
    background: #f8fafc !important;
    border: 1px solid #000000 !important;
    color: #000000 !important;
    page-break-inside: avoid;
  }
}

