/* ==========================================================================
   DCvcxz Computational Digital Twin & DCIM Simulator - Main Stylesheet
   Dark-mode industrial theme, responsive grid, 3D HUD badges & studio drawer
   ========================================================================== */

    :root {
      --bg: #060911;
      --card-bg: #0c1220;
      --card-border: #1a2538;
      --cyan: #06b6d4;
      --blue: #3b82f6;
      --green: #10b981;
      --amber: #f59e0b;
      --crimson: #ef4444;
      --purple: #8b5cf6;
      --text: #f1f5f9;
      --text-muted: #8899ac;
    }
    * { box-sizing: border-box; margin: 0; padding: 0; }
    html, body {
      background: var(--bg);
      color: var(--text);
      font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "JetBrains Mono", monospace;
      min-height: 100vh;
      display: flex;
      flex-direction: column;
      overflow-x: hidden;
      width: 100%;
      max-width: 100vw;
      position: relative;
    }

    /* Top Bar */
    header {
      background: var(--card-bg);
      border-bottom: 1px solid var(--card-border);
      padding: 10px 20px;
      display: flex;
      justify-content: space-between;
      align-items: center;
      flex-wrap: wrap;
      gap: 12px;
    }
    .brand { display: flex; align-items: center; gap: 12px; }
    .brand h1 { font-size: 1.15rem; font-weight: 700; letter-spacing: 0.5px; }
    .brand span { font-size: 0.78rem; color: var(--cyan); background: rgba(6,182,212,0.1); padding: 3px 8px; border-radius: 4px; border: 1px solid rgba(6,182,212,0.3); }
    .status-badges { display: flex; gap: 8px; font-size: 0.74rem; flex-wrap: wrap; }
    .badge { padding: 4px 10px; border-radius: 4px; border: 1px solid var(--card-border); display: flex; align-items: center; gap: 6px; font-weight: 600; }
    .badge.ok { border-color: rgba(16,185,129,0.4); background: rgba(16,185,129,0.1); color: var(--green); }
    .badge.warn { border-color: rgba(245,158,11,0.4); background: rgba(245,158,11,0.1); color: var(--amber); }
    .badge.danger { border-color: rgba(239,68,68,0.4); background: rgba(239,68,68,0.15); color: var(--crimson); animation: pulse 1.5s infinite; }
    @keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.6; } }

    /* Dual Architecture Mode Segmented Switch */
    .dual-mode-segmented-control {
      display: inline-flex;
      align-items: center;
      background: rgba(13, 20, 36, 0.95);
      border: 1px solid rgba(56, 189, 248, 0.35);
      border-radius: 8px;
      padding: 3px;
      gap: 4px;
      box-shadow: 0 2px 10px rgba(0, 0, 0, 0.45);
      z-index: 10;
    }
    .mode-segment-btn {
      display: inline-flex;
      align-items: center;
      gap: 7px;
      background: transparent;
      border: 1px solid transparent;
      border-radius: 6px;
      padding: 6px 14px;
      font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "JetBrains Mono", monospace;
      font-size: 0.78rem;
      font-weight: 700;
      color: #94a3b8;
      cursor: pointer;
      transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
      white-space: nowrap;
      user-select: none;
      -webkit-tap-highlight-color: transparent;
      min-height: 34px;
    }
    .mode-segment-btn:hover {
      color: #f1f5f9;
      background: rgba(255, 255, 255, 0.05);
    }
    .mode-segment-btn .mode-icon {
      font-size: 0.95rem;
      line-height: 1;
    }
    .mode-segment-btn .mode-title {
      font-weight: 800;
      letter-spacing: 0.02em;
    }
    .mode-segment-btn .mode-sub {
      font-size: 0.68rem;
      font-weight: 600;
      opacity: 0.85;
      padding: 1px 5px;
      border-radius: 3px;
    }
    /* Active Legacy Air */
    .mode-segment-btn#btn-mode-legacy-air.active {
      background: linear-gradient(135deg, rgba(245, 158, 11, 0.22), rgba(217, 119, 6, 0.15));
      border: 1px solid rgba(245, 158, 11, 0.65);
      color: #fbbf24;
      box-shadow: 0 0 12px rgba(245, 158, 11, 0.25);
    }
    .mode-segment-btn#btn-mode-legacy-air.active .mode-sub {
      background: rgba(245, 158, 11, 0.25);
      color: #fef3c7;
    }
    /* Active NVL72 DTC Liquid */
    .mode-segment-btn#btn-mode-nvl72-liquid.active {
      background: linear-gradient(135deg, rgba(0, 229, 255, 0.22), rgba(16, 185, 129, 0.18));
      border: 1px solid rgba(0, 229, 255, 0.65);
      color: #38bdf8;
      box-shadow: 0 0 14px rgba(0, 229, 255, 0.3);
    }
    .mode-segment-btn#btn-mode-nvl72-liquid.active .mode-sub {
      background: rgba(0, 229, 255, 0.22);
      color: #e0f2fe;
    }

    @media (max-width: 900px) {
      .dual-mode-segmented-control {
        width: 100%;
        order: 3;
        display: flex;
      }
      .mode-segment-btn {
        flex: 1;
        justify-content: center;
        padding: 8px 6px;
        min-height: 40px;
        font-size: 0.74rem;
      }
    }

    /* Climate Banner */
    .econ-banner {
      background: rgba(12, 18, 32, 0.95);
      border-bottom: 1px solid #1a2538;
      padding: 6px 20px;
      font-size: 0.74rem;
      color: var(--text-muted);
      display: flex;
      justify-content: space-between;
      align-items: center;
      flex-wrap: wrap;
      gap: 12px;
    }
    .econ-badge { font-weight: 700; color: var(--cyan); }

    /* Navigation Tabs */
    .nav-tabs {
      background: #080d18;
      border-bottom: 1px solid var(--card-border);
      display: flex;
      gap: 4px;
      padding: 6px 20px 0;
      overflow-x: auto;
      overflow-y: hidden;
      -webkit-overflow-scrolling: touch;
      scrollbar-width: none;
      -ms-overflow-style: none;
      touch-action: pan-x;
    }
    .nav-tabs::-webkit-scrollbar {
      display: none;
      width: 0;
      height: 0;
    }
    .tab-btn {
      background: transparent;
      border: 1px solid transparent;
      border-bottom: none;
      color: var(--text-muted);
      padding: 8px 16px;
      font-size: 0.82rem;
      font-weight: 600;
      cursor: pointer;
      border-radius: 6px 6px 0 0;
      display: flex;
      align-items: center;
      gap: 8px;
      transition: all 0.15s ease;
    }
    .tab-btn:hover { color: var(--text); background: rgba(255,255,255,0.03); }
    .tab-btn.active {
      color: var(--cyan);
      background: var(--card-bg);
      border-color: var(--card-border);
      border-bottom: 2px solid var(--cyan);
    }

    /* Main Grid */
    main {
      flex: 1;
      display: grid;
      grid-template-columns: 1fr 380px;
      gap: 16px;
      padding: 16px;
    }
    @media (max-width: 1150px) {
      main { grid-template-columns: 1fr; }
    }

    .panel {
      background: var(--card-bg);
      border: 1px solid var(--card-border);
      border-radius: 8px;
      padding: 16px;
      display: flex;
      flex-direction: column;
      position: relative;
    }
    .panel-title {
      font-size: 0.82rem;
      font-weight: 700;
      text-transform: uppercase;
      letter-spacing: 1px;
      color: var(--text-muted);
      margin-bottom: 12px;
      display: flex;
      justify-content: space-between;
      align-items: center;
    }

    /* Tab Panes */
    .tab-pane { display: none; flex-direction: column; flex: 1; height: 100%; min-height: 560px; }
    .tab-pane.active { display: flex; }

    /* 3D Viewport */
    #three-wrapper {
      position: relative;
      width: 100%;
      height: 100%;
      min-height: 540px;
      background: #04070e;
      border-radius: 6px;
      overflow: hidden;
      border: 1px solid #162032;
      touch-action: none;
    }
    #threeContainer { width: 100%; height: 100%; min-height: 540px; display: block; touch-action: none; }
    #threeContainer canvas { touch-action: none; display: block; width: 100% !important; height: 100% !important; }
    .three-controls-overlay {
      position: absolute;
      top: 12px;
      left: 12px;
      display: flex;
      gap: 8px;
      flex-wrap: wrap;
      z-index: 10;
      pointer-events: none;
    }
    .three-controls-overlay > * {
      pointer-events: auto;
    }
    .three-debug-toggles {
      display: inline-flex;
      gap: 10px;
      align-items: center;
      background: rgba(8, 14, 24, 0.92);
      padding: 4px 10px;
      border-radius: 6px;
      border: 1px solid #1e3a5f;
      font-size: 0.72rem;
      vertical-align: middle;
      margin-left: 4px;
    }
    .three-btn {
      background: rgba(12, 18, 32, 0.88);
      border: 1px solid rgba(6, 182, 212, 0.4);
      color: var(--text);
      padding: 5px 11px;
      font-size: 0.72rem;
      border-radius: 4px;
      cursor: pointer;
      backdrop-filter: blur(4px);
      display: flex;
      align-items: center;
      gap: 6px;
      font-weight: 600;
    }
    .three-btn:hover { background: rgba(6, 182, 212, 0.2); border-color: var(--cyan); }
    .three-btn.active-tool { background: rgba(6, 182, 212, 0.35); border-color: var(--cyan); color: var(--cyan); }

    /* 2026 AI Factory Telemetry Strip Overlay */
    .ai-cluster-telemetry-strip {
      position: absolute;
      bottom: 12px;
      right: 12px;
      z-index: 15;
      display: flex;
      gap: 10px;
      align-items: center;
      background: rgba(6, 11, 20, 0.92);
      border: 1px solid #1e3a5f;
      padding: 6px 14px;
      border-radius: 8px;
      font-size: 0.74rem;
      font-family: 'JetBrains Mono', monospace;
      backdrop-filter: blur(8px);
      box-shadow: 0 4px 16px rgba(0, 0, 0, 0.6);
      pointer-events: none;
    }

    .three-legend {
      position: absolute;
      bottom: 12px;
      left: 12px;
      background: rgba(12, 18, 32, 0.88);
      border: 1px solid var(--card-border);
      border-radius: 4px;
      padding: 6px 12px;
      font-size: 0.7rem;
      display: flex;
      gap: 12px;
      align-items: center;
      backdrop-filter: blur(4px);
      z-index: 10;
      pointer-events: none;
    }
    .legend-chip { display: flex; align-items: center; gap: 5px; }
    .legend-box { width: 10px; height: 10px; border-radius: 2px; }

    /* Virtual Multimeter / Diagnostic Probe HUD Overlay */
    #multimeter-hud {
      display: none;
      position: absolute;
      top: 50px;
      right: 14px;
      width: 290px;
      background: rgba(8, 13, 23, 0.94);
      border: 2px solid var(--cyan);
      border-radius: 8px;
      padding: 14px;
      box-shadow: 0 8px 24px rgba(0,0,0,0.8);
      z-index: 50;
      backdrop-filter: blur(6px);
      font-family: "JetBrains Mono", monospace;
    }
    #multimeter-hud.visible { display: block; }
    .meter-screen {
      background: #020408;
      border: 1px solid #1a2a40;
      border-radius: 4px;
      padding: 10px;
      margin: 8px 0;
      font-size: 0.75rem;
      line-height: 1.5;
    }

    /* 2D Canvas */
    .canvas-container {
      flex: 1;
      position: relative;
      background: #04070e;
      border: 1px solid #162032;
      border-radius: 6px;
      min-height: 540px;
      display: flex;
      align-items: center;
      justify-content: center;
      overflow: hidden;
      cursor: crosshair;
    }
    #floorCanvas { display: block; width: 100%; height: 100%; }
    #blueprintCanvas { display: block; width: 100%; height: 100%; border-radius: 6px; touch-action: manipulation; }
    .pill-btn {
      background: #0d1728;
      border: 1px solid #1e2e4a;
      color: #94a3b8;
      padding: 6px 13px;
      border-radius: 18px;
      font-size: 0.76rem;
      font-weight: 600;
      cursor: pointer;
      white-space: nowrap;
      transition: all 0.15s ease;
      display: inline-flex;
      align-items: center;
      gap: 5px;
    }
    .pill-btn:hover { color: #f1f5f9; background: #14243b; border-color: #38bdf8; }
    .pill-btn.active { color: #020617; background: #38bdf8; border-color: #38bdf8; font-weight: 700; }
    .zone-stat-grid {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
      gap: 10px;
      margin-top: 8px;
    }
    .zone-stat-box {
      background: #060b16;
      border: 1px solid #162438;
      border-radius: 5px;
      padding: 8px 12px;
    }
    .zone-stat-label { font-size: 0.70rem; color: #8899ac; text-transform: uppercase; margin-bottom: 2px; }
    .zone-stat-val { font-size: 0.92rem; font-weight: 700; font-family: "JetBrains Mono", monospace; color: var(--cyan); }

    /* Rack Fleet Manager */
    .fleet-grid {
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
      gap: 12px;
      overflow-y: auto;
      max-height: 580px;
      padding: 4px;
    }
    .rack-card {
      background: #080d18;
      border: 1px solid #1a2538;
      border-radius: 6px;
      padding: 12px;
      display: flex;
      flex-direction: column;
      gap: 8px;
      position: relative;
      transition: border-color 0.2s;
    }
    .rack-card.throttling { border-color: var(--crimson); }
    .rack-card.unpowered { opacity: 0.5; border-style: dashed; }
    .rack-card-header { display: flex; justify-content: space-between; align-items: center; }
    .rack-card-title { font-weight: 700; font-size: 0.85rem; color: var(--cyan); }
    .rack-thermal-bar { display: flex; gap: 3px; height: 8px; border-radius: 4px; overflow: hidden; background: #1a2538; }
    .thermal-seg { flex: 1; height: 100%; }

    /* Electrical Sandbox Panel */
    .sandbox-grid {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 16px;
      overflow-y: auto;
      max-height: 580px;
    }
    @media (max-width: 900px) {
      .sandbox-grid { grid-template-columns: 1fr; }
    }
    .sandbox-box {
      background: #080d18;
      border: 1px solid #1a2538;
      border-radius: 6px;
      padding: 14px;
      display: flex;
      flex-direction: column;
      gap: 10px;
    }

    /* Modal dialog */
    .modal-backdrop {
      display: none;
      position: fixed;
      top: 0; left: 0; right: 0; bottom: 0;
      background: rgba(0,0,0,0.7);
      z-index: 999;
      align-items: center;
      justify-content: center;
    }
    .modal-backdrop.open { display: flex; }
    .modal-card {
      background: #0c1220;
      border: 2px solid var(--cyan);
      border-radius: 8px;
      width: 440px;
      max-width: 94vw;
      max-height: 90vh;
      overflow-y: auto;
      padding: 20px;
      display: flex;
      flex-direction: column;
      gap: 14px;
      box-shadow: 0 10px 30px rgba(0,0,0,0.9);
      box-sizing: border-box;
    }
    kbd {
      background: #152033;
      border: 1px solid #2a3d5e;
      border-radius: 4px;
      box-shadow: 0 1px 0 rgba(0,0,0,0.5);
      color: var(--cyan);
      display: inline-block;
      font-family: monospace;
      font-size: 0.75rem;
      padding: 2px 7px;
      min-width: 20px;
      text-align: center;
      font-weight: 600;
    }

    /* Power Diagram */
    .power-diagram-box {
      flex: 1;
      background: #04070e;
      border: 1px solid #162032;
      border-radius: 6px;
      padding: 16px;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      overflow: auto;
    }
    .power-svg { width: 100%; max-width: 820px; height: auto; }

    /* Flow & Physical Logic Visualizer Styles */
    .flow-sub-btn {
      background: rgba(255,255,255,0.04);
      border: 1px solid #1a2538;
      color: var(--text-muted);
      padding: 5px 12px;
      font-size: 0.78rem;
      font-weight: 600;
      border-radius: 4px;
      cursor: pointer;
      transition: all 0.15s ease;
    }
    .flow-sub-btn:hover {
      background: rgba(0,229,255,0.08);
      color: var(--text);
    }
    .flow-sub-btn.active {
      background: rgba(0,229,255,0.14);
      border-color: var(--cyan);
      color: var(--cyan);
    }
    .flow-panel-card {
      background: #080e1b;
      border: 1px solid #1a2538;
      border-radius: 6px;
      padding: 10px;
      display: flex;
      flex-direction: column;
      gap: 8px;
    }
    .flow-card-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      border-bottom: 1px solid #152238;
      padding-bottom: 6px;
    }
    @keyframes electronFlow {
      from { stroke-dashoffset: 24; }
      to { stroke-dashoffset: 0; }
    }
    @keyframes electronReverseFlow {
      from { stroke-dashoffset: 0; }
      to { stroke-dashoffset: 24; }
    }
    @keyframes waterBubbleFlow {
      from { stroke-dashoffset: 28; }
      to { stroke-dashoffset: 0; }
    }
    .elec-pulse-line {
      stroke-dasharray: 4, 8;
      animation: electronFlow 0.85s linear infinite;
    }
    .elec-reverse-line {
      stroke-dasharray: 4, 8;
      animation: electronReverseFlow 0.85s linear infinite;
    }
    .water-flow-line {
      stroke-dasharray: 6, 8;
      animation: waterBubbleFlow 1.1s linear infinite;
    }
    .flow-node-box {
      fill: #0c1424;
      stroke: #1e2c45;
      stroke-width: 1.5;
      rx: 5;
      cursor: pointer;
      transition: all 0.2s ease;
    }
    .flow-node-box:hover {
      stroke: #00e5ff;
      filter: drop-shadow(0 0 6px rgba(0, 229, 255, 0.7));
    }
    .flow-node-box.active {
      stroke: var(--cyan);
    }
    .flow-node-box.green {
      stroke: var(--green);
    }
    .flow-node-box.amber {
      stroke: var(--amber);
    }
    .flow-node-box.danger {
      stroke: var(--crimson);
      fill: #1f0f14;
    }
    .flow-node-box.selected {
      stroke: #ffffff !important;
      stroke-width: 2.5 !important;
      filter: drop-shadow(0 0 10px rgba(0, 229, 255, 0.95)) !important;
    }
    .flow-formula-tag {
      background: #0a1120;
      border: 1px solid #1a273e;
      border-radius: 4px;
      padding: 4px 8px;
      font-family: monospace;
      font-size: 0.75rem;
    }

    /* Telemetry Sidebar */
    .sidebar { display: flex; flex-direction: column; gap: 14px; }
    .pue-card {
      background: linear-gradient(135deg, rgba(6,182,212,0.08), rgba(59,130,246,0.03));
      border: 1px solid rgba(6,182,212,0.3);
      border-radius: 8px;
      padding: 16px;
      text-align: center;
    }
    .pue-val { font-size: 3rem; font-weight: 800; font-family: "JetBrains Mono", monospace; color: var(--cyan); }
    .pue-sub { font-size: 0.74rem; color: var(--text-muted); margin-top: 4px; }
    .metric-row {
      display: flex;
      justify-content: space-between;
      padding: 5px 0;
      border-bottom: 1px solid rgba(255,255,255,0.04);
      font-size: 0.8rem;
    }
    .metric-row:last-child { border-bottom: none; }
    .metric-label { color: var(--text-muted); }
    .metric-val { font-weight: 700; font-family: "JetBrains Mono", monospace; }

    /* Alarms */
    .alarm-box {
      max-height: 100px;
      overflow-y: auto;
      font-size: 0.72rem;
      font-family: "JetBrains Mono", monospace;
      display: flex;
      flex-direction: column;
      gap: 5px;
    }
    .alarm-item { padding: 4px 8px; border-radius: 4px; border-left: 3px solid; background: rgba(255,255,255,0.02); }
    .alarm-item.CRITICAL, .alarm-item.EMERGENCY { border-color: var(--crimson); color: #fca5a5; }
    .alarm-item.WARNING { border-color: var(--amber); color: #fde68a; }
    .alarm-item.NORMAL { border-color: var(--green); color: #a7f3d0; }

    /* Engineering Deep Dive & Chaos UI */
    .deep-dive-btn {
      background: rgba(0, 229, 255, 0.08);
      border: 1px solid rgba(0, 229, 255, 0.3);
      color: var(--cyan);
      border-radius: 4px;
      padding: 1px 6px;
      font-size: 0.72rem;
      cursor: pointer;
      font-family: inherit;
      transition: all 0.15s ease;
      display: inline-flex;
      align-items: center;
      gap: 3px;
      line-height: 1.2;
    }
    .deep-dive-btn:hover {
      background: rgba(0, 229, 255, 0.22);
      border-color: var(--cyan);
      box-shadow: 0 0 8px rgba(0, 229, 255, 0.4);
    }
    .mini-dive-btn {
      background: transparent;
      border: 1px solid rgba(0, 229, 255, 0.2);
      color: var(--cyan);
      border-radius: 3px;
      padding: 0 4px;
      font-size: 0.65rem;
      cursor: pointer;
      margin-left: 4px;
      vertical-align: middle;
      line-height: 1.2;
      transition: all 0.15s ease;
    }
    .mini-dive-btn:hover {
      background: rgba(0, 229, 255, 0.18);
      border-color: var(--cyan);
    }
    .standards-badge {
      display: inline-block;
      padding: 2px 8px;
      border-radius: 4px;
      font-size: 0.7rem;
      font-weight: 700;
      font-family: "JetBrains Mono", monospace;
      letter-spacing: 0.03em;
    }
    .standards-badge.ashrae {
      background: rgba(6, 182, 212, 0.15);
      border: 1px solid var(--cyan);
      color: var(--cyan);
    }
    .standards-badge.ieee {
      background: rgba(59, 130, 246, 0.15);
      border: 1px solid #3b82f6;
      color: #93c5fd;
    }
    .standards-badge.uglys {
      background: rgba(245, 158, 11, 0.15);
      border: 1px solid var(--amber);
      color: #fde68a;
    }
    .formula-card {
      background: #060a14;
      border: 1px solid #16243a;
      border-left: 3px solid var(--cyan);
      border-radius: 6px;
      padding: 12px 16px;
      font-family: "JetBrains Mono", monospace;
      color: #e2e8f0;
      font-size: 0.88rem;
      margin: 8px 0;
      overflow-x: auto;
    }
    .chaos-grid {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
      gap: 12px;
    }
    .chaos-card {
      background: #080d1a;
      border: 1px solid #1a2942;
      border-radius: 6px;
      padding: 12px;
      display: flex;
      flex-direction: column;
      gap: 8px;
      transition: all 0.2s ease;
    }
    .chaos-card:hover {
      border-color: rgba(239, 68, 68, 0.5);
      background: #0d1222;
      box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5);
    }
    .archetype-selector-pill {
      display: flex;
      align-items: center;
      gap: 6px;
      background: #0c1424;
      border: 1px solid #1a2c48;
      border-radius: 6px;
      padding: 3px 8px;
    }

    /* Controls Footer */
    footer {
      background: var(--card-bg);
      border-top: 1px solid var(--card-border);
      padding: 12px 20px;
      display: flex;
      gap: 16px;
      align-items: center;
      flex-wrap: wrap;
    }
    .ctrl-group { display: flex; flex-direction: column; gap: 4px; min-width: 130px; }
    .ctrl-group label { font-size: 0.7rem; color: var(--text-muted); font-weight: 600; text-transform: uppercase; }
    input[type=range] { accent-color: var(--cyan); cursor: pointer; }
    select, button, input[type=number], input[type=text] {
      background: #1a2538;
      color: var(--text);
      border: 1px solid #2d3e58;
      padding: 6px 10px;
      border-radius: 4px;
      font-size: 0.76rem;
      cursor: pointer;
      font-weight: 600;
      transition: all 0.15s;
    }
    select:hover, button:hover { background: #2d3e58; }
    button.danger { background: rgba(239,68,68,0.2); border-color: var(--crimson); color: #fca5a5; }
    button.danger:hover { background: rgba(239,68,68,0.4); }
    button.primary { background: rgba(6,182,212,0.2); border-color: var(--cyan); color: var(--cyan); }
    button.primary:hover { background: rgba(6,182,212,0.4); }
    button.success { background: rgba(16,185,129,0.2); border-color: var(--green); color: var(--green); }
    button.success:hover { background: rgba(16,185,129,0.4); }

    /* Switch toggle */
    .switch { position: relative; display: inline-block; width: 36px; height: 18px; }
    .switch input { opacity: 0; width: 0; height: 0; }
    .slider-round {
      position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0;
      background-color: #2d3e58; transition: .2s; border-radius: 18px;
    }
    .slider-round:before {
      position: absolute; content: ""; height: 12px; width: 12px; left: 3px; bottom: 3px;
      background-color: white; transition: .2s; border-radius: 50%;
    }
    input:checked + .slider-round { background-color: var(--green); }
    input:checked + .slider-round:before { transform: translateX(18px); }

    /* =========================================================================
       MOBILE & TABLET RESPONSIVE SYSTEM (320px - 768px)
       ========================================================================= */
    @media (max-width: 768px) {
      header {
        padding: 8px 12px;
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
      }
      .brand {
        display: flex;
        align-items: center;
        gap: 8px;
        width: 100%;
      }
      .brand h1 { font-size: 0.95rem; }
      .brand span { font-size: 0.68rem; }
      .status-badges {
        font-size: 0.68rem;
        gap: 6px;
        display: flex;
        flex-wrap: nowrap;
        overflow-x: auto;
        overflow-y: hidden;
        white-space: nowrap;
        width: 100%;
        max-width: 100%;
        padding-bottom: 2px;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        -ms-overflow-style: none;
        touch-action: pan-x;
        pointer-events: auto;
      }
      .status-badges::-webkit-scrollbar { display: none; width: 0; height: 0; }
      .status-badges > * { flex-shrink: 0; }
      .badge { padding: 3px 7px; }

      .econ-banner {
        padding: 6px 12px;
        font-size: 0.68rem;
        display: flex;
        flex-wrap: nowrap;
        overflow-x: auto;
        overflow-y: hidden;
        white-space: nowrap;
        gap: 14px;
        align-items: center;
        width: 100%;
        max-width: 100%;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        -ms-overflow-style: none;
        touch-action: pan-x;
        pointer-events: auto;
        box-sizing: border-box;
      }
      .econ-banner::-webkit-scrollbar { display: none; width: 0; height: 0; }
      .econ-banner > * { flex-shrink: 0; }

      .nav-tabs {
        padding: 4px 8px 0;
        gap: 4px;
        display: flex;
        flex-wrap: nowrap;
        overflow-x: auto;
        overflow-y: hidden;
        white-space: nowrap;
        width: 100%;
        max-width: 100%;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        -ms-overflow-style: none;
        touch-action: pan-x;
        pointer-events: auto;
      }
      .nav-tabs::-webkit-scrollbar { display: none; width: 0; height: 0; }
      .tab-btn {
        padding: 6px 12px;
        font-size: 0.74rem;
        white-space: nowrap;
        flex-shrink: 0;
      }

      main {
        padding: 8px;
        gap: 12px;
        max-width: 100vw;
        overflow-x: hidden;
      }
      .panel { padding: 10px; }
      .tab-pane { min-height: 380px; }

      #three-wrapper {
        min-height: 420px;
        height: 58vh;
        max-height: 80vh;
        touch-action: none;
      }
      #threeContainer {
        min-height: 420px;
        height: 100%;
        width: 100%;
        touch-action: none;
      }
      #threeContainer canvas {
        width: 100% !important;
        height: 100% !important;
        touch-action: none;
        display: block;
      }
      .canvas-container {
        min-height: 380px;
      }

      .three-controls-overlay {
        position: absolute;
        top: 8px;
        left: 8px;
        right: 8px;
        max-width: calc(100% - 16px);
        overflow-x: auto;
        overflow-y: hidden;
        padding: 4px 6px;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        -ms-overflow-style: none;
        display: flex;
        flex-wrap: nowrap;
        gap: 6px;
        pointer-events: auto;
        touch-action: pan-x;
        background: rgba(6, 12, 22, 0.75);
        backdrop-filter: blur(8px);
        -webkit-backdrop-filter: blur(8px);
        border: 1px solid rgba(6, 182, 212, 0.25);
        border-radius: 8px;
        z-index: 25;
      }
      .three-controls-overlay::-webkit-scrollbar { display: none; width: 0; height: 0; }
      .three-controls-overlay > * {
        pointer-events: auto;
        flex-shrink: 0;
      }
      .three-debug-toggles {
        white-space: nowrap;
        flex-shrink: 0;
        font-size: 0.68rem;
        padding: 3px 8px;
      }
      .three-btn {
        padding: 6px 10px;
        font-size: 0.70rem;
        white-space: nowrap;
        flex-shrink: 0;
      }

      .ai-cluster-telemetry-strip {
        position: absolute;
        bottom: 38px;
        left: 8px;
        right: 8px;
        font-size: 0.62rem;
        padding: 4px 8px;
        gap: 6px;
        max-width: calc(100% - 16px);
        display: flex;
        overflow-x: auto;
        overflow-y: hidden;
        flex-wrap: nowrap;
        white-space: nowrap;
        scrollbar-width: none;
        -ms-overflow-style: none;
        pointer-events: auto;
        touch-action: pan-x;
        background: rgba(6, 11, 20, 0.90);
        backdrop-filter: blur(6px);
        -webkit-backdrop-filter: blur(6px);
        border: 1px solid rgba(56, 189, 248, 0.25);
        border-radius: 6px;
        -webkit-overflow-scrolling: touch;
        z-index: 20;
      }
      .ai-cluster-telemetry-strip::-webkit-scrollbar { display: none; width: 0; height: 0; }
      .ai-cluster-telemetry-strip > * {
        flex-shrink: 0;
        pointer-events: auto;
      }

      .three-legend {
        bottom: 8px;
        left: 8px;
        right: 8px;
        font-size: 0.62rem;
        padding: 4px 8px;
        gap: 6px;
        max-width: calc(100% - 16px);
        display: flex;
        overflow-x: auto;
        overflow-y: hidden;
        flex-wrap: nowrap;
        white-space: nowrap;
        scrollbar-width: none;
        -ms-overflow-style: none;
        pointer-events: auto;
        touch-action: pan-x;
        background: rgba(6, 11, 20, 0.90);
        backdrop-filter: blur(6px);
        -webkit-backdrop-filter: blur(6px);
        border: 1px solid #162032;
        border-radius: 6px;
        -webkit-overflow-scrolling: touch;
        z-index: 20;
      }
      .three-legend::-webkit-scrollbar { display: none; width: 0; height: 0; }
      .three-legend > * {
        flex-shrink: 0;
        pointer-events: auto;
      }

      .studio-subnav,
      .flow-subnav,
      .blueprint-zone-pills {
        display: flex !important;
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        overflow-y: hidden !important;
        white-space: nowrap !important;
        width: 100% !important;
        max-width: 100% !important;
        -webkit-overflow-scrolling: touch !important;
        scrollbar-width: none !important;
        -ms-overflow-style: none !important;
        touch-action: pan-x !important;
        pointer-events: auto !important;
        padding-bottom: 4px !important;
      }
      .studio-subnav::-webkit-scrollbar,
      .flow-subnav::-webkit-scrollbar,
      .blueprint-zone-pills::-webkit-scrollbar {
        display: none !important;
        width: 0 !important;
        height: 0 !important;
      }
      .studio-subnav > *,
      .flow-subnav > *,
      .blueprint-zone-pills > * {
        flex-shrink: 0 !important;
      }

      #multimeter-hud {
        top: 48px;
        right: 8px;
        left: 8px;
        width: auto;
        max-width: calc(100% - 16px);
        padding: 10px;
        font-size: 0.72rem;
        z-index: 60;
        touch-action: pan-y;
      }

      #flow-split-layout {
        grid-template-columns: 1fr !important;
      }

      .modal-card {
        width: 94vw !important;
        max-width: 94vw !important;
        max-height: 88vh !important;
        padding: 14px 12px !important;
      }

      /* Mobile Drawer as Slide-Up Bottom Sheet */
      .drawer {
        top: auto !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        width: 100vw !important;
        max-width: 100vw !important;
        height: 82vh !important;
        max-height: 85vh !important;
        border-left: none !important;
        border-top: 2px solid var(--cyan) !important;
        border-radius: 18px 18px 0 0 !important;
        box-shadow: 0 -12px 35px rgba(0,0,0,0.92) !important;
        padding: 16px 16px 28px 16px !important;
        -webkit-overflow-scrolling: touch;
      }
      .drawer::before {
        content: "";
        display: block;
        width: 44px;
        height: 5px;
        background: #334155;
        border-radius: 3px;
        margin: -4px auto 12px auto;
        opacity: 0.8;
      }
      #drawer-server-list {
        max-height: 48vh !important;
      }

      /* 42U Rack Designer Studio Mobile Layout */
      .studio-container {
        display: flex !important;
        flex-direction: column !important;
        height: auto !important;
        min-height: auto !important;
        overflow: visible !important;
        padding: 8px !important;
        gap: 12px !important;
      }
      .studio-rack-center {
        width: 100% !important;
        min-width: 0 !important;
      }
      .studio-rails-scroll {
        max-height: 60vh !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch;
      }
      .studio-pdu-col {
        flex-direction: row !important;
        align-items: center !important;
        justify-content: space-between !important;
        padding: 6px 10px !important;
      }
      .studio-pdu-col .pdu-outlets-strip {
        display: none !important;
      }
      .studio-pdu-col .pdu-header {
        border-bottom: none !important;
        width: auto !important;
        font-size: 0.75rem !important;
      }
      .studio-pdu-col .pdu-meter-box {
        width: auto !important;
        display: flex !important;
        gap: 8px !important;
        align-items: center !important;
      }
      .studio-inspector-col {
        width: 100% !important;
      }
      .studio-cable-filters {
        overflow-x: auto !important;
        max-width: 100% !important;
        padding-bottom: 2px !important;
        -webkit-overflow-scrolling: touch;
        white-space: nowrap !important;
      }
      .rack-network-table-wrap {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
      }
      .rack-network-table {
        min-width: 680px !important;
      }

      footer {
        padding: 12px 14px 20px 14px;
        gap: 12px;
      }
      .ctrl-group {
        min-width: 120px;
        flex: 1 1 45%;
      }
      .footer-btn-group {
        width: 100%;
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 8px;
        margin-left: 0;
      }
      .footer-btn-group button {
        width: 100%;
        text-align: center;
        padding: 9px 8px;
        font-size: 0.75rem;
        min-height: 38px;
      }
    }

    /* Small Phone Screens (<= 480px) */
    @media (max-width: 480px) {
      .brand h1 { font-size: 0.92rem; }
      .brand span { font-size: 0.65rem; }
      .tab-btn { padding: 6px 8px; font-size: 0.70rem; }
      .ctrl-group { flex: 1 1 100%; }
      .footer-btn-group { grid-template-columns: 1fr; }
      .pue-val { font-size: 2.2rem; }
      #toast-container {
        left: 10px;
        right: 10px;
        bottom: 70px;
      }
      .toast-msg {
        max-width: 100%;
      }
    }

    /* Modal / Drawer */
    .drawer {
      display: none; position: fixed; top: 0; right: 0; bottom: 0; width: 440px;
      background: #080d18; border-left: 2px solid var(--cyan);
      box-shadow: -10px 0 30px rgba(0,0,0,0.85); z-index: 999; padding: 20px;
      overflow-y: auto; flex-direction: column; gap: 14px;
    }
    .drawer.open { display: flex; }
    .drawer-header { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid #1a2538; padding-bottom: 10px; }
    .drawer-close { background: none; border: none; font-size: 1.4rem; color: #8899ac; cursor: pointer; }
    .drawer-close:hover { color: #fff; }
    .server-blade {
      background: #0c1424; border: 1px solid #1c2a3e; border-radius: 4px;
      padding: 6px 10px; font-size: 0.72rem; display: flex; justify-content: space-between;
      align-items: center; margin-bottom: 4px;
    }

    /* =========================================================================
       42U RACK DESIGNER STUDIO & DEEP HARDWARE VISUALIZER STYLES
       ========================================================================= */
    .studio-container {
      display: grid;
      grid-template-columns: 88px 1fr 88px 360px;
      gap: 12px;
      height: 100%;
      min-height: 650px;
      background: #04070e;
      border: 1px solid #162032;
      border-radius: 8px;
      padding: 12px;
      overflow: hidden;
      position: relative;
    }
    @media (max-width: 1280px) {
      .studio-container { grid-template-columns: 75px 1fr 75px 300px; }
    }
    @media (max-width: 1024px) {
      .studio-container { grid-template-columns: 1fr; height: auto; overflow-y: auto; }
    }

    /* PDU Vertical Rails */
    .studio-pdu-col {
      background: #090f1d;
      border: 1px solid #1c2b42;
      border-radius: 6px;
      display: flex;
      flex-direction: column;
      align-items: center;
      padding: 8px 4px;
      gap: 6px;
      user-select: none;
    }
    .pdu-header {
      font-size: 0.65rem;
      font-weight: 800;
      text-align: center;
      color: var(--cyan);
      letter-spacing: 0.5px;
      border-bottom: 1px solid #1c2b42;
      padding-bottom: 4px;
      width: 100%;
    }
    .pdu-meter-box {
      background: #03060c;
      border: 1px solid #162338;
      border-radius: 4px;
      padding: 4px;
      width: 100%;
      text-align: center;
      font-family: "JetBrains Mono", monospace;
      font-size: 0.68rem;
    }
    .pdu-meter-val { font-weight: 800; color: #38bdf8; font-size: 0.8rem; }
    .pdu-meter-amps { font-size: 0.72rem; color: #f1f5f9; }
    .pdu-meter-limit { font-size: 0.6rem; color: #8899ac; }
    .pdu-load-bar-wrap {
      width: 100%;
      height: 6px;
      background: #162032;
      border-radius: 3px;
      overflow: hidden;
      margin-top: 3px;
    }
    .pdu-load-bar {
      height: 100%;
      background: var(--green);
      transition: width 0.3s ease, background 0.3s ease;
    }
    .pdu-load-bar.warn { background: var(--amber); }
    .pdu-load-bar.overload { background: var(--crimson); }
    .pdu-outlets-strip {
      flex: 1;
      width: 100%;
      display: flex;
      flex-direction: column;
      justify-content: space-between;
      gap: 2px;
      padding: 4px 0;
    }
    .pdu-outlet-dot {
      width: 10px;
      height: 10px;
      border-radius: 2px;
      background: #111d2e;
      border: 1px solid #233650;
      margin: 0 auto;
      transition: all 0.2s;
    }
    .pdu-outlet-dot.active { background: #0284c7; border-color: #38bdf8; box-shadow: 0 0 4px #0284c7; }
    .pdu-outlet-dot.overloaded { background: #ef4444; border-color: #f87171; box-shadow: 0 0 4px #ef4444; }

    /* 42U Center Rail Elevation */
    .studio-rack-center {
      display: flex;
      flex-direction: column;
      background: #060a14;
      border: 1px solid #1a273c;
      border-radius: 6px;
      overflow: hidden;
      position: relative;
    }
    .studio-rack-toolbar {
      display: flex;
      justify-content: space-between;
      align-items: center;
      padding: 8px 12px;
      background: #090f1d;
      border-bottom: 1px solid #1c2b42;
      flex-wrap: wrap;
      gap: 8px;
    }
    .studio-toggle-group {
      display: flex;
      background: #03060c;
      border: 1px solid #1c2b42;
      border-radius: 4px;
      overflow: hidden;
    }
    .studio-btn-toggle {
      background: transparent;
      border: none;
      color: #8899ac;
      padding: 4px 10px;
      font-size: 0.72rem;
      font-weight: 600;
      cursor: pointer;
    }
    .studio-btn-toggle.active {
      background: #1c2b42;
      color: var(--cyan);
    }
    .studio-cable-filters {
      display: flex;
      gap: 4px;
      align-items: center;
      font-size: 0.7rem;
      color: #8899ac;
    }
    .cable-pill {
      padding: 2px 8px;
      border-radius: 3px;
      cursor: pointer;
      font-weight: 700;
      font-size: 0.68rem;
      border: 1px solid transparent;
      transition: all 0.15s;
    }
    .cable-pill.all { background: rgba(255,255,255,0.08); color: #fff; }
    .cable-pill.cat6 { background: rgba(59,130,246,0.2); border-color: #3b82f6; color: #60a5fa; }
    .cable-pill.power { background: rgba(148,163,184,0.2); border-color: #94a3b8; color: #cbd5e1; }
    .cable-pill.fiber { background: rgba(245,158,11,0.2); border-color: #f59e0b; color: #fbbf24; }
    .cable-pill.mgmt { background: rgba(168,85,247,0.2); border-color: #a855f7; color: #c084fc; }
    .cable-pill.inactive { opacity: 0.35; filter: grayscale(0.8); }

    /* 42U Rail Scroll Canvas */
    .studio-rails-scroll {
      flex: 1;
      overflow-y: auto;
      padding: 6px 10px;
      display: flex;
      flex-direction: column;
      gap: 2px;
      max-height: 570px;
    }
    .u-slot-row {
      display: grid;
      grid-template-columns: 34px 22px 1fr 22px 34px;
      gap: 3px;
      align-items: center;
      min-height: 22px;
      user-select: none;
      transition: all 0.12s;
      border-radius: 3px;
    }
    .u-slot-row:hover { background: rgba(255,255,255,0.03); }
    .cable-raceway {
      height: 100%;
      min-height: 22px;
      display: flex;
      align-items: center;
      justify-content: center;
      background: #030712;
      border-radius: 2px;
      border: 1px solid #142033;
      padding: 0 1px;
      gap: 2px;
      position: relative;
      overflow: hidden;
    }
    .cable-strand {
      width: 4px;
      height: 100%;
      border-radius: 2px;
      transition: all 0.2s;
    }
    .cable-strand.cat6 { background: #2563eb; box-shadow: 0 0 4px #3b82f6; }
    .cable-strand.mgmt { background: #9333ea; box-shadow: 0 0 4px #a855f7; }
    .cable-strand.power { background: #ef4444; box-shadow: 0 0 4px #f87171; }
    .cable-strand.power-b { background: #f97316; box-shadow: 0 0 4px #fb923c; }
    .cable-strand.fiber { background: #06b6d4; box-shadow: 0 0 4px #38bdf8; }
    .cable-strand.dimmed { opacity: 0.12 !important; filter: grayscale(1) !important; box-shadow: none !important; }
    .u-num-marker {
      font-family: "JetBrains Mono", monospace;
      font-size: 0.65rem;
      font-weight: 700;
      color: #475569;
      text-align: center;
      line-height: 22px;
      border-right: 1px solid #162338;
    }
    .u-num-marker.right { border-right: none; border-left: 1px solid #162338; }
    .u-hardware-bay {
      height: 100%;
      min-height: 22px;
      border-radius: 3px;
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 0 10px;
      font-size: 0.72rem;
      font-weight: 600;
      cursor: pointer;
      position: relative;
      overflow: hidden;
      border: 1px solid rgba(255,255,255,0.08);
      transition: all 0.15s ease;
    }
    .u-hardware-bay:hover {
      border-color: var(--cyan);
      box-shadow: 0 0 8px rgba(6,182,212,0.3);
      transform: translateY(-1px);
    }
    .u-hardware-bay.selected {
      border-color: #38bdf8;
      box-shadow: 0 0 10px rgba(56,189,248,0.6);
    }

    /* Hardware Item Themes */
    .bay-tor {
      background: linear-gradient(90deg, #0f2038, #182d4d);
      border-color: #2563eb;
      color: #93c5fd;
    }
    .bay-patch {
      background: linear-gradient(90deg, #111a2e, #1c273e);
      border-color: #475569;
      color: #cbd5e1;
    }
    .bay-kvm {
      background: linear-gradient(90deg, #1e1b4b, #2e1065);
      border-color: #7c3aed;
      color: #d8b4fe;
    }
    .bay-compute {
      background: linear-gradient(90deg, #0b192c, #132742);
      border-color: #0284c7;
      color: #bae6fd;
    }
    .bay-gpu {
      background: linear-gradient(90deg, #022c22, #064e3b);
      border-color: #059669;
      color: #a7f3d0;
    }
    .bay-gpu.throttling {
      background: linear-gradient(90deg, #450a0a, #7f1d1d) !important;
      border-color: #ef4444 !important;
      color: #fca5a5 !important;
      animation: pulse 1.5s infinite;
    }
    .bay-storage {
      background: linear-gradient(90deg, #1e1b2e, #2d2645);
      border-color: #9333ea;
      color: #e9d5ff;
    }
    .bay-ups {
      background: linear-gradient(90deg, #2a1b07, #45290a);
      border-color: #d97706;
      color: #fde68a;
    }
    .bay-blanking {
      background: #090e18;
      border: 1px dashed #23334d;
      color: #64748b;
    }
    .bay-empty {
      background: rgba(239,68,68,0.05);
      border: 1px dashed rgba(239,68,68,0.4);
      color: #f87171;
    }
    .bay-empty:hover {
      background: rgba(239,68,68,0.12);
      border-color: #ef4444;
    }
    .bay-unpowered {
      opacity: 0.42 !important;
      filter: grayscale(0.85) contrast(0.9) !important;
      background: #090e18 !important;
      border-color: #2b394e !important;
      color: #64748b !important;
      box-shadow: none !important;
    }
    .bay-unpowered .switch-port-led,
    .bay-unpowered .caddy-led,
    .bay-unpowered .uid-beacon-led {
      background: #1e293b !important;
      box-shadow: none !important;
      animation: none !important;
    }
    .bay-unpowered .chassis-ear {
      background: #111827 !important;
      border-color: #1f2937 !important;
    }
    .offline-badge {
      display: inline-flex;
      align-items: center;
      gap: 3px;
      padding: 1px 5px;
      font-size: 0.58rem;
      font-weight: 800;
      color: #94a3b8;
      background: rgba(15, 23, 42, 0.9);
      border: 1px solid #475569;
      border-radius: 2px;
      letter-spacing: 0.5px;
    }
    .feeder-isolated-banner {
      background: rgba(239, 68, 68, 0.15);
      border: 1px solid #ef4444;
      border-radius: 4px;
      padding: 6px 10px;
      font-size: 0.72rem;
      color: #fca5a5;
      font-weight: bold;
      display: none;
      align-items: center;
      justify-content: space-between;
      margin-bottom: 6px;
    }

    /* Cable overlays inside bay */
    .cable-dot {
      display: inline-block;
      width: 7px;
      height: 7px;
      border-radius: 50%;
      margin-left: 3px;
    }
    .cable-dot.cat6 { background: #3b82f6; box-shadow: 0 0 3px #3b82f6; }
    .cable-dot.power { background: #94a3b8; box-shadow: 0 0 3px #94a3b8; }
    .cable-dot.fiber { background: #f59e0b; box-shadow: 0 0 3px #f59e0b; }
    .cable-dot.mgmt { background: #a855f7; box-shadow: 0 0 3px #a855f7; }

    /* Rear View Liquid Manifold Central Pillar */
    .rear-liquid-manifold-col {
      width: 22px;
      background: linear-gradient(180deg, #475569, #94a3b8, #475569);
      border-radius: 4px;
      border: 1px solid #cbd5e1;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: space-between;
      padding: 4px 0;
      box-shadow: 0 0 8px rgba(203,213,225,0.4);
    }
    .manifold-valve-indicator {
      width: 14px;
      height: 14px;
      border-radius: 50%;
      background: #0284c7;
      border: 2px solid #38bdf8;
      box-shadow: 0 0 6px #38bdf8;
      cursor: pointer;
    }
    .manifold-valve-indicator.shut {
      background: #ef4444;
      border-color: #f87171;
      box-shadow: 0 0 6px #ef4444;
    }

    /* Detailed Hardware Elevation Component Styles */
    .chassis-ear {
      width: 14px;
      height: 100%;
      background: linear-gradient(180deg, #334155, #1e293b);
      border: 1px solid #475569;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      position: relative;
      flex-shrink: 0;
    }
    .ear-screw {
      width: 6px;
      height: 6px;
      border-radius: 50%;
      background: #94a3b8;
      border: 1px solid #cbd5e1;
      box-shadow: inset 0 0 2px #000;
    }
    .hex-mesh-pattern {
      background-image: radial-gradient(#1e293b 25%, transparent 25%), radial-gradient(#1e293b 25%, transparent 25%);
      background-size: 6px 6px;
      background-position: 0 0, 3px 3px;
    }
    .caddy-grid {
      display: flex;
      align-items: center;
      gap: 3px;
    }
    .caddy-slot {
      width: 22px;
      height: 16px;
      background: #0f172a;
      border: 1px solid #334155;
      border-radius: 2px;
      display: flex;
      flex-direction: column;
      justify-content: space-between;
      padding: 1px;
      position: relative;
    }
    .caddy-latch {
      width: 100%;
      height: 2px;
      background: #475569;
      border-radius: 1px;
    }
    .caddy-led {
      width: 3px;
      height: 3px;
      border-radius: 50%;
      background: #10b981;
      box-shadow: 0 0 3px #10b981;
      align-self: flex-end;
    }
    .caddy-led.activity {
      background: #06b6d4;
      box-shadow: 0 0 3px #06b6d4;
      animation: pulse 0.8s infinite alternate;
    }
    .switch-port-matrix {
      display: flex;
      flex-wrap: wrap;
      gap: 2px;
      max-width: 140px;
    }
    .switch-port-cage {
      width: 7px;
      height: 6px;
      background: #020617;
      border: 1px solid #1e293b;
      position: relative;
    }
    .switch-port-led {
      width: 2px;
      height: 2px;
      border-radius: 50%;
      background: #22c55e;
      position: absolute;
      top: 0;
      right: 0;
      box-shadow: 0 0 2px #22c55e;
    }
    .rear-psu-module {
      display: flex;
      align-items: center;
      gap: 4px;
      background: #0a0f1d;
      border: 1px solid #1e293b;
      padding: 2px 4px;
      border-radius: 2px;
    }
    .iec-inlet {
      width: 10px;
      height: 8px;
      background: #000;
      border: 1px solid #475569;
      border-radius: 1px;
      position: relative;
    }
    .rear-fan-cowling {
      width: 18px;
      height: 18px;
      border-radius: 50%;
      background: #020617;
      border: 1px solid #334155;
      display: flex;
      align-items: center;
      justify-content: center;
      box-shadow: inset 0 0 4px #000;
    }
    .rear-fan-blades {
      width: 10px;
      height: 10px;
      border-radius: 50%;
      border: 1px dashed #64748b;
      animation: spin 2s linear infinite;
    }
    @keyframes spin { 100% { transform: rotate(360deg); } }
    .qd-coupling {
      width: 12px;
      height: 12px;
      border-radius: 50%;
      display: inline-block;
      border: 2px solid #fff;
    }
    .qd-coupling.inlet { background: #0284c7; box-shadow: 0 0 6px #0284c7; }
    .qd-coupling.outlet { background: #ef4444; box-shadow: 0 0 6px #ef4444; }

    /* Component Inspector & Educational Guide Column */
    .studio-inspector-col {
      background: #080d18;
      border: 1px solid #1a273c;
      border-radius: 6px;
      display: flex;
      flex-direction: column;
      gap: 12px;
      padding: 14px;
      overflow-y: auto;
    }
    .inspector-title {
      font-size: 0.85rem;
      font-weight: 800;
      color: #38bdf8;
      border-bottom: 1px solid #1c2b42;
      padding-bottom: 6px;
    }
    .educational-guide-card {
      background: rgba(6,182,212,0.07);
      border: 1px solid rgba(6,182,212,0.3);
      border-left: 3px solid var(--cyan);
      border-radius: 6px;
      padding: 10px;
      display: flex;
      flex-direction: column;
      gap: 6px;
    }
    .guide-badge {
      font-size: 0.68rem;
      font-weight: 800;
      color: var(--cyan);
      text-transform: uppercase;
      letter-spacing: 0.5px;
      display: flex;
      align-items: center;
      gap: 5px;
    }
    .guide-body {
      font-size: 0.74rem;
      color: #cbd5e1;
      line-height: 1.45;
    }
    .guide-standards {
      font-size: 0.68rem;
      color: #94a3b8;
      font-family: "JetBrains Mono", monospace;
      margin-top: 4px;
      border-top: 1px dashed rgba(255,255,255,0.08);
      padding-top: 4px;
    }

    /* Recirculation Hazard Alert Banner */
    .recirc-hazard-banner {
      background: rgba(239,68,68,0.12);
      border: 1px solid rgba(239,68,68,0.4);
      border-left: 4px solid var(--crimson);
      border-radius: 6px;
      padding: 8px 14px;
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-bottom: 10px;
      font-size: 0.78rem;
      animation: pulse 2s infinite;
    }
    .recirc-hazard-banner.sealed {
      background: rgba(16,185,129,0.1);
      border-color: rgba(16,185,129,0.3);
      border-left-color: var(--green);
      animation: none;
    }

    /* UID Locator Beacon & Network Table Styles */
    .uid-beacon-led {
      width: 8px;
      height: 8px;
      border-radius: 50%;
      background: #1e293b;
      border: 1px solid #475569;
      display: inline-block;
      margin-right: 6px;
      transition: all 0.2s;
    }
    .uid-beacon-led.active {
      background: #00e5ff;
      border-color: #ffffff;
      box-shadow: 0 0 8px #00e5ff, 0 0 14px #3b82f6;
      animation: beaconFlash 0.6s infinite alternate;
    }
    @keyframes beaconFlash {
      0% { opacity: 0.3; transform: scale(0.85); }
      100% { opacity: 1.0; transform: scale(1.35); }
    }

    .studio-sub-view {
      display: flex;
      flex-direction: column;
      gap: 10px;
      width: 100%;
    }
    .studio-sub-view.hidden { display: none !important; }

    .rack-network-table-wrap {
      background: #04070e;
      border: 1px solid #162438;
      border-radius: 6px;
      overflow-x: auto;
      max-height: 560px;
    }
    .rack-network-table {
      width: 100%;
      border-collapse: collapse;
      font-size: 0.72rem;
      font-family: "JetBrains Mono", monospace;
    }
    .rack-network-table th {
      background: #090f1d;
      color: var(--cyan);
      text-align: left;
      padding: 8px 10px;
      border-bottom: 1px solid #1c2b42;
      position: sticky;
      top: 0;
      z-index: 2;
    }
    .rack-network-table td {
      padding: 7px 10px;
      border-bottom: 1px solid #111a28;
      color: #cbd5e1;
    }
    .rack-network-table tr:hover {
      background: rgba(0, 229, 255, 0.04);
    }
    .status-dot {
      display: inline-block;
      width: 7px;
      height: 7px;
      border-radius: 50%;
      margin-right: 5px;
    }
    .status-dot.up { background: #10b981; box-shadow: 0 0 4px #10b981; }
    .status-dot.down { background: #ef4444; box-shadow: 0 0 4px #ef4444; }

    .outlet-relay-grid {
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
      gap: 8px;
    }
    .outlet-relay-card {
      background: #060a14;
      border: 1px solid #162438;
      border-radius: 4px;
      padding: 6px 8px;
      display: flex;
      flex-direction: column;
      gap: 3px;
      font-size: 0.7rem;
      font-family: "JetBrains Mono", monospace;
      transition: all 0.15s;
    }
    .outlet-relay-card.energized { border-color: #0284c7; }
    .outlet-relay-card.de-energized {
      border-color: #ef4444;
      background: rgba(239, 68, 68, 0.05);
      opacity: 0.7;
    }
    .relay-toggle-btn {
      padding: 2px 6px;
      font-size: 0.65rem;
      font-weight: bold;
      border-radius: 3px;
      cursor: pointer;
      border: 1px solid transparent;
      margin-top: 2px;
    }
    .relay-toggle-btn.on {
      background: rgba(16, 185, 129, 0.2);
      border-color: #10b981;
      color: #34d399;
    }
    .relay-toggle-btn.off {
      background: rgba(239, 68, 68, 0.2);
      border-color: #ef4444;
      color: #f87171;
    }

    /* 3D Flow Layer Control Buttons */
    .three-btn.layer-active {
      background: rgba(6,182,212,0.25);
      border-color: var(--cyan);
      color: #e0f2fe;
      box-shadow: 0 0 8px rgba(6,182,212,0.4);
    }

    /* Toast Notification System */
    #toast-container {
      position: fixed;
      bottom: 75px;
      right: 20px;
      z-index: 9999;
      display: flex;
      flex-direction: column;
      gap: 8px;
      pointer-events: none;
    }
    .toast-msg {
      background: rgba(12, 18, 32, 0.96);
      border: 1px solid var(--cyan);
      border-left: 4px solid var(--cyan);
      color: #f1f5f9;
      padding: 9px 15px;
      border-radius: 6px;
      font-size: 0.76rem;
      font-weight: 600;
      box-shadow: 0 6px 20px rgba(0,0,0,0.7);
      backdrop-filter: blur(6px);
      animation: toastIn 0.22s cubic-bezier(0.16, 1, 0.3, 1);
      pointer-events: auto;
      display: flex;
      align-items: center;
      gap: 8px;
      max-width: 380px;
    }
    .toast-msg.success { border-color: var(--green); border-left-color: var(--green); }
    .toast-msg.danger { border-color: var(--crimson); border-left-color: var(--crimson); }
    .toast-msg.warn { border-color: var(--amber); border-left-color: var(--amber); }
    @keyframes toastIn { from { transform: translateY(12px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }