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

        body {
            font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
            background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
            min-height: 100vh;
            color: #e2e8f0;
            padding: 20px;
        }

        .container { max-width: 1400px; margin: 0 auto; }

        header { text-align: center; padding: 30px 0; margin-bottom: 30px; }
        header h1 {
            font-size: 2.5rem; font-weight: 700;
            background: linear-gradient(90deg, #60a5fa, #a78bfa);
            -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
            margin-bottom: 10px;
        }
        header p { color: #94a3b8; font-size: 1.1rem; }

        .stats-bar {
            display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
            gap: 15px; margin-bottom: 30px;
        }
        .stat-card {
            background: rgba(30, 41, 59, 0.8); border: 1px solid rgba(148, 163, 184, 0.1);
            border-radius: 12px; padding: 20px; text-align: center;
            backdrop-filter: blur(10px); transition: transform 0.2s, box-shadow 0.2s;
        }
        .stat-card:hover { transform: translateY(-2px); box-shadow: 0 10px 40px rgba(0,0,0,0.3); }
        .stat-card .number { font-size: 2rem; font-weight: 700; color: #60a5fa; }
        .stat-card .label { font-size: 0.875rem; color: #94a3b8; margin-top: 5px; text-transform: uppercase; letter-spacing: 0.05em; }

        .controls {
            display: flex; flex-wrap: wrap; gap: 15px; margin-bottom: 25px; align-items: center;
        }
        .search-box { flex: 1; min-width: 250px; position: relative; }
        .search-box input {
            width: 100%; padding: 12px 40px 12px 45px;
            border: 1px solid rgba(148, 163, 184, 0.2); border-radius: 10px;
            background: rgba(15, 23, 42, 0.6); color: #e2e8f0; font-size: 0.95rem;
            outline: none; transition: border-color 0.2s;
        }
        .search-box input:focus { border-color: #60a5fa; }
        .search-box::before { content: "🔍"; position: absolute; left: 15px; top: 50%; transform: translateY(-50%); font-size: 1rem; }

        .search-box .clear-btn {
            position: absolute;
            right: 12px;
            top: 50%;
            transform: translateY(-50%);
            background: rgba(148, 163, 184, 0.2);
            border: none;
            border-radius: 50%;
            width: 22px;
            height: 22px;
            color: #94a3b8;
            font-size: 0.75rem;
            cursor: pointer;
            display: none;
            align-items: center;
            justify-content: center;
            transition: all 0.2s;
            padding: 0;
            line-height: 1;
        }
        .search-box .clear-btn:hover {
            background: rgba(239, 68, 68, 0.3);
            color: #f87171;
        }
        .search-box .clear-btn.show {
            display: flex;
        }

        .filter-select {
            padding: 12px 15px; border: 1px solid rgba(148, 163, 184, 0.2); border-radius: 10px;
            background: rgba(15, 23, 42, 0.6); color: #e2e8f0; font-size: 0.95rem;
            outline: none; cursor: pointer; min-width: 150px;
        }
        .filter-select:focus { border-color: #60a5fa; }

        .date-range-group {
            display: flex; align-items: center; gap: 8px;
            background: rgba(15, 23, 42, 0.6); border: 1px solid rgba(148, 163, 184, 0.2);
            border-radius: 10px; padding: 8px 12px;
        }
        .date-range-group label {
            font-size: 0.8rem; color: #94a3b8; text-transform: uppercase; white-space: nowrap;
        }
        .date-range-group input[type="date"] {
            background: transparent; color: #e2e8f0; border: 1px solid rgba(148, 163, 184, 0.3);
            border-radius: 6px; padding: 4px 8px; font-size: 0.9rem; outline: none;
            color-scheme: dark;
        }
        .date-range-group input[type="date"]:focus { border-color: #60a5fa; }

        .btn {
            padding: 12px 24px; border: none; border-radius: 10px;
            background: linear-gradient(135deg, #3b82f6, #8b5cf6); color: white;
            font-weight: 600; cursor: pointer; transition: all 0.2s; font-size: 0.95rem;
        }
        .btn:hover { transform: translateY(-1px); box-shadow: 0 5px 20px rgba(59, 130, 246, 0.4); }
        .btn-secondary { background: rgba(148, 163, 184, 0.15); border: 1px solid rgba(148, 163, 184, 0.2); }
        .btn-secondary:hover { background: rgba(148, 163, 184, 0.25); box-shadow: none; }
        .btn-success { background: linear-gradient(135deg, #22c55e, #16a34a); }
        .btn-success:hover { box-shadow: 0 5px 20px rgba(34, 197, 94, 0.4); }
        .btn-danger { background: linear-gradient(135deg, #ef4444, #dc2626); }
        .btn-danger:hover { box-shadow: 0 5px 20px rgba(239, 68, 68, 0.4); }

        .table-wrapper {
            background: rgba(30, 41, 59, 0.6); border: 1px solid rgba(148, 163, 184, 0.1);
            border-radius: 16px; overflow: hidden; backdrop-filter: blur(10px);
        }
        .table-header {
            display: flex; justify-content: space-between; align-items: center;
            padding: 15px 25px; border-bottom: 1px solid rgba(148, 163, 184, 0.1);
        }
        .table-header h2 { font-size: 1.1rem; font-weight: 600; color: #cbd5e1; }
        .last-updated { font-size: 0.8rem; color: #64748b; }

        .table-container { overflow-x: auto; max-height: 600px; overflow-y: auto; }

        table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
        thead { position: sticky; top: 0; z-index: 10; }
        th {
            background: rgba(15, 23, 42, 0.95); padding: 14px 16px; text-align: left;
            font-weight: 600; color: #94a3b8; text-transform: uppercase; font-size: 0.75rem;
            letter-spacing: 0.05em; border-bottom: 2px solid rgba(148, 163, 184, 0.15);
            white-space: nowrap;  transition: color 0.2s;
        }
        th:hover { color: #e2e8f0; }
        th .sort-icon { margin-left: 5px; opacity: 0.5; font-size: 0.7rem; }
        th.sort-asc .sort-icon::after { content: " ▲"; }
        th.sort-desc .sort-icon::after { content: " ▼"; }

        td {
            padding: 8px 16px; border-bottom: 1px solid rgba(148, 163, 184, 0.05);
            color: #cbd5e1; white-space: normal; position: relative;
        }
        td .cell-text { display: inline-block; min-width: 40px; min-height: 20px; }

        tbody tr { transition: background 0.15s; }
        tbody tr:hover { background: rgba(59, 130, 246, 0.08); }
        tbody tr:nth-child(even) { background: rgba(15, 23, 42, 0.2); }
        tbody tr:nth-child(even):hover { background: rgba(59, 130, 246, 0.12); }
        tbody tr.deleting { opacity: 0.4; pointer-events: none; }

        .row-actions { display: flex; gap: 6px; }
        .row-actions button {
            padding: 4px 10px; border: none; border-radius: 6px; font-size: 0.75rem;
            cursor: pointer; transition: all 0.2s; font-weight: 600;
        }
        .row-actions .btn-edit { background: rgba(59, 130, 246, 0.2); color: #60a5fa; }
        .row-actions .btn-edit:hover { background: rgba(59, 130, 246, 0.4); }
        .row-actions .btn-del { background: rgba(239, 68, 68, 0.2); color: #f87171; }
        .row-actions .btn-del:hover { background: rgba(239, 68, 68, 0.4); }

        .loading { text-align: center; padding: 60px 20px; }
        .loading-spinner {
            width: 40px; height: 40px; border: 3px solid rgba(96, 165, 250, 0.2);
            border-top-color: #60a5fa; border-radius: 50%;
            animation: spin 0.8s linear infinite; margin: 0 auto 20px;
        }
        @keyframes spin { to { transform: rotate(360deg); } }

        .error { text-align: center; padding: 60px 20px; color: #f87171; }
        .error-icon { font-size: 3rem; margin-bottom: 15px; }
        .empty { text-align: center; padding: 60px 20px; color: #64748b; }

        .pagination {
            display: flex; justify-content: center; align-items: center;
            gap: 10px; padding: 20px; border-top: 1px solid rgba(148, 163, 184, 0.1);
        }
        .pagination button {
            padding: 8px 16px; border: 1px solid rgba(148, 163, 184, 0.2); border-radius: 8px;
            background: rgba(15, 23, 42, 0.6); color: #e2e8f0; cursor: pointer; transition: all 0.2s;
        }
        .pagination button:hover:not(:disabled) { background: rgba(59, 130, 246, 0.2); border-color: #60a5fa; }
        .pagination button:disabled { opacity: 0.4; cursor: not-allowed; }
        .pagination .page-info { color: #94a3b8; font-size: 0.9rem; }

        .badge {
            display: inline-block; padding: 3px 10px; border-radius: 20px;
            font-size: 0.75rem; font-weight: 600;
        }
        .badge-site-a { background: rgba(59, 130, 246, 0.2); color: #60a5fa; }
        .badge-site-b { background: rgba(168, 85, 247, 0.2); color: #c084fc; }
        .badge-site-c { background: rgba(34, 197, 94, 0.2); color: #4ade80; }

        .toast {
            position: fixed; bottom: 30px; right: 30px;
            padding: 16px 24px; border-radius: 12px; font-weight: 600;
            box-shadow: 0 10px 40px rgba(0,0,0,0.4); z-index: 1000;
            transform: translateY(100px); opacity: 0; transition: all 0.3s ease;
        }
        .toast.show { transform: translateY(0); opacity: 1; }
        .toast.success { background: linear-gradient(135deg, #22c55e, #16a34a); color: white; }
        .toast.error { background: linear-gradient(135deg, #ef4444, #dc2626); color: white; }

        .modal-overlay {
            position: fixed; inset: 0; background: rgba(0,0,0,0.7);
            display: none; justify-content: center; align-items: center; z-index: 999;
            backdrop-filter: blur(5px);
        }
        .modal-overlay.show { display: flex; }
        .modal {
            background: #1e293b; border: 1px solid rgba(148, 163, 184, 0.2);
            border-radius: 16px; padding: 30px; width: 90%; max-width: 700px;
            max-height: 90vh; overflow-y: auto;
        }
        .modal h3 { font-size: 1.3rem; margin-bottom: 20px; color: #e2e8f0; }
        .modal .form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }
        .modal .form-group { margin-bottom: 15px; }
        .modal label { display: block; font-size: 0.85rem; color: #94a3b8; margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.03em; }
        .modal label .required { color: #f87171; margin-left: 2px; }
        .modal input, .modal select, .modal textarea {
            width: 100%; padding: 10px 14px; border: 1px solid rgba(148, 163, 184, 0.2);
            border-radius: 8px; background: rgba(15, 23, 42, 0.6); color: #e2e8f0;
            font-size: 0.95rem; outline: none;
        }
        .modal input.error-field, .modal select.error-field, .modal textarea.error-field {
            border-color: #f87171;
            box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.2);
        }
        .modal input[type="date"] { color-scheme: dark; }
        .modal input:focus, .modal select:focus, .modal textarea:focus { border-color: #60a5fa; }
        .modal textarea { min-height: 80px; resize: vertical; }
        .modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }
        .modal .validation-msg {
            color: #f87171; font-size: 0.85rem; margin-top: 10px; text-align: center;
        }

        /* Delete confirmation row preview */
        .delete-preview {
            background: rgba(239, 68, 68, 0.1);
            border: 1px solid rgba(239, 68, 68, 0.3);
            border-radius: 12px;
            padding: 20px;
            margin: 20px 0;
        }
        .delete-preview h4 {
            color: #f87171;
            font-size: 1rem;
            margin-bottom: 15px;
            text-align: center;
        }
        .delete-preview .preview-row {
            display: grid;
            grid-template-columns: repeat(2, 1fr);
            gap: 10px;
        }
        .delete-preview .preview-item {
            background: rgba(15, 23, 42, 0.6);
            padding: 10px 14px;
            border-radius: 8px;
            border: 1px solid rgba(148, 163, 184, 0.1);
        }
        .delete-preview .preview-item .preview-label {
            font-size: 0.7rem;
            color: #94a3b8;
            text-transform: uppercase;
            letter-spacing: 0.05em;
            margin-bottom: 4px;
        }
        .delete-preview .preview-item .preview-value {
            font-size: 0.95rem;
            color: #e2e8f0;
            font-weight: 500;
        }
        .delete-warning {
            text-align: center;
            color: #f87171;
            font-size: 0.9rem;
            margin-top: 15px;
            font-weight: 600;
        }

        @media (max-width: 768px) {
            header h1 { font-size: 1.8rem; }
            .controls { flex-direction: column; align-items: stretch; }
            .search-box { min-width: 100%; }
            .date-range-group { flex-wrap: wrap; }
            th, td { padding: 10px 12px; font-size: 0.85rem; }
            .modal .form-row { grid-template-columns: 1fr; }
            .delete-preview .preview-row { grid-template-columns: 1fr; }
        }