﻿        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
            background: #f5f7fa;
            color: #1a202c;
            overflow-x: hidden;
        }

        /* Layout Container */
        .app-container {
            display: flex;
            min-height: 100vh;
            overflow-x: hidden;
        }

        /* Sidebar */
        .sidebar {
            width: 260px;
            min-width: 260px;
            background: #1a202c;
            color: white;
            display: flex;
            flex-direction: column;
            position: fixed;
            height: 100vh;
            left: 0;
            top: 0;
            z-index: 1000;
            transition: transform 0.3s ease;
        }

        .sidebar-header {
            padding: 24px 20px;
            border-bottom: 1px solid rgba(255, 255, 255, 0.1);
            display: flex;
            align-items: center;
            gap: 12px;
        }

        .sidebar-logo {
            width: 40px;
            height: 40px;
            border-radius: 8px;
            display: flex;
            align-items: center;
            justify-content: center;
            overflow: hidden;
            background: white;
        }
        .sidebar-logo img {
            width: 100%;
            height: 100%;
            object-fit: contain;
        }

        .sidebar-title {
            flex: 1;
        }

        .sidebar-title h1 {
            font-size: 17px;
            font-weight: 700;
            margin-bottom: 2px;
            color: #fff;
        }

        .sidebar-title p {
            font-size: 10px;
            color: rgba(255, 255, 255, 0.55);
            text-transform: uppercase;
            letter-spacing: 0.08em;
        }

        .sidebar-nav {
            flex: 1;
            padding: 16px 12px;
            overflow-y: auto;
            display: flex;
            flex-direction: column;
            gap: 4px;
        }

        .nav-item {
            display: grid;
            grid-template-columns: auto 1fr;
            align-items: center;
            gap: 12px;
            padding: 12px 14px;
            color: rgba(255, 255, 255, 0.75);
            text-decoration: none;
            transition: all 0.18s;
            cursor: pointer;
            border-radius: 10px;
            border-left: 3px solid transparent;
        }

        .nav-item:hover {
            background: rgba(255, 255, 255, 0.08);
            color: white;
        }

        .nav-item.active {
            background: rgba(102, 126, 234, 0.2);
            color: white;
            border-left-color: #667eea;
            box-shadow: 0 2px 8px rgba(102, 126, 234, 0.15);
        }

        .nav-item-icon {
            width: 22px;
            height: 22px;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 16px;
            opacity: 0.9;
        }

        .nav-item > span:last-child {
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
            min-width: 0;
            font-size: 14px;
            font-weight: 500;
        }

        .sidebar-footer {
            padding: 16px 12px;
            border-top: 1px solid rgba(255, 255, 255, 0.1);
        }

        .user-profile {
            display: flex;
            align-items: center;
            gap: 12px;
            padding: 14px;
            background: rgba(255, 255, 255, 0.06);
            border-radius: 10px;
            margin-bottom: 12px;
            border: 1px solid rgba(255, 255, 255, 0.08);
        }

        .user-avatar {
            width: 42px;
            height: 42px;
            border-radius: 50%;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            display: flex;
            align-items: center;
            justify-content: center;
            font-weight: 700;
            font-size: 16px;
            color: white;
            flex-shrink: 0;
        }

        .user-info {
            flex: 1;
            min-width: 0;
        }

        .user-name {
            font-size: 14px;
            font-weight: 600;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
            color: #fff;
        }

        .user-role {
            font-size: 11px;
            color: rgba(255, 255, 255, 0.6);
            text-transform: uppercase;
            letter-spacing: 0.05em;
            margin-top: 2px;
        }

        .btn-change-password {
            width: 100%;
            padding: 10px 14px;
            margin-bottom: 8px;
            background: rgba(102, 126, 234, 0.15);
            color: #a5b4fc;
            border: 1px solid rgba(102, 126, 234, 0.3);
            border-radius: 8px;
            cursor: pointer;
            font-size: 13px;
            font-weight: 500;
            transition: all 0.18s;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 8px;
        }

        .btn-change-password:hover {
            background: rgba(102, 126, 234, 0.25);
            color: #c7d2fe;
            border-color: rgba(102, 126, 234, 0.4);
        }

        .btn-logout-sidebar {
            width: 100%;
            padding: 10px 14px;
            background: rgba(239, 68, 68, 0.12);
            color: #fca5a5;
            border: 1px solid rgba(239, 68, 68, 0.25);
            border-radius: 8px;
            cursor: pointer;
            font-size: 13px;
            font-weight: 500;
            transition: all 0.18s;
        }

        .btn-logout-sidebar:hover {
            background: rgba(239, 68, 68, 0.22);
            color: #fecaca;
            border-color: rgba(239, 68, 68, 0.35);
        }

        /* Main Content Area */
        .main-content-wrapper {
            flex: 1;
            min-width: 0; /* Allow flex child to shrink and prevent overflow */
            margin-left: 260px;
            display: flex;
            flex-direction: column;
            min-height: 100vh;
            overflow-x: hidden;
        }

        /* Top Header */
        .top-header {
            background: white;
            padding: 16px 32px;
            border-bottom: 1px solid #e2e8f0;
            display: flex;
            align-items: center;
            justify-content: space-between;
            position: sticky;
            top: 0;
            z-index: 100;
            box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
        }

        .header-left {
            display: flex;
            align-items: center;
            gap: 16px;
        }

        .page-title {
            font-size: 24px;
            font-weight: 700;
            color: #1a202c;
        }

        .header-right {
            display: flex;
            align-items: center;
            gap: 12px;
        }

        .btn-header {
            padding: 8px 16px;
            border-radius: 8px;
            font-size: 14px;
            font-weight: 500;
            cursor: pointer;
            transition: all 0.2s;
            border: none;
        }

        .btn-primary-header {
            background: #667eea;
            color: white;
        }

        .btn-primary-header:hover {
            background: #5568d3;
            transform: translateY(-1px);
            box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
        }

        .btn-secondary-header {
            background: rgba(255,255,255,0.12);
            color: #fff;
            border: 1px solid rgba(255,255,255,0.25);
        }

        .btn-secondary-header:hover {
            background: rgba(255,255,255,0.22);
            color: #fff;
        }

        .btn-secondary-header:disabled {
            opacity: 0.4;
            cursor: not-allowed;
        }

        .btn-secondary-header:disabled:hover {
            background: rgba(255,255,255,0.12);
        }

        /* Top header (light bg) — override for visibility */
        .top-header .btn-secondary-header {
            background: #f1f5f9;
            color: #475569;
            border: 1px solid #e2e8f0;
        }

        .top-header .btn-secondary-header:hover {
            background: #e2e8f0;
            color: #1e293b;
        }

        .top-header .btn-secondary-header:disabled:hover {
            background: #f1f5f9;
        }

        /* Content Area */
        .content-area {
            flex: 1;
            min-width: 0; /* Prevent horizontal overflow */
            padding: 32px;
            overflow-y: auto;
            overflow-x: hidden;
        }

        .tab-content {
            display: none;
        }

        .tab-content.active {
            display: block;
        }

        /* Stats Cards */
        .stats-grid {
            display: flex;
            gap: 12px;
            margin-bottom: 20px;
        }

        .stat-card {
            background: white;
            padding: 14px 18px;
            border-radius: 10px;
            border: 1px solid #e2e8f0;
            display: flex;
            align-items: center;
            gap: 14px;
            position: relative;
            overflow: hidden;
            transition: box-shadow 0.15s;
        }
        .stat-card:hover {
            box-shadow: 0 4px 16px rgba(0,0,0,0.08);
        }
        .stat-card-icon {
            width: 40px;
            height: 40px;
            border-radius: 10px;
            display: flex;
            align-items: center;
            justify-content: center;
            flex-shrink: 0;
            font-size: 18px;
        }
        .stat-card-body { flex: 1; min-width: 0; }
        .stat-label {
            font-size: 11px;
            font-weight: 600;
            text-transform: uppercase;
            letter-spacing: 0.06em;
            margin-bottom: 3px;
        }
        .stat-value {
            font-size: 26px;
            font-weight: 700;
            line-height: 1;
        }
        .stat-card-total  .stat-card-icon { background: #eff6ff; }
        .stat-card-total  .stat-label     { color: #3b82f6; }
        .stat-card-total  .stat-value     { color: #1e40af; }
        .stat-card-total::after           { content:''; position:absolute; left:0; top:0; bottom:0; width:3px; background:#3b82f6; border-radius:10px 0 0 10px; }

        .stat-card-pending .stat-card-icon { background: #fffbeb; }
        .stat-card-pending .stat-label     { color: #d97706; }
        .stat-card-pending .stat-value     { color: #92400e; }
        .stat-card-pending::after          { content:''; position:absolute; left:0; top:0; bottom:0; width:3px; background:#f59e0b; border-radius:10px 0 0 10px; }

        .stat-card-won .stat-card-icon { background: #f0fdf4; }
        .stat-card-won .stat-label     { color: #16a34a; }
        .stat-card-won .stat-value     { color: #14532d; }
        .stat-card-won::after          { content:''; position:absolute; left:0; top:0; bottom:0; width:3px; background:#22c55e; border-radius:10px 0 0 10px; }

        /* Main Content Card */
        .content-card {
            background: white;
            border-radius: 12px;
            box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
            border: 1px solid #e2e8f0;
            overflow: hidden;
            max-width: 100%;
        }

        .card-header {
            padding: 24px;
            border-bottom: 1px solid #e2e8f0;
            display: flex;
            align-items: center;
            justify-content: space-between;
        }

        .card-title {
            font-size: 20px;
            font-weight: 700;
            color: #1a202c;
        }

        .card-body {
            padding: 24px;
        }

        /* Deals Filters and Search */
        .deals-filters {
            margin-bottom: 24px;
            padding: 20px;
            background: #f7fafc;
            border-radius: 8px;
            border: 1px solid #e2e8f0;
        }

        .search-box {
            margin-bottom: 16px;
        }

        .search-box input {
            width: 100%;
            padding: 12px 16px;
            border: 1px solid #e2e8f0;
            border-radius: 8px;
            font-size: 14px;
            transition: all 0.2s;
        }

        .search-box input:focus {
            outline: none;
            border-color: #667eea;
            box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
        }

        .filters-row {
            display: flex;
            gap: 12px;
            flex-wrap: wrap;
            align-items: center;
        }

        .filters-row select,
        .filters-row input[type="date"] {
            padding: 8px 12px;
            border: 1px solid #e2e8f0;
            border-radius: 6px;
            font-size: 14px;
            background: white;
            cursor: pointer;
        }

        .filters-row select:focus,
        .filters-row input[type="date"]:focus {
            outline: none;
            border-color: #667eea;
        }

        .btn-filter-clear {
            padding: 8px 16px;
            background: #f7fafc;
            border: 1px solid #e2e8f0;
            border-radius: 6px;
            font-size: 14px;
            cursor: pointer;
            color: #4a5568;
            transition: all 0.2s;
        }

        .btn-filter-clear:hover {
            background: #edf2f7;
            border-color: #cbd5e0;
        }

        .deals-count {
            margin-top: 12px;
            font-size: 13px;
            color: #718096;
            font-weight: 500;
        }

        /* Activities table - same overflow handling */
        .activities-table-container {
            overflow-x: auto;
            -webkit-overflow-scrolling: touch;
            max-width: 100%;
        }

        /* Deals Table */
        .deals-table-container {
            overflow-x: auto;
            -webkit-overflow-scrolling: touch;
            border-radius: 8px;
            border: 1px solid #e2e8f0;
            max-width: 100%;
        }

        .deals-table {
            width: 100%;
            min-width: 0;
            table-layout: fixed;
            border-collapse: collapse;
            background: white;
        }

        /* Table cell truncation — table-layout:fixed handles column widths */
        .deals-table .deal-company-cell,
        .deals-table .deal-row-store-url {
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
            display: block;
            max-width: 100%;
        }

        .deals-table .deal-row-store-details {
            overflow: hidden;
            min-width: 0;
        }

        /* Truncate plain text cells (email, phone, location, owner) */
        .deals-table td.cell-truncate {
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }

        .deals-table thead {
            background: #f7fafc;
            position: sticky;
            top: 0;
            z-index: 10;
        }

        .deals-table th {
            padding: 10px 10px;
            text-align: left;
            font-size: 11px;
            font-weight: 600;
            color: #718096;
            text-transform: uppercase;
            letter-spacing: 0.5px;
            border-bottom: 2px solid #e2e8f0;
            cursor: pointer;
            user-select: none;
            white-space: nowrap;
        }

        .deals-table th:hover {
            background: #edf2f7;
        }

        .sort-indicator {
            margin-left: 4px;
            color: #cbd5e0;
            font-size: 10px;
        }

        .sort-indicator.active {
            color: #667eea;
        }

        .deals-table td {
            padding: 10px 10px;
            border-bottom: 1px solid #e2e8f0;
            font-size: 13px;
            overflow: hidden;
            color: #4a5568;
            vertical-align: middle;
        }

        .deals-table tbody tr {
            transition: background 0.15s;
        }

        .deals-table tbody tr:hover {
            background: #f7fafc;
        }

        .deals-table tbody tr.selected {
            background: #f7faff;
            border-left: 3px solid #667eea;
        }

        .deals-table tbody tr.selected:hover {
            background: #f0f4ff;
        }

        .deal-id-cell {
            font-weight: 600;
            color: #667eea;
            font-size: 11px;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }

        .deal-company-cell {
            font-weight: 600;
            color: #1a202c;
        }

        /* ── Deal status & source chips ─────────────────────────────── */
        .deal-status-badge {
            display: inline-flex;
            align-items: center;
            gap: 5px;
            padding: 3px 9px;
            border-radius: 20px;
            font-size: 12px;
            font-weight: 600;
            white-space: nowrap;
        }
        .deal-status-badge::before {
            content: '';
            width: 6px;
            height: 6px;
            border-radius: 50%;
            flex-shrink: 0;
        }

        .status-pending {
            background: #fffbeb;
            color: #b45309;
            border: 1px solid #fde68a;
        }
        .status-pending::before { background: #f59e0b; }

        .status-won {
            background: #f0fdf4;
            color: #15803d;
            border: 1px solid #bbf7d0;
        }
        .status-won::before { background: #22c55e; }

        .deal-source-badge {
            display: inline-flex;
            align-items: center;
            gap: 4px;
            padding: 2px 8px;
            border-radius: 20px;
            font-size: 11px;
            font-weight: 600;
            white-space: nowrap;
            border: 1px solid transparent;
        }
        .deal-source-badge::before {
            content: '';
            width: 5px;
            height: 5px;
            border-radius: 50%;
            flex-shrink: 0;
        }

        .source-hubspot {
            background: #fff4f1;
            color: #c2410c;
            border-color: #fed7aa;
        }
        .source-hubspot::before { background: #f97316; }

        .source-manual {
            background: #eef2ff;
            color: #4338ca;
            border-color: #c7d2fe;
        }
        .source-manual::before { background: #6366f1; }

        .source-ready-store {
            background: #f0fdf4;
            color: #15803d;
            border-color: #bbf7d0;
        }
        .source-ready-store::before { background: #22c55e; }

        .source-store-created {
            background: #ecfdf5;
            color: #065f46;
            border-color: #a7f3d0;
        }
        .source-store-created::before { background: #10b981; }

        .deal-chips-row {
            display: flex;
            flex-wrap: wrap;
            gap: 4px;
            align-items: center;
        }

        .deal-row-store-info {
            display: flex;
            align-items: center;
            gap: 10px;
        }

        .deal-row-store-logo {
            width: 30px;
            height: 30px;
            border-radius: 5px;
            object-fit: contain;
            background: #f7fafc;
            border: 1px solid #e2e8f0;
            flex-shrink: 0;
        }

        .deal-row-store-details {
            display: flex;
            flex-direction: column;
            gap: 2px;
            min-width: 0;
        }

        .deal-row-store-url {
            font-size: 11px;
            color: #667eea;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
            max-width: 180px;
        }

        .deal-row-store-url:hover {
            text-decoration: underline;
        }

        .table-actions {
            display: flex;
            gap: 5px;
            align-items: center;
        }

        .btn-icon {
            width: 32px;
            height: 32px;
            border-radius: 8px;
            border: 1px solid transparent;
            background: #f1f5f9;
            color: #64748b;
            cursor: pointer;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            transition: background 0.15s, color 0.15s, border-color 0.15s, box-shadow 0.15s, transform 0.1s;
            flex-shrink: 0;
            padding: 0;
        }

        .btn-icon svg {
            width: 15px;
            height: 15px;
            display: block;
            flex-shrink: 0;
        }

        .btn-icon:hover {
            transform: translateY(-1px);
            box-shadow: 0 2px 8px rgba(0,0,0,0.12);
        }

        .btn-icon.edit {
            background: #eff6ff;
            color: #3b82f6;
            border-color: #bfdbfe;
        }
        .btn-icon.edit:hover {
            background: #3b82f6;
            color: #fff;
            border-color: #3b82f6;
            box-shadow: 0 3px 10px rgba(59,130,246,0.35);
        }

        .btn-icon.orders {
            background: #f0fdf4;
            color: #16a34a;
            border-color: #bbf7d0;
        }
        .btn-icon.orders:hover {
            background: #16a34a;
            color: #fff;
            border-color: #16a34a;
            box-shadow: 0 3px 10px rgba(22,163,74,0.35);
        }

        .btn-icon.delete {
            background: #fff1f2;
            color: #f43f5e;
            border-color: #fecdd3;
        }
        .btn-icon.delete:hover {
            background: #f43f5e;
            color: #fff;
            border-color: #f43f5e;
            box-shadow: 0 3px 10px rgba(244,63,94,0.35);
        }

        /* Deal Details Modal - Override base modal-content styles */
        .modal-content.modal-large {
            max-width: 76vw !important;
            width: 76vw !important;
            max-height: 95vh !important;
        }
        
        .modal-content.modal-large .modal-body.modal-scrollable {
            max-height: calc(95vh - 180px);
        }

        .modal-scrollable {
            overflow-y: auto;
            padding-right: 8px;
            flex: 1;
        }

        /* Product Selection Modal Styles */
        .products-grid {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
            gap: 16px;
            margin-bottom: 24px;
        }

        .product-card {
            border: 2px solid #e2e8f0;
            border-radius: 8px;
            padding: 12px;
            cursor: pointer;
            transition: all 0.2s;
            background: white;
            position: relative;
        }

        .product-card:hover {
            border-color: #667eea;
            box-shadow: 0 2px 8px rgba(102, 126, 234, 0.15);
        }

        .product-card.selected {
            border-color: #667eea;
            background: #f7faff;
        }

        .product-card.selected::before {
            content: '✓';
            position: absolute;
            top: 8px;
            right: 8px;
            width: 24px;
            height: 24px;
            background: #667eea;
            color: white;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 14px;
            font-weight: bold;
        }

        .product-card-category {
            margin-top: 8px;
            padding-top: 8px;
            border-top: 1px solid #e2e8f0;
        }

        .product-card-category-label {
            font-size: 10px;
            color: #718096;
            margin-bottom: 4px;
            font-weight: 600;
            text-transform: uppercase;
            letter-spacing: 0.5px;
        }

        .product-card-category-select {
            width: 100%;
            padding: 5px 6px;
            border: 1px solid #cbd5e0;
            border-radius: 4px;
            font-size: 11px;
            background: white;
            color: #1a202c;
            cursor: pointer;
            transition: border-color 0.2s;
        }

        .product-card-category-select:hover {
            border-color: #667eea;
        }

        .product-card-category-select:focus {
            outline: none;
            border-color: #667eea;
            box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.1);
        }

        .product-card-category-checkboxes {
            max-height: 150px;
            overflow-y: auto;
            border: 1px solid #cbd5e0;
            border-radius: 4px;
            padding: 4px;
            background: white;
        }

        .product-card-category-checkbox-item {
            display: flex;
            align-items: center;
            padding: 4px 6px;
            font-size: 11px;
            cursor: pointer;
            transition: background-color 0.2s;
            border-radius: 3px;
        }

        .product-card-category-checkbox-item:hover {
            background-color: #f7fafc;
        }

        .product-card-category-checkbox-item input[type="checkbox"] {
            margin-right: 6px;
            cursor: pointer;
            width: 14px;
            height: 14px;
            accent-color: #667eea;
        }

        .product-card-category-checkbox-item label {
            cursor: pointer;
            flex: 1;
            color: #1a202c;
            user-select: none;
        }

        .product-image {
            width: 100%;
            height: 150px;
            object-fit: contain;
            background: #f7fafc;
            border-radius: 6px;
            margin-bottom: 8px;
        }

        .product-image-placeholder {
            width: 100%;
            height: 150px;
            background: #f7fafc;
            border-radius: 6px;
            display: flex;
            align-items: center;
            justify-content: center;
            color: #a0aec0;
            font-size: 12px;
            margin-bottom: 8px;
        }

        .product-name {
            font-size: 13px;
            font-weight: 600;
            color: #1a202c;
            margin-bottom: 4px;
            line-height: 1.4;
            display: -webkit-box;
            -webkit-line-clamp: 2;
            -webkit-box-orient: vertical;
            overflow: hidden;
        }

        .product-sku {
            font-size: 11px;
            color: #718096;
            margin-bottom: 4px;
        }

        .product-price {
            font-size: 14px;
            font-weight: 700;
            color: #667eea;
        }

        .product-match-reason {
            font-size: 10px;
            color: #a0aec0;
            margin-top: 4px;
            font-style: italic;
        }

        .product-variants {
            margin-top: 8px;
            display: flex;
            flex-direction: row;
            flex-wrap: wrap;
            gap: 6px;
            align-items: flex-start;
        }

        .variant-swatch {
            width: 24px;
            height: 24px;
            min-width: 24px;
            min-height: 24px;
            max-width: 24px;
            max-height: 24px;
            flex-shrink: 0;
            border-radius: 4px;
            border: 2px solid #e2e8f0;
            cursor: pointer;
            position: relative;
            transition: all 0.2s;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            font-size: 10px;
            font-weight: 600;
            color: #4a5568;
            background: #f7fafc;
            box-sizing: border-box;
        }

        .variant-swatch:hover {
            border-color: #667eea;
            transform: scale(1.1);
        }

        .variant-swatch.selected {
            border-color: #667eea;
            border-width: 3px;
            box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.2);
        }

        .variant-swatch.selected::after {
            content: '✓';
            position: absolute;
            color: white;
            font-size: 12px;
            text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
        }

        .variant-swatch.color-swatch {
            background-size: cover;
            background-position: center;
            width: 24px;
            height: 24px;
            min-width: 24px;
            min-height: 24px;
            max-width: 24px;
            max-height: 24px;
        }

        .variant-swatch.text-swatch {
            min-width: 32px;
            width: auto;
            height: 24px;
            padding: 0 6px;
            font-size: 9px;
            max-width: none;
        }

        .selected-products-list {
            display: flex;
            flex-direction: column;
            gap: 8px;
            max-height: 200px;
            overflow-y: auto;
        }

        .selected-product-item {
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding: 10px 12px;
            background: #f7fafc;
            border-radius: 6px;
            border: 1px solid #e2e8f0;
        }

        .selected-product-info {
            flex: 1;
        }

        .selected-product-name {
            font-size: 13px;
            font-weight: 600;
            color: #1a202c;
            margin-bottom: 2px;
        }

        .selected-product-sku {
            font-size: 11px;
            color: #718096;
        }

        .selected-product-category {
            margin-top: 8px;
        }

        .category-select-label {
            font-size: 11px;
            color: #4a5568;
            margin-bottom: 4px;
            font-weight: 600;
        }

        .category-select {
            width: 100%;
            padding: 6px 8px;
            border: 1px solid #e2e8f0;
            border-radius: 4px;
            font-size: 12px;
            background: white;
            color: #1a202c;
            cursor: pointer;
            transition: border-color 0.2s;
        }

        .category-select:hover {
            border-color: #cbd5e0;
        }

        .category-select:focus {
            outline: none;
            border-color: #667eea;
            box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
        }

        .remove-product-btn {
            padding: 4px 8px;
            background: #fee2e2;
            color: #dc2626;
            border: none;
            border-radius: 4px;
            font-size: 11px;
            cursor: pointer;
            transition: all 0.2s;
        }

        .remove-product-btn:hover {
            background: #fecaca;
        }

        .modal-footer {
            padding: 20px 24px;
            border-top: 1px solid #e2e8f0;
            display: flex;
            justify-content: space-between;
            align-items: center;
            background: white;
            border-radius: 0 0 16px 16px;
        }

        .modal-scrollable::-webkit-scrollbar {
            width: 8px;
        }

        .modal-scrollable::-webkit-scrollbar-track {
            background: #f1f1f1;
            border-radius: 4px;
        }

        .modal-scrollable::-webkit-scrollbar-thumb {
            background: #cbd5e0;
            border-radius: 4px;
        }

        .modal-scrollable::-webkit-scrollbar-thumb:hover {
            background: #a0aec0;
        }


        .deal-details-main {
            display: flex;
            flex-direction: column;
            gap: 20px;
        }

        .details-section {
            background: #fff;
            border-radius: 10px;
            padding: 24px 28px;
            border: 1px solid #e2e8f0;
            position: relative;
            overflow: hidden;
            box-shadow: 0 1px 3px rgba(0,0,0,0.06);
        }
        .details-section::before {
            content: '';
            position: absolute;
            left: 0;
            top: 0;
            bottom: 0;
            width: 4px;
            background: linear-gradient(180deg, #475569 0%, #334155 100%);
            border-radius: 10px 0 0 10px;
        }
        
        /* Logo section should be centered and constrained */
        #logoSection {
            display: flex;
            flex-direction: column;
            align-items: center;
        }

        .details-section-title {
            font-size: 12px;
            font-weight: 700;
            color: #334155;
            margin: -24px -28px 20px -28px;
            padding: 10px 28px 10px 32px;
            background: linear-gradient(90deg, #f1f5f9 0%, #f8fafc 100%);
            border-bottom: 1px solid #cbd5e1;
            text-transform: uppercase;
            letter-spacing: 0.08em;
            display: flex;
            align-items: center;
            gap: 8px;
            border-radius: 10px 10px 0 0;
        }
        .details-section-title::before {
            content: '';
            width: 6px;
            height: 6px;
            border-radius: 50%;
            background: #475569;
            flex-shrink: 0;
        }

        .btn-edit {
            background: #fff;
            color: #475569;
            border: 1px solid #cbd5e0;
            padding: 3px 10px;
            border-radius: 5px;
            font-size: 11px;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.2s;
            white-space: nowrap;
        }
        .btn-edit:hover {
            background: #f1f5f9;
            color: #1e293b;
            border-color: #94a3b8;
        }


        .details-grid {
            display: grid;
            grid-template-columns: repeat(3, 1fr);
            gap: 16px 20px;
        }
        
        /* Two-column layout for Store Customization section */
        #dealInfoDetails {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 24px 32px;
            align-items: start;
        }
        
        .store-customization-left,
        .store-customization-right {
            display: flex;
            flex-direction: column;
            gap: 20px;
        }
        
        .store-customization-left .detail-item,
        .store-customization-right .detail-item {
            width: 100%;
        }

        .detail-item {
            display: flex;
            flex-direction: column;
            min-width: 0;
            padding: 10px 0;
        }
        
        .detail-item.full-width {
            grid-column: 1 / -1;
        }
        
        .detail-item.half-width {
            grid-column: span 1;
        }

        .detail-label {
            font-size: 11px;
            font-weight: 600;
            color: #64748b;
            text-transform: uppercase;
            letter-spacing: 0.06em;
            margin-bottom: 5px;
        }

        .detail-value {
            font-size: 14px;
            color: #1e293b;
            font-weight: 500;
            word-wrap: break-word;
            overflow-wrap: break-word;
            line-height: 1.5;
        }

        .deal-logo-container {
            margin-bottom: 20px;
            padding: 24px;
            background: #f7fafc;
            border-radius: 8px;
            border: 2px dashed #cbd5e0;
            display: flex;
            align-items: center;
            justify-content: center;
            min-height: 200px;
            max-width: 400px;
            width: fit-content;
            margin-left: auto;
            margin-right: auto;
        }

        .deal-logo-container img {
            max-width: 100%;
            max-height: 250px;
            width: auto;
            height: auto;
            border-radius: 8px;
            object-fit: contain;
            aspect-ratio: auto;
        }

        .deal-logo-placeholder {
            color: #a0aec0;
            font-size: 14px;
            padding: 40px;
        }

        .btn-action {
            padding: 12px 24px;
            border-radius: 8px;
            font-size: 15px;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.2s;
            border: none;
        }

        .btn-action-primary {
            background: #667eea;
            color: white;
        }

        .btn-action-primary:hover {
            background: #5568d3;
            transform: translateY(-2px);
            box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
        }

        .btn-action-primary:disabled {
            background: #cbd5e0;
            cursor: not-allowed;
            transform: none;
        }

        /* Users Table */
        .users-table-container {
            overflow-x: auto;
        }

        .users-table {
            width: 100%;
            border-collapse: collapse;
        }

        .users-table thead {
            background: #f7fafc;
        }

        .users-table th {
            padding: 12px 16px;
            text-align: left;
            font-size: 12px;
            font-weight: 600;
            color: #718096;
            text-transform: uppercase;
            letter-spacing: 0.5px;
            border-bottom: 2px solid #e2e8f0;
        }

        .users-table td {
            padding: 16px;
            border-bottom: 1px solid #e2e8f0;
            font-size: 14px;
            color: #4a5568;
        }

        .users-table tbody tr:hover {
            background: #f7fafc;
        }

        .badge {
            display: inline-block;
            padding: 4px 12px;
            border-radius: 12px;
            font-size: 12px;
            font-weight: 600;
            text-transform: uppercase;
            letter-spacing: 0.5px;
        }

        .badge-admin {
            background: #dbeafe;
            color: #1e40af;
        }

        .badge-sales-rep {
            background: #dcfce7;
            color: #166534;
        }

        .badge-active {
            background: #d1fae5;
            color: #065f46;
        }

        .badge-inactive {
            background: #fee2e2;
            color: #991b1b;
        }

        /* Empty States */
        .empty-state {
            text-align: center;
            padding: 60px 20px;
            color: #718096;
        }

        .empty-state-icon {
            font-size: 64px;
            margin-bottom: 16px;
            opacity: 0.5;
        }

        .empty-state h3 {
            font-size: 20px;
            color: #4a5568;
            margin-bottom: 8px;
        }

        .empty-state p {
            font-size: 14px;
            color: #718096;
        }

        /* Modals */
        .modal {
            display: none;
            position: fixed;
            z-index: 2000;
            left: 0;
            top: 0;
            width: 100%;
            height: 100%;
            background-color: rgba(0, 0, 0, 0.5);
            backdrop-filter: blur(4px);
            overflow-y: auto;
            padding: 20px;
        }

        .modal.active {
            display: flex;
            align-items: center;
            justify-content: center;
        }

        /* Close modal when clicking backdrop */
        .modal.active::before {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            z-index: -1;
        }

        .modal-content {
            background: white;
            border-radius: 14px;
            width: 100%;
            max-width: 1200px;
            max-height: 90vh;
            overflow: hidden;
            box-shadow: 0 24px 64px rgba(0, 0, 0, 0.28);
            position: relative;
            display: flex;
            flex-direction: column;
            margin: auto;
        }

        /* Edit modals should be smaller */
        #editCompanyModal .modal-content,
        #editUserModal .modal-content {
            max-width: 600px;
        }

        #editCategoryMetaModal .modal-content {
            max-width: 700px;
        }
        
        /* Override for large modals (deal details) - already handled above */

        .modal-header {
            padding: 18px 24px;
            display: flex;
            justify-content: space-between;
            align-items: center;
            position: sticky;
            top: 0;
            z-index: 10;
            background: linear-gradient(135deg, #1a202c 0%, #2d3748 100%);
            flex-shrink: 0;
        }

        .deal-details-header-sticky {
            flex-wrap: wrap;
            gap: 12px;
        }

        .deal-details-header-actions {
            display: flex;
            align-items: center;
            gap: 10px;
        }

        .modal-header h2 {
            margin: 0;
            color: #fff;
            font-size: 18px;
            font-weight: 700;
            letter-spacing: -0.01em;
        }

        .modal-close {
            background: rgba(255,255,255,0.12);
            border: none;
            font-size: 20px;
            cursor: pointer;
            color: #fff;
            padding: 0;
            width: 30px;
            height: 30px;
            display: flex;
            align-items: center;
            justify-content: center;
            border-radius: 50%;
            transition: background 0.15s;
            line-height: 1;
            flex-shrink: 0;
        }

        .modal-close:hover {
            background: rgba(255,255,255,0.25);
        }

        .modal-body {
            padding: 24px;
            overflow-y: auto;
            flex: 1;
        }

        .modal-body.modal-scrollable {
            max-height: calc(90vh - 120px);
        }
        
        /* Override for large modals */
        .modal-large .modal-body.modal-scrollable {
            max-height: calc(95vh - 180px);
        }

        .modal-actions {
            display: flex;
            justify-content: flex-end;
            gap: 10px;
            padding-top: 20px;
            border-top: 1px solid #f1f5f9;
            margin-top: 8px;
            margin-top: 24px;
            border-top: 1px solid #e2e8f0;
        }

        .btn-primary {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            color: white;
            border: none;
            padding: 12px 24px;
            border-radius: 8px;
            font-size: 14px;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.2s ease;
            box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
        }

        .btn-primary:hover {
            background: linear-gradient(135deg, #5568d3 0%, #6a3d8f 100%);
            transform: translateY(-1px);
            box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
        }

        .btn-primary:active {
            transform: translateY(0);
            box-shadow: 0 2px 6px rgba(102, 126, 234, 0.3);
        }

        .btn-secondary {
            background: white;
            color: #4a5568;
            border: 2px solid #e2e8f0;
            padding: 12px 24px;
            border-radius: 8px;
            font-size: 14px;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.2s ease;
        }

        .btn-secondary:hover {
            background: #f7fafc;
            border-color: #cbd5e0;
            color: #2d3748;
        }

        .btn-secondary:active {
            background: #edf2f7;
        }

        .form-section {
            margin-bottom: 16px;
            padding: 20px 20px 20px 24px;
            border: 1px solid #e2e8f0;
            background: #fff;
            border-radius: 10px;
            overflow: hidden;
            box-shadow: 0 1px 3px rgba(0,0,0,0.06);
            position: relative;
        }
        .form-section::before {
            content: '';
            position: absolute;
            left: 0;
            top: 0;
            bottom: 0;
            width: 4px;
            background: linear-gradient(180deg, #475569 0%, #334155 100%);
            border-radius: 10px 0 0 10px;
        }
        .form-section:last-of-type {
            margin-bottom: 0;
        }
        .form-section h3 {
            margin: -20px -20px 18px -24px;
            font-size: 12px;
            font-weight: 700;
            color: #334155;
            text-transform: uppercase;
            letter-spacing: 0.08em;
            padding: 10px 20px 10px 28px;
            background: linear-gradient(90deg, #f1f5f9 0%, #f8fafc 100%);
            border-bottom: 1px solid #cbd5e1;
            display: flex;
            align-items: center;
            gap: 8px;
        }
        .form-section h3::before {
            content: '';
            width: 6px;
            height: 6px;
            border-radius: 50%;
            background: #475569;
            flex-shrink: 0;
        }
        .form-subsection {
            margin-bottom: 24px;
            padding: 16px;
            background: #f8fafc;
            border-radius: 8px;
            border: 1px solid #e2e8f0;
        }
        .form-subsection h4 {
            font-size: 16px;
            font-weight: 600;
            color: #4a5568;
            margin: 0 0 12px 0;
        }

        .form-grid {
            display: grid;
            grid-template-columns: repeat(2, 1fr);
            gap: 16px;
        }

        .form-group {
            display: flex;
            flex-direction: column;
        }

        .form-group.full-width {
            grid-column: 1 / -1;
        }

        .form-group label {
            margin-bottom: 6px;
            color: #475569;
            font-weight: 600;
            font-size: 13px;
        }

        .form-group input,
        .form-group select,
        .form-group textarea {
            padding: 10px 12px;
            border: 1px solid #e2e8f0;
            border-radius: 8px;
            font-size: 14px;
            transition: all 0.2s;
            background: white;
        }

        .form-group input:focus,
        .form-group select:focus,
        .form-group textarea:focus {
            outline: none;
            border-color: #667eea;
            box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
        }

        /* Tertiary Color Picker Styles */
        .tertiary-color-container {
            display: flex;
            flex-direction: column;
            gap: 12px;
            position: relative; /* Required for absolute positioning of popup */
        }

        .color-swatches-grid {
            display: grid;
            grid-template-columns: repeat(13, 1fr);
            gap: 8px;
            margin-bottom: 12px;
            min-height: 60px; /* Ensure grid has minimum height */
        }
        
        @media (max-width: 1200px) {
            .color-swatches-grid {
                grid-template-columns: repeat(10, 1fr);
            }
        }
        
        @media (max-width: 768px) {
            .color-swatches-grid {
                grid-template-columns: repeat(8, 1fr);
            }
        }

        .color-swatch {
            width: 100%;
            aspect-ratio: 1;
            min-width: 18px;
            min-height: 18px;
            max-width: 24px;
            max-height: 24px;
            border: 1.5px solid #a0aec0;
            border-radius: 3px;
            cursor: pointer;
            transition: all 0.2s;
            position: relative;
            display: flex;
            align-items: center;
            justify-content: center;
            flex-shrink: 0;
            margin: 0 auto;
        }

        .color-swatch:hover {
            border-color: #667eea;
            transform: scale(1.05);
        }

        .color-swatch.selected {
            border-color: #667eea;
            border-width: 3px;
            box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.2);
        }

        .color-swatch .remove-icon {
            position: absolute;
            top: -8px;
            right: -8px;
            width: 20px;
            height: 20px;
            background: white;
            border: 2px solid #ef4444;
            border-radius: 50%;
            color: #ef4444;
            font-size: 12px;
            display: none;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            z-index: 10;
        }

        .color-swatch.selected .remove-icon {
            display: flex;
        }

        .selected-colors-display {
            display: flex;
            flex-wrap: wrap;
            gap: 8px;
            min-height: 40px;
            padding: 8px;
            border: 1px solid #e2e8f0;
            border-radius: 4px;
            background: #f7fafc;
        }

        .selected-color-chip {
            display: inline-flex;
            align-items: center;
            gap: 6px;
            padding: 4px 8px;
            background: white;
            border: 1px solid #cbd5e0;
            border-radius: 4px;
            font-size: 12px;
        }

        .selected-color-chip .color-preview {
            width: 16px;
            height: 16px;
            border-radius: 2px;
            border: 1px solid #a0aec0;
        }

        .btn-custom-color {
            padding: 8px 16px;
            background: #f7fafc;
            border: 1px dashed #cbd5e0;
            border-radius: 4px;
            color: #4a5568;
            cursor: pointer;
            font-size: 14px;
            transition: all 0.2s;
        }

        .btn-custom-color:hover {
            background: #edf2f7;
            border-color: #667eea;
            color: #667eea;
        }

        .color-picker-popup {
            position: absolute;
            top: 100%;
            left: 0;
            margin-top: 8px;
            background: white;
            border: 1px solid #e2e8f0;
            border-radius: 8px;
            box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
            z-index: 1000;
            padding: 16px;
            min-width: 280px;
            display: none; /* Hidden by default */
        }

        .color-picker-content {
            display: flex;
            flex-direction: column;
            gap: 12px;
        }

        .color-gradient {
            width: 100%;
            height: 150px;
            border: 1px solid #e2e8f0;
            border-radius: 4px;
            cursor: crosshair;
            position: relative;
            overflow: hidden;
        }
        
        .color-gradient::before {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background: linear-gradient(to right, white, transparent);
            pointer-events: none;
            z-index: 1;
        }
        
        .color-gradient::after {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background: linear-gradient(to bottom, transparent, black);
            pointer-events: none;
            z-index: 2;
        }
        
        .color-gradient .picker-indicator {
            position: absolute;
            width: 12px;
            height: 12px;
            border: 2px solid white;
            border-radius: 50%;
            transform: translate(-50%, -50%);
            pointer-events: none;
            box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.5);
            z-index: 10;
        }

        .color-gradient .picker-indicator {
            position: absolute;
            width: 12px;
            height: 12px;
            border: 2px solid white;
            border-radius: 50%;
            transform: translate(-50%, -50%);
            pointer-events: none;
            box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.2);
        }

        .hue-slider {
            width: 100%;
            height: 20px;
            border: 1px solid #e2e8f0;
            border-radius: 4px;
            cursor: pointer;
            background: linear-gradient(to right, #ff0000, #ffff00, #00ff00, #00ffff, #0000ff, #ff00ff, #ff0000);
            position: relative;
        }
        
        .hue-slider .hue-indicator {
            position: absolute;
            top: 50%;
            transform: translateY(-50%);
            width: 4px;
            height: 100%;
            background: white;
            border: 1px solid rgba(0, 0, 0, 0.3);
            pointer-events: none;
            z-index: 10;
        }

        .hue-slider .hue-indicator {
            position: absolute;
            top: 50%;
            transform: translateY(-50%);
            width: 4px;
            height: 100%;
            background: white;
            border: 1px solid rgba(0, 0, 0, 0.3);
            pointer-events: none;
        }

        .color-preview {
            display: flex;
            align-items: center;
            gap: 12px;
        }

        .current-color {
            width: 40px;
            height: 40px;
            border: 1px solid #a0aec0;
            border-radius: 4px;
        }

        .color-preview input[type="text"] {
            flex: 1;
            padding: 6px 8px;
            border: 1px solid #e2e8f0;
            border-radius: 4px;
            font-family: monospace;
            font-size: 14px;
        }

        .rgb-inputs {
            display: grid;
            grid-template-columns: repeat(3, 1fr);
            gap: 8px;
        }

        .rgb-inputs input {
            padding: 6px 8px;
            border: 1px solid #e2e8f0;
            border-radius: 4px;
            font-size: 14px;
        }

        .color-picker-actions {
            display: flex;
            gap: 8px;
        }

        .btn-add-color,
        .btn-cancel-color {
            flex: 1;
            padding: 8px 16px;
            border-radius: 4px;
            font-size: 14px;
            font-weight: 500;
            cursor: pointer;
            transition: all 0.2s;
        }

        .btn-add-color {
            background: #667eea;
            color: white;
            border: none;
        }

        .btn-add-color:hover {
            background: #5568d3;
        }

        .btn-cancel-color {
            background: #f7fafc;
            color: #4a5568;
            border: 1px solid #e2e8f0;
        }

        .btn-cancel-color:hover {
            background: #edf2f7;
        }

        /* Theme Selection Styles */
        .template-selection-container {
            margin-top: 8px;
            max-width: 600px;
            margin-left: auto;
            margin-right: auto;
        }

        .template-thumbnails {
            display: grid;
            grid-template-columns: repeat(5, 1fr);
            gap: 16px;
            margin-bottom: 12px;
        }

        .template-thumbnail {
            position: relative;
            border: 2px solid #e2e8f0;
            border-radius: 8px;
            overflow: hidden;
            cursor: pointer;
            transition: all 0.2s;
            background: white;
        }

        .template-thumbnail:hover {
            border-color: #667eea;
            box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15);
            transform: translateY(-2px);
        }

        .template-thumbnail.selected {
            border-color: #667eea;
            border-width: 3px;
            box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
        }

        .template-thumbnail.selected::after {
            content: '✓';
            position: absolute;
            top: 8px;
            right: 8px;
            width: 24px;
            height: 24px;
            background: #667eea;
            color: white;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 14px;
            font-weight: bold;
            z-index: 10;
        }

        .template-thumbnail-image {
            position: relative;
            overflow: hidden;
            cursor: pointer;
            height: 100px;
            flex-shrink: 0;
        }

        .template-thumbnail-image img {
            width: 100%;
            height: 100%;
            display: block;
            object-fit: cover;
            object-position: top center;
            transition: transform 0.2s;
        }

        .template-thumbnail-image:hover img {
            transform: scale(1.05);
        }

        .template-preview-overlay {
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background: rgba(0, 0, 0, 0.5);
            display: flex;
            align-items: center;
            justify-content: center;
            opacity: 0;
            transition: opacity 0.2s;
            color: white;
            font-size: 14px;
            font-weight: 600;
        }

        .template-thumbnail-image:hover .template-preview-overlay {
            opacity: 1;
        }

        .template-label {
            padding: 8px 12px;
            background: #f7fafc;
            font-size: 13px;
            font-weight: 600;
            color: #1a202c;
            text-align: center;
            border-top: 1px solid #e2e8f0;
        }

        .template-badge {
            padding: 4px 8px;
            background: #667eea;
            color: white;
            font-size: 11px;
            font-weight: 600;
            text-align: center;
            text-transform: uppercase;
            letter-spacing: 0.5px;
        }

        /* Common Droid section */
        .common-droid-section {
            margin-top: 16px;
            padding: 16px;
            background: #f8fafc;
            border-radius: 8px;
            border: 1px solid #e2e8f0;
        }
        .step-badge {
            display: inline-block;
            padding: 4px 10px;
            background: #e2e8f0;
            color: #64748b;
            font-size: 12px;
            font-weight: 600;
            border-radius: 9999px;
            margin-bottom: 8px;
        }
        .common-droid-title {
            font-size: 18px;
            font-weight: 700;
            color: #1a202c;
            margin: 0 0 4px 0;
        }
        .common-droid-subtitle {
            font-size: 13px;
            color: #64748b;
            margin: 0 0 12px 0;
        }
        .common-droid-selected-card {
            max-width: 150px;
            border: 1px solid #e2e8f0;
            border-radius: 8px;
            overflow: hidden;
            background: #fff;
            margin-bottom: 12px;
        }
        .common-droid-list-container {
            margin-top: 8px;
        }
        .common-droid-list {
            display: flex;
            flex-wrap: wrap;
            gap: 10px;
        }
        .droid-card {
            width: 100px;
            border: 2px solid #e2e8f0;
            border-radius: 8px;
            overflow: hidden;
            cursor: pointer;
            background: #fff;
            transition: all 0.2s;
            position: relative;
        }
        .droid-card:hover {
            border-color: #667eea;
            box-shadow: 0 2px 8px rgba(102, 126, 234, 0.2);
        }
        .droid-card.selected {
            border-color: #667eea;
            border-width: 3px;
            box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
        }
        .droid-card.selected::after {
            content: '✓';
            position: absolute;
            top: 8px;
            right: 8px;
            width: 24px;
            height: 24px;
            background: #667eea;
            color: white;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 14px;
            font-weight: bold;
            z-index: 10;
        }
        .graphic-card.selected {
            border-color: #667eea;
            border-width: 3px;
            box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
            background: #eef2ff;
        }
        .graphic-card.selected::after {
            content: '✓';
            position: absolute;
            top: 4px;
            right: 4px;
            width: 20px;
            height: 20px;
            background: #667eea;
            color: white;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 12px;
            font-weight: bold;
            z-index: 10;
        }
        .droid-card canvas {
            width: 100%;
            height: 80px;
            display: block;
            background: #f7fafc;
        }
        .droid-card img {
            width: 100%;
            height: 80px;
            object-fit: contain;
            display: block;
            background: #f7fafc;
        }
        .droid-card .droid-card-name {
            padding: 6px 8px;
            font-size: 11px;
            font-weight: 600;
            color: #1a202c;
            text-align: center;
        }
        .droid-preview-spinner {
            width: 24px;
            height: 24px;
            border: 3px solid #e2e8f0;
            border-top-color: #667eea;
            border-radius: 50%;
            animation: droid-spinner 0.8s linear infinite;
        }
        @keyframes droid-spinner {
            to { transform: rotate(360deg); }
        }
        .common-droid-loading,
        .common-droid-empty {
            font-size: 13px;
            color: #64748b;
            padding: 12px 0;
        }

        /* Theme Preview Modal */
        .template-preview-modal {
            display: none;
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background: rgba(0, 0, 0, 0.8);
            z-index: 10000;
            align-items: center;
            justify-content: center;
            padding: 20px;
        }

        .template-preview-modal.active {
            display: flex;
        }

        .template-preview-content {
            position: relative;
            max-width: 90%;
            max-height: 90vh;
            background: white;
            border-radius: 8px;
            overflow: auto;
            box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
        }

        .template-preview-header {
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding: 16px 20px;
            border-bottom: 1px solid #e2e8f0;
            background: #f7fafc;
            position: sticky;
            top: 0;
            z-index: 100;
        }

        .template-preview-title {
            font-size: 18px;
            font-weight: 600;
            color: #1a202c;
        }

        .template-preview-close {
            width: 32px;
            height: 32px;
            border: none;
            background: transparent;
            font-size: 24px;
            color: #718096;
            cursor: pointer;
            border-radius: 4px;
            display: flex;
            align-items: center;
            justify-content: center;
            transition: all 0.2s;
        }

        .template-preview-close:hover {
            background: #e2e8f0;
            color: #1a202c;
        }

        .template-preview-image {
            width: 100%;
            height: auto;
            display: block;
        }

        .form-group textarea {
            resize: vertical;
            min-height: 80px;
        }

        .form-actions {
            display: flex;
            justify-content: flex-end;
            gap: 12px;
            padding-top: 24px;
            border-top: 1px solid #e2e8f0;
            margin-top: 24px;
        }

        .btn-cancel {
            background: #f7fafc;
            color: #4a5568;
            border: 1px solid #e2e8f0;
            padding: 10px 20px;
            border-radius: 8px;
            cursor: pointer;
            font-size: 14px;
            font-weight: 500;
        }

        .btn-cancel:hover {
            background: #edf2f7;
        }

        .btn-submit {
            background: #667eea;
            color: white;
            border: none;
            padding: 10px 20px;
            border-radius: 8px;
            cursor: pointer;
            font-size: 14px;
            font-weight: 500;
        }

        .btn-submit:hover {
            background: #5568d3;
        }

        .btn-submit:disabled {
            background: #cbd5e0;
            cursor: not-allowed;
        }

        /* Loading & Messages */
        .loading {
            display: none;
            text-align: center;
            padding: 40px 20px;
            color: #667eea;
            font-size: 16px;
            font-weight: 500;
        }

        .loading.active {
            display: block;
        }
        
        .loading p {
            margin: 0;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 8px;
        }

        .result-message {
            margin-top: 20px;
            padding: 16px;
            border-radius: 8px;
            display: none;
        }

        .result-message.success {
            background: #d1fae5;
            color: #065f46;
            border: 1px solid #a7f3d0;
            display: block;
        }

        .result-message.error {
            background: #fee2e2;
            color: #991b1b;
            border: 1px solid #fecaca;
            display: block;
        }

        /* Top notification banner */
        .top-notification {
            position: fixed;
            top: 0;
            left: 260px;
            right: 0;
            z-index: 2000;
            padding: 16px 24px;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            color: white;
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
            display: none;
            align-items: center;
            justify-content: space-between;
            animation: slideDown 0.3s ease-out;
        }

        @media (max-width: 768px) {
            .top-notification {
                left: 0;
            }
        }

        @keyframes slideDown {
            from {
                transform: translateY(-100%);
                opacity: 0;
            }
            to {
                transform: translateY(0);
                opacity: 1;
            }
        }

        .top-notification.show {
            display: flex;
        }

        .top-notification-content {
            flex: 1;
            display: flex;
            align-items: center;
            gap: 12px;
        }

        .top-notification-icon {
            font-size: 24px;
        }

        .top-notification-text {
            flex: 1;
        }

        .top-notification-text h3 {
            margin: 0 0 4px 0;
            font-size: 16px;
            font-weight: 600;
        }

        .top-notification-text p {
            margin: 0;
            font-size: 13px;
            opacity: 0.95;
        }

        .top-notification-close {
            background: rgba(255, 255, 255, 0.2);
            border: none;
            color: white;
            width: 32px;
            height: 32px;
            border-radius: 6px;
            cursor: pointer;
            font-size: 18px;
            display: flex;
            align-items: center;
            justify-content: center;
            transition: background 0.2s;
        }

        .top-notification-close:hover {
            background: rgba(255, 255, 255, 0.3);
        }

        /* Store info and logo wrapper */
        .store-info-logo-wrapper {
            display: grid;
            grid-template-columns: 30% 1fr;
            gap: 20px;
            margin-bottom: 24px;
        }

        @media (max-width: 768px) {
            .store-info-logo-wrapper {
                grid-template-columns: 1fr;
            }
            
            .store-logo-section {
                min-height: 150px;
            }
            
            .store-logo-container img {
                max-height: 120px;
            }
            
            .store-logo-placeholder {
                height: 120px;
            }
        }

        /* Logo section in top layout */
        .store-logo-section {
            background: white;
            border: 2px solid #667eea;
            border-radius: 12px;
            padding: 20px;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            min-height: 200px;
        }

        .store-logo-section h3 {
            margin: 0;
            color: #1a202c;
            font-size: 16px;
            font-weight: 600;
        }

        .store-logo-container {
            width: 100%;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: flex-start;
            gap: 12px;
        }

        .store-logo-container h3 {
            margin: 0;
            color: #1a202c;
            font-size: 16px;
            font-weight: 600;
            text-align: center;
            width: 100%;
        }

        .store-logo-container img {
            max-width: 100%;
            max-height: 180px;
            object-fit: contain;
            border-radius: 8px;
        }

        .store-logo-placeholder {
            width: 100%;
            height: 180px;
            display: flex;
            align-items: center;
            justify-content: center;
            background: #f7fafc;
            border: 2px dashed #cbd5e0;
            border-radius: 8px;
            color: #718096;
            font-size: 14px;
        }

        /* Store info section at top */
        .store-info-top {
            background: linear-gradient(135deg, #f7fafc 0%, #edf2f7 100%);
            border: 2px solid #667eea;
            border-radius: 12px;
            padding: 20px;
        }

        .store-info-top-header {
            display: flex;
            align-items: center;
            gap: 12px;
            margin-bottom: 16px;
        }

        .store-info-top-header h3 {
            margin: 0;
            color: #1a202c;
            font-size: 18px;
        }

        .store-info-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
            gap: 16px;
        }

        .store-info-item {
            display: flex;
            flex-direction: column;
            gap: 4px;
            min-width: 0; /* Allow flex items to shrink below content size */
        }

        .store-info-item.full-width {
            grid-column: 1 / -1; /* Span all columns */
        }

        .store-info-label {
            font-size: 11px;
            text-transform: uppercase;
            letter-spacing: 0.5px;
            color: #718096;
            font-weight: 600;
        }

        .store-info-value {
            font-size: 14px;
            color: #1a202c;
            font-weight: 500;
            word-break: break-all; /* Break long URLs */
            overflow-wrap: break-word; /* Additional wrapping support */
            line-height: 1.5;
        }

        .store-info-value a {
            color: #667eea;
            text-decoration: none;
            word-break: break-all;
            overflow-wrap: break-word;
        }

        .store-info-value a:hover {
            text-decoration: underline;
        }

        /* Category products section */
        .category-products-section {
            margin-top: 24px;
        }

        /* Loading state for categories/products */
        .category-products-loading {
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            padding: 60px 20px;
            background: white;
            border: 1px solid #e2e8f0;
            border-radius: 8px;
            min-height: 400px;
        }

        .category-products-loading-spinner {
            width: 48px;
            height: 48px;
            border: 4px solid #e2e8f0;
            border-top-color: #667eea;
            border-radius: 50%;
            animation: spin 1s linear infinite;
            margin-bottom: 16px;
        }

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

        .category-products-loading-text {
            color: #718096;
            font-size: 14px;
            font-weight: 500;
        }

        /* Two-column layout for categories and products */
        .categories-products-layout {
            display: grid;
            grid-template-columns: 300px 1fr;
            gap: 20px;
            margin-top: 16px;
        }

        /* Category tree sidebar */
        .category-tree-sidebar {
            background: white;
            border: 1px solid #e2e8f0;
            border-radius: 8px;
            padding: 16px;
            max-height: 600px;
            overflow-y: auto;
        }

        .category-tree-title {
            font-size: 14px;
            font-weight: 600;
            color: #1a202c;
            margin-bottom: 12px;
            padding-bottom: 8px;
            border-bottom: 1px solid #e2e8f0;
        }

        .category-tree-item {
            padding: 8px 12px;
            margin: 4px 0;
            border-radius: 6px;
            cursor: pointer;
            transition: all 0.2s;
            display: flex;
            align-items: center;
            justify-content: space-between;
            font-size: 13px;
        }

        .category-tree-item:hover {
            background: #f7fafc;
        }

        .category-tree-item.active {
            background: #667eea;
            color: white;
        }

        .category-tree-item.active .category-tree-count {
            background: rgba(255, 255, 255, 0.2);
            color: white;
        }

        .category-tree-item.main-category {
            font-weight: 600;
            padding-left: 12px;
        }

        .category-tree-item.subcategory {
            font-weight: 400;
            padding-left: 32px;
            font-size: 12px;
        }

        .category-tree-icon {
            margin-right: 8px;
            font-size: 14px;
        }

        .category-tree-name {
            flex: 1;
        }

        .category-tree-count {
            background: #e2e8f0;
            color: #4a5568;
            padding: 2px 8px;
            border-radius: 12px;
            font-size: 11px;
            font-weight: 600;
            min-width: 24px;
            text-align: center;
        }

        /* Products panel */
        .products-panel {
            background: white;
            border: 1px solid #e2e8f0;
            border-radius: 8px;
            padding: 16px;
            min-height: 400px;
        }

        .products-panel-header {
            display: flex;
            align-items: center;
            justify-content: space-between;
            margin-bottom: 16px;
            padding-bottom: 12px;
            border-bottom: 1px solid #e2e8f0;
        }

        .products-panel-title {
            font-size: 16px;
            font-weight: 600;
            color: #1a202c;
        }

        .products-panel-subtitle {
            font-size: 12px;
            color: #718096;
            margin-top: 4px;
        }

        .products-panel-empty {
            text-align: center;
            padding: 60px 20px;
            color: #718096;
        }

        .products-panel-empty-icon {
            font-size: 48px;
            margin-bottom: 12px;
            opacity: 0.5;
        }

        .category-card {
            background: white;
            border: 1px solid #e2e8f0;
            border-radius: 8px;
            padding: 16px;
            margin-bottom: 16px;
        }

        .category-card-header {
            display: flex;
            align-items: center;
            justify-content: space-between;
            margin-bottom: 12px;
            padding-bottom: 12px;
            border-bottom: 1px solid #e2e8f0;
        }

        .category-card-title {
            font-size: 16px;
            font-weight: 600;
            color: #1a202c;
        }

        .product-list {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
            gap: 12px;
            margin-top: 12px;
        }

        .product-item-card {
            background: #f7fafc;
            border: 1px solid #e2e8f0;
            border-radius: 6px;
            padding: 12px;
            padding-bottom: 44px;
        }

        .product-item-name {
            font-size: 13px;
            font-weight: 600;
            color: #1a202c;
            margin-bottom: 4px;
        }

        .product-item-sku {
            font-size: 11px;
            color: #718096;
            margin-bottom: 8px;
        }

        .variant-list {
            margin-top: 8px;
            padding-top: 8px;
            border-top: 1px solid #e2e8f0;
        }

        .variant-section summary {
            cursor: pointer;
            list-style: none;
            display: flex;
            align-items: center;
            gap: 8px;
            padding: 4px 0;
            user-select: none;
        }
        .variant-section summary::-webkit-details-marker { display: none; }
        .variant-section summary::before {
            content: '▶';
            font-size: 10px;
            color: #718096;
            transition: transform 0.2s;
        }
        .variant-section[open] summary::before {
            transform: rotate(90deg);
        }

        .variant-item {
            font-size: 11px;
            color: #4a5568;
            padding: 4px 0;
        }

        .metafield-info {
            margin-top: 12px;
            padding-top: 12px;
            border-top: 1px solid #e2e8f0;
        }

        .metafield-section summary {
            cursor: pointer;
            list-style: none;
            display: flex;
            align-items: center;
            gap: 8px;
            padding: 8px 0;
            user-select: none;
        }
        .metafield-section summary::-webkit-details-marker { display: none; }
        .metafield-section summary::before {
            content: '▶';
            font-size: 10px;
            color: #718096;
            transition: transform 0.2s;
        }
        .metafield-section[open] summary::before {
            transform: rotate(90deg);
        }

        .metafield-item {
            font-size: 11px;
            color: #718096;
            margin-top: 4px;
        }

        /* Delete Confirmation */
        .delete-confirm {
            display: none;
            position: fixed;
            z-index: 2001;
            left: 0;
            top: 0;
            width: 100%;
            height: 100%;
            background-color: rgba(0, 0, 0, 0.5);
            backdrop-filter: blur(4px);
            align-items: center;
            justify-content: center;
            padding: 20px;
        }

        .delete-confirm.active {
            display: flex;
        }

        .delete-confirm-content {
            background: white;
            border-radius: 12px;
            padding: 24px;
            max-width: 400px;
            width: 100%;
            box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
        }

        .delete-confirm-content h3 {
            margin: 0 0 12px 0;
            color: #dc2626;
            font-size: 20px;
            font-weight: 700;
        }

        .delete-confirm-content p {
            margin: 0 0 16px 0;
            color: #718096;
            line-height: 1.5;
        }

        .delete-confirm-actions {
            display: flex;
            justify-content: flex-end;
            gap: 12px;
            margin-top: 24px;
        }

        /* Responsive - Medium screens */
        @media (max-width: 1400px) {
            .details-grid {
                grid-template-columns: repeat(3, 1fr);
                gap: 20px;
            }
        }
        
        @media (max-width: 1200px) {
            .details-grid {
                grid-template-columns: repeat(2, 1fr);
                gap: 18px;
            }
        }

        /* Hamburger menu - visible on tablet/mobile */
        .sidebar-toggle {
            display: none;
            align-items: center;
            justify-content: center;
            width: 40px;
            height: 40px;
            padding: 0;
            background: #f7fafc;
            border: 1px solid #e2e8f0;
            border-radius: 8px;
            cursor: pointer;
            font-size: 20px;
            margin-right: 12px;
        }

        .sidebar-overlay {
            display: none;
            position: fixed;
            inset: 0;
            background: rgba(0, 0, 0, 0.4);
            z-index: 999;
            opacity: 0;
            transition: opacity 0.3s;
        }

        .sidebar-overlay.visible {
            opacity: 1;
        }

        /* Tablet breakpoint */
        @media (max-width: 1200px) {
            .content-area {
                padding: 24px 20px;
            }

            .top-header {
                padding: 12px 20px;
            }

            .page-title {
                font-size: 20px;
            }

            .header-right {
                flex-wrap: wrap;
                gap: 8px;
            }

            .btn-header {
                padding: 6px 12px;
                font-size: 13px;
            }
        }

        /* Responsive - Tablet and below */
        @media (max-width: 1024px) {
            .sidebar {
                transform: translateX(-100%);
                box-shadow: 4px 0 20px rgba(0, 0, 0, 0.15);
            }

            .sidebar.open {
                transform: translateX(0);
            }

            .sidebar-overlay {
                display: block;
            }

            .sidebar-toggle {
                display: flex;
            }

            .main-content-wrapper {
                margin-left: 0;
            }

            .content-area {
                padding: 20px 16px;
            }

            .top-header {
                padding: 12px 16px;
            }

            .deals-filters {
                padding: 16px;
            }

            .filters-row select,
            .filters-row input[type="date"] {
                min-width: 120px;
            }
        }

        /* Responsive - Small screens */
        @media (max-width: 768px) {
            .content-area {
                padding: 16px 12px;
            }

            .top-header {
                padding: 12px;
                flex-wrap: wrap;
                gap: 12px;
            }

            .header-left {
                flex: 1;
                min-width: 0;
            }

            .page-title {
                font-size: 18px;
            }

            .deals-grid {
                grid-template-columns: 1fr;
            }

            .stats-grid {
                grid-template-columns: 1fr;
                gap: 12px;
                margin-bottom: 20px;
            }

            .stat-card {
                padding: 12px 14px;
            }
            .stats-grid {
                flex-wrap: wrap;
            }

            .stat-value {
                font-size: 24px;
            }

            .modal-content.modal-large {
                width: 95vw !important;
                max-width: 95vw !important;
                max-height: 95vh !important;
            }
            
            .modal-content.modal-large .modal-body.modal-scrollable {
                max-height: calc(95vh - 180px);
            }
            
            .details-grid {
                grid-template-columns: 1fr;
                gap: 16px;
            }
            
            #dealInfoDetails {
                grid-template-columns: 1fr;
                gap: 20px;
            }

            .products-grid {
                grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
                gap: 12px;
            }

            .modal-footer {
                flex-direction: column;
                gap: 12px;
            }

            .modal-footer > div {
                width: 100%;
                flex-direction: column;
            }

            .deal-details-header-sticky {
                flex-direction: column;
                align-items: stretch;
            }

            .deal-details-header-actions {
                width: 100%;
                flex-direction: column;
                gap: 12px;
            }

            .deal-details-header-actions .btn-action {
                width: 100%;
            }

            .deals-table-container {
                overflow-x: auto;
                -webkit-overflow-scrolling: touch;
                margin: 0 -12px;
                border-radius: 0;
                border-left: none;
                border-right: none;
            }

            .deals-table {
                min-width: 0;
            }

            .filters-row {
                flex-direction: column;
                align-items: stretch;
            }

            .filters-row select,
            .filters-row input[type="date"],
            .filters-row button {
                width: 100%;
                min-width: 0;
            }

            .deals-filters {
                padding: 12px;
            }

            .card-header,
            .card-body {
                padding: 16px;
            }
        }

        /* Extra small screens */
        @media (max-width: 480px) {
            .content-area {
                padding: 12px 8px;
            }

            .top-header {
                padding: 10px;
            }

            .btn-header {
                padding: 6px 10px;
                font-size: 12px;
            }

            .sidebar-toggle {
                width: 36px;
                height: 36px;
                font-size: 18px;
            }
        }

/* === Droid Assignment Modal === */
        #droidAssignmentModal .droid-color-select option {
            padding: 8px 12px !important;
        }
        #droidAssignmentModal .droid-color-option:hover {
            background: #f1f5f9 !important;
        }
        #droidAssignmentModal .droid-thumbnail-canvas {
            width: 100% !important;
            height: auto !important;
            aspect-ratio: 2 / 1;
            display: block;
            object-fit: contain;
        }
        #droidAssignmentModal .droid-thumb-spinner {
            pointer-events: none;
        }
        /* Flex-center fabric's .canvas-container within the design wrapper.
           Dynaviewer sizes the canvas-container to the design's own aspect ratio, which
           may differ from the wrapper's aspect ratio. Centering ensures the design is
           always in the middle of the overlay regardless of design shape. */
        #droidModalDesignWrapper {
            align-items: center;
            justify-content: center;
        }
        #droidModalDesignWrapper > .canvas-container {
            position: relative !important;
            flex-shrink: 0;
            left: auto !important;
            top: auto !important;
        }
        #droidModalDesignWrapper > .canvas-container canvas {
            left: 0 !important;
            top: 0 !important;
        }
