:root {
    --primary: #6366f1;
    --primary-light: #818cf8;
    --secondary: #ec4899;
    --accent: #06b6d4;
    --bg-dark: #0f172a;
    --sidebar: #1e293b;
    --glass: rgba(30, 41, 59, 0.7);
    --glass-border: rgba(255, 255, 255, 0.1);
    --text: #f8fafc;
    --text-muted: #94a3b8;
    --success: #22c55e;
    --danger: #ef4444;
    --radius: 16px;
}

* { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Outfit', sans-serif; }

body {
    background: #0f172a;
    color: var(--text);
    display: flex;
    min-height: 100vh;
}

.bg-blobs {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    z-index: -1; overflow: hidden;
}

.blob {
    position: absolute; width: 600px; height: 600px;
    background: var(--primary); filter: blur(150px);
    opacity: 0.1; border-radius: 50%;
}

.blob-1 { top: -100px; left: -100px; background: var(--primary); }
.blob-2 { bottom: -100px; right: -100px; background: var(--secondary); }

/* Sidebar */
.sidebar {
    width: 260px;
    background: var(--sidebar);
    border-right: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    padding: 30px 20px;
    position: fixed;
    height: 100vh;
    z-index: 100;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.5rem;
    font-weight: 800;
    margin-bottom: 50px;
}

.sidebar-logo i { color: var(--primary); }

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex: 1;
}

.nav-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 1rem;
    font-weight: 600;
    border-radius: 12px;
    cursor: pointer;
    transition: 0.3s;
}

.nav-btn:hover { background: rgba(255,255,255,0.05); color: var(--text); }
.nav-btn.active { background: var(--primary); color: white; }

/* Main Content */
.main-content {
    margin-left: 260px;
    flex: 1;
    padding: 40px;
}

.view-content { display: none; animation: fadeIn 0.4s ease; }
.view-content.active { display: block; }

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.hero { margin-bottom: 40px; }
h1 { font-size: 3rem; font-weight: 800; letter-spacing: -1.5px; }
.gradient-text { background: linear-gradient(135deg, var(--primary), var(--accent)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }

/* Dashboard Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 25px;
    margin-bottom: 40px;
}

.card {
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    padding: 24px;
    backdrop-filter: blur(10px);
}

.stat-card { display: flex; align-items: center; gap: 20px; }
.stat-icon { width: 60px; height: 60px; border-radius: 15px; display: flex; align-items: center; justify-content: center; font-size: 1.5rem; }
.stat-icon.database { background: rgba(99, 102, 241, 0.1); color: var(--primary); }
.stat-icon.pending { background: rgba(236, 72, 153, 0.1); color: var(--secondary); }

.stat-value { font-size: 2.2rem; font-weight: 800; }

/* Extractor Styles */
textarea {
    width: 100%; height: 200px;
    background: rgba(0,0,0,0.2);
    border: 1px solid var(--glass-border);
    border-radius: 12px; padding: 20px;
    color: white; font-family: monospace;
    margin-bottom: 20px;
}

.action-bar { display: flex; gap: 15px; }

.btn {
    padding: 12px 28px; border-radius: 12px; border: none;
    font-weight: 700; cursor: pointer; display: flex; align-items: center; gap: 10px;
}

.btn.primary { background: var(--primary); color: white; }
.btn.secondary { background: var(--glass); color: white; border: 1px solid var(--glass-border); }

/* Quick Send Styles */
.input-group {
    margin-bottom: 20px;
}

.input-group label {
    display: block;
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 8px;
    font-weight: 600;
}

.input-group input {
    width: 100%;
    padding: 12px 16px;
    background: rgba(0,0,0,0.2);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    color: white;
    font-size: 1rem;
}

.quick-send-card {
    max-width: 500px;
    margin: 0 auto;
}

.search-box {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(0,0,0,0.2);
    border: 1px solid var(--glass-border);
    padding: 8px 15px;
    border-radius: 10px;
    width: 250px;
}

.search-box input {
    background: transparent;
    border: none;
    color: white;
    outline: none;
    width: 100%;
}

.search-box i { color: var(--text-muted); width: 16px; }

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.8);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.modal-overlay.active { display: flex; }

.modal {
    max-width: 400px;
    width: 90%;
    text-align: center;
    animation: zoomIn 0.3s ease;
}

