    :root {
      --bg: #000000;
      --card-bg: rgba(14, 18, 27, 0.75);
      --card-hover: rgba(24, 30, 45, 0.88);
      --border: rgba(255, 255, 255, 0.08);
      --border-hover: #f39c12;
      --accent: #f39c12;
      --accent-glow: rgba(243, 156, 18, 0.25);
      --text-main: #f1f5f9;
      --text-muted: #94a3b8;
      --nav-height: 58px;
      --header-height: 60px;
      --safe-bottom: env(safe-area-inset-bottom, 0px);
    }

    * {
      box-sizing: border-box;
      margin: 0;
      padding: 0;
      font-family: 'Inter', -apple-system, sans-serif;
      -webkit-tap-highlight-color: transparent;
      touch-action: manipulation;
    }

    html, body {
      background-color: var(--bg);
      color: var(--text-main);
      min-height: 100vh;
      width: 100% !important;
      max-width: 100vw !important;
      overflow-x: hidden !important;
      position: relative;
      touch-action: pan-y !important; /* disable pinch-to-zoom */
      -webkit-text-size-adjust: 100%;
      overscroll-behavior-y: none;
      -webkit-user-select: none;
      user-select: none;
    }

    /* Prevent auto-zoom on iOS when tapping inputs on mobile */
    @media (max-width: 768px) {
      input:not(.param-select):not(.autodelete-checkbox),
      select:not(.param-select),
      textarea {
        font-size: 16px !important;
      }
    }
    input, select, textarea {
      touch-action: auto !important;
      -webkit-user-select: auto;
      user-select: auto;
    }

    /* Ambient background glow - disabled for pure black aesthetics */
    .bg-glow {
      display: none !important;
    }

    /* --- AUTH SCREEN --- */
    #auth-screen {
      position: fixed;
      inset: 0;
      display: flex;
      align-items: center;
      justify-content: center;
      z-index: 1000;
      background: #000000;
      padding: 20px;
      width: 100vw;
      max-width: 100vw;
      box-sizing: border-box;
    }

    .auth-card {
      background: rgba(12, 16, 24, 0.85);
      backdrop-filter: blur(20px);
      border: 1px solid var(--border);
      border-radius: 24px;
      width: 100%;
      max-width: 400px;
      padding: 36px 28px;
      box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7), 0 0 30px rgba(243, 156, 18, 0.05);
      text-align: center;
      animation: fadeIn 0.4s ease-out;
    }

    .auth-logo {
      width: 64px;
      height: 64px;
      background: rgba(243, 156, 18, 0.1);
      border: 1px solid rgba(243, 156, 18, 0.3);
      border-radius: 18px;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 30px;
      color: var(--accent);
      margin: 0 auto 18px auto;
      box-shadow: 0 0 20px rgba(243, 156, 18, 0.15);
    }

    .auth-title {
      font-size: 24px;
      font-weight: 700;
      letter-spacing: -0.5px;
      margin-bottom: 6px;
      color: #fff;
    }

    .auth-subtitle {
      color: var(--text-muted);
      font-size: 13px;
      margin-bottom: 24px;
    }

    .form-group {
      text-align: left;
      margin-bottom: 16px;
    }

    .form-label {
      display: block;
      font-size: 11px;
      font-weight: 700;
      text-transform: uppercase;
      letter-spacing: 0.8px;
      color: var(--text-muted);
      margin-bottom: 7px;
    }

    .form-input {
      width: 100%;
      background: #050811;
      border: 1px solid rgba(255, 255, 255, 0.1);
      border-radius: 12px;
      padding: 12px 14px;
      color: #fff;
      font-size: 14px;
      outline: none;
      transition: all 0.2s;
    }

    .form-input:focus {
      border-color: #eab308;
      box-shadow: 0 0 0 3px rgba(234, 179, 8, 0.15);
    }

    .input-wrapper {
      position: relative;
      display: flex;
      align-items: center;
      background: #050811;
      border: 1px solid rgba(255, 255, 255, 0.12);
      border-radius: 12px;
      padding: 0 14px;
      transition: border-color 0.2s ease, box-shadow 0.2s ease;
    }

    .input-wrapper i,
    .input-wrapper .input-icon {
      position: static;
      transform: none;
      color: #64748b;
      font-size: 15px;
      margin-right: 12px;
      flex-shrink: 0;
      transition: color 0.2s ease;
    }

    .input-wrapper .form-input {
      flex: 1;
      width: 100%;
      background: transparent !important;
      border: none !important;
      border-radius: 0 !important;
      padding: 12px 0 !important;
      color: #fff !important;
      font-size: 14px !important;
      outline: none !important;
      box-shadow: none !important;
    }

    /* Active input state: brighter yellow border & glowing yellow icon */
    .input-wrapper:focus-within {
      border-color: #eab308 !important;
      box-shadow: 0 0 0 3px rgba(234, 179, 8, 0.2), 0 0 18px rgba(234, 179, 8, 0.25) !important;
    }

    .input-wrapper:focus-within i,
    .input-wrapper:focus-within .input-icon {
      color: #eab308 !important;
    }

    @keyframes authBtnPulse {
      0%, 100% {
        box-shadow: 0 4px 15px rgba(234, 179, 8, 0.4);
        transform: scale(1);
      }
      50% {
        box-shadow: 0 6px 25px rgba(234, 179, 8, 0.75), 0 0 16px rgba(234, 179, 8, 0.5);
        transform: scale(1.02);
      }
    }

    .btn-primary {
      width: 100%;
      background: linear-gradient(135deg, #eab308, #ca8a04);
      border: none;
      color: #000;
      font-weight: 700;
      font-size: 15px;
      padding: 13px;
      border-radius: 12px;
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 10px;
      margin-top: 22px;
      transition: all 0.25s ease;
      box-shadow: 0 4px 15px rgba(234, 179, 8, 0.4);
      animation: authBtnPulse 2.2s infinite ease-in-out;
    }

    .btn-primary:hover {
      background: linear-gradient(135deg, #facc15, #eab308);
      box-shadow: 0 8px 30px rgba(234, 179, 8, 0.8), 0 0 20px rgba(234, 179, 8, 0.6);
    }

    .auth-error {
      background: rgba(239, 68, 68, 0.15);
      border: 1px solid rgba(239, 68, 68, 0.3);
      color: #ef4444;
      font-size: 13px;
      padding: 10px;
      border-radius: 10px;
      margin-top: 14px;
      display: none;
    }

    /* --- MAIN APP DASHBOARD --- */
    #main-app {
      display: none;
      flex-direction: column;
      flex: 1;
      position: relative;
      z-index: 1;
      width: 100%;
      max-width: 100vw;
      overflow-x: hidden;
    }

    .app-header {
      border-bottom: 1px solid var(--border);
      background: rgba(5, 9, 15, 0.88);
      backdrop-filter: blur(16px);
      position: sticky;
      top: 0;
      z-index: 50;
      padding: 10px 20px;
      display: flex;
      align-items: center;
      justify-content: space-between;
      height: var(--header-height);
      width: 100%;
      max-width: 100vw;
      box-sizing: border-box;
    }

    .header-left {
      display: flex;
      align-items: center;
      gap: 10px;
      min-width: max-content;
      flex-shrink: 0;
    }

    .brand-logo {
      display: flex;
      align-items: center;
      gap: 8px;
      text-decoration: none;
      color: #fff;
      min-width: max-content;
      flex-shrink: 0;
    }

    .brand-icon {
      width: 36px;
      height: 36px;
      background: rgba(243, 156, 18, 0.15);
      border: 1px solid rgba(243, 156, 18, 0.3);
      border-radius: 10px;
      display: flex;
      align-items: center;
      justify-content: center;
      color: var(--accent);
      font-size: 17px;
      flex-shrink: 0;
    }

    .brand-title {
      font-size: 17px;
      font-weight: 700;
      letter-spacing: -0.3px;
      white-space: nowrap;
    }

    .brand-badge {
      font-size: 9px;
      font-weight: 800;
      background: rgba(243, 156, 18, 0.15);
      color: var(--accent);
      padding: 2px 7px;
      border-radius: 20px;
      letter-spacing: 0.5px;
      border: 1px solid rgba(243, 156, 18, 0.3);
      margin-left: 6px;
    }

    .header-actions {
      display: flex;
      align-items: center;
      gap: 8px;
      flex-shrink: 0;
    }

    /* Compact Icon Buttons */
    .btn-icon-header {
      width: 36px;
      height: 36px;
      background: rgba(255, 255, 255, 0.05);
      border: 1px solid var(--border);
      border-radius: 10px;
      color: #94a3b8;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 15px;
      cursor: pointer;
      transition: all 0.2s;
      flex-shrink: 0;
    }

    /* Passive Mode Indicator Badge (non-clickable, purely displays current mode) */
    .mode-badge-indicator {
      width: 34px;
      height: 34px;
      background: rgba(255, 255, 255, 0.04);
      border: 1px solid var(--border);
      border-radius: 10px;
      color: #64748b;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 14px;
      cursor: default;
      user-select: none;
      flex-shrink: 0;
    }

    .btn-icon-header:hover {
      background: rgba(243, 156, 18, 0.15);
      border-color: var(--accent);
      color: var(--accent);
    }

    .btn-icon-header.btn-logout {
      color: #ef4444;
      background: rgba(239, 68, 68, 0.1);
      border-color: rgba(239, 68, 68, 0.2);
    }

    .btn-icon-header.btn-logout:hover {
      background: rgba(239, 68, 68, 0.2);
      border-color: #ef4444;
    }

    .user-pill {
      display: flex;
      align-items: center;
      gap: 7px;
      background: rgba(255, 255, 255, 0.04);
      border: 1px solid var(--border);
      padding: 5px 10px;
      border-radius: 30px;
      font-size: 12px;
      white-space: nowrap;
    }

    .user-role-badge {
      font-size: 9px;
      font-weight: 800;
      text-transform: uppercase;
      padding: 2px 6px;
      border-radius: 10px;
      letter-spacing: 0.5px;
      display: inline-flex;
      align-items: center;
      gap: 3px;
    }

    .role-admin {
      background: rgba(243, 156, 18, 0.2);
      color: #f39c12;
      border: 1px solid rgba(243, 156, 18, 0.4);
    }

    .role-user {
      background: rgba(59, 130, 246, 0.2);
      color: #60a5fa;
      border: 1px solid rgba(59, 130, 246, 0.4);
    }

    .btn-header {
      background: rgba(255, 255, 255, 0.05);
      border: 1px solid var(--border);
      color: #cbd5e1;
      padding: 7px 12px;
      border-radius: 10px;
      font-size: 13px;
      font-weight: 600;
      cursor: pointer;
      display: flex;
      align-items: center;
      gap: 7px;
      transition: all 0.2s;
      white-space: nowrap;
    }

    .btn-header:hover {
      background: rgba(243, 156, 18, 0.15);
      border-color: var(--accent);
      color: var(--accent);
    }

    /* --- APP BODY & SIDEBAR LAYOUT --- */
    .app-body {
      display: flex;
      flex: 1;
      position: relative;
      width: 100%;
      min-height: calc(100vh - var(--header-height));
    }

    .app-sidebar {
      width: 285px !important;
      min-width: 285px !important;
      max-width: 285px !important;
      background: #000000 !important;
      border-right: 1px solid #131a28 !important;
      display: flex;
      flex-direction: column;
      height: calc(100vh - var(--header-height));
      position: sticky;
      top: var(--header-height);
      overflow-y: auto;
      overflow-x: hidden;
      z-index: 40;
      transition: transform 0.25s ease;
      box-sizing: border-box;
      padding: 16px 14px !important;
      gap: 12px !important;
    }

    .app-sidebar::-webkit-scrollbar {
      width: 4px;
    }
    .app-sidebar::-webkit-scrollbar-thumb {
      background: rgba(255, 255, 255, 0.1);
      border-radius: 4px;
    }

    .sidebar-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding-bottom: 12px;
      border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    }
    .sb-brand {
      display: flex;
      align-items: center;
      gap: 10px;
    }
    .sb-icon {
      width: 34px;
      height: 34px;
      background: rgba(243, 156, 18, 0.15);
      border: 1px solid rgba(243, 156, 18, 0.3);
      border-radius: 8px;
      display: flex;
      align-items: center;
      justify-content: center;
      color: var(--accent);
      font-size: 15px;
    }
    .sb-titles {
      display: flex;
      flex-direction: column;
    }
    .sb-title {
      font-size: 15px;
      font-weight: 800;
      color: #fff;
      letter-spacing: -0.2px;
    }
    .sb-subtitle {
      font-size: 9px;
      font-weight: 700;
      letter-spacing: 1px;
      color: var(--accent);
      text-transform: uppercase;
    }
    .sb-close-btn {
      display: none;
      background: transparent;
      border: none;
      color: #94a3b8;
      font-size: 18px;
      cursor: pointer;
      padding: 4px;
    }

    .sb-section {
      display: flex;
      flex-direction: column;
      gap: 8px;
    }
    .sb-section-label {
      font-size: 10px;
      font-weight: 800;
      letter-spacing: 0.8px;
      color: #64748b;
      text-transform: uppercase;
    }

    .sb-select-row {
      display: flex;
      align-items: center;
      gap: 6px;
    }
    .sb-select {
      flex: 1;
      background: #05090f !important;
      border: 1px solid #131a28 !important;
      color: #f1f5f9;
      font-size: 12px !important;
      font-weight: 500;
      padding: 6px 10px !important;
      border-radius: 6px;
      outline: none;
      cursor: pointer;
      transition: border-color 0.2s, opacity 0.2s;
    }
    .sb-select:disabled {
      opacity: 0.55 !important;
      cursor: not-allowed !important;
    }
    .sb-select:focus {
      border-color: var(--accent);
    }
    .sb-btn-edit {
      width: 34px;
      height: 34px;
      background: var(--accent);
      border: none;
      color: #000;
      border-radius: 8px;
      font-size: 13px;
      display: flex;
      align-items: center;
      justify-content: center;
      cursor: pointer;
      flex-shrink: 0;
      transition: filter 0.2s;
    }
    .sb-btn-edit:hover {
      filter: brightness(1.15);
    }
    .sb-btn-delete {
      background: rgba(239, 68, 68, 0.08);
      border: 1px solid rgba(239, 68, 68, 0.25);
      color: #f87171;
      font-size: 12px;
      font-weight: 600;
      padding: 8px;
      border-radius: 8px;
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 6px;
      transition: all 0.2s;
    }
    .sb-btn-delete:hover {
      background: rgba(239, 68, 68, 0.18);
      border-color: #ef4444;
    }

    .sb-info-card {
      background: #05090f !important;
      border: 1px solid #131a28 !important;
      border-radius: 8px;
      padding: 10px 12px;
      display: flex;
      flex-direction: column;
      gap: 6px;
    }
    .sb-info-row {
      display: flex;
      justify-content: space-between;
      align-items: center;
      font-size: 11px;
    }
    .sb-info-key {
      color: #64748b;
      font-weight: 500;
    }
    .sb-info-val {
      color: #cbd5e1;
      font-weight: 600;
    }
    .sb-info-val.mono {
      font-family: monospace;
      letter-spacing: 0.5px;
    }

    .sb-btn-error {
      background: rgba(239, 68, 68, 0.12);
      border: 1px solid rgba(239, 68, 68, 0.3);
      color: #f87171;
      padding: 8px 10px;
      border-radius: 8px;
      font-size: 12px;
      font-weight: 600;
      cursor: pointer;
      display: flex;
      align-items: center;
      gap: 7px;
      transition: all 0.2s;
    }
    .sb-btn-error:hover {
      background: rgba(239, 68, 68, 0.22);
      border-color: #ef4444;
    }

    .sb-btn-admin-users {
      background: rgba(59, 130, 246, 0.12);
      border: 1px solid rgba(59, 130, 246, 0.3);
      color: #60a5fa;
      padding: 8px 10px;
      border-radius: 8px;
      font-size: 12px;
      font-weight: 600;
      cursor: pointer;
      display: flex;
      align-items: center;
      gap: 7px;
      transition: all 0.2s;
    }
    .sb-btn-admin-users:hover {
      background: rgba(59, 130, 246, 0.22);
      border-color: #3b82f6;
    }

    .sb-btn-admin-stt {
      background: rgba(168, 85, 247, 0.12);
      border: 1px solid rgba(168, 85, 247, 0.3);
      color: #c084fc;
      padding: 8px 10px;
      border-radius: 8px;
      font-size: 12px;
      font-weight: 600;
      cursor: pointer;
      display: flex;
      align-items: center;
      gap: 7px;
      transition: all 0.2s;
    }
    .sb-btn-admin-stt:hover {
      background: rgba(168, 85, 247, 0.22);
      border-color: #a855f7;
    }

    .sb-settings-card {
      background: #05090f !important;
      border: 1px solid #131a28 !important;
      border-radius: 8px;
      padding: 10px 12px;
      display: flex;
      flex-direction: column;
      gap: 10px;
    }
    .sb-field {
      display: flex;
      flex-direction: column;
      gap: 4px;
    }
    .sb-field-label {
      font-size: 10px !important;
      color: #64748b !important;
      font-weight: 600 !important;
      text-transform: uppercase !important;
      letter-spacing: 0.4px !important;
    }
    .sb-check-row {
      display: flex;
      align-items: center;
      gap: 8px;
      font-size: 12px;
      color: #e2e8f0;
      cursor: pointer;
    }
    .sb-check-row input[type="checkbox"] {
      accent-color: var(--accent);
      width: 15px;
      height: 15px;
      cursor: pointer;
    }
    .sb-stepper-row {
      display: flex;
      align-items: center;
      gap: 8px;
    }
    .sb-num-input {
      width: 60px;
      background: #060910;
      border: 1px solid #1e293b;
      color: #fff;
      padding: 5px 8px;
      border-radius: 6px;
      font-size: 12px;
      font-weight: 700;
      text-align: center;
      outline: none;
    }
    .sb-num-hint {
      font-size: 11px;
      color: #64748b;
    }

    .sb-btn-apply {
      background: var(--accent);
      border: none;
      color: #000;
      font-weight: 700;
      font-size: 13px;
      padding: 9px;
      border-radius: 8px;
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 6px;
      transition: filter 0.2s;
    }
    .sb-btn-apply:hover {
      filter: brightness(1.12);
    }

    .sb-btn-stealth {
      background: rgba(239, 68, 68, 0.12);
      border: 1px solid rgba(239, 68, 68, 0.35);
      color: #f87171;
      font-weight: 700;
      font-size: 12px;
      padding: 8px;
      border-radius: 8px;
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 6px;
      transition: all 0.2s;
    }
    .sb-btn-stealth:hover {
      background: rgba(239, 68, 68, 0.22);
      border-color: #ef4444;
    }

    /* Workspace Area */
    .workspace-area {
      flex: 1;
      display: flex;
      flex-direction: column;
      min-width: 0;
      background: var(--bg-main);
    }

    .workspace-breadcrumbs {
      padding: 12px 24px;
      border-bottom: 1px solid rgba(255, 255, 255, 0.05);
      background: rgba(8, 12, 20, 0.6);
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
    }
    .bc-left {
      display: flex;
      align-items: center;
      gap: 8px;
      font-size: 14px;
      color: #94a3b8;
    }
    .bc-sep {
      color: #475569;
    }
    .bc-left strong, .bc-left #bc-device-name {
      color: #fff;
    }

    .sidebar-backdrop {
      display: none;
      position: fixed;
      inset: 0;
      background: rgba(0, 0, 0, 0.65);
      backdrop-filter: blur(4px);
      z-index: 80;
    }

    /* Container */
    .main-container {
      max-width: 1300px;
      width: 100%;
      margin: 0 auto;
      padding: 24px;
      flex: 1;
      box-sizing: border-box;
      overflow-x: hidden;
    }

    .section-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      margin-bottom: 20px;
      flex-wrap: wrap;
      gap: 12px;
    }

    .section-title {
      font-size: 20px;
      font-weight: 700;
      color: #fff;
      display: flex;
      align-items: center;
      gap: 10px;
    }

    .stats-pill {
      font-size: 12px;
      color: var(--text-muted);
      background: rgba(255, 255, 255, 0.03);
      border: 1px solid var(--border);
      padding: 4px 12px;
      border-radius: 20px;
    }

    .stats-pill strong {
      color: var(--accent);
    }

    /* Cards Grid */
    .card-grid {
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
      gap: 18px;
      width: 100%;
      box-sizing: border-box;
    }

    .device-card {
      background: var(--card-bg);
      backdrop-filter: blur(14px);
      border: 1px solid var(--border);
      border-radius: 16px;
      padding: 18px;
      position: relative;
      overflow: hidden;
      display: flex;
      flex-direction: column;
      justify-content: space-between;
      min-height: 170px;
      cursor: pointer;
      transition: all 0.25s ease;
      box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
      box-sizing: border-box;
    }

    .device-card:hover {
      background: var(--card-hover);
      border-color: var(--border-hover);
      transform: translateY(-3px);
      box-shadow: 0 15px 35px rgba(0, 0, 0, 0.6), 0 0 25px var(--accent-glow);
    }

    .device-card:active {
      transform: scale(0.985);
    }

    .card-watermark {
      position: absolute;
      right: -20px;
      bottom: -20px;
      font-size: 120px;
      color: rgba(255, 255, 255, 0.02);
      pointer-events: none;
      transition: all 0.3s;
    }

    .device-card:hover .card-watermark {
      color: rgba(243, 156, 18, 0.05);
      transform: scale(1.06) rotate(-5deg);
    }

    .card-top {
      display: flex;
      align-items: center;
      justify-content: space-between;
      margin-bottom: 12px;
    }

    .badges-group {
      display: flex;
      align-items: center;
      gap: 6px;
      flex-wrap: wrap;
    }

    .badge {
      font-size: 10px;
      font-weight: 700;
      padding: 3px 8px;
      border-radius: 12px;
      letter-spacing: 0.4px;
      text-transform: uppercase;
    }

    .badge-type {
      background: rgba(255, 255, 255, 0.06);
      color: #cbd5e1;
      border: 1px solid rgba(255, 255, 255, 0.1);
    }

    .badge-mode {
      background: rgba(243, 156, 18, 0.12);
      color: #f39c12;
      border: 1px solid rgba(243, 156, 18, 0.25);
    }

    .status-badge, .status-badge-sq {
      display: inline-flex !important;
      align-items: center !important;
      gap: 5px !important;
      font-size: 10px !important;
      font-weight: 700 !important;
      padding: 2px 7px !important;
      border-radius: 3px !important;
      text-transform: uppercase !important;
      letter-spacing: 0.5px !important;
      line-height: 1.3 !important;
    }

    .status-online, .status-badge-sq.status-online {
      background: rgba(34, 197, 94, 0.12) !important;
      border: 1px solid rgba(34, 197, 94, 0.3) !important;
      color: #4ade80 !important;
      border-radius: 3px !important;
    }

    .status-online .dot, .status-online .sq-dot {
      width: 5px !important;
      height: 5px !important;
      background: #4ade80 !important;
      border-radius: 1px !important;
      box-shadow: 0 0 6px #4ade80 !important;
      animation: pulse 2s infinite !important;
      display: inline-block !important;
    }

    .status-offline, .status-badge-sq.status-offline {
      background: rgba(239, 68, 68, 0.12) !important;
      border: 1px solid rgba(239, 68, 68, 0.3) !important;
      color: #f87171 !important;
      border-radius: 3px !important;
    }

    .status-offline .dot, .status-offline .sq-dot {
      width: 5px !important;
      height: 5px !important;
      background: #f87171 !important;
      border-radius: 1px !important;
      display: inline-block !important;
    }

    .card-title {
      font-size: 18px;
      font-weight: 700;
      color: #fff;
      margin-bottom: 4px;
      display: flex;
      align-items: center;
      gap: 8px;
    }

    .card-mac {
      font-size: 12px;
      font-family: monospace;
      color: var(--text-muted);
      margin-bottom: 14px;
    }

    .card-footer {
      border-top: 1px solid rgba(255, 255, 255, 0.05);
      padding-top: 12px;
      display: flex;
      align-items: center;
      justify-content: space-between;
      font-size: 12px;
      color: var(--text-muted);
    }

    .card-footer-item {
      display: flex;
      align-items: center;
      gap: 6px;
    }

    .empty-state {
      text-align: center;
      padding: 50px 20px;
      background: rgba(14, 18, 27, 0.4);
      border: 1px dashed var(--border);
      border-radius: 20px;
      grid-column: 1 / -1;
    }

    .empty-icon {
      font-size: 44px;
      color: var(--text-muted);
      margin-bottom: 14px;
    }

    /* --- VIEWS: DEVICES OVERVIEW & WORKBENCH --- */
    #devices-overview-view {
      display: block;
      width: 100%;
    }

    #desktop-workbench-view {
      display: none;
      flex-direction: column;
      gap: 16px;
      width: 100%;
    }

    /* 1. CALENDAR CARD */
    /* 1. CALENDAR CARD (EXACT BOXES.MD REFERENCE) */
    /* 1. CALENDAR CARD (EXACT BOXES.MD REFERENCE) */
    .calendar-card {
      background: #000000 !important;
      border: 1px solid #131a28 !important;
      border-radius: 8px !important;
      padding: 16px 20px !important;
      min-height: 290px !important;
      display: flex !important;
      align-items: center !important;
      justify-content: space-between !important;
      gap: 16px !important;
      box-sizing: border-box !important;
    }

    .cal-title {
      font-size: 11px;
      font-weight: 800;
      letter-spacing: 1px;
      color: #94a3b8;
      text-transform: uppercase;
    }

    .cal-nav-btn {
      background: transparent !important;
      border: none !important;
      color: #94a3b8 !important;
      font-size: 12px !important;
      font-weight: 600 !important;
      cursor: pointer !important;
      display: flex !important;
      align-items: center !important;
      gap: 6px !important;
      padding: 8px 12px !important;
      border-radius: 6px !important;
      flex-shrink: 0 !important;
      transition: all 0.2s !important;
      user-select: none !important;
    }
    .cal-nav-btn:hover {
      color: #ffffff !important;
      background: rgba(255, 255, 255, 0.05) !important;
    }

    .cal-months-row {
      display: flex !important;
      flex-direction: row !important;
      gap: 28px !important;
      align-items: flex-start !important;
      justify-content: center !important;
      flex: 1 1 auto !important;
      overflow: hidden !important;
      padding: 0 !important;
    }

    .cal-month-box {
      flex: 0 1 250px !important;
      width: 250px !important;
      min-width: 210px !important;
      max-width: 260px !important;
      background: transparent !important;
      border: none !important;
      box-shadow: none !important;
      padding: 0 !important;
      box-sizing: border-box !important;
      display: flex !important;
      flex-direction: column !important;
      gap: 6px !important;
      user-select: none !important;
    }

    .cal-month-header {
      display: flex !important;
      align-items: center !important;
      justify-content: space-between !important;
      padding: 2px 2px 6px 2px !important;
      border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
      margin-bottom: 4px !important;
    }

    .cal-month-title {
      font-size: 11px !important;
      font-weight: 800 !important;
      color: #cbd5e1 !important;
      letter-spacing: 0.5px !important;
      text-transform: uppercase !important;
    }

    .cal-broom-btn {
      background: transparent !important;
      border: none !important;
      color: #64748b !important;
      font-size: 11px !important;
      cursor: pointer !important;
      padding: 2px 5px !important;
      border-radius: 4px !important;
      transition: all 0.15s !important;
    }
    .cal-broom-btn:hover {
      color: #f87171 !important;
      background: rgba(239, 68, 68, 0.1) !important;
    }

    .cal-weekdays-row {
      display: grid !important;
      grid-template-columns: repeat(7, 1fr) !important;
      text-align: center !important;
      font-size: 9px !important;
      color: #64748b !important;
      font-weight: 700 !important;
      padding: 2px 0 !important;
    }

    .cal-days-grid {
      display: grid !important;
      grid-template-columns: repeat(7, 1fr) !important;
      gap: 4px !important;
      padding: 2px 0 !important;
    }

    .cal-day-cell {
      width: 100% !important;
      aspect-ratio: 1 / 1 !important;
      display: flex !important;
      align-items: center !important;
      justify-content: center !important;
      font-size: 10px !important;
      font-weight: 600 !important;
      border-radius: 3px !important;
      color: #475569 !important;
      cursor: pointer !important;
      position: relative !important;
      background: rgba(15, 23, 42, 0.12) !important;
      border: 1px solid rgba(255, 255, 255, 0.02) !important;
      opacity: 0.20 !important;
      transition: all 0.15s ease !important;
    }
    .cal-day-cell:hover:not(.empty) {
      z-index: 25 !important;
      opacity: 0.85 !important;
      border-color: rgba(56, 189, 248, 0.4) !important;
      color: #ffffff !important;
      background: rgba(30, 41, 59, 0.4) !important;
    }
    .cal-day-cell.empty {
      background: transparent !important;
      border-color: transparent !important;
      cursor: default !important;
      pointer-events: none !important;
      opacity: 0 !important;
    }
    .cal-day-cell.has-data {
      border: 1px solid rgba(16, 185, 129, 0.35) !important;
      color: #ffffff !important;
      font-weight: 700 !important;
      opacity: 1 !important;
    }
    .cal-day-cell.has-offline {
      border: 1px solid rgba(239, 68, 68, 0.35) !important;
      color: #ffffff !important;
      font-weight: 700 !important;
      opacity: 1 !important;
    }
    .cal-day-cell.selected, .cal-day-cell.active-day-border {
      border-color: #22c55e !important;
      box-shadow: 0 0 0 2px #22c55e, 0 0 12px rgba(34, 197, 94, 0.6) !important;
      z-index: 20 !important;
      font-weight: 800 !important;
      opacity: 1 !important;
    }
    .cal-day-cell.selected.has-offline, .cal-day-cell.active-day-border.has-offline {
      border-color: #ef4444 !important;
      box-shadow: 0 0 0 2px #ef4444, 0 0 12px rgba(239, 68, 68, 0.6) !important;
    }

    /* 4-DOT INDICATOR SYSTEM IN CALENDAR (Boxes.md Section 3) */
    .day-dots-wrap {
      position: absolute;
      top: 2px;
      right: 2px;
      display: flex;
      flex-direction: column;
      gap: 2px;
      pointer-events: none;
      z-index: 5;
    }
    .m-dot {
      width: 4px;
      height: 4px;
      border-radius: 50%;
      display: block;
    }
    .m-dot.red {
      background: #ef4444;
      box-shadow: 0 0 4px rgba(239, 68, 68, 0.9);
    }
    .m-dot.blue {
      background: #38bdf8;
      box-shadow: 0 0 4px rgba(56, 189, 248, 0.9);
    }
    .m-dot.orange {
      background: #f59e0b;
      box-shadow: 0 0 4px rgba(245, 158, 11, 0.9);
    }
    .m-dot.purple {
      background: #a855f7;
      box-shadow: 0 0 4px rgba(168, 85, 247, 0.9);
    }

    /* CALENDAR DAY TOOLTIP (Exact match for Screenshot 4) */
    .cal-day-tooltip {
      position: absolute;
      bottom: calc(100% + 6px);
      left: 50%;
      transform: translateX(-50%);
      background: rgba(10, 13, 18, 0.96);
      backdrop-filter: blur(8px);
      border: 1px solid #1e293b;
      border-radius: 5px;
      padding: 6px 10px;
      font-size: 10px;
      color: #e2e8f0;
      white-space: nowrap;
      pointer-events: none;
      z-index: 100;
      display: none;
      flex-direction: column;
      align-items: center;
      gap: 3px;
      box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.8);
    }
    .cal-day-tooltip::after {
      content: '';
      position: absolute;
      top: 100%;
      left: 50%;
      transform: translateX(-50%);
      border-width: 4px;
      border-style: solid;
      border-color: #1e293b transparent transparent transparent;
    }
    .cal-day-cell:hover .cal-day-tooltip {
      display: flex;
    }
    .tt-title {
      font-weight: 700;
      color: #cbd5e1;
      margin-bottom: 2px;
    }
    .tt-item {
      font-weight: 600;
      line-height: 1.3;
    }
    .tt-red { color: #f87171 !important; }
    .tt-blue { color: #38bdf8 !important; }
    .tt-amber { color: #fbbf24 !important; }
    .tt-purple { color: #c084fc !important; }
    .tt-green { color: #4ade80 !important; }
    .tt-muted { color: #64748b !important; }

    /* LATEST FILE FOCUS PULSE ANIMATION */
    @keyframes latestFilePulse {
      0% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7); border-color: #22c55e; }
      50% { box-shadow: 0 0 18px 4px rgba(34, 197, 94, 0.4); border-color: #4ade80; }
      100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
    }
    .chunk-card.focused-latest-file {
      animation: latestFilePulse 1.8s ease-in-out 3 !important;
      border: 1.5px solid #22c55e !important;
    }

    /* SIDEBAR RECORDING SETTINGS & COLLAPSIBLE (Screenshots 2 & 3 & AppScript) */
    .advanced-params-collapsible {
      max-height: 0;
      opacity: 0;
      margin-bottom: 0;
      overflow: hidden;
      transition: max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease, margin-bottom 0.3s ease;
    }
    .advanced-params-collapsible.is-expanded {
      max-height: 850px;
      opacity: 1;
      margin-bottom: 8px;
    }

    .params-box {
      background: rgba(0, 0, 0, 0.4) !important;
      border: 1px solid #131a28 !important;
      border-radius: 6px;
      overflow: hidden;
      margin-top: 6px;
    }
    .params-box-header {
      padding: 5px 8px !important;
      font-size: 10px !important;
      font-weight: 700 !important;
      color: #eab308;
      border-bottom: 1px solid rgba(19, 26, 40, 0.6) !important;
      display: flex;
      align-items: center;
      gap: 5px;
      transition: color 0.2s;
    }
    .params-box-body {
      padding: 4px 8px !important;
      display: flex;
      flex-direction: column;
      gap: 3px;
    }
    .param-row {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 6px;
      font-size: 10px !important;
      padding: 1.5px 0 !important;
    }
    .param-label-wrap {
      display: flex;
      align-items: center;
      gap: 4px;
      color: #94a3b8 !important;
      font-size: 10px !important;
      font-weight: 500;
    }
    .param-label-wrap span {
      font-size: 10px !important;
      color: #94a3b8 !important;
    }
    .param-help {
      font-size: 9px !important;
      color: #475569 !important;
      cursor: help;
    }
    .param-help:hover {
      color: #cbd5e1 !important;
    }
    .param-select {
      background: #05090f !important;
      border: 1px solid #131a28 !important;
      border-radius: 4px !important;
      color: #cbd5e1 !important;
      font-size: 10px !important;
      font-weight: 500 !important;
      padding: 1px 4px !important;
      height: 22px !important;
      width: 140px !important;
      max-width: 140px !important;
      outline: none !important;
      transition: all 0.2s;
      cursor: pointer;
    }
    .param-select:disabled {
      opacity: 0.55 !important;
      cursor: not-allowed !important;
    }
    .param-select:not(:disabled):focus {
      border-color: #eab308 !important;
    }
    .param-select option {
      font-size: 11px !important;
      background: #05090f !important;
      color: #cbd5e1 !important;
    }
    .param-section-divider {
      font-size: 8.5px !important;
      font-weight: 800 !important;
      letter-spacing: 0.6px !important;
      color: #475569 !important;
      text-transform: uppercase !important;
      padding: 4px 0 2px 0 !important;
      border-top: 1px solid rgba(19, 26, 40, 0.6) !important;
      margin-top: 3px !important;
    }
    .autodelete-box {
      background: rgba(0, 0, 0, 0.3) !important;
      border: 1px solid #131a28 !important;
      border-radius: 6px;
      padding: 6px 8px !important;
      margin-top: 6px;
    }
    .autodelete-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
    }
    .autodelete-title {
      display: flex;
      align-items: center;
      gap: 6px;
      font-size: 10px !important;
      font-weight: 600;
      color: #f87171;
    }
    .autodelete-checkbox {
      width: 13px !important;
      height: 13px !important;
      accent-color: #eab308;
      cursor: pointer;
    }
    .autodelete-checkbox:disabled {
      opacity: 0.55;
      cursor: not-allowed;
    }
    .sb-actions-stack {
      display: flex;
      flex-direction: column;
      gap: 6px;
      margin-top: 4px;
    }
    .sb-btn-apply {
      width: 100%;
      background: #eab308;
      color: #000;
      font-weight: 700;
      font-size: 12px;
      border-radius: 6px;
      padding: 9px 14px;
      border: none;
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 8px;
      transition: all 0.25s ease;
    }
    .sb-btn-apply:hover:not(:disabled) {
      background: #ca8a04;
    }
    .sb-btn-apply.is-active-save {
      background: #10b981 !important;
      color: #ffffff !important;
      font-weight: 700 !important;
      cursor: pointer !important;
      box-shadow: 0 4px 14px rgba(16, 185, 129, 0.35) !important;
      border: none !important;
    }
    .sb-btn-apply.is-active-save:hover {
      background: #059669 !important;
    }
    .sb-btn-apply.is-disabled-save {
      background: #1e2638 !important;
      color: #64748b !important;
      cursor: not-allowed !important;
      box-shadow: none !important;
      border: 1px solid rgba(255, 255, 255, 0.05) !important;
    }
    .sb-btn-cancel {
      width: 100%;
      background: #05090f !important;
      border: 1px solid #131a28 !important;
      color: #94a3b8 !important;
      font-weight: 600;
      font-size: 12px;
      border-radius: 6px;
      padding: 8px 14px;
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 8px;
      transition: all 0.2s;
    }
    .sb-btn-cancel:hover {
      background: #0e1524 !important;
      color: #fff !important;
      border-color: #1e293b !important;
    }

    /* FOCUSED LATEST FILE ANIMATION */
    .audio-row.focused-latest-file {
      border: 1px solid #eab308 !important;
      box-shadow: 0 0 16px rgba(234, 179, 8, 0.4) !important;
      animation: focusPulse 2.5s ease;
    }
    @keyframes focusPulse {
      0% { box-shadow: 0 0 28px rgba(234, 179, 8, 0.9); }
      50% { box-shadow: 0 0 10px rgba(234, 179, 8, 0.3); }
      100% { box-shadow: 0 0 16px rgba(234, 179, 8, 0.4); }
    }
    .m-dot.red {
      background: #ef4444;
      box-shadow: 0 0 3px rgba(239, 68, 68, 0.9);
    }
    .m-dot.blue {
      background: #38bdf8;
      box-shadow: 0 0 3px rgba(56, 189, 248, 0.9);
    }
    .m-dot.orange {
      background: #f59e0b;
      box-shadow: 0 0 3px rgba(245, 158, 11, 0.9);
    }
    .m-dot.purple {
      background: #a855f7;
      box-shadow: 0 0 3px rgba(168, 85, 247, 0.9);
    }

    /* 2. TIMELINE HISTOGRAM (Boxes.md Section 2) */
    .timeline-card {
      background: #050811;
      border: 1px solid #131a28;
      border-radius: 8px;
      padding: 16px 20px;
      display: flex;
      flex-direction: column;
      gap: 8px;
    }

    .timeline-date-label {
      font-size: 16px;
      font-weight: 800;
      color: #eab308;
      text-align: center;
      letter-spacing: 0.5px;
    }

    .timeline-hours-row {
      display: flex;
      justify-content: space-between;
      gap: 3px;
      background: rgba(5, 9, 15, 0.4);
      border: 1px solid #131a28;
      border-radius: 6px;
      padding: 3px 4px;
    }

    .th-btn {
      flex: 1;
      height: 28px;
      display: flex;
      align-items: center;
      justify-content: center;
      border-radius: 4px;
      cursor: pointer;
      font-size: 10px;
      font-weight: 700;
      user-select: none;
      position: relative;
      background: rgba(255, 255, 255, 0.02);
      color: #475569;
      border: 1px solid rgba(255, 255, 255, 0.05);
      transition: all 0.15s ease;
    }
    .th-btn:hover {
      transform: scaleY(1.1);
      z-index: 5;
    }
    .th-btn.has-files, .th-btn.online {
      background: rgba(16, 185, 129, 0.1) !important;
      border: 1px solid rgba(16, 185, 129, 0.25) !important;
      color: #34d399 !important;
    }
    .th-btn.offline {
      background: rgba(239, 68, 68, 0.1) !important;
      border: 1px solid rgba(239, 68, 68, 0.25) !important;
      color: #f87171 !important;
    }
    .th-btn.delayed {
      background: rgba(56, 189, 248, 0.1) !important;
      border: 1px solid rgba(56, 189, 248, 0.25) !important;
      color: #38bdf8 !important;
    }
    .th-btn.missing {
      background: rgba(69, 10, 10, 0.6) !important;
      border: 1px solid rgba(127, 29, 29, 0.8) !important;
      color: #ef4444 !important;
    }
    .th-btn.active {
      border: 2px solid #10b981 !important;
      background: rgba(16, 185, 129, 0.25) !important;
      color: #ffffff !important;
      box-shadow: 0 0 12px rgba(16, 185, 129, 0.6) !important;
      z-index: 10 !important;
      font-weight: 800 !important;
    }
    .th-btn.active.delayed, .th-btn.active.delayed-active {
      border: 2px solid #38bdf8 !important;
      background: rgba(56, 189, 248, 0.22) !important;
      box-shadow: 0 0 12px rgba(56, 189, 248, 0.6) !important;
      color: #ffffff !important;
    }
    .th-btn.active.offline {
      border: 2px solid #ef4444 !important;
      background: rgba(239, 68, 68, 0.22) !important;
      box-shadow: 0 0 12px rgba(239, 68, 68, 0.6) !important;
      color: #ffffff !important;
    }
    .th-btn.live-recording {
      animation: hourLivePulse 1.8s infinite ease-in-out !important;
      border-color: #34d399 !important;
    }
    @keyframes hourLivePulse {
      0%, 100% {
        box-shadow: 0 0 0 1px #34d399;
      }
      50% {
        box-shadow: 0 0 8px rgba(52, 211, 153, 0.8), inset 0 0 4px rgba(52, 211, 153, 0.4);
      }
    }

    /* Hourly dots container matching AppScript Boxes.md / Image 2 */
    .th-dots-container {
      position: absolute;
      top: 2px;
      right: 2px;
      display: flex;
      flex-direction: column;
      gap: 2px;
      pointer-events: none;
      z-index: 4;
    }
    .th-dot {
      width: 4px;
      height: 4px;
      border-radius: 50%;
      display: block;
    }
    .th-dot-blue {
      background: #38bdf8;
      box-shadow: 0 0 4px rgba(56, 189, 248, 0.95);
    }
    .th-dot-amber {
      background: #f59e0b;
      box-shadow: 0 0 4px rgba(245, 158, 11, 0.95);
    }
    .th-dot-purple {
      background: #c084fc;
      box-shadow: 0 0 4px rgba(192, 132, 252, 0.95);
    }
    .th-dot-red {
      background: #ef4444;
      box-shadow: 0 0 4px rgba(239, 68, 68, 0.95);
    }

    /* Floating rich tooltip matching Image 2 */
    .th-tooltip {
      position: absolute;
      bottom: calc(100% + 7px);
      left: 50%;
      transform: translateX(-50%);
      background: rgba(10, 13, 18, 0.97);
      backdrop-filter: blur(10px);
      -webkit-backdrop-filter: blur(10px);
      border: 1px solid rgba(255, 255, 255, 0.12);
      border-radius: 6px;
      padding: 6px 10px;
      box-shadow: 0 12px 28px -4px rgba(0, 0, 0, 0.85);
      white-space: nowrap;
      pointer-events: none;
      z-index: 1000;
      opacity: 0;
      visibility: hidden;
      transition: opacity 0.15s ease, transform 0.15s ease;
      display: flex;
      flex-direction: column;
      align-items: center;
      text-align: center;
      min-width: 130px;
    }
    .th-btn:hover .th-tooltip {
      opacity: 1;
      visibility: visible;
    }
    .th-tooltip-arrow {
      position: absolute;
      top: 100%;
      left: 50%;
      transform: translateX(-50%);
      width: 0;
      height: 0;
      border-left: 5px solid transparent;
      border-right: 5px solid transparent;
      border-top: 5px solid rgba(10, 13, 18, 0.97);
    }
    .th-btn[data-h="0"] .th-tooltip, .th-btn[data-h="1"] .th-tooltip {
      left: 0;
      transform: none;
    }
    .th-btn[data-h="0"] .th-tooltip-arrow, .th-btn[data-h="1"] .th-tooltip-arrow {
      left: 12px;
      transform: none;
    }
    .th-btn[data-h="22"] .th-tooltip, .th-btn[data-h="23"] .th-tooltip {
      left: auto;
      right: 0;
      transform: none;
    }
    .th-btn[data-h="22"] .th-tooltip-arrow, .th-btn[data-h="23"] .th-tooltip-arrow {
      left: auto;
      right: 12px;
      transform: none;
    }
    .th-tt-header {
      font-size: 11px;
      font-weight: 700;
      color: #e2e8f0;
      margin-bottom: 2px;
    }
    .th-tt-status {
      font-size: 10px;
      font-weight: 700;
      margin-bottom: 3px;
    }
    .th-tt-badge {
      font-size: 9px;
      font-weight: 600;
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 5px;
      margin-top: 2px;
    }
    .th-tt-amber {
      color: #fbbf24;
    }
    .th-tt-purple {
      color: #c084fc;
    }
    .th-tt-red {
      color: #f87171;
    }
    .th-tt-blue {
      color: #38bdf8;
    }

    .timeline-ruler {
      display: flex;
      justify-content: space-between;
      font-size: 10px;
      color: #475569;
      font-weight: 600;
      padding: 0 4px;
    }

    .vad-tooltip {
      position: fixed;
      display: none;
      background: rgba(10, 13, 18, 0.95);
      backdrop-filter: blur(8px);
      border: 1px solid #1e293b;
      font-size: 10px;
      color: #e2e8f0;
      padding: 4px 8px;
      border-radius: 6px;
      box-shadow: 0 8px 24px rgba(0,0,0,0.8);
      white-space: nowrap;
      z-index: 9999;
      pointer-events: none;
      transition: opacity 0.15s;
    }


    /* 3. FILES & LOGS TOOLBAR */
    .files-toolbar {
      display: flex;
      align-items: center;
      justify-content: space-between;
      flex-wrap: wrap;
      gap: 12px;
      padding: 10px 16px;
      background: #080c14;
      border: 1px solid rgba(255, 255, 255, 0.06);
      border-radius: 12px;
    }

    .ft-left {
      display: flex;
      align-items: center;
      gap: 10px;
      flex-wrap: wrap;
    }
    .ft-title {
      font-size: 13px;
      font-weight: 800;
      color: #fff;
      letter-spacing: 0.5px;
    }
    .ft-updated {
      font-size: 11px;
      color: #64748b;
    }
    .ft-btn-sync {
      background: rgba(255, 255, 255, 0.05);
      border: 1px solid var(--border);
      color: #cbd5e1;
      font-size: 11px;
      font-weight: 600;
      padding: 5px 10px;
      border-radius: 8px;
      cursor: pointer;
      display: flex;
      align-items: center;
      gap: 5px;
      transition: all 0.2s;
    }
    .ft-btn-sync:hover {
      background: rgba(243, 156, 18, 0.15);
      color: var(--accent);
      border-color: var(--accent);
    }
    .ft-pill-speed {
      display: flex;
      align-items: center;
      gap: 6px;
      background: rgba(16, 185, 129, 0.1);
      border: 1px solid rgba(16, 185, 129, 0.25);
      color: #34d399;
      font-size: 11px;
      font-weight: 700;
      padding: 4px 10px;
      border-radius: 20px;
    }
    .ft-select-stt {
      background: #0d131f;
      border: 1px solid #7c3aed;
      color: #c084fc;
      font-size: 11px;
      font-weight: 700;
      padding: 5px 10px;
      border-radius: 8px;
      outline: none;
      cursor: pointer;
    }

    .ft-right {
      display: flex;
      align-items: center;
      gap: 8px;
    }
    .ft-btn-cache {
      background: linear-gradient(135deg, #f39c12, #d97706);
      border: none;
      color: #000;
      font-size: 11px;
      font-weight: 800;
      padding: 7px 14px;
      border-radius: 8px;
      cursor: pointer;
      display: flex;
      align-items: center;
      gap: 6px;
      box-shadow: 0 2px 10px rgba(243, 156, 18, 0.25);
      transition: filter 0.2s;
    }
    .ft-btn-cache:hover {
      filter: brightness(1.15);
    }
    .ft-download-dropdown-wrap {
      position: relative;
    }
    .ft-btn-download {
      background: linear-gradient(135deg, #0284c7, #0369a1);
      border: none;
      color: #fff;
      font-size: 11px;
      font-weight: 800;
      padding: 7px 14px;
      border-radius: 8px;
      cursor: pointer;
      display: flex;
      align-items: center;
      gap: 6px;
    }
    .ft-download-menu {
      position: absolute;
      top: 100%;
      right: 0;
      margin-top: 6px;
      background: #0d131f;
      border: 1px solid #1e293b;
      border-radius: 8px;
      padding: 6px 0;
      min-width: 220px;
      box-shadow: 0 10px 25px rgba(0,0,0,0.5);
      z-index: 50;
    }
    .ft-download-menu a {
      display: block;
      padding: 8px 14px;
      font-size: 12px;
      color: #cbd5e1;
      text-decoration: none;
      transition: background 0.2s;
    }
    .ft-download-menu a:hover {
      background: rgba(243, 156, 18, 0.15);
      color: var(--accent);
    }

    /* 4. AUDIO CHUNKS LIST & CANVAS */
    .audio-chunks-list {
      display: flex;
      flex-direction: column;
      gap: 8px;
      margin-bottom: 90px;
    }

    .chunk-card {
      background: rgba(5, 9, 15, 0.65);
      border: 1px solid #131a28;
      border-radius: 6px;
      padding: 6px 14px;
      display: flex !important;
      flex-direction: row !important;
      align-items: center !important;
      justify-content: space-between !important;
      gap: 12px;
      margin-bottom: 6px;
      min-height: 48px;
      transition: all 0.2s;
    }
    .chunk-card.active-playing {
      border: 1.5px solid #10b981 !important;
      box-shadow: 0 0 14px rgba(16, 185, 129, 0.28) !important;
      background: rgba(6, 78, 59, 0.18) !important;
    }
    .chunk-waveform-wrap {
      flex: 1 !important;
      height: 28px !important;
      margin: 0 16px !important;
      background: transparent !important;
      border: none !important;
      border-radius: 0 !important;
      display: flex !important;
      align-items: center !important;
      position: relative !important;
      overflow: hidden !important;
      cursor: pointer !important;
    }
    .chunk-waveform-wrap img {
      width: 100% !important;
      height: 28px !important;
      object-fit: fill !important;
      display: block !important;
      pointer-events: none !important;
      user-select: none !important;
    }
    .chunk-waveform-canvas {
      width: 100%;
      height: 100%;
      display: block;
    }

    .chunk-actions-row {
      display: flex;
      align-items: center;
      gap: 8px;
    }

    .chunk-btn-stt {
      background: rgba(168, 85, 247, 0.12);
      border: 1px solid rgba(168, 85, 247, 0.3);
      color: #c084fc;
      font-size: 11px;
      font-weight: 600;
      padding: 6px 10px;
      border-radius: 8px;
      cursor: pointer;
      display: flex;
      align-items: center;
      gap: 5px;
      transition: all 0.2s;
    }
    .chunk-btn-stt:hover {
      background: rgba(168, 85, 247, 0.22);
    }

    .chunk-btn-play {
      width: 32px;
      height: 32px;
      border-radius: 50%;
      display: flex;
      align-items: center;
      justify-content: center;
      border: none;
      cursor: pointer;
      font-size: 13px;
      flex-shrink: 0;
      transition: transform 0.15s ease;
    }
    .chunk-btn-play:hover {
      transform: scale(1.1);
    }
    .chunk-btn-play.gold {
      background: var(--accent);
      color: #000;
    }
    .chunk-btn-play.green {
      background: #10b981;
      color: #000;
    }

    .chunk-stt-drawer {
      background: rgba(6, 10, 18, 0.85);
      border: 1px dashed rgba(168, 85, 247, 0.3);
      border-radius: 8px;
      padding: 10px 14px;
      margin-top: 4px;
      display: flex;
      flex-direction: column;
      gap: 8px;
      font-size: 12px;
    }
    .stt-text-content {
      color: #e2e8f0;
      line-height: 1.5;
      font-style: italic;
    }
    .stt-drawer-actions {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 8px;
    }

    /* 5. STICKY BOTTOM AUDIO PLAYER */
    .sticky-player-bar {
      position: fixed;
      bottom: 0;
      left: 310px;
      right: 0;
      height: 64px;
      background: rgba(7, 10, 17, 0.95);
      backdrop-filter: blur(16px);
      border-top: 1px solid rgba(255, 255, 255, 0.1);
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 0 24px;
      z-index: 60;
      box-sizing: border-box;
      transition: left 0.25s ease;
    }
    .device-mobile .sticky-player-bar,
    .app-sidebar.sidebar-collapsed + .workspace-area ~ .sticky-player-bar {
      left: 0 !important;
    }

    .sp-track-info {
      display: flex;
      flex-direction: column;
      min-width: 200px;
    }
    .sp-track-title {
      font-size: 13px;
      font-weight: 700;
      color: #fff;
    }
    .sp-track-sub {
      font-size: 11px;
      color: #64748b;
    }

    .sp-controls-center {
      display: flex;
      align-items: center;
      gap: 16px;
      flex: 1;
      max-width: 650px;
      margin: 0 20px;
    }
    .sp-btn-play {
      width: 38px;
      height: 38px;
      border-radius: 50%;
      background: var(--accent);
      border: none;
      color: #000;
      font-size: 15px;
      display: flex;
      align-items: center;
      justify-content: center;
      cursor: pointer;
      box-shadow: 0 0 15px rgba(243, 156, 18, 0.3);
      flex-shrink: 0;
      transition: transform 0.15s ease;
    }
    .sp-btn-play:hover {
      transform: scale(1.08);
    }

    .sp-time-row {
      display: flex;
      align-items: center;
      gap: 10px;
      flex: 1;
    }
    .sp-time {
      font-size: 11px;
      font-weight: 600;
      color: #94a3b8;
      font-family: monospace;
    }
    .sp-progress-bar-wrap {
      flex: 1;
      height: 6px;
      background: #1e293b;
      border-radius: 3px;
      position: relative;
      cursor: pointer;
    }
    .sp-progress-fill {
      height: 100%;
      background: var(--accent);
      border-radius: 3px;
      position: absolute;
      top: 0;
      left: 0;
    }
    .sp-progress-thumb {
      position: absolute;
      top: 50%;
      transform: translate(-50%, -50%);
      width: 12px;
      height: 12px;
      border-radius: 50%;
      background: #fff;
      border: 2px solid var(--accent);
      pointer-events: none;
    }

    .sp-actions-right {
      display: flex;
      align-items: center;
      gap: 10px;
    }
    .sp-btn-speed {
      background: rgba(255, 255, 255, 0.05);
      border: 1px solid var(--border);
      color: #cbd5e1;
      font-size: 12px;
      font-weight: 700;
      padding: 5px 8px;
      border-radius: 6px;
      cursor: pointer;
    }
    .sp-btn-speed:hover {
      border-color: var(--accent);
      color: var(--accent);
    }
    .sp-btn-action {
      background: none;
      border: none;
      color: #94a3b8;
      font-size: 15px;
      cursor: pointer;
      padding: 6px;
      transition: color 0.2s;
    }
    .sp-btn-action:hover {
      color: #fff;
    }

    /* --- MOBILE BOTTOM NAVIGATION BAR --- */
    .mobile-bottom-nav {
      display: none;
      position: fixed;
      bottom: 0;
      left: 0;
      right: 0;
      height: calc(var(--nav-height) + var(--safe-bottom));
      padding-bottom: var(--safe-bottom);
      background: rgba(6, 10, 18, 0.96);
      backdrop-filter: blur(20px);
      border-top: 1px solid var(--border);
      z-index: 100;
      align-items: center;
      justify-content: space-around;
      box-sizing: border-box;
      width: 100vw;
      max-width: 100vw;
    }

    .nav-tab-btn {
      flex: 1;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      gap: 3px;
      color: #64748b;
      background: none;
      border: none;
      font-size: 11px;
      font-weight: 600;
      cursor: pointer;
      padding: 6px 0;
      transition: all 0.2s;
    }

    .nav-tab-btn i {
      font-size: 18px;
    }

    .nav-tab-btn.active {
      color: var(--accent);
    }

    /* --- MOBILE PROFILE MODAL / DRAWER --- */
    #mobile-profile-modal .modal-box {
      max-width: 380px;
    }

    /* --- USERS MODAL (Apps Script Style 3-Column on PC, Responsive Tabs on Mobile) --- */
    .modal-overlay {
      position: fixed;
      inset: 0;
      background: rgba(0, 0, 0, 0.88);
      backdrop-filter: blur(12px);
      display: none;
      align-items: center;
      justify-content: center;
      z-index: 200;
      padding: 16px;
      box-sizing: border-box;
      width: 100vw;
      max-width: 100vw;
      overflow: hidden;
    }

    .users-modal-box {
      background: #05090f;
      border: 1px solid var(--border);
      border-radius: 16px;
      width: 100%;
      max-width: 1100px;
      height: 82vh;
      display: flex;
      flex-direction: column;
      box-shadow: 0 25px 60px rgba(0, 0, 0, 0.85);
      overflow: hidden;
      position: relative;
    }

    .users-modal-header {
      padding: 14px 18px;
      border-bottom: 1px solid var(--border);
      display: flex;
      align-items: center;
      justify-content: space-between;
      background: rgba(10, 14, 24, 0.6);
      flex-wrap: wrap;
      gap: 8px;
    }

    .users-modal-header-left {
      display: flex;
      flex-direction: column;
      gap: 2px;
    }

    .users-modal-header-title {
      font-size: 15px;
      font-weight: 700;
      color: #fff;
      display: flex;
      align-items: center;
      gap: 8px;
      text-transform: uppercase;
      letter-spacing: 0.5px;
    }

    .users-modal-header-actions {
      display: flex;
      align-items: center;
      gap: 8px;
    }

    .btn-action-emerald {
      font-size: 11px;
      font-weight: 700;
      color: #34d399;
      background: rgba(16, 185, 129, 0.1);
      border: 1px solid rgba(16, 185, 129, 0.3);
      padding: 6px 12px;
      border-radius: 8px;
      cursor: pointer;
      display: flex;
      align-items: center;
      gap: 6px;
      transition: all 0.2s;
    }

    .btn-action-emerald:hover {
      background: rgba(16, 185, 129, 0.2);
    }

    .btn-action-blue {
      font-size: 11px;
      font-weight: 700;
      color: #60a5fa;
      background: rgba(59, 130, 246, 0.1);
      border: 1px solid rgba(59, 130, 246, 0.3);
      padding: 6px 12px;
      border-radius: 8px;
      cursor: pointer;
      display: flex;
      align-items: center;
      gap: 6px;
      transition: all 0.2s;
    }

    .btn-action-blue:hover {
      background: rgba(59, 130, 246, 0.2);
    }

    .btn-action-red {
      font-size: 11px;
      font-weight: 700;
      color: #f87171;
      background: rgba(239, 68, 68, 0.1);
      border: 1px solid rgba(239, 68, 68, 0.3);
      padding: 6px 12px;
      border-radius: 8px;
      cursor: pointer;
      display: flex;
      align-items: center;
      gap: 6px;
      transition: all 0.2s;
    }
    .btn-action-red:hover {
      background: rgba(239, 68, 68, 0.2);
    }

    /* --- TRANSCRIPT MODAL (Matching C:\Users\Vital\Desktop\NanoPiDuo2) --- */
    .transcript-modal-box {
      background: #05090f;
      border: 1px solid var(--border);
      border-radius: 14px;
      width: 95vw;
      max-width: 1200px;
      height: 90vh;
      display: flex;
      flex-direction: column;
      box-shadow: 0 25px 65px rgba(0, 0, 0, 0.95);
      position: relative;
      overflow: hidden;
    }

    .transcript-modal-header {
      padding: 16px 20px;
      border-bottom: 1px solid var(--border);
      display: flex;
      justify-content: space-between;
      align-items: flex-start;
      gap: 12px;
      background: rgba(10, 14, 24, 0.6);
      flex-wrap: wrap;
    }

    .transcript-modal-title {
      font-size: 14px;
      font-weight: 700;
      color: #fff;
      text-transform: uppercase;
      letter-spacing: 0.5px;
      display: flex;
      align-items: center;
      gap: 8px;
    }

    .transcript-modal-sub {
      display: flex;
      flex-wrap: wrap;
      align-items: center;
      gap: 8px;
      margin-top: 4px;
      font-size: 11px;
      color: #94a3b8;
    }

    .model-badge {
      font-size: 9px;
      background: rgba(59, 130, 246, 0.15);
      color: #60a5fa;
      border: 1px solid rgba(59, 130, 246, 0.3);
      padding: 2px 6px;
      border-radius: 4px;
      font-family: monospace;
    }

    .transcript-modal-header-actions {
      display: flex;
      align-items: center;
      gap: 8px;
      margin-right: 36px;
      user-select: none;
    }

    .transcript-modal-body {
      flex: 1;
      overflow-y: auto;
      padding: 20px;
      display: flex;
      flex-direction: column;
      gap: 8px;
      font-size: 13.5px;
      color: #e2e8f0;
      line-height: 1.6;
      user-select: text;
    }

    .transcript-row {
      display: flex;
      gap: 12px;
      align-items: flex-start;
      padding: 8px 12px;
      border-radius: 8px;
      cursor: pointer;
      transition: all 0.15s ease;
      border-left: 3px solid transparent;
    }

    .transcript-row:hover {
      background: rgba(255, 255, 255, 0.05);
      border-left-color: #10b981;
    }

    .transcript-row.active {
      background: rgba(16, 185, 129, 0.12);
      border-left-color: #34d399;
    }

    .transcript-time-badge {
      font-family: monospace;
      font-size: 11px;
      font-weight: 700;
      color: #34d399;
      padding: 2px 6px;
      background: rgba(6, 78, 59, 0.4);
      border: 1px solid rgba(16, 185, 129, 0.3);
      border-radius: 4px;
      flex-shrink: 0;
      user-select: none;
      transition: all 0.15s;
    }

    .transcript-row:hover .transcript-time-badge {
      background: #10b981;
      color: #000;
    }

    .transcript-modal-footer {
      padding: 14px 20px;
      border-top: 1px solid var(--border);
      background: rgba(0, 0, 0, 0.55);
      display: flex;
      flex-direction: column;
      gap: 10px;
    }

    .transcript-wave-container {
      background: #0a0d12;
      border: 1px solid var(--border);
      border-radius: 6px;
      overflow: hidden;
      height: 50px;
      position: relative;
      cursor: pointer;
    }

    .transcript-player-controls {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
    }

    .transcript-player-info {
      width: 33%;
      min-width: 0;
    }

    .transcript-track-title {
      font-size: 12px;
      font-weight: 600;
      color: #fff;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }

    .transcript-track-time {
      font-size: 11px;
      color: #64748b;
      margin-top: 2px;
    }

    .transcript-player-buttons {
      display: flex;
      align-items: center;
      gap: 14px;
    }

    .tp-btn-nav {
      background: none;
      border: none;
      color: #94a3b8;
      cursor: pointer;
      font-size: 14px;
      transition: color 0.15s;
    }

    .tp-btn-nav:hover {
      color: #fff;
    }

    .tp-btn-play {
      width: 36px;
      height: 36px;
      border-radius: 50%;
      background: #10b981;
      color: #000;
      display: flex;
      align-items: center;
      justify-content: center;
      border: none;
      cursor: pointer;
      font-size: 14px;
      transition: transform 0.15s;
    }

    .tp-btn-play:hover {
      transform: scale(1.06);
    }

    .transcript-player-extra {
      width: 33%;
      display: flex;
      justify-content: flex-end;
    }

    .tp-btn-speed {
      font-size: 11px;
      font-weight: 600;
      color: #cbd5e1;
      background: #1e293b;
      border: 1px solid #334155;
      padding: 4px 8px;
      border-radius: 6px;
      cursor: pointer;
      transition: background 0.15s;
    }

    .tp-btn-speed:hover {
      background: #334155;
    }

    /* Action button in the chunk row */
    .chunk-btn-icon {
      width: 32px;
      height: 32px;
      border-radius: 6px;
      background: transparent;
      border: 1px solid transparent;
      display: flex;
      align-items: center;
      justify-content: center;
      cursor: pointer;
      font-size: 14px;
      transition: all 0.2s;
    }

    .chunk-btn-icon:hover {
      background: rgba(255, 255, 255, 0.08);
    }

    .chunk-btn-icon.has-transcript {
      color: #34d399;
    }

    .chunk-btn-icon.has-transcript:hover {
      color: #6ee7b7;
      border-color: rgba(52, 211, 153, 0.3);
    }

    .chunk-btn-icon.no-transcript {
      color: #64748b;
    }

    .chunk-btn-icon.no-transcript:hover {
      color: #cbd5e1;
      border-color: rgba(148, 163, 184, 0.2);
    }

    /* Mobile modal nav tabs */
    .mobile-modal-tabs {
      display: none;
      background: rgba(0, 0, 0, 0.4);
      border-bottom: 1px solid var(--border);
      padding: 4px;
      gap: 4px;
    }

    .modal-tab-pill {
      flex: 1;
      padding: 8px;
      font-size: 12px;
      font-weight: 600;
      border-radius: 8px;
      border: none;
      background: transparent;
      color: #94a3b8;
      cursor: pointer;
      text-align: center;
      transition: all 0.2s;
    }

    .modal-tab-pill.active {
      background: rgba(243, 156, 18, 0.15);
      color: var(--accent);
      border: 1px solid rgba(243, 156, 18, 0.3);
    }

    /* 3 Columns Body */
    .users-modal-body {
      flex: 1;
      display: flex;
      overflow: hidden;
    }

    /* Column 1: Accounts List */
    .col-accounts {
      width: 280px;
      border-right: 1px solid var(--border);
      display: flex;
      flex-direction: column;
      background: rgba(0, 0, 0, 0.2);
    }

    .col-header {
      padding: 12px 16px;
      border-bottom: 1px solid var(--border);
      font-size: 11px;
      font-weight: 700;
      text-transform: uppercase;
      letter-spacing: 0.8px;
      color: var(--text-muted);
    }

    .accounts-list {
      flex: 1;
      overflow-y: auto;
      padding: 10px;
      display: flex;
      flex-direction: column;
      gap: 6px;
    }

    .account-item {
      display: flex;
      align-items: center;
      gap: 12px;
      padding: 10px 12px;
      border-radius: 10px;
      border: 1px solid transparent;
      cursor: pointer;
      transition: all 0.2s;
    }

    .account-item:hover {
      background: rgba(255, 255, 255, 0.04);
    }

    .account-item.active {
      background: rgba(243, 156, 18, 0.12);
      border-color: rgba(243, 156, 18, 0.4);
    }

    .account-avatar {
      width: 34px;
      height: 34px;
      border-radius: 50%;
      background: rgba(255, 255, 255, 0.08);
      border: 1px solid var(--border);
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 13px;
      font-weight: 700;
      color: #fff;
    }

    .account-item.active .account-avatar {
      background: var(--accent);
      color: #000;
      border-color: var(--accent);
    }

    /* Column 2: Selected User Detail */
    .col-detail {
      flex: 1;
      border-right: 1px solid var(--border);
      display: flex;
      flex-direction: column;
      overflow-y: auto;
      padding: 24px;
      gap: 20px;
    }

    .detail-empty {
      flex: 1;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      color: var(--text-muted);
      gap: 12px;
      font-size: 13px;
    }

    .detail-user-card {
      display: flex;
      align-items: center;
      gap: 14px;
    }

    .detail-avatar-large {
      width: 48px;
      height: 48px;
      border-radius: 50%;
      background: rgba(59, 130, 246, 0.2);
      border: 1px solid rgba(59, 130, 246, 0.4);
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 18px;
      font-weight: 700;
      color: #60a5fa;
    }

    .detail-section-box {
      background: rgba(0, 0, 0, 0.35);
      border: 1px solid var(--border);
      border-radius: 12px;
      padding: 16px;
      display: flex;
      flex-direction: column;
      gap: 12px;
    }

    .section-box-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
    }

    .section-box-title {
      font-size: 11px;
      font-weight: 700;
      text-transform: uppercase;
      letter-spacing: 0.6px;
      color: #cbd5e1;
      display: flex;
      align-items: center;
      gap: 6px;
    }

    .password-display-row {
      display: flex;
      align-items: center;
      gap: 8px;
    }

    .password-input-view {
      flex: 1;
      background: #030508;
      border: 1px solid var(--border);
      border-radius: 8px;
      padding: 9px 12px;
      font-family: monospace;
      color: #e2e8f0;
      font-size: 13px;
      letter-spacing: 1px;
    }

    .btn-icon-square {
      width: 36px;
      height: 36px;
      background: rgba(255, 255, 255, 0.05);
      border: 1px solid var(--border);
      border-radius: 8px;
      color: #cbd5e1;
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: center;
      transition: all 0.2s;
    }

    .btn-icon-square:hover {
      background: rgba(255, 255, 255, 0.1);
      color: #fff;
    }

    .device-chips-container {
      display: flex;
      flex-wrap: wrap;
      gap: 8px;
      min-height: 48px;
    }

    .device-chip {
      background: rgba(255, 255, 255, 0.05);
      border: 1px solid var(--border);
      border-radius: 20px;
      padding: 4px 10px;
      font-size: 12px;
      display: flex;
      align-items: center;
      gap: 8px;
      color: #cbd5e1;
    }

    .device-chip-del {
      color: #ef4444;
      cursor: pointer;
      transition: transform 0.2s;
    }

    .device-chip-del:hover {
      transform: scale(1.2);
    }

    .add-device-row {
      display: flex;
      gap: 8px;
      padding-top: 10px;
      border-top: 1px solid rgba(255, 255, 255, 0.06);
    }

    /* Column 3: Create User */
    .col-create {
      width: 320px;
      display: flex;
      flex-direction: column;
      overflow-y: auto;
      background: rgba(0, 0, 0, 0.2);
    }

    .create-user-form {
      padding: 16px;
      display: flex;
      flex-direction: column;
      gap: 14px;
    }

    /* --- "НЕМАЄ ДОСТУПУ" (ACCESS DENIED) MODAL --- */
    .access-denied-box {
      background: #090d16;
      border: 1px solid rgba(239, 68, 68, 0.4);
      border-radius: 20px;
      max-width: 400px;
      width: 100%;
      padding: 28px 24px;
      text-align: center;
      box-shadow: 0 25px 60px rgba(0, 0, 0, 0.9), 0 0 35px rgba(239, 68, 68, 0.15);
      animation: fadeIn 0.25s ease-out;
      box-sizing: border-box;
    }

    .access-denied-icon {
      width: 58px;
      height: 58px;
      background: rgba(239, 68, 68, 0.12);
      border: 1px solid rgba(239, 68, 68, 0.3);
      color: #ef4444;
      border-radius: 50%;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 26px;
      margin: 0 auto 16px auto;
    }

    .access-denied-title {
      font-size: 19px;
      font-weight: 700;
      color: #fff;
      margin-bottom: 8px;
    }

    .access-denied-desc {
      font-size: 13px;
      color: var(--text-muted);
      line-height: 1.5;
      margin-bottom: 20px;
    }

    .access-denied-badge {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      background: rgba(255, 255, 255, 0.05);
      border: 1px solid var(--border);
      padding: 4px 12px;
      border-radius: 20px;
      font-size: 11px;
      color: #cbd5e1;
      margin-bottom: 18px;
    }

    .btn-secondary {
      background: rgba(255, 255, 255, 0.08);
      border: 1px solid var(--border);
      color: #fff;
      font-weight: 600;
      padding: 11px 18px;
      border-radius: 12px;
      cursor: pointer;
      width: 100%;
      transition: all 0.2s;
    }

    .btn-secondary:hover {
      background: rgba(255, 255, 255, 0.14);
    }

    /* --- RESPONSIVE / MOBILE STYLES --- */
    @media (max-width: 768px) {
      body {
        --header-height: 52px;
        --nav-height: 56px;
      }

      .app-header {
        padding: 8px 12px !important;
        height: 52px !important;
        width: 100% !important;
        max-width: 100vw !important;
        box-sizing: border-box !important;
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
        gap: 8px !important;
      }

      .header-left {
        gap: 8px !important;
        flex-shrink: 0 !important;
        min-width: max-content !important;
      }

      .brand-icon {
        width: 30px !important;
        height: 30px !important;
        font-size: 14px !important;
        border-radius: 8px !important;
      }

      .brand-title {
        font-size: 15px !important;
        font-weight: 700 !important;
        white-space: nowrap !important;
      }

      .brand-badge {
        display: none !important;
      }

      .header-actions {
        gap: 6px !important;
        align-items: center !important;
        flex-shrink: 0 !important;
      }

      /* Desktop users button is STRICTLY HIDDEN in mobile header */
      #btn-open-users-desktop {
        display: none !important;
      }

      /* Compact user pill on phone */
      .user-pill {
        padding: 4px 8px !important;
        gap: 4px !important;
        font-size: 11px !important;
        max-width: 110px !important;
      }

      .user-pill #current-user-name {
        max-width: 50px !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        white-space: nowrap !important;
        font-weight: 600 !important;
      }

      .user-role-badge {
        font-size: 8px !important;
        padding: 2px 4px !important;
        border-radius: 6px !important;
      }

      .btn-icon-header {
        width: 32px !important;
        height: 32px !important;
        font-size: 13px !important;
        border-radius: 8px !important;
      }

      .mode-badge-indicator {
        width: 30px !important;
        height: 30px !important;
        font-size: 12px !important;
        border-radius: 8px !important;
      }

      /* Mobile: Hide Sidebar, breadcrumbs and hamburger toggle completely */
      .app-sidebar,
      #btn-toggle-sidebar,
      .sidebar-backdrop,
      .workspace-breadcrumbs {
        display: none !important;
      }

      /* Show bottom navigation bar */
      .mobile-bottom-nav {
        display: flex !important;
      }

      /* Main container padding compensation for bottom navigation */
      .main-container {
        padding: 14px 12px calc(var(--nav-height) + var(--safe-bottom) + 20px) 12px !important;
        width: 100% !important;
        max-width: 100vw !important;
        box-sizing: border-box !important;
      }

      .section-header {
        margin-bottom: 12px !important;
        gap: 8px !important;
      }

      .section-title {
        font-size: 17px !important;
      }

      .stats-pill {
        font-size: 11px !important;
        padding: 3px 9px !important;
      }

      /* 1-column device cards */
      .card-grid {
        grid-template-columns: 1fr !important;
        gap: 12px !important;
      }

      .device-card {
        padding: 16px !important;
        min-height: 155px !important;
      }

      /* Mobile 3-column modal transforms into tabs */
      .users-modal-box {
        height: 94vh !important;
        max-width: 100% !important;
        border-radius: 16px 16px 0 0 !important;
        margin-top: auto !important;
      }

      .mobile-modal-tabs {
        display: flex !important;
      }

      .users-modal-body {
        flex-direction: column !important;
      }

      .col-accounts,
      .col-detail,
      .col-create {
        width: 100% !important;
        border-right: none !important;
        flex: 1 !important;
        display: none;
      }

      .col-accounts.tab-active,
      .col-detail.tab-active,
      .col-create.tab-active {
        display: flex !important;
      }

      .col-header {
        display: none !important;
      }

      .users-modal-header {
        padding: 12px 14px !important;
      }
    }

    /* Force Mobile Rules via class */
    .device-mobile .app-header {
      padding: 8px 12px !important;
      height: 52px !important;
      gap: 8px !important;
    }
    .device-mobile .header-left {
      gap: 8px !important;
      flex-shrink: 0 !important;
      min-width: max-content !important;
    }
    .device-mobile .brand-icon {
      width: 30px !important;
      height: 30px !important;
      font-size: 14px !important;
      border-radius: 8px !important;
    }
    .device-mobile .brand-title {
      font-size: 15px !important;
      font-weight: 700 !important;
      white-space: nowrap !important;
    }
    .device-mobile .brand-badge {
      display: none !important;
    }
    .device-mobile .header-actions {
      gap: 6px !important;
      flex-shrink: 0 !important;
    }
    .device-mobile #btn-open-users-desktop {
      display: none !important;
    }
    .device-mobile .user-pill {
      padding: 4px 8px !important;
      gap: 4px !important;
      font-size: 11px !important;
      max-width: 110px !important;
    }
    .device-mobile .user-pill #current-user-name {
      max-width: 50px !important;
      overflow: hidden !important;
      text-overflow: ellipsis !important;
      white-space: nowrap !important;
      font-weight: 600 !important;
    }
    .device-mobile .user-role-badge {
      font-size: 8px !important;
      padding: 2px 4px !important;
      border-radius: 6px !important;
    }
    .device-mobile .btn-icon-header {
      width: 32px !important;
      height: 32px !important;
      font-size: 13px !important;
      border-radius: 8px !important;
    }
    .device-mobile .mode-badge-indicator {
      width: 30px !important;
      height: 30px !important;
      font-size: 12px !important;
      border-radius: 8px !important;
    }
    .device-mobile .mobile-bottom-nav {
      display: flex !important;
    }
    .device-mobile .main-container {
      padding: 14px 12px calc(var(--nav-height) + var(--safe-bottom) + 20px) 12px !important;
    }
    .device-mobile .card-grid {
      grid-template-columns: 1fr !important;
    }
    .device-mobile .mobile-modal-tabs {
      display: flex !important;
    }
    .device-mobile .users-modal-body {
      flex-direction: column !important;
    }
    .device-mobile .col-accounts,
    .device-mobile .col-detail,
    .device-mobile .col-create {
      width: 100% !important;
      border-right: none !important;
      display: none;
    }
    .device-mobile .col-accounts.tab-active,
    .device-mobile .col-detail.tab-active,
    .device-mobile .col-create.tab-active {
      display: flex !important;
    }
    .device-mobile .col-header {
      display: none !important;
    }
    /* Mobile: Sidebar completely hidden, only quick board statuses on main page */
    .device-mobile .app-sidebar,
    .device-mobile #btn-toggle-sidebar,
    .device-mobile .sidebar-backdrop,
    .device-mobile .workspace-breadcrumbs {
      display: none !important;
    }

    /* Desktop Collapsible Sidebar */
    .app-sidebar.sidebar-collapsed {
      margin-left: -310px;
    }

    /* Force Desktop Rules when user chose Desktop View on Mobile */
    .device-desktop .mobile-bottom-nav {
      display: none !important;
    }

    @keyframes fadeIn {
      from {
        opacity: 0;
        transform: scale(0.96);
      }
      to {
        opacity: 1;
        transform: scale(1);
      }
    }

    @keyframes pulse {
      0%, 100% {
        opacity: 1;
      }
      50% {
        opacity: 0.4;
      }
    }
  
    /* --- STRICT REFERENCE LAYOUT & SCROLLING FIX --- */
    html, body {
      background-color: #000000 !important;
      color: #f1f5f9 !important;
      height: 100vh !important;
      width: 100vw !important;
      margin: 0 !important;
      padding: 0 !important;
      overflow: hidden !important;
      -webkit-user-select: none !important;
      user-select: none !important;
    }

    #main-app {
      display: flex;
      width: 100vw !important;
      height: 100vh !important;
      overflow: hidden !important;
      position: relative !important;
      background: #000000 !important;
    }

    .app-header {
      display: none !important;
    }

    .app-body {
      display: flex !important;
      width: 100% !important;
      height: 100vh !important;
      overflow: hidden !important;
      position: relative !important;
      min-height: 100vh !important;
    }

    .app-sidebar {
      width: 285px !important;
      min-width: 285px !important;
      max-width: 285px !important;
      background: #000000 !important;
      border-right: 1px solid #131a28 !important;
      display: flex !important;
      flex-direction: column !important;
      height: 100vh !important;
      overflow-y: auto !important;
      overflow-x: hidden !important;
      z-index: 40 !important;
      box-sizing: border-box !important;
      padding: 18px 16px !important;
      gap: 12px !important;
      flex-shrink: 0 !important;
      margin-left: 0 !important;
      transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    }

    .app-sidebar.sidebar-collapsed {
      margin-left: -285px !important;
    }

    .workspace-area {
      flex: 1 !important;
      height: 100vh !important;
      display: flex !important;
      flex-direction: column !important;
      min-width: 0 !important;
      width: 100% !important;
      background: #000000 !important;
      overflow: hidden !important;
      position: relative !important;
    }

    .workspace-breadcrumbs {
      height: 56px !important;
      min-height: 56px !important;
      border-bottom: 1px solid #131a28 !important;
      background: #000000 !important;
      display: flex !important;
      align-items: center !important;
      justify-content: space-between !important;
      padding: 0 20px !important;
      gap: 12px !important;
      flex-shrink: 0 !important;
      z-index: 10 !important;
    }

    .main-container {
      flex: 1 !important;
      height: calc(100vh - 56px) !important;
      overflow-y: auto !important;
      overflow-x: hidden !important;
      padding: 20px 24px !important;
      padding-bottom: 180px !important; /* CRITICAL: ensures all files can be scrolled completely above bottom player bar */
      box-sizing: border-box !important;
      width: 100% !important;
      max-width: 100% !important;
      margin: 0 !important;
    }

    .main-container::-webkit-scrollbar {
      width: 6px;
    }
    .main-container::-webkit-scrollbar-track {
      background: transparent;
    }
    .main-container::-webkit-scrollbar-thumb {
      background: #131a28;
      border-radius: 3px;
    }
    .main-container::-webkit-scrollbar-thumb:hover {
      background: #1e293b;
    }

    .sticky-player-bar {
      position: fixed !important;
      bottom: 0 !important;
      left: 285px !important;
      right: 0 !important;
      height: 60px !important;
      background: rgba(0, 0, 0, 0.95) !important;
      backdrop-filter: blur(16px) !important;
      border-top: 1px solid #131a28 !important;
      display: flex !important;
      align-items: center !important;
      justify-content: space-between !important;
      padding: 0 24px !important;
      z-index: 60 !important;
      box-sizing: border-box !important;
      transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    }
    .app-sidebar.sidebar-collapsed ~ .sticky-player-bar,
    .app-sidebar.sidebar-collapsed + .workspace-area ~ .sticky-player-bar {
      left: 0 !important;
    }

