    /* ── Reset & base ───────────────────────────────────────────── */
    *, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

    :root {
      --bg:           #090909;
      --panel-bg:     rgba(10, 10, 10, 0.92);
      --border:       rgba(79, 195, 247, 0.10);
      --accent:       #4fc3f7;
      --accent2:      #ffb74d;
      --text:         rgba(224, 230, 240, 0.95);
      --text-dim:     rgba(255, 255, 255, 0.58);
      --sidebar-w:    268px;
      --topbar-h:     56px;
      --radius:       8px;

      /* pipe system colors */
      --chwr: #4fc3f7;
      --chws: #0288d1;
      --cwr:  #81c784;
      --cws:  #2e7d32;
    }

    html, body { width: 100%; height: 100%; overflow: hidden; }

    body {
      font-family: 'Inter', system-ui, -apple-system, sans-serif;
      font-size: 13px;
      color: var(--text);
      background: radial-gradient(ellipse at 50% 75%, #323232 0%, #191919 70%);
    }

    /* ── Canvas wrapper ─────────────────────────────────────────── */
    #canvas-wrapper {
      position: fixed;
      inset: 0;
      z-index: 0;
    }

    #canvas-wrapper canvas { display: block; }

    /* CSS2DRenderer sits on top of canvas, pointer-events off */
    #canvas-wrapper .label-layer {
      position: absolute;
      inset: 0;
      pointer-events: none;
    }

    /* ── Loader overlay ─────────────────────────────────────────── */
    #loader-overlay {
      position: fixed;
      inset: 0;
      z-index: 900;
      background: rgba(10, 14, 26, 0.94);
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      gap: 18px;
      transition: opacity 0.35s ease;
    }

    #loader-overlay.hidden {
      opacity: 0;
      pointer-events: none;
    }

    .loader-ring {
      width: 52px;
      height: 52px;
      border-radius: 50%;
      border: 3px solid rgba(79, 195, 247, 0.15);
      border-top-color: var(--accent);
      animation: spin 0.75s linear infinite;
    }

    @keyframes spin { to { transform: rotate(360deg); } }

    #loader-text {
      font-size: 12px;
      letter-spacing: 0.12em;
      color: var(--accent);
      text-transform: uppercase;
    }

    .loader-track {
      width: 220px;
      height: 2px;
      background: rgba(255,255,255,0.08);
      border-radius: 1px;
      overflow: hidden;
    }

    #loader-bar {
      height: 100%;
      width: 0%;
      background: var(--accent);
      transition: width 0.2s ease;
    }

    /* ── Performance Monitor (Ctrl+P) ───────────────────────────── */
    #perf-panel {
      position: fixed;
      bottom: 14px;
      left: 14px;
      z-index: 300;
      width: 224px;
      background: rgba(4, 7, 14, 0.94);
      backdrop-filter: blur(12px);
      border: 1px solid rgba(255,255,255,0.07);
      border-radius: 9px;
      overflow: hidden;
      display: none;
      flex-direction: column;
      font-family: 'JetBrains Mono', 'Consolas', 'Courier New', monospace;
      font-size: 11px;
    }

    #perf-panel.open { display: flex; }

    .perf-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 8px 12px 6px;
      border-bottom: 1px solid rgba(255,255,255,0.06);
      cursor: grab;
      user-select: none;
    }
    .perf-header:active { cursor: grabbing; }

    .perf-close-btn {
      width: 18px; height: 18px;
      display: flex; align-items: center; justify-content: center;
      background: none; border: none;
      color: rgba(255,255,255,0.35);
      cursor: pointer; border-radius: 3px; font-size: 11px;
      flex-shrink: 0; margin-left: 6px;
    }
    .perf-close-btn:hover { background: rgba(255,255,255,0.09); color: rgba(255,255,255,0.65); }

    .perf-title {
      font-size: 9px;
      font-weight: 700;
      letter-spacing: 0.16em;
      text-transform: uppercase;
      color: rgba(255,255,255,0.55);
    }

    #perf-fps-badge {
      font-size: 12px;
      font-weight: 700;
      color: #4ade80;
      transition: color 0.3s;
    }

    #perf-fps-badge.warn  { color: #fbbf24; }
    #perf-fps-badge.crit  { color: #f87171; }

    /* FPS Graph */
    #perf-graph {
      display: block;
      width: 100%;
      height: 40px;
      image-rendering: pixelated;
      border-bottom: 1px solid rgba(255,255,255,0.05);
    }

    /* Stat rows */
    .perf-body { padding: 8px 12px 10px; display: flex; flex-direction: column; gap: 5px; }

    .perf-row {
      display: flex;
      align-items: center;
      gap: 6px;
    }

    .perf-lbl {
      color: rgba(255,255,255,0.68);
      font-size: 10px;
      width: 84px;
      flex-shrink: 0;
    }

    .perf-val {
      color: rgba(255,255,255,0.82);
      font-size: 11px;
      flex: 1;
      text-align: right;
    }

    .perf-val.good { color: #4ade80; }
    .perf-val.warn { color: #fbbf24; }
    .perf-val.crit { color: #f87171; }

    .perf-divider {
      height: 1px;
      background: rgba(255,255,255,0.05);
      margin: 3px 0;
    }

    .perf-hint {
      padding: 5px 12px 7px;
      font-size: 9px;
      color: rgba(255,255,255,0.60);
      letter-spacing: 0.06em;
      border-top: 1px solid rgba(255,255,255,0.05);
    }

    /* ── Detail Scene mode ───────────────────────────────────────── */
    /* Hide tools not available in Detail Scene */
    body.detail-scene-active #filter-btn,
    body.detail-scene-active #drone-btn,
    body.detail-scene-active #walkthrough-btn,
    body.detail-scene-active #pano360-btn { display: none !important; }

    /* Show Detail Scene exclusive tools */
    #ds-tool-group { display: none; }
    body.detail-scene-active #ds-tool-group { display: flex; }

    /* Indicator bar */
    #ds-bar {
      position: fixed;
      top: var(--topbar-h);
      left: 50%;
      transform: translateX(-50%);
      z-index: 400;
      display: none;
      align-items: center;
      gap: 14px;
      background: rgba(10, 12, 20, 0.94);
      backdrop-filter: blur(12px);
      border: 1px solid rgba(79,195,247,0.28);
      border-top: none;
      border-radius: 0 0 10px 10px;
      padding: 7px 18px 8px;
      box-shadow: 0 6px 24px rgba(0,0,0,0.50);
    }
    body.detail-scene-active #ds-bar { display: flex; }

    #ds-label {
      font-size: 11px;
      font-weight: 600;
      color: var(--accent);
      letter-spacing: 0.04em;
      white-space: nowrap;
    }
    #ds-exit-btn {
      background: rgba(79,195,247,0.12);
      border: 1px solid rgba(79,195,247,0.30);
      border-radius: 6px;
      color: var(--accent);
      font-size: 11px;
      font-weight: 600;
      padding: 4px 12px;
      cursor: pointer;
      white-space: nowrap;
      transition: background 0.15s;
    }
    #ds-exit-btn:hover { background: rgba(79,195,247,0.22); }

    /* All ctx items hidden by default — each shown only when menu carries its class */
    #ctx-menu [data-action="DetailScene"],
    #ctx-menu [data-action="Documents"],
    #ctx-menu [data-action="Pictures"],
    #ctx-menu [data-action="Schedules"]  { display: none; }
    #ctx-menu [data-action="Maintenance"] { display: none; }

    #ctx-menu.has-detail    [data-action="DetailScene"] { display: flex; }
    #ctx-menu.has-documents [data-action="Documents"]   { display: flex; }
    #ctx-menu.has-pictures  [data-action="Pictures"]    { display: flex; }
    #ctx-menu.has-schedules [data-action="Schedules"]   { display: flex; }
    #ctx-menu.has-maintenance [data-action="Maintenance"] { display: flex; }

    /* ── Logo ──────────────────────────────────────────────────── */
    .tb-logo {
      display: flex;
      align-items: center;
      padding: 0 6px 0 2px;
      flex-shrink: 0;
    }
    .tb-logo img {
      height: 36px;
      width: auto;
      object-fit: contain;
      display: block;
    }

    /* ── Icon-only topbar buttons ──────────────────────────────── */
    .tb-icon-btn {
      position: relative;
      display: flex;
      align-items: center;
      justify-content: center;
      width: 46px;
      height: 46px;
      border-radius: 12px;
      border: none;
      background: transparent;
      cursor: pointer;
      transition: background 0.14s ease;
      flex-shrink: 0;
    }

    .tb-icon-btn:hover,
    .tb-icon-btn.active {
      background: #2563eb;
    }

    .tb-icon-img {
      width: 26px;
      height: 26px;
      object-fit: contain;
      display: block;
      pointer-events: none;
      user-select: none;
    }

    /* Animated tooltip — below (topbar) */
    .tb-tip {
      position: absolute;
      top: calc(100% + 6px);
      left: 50%;
      transform: translateX(-50%) translateY(-4px);
      background: #2563eb;
      border-radius: 8px;
      padding: 5px 12px;
      font-size: 12px;
      font-weight: 600;
      color: #ffffff;
      white-space: nowrap;
      pointer-events: none;
      opacity: 0;
      transition: opacity 0.16s ease, transform 0.16s ease;
      z-index: 999;
      letter-spacing: 0.01em;
    }

    .tb-icon-btn:hover .tb-tip {
      opacity: 1;
      transform: translateX(-50%) translateY(0);
    }

    /* ── Tool group (topbar) — no background, just spacing ─────── */
    .tb-tool-group {
      display: flex;
      align-items: center;
      gap: 2px;
      flex-shrink: 0;
    }

    /* ── Right Toolbar ─────────────────────────────────────────── */
    #right-toolbar {
      position: fixed;
      right: 12px;
      top: 50%;
      transform: translateY(-50%);
      z-index: 300;
      display: flex;
      flex-direction: column;
      gap: 8px;
      pointer-events: auto;
      transition: opacity 0.2s ease, visibility 0.2s ease;
    }

    .rt-group {
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 2px;
      padding: 4px;
      background: rgba(9, 9, 9, 0.92);
      backdrop-filter: blur(14px);
      border: 1px solid rgba(255, 255, 255, 0.08);
      border-radius: 14px;
    }

    .rt-btn {
      position: relative;
      display: flex;
      align-items: center;
      justify-content: center;
      width: 46px;
      height: 46px;
      border-radius: 12px;
      border: none;
      background: transparent;
      color: #fff;
      cursor: pointer;
      transition: background 0.14s ease;
      flex-shrink: 0;
    }

    .rt-btn:hover,
    .rt-btn.active {
      background: #2563eb;
    }

    /* Animated tooltip — to the left (right toolbar) */
    .rt-tip {
      position: absolute;
      right: calc(100% + 8px);
      top: 50%;
      transform: translateY(-50%) translateX(4px);
      background: #2563eb;
      border-radius: 8px;
      padding: 5px 12px;
      font-size: 12px;
      font-weight: 600;
      color: #ffffff;
      white-space: nowrap;
      pointer-events: none;
      opacity: 0;
      transition: opacity 0.16s ease, transform 0.16s ease;
      z-index: 999;
      letter-spacing: 0.01em;
    }

    .rt-btn:hover .rt-tip {
      opacity: 1;
      transform: translateY(-50%) translateX(0);
    }

    /* ── Drag-over feedback ─────────────────────────────────────── */
    body.drag-active::after {
      content: 'Drop your .glb file here';
      position: fixed;
      inset: 0;
      z-index: 850;
      pointer-events: none;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 22px;
      color: var(--accent);
      border: 3px dashed rgba(79,195,247,0.55);
      background: rgba(79,195,247,0.07);
    }

    /* ── Tag labels (CSS2DObject) ───────────────────────────────── */
    .tag-label {
      padding: 4px 11px;
      background: rgba(5, 5, 10, 0.82);
      border: 1px solid rgba(79, 195, 247, 0.40);
      border-radius: 20px;
      color: rgba(255, 255, 255, 0.93);
      font-family: 'Inter', system-ui, sans-serif;
      font-size: 11px;
      font-weight: 600;
      letter-spacing: 0.25px;
      white-space: nowrap;
      pointer-events: none;
      user-select: none;
      position: relative;
      /* smooth occlusion fade */
      opacity: 1;
      transition: opacity 0.35s ease;
    }
    /* Hovered state — always on top, brighter border */
    .tag-label.tag-hovered {
      border-color: rgba(79, 195, 247, 0.90);
      background: rgba(5, 10, 22, 0.95);
      color: #fff;
      transition: none;   /* instant — no fade while hovering */
    }
    /* small dot at the bottom edge — sits right on the 3D anchor point */
    .tag-label::after {
      content: '';
      position: absolute;
      bottom: -4px;
      left: 50%;
      transform: translateX(-50%);
      width: 5px;
      height: 5px;
      background: rgba(79, 195, 247, 0.75);
      border-radius: 50%;
    }
    .tag-label.tag-hovered::after {
      background: rgba(79, 195, 247, 1);
      width: 6px; height: 6px; bottom: -5px;
    }