@keyframes zoomIn {
    from { transform: scale(0.9); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.modal-header { margin-bottom: 20px; }
.modal-header i { font-size: 3rem; margin-bottom: 10px; }

.dup-date {
    background: rgba(255,255,255,0.05);
    padding: 10px;
    border-radius: 8px;
    margin: 15px 0;
    color: var(--primary-light);
    font-weight: 700;
}

.modal-footer {
    display: flex;
    gap: 10px;
    margin-top: 25px;
}

.modal-footer button { flex: 1; justify-content: center; }

.badge {
    background: var(--primary);
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 700;
}

.card-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
}

.card-header h2 { font-size: 1.25rem; font-weight: 700; }

/* Lead Rows */
.leads-stack { display: flex; flex-direction: column; gap: 12px; margin-top: 20px; }
.lead-row {
    background: var(--glass); border: 1px solid var(--glass-border);
    border-radius: 12px; padding: 16px 20px;
    display: flex; justify-content: space-between; align-items: center;
}

.lead-name { font-weight: 700; font-size: 1.1rem; display: flex; align-items: center; gap: 8px; }
.phone-badge { color: var(--primary-light); font-weight: 600; font-size: 0.95rem; }
.mini-btn { padding: 6px 14px; border-radius: 8px; border: 1px solid var(--glass-border); background: rgba(255,255,255,0.05); color: white; font-weight: 600; cursor: pointer; }
.mini-btn.success { background: var(--success); border: none; }
.mini-btn.danger-text { color: var(--danger); border: none; background: transparent; padding: 4px; border-radius: 4px; }
.mini-btn.danger-text:hover { background: rgba(239, 68, 68, 0.1); }

.muted { opacity: 0.7; }

/* Toast */
.toast { position: fixed; bottom: 30px; right: 30px; background: var(--primary); padding: 14px 28px; border-radius: 12px; transform: translateY(150px); transition: 0.3s; z-index: 1000; }
.toast.show { transform: translateY(0); }

/* Categories */
.sidebar-categories {
    --cat-panel-bg: rgba(15, 23, 42, 0.55);
    margin-bottom: 18px;
    margin-top: 8px;
    padding: 14px 12px;
    border-radius: 14px;
    background: var(--cat-panel-bg);
    border: 1px solid rgba(99, 102, 241, 0.18);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.sidebar-section-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.72rem;
    font-weight: 800;
    color: var(--primary-light);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 12px;
}

.sidebar-section-title i {
    width: 15px;
    height: 15px;
    color: var(--accent);
}

.category-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
    max-height: 148px;
    overflow-y: auto;
    padding-right: 2px;
}

.category-chips::-webkit-scrollbar { width: 4px; }
.category-chips::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.35);
    border-radius: 4px;
}

.category-chip {
    --cat-color: #6366f1;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 6px 11px 6px 9px;
    border-radius: 999px;
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    color: #e2e8f0;
    border: 1px solid color-mix(in srgb, var(--cat-color) 42%, transparent);
    background: linear-gradient(
        135deg,
        color-mix(in srgb, var(--cat-color) 24%, transparent),
        color-mix(in srgb, var(--cat-color) 8%, rgba(15, 23, 42, 0.6))
    );
    box-shadow:
        0 2px 10px color-mix(in srgb, var(--cat-color) 18%, transparent),
        inset 0 1px 0 rgba(255, 255, 255, 0.08);
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.category-chip:hover {
    transform: translateY(-1px);
    border-color: color-mix(in srgb, var(--cat-color) 60%, transparent);
    box-shadow:
        0 4px 14px color-mix(in srgb, var(--cat-color) 28%, transparent),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.category-chip .chip-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    flex-shrink: 0;
    background: var(--cat-color);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--cat-color) 30%, transparent),
                0 0 10px color-mix(in srgb, var(--cat-color) 55%, transparent);
}

.category-chip .chip-delete {
    background: rgba(0, 0, 0, 0.2);
    border: none;
    color: rgba(255, 255, 255, 0.55);
    cursor: pointer;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    font-size: 0.85rem;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-left: 2px;
    transition: 0.2s ease;
}

.category-chip .chip-delete:hover {
    color: #fff;
    background: rgba(239, 68, 68, 0.85);
}

.add-category-row {
    display: flex;
    gap: 8px;
    align-items: stretch;
}

.add-category-row input {
    flex: 1;
    min-width: 0;
    padding: 10px 12px;
    background: rgba(0, 0, 0, 0.28);
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 10px;
    color: white;
    font-size: 0.84rem;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.add-category-row input::placeholder { color: rgba(148, 163, 184, 0.75); }

.add-category-row input:focus {
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.18);
}

.sidebar-categories .mini-btn.primary {
    background: linear-gradient(135deg, var(--primary), #4f46e5);
    border: none;
    padding: 0 14px;
    min-width: 42px;
    font-size: 1.1rem;
    font-weight: 800;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.35);
}

