
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
            background: #f0f2f5;
            min-height: 100vh;
        }

        .hidden {
            display: none !important;
        }

        /* ========== LOGIN STYLES ========== */
        .login-container {
            display: flex;
            justify-content: center;
            align-items: center;
            min-height: 100vh;
            padding: 20px;
            background:
                radial-gradient(circle at 20% 50%, rgba(59, 130, 246, 0.15) 0%, transparent 50%),
                radial-gradient(circle at 80% 20%, rgba(99, 102, 241, 0.15) 0%, transparent 40%),
                radial-gradient(circle at 40% 80%, rgba(14, 165, 233, 0.1) 0%, transparent 45%),
                linear-gradient(135deg, #0a1628 0%, #1a237e 50%, #0d47a1 100%);
        }

        .login-container::before {
            content: '';
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background-image:
                radial-gradient(circle at 25% 25%, rgba(59, 130, 246, 0.4) 1px, transparent 1px),
                radial-gradient(circle at 75% 75%, rgba(99, 102, 241, 0.3) 1px, transparent 1px);
            background-size: 60px 60px, 80px 80px;
            pointer-events: none;
            z-index: 0;
        }

        .login-box {
            background: white;
            padding: 40px;
            border-radius: 16px;
            box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
            width: 100%;
            max-width: 420px;
            position: relative;
            z-index: 1;
        }

        .login-logo {
            text-align: center;
            margin-bottom: 30px;
        }

        .login-logo h1 {
            color: #1a237e;
            font-size: 1.5em;
            margin-bottom: 5px;
        }

        .login-logo p {
            color: #666;
            font-size: 0.9em;
        }

        .form-group {
            margin-bottom: 20px;
        }

        .form-group label {
            display: block;
            margin-bottom: 8px;
            font-weight: 600;
            color: #333;
        }

        .form-group input {
            width: 100%;
            padding: 12px 15px;
            border: 2px solid #e0e0e0;
            border-radius: 8px;
            font-size: 15px;
            transition: border-color 0.3s, box-shadow 0.3s;
        }

        .form-group input:focus {
            outline: none;
            border-color: #1a237e;
            box-shadow: 0 0 0 3px rgba(26, 35, 126, 0.1);
        }

        .btn {
            background: linear-gradient(135deg, #1a237e 0%, #0d47a1 100%);
            color: white;
            border: none;
            padding: 14px 30px;
            border-radius: 8px;
            font-size: 16px;
            font-weight: 600;
            cursor: pointer;
            width: 100%;
            transition: transform 0.2s, box-shadow 0.2s;
            box-shadow: 0 4px 15px rgba(26, 35, 126, 0.3);
        }

        .btn:hover {
            transform: translateY(-2px);
            box-shadow: 0 6px 20px rgba(26, 35, 126, 0.4);
        }

        .btn:disabled {
            opacity: 0.7;
            cursor: not-allowed;
            transform: none;
        }

        .btn-secondary {
            background: transparent;
            color: #1a237e;
            border: 2px solid #1a237e;
            box-shadow: none;
            margin-top: 10px;
        }

        .btn-secondary:hover {
            background: #f5f5f5;
            box-shadow: none;
            transform: none;
        }

        .forgot-password {
            text-align: center;
            margin-top: 20px;
        }

        .forgot-password a {
            color: #1a237e;
            text-decoration: none;
            font-size: 0.9em;
        }

        .alert {
            padding: 12px 15px;
            border-radius: 8px;
            margin-bottom: 20px;
            font-size: 0.9em;
        }

        .alert-error {
            background: #ffebee;
            color: #c62828;
            border: 1px solid #ef9a9a;
        }

        .alert-success {
            background: #e8f5e9;
            color: #2e7d32;
            border: 1px solid #a5d6a7;
        }

        /* ========== DASHBOARD LAYOUT ========== */
        .app-container {
            display: flex;
            min-height: 100vh;
        }

        /* ========== SIDEBAR ========== */
        .sidebar {
            width: 240px;
            background: linear-gradient(180deg, #0a1628 0%, #1a237e 100%);
            color: white;
            display: flex;
            flex-direction: column;
            position: fixed;
            height: 100vh;
            z-index: 100;
            transition: transform 0.3s ease;
        }

        .sidebar-header {
            padding: 20px;
            border-bottom: 1px solid rgba(255, 255, 255, 0.1);
        }

        .sidebar-logo {
            display: flex;
            align-items: center;
            gap: 10px;
            font-size: 1.3em;
            font-weight: 700;
        }

        .sidebar-logo span {
            font-size: 1.5em;
        }

        .sidebar-nav {
            flex: 1;
            padding: 20px 0;
        }

        .nav-item {
            display: flex;
            align-items: center;
            gap: 12px;
            padding: 14px 20px;
            color: rgba(255, 255, 255, 0.7);
            text-decoration: none;
            cursor: pointer;
            transition: all 0.2s;
            border-left: 3px solid transparent;
        }

        .nav-item:hover {
            background: rgba(255, 255, 255, 0.1);
            color: white;
        }

        .nav-item.active {
            background: rgba(255, 255, 255, 0.15);
            color: white;
            border-left-color: #42a5f5;
        }

        .nav-item .nav-icon {
            font-size: 1.2em;
            width: 24px;
            text-align: center;
        }

        .nav-item .nav-text {
            font-size: 0.95em;
        }

        .nav-divider {
            height: 1px;
            background: rgba(255, 255, 255, 0.1);
            margin: 15px 20px;
        }

        .sidebar-footer {
            padding: 20px;
            border-top: 1px solid rgba(255, 255, 255, 0.1);
        }

        .user-profile {
            display: flex;
            align-items: center;
            gap: 12px;
            margin-bottom: 15px;
        }

        .user-avatar {
            width: 40px;
            height: 40px;
            background: rgba(255, 255, 255, 0.2);
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 1.2em;
        }

        .user-details {
            flex: 1;
            min-width: 0;
        }

        .user-details .user-name {
            font-weight: 600;
            font-size: 0.9em;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }

        .user-details .user-role {
            font-size: 0.75em;
            opacity: 0.8;
            background: rgba(255, 255, 255, 0.2);
            padding: 2px 8px;
            border-radius: 10px;
            display: inline-block;
            margin-top: 3px;
        }

        .btn-logout {
            width: 100%;
            background: rgba(255, 255, 255, 0.1);
            border: 1px solid rgba(255, 255, 255, 0.2);
            color: white;
            padding: 10px;
            border-radius: 6px;
            cursor: pointer;
            font-size: 0.85em;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 8px;
            transition: background 0.2s;
        }

        .btn-logout:hover {
            background: rgba(255, 255, 255, 0.2);
        }

        /* ========== MAIN CONTENT ========== */
        .main-content {
            flex: 1;
            margin-left: 240px;
            padding: 20px 30px;
            min-height: 100vh;
        }

        /* Mobile menu button */
        .mobile-menu-btn {
            display: none;
            position: fixed;
            top: 15px;
            left: 15px;
            z-index: 101;
            background: #1a237e;
            color: white;
            border: none;
            width: 45px;
            height: 45px;
            border-radius: 8px;
            font-size: 1.5em;
            cursor: pointer;
            box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
        }

        .sidebar-overlay {
            display: none;
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(0, 0, 0, 0.5);
            z-index: 99;
        }

        /* ========== SECTION HEADER ========== */
        .section-header {
            margin-bottom: 25px;
        }

        .section-header h1 {
            color: #1a237e;
            font-size: 1.8em;
            margin-bottom: 5px;
        }

        .section-header p {
            color: #666;
            font-size: 0.95em;
        }

        /* ========== FILTERS PANEL ========== */
        .filters-panel {
            background: white;
            padding: 20px;
            border-radius: 12px;
            box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
            margin-bottom: 20px;
        }

        .filters-panel h3 {
            margin-bottom: 15px;
            color: #1a237e;
            font-size: 1em;
            display: flex;
            align-items: center;
            gap: 8px;
        }

        .filters-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
            gap: 15px;
            align-items: end;
        }

        .filter-group {
            display: flex;
            flex-direction: column;
        }

        .filter-group label {
            margin-bottom: 5px;
            font-weight: 600;
            color: #333;
            font-size: 0.85em;
        }

        .filter-group select,
        .filter-group input {
            padding: 10px;
            border: 2px solid #e0e0e0;
            border-radius: 6px;
            font-size: 14px;
            transition: border-color 0.2s;
        }

        .filter-group select:focus,
        .filter-group input:focus {
            outline: none;
            border-color: #1a237e;
        }

        .btn-filter {
            background: linear-gradient(135deg, #1a237e 0%, #0d47a1 100%);
            color: white;
            border: none;
            padding: 10px 20px;
            border-radius: 6px;
            cursor: pointer;
            font-weight: 600;
            font-size: 0.9em;
            transition: transform 0.2s;
        }

        .btn-filter:hover {
            transform: translateY(-1px);
        }

        /* Multi-select */
        .multi-select-container {
            position: relative;
            width: 100%;
        }

        .multi-select-display {
            min-height: 42px;
            padding: 8px 35px 8px 10px;
            border: 2px solid #e0e0e0;
            border-radius: 6px;
            background: white;
            cursor: pointer;
            display: flex;
            flex-wrap: wrap;
            gap: 5px;
            align-items: center;
            position: relative;
        }

        .multi-select-display:hover {
            border-color: #1a237e;
        }

        .multi-select-display::after {
            content: '▼';
            position: absolute;
            right: 12px;
            top: 50%;
            transform: translateY(-50%);
            font-size: 0.7em;
            color: #666;
        }

        .multi-select-placeholder {
            color: #999;
            font-size: 0.9em;
        }

        .chip {
            background: linear-gradient(135deg, #1a237e 0%, #0d47a1 100%);
            color: white;
            padding: 4px 8px;
            border-radius: 15px;
            font-size: 0.8em;
            display: flex;
            align-items: center;
            gap: 5px;
        }

        .chip-remove {
            cursor: pointer;
            font-weight: bold;
            opacity: 0.8;
        }

        .chip-remove:hover {
            opacity: 1;
        }

        .multi-select-dropdown {
            position: absolute;
            top: 100%;
            left: 0;
            right: 0;
            background: white;
            border: 2px solid #1a237e;
            border-top: none;
            border-radius: 0 0 6px 6px;
            max-height: 200px;
            overflow-y: auto;
            z-index: 100;
            display: none;
            box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
        }

        .multi-select-dropdown.open {
            display: block;
        }

        .multi-select-option {
            padding: 10px 15px;
            cursor: pointer;
            display: flex;
            align-items: center;
            gap: 10px;
        }

        .multi-select-option:hover {
            background: #e3f2fd;
        }

        .multi-select-option input[type="checkbox"] {
            width: 16px;
            height: 16px;
        }

        .select-all-option {
            border-bottom: 1px solid #e0e0e0;
            font-weight: 600;
            background: #f5f5f5;
        }

        /* ========== KPI CARDS ========== */
        .cards-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
            gap: 20px;
            margin-bottom: 25px;
        }

        .card {
            background: white;
            padding: 20px;
            border-radius: 12px;
            box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
            text-align: center;
        }

        .card-value {
            font-size: 2.2em;
            font-weight: 700;
            color: #1a237e;
            margin-bottom: 5px;
        }

        .card-label {
            color: #666;
            font-size: 0.8em;
            text-transform: uppercase;
            letter-spacing: 1px;
        }

        /* ========== CHARTS ========== */
        .charts-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
            gap: 20px;
            margin-bottom: 25px;
        }

        .chart-panel {
            background: white;
            padding: 20px;
            border-radius: 12px;
            box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
        }

        .chart-panel h3 {
            margin-bottom: 15px;
            color: #1a237e;
            font-size: 1em;
        }

        /* ========== DATA TABLE ========== */
        .data-panel {
            background: white;
            border-radius: 12px;
            box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
            overflow: hidden;
            margin-bottom: 25px;
        }

        .data-panel-header {
            padding: 15px 20px;
            border-bottom: 1px solid #e0e0e0;
            display: flex;
            justify-content: space-between;
            align-items: center;
            flex-wrap: wrap;
            gap: 10px;
        }

        .data-panel-header h3 {
            color: #1a237e;
            font-size: 1em;
        }

        .data-count {
            background: #e3f2fd;
            color: #1565c0;
            padding: 4px 12px;
            border-radius: 15px;
            font-size: 0.85em;
            font-weight: 600;
        }

        .export-buttons {
            display: flex;
            gap: 8px;
        }

        .btn-export {
            padding: 8px 14px;
            border-radius: 6px;
            cursor: pointer;
            font-weight: 600;
            font-size: 0.8em;
            border: none;
            transition: transform 0.2s;
        }

        .btn-export:hover {
            transform: translateY(-1px);
        }

        .btn-export.csv {
            background: #4caf50;
            color: white;
        }

        .btn-export.excel {
            background: #2e7d32;
            color: white;
        }

        .btn-export.pdf {
            background: #c62828;
            color: white;
        }

        .table-container {
            overflow-x: auto;
            max-height: 500px;
            overflow-y: auto;
        }

        table {
            width: 100%;
            border-collapse: collapse;
        }

        th,
        td {
            padding: 12px 15px;
            text-align: left;
            border-bottom: 1px solid #e0e0e0;
        }

        th {
            background: #f5f5f5;
            font-weight: 600;
            color: #333;
            position: sticky;
            top: 0;
            z-index: 10;
            user-select: none;
            /* Prevent text selection while dragging */
        }

        .resizer {
            position: absolute;
            top: 0;
            right: 0;
            width: 5px;
            cursor: col-resize;
            user-select: none;
            height: 100%;
            z-index: 11;
        }

        .resizer:hover,
        .resizing {
            background-color: #2196f3;
        }

        tr:hover {
            background: #fafafa;
        }

        .message-cell {
            /* max-width removed to allow manual resizing */
            white-space: normal;
            word-break: break-word;
            overflow-wrap: break-word;
        }

        .clip-cell {
            /* max-width removed to allow manual resizing */
            white-space: normal;
            word-break: break-word;
            overflow-wrap: break-word;
            display: block;
            /* changed from inline-block to fill cell width */
            width: 100%;
        }

        .sidebar-logo img {
            max-height: 40px;
        }

        .type-badge {
            display: inline-block;
            padding: 3px 10px;
            border-radius: 12px;
            font-size: 0.8em;
            font-weight: 600;
        }

        .type-badge.human {
            background: #e3f2fd;
            color: #1565c0;
        }

        .type-badge.ai {
            background: #f3e5f5;
            color: #7b1fa2;
        }

        .rating-badge {
            display: inline-flex;
            align-items: center;
            gap: 3px;
            font-weight: 600;
        }

        /* Pagination */
        .pagination {
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 10px;
            padding: 15px 20px;
            border-top: 1px solid #e0e0e0;
            background: #fafafa;
            flex-wrap: wrap;
        }

        .pagination-btn {
            background: linear-gradient(135deg, #1a237e 0%, #0d47a1 100%);
            color: white;
            border: none;
            width: 36px;
            height: 36px;
            border-radius: 6px;
            cursor: pointer;
            font-size: 0.9em;
        }

        .pagination-btn:disabled {
            opacity: 0.4;
            cursor: not-allowed;
        }

        .pagination-info {
            font-size: 0.9em;
            color: #333;
        }

        .pagination-select {
            padding: 8px 12px;
            border: 2px solid #e0e0e0;
            border-radius: 6px;
            font-size: 0.85em;
        }

        /* ========== TOPICS SECTION ========== */
        .topics-stats {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
            gap: 15px;
            margin-bottom: 20px;
        }

        .topic-stat-card {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            color: white;
            padding: 20px;
            border-radius: 12px;
            text-align: center;
        }

        .topic-stat-card.secondary {
            background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
        }

        .topic-stat-card.tertiary {
            background: linear-gradient(135deg, #ee9ca7 0%, #ffdde1 100%);
            color: #333;
        }

        .topic-stat-value {
            font-size: 2em;
            font-weight: 700;
        }

        .topic-stat-label {
            font-size: 0.85em;
            opacity: 0.9;
        }

        /* ========== CONFIG SECTION ========== */
        .config-placeholder {
            background: white;
            padding: 60px 40px;
            border-radius: 12px;
            text-align: center;
            box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
        }

        .config-placeholder .icon {
            font-size: 4em;
            margin-bottom: 20px;
        }

        .config-placeholder h2 {
            color: #1a237e;
            margin-bottom: 10px;
        }

        .config-placeholder p {
            color: #666;
            max-width: 400px;
            margin: 0 auto;
        }

        /* Loading */
        .loading {
            display: flex;
            justify-content: center;
            align-items: center;
            padding: 40px;
        }

        .spinner {
            width: 40px;
            height: 40px;
            border: 4px solid #e0e0e0;
            border-top-color: #1a237e;
            border-radius: 50%;
            animation: spin 1s linear infinite;
        }

        @keyframes spin {
            to {
                transform: rotate(360deg);
            }
        }

        /* ========== RESPONSIVE ========== */
        @media (max-width: 900px) {
            .sidebar {
                transform: translateX(-100%);
            }

            .sidebar.open {
                transform: translateX(0);
            }

            .sidebar-overlay.open {
                display: block;
            }

            .mobile-menu-btn {
                display: flex;
                align-items: center;
                justify-content: center;
            }

            .main-content {
                margin-left: 0;
                padding: 70px 15px 20px;
            }

            .charts-grid {
                grid-template-columns: 1fr;
            }

            .cards-grid {
                grid-template-columns: repeat(2, 1fr);
            }

            .filters-grid {
                grid-template-columns: 1fr;
            }

            .filter-group {
                min-width: 100% !important;
            }

            .section-header h1 {
                font-size: 1.4em;
            }

            .section-header p {
                font-size: 0.85em;
            }

            .topics-stats {
                grid-template-columns: repeat(3, 1fr);
                gap: 10px;
            }

            .topic-stat-card {
                padding: 15px 10px;
            }

            .topic-stat-value {
                font-size: 1.5em;
            }

            .topic-stat-label {
                font-size: 0.7em;
            }

            .data-panel-header {
                flex-direction: column;
                align-items: flex-start;
                gap: 10px;
            }

            .export-buttons {
                width: 100%;
                justify-content: flex-start;
            }

            .btn-export {
                flex: 1;
                text-align: center;
                padding: 10px 8px;
                font-size: 0.75em;
            }

            .table-container {
                font-size: 0.85em;
            }

            th,
            td {
                padding: 8px 10px;
            }

            .pagination {
                gap: 5px;
            }

            .pagination-info {
                font-size: 0.8em;
                order: -1;
                width: 100%;
                text-align: center;
                margin-bottom: 10px;
            }

            .config-section {
                padding: 15px;
            }

            .stopwords-container {
                max-height: 150px;
            }

            .stopword-tag {
                font-size: 0.75em;
                padding: 4px 8px;
            }
        }

        @media (max-width: 500px) {
            .cards-grid {
                grid-template-columns: 1fr;
            }

            .topics-stats {
                grid-template-columns: 1fr;
            }

            .topic-stat-card {
                padding: 20px;
            }

            .topic-stat-value {
                font-size: 2em;
            }

            .topic-stat-label {
                font-size: 0.85em;
            }
        }

        /* ========== CONFIG SECTION STYLES ========== */
        .config-section {
            background: white;
            padding: 25px;
            border-radius: 12px;
            box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
            margin-bottom: 20px;
        }

        .config-section h3 {
            color: #1a237e;
            margin-bottom: 15px;
            display: flex;
            align-items: center;
            gap: 10px;
        }

        .config-description {
            color: #666;
            font-size: 0.9em;
            margin-bottom: 20px;
        }

        .stopwords-container {
            display: flex;
            flex-wrap: wrap;
            gap: 8px;
            max-height: 200px;
            overflow-y: auto;
            padding: 15px;
            background: #f5f5f5;
            border-radius: 8px;
            margin-bottom: 15px;
        }

        .stopword-tag {
            background: #e3f2fd;
            color: #1565c0;
            padding: 5px 10px;
            border-radius: 15px;
            font-size: 0.85em;
            display: flex;
            align-items: center;
            gap: 5px;
        }

        .stopword-tag.custom {
            background: #fff3e0;
            color: #e65100;
        }

        .stopword-tag .remove-btn {
            cursor: pointer;
            font-weight: bold;
            opacity: 0.7;
            margin-left: 3px;
        }

        .stopword-tag .remove-btn:hover {
            opacity: 1;
        }

        .add-stopword-form {
            display: flex;
            gap: 10px;
            margin-top: 15px;
        }

        .add-stopword-form input {
            flex: 1;
            padding: 10px 15px;
            border: 2px solid #e0e0e0;
            border-radius: 6px;
            font-size: 14px;
        }

        .add-stopword-form input:focus {
            outline: none;
            border-color: #1a237e;
        }

        .add-stopword-form button {
            padding: 10px 20px;
            background: linear-gradient(135deg, #1a237e 0%, #0d47a1 100%);
            color: white;
            border: none;
            border-radius: 6px;
            cursor: pointer;
            font-weight: 600;
        }

        .config-actions {
            display: flex;
            gap: 10px;
            margin-top: 20px;
            padding-top: 20px;
            border-top: 1px solid #e0e0e0;
        }

        .btn-config {
            padding: 10px 20px;
            border-radius: 6px;
            cursor: pointer;
            font-weight: 600;
            font-size: 0.9em;
            border: none;
            transition: transform 0.2s;
        }

        .btn-config:hover {
            transform: translateY(-1px);
        }

        .btn-config.primary {
            background: linear-gradient(135deg, #1a237e 0%, #0d47a1 100%);
            color: white;
        }

        .btn-config.secondary {
            background: #78909c;
            color: white;
        }

        .btn-config.danger {
            background: #c62828;
            color: white;
        }

        .stats-badge {
            background: #e8f5e9;
            color: #2e7d32;
            padding: 3px 10px;
            border-radius: 10px;
            font-size: 0.8em;
            font-weight: normal;
        }
    