﻿    /* LOGIN PAGE */
    #loginPage {
      display: none;
      position: fixed;
      top: 0; left: 0; right: 0; bottom: 0;
      z-index: 1000;
      justify-content: center;
      align-items: center;
      padding: 20px;
    }
    #loginPage.active { display: flex; }
    .login-container {
      background: rgba(255, 255, 255, 0.05);
      backdrop-filter: blur(40px) saturate(1.6);
      -webkit-backdrop-filter: blur(40px) saturate(1.6);
      border: 1px solid rgba(255, 255, 255, 0.1);
      border-radius: 28px;
      padding: 48px 36px 36px;
      width: 100%;
      max-width: 380px;
      box-shadow:
        0 24px 80px rgba(0, 0, 0, 0.5),
        0 0 0 1px rgba(255, 255, 255, 0.05) inset,
        0 1px 0 rgba(255, 255, 255, 0.06) inset;
      position: relative;
      z-index: 1;
      animation: loginFadeIn 0.5s cubic-bezier(0.16, 1, 0.3, 1) both;
    }
    @keyframes loginFadeIn {
      from { opacity: 0; transform: translateY(20px) scale(0.97); }
      to { opacity: 1; transform: translateY(0) scale(1); }
    }
    .login-logo { text-align: center; margin-bottom: 36px; }
    .login-logo-ring {
      width: 80px; height: 80px;
      margin: 0 auto 20px;
      border-radius: 22px;
      padding: 3px;
      background: linear-gradient(135deg, rgba(0, 212, 170, 0.4), rgba(0, 160, 220, 0.2));
      box-shadow: 0 8px 32px rgba(0, 212, 170, 0.2);
    }
    .login-logo-ring img {
      width: 100%; height: 100%;
      border-radius: 19px;
      display: block;
    }
    .login-logo h1 {
      font-size: 22px; font-weight: 700; color: var(--text-primary);
      margin-bottom: 4px; letter-spacing: -0.3px;
    }
    .login-logo p {
      font-size: 13px; color: var(--text-secondary);
      letter-spacing: 0.5px;
    }
    .login-form .form-group { margin-bottom: 16px; }
    .login-form .form-group label {
      display: block; font-size: 11px; color: var(--text-secondary);
      text-transform: uppercase; letter-spacing: 0.8px;
      margin-bottom: 6px; font-weight: 600;
    }
    .input-wrapper {
      position: relative;
    }
    .input-icon {
      position: absolute;
      left: 14px; top: 50%;
      transform: translateY(-50%);
      color: var(--text-tertiary);
      pointer-events: none;
      transition: color 0.2s;
    }
    .input-wrapper input {
      width: 100%; padding: 12px 14px 12px 42px;
      background: rgba(255, 255, 255, 0.05);
      border: 1px solid rgba(255, 255, 255, 0.1);
      border-radius: 12px;
      color: var(--text-primary); font-size: 14px;
      outline: none; transition: all 0.25s;
    }
    .input-wrapper input:focus {
      border-color: var(--accent);
      box-shadow: 0 0 0 3px rgba(0, 212, 170, 0.12);
      background: rgba(255, 255, 255, 0.08);
    }
    .input-wrapper input:focus + .input-icon,
    .input-wrapper:focus-within .input-icon {
      color: var(--accent);
    }
    .input-wrapper input::placeholder { color: var(--text-tertiary); }
    .login-btn {
      width: 100%; padding: 13px 20px;
      background: linear-gradient(135deg, #00D4AA, #00B89C);
      color: #000; border: none; border-radius: 12px;
      font-size: 14px; font-weight: 700; cursor: pointer;
      transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
      margin-top: 12px;
      box-shadow: 0 4px 20px rgba(0, 212, 170, 0.25);
      display: flex; align-items: center; justify-content: center; gap: 8px;
    }
    .login-btn:hover {
      transform: translateY(-1px);
      box-shadow: 0 8px 30px rgba(0, 212, 170, 0.35);
    }
    .login-btn:active { transform: translateY(0); box-shadow: 0 2px 10px rgba(0, 212, 170, 0.2); }
    .login-btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }
    .login-btn svg { transition: transform 0.2s; }
    .login-btn:hover svg { transform: translateX(3px); }
    .login-error {
      color: #ff6b6b; font-size: 12px; text-align: center;
      margin-top: 12px; display: none;
      padding: 8px 12px; border-radius: 8px;
      background: rgba(255, 107, 107, 0.08);
    }
    .login-error.show { display: block; }
    .login-footer {
      margin-top: 24px;
      padding-top: 20px;
      border-top: 1px solid rgba(255, 255, 255, 0.06);
    }
    .login-device-info {
      display: flex; align-items: center; justify-content: center; gap: 8px;
      font-size: 11px; color: var(--text-tertiary);
    }
    .login-device-info svg { flex-shrink: 0; }
    .login-device-info .device-count { color: var(--accent); font-weight: 700; }

        /* THEME VARIABLES — MiMo-inspired */
    :root {
      --bg-primary: #1a1a1e;
      --bg-secondary: #222226;
      --bg-tertiary: #2a2a2e;
      --bg-card: #242428;
      --text-primary: #f0f0f4;
      --text-secondary: #a0a0a8;
      --text-tertiary: #6a6a72;
      --border: rgba(255, 255, 255, 0.08);
      --accent: #00D4AA;
      --accent-glow: rgba(0, 212, 170, 0.08);
      --accent-hover: #00E8B0;
      --accent2: #ff5252;
      --success: #00D4AA;
      --warning: #FFB300;
      --canvas-bg: #1a1a1e;
    }
    body.light-theme {
      --bg-primary: #f8f8fa;
      --bg-secondary: #f0f0f2;
      --bg-tertiary: #e8e8ea;
      --bg-card: #ffffff;
      --text-primary: #1a1a1e;
      --text-secondary: #5a5a60;
      --text-tertiary: #8a8a90;
      --border: rgba(0, 0, 0, 0.1);
      --accent: #00B89C;
      --accent-glow: rgba(0, 184, 156, 0.08);
      --accent-hover: #00D4AA;
      --accent2: #d32f2f;
      --success: #00B89C;
      --warning: #E65100;
      --canvas-bg: #f0f0f2;
    }
    * { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }


    /* ===== GLASSMORPHISM BACKGROUND ===== */
    .bg-layer {
      position: fixed; inset: 0;
      z-index: 0; pointer-events: none;
      overflow: hidden;
    }
    .bg-layer::before {
      content: '';
      position: absolute; inset: 0;
      background: url('bg-dark.png') center/cover no-repeat;
      opacity: 0.1;
    }
    .bg-shape {
      position: absolute;
      border-radius: 50%;
      filter: blur(200px);
      will-change: transform;
    }
    .bg-shape-1 {
      width: 1200px; height: 1200px;
      background: radial-gradient(circle, rgba(0, 212, 170, 0.35) 0%, rgba(0, 180, 150, 0.2) 30%, rgba(0, 150, 120, 0.1) 60%, transparent 100%);
      top: -10%; left: -5%;
      animation: shapeFloat1 25s ease-in-out infinite;
    }
    .bg-shape-2 {
      width: 1000px; height: 1000px;
      background: radial-gradient(circle, rgba(0, 160, 220, 0.28) 0%, rgba(0, 140, 200, 0.15) 40%, transparent 100%);
      top: 30%; right: -5%;
      animation: shapeFloat2 30s ease-in-out infinite;
    }
    .bg-shape-3 {
      width: 1100px; height: 1100px;
      background: radial-gradient(circle, rgba(0, 212, 170, 0.22) 0%, rgba(0, 180, 150, 0.12) 40%, transparent 100%);
      bottom: -5%; left: 20%;
      animation: shapeFloat3 28s ease-in-out infinite;
    }
    body.light-theme .bg-layer::before {
      background: url('bg-light.png') center/cover no-repeat;
      opacity: 0.15;
    }
    body.light-theme .bg-shape-1 {
      background: radial-gradient(circle, rgba(0, 184, 156, 0.2) 0%, rgba(0, 160, 140, 0.1) 40%, transparent 100%);
    }
    body.light-theme .bg-shape-2 {
      background: radial-gradient(circle, rgba(0, 150, 200, 0.15) 0%, rgba(0, 130, 180, 0.08) 40%, transparent 100%);
    }
    body.light-theme .bg-shape-3 {
      background: radial-gradient(circle, rgba(0, 184, 156, 0.12) 0%, rgba(0, 160, 140, 0.06) 40%, transparent 100%);
    }
    @keyframes shapeFloat1 {
      0%, 100% { transform: translate(0, 0) scale(1); }
      25% { transform: translate(40px, -30px) scale(1.05); }
      50% { transform: translate(-20px, 50px) scale(0.95); }
      75% { transform: translate(30px, 20px) scale(1.03); }
    }
    @keyframes shapeFloat2 {
      0%, 100% { transform: translate(0, 0) scale(1); }
      33% { transform: translate(-50px, 40px) scale(1.05); }
      66% { transform: translate(30px, -30px) scale(0.97); }
    }
    @keyframes shapeFloat3 {
      0%, 100% { transform: translate(0, 0) scale(1); }
      40% { transform: translate(60px, -40px) scale(1.06); }
      80% { transform: translate(-30px, 20px) scale(0.96); }
    }


    body {
      font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'SF Pro Display', Roboto, sans-serif;
      background: var(--bg-primary);
      overflow: hidden;
      position: fixed;
      width: 100%;
      height: 100%;
      user-select: none;
      -webkit-user-select: none;
      color: var(--text-primary);
      transition: background 0.3s, color 0.3s;
    }
    #canvas3d {
      position: absolute;
      top: 0; left: 0;
      width: 100%; height: 100%;
      display: block;
      z-index: 1;
      touch-action: none;
    }

    /* TOP PANEL */
    .top-panel {
      position: fixed; top: 0; left: 0; right: 0;
      height: 50px;
      background: var(--bg-secondary);
      border-bottom: 1px solid var(--border);
      display: flex; align-items: center; justify-content: space-between;
      padding: 0 14px;
      z-index: 20;
      backdrop-filter: blur(24px);
      box-shadow: 0 2px 20px rgba(0, 0, 0, 0.3);
    }
    .top-left { display: flex; align-items: center; gap: 8px; }
    .top-btn {
      background: rgba(255,255,255,0.04);
      border: 1px solid rgba(0, 212, 170, 0.08);
      width: 36px; height: 36px;
      border-radius: 10px;
      font-size: 16px;
      cursor: pointer;
      color: var(--text-secondary);
      display: flex; align-items: center; justify-content: center;
      transition: all 0.2s;
    }
    .top-btn:active { transform: scale(0.9); background: var(--accent); color: #071a14; }
    .project-title {
      font-size: 13px; font-weight: 600;
      color: var(--text-primary);
      max-width: 140px;
      overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    }
    .stats-bar { display: flex; gap: 14px; align-items: center; font-size: 11px; }
    .stat-item { display: flex; align-items: center; gap: 4px; }
    .stat-value { font-weight: 700; color: var(--accent); font-size: 12px; }
    .progress-container { flex: 1; max-width: 160px; }
    .progress-bar {
      width: 100%; height: 3px;
      background: rgba(0, 212, 170, 0.08);
      border-radius: 2px; overflow: hidden;
    }
    .progress-fill {
      height: 100%; background: var(--accent);
      transition: width 0.3s ease; border-radius: 2px;
    }

    /* BOTTOM TOOLBAR */
    .bottom-toolbar {
      position: fixed; bottom: 0; left: 0; right: 0;
      height: 56px;
      background: var(--bg-secondary);
      border-top: 1px solid var(--border);
      display: flex; align-items: center; justify-content: space-around;
      padding: 0 8px 8px 8px;
      z-index: 19;
      backdrop-filter: blur(24px);
      box-shadow: 0 -2px 20px rgba(0, 0, 0, 0.3);
    }
    .toolbar-btn {
      background: rgba(255,255,255,0.04);
      border: 1px solid rgba(0, 212, 170, 0.08);
      width: 44px; height: 44px;
      border-radius: 12px;
      font-size: 18px;
      cursor: pointer;
      color: var(--accent);
      display: flex; align-items: center; justify-content: center;
      transition: all 0.2s ease;
      flex-shrink: 0;
    }
    .toolbar-btn:active { transform: scale(0.92); background: var(--accent); color: #071a14; }
    .toolbar-btn.active { background: var(--accent-glow); border-color: rgba(0, 212, 170, 0.2); }

    /* BOTTOM SHEET */
    .bottom-sheet {
      position: fixed;
      bottom: 56px; left: 0; right: 0;
      background: var(--bg-card);
      border-radius: 24px 24px 0 0;
      transform: translateY(100%);
      transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
      z-index: 18;
      border-top: 1px solid var(--border);
      max-height: 45vh;
      backdrop-filter: blur(32px);
      box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.25);
    }
    .bottom-sheet.open { transform: translateY(0); }
    .sheet-handle {
      width: 48px; height: 4px;
      background: var(--text-secondary);
      opacity: 0.2; border-radius: 3px;
      margin: 10px auto 6px;
    }
    .sheet-header {
      display: flex; justify-content: space-between; align-items: center;
      padding: 0 16px 6px;
    }
    .sheet-title {
      font-size: 12px; font-weight: 700;
      color: var(--accent);
      letter-spacing: 1.2px;
      text-transform: uppercase;
    }
    .sheet-close {
      background: none; border: none;
      color: var(--text-secondary);
      font-size: 18px; cursor: pointer;
      padding: 4px 8px;
    }
    .sheet-content {
      padding: 0 16px 14px;
      overflow-y: auto;
      max-height: calc(42vh - 40px);
    }

    /* DETAIL CARD */
    .detail-card { display: flex; flex-direction: column; gap: 6px; }
    .detail-row {
      display: flex; justify-content: space-between;
      align-items: baseline; gap: 8px;
    }
    .detail-label {
      font-size: 11px; color: var(--text-secondary);
      letter-spacing: 0.5px; text-transform: uppercase; flex-shrink: 0;
    }
    .detail-value {
      font-size: 14px; color: var(--text-primary); font-weight: 500;
    }
    .detail-code {
      font-size: 13px; color: var(--accent);
      font-family: 'Monaco', 'Menlo', monospace;
    }
    .dims-row { display: flex; gap: 8px; margin: 4px 0; }
    .dim {
      font-size: 12px; color: var(--text-primary); font-weight: 500;
    }
    .dim-label {
      color: var(--text-secondary);
      font-size: 10px;
    }
    .dim-value {
      color: var(--text-primary); font-weight: 600; font-size: 12px;
    }
    .material-tag {
      font-size: 10px; color: #ff9f6e;
      background: rgba(255, 140, 90, 0.1);
      padding: 2px 8px; border-radius: 6px;
      border: 1px solid rgba(255, 152, 0, 0.15);
      display: inline-block; width: fit-content;
    }
    .status-badge {
      font-size: 11px; padding: 2px 8px;
      border-radius: 6px; display: inline-block; font-weight: 600;
    }
    .status-badge.scanned {
      color: var(--success);
      background: rgba(74, 222, 128, 0.1);
      border: 1px solid rgba(74, 222, 128, 0.2);
    }
    .status-badge.waiting {
      color: var(--warning);
      background: rgba(251, 191, 36, 0.1);
      border: 1px solid rgba(251, 191, 36, 0.2);
    }
    .action-buttons { display: flex; gap: 6px; margin-top: 6px; }
    .action-btn {
      flex: 1;
      background: var(--accent-glow);
      border: 1px solid var(--border);
      padding: 10px 0; border-radius: 8px;
      font-size: 12px; color: var(--accent);
      text-align: center; cursor: pointer; font-weight: 600;
      transition: all 0.15s;
    }
    .action-btn:active { background: var(--accent); color: #fff; }

    /* QUICK ACTIONS FLOATING BAR */
    .quick-actions {
      position: fixed;
      bottom: 64px; left: 12px; right: 12px;
      display: none;
      gap: 8px;
      z-index: 19;
      background: var(--bg-secondary);
      border: 1px solid rgba(0, 212, 170, 0.12);
      border-radius: 16px;
      padding: 8px;
      backdrop-filter: blur(24px);
      box-shadow: 0 4px 16px rgba(0,0,0,0.25);
    }
    .quick-actions.show { display: flex; }
    .quick-action-btn {
      flex: 1;
      background: var(--accent-glow);
      border: 1px solid var(--border);
      padding: 10px 0;
      border-radius: 10px;
      font-size: 12px;
      color: var(--accent);
      text-align: center;
      cursor: pointer;
      font-weight: 600;
      transition: all 0.15s;
    }
    .quick-action-btn:active { background: var(--accent); color: #fff; }

    .module-badge {
      font-size: 10px; padding: 2px 8px;
      border-radius: 6px; display: inline-block;
      font-weight: 600; letter-spacing: 0.3px;
      color: #00d4aa; background: rgba(0, 212, 170, 0.1);
      border: 1px solid rgba(0, 212, 170, 0.15);
    }
    .assembly-hint {
      font-size: 11px; color: var(--text-secondary);
      background: var(--bg-tertiary);
      padding: 6px 10px; border-radius: 6px;
      border-left: 2px solid var(--accent);
      margin-top: 4px;
    }

    /* DRAWER */
    .drawer {
      position: fixed;
      top: 50px; left: 0; bottom: 0;
      width: 85%; max-width: 360px;
      background: var(--bg-card);
      transform: translateX(-100%);
      transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
      z-index: 25;
      display: flex; flex-direction: column;
      border-right: 1px solid rgba(0, 212, 170, 0.06);
      backdrop-filter: blur(32px);
      box-shadow: 4px 0 24px rgba(0, 0, 0, 0.25);
    }
    .drawer.open { transform: translateX(0); }
    .drawer-header {
      display: flex; justify-content: space-between; align-items: center;
      padding: 14px 16px;
      border-bottom: 1px solid var(--border);
    }
    .drawer-title {
      font-size: 11px; font-weight: 700;
      color: var(--accent); letter-spacing: 1px;
    }
    .drawer-close {
      background: none; border: none;
      font-size: 18px; color: var(--text-secondary); cursor: pointer;
    }
    .drawer-search {
      padding: 10px 12px;
      background: var(--bg-tertiary);
      border-bottom: 1px solid var(--border);
    }
    .search-input {
      width: 100%; padding: 7px 10px;
      background: var(--bg-primary);
      border: 1px solid var(--border);
      border-radius: 8px;
      color: var(--text-primary); font-size: 14px;
    }
    .search-input::placeholder { color: var(--text-tertiary); }
    .drawer-content {
      flex: 1; overflow-y: auto; padding: 10px;
    }
    .upload-btn {
      width: 100%;
      background: var(--accent-glow);
      border: 1px dashed var(--border);
      padding: 10px; border-radius: 10px;
      color: var(--accent); font-size: 14px;
      text-align: center; margin-bottom: 10px;
      cursor: pointer; font-weight: 600;
    }
    .upload-btn:active { background: var(--accent); color: #fff; }
    .id-mode-toggle {
      display: flex; align-items: center; gap: 8px;
      margin-bottom: 8px; padding: 8px 10px;
      background: var(--bg-secondary); border-radius: 8px;
    }
    .id-mode-label { font-size: 12px; color: var(--text-secondary); font-weight: 600; }
    .id-mode-switch { display: flex; gap: 4px; flex: 1; }
    .id-mode-btn {
      flex: 1; padding: 8px 0; border: 1px solid var(--border);
      background: var(--bg-tertiary); border-radius: 6px;
      font-size: 12px; color: var(--text-secondary);
      cursor: pointer; font-weight: 600; transition: all 0.15s;
    }
    .id-mode-btn.active {
      background: var(--accent); color: #fff; border-color: var(--accent);
    }
    .drawer-actions {
      display: flex; gap: 6px; margin-bottom: 8px;
    }
    .drawer-action-btn {
      flex: 1;
      background: var(--bg-tertiary);
      border: 1px solid var(--border);
      padding: 10px 0; border-radius: 8px;
      font-size: 12px; color: var(--text-secondary);
      text-align: center; cursor: pointer; font-weight: 600;
      transition: all 0.15s;
    }
    .drawer-action-btn:active { background: var(--accent); color: #fff; }

    /* MODULE GROUP */
    .module-group { margin-bottom: 8px; }
    .module-header {
      display: flex; align-items: center; gap: 8px;
      padding: 10px 12px;
      background: var(--bg-tertiary);
      border-radius: 8px;
      cursor: pointer;
      margin-bottom: 4px;
      border: 1px solid var(--border);
      transition: all 0.15s;
    }
    .module-header:active { background: var(--accent-glow); }
    .module-dot {
      width: 10px; height: 10px;
      border-radius: 3px; flex-shrink: 0;
    }
    .module-name {
      font-size: 12px; font-weight: 700;
      color: var(--text-primary); flex: 1;
      letter-spacing: 0.3px;
    }
    .module-count {
      font-size: 11px; color: var(--text-secondary);
      background: var(--bg-primary);
      padding: 1px 6px; border-radius: 4px;
    }
    .module-arrow {
      font-size: 12px; color: var(--text-secondary);
      transition: transform 0.2s;
    }
    .module-arrow.open { transform: rotate(90deg); }
    .module-parts { padding-left: 8px; }
    .module-parts.collapsed { display: none; }

    /* PART ITEM */
    .part-item {
      display: flex; align-items: center; gap: 8px;
      padding: 10px 10px;
      background: var(--accent-glow);
      border-radius: 8px;
      margin-bottom: 3px;
      cursor: pointer;
      transition: all 0.15s;
      border: 1px solid transparent;
    }
    .part-item:active { background: var(--accent-glow); }
    .part-item.active {
      background: var(--accent-glow);
      border-color: var(--accent);
    }
    .part-swatch {
      width: 36px; height: 36px;
      border-radius: 6px; flex-shrink: 0;
    }
    .part-info { flex: 1; min-width: 0; }
    .part-name {
      font-size: 12px; font-weight: 500;
      color: var(--text-primary);
      white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    }
    .part-code {
      font-size: 10px; color: var(--accent);
      margin-top: 1px;
      font-family: 'Monaco', 'Menlo', monospace;
    }
    .part-dims {
      font-size: 10px; color: var(--text-secondary);
      margin-top: 1px;
    }
    .check { font-size: 14px; flex-shrink: 0; }
    .check.done { color: var(--success); }

    /* MATERIAL SUMMARY PANEL */
    .material-summary {
      padding: 10px 12px;
      border-top: 1px solid var(--border);
      background: var(--bg-tertiary);
    }
    .summary-title {
      font-size: 11px; font-weight: 700;
      color: var(--accent); letter-spacing: 1px;
      text-transform: uppercase; margin-bottom: 6px;
    }
    .summary-row {
      display: flex; justify-content: space-between;
      align-items: center; padding: 3px 0;
      font-size: 12px;
    }
    .summary-label { color: var(--text-secondary); }
    .summary-val { color: var(--text-primary); font-weight: 600; }

    /* MODAL */
    .modal {
      position: fixed; inset: 0;
      background: rgba(0, 0, 0, 0.6);
      display: flex; align-items: center; justify-content: center;
      z-index: 50;
      backdrop-filter: blur(12px);
    }
    .modal.hidden { display: none; }
    .modal-box {
      background: rgba(18, 26, 38, 0.98);
      border: 1px solid rgba(0, 212, 170, 0.1);
      border-radius: 24px;
      padding: 24px;
      width: 90%; max-width: 340px;
      box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
    }
    .modal-title {
      color: var(--accent);
      text-align: center; margin-bottom: 14px;
      font-size: 14px; font-weight: 700;
      letter-spacing: 0.5px;
    }
    #video {
      width: 100%; aspect-ratio: 1/1;
      object-fit: cover;
      border-radius: 12px;
      border: 2px solid var(--border);
      margin-bottom: 14px;
    }
    .input-field {
      width: 100%; padding: 10px;
      margin-bottom: 10px;
      background: var(--bg-tertiary);
      border: 1px solid var(--border);
      border-radius: 10px;
      color: var(--text-primary);
      font-size: 14px;
      font-family: 'Monaco', 'Menlo', monospace;
    }
    .input-field::placeholder { color: var(--text-secondary); }
    .modal-btn {
      width: 100%; padding: 10px;
      background: var(--accent-glow);
      border: 1px solid var(--border);
      border-radius: 10px;
      color: var(--accent);
      font-weight: 700; font-size: 14px;
      cursor: pointer; margin-bottom: 6px;
      transition: all 0.15s;
    }
    .modal-btn:active { background: var(--accent); color: #fff; }
    .modal-btn.secondary {
      background: var(--bg-tertiary);
      color: var(--text-secondary);
    }

    /* TOAST */
    .toast {
      position: fixed;
      bottom: 70px; left: 50%;
      transform: translateX(-50%);
      background: var(--bg-secondary);
      border: 1px solid rgba(0, 212, 170, 0.15);
      padding: 10px 20px;
      border-radius: 12px;
      color: var(--accent);
      font-size: 14px; z-index: 100;
      pointer-events: none;
      opacity: 0; transition: opacity 0.3s ease;
      font-weight: 600;
      white-space: nowrap;
      box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
      backdrop-filter: blur(16px);
    }
    .toast.show { opacity: 1; }

    /* LOADING OVERLAY */
    #loadingOverlay {
      position: fixed; inset: 0;
      background: rgba(0,0,0,0.5);
      display: none; align-items: center; justify-content: center;
      z-index: 200; backdrop-filter: blur(8px);
    }
    #loadingOverlay.show { display: flex; }
    #loadingOverlay .spinner {
      width: 48px; height: 48px;
      border: 3px solid rgba(0,212,170,0.2);
      border-top-color: #00d4aa;
      border-radius: 50%;
      animation: spin 0.8s linear infinite;
    }
    @keyframes spin { to { transform: rotate(360deg); } }
    #loadingOverlay .load-text {
      color: var(--accent); font-size: 14px; margin-top: 12px; font-weight: 600;
    }

    /* ASSEMBLY GUIDE OVERLAY */
    .assembly-overlay {
      position: fixed;
      top: 50px; left: 0; right: 0;
      background: var(--bg-secondary);
      border-bottom: 1px solid var(--border);
      padding: 10px 14px;
      z-index: 17;
      display: none;
      align-items: center; gap: 10px;
      backdrop-filter: blur(24px);
      box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    }
    .assembly-overlay.active { display: flex; }
    .assembly-step {
      font-size: 11px; color: var(--accent); font-weight: 700;
      min-width: 60px;
    }
    .assembly-info {
      flex: 1; font-size: 10px; color: var(--text-primary);
    }
    .assembly-nav {
      display: flex; gap: 6px;
    }
    .assembly-nav button {
      background: rgba(255,255,255,0.04);
      border: 1px solid rgba(0, 212, 170, 0.08);
      width: 34px; height: 34px;
      border-radius: 10px; font-size: 14px;
      color: var(--accent); cursor: pointer;
      transition: all 0.2s;
    }
    .assembly-nav button:active {
      background: var(--accent); color: #fff;
    }

    ::-webkit-scrollbar { width: 3px; }
    ::-webkit-scrollbar-track { background: transparent; }
    ::-webkit-scrollbar-thumb { background: var(--accent-glow); border-radius: 2px; }

    /* === ANIMATIONS === */
    @keyframes fadeInUp {
      from { opacity: 0; transform: translateY(20px); }
      to { opacity: 1; transform: translateY(0); }
    }
    @keyframes fadeIn {
      from { opacity: 0; }
      to { opacity: 1; }
    }
    @keyframes scaleIn {
      from { opacity: 0; transform: scale(0.95); }
      to { opacity: 1; transform: scale(1); }
    }
    @keyframes slideUp {
      from { transform: translateY(100%); }
      to { transform: translateY(0); }
    }
    @keyframes pulse {
      0%, 100% { opacity: 1; }
      50% { opacity: 0.6; }
    }
    @keyframes shimmer {
      0% { background-position: -200% center; }
      100% { background-position: 200% center; }
    }

    .login-container {
      animation: scaleIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    }
    .bottom-sheet.open {
      animation: slideUp 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    }
    .modal:not(.hidden) .modal-box {
      animation: scaleIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    }
    .feature-card {
      transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    }
    .feature-card:hover {
      border-color: rgba(0, 212, 170, 0.15);
      transform: translateY(-4px);
      box-shadow: 0 12px 36px rgba(0, 0, 0, 0.2);
    }
    .step {
      animation: fadeInUp 0.5s ease both;
    }
    .step:nth-child(1) { animation-delay: 0.1s; }
    .step:nth-child(2) { animation-delay: 0.2s; }
    .step:nth-child(3) { animation-delay: 0.3s; }
    .btn-primary {
      transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    }
    .btn-primary:hover {
      transform: translateY(-2px);
      box-shadow: 0 8px 24px rgba(0, 212, 170, 0.3);
    }
    .cta-box {
      animation: fadeInUp 0.6s ease both;
      animation-delay: 0.4s;
    }
    .toolbar-btn {
      transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    }
    .toolbar-btn:active {
      transform: scale(0.9);
    }
    .top-btn {
      transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    }
    .top-btn:active {
      transform: scale(0.9);
    }
    .drawer {
      transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    }
    .bottom-sheet {
      transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    }
    .toast {
      transition: opacity 0.3s ease, transform 0.3s ease;
    }
    .toast.show {
      transform: translateX(-50%) translateY(0);
    }
    .part-item {
      transition: all 0.2s ease;
    }
    .part-item:active {
      transform: scale(0.98);
    }
    .module-header {
      transition: all 0.2s ease;
    }
    .module-header:active {
      transform: scale(0.98);
    }


    /* ===== GLASSMORPHISM — EVERYTHING ===== */



    /* Top panel */
    .top-panel {
      background: rgba(10, 10, 10, 0.5) !important;
      backdrop-filter: blur(30px) saturate(1.3) !important;
      -webkit-backdrop-filter: blur(30px) saturate(1.3) !important;
      border-bottom: 1px solid rgba(255, 255, 255, 0.1) !important;
    }

    /* Bottom toolbar */
    .bottom-toolbar {
      background: rgba(10, 10, 10, 0.55) !important;
      backdrop-filter: blur(30px) saturate(1.3) !important;
      -webkit-backdrop-filter: blur(30px) saturate(1.3) !important;
      border-top: 1px solid rgba(255, 255, 255, 0.1) !important;
    }

    /* Toolbar buttons */
    .toolbar-btn {
      background: rgba(255, 255, 255, 0.08) !important;
      border: 1px solid rgba(255, 255, 255, 0.12) !important;
    }
    .toolbar-btn.active {
      background: rgba(0, 212, 170, 0.12) !important;
      border-color: rgba(0, 212, 170, 0.2) !important;
    }

    /* Top buttons */
    .top-btn {
      background: rgba(255, 255, 255, 0.08) !important;
      border: 1px solid rgba(255, 255, 255, 0.12) !important;
    }

    /* Bottom sheet — transparent so 3D stays visible */
    .bottom-sheet {
      background: rgba(10, 10, 12, 0.15) !important;
      backdrop-filter: blur(8px) saturate(1.2) !important;
      -webkit-backdrop-filter: blur(16px) saturate(1.2) !important;
      border-top: 1px solid rgba(255, 255, 255, 0.08) !important;
      border-radius: 24px 24px 0 0 !important;
    }

    /* Drawer */
    .drawer {
      background: rgba(15, 15, 17, 0.65) !important;
      backdrop-filter: blur(40px) saturate(1.4) !important;
      -webkit-backdrop-filter: blur(40px) saturate(1.4) !important;
      border-right: 1px solid rgba(255, 255, 255, 0.1) !important;
    }

    /* Drawer buttons */
    .upload-btn {
      background: rgba(255, 255, 255, 0.08) !important;
      border: 1px dashed rgba(255, 255, 255, 0.15) !important;
    }
    .drawer-action-btn {
      background: rgba(255, 255, 255, 0.06) !important;
      border: 1px solid rgba(255, 255, 255, 0.12) !important;
    }
    .id-mode-btn {
      background: rgba(255, 255, 255, 0.06) !important;
      border: 1px solid rgba(255, 255, 255, 0.12) !important;
    }
    .id-mode-btn.active {
      background: var(--accent) !important;
      border-color: var(--accent) !important;
    }
    .search-input {
      background: rgba(255, 255, 255, 0.08) !important;
      border: 1px solid rgba(255, 255, 255, 0.12) !important;
    }

    /* Module headers */
    .module-header {
      background: rgba(255, 255, 255, 0.06) !important;
      border: 1px solid rgba(255, 255, 255, 0.1) !important;
    }

    /* Part items */
    .part-item {
      background: rgba(255, 255, 255, 0.05) !important;
    }
    .part-item.active {
      background: rgba(0, 212, 170, 0.08) !important;
      border-color: rgba(0, 212, 170, 0.2) !important;
    }

    /* Modals */
    .modal-box {
      background: rgba(25, 25, 28, 0.7) !important;
      backdrop-filter: blur(30px) saturate(1.4) !important;
      -webkit-backdrop-filter: blur(30px) saturate(1.4) !important;
      border: 1px solid rgba(255, 255, 255, 0.12) !important;
    }
    .input-field {
      background: rgba(255, 255, 255, 0.08) !important;
      border: 1px solid rgba(255, 255, 255, 0.1) !important;
    }
    .modal-btn {
      background: rgba(255, 255, 255, 0.08) !important;
      border: 1px solid rgba(255, 255, 255, 0.1) !important;
    }
    .modal-btn.secondary {
      background: rgba(255, 255, 255, 0.06) !important;
      border: 1px solid rgba(255, 255, 255, 0.1) !important;
    }

    /* Assembly overlay */
    .assembly-overlay {
      background: rgba(10, 10, 10, 0.55) !important;
      backdrop-filter: blur(24px) saturate(1.3) !important;
      -webkit-backdrop-filter: blur(24px) saturate(1.3) !important;
      border-bottom: 1px solid rgba(255, 255, 255, 0.1) !important;
    }
    .assembly-nav button {
      background: rgba(255, 255, 255, 0.08) !important;
      border: 1px solid rgba(255, 255, 255, 0.12) !important;
    }

    /* Toast */
    .toast {
      background: rgba(20, 20, 22, 0.65) !important;
      backdrop-filter: blur(24px) saturate(1.3) !important;
      -webkit-backdrop-filter: blur(24px) saturate(1.3) !important;
      border: 1px solid rgba(255, 255, 255, 0.12) !important;
    }

    /* Loading overlay */
    #loadingOverlay {
      background: rgba(10, 10, 10, 0.7) !important;
      backdrop-filter: blur(10px) !important;
    }

    /* Quick actions */
    .quick-actions {
      background: rgba(20, 20, 22, 0.9) !important;
      backdrop-filter: blur(20px) !important;
      -webkit-backdrop-filter: blur(20px) !important;
      border: 1px solid rgba(255, 255, 255, 0.12) !important;
    }
    .quick-action-btn {
      background: rgba(255, 255, 255, 0.08) !important;
      border: 1px solid rgba(255, 255, 255, 0.12) !important;
    }

    /* Action buttons */
    .action-btn {
      background: rgba(255, 255, 255, 0.08) !important;
      border: 1px solid rgba(255, 255, 255, 0.12) !important;
    }

    /* Material summary */
    .material-summary {
      background: rgba(255, 255, 255, 0.03) !important;
      border-top: 1px solid rgba(255, 255, 255, 0.06) !important;
    }

    /* ===== LIGHT THEME GLASS ===== */
    body.light-theme .top-panel {
      background: rgba(255, 255, 255, 0.5) !important;
      border-bottom: 1px solid rgba(0, 0, 0, 0.08) !important;
    }
    body.light-theme .bottom-toolbar {
      background: rgba(255, 255, 255, 0.55) !important;
      border-top: 1px solid rgba(0, 0, 0, 0.08) !important;
    }
    body.light-theme .bottom-sheet {
      background: rgba(255, 255, 255, 0.2) !important;
      border-top: 1px solid rgba(0, 0, 0, 0.08) !important;
    }
    body.light-theme .drawer {
      background: rgba(255, 255, 255, 0.65) !important;
      border-right: 1px solid rgba(0, 0, 0, 0.08) !important;
    }
    body.light-theme .modal-box {
      background: rgba(255, 255, 255, 0.7) !important;
      border: 1px solid rgba(0, 0, 0, 0.1) !important;
    }
    body.light-theme .toolbar-btn,
    body.light-theme .top-btn,
    body.light-theme .assembly-nav button,
    body.light-theme .drawer-action-btn,
    body.light-theme .upload-btn,
    body.light-theme .modal-btn,
    body.light-theme .action-btn,
    body.light-theme .quick-action-btn,
    body.light-theme .id-mode-btn {
      background: rgba(0, 0, 0, 0.04) !important;
      border: 1px solid rgba(0, 0, 0, 0.08) !important;
    }
    body.light-theme .toast {
      background: rgba(255, 255, 255, 0.65) !important;
      border: 1px solid rgba(0, 0, 0, 0.1) !important;
    }
    body.light-theme .search-input,
    body.light-theme .input-field {
      background: rgba(0, 0, 0, 0.04) !important;
      border: 1px solid rgba(0, 0, 0, 0.08) !important;
    }
    body.light-theme .module-header {
      background: rgba(0, 0, 0, 0.03) !important;
      border: 1px solid rgba(0, 0, 0, 0.06) !important;
    }

    /* Text readability on transparent sheet */
    .sheet-content .detail-label,
    .sheet-content .detail-value,
    .sheet-content .detail-code,
    .sheet-content .dim,
    .sheet-content .dim-label,
    .sheet-content .dim-value,
    .sheet-content .module-badge,
    .sheet-content .material-tag,
    .sheet-content .status-badge,
    .sheet-content .assembly-hint {
      text-shadow: 0 1px 4px rgba(0,0,0,0.5);
    }
    body.light-theme .sheet-content .detail-label,
    body.light-theme .sheet-content .detail-value,
    body.light-theme .sheet-content .detail-code,
    body.light-theme .sheet-content .dim,
    body.light-theme .sheet-content .dim-label,
    body.light-theme .sheet-content .dim-value,
    body.light-theme .sheet-content .module-badge,
    body.light-theme .sheet-content .material-tag,
    body.light-theme .sheet-content .status-badge,
    body.light-theme .sheet-content .assembly-hint {
      text-shadow: 0 1px 3px rgba(255,255,255,0.6);
    }