.sidebar-categories .mini-btn.primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(99, 102, 241, 0.45);
}

.category-select {
    width: 100%;
    padding: 12px 40px 12px 14px;
    background: linear-gradient(180deg, rgba(30, 41, 59, 0.9), rgba(15, 23, 42, 0.85));
    border: 1px solid rgba(99, 102, 241, 0.25);
    border-radius: 12px;
    color: white;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    outline: none;
    appearance: none;
    background-image:
        linear-gradient(180deg, rgba(30, 41, 59, 0.9), rgba(15, 23, 42, 0.85)),
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%23a5b4fc' stroke-width='2.5'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat, no-repeat;
    background-position: 0 0, right 12px center;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.category-select:hover {
    border-color: rgba(129, 140, 248, 0.45);
}

.category-select:focus {
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.category-select option {
    background: #1e293b;
    color: white;
    padding: 8px;
}

.extractor-category-bar {
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    padding: 16px 20px !important;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1), rgba(6, 182, 212, 0.06)) !important;
    border-color: rgba(99, 102, 241, 0.22) !important;
}

.extractor-category-bar label {
    font-weight: 700;
    font-size: 0.88rem;
    color: var(--primary-light);
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 8px;
}

.extractor-category-bar label::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    box-shadow: 0 0 10px rgba(99, 102, 241, 0.6);
}

.extractor-category-bar .category-select { max-width: 340px; }

.history-filters {
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    padding: 14px 18px !important;
    background: rgba(15, 23, 42, 0.45) !important;
    border-color: rgba(148, 163, 184, 0.16) !important;
}

.history-filters label {
    font-weight: 700;
    font-size: 0.88rem;
    color: var(--text-muted);
}

.history-filters .category-select { max-width: 300px; }

.category-badge {
    --cat-color: #94a3b8;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 11px 4px 8px;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    white-space: nowrap;
    color: color-mix(in srgb, var(--cat-color) 75%, white);
    border: 1px solid color-mix(in srgb, var(--cat-color) 38%, transparent);
    background: linear-gradient(
        135deg,
        color-mix(in srgb, var(--cat-color) 22%, transparent),
        color-mix(in srgb, var(--cat-color) 8%, transparent)
    );
    box-shadow: 0 1px 6px color-mix(in srgb, var(--cat-color) 12%, transparent);
}

.category-badge .badge-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--cat-color);
    box-shadow: 0 0 8px color-mix(in srgb, var(--cat-color) 70%, transparent);
}

.category-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
    gap: 14px;
}

.category-stat-item {
    --cat-color: #6366f1;
    position: relative;
    overflow: hidden;
    background: linear-gradient(
        160deg,
        color-mix(in srgb, var(--cat-color) 16%, rgba(15, 23, 42, 0.8)),
        rgba(15, 23, 42, 0.55)
    );
    border: 1px solid color-mix(in srgb, var(--cat-color) 30%, transparent);
    border-radius: 14px;
    padding: 16px 14px 14px;
    text-align: center;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.category-stat-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--cat-color), color-mix(in srgb, var(--cat-color) 40%, white));
}

.category-stat-item:hover {
    transform: translateY(-3px);
    border-color: color-mix(in srgb, var(--cat-color) 50%, transparent);
    box-shadow: 0 10px 24px color-mix(in srgb, var(--cat-color) 18%, transparent);
}

.category-stat-item .cat-name {
    font-size: 0.78rem;
    font-weight: 700;
    color: color-mix(in srgb, var(--cat-color) 55%, white);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
}

.category-stat-item .cat-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--cat-color);
    box-shadow: 0 0 10px color-mix(in srgb, var(--cat-color) 65%, transparent);
}

.category-stat-item .cat-count {
    font-size: 1.85rem;
    font-weight: 800;
    line-height: 1;
    color: #f8fafc;
    text-shadow: 0 2px 12px color-mix(in srgb, var(--cat-color) 35%, transparent);
}

.category-stat-item .cat-pending {
    margin-top: 8px;
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 700;
    color: color-mix(in srgb, var(--cat-color) 70%, white);
    background: color-mix(in srgb, var(--cat-color) 14%, transparent);
    border: 1px solid color-mix(in srgb, var(--cat-color) 25%, transparent);
}

.category-stats-card {
    background: linear-gradient(180deg, rgba(30, 41, 59, 0.75), rgba(15, 23, 42, 0.55)) !important;
}

.lead-identity { display: flex; flex-direction: column; gap: 6px; }
.lead-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
