/* Modals Glassmorphism */
    .modal-overlay.active {
      display: flex !important;
    }

    .modal-overlay {
      position: fixed;
      inset: 0;
      background: rgba(0, 0, 0, 0.8);
      backdrop-filter: blur(10px);
      display: none;
      align-items: center;
      justify-content: center;
      z-index: 1500;
    }

    .modal-dialog {
      background: var(--bg-card);
      border: 1px solid var(--border-color);
      border-radius: var(--radius-lg);
      padding: 2rem;
      width: 100%;
      max-width: 680px;
      max-height: 90vh;
      overflow-y: auto;
      box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.85);
    }

    .modal-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      border-bottom: 1px solid var(--border-color);
      padding-bottom: 1rem;
      margin-bottom: 1.25rem;
    }

    .modal-header h3 {
      font-size: 1.2rem;
      font-weight: 700;
      display: flex;
      align-items: center;
      gap: 0.5rem;
    }

    .modal-close-btn {
      background: transparent;
      border: none;
      color: var(--text-muted);
      font-size: 1.3rem;
      cursor: pointer;
      line-height: 1;
      padding: 0.2rem;
    }

    .modal-close-btn:hover { color: #fff; }

    .form-group {
      margin-bottom: 1.15rem;
    }

    .form-group label {
      display: block;
      font-size: 0.8rem;
      font-weight: 600;
      color: var(--text-muted);
      margin-bottom: 0.4rem;
    }

    .form-control {
      width: 100%;
      background: var(--bg-primary);
      border: 1px solid var(--border-color);
      border-radius: var(--radius-md);
      padding: 0.65rem 0.85rem;
      color: var(--text-main);
      font-family: inherit;
      font-size: 0.85rem;
      outline: none;
      transition: border-color 0.2s;
    }

    .form-control:focus {
      border-color: var(--border-focus);
      box-shadow: 0 0 10px var(--primary-glow);
    }

    /* Toast */
    #toast-container {
      position: fixed;
      bottom: 2rem;
      right: 2rem;
      z-index: 3000;
      display: flex;
      flex-direction: column;
      gap: 0.75rem;
      pointer-events: none;
    }

    .toast-msg {
      pointer-events: auto;
      background: #1e293b;
      border: 1px solid rgba(99, 102, 241, 0.4);
      color: #f8fafc;
      padding: 0.8rem 1.25rem;
      border-radius: 8px;
      box-shadow: 0 10px 25px -5px rgba(0,0,0,0.6);
      display: flex;
      align-items: center;
      gap: 0.6rem;
      font-size: 0.88rem;
      animation: toastSlideIn 0.25s ease-out;
      transition: opacity 0.3s;
    }

    .toast-msg.success { border-color: #10b981; background: #064e3b; color: #ecfdf5; }
    .toast-msg.error { border-color: #ef4444; background: #7f1d1d; color: #fef2f2; }

    @keyframes toastSlideIn {
      from { transform: translateX(50px); opacity: 0; }
      to { transform: translateX(0); opacity: 1; }
    }
  
    /* --- CUSTOM SELECTO COMPONENT (STUDIO) --- */
    .custom-selecto-wrapper {
      position: relative;
      min-width: 250px;
      user-select: none;
    }

    #company-selecto-trigger {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 0.65rem;
      width: 100%;
      height: 38px;
      background: rgba(15, 23, 42, 0.85);
      border: 1px solid var(--border-color);
      border-radius: var(--radius-md);
      padding: 0.45rem 0.85rem;
      color: #f8fafc;
      font-size: 0.82rem;
      font-weight: 600;
      cursor: pointer;
      transition: all 0.2s ease;
      box-shadow: 0 2px 8px rgba(0,0,0,0.25);
    }

    #company-selecto-trigger:hover, #company-selecto-trigger.active {
      border-color: #38bdf8;
      background: rgba(30, 41, 59, 0.95);
      box-shadow: 0 0 14px rgba(56, 189, 248, 0.3);
    }

    #company-selecto-dropdown {
      display: none;
      position: absolute;
      top: calc(100% + 6px);
      left: 0;
      min-width: 280px;
      width: 100%;
      background: #0b1120;
      border: 1px solid rgba(56, 189, 248, 0.4);
      border-radius: var(--radius-md);
      box-shadow: 0 20px 40px rgba(0,0,0,0.8), 0 0 0 1px rgba(255,255,255,0.06);
      z-index: 1200;
      overflow: hidden;
      backdrop-filter: blur(16px);
      animation: selectoFadeIn 0.15s ease-out;
    }

    @keyframes selectoFadeIn {
      from { opacity: 0; transform: translateY(-4px); }
      to { opacity: 1; transform: translateY(0); }
    }

    .selecto-search-box {
      padding: 0.55rem;
      border-bottom: 1px solid rgba(255,255,255,0.08);
      background: rgba(255,255,255,0.02);
    }

    .selecto-search-inner {
      display: flex;
      align-items: center;
      gap: 0.45rem;
      background: rgba(0,0,0,0.5);
      border: 1px solid rgba(255,255,255,0.12);
      border-radius: 6px;
      padding: 0.35rem 0.65rem;
      transition: border-color 0.2s;
    }

    .selecto-search-inner:focus-within {
      border-color: #38bdf8;
      box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.25);
    }

    #company-selecto-search {
      width: 100%;
      background: transparent;
      border: none;
      outline: none;
      color: #f8fafc;
      font-size: 0.8rem;
      font-family: inherit;
    }

    #company-selecto-options-list {
      max-height: 240px;
      overflow-y: auto;
      padding: 0.35rem 0;
    }

    #company-selecto-options-list::-webkit-scrollbar { width: 5px; }
    #company-selecto-options-list::-webkit-scrollbar-thumb {
      background: rgba(255,255,255,0.2);
      border-radius: 4px;
    }

    .selecto-option {
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 0.6rem 0.95rem;
      font-size: 0.82rem;
      color: #cbd5e1;
      cursor: pointer;
      transition: all 0.15s ease;
    }

    .selecto-option:hover, .selecto-option.highlighted {
      background: rgba(56, 189, 248, 0.18);
      color: #ffffff;
      padding-left: 1.15rem;
    }

    .selecto-option.selected {
      background: rgba(56, 189, 248, 0.28);
      color: #7dd3fc;
      font-weight: 700;
    }

    .selecto-count-tag {
      font-size: 0.72rem;
      background: rgba(255, 255, 255, 0.08);
      padding: 1px 7px;
      border-radius: 10px;
      font-family: monospace;
      color: var(--text-muted);
    }

  
    /* --- MOBILE RESPONSIVE DESIGN (IOS & ANDROID READY) --- */
    .mobile-menu-btn {
      display: none;
      background: rgba(255, 255, 255, 0.08);
      border: 1px solid var(--border-color);
      color: #fff;
      font-size: 1.25rem;
      width: 40px;
      height: 40px;
      border-radius: var(--radius-md);
      cursor: pointer;
      align-items: center;
      justify-content: center;
      flex-shrink: 0;
      transition: all 0.2s;
    }

    .mobile-menu-btn:active {
      background: rgba(255, 255, 255, 0.18);
      transform: scale(0.95);
    }

    .sidebar-backdrop {
      display: none;
      position: fixed;
      inset: 0;
      background: rgba(0, 0, 0, 0.7);
      backdrop-filter: blur(6px);
      -webkit-backdrop-filter: blur(6px);
      z-index: 2400;
      opacity: 0;
      transition: opacity 0.25s ease;
    }

    .sidebar-backdrop.active {
      display: block;
      opacity: 1;
    }

    @media (max-width: 960px) {
      .mobile-menu-btn {
        display: flex;
      }

      .sidebar {
        position: fixed;
        top: 0;
        bottom: 0;
        left: -290px;
        width: 280px;
        height: 100vh;
        z-index: 2500;
        transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: 0 0 35px rgba(0, 0, 0, 0.9);
      }

      .sidebar.mobile-open {
        left: 0;
      }

      .main-workspace {
        width: 100vw;
        max-width: 100vw;
        overflow-x: hidden;
      }

      .workspace-topbar {
        height: auto;
        min-height: auto;
        padding: 0;
        flex-direction: column;
        align-items: stretch;
      }

      .topbar-row-dinia {
        padding: 0.5rem 1rem;
        flex-wrap: wrap;
        gap: 0.5rem;
      }

      .topbar-row-workspace {
        padding: 0.75rem 1rem;
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
      }

      .workspace-top-actions {
        flex-direction: column;
        width: 100%;
        gap: 0.6rem;
      }

      .custom-selecto-wrapper,
      .search-input-wrap,
      #btn-top-create-agent,
      #btn-top-create-bundle {
        width: 100%;
        min-width: 0;
      }

      #company-selecto-trigger {
        width: 100%;
        justify-content: space-between;
      }

      #company-selecto-dropdown {
        width: 100%;
        left: 0;
        right: 0;
      }

      .search-input-wrap input {
        width: 100%;
      }

      .workspace-content {
        padding: 1rem 0.85rem;
      }

      .cards-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
      }

      .card-item {
        padding: 1.15rem;
      }

      .card-header-top {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.6rem;
      }

      .card-pill-tags {
        margin-left: 0;
        width: 100%;
        flex-wrap: wrap;
      }

      .card-actions-row {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 0.4rem;
      }

      .btn-card-action {
        justify-content: center;
        padding: 0.45rem 0.35rem;
        font-size: 0.76rem;
      }

      .modal-dialog {
        width: 94vw !important;
        max-width: 94vw !important;
        margin: 1rem auto !important;
        padding: 1.25rem !important;
        max-height: 92vh !important;
      }

      .modal-footer-sticky {
        flex-direction: column;
        gap: 0.5rem;
      }

      .modal-footer-sticky button {
        width: 100%;
      }

      .tab-bar-nav {
        overflow-x: auto;
        white-space: nowrap;
        padding-bottom: 0.35rem;
      }
    }

    @media (max-width: 480px) {
      .workspace-title-block h2 {
        font-size: 1.15rem;
      }

      .workspace-title-block p {
        font-size: 0.75rem;
      }

      .card-actions-row {
        grid-template-columns: repeat(2, 1fr);
      }
    }
