@import url('https://fonts.googleapis.com/css2?family=Cormorant+Unicase:wght@400;500;600;700&family=Plus+Jakarta+Sans:wght@300;400;500;600;700&display=swap');

:root {
    --bg-main: #fcfbf7; /* Warm Editorial Ivory/Cream */
    --bg-card: #ffffff; /* Contrast White Cards */
    --bg-sidebar: #ffffff; /* Contrast White Sidebar */
    --border-color: #f5f3e9; /* Soft Beige Border */
    --primary: #5da46b; /* Sage Green */
    --primary-glow: rgba(93, 164, 107, 0.08);
    --secondary: #4e8e5b;
    --success: #5da46b;
    --warning: #f59e0b;
    --danger: #ef4444;
    --text-primary: #1e2920; /* Deep Olive/Charcoal Forest */
    --text-secondary: #4a544c; /* Muted Charcoal Green */
    --font-title: 'Cormorant Unicase', serif; /* Luxurious classical serif font */
    --font-sans: 'Plus Jakarta Sans', sans-serif;
    --shadow-sm: 0 1px 3px rgba(30, 41, 32, 0.02);
    --shadow-md: 0 10px 25px rgba(30, 41, 32, 0.04);
    --shadow-lg: 0 20px 40px rgba(30, 41, 32, 0.06);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    font-family: var(--font-sans);
    display: flex;
    height: 100vh;
    overflow: hidden;
}

.app-container {
    display: flex;
    width: 100%;
    height: 100vh;
    overflow: hidden;
    position: relative;
    z-index: 1;
}

/* Sidebar Layout */
.sidebar {
    width: 280px;
    background-color: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 3rem;
}

.logo-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 15px rgba(118, 184, 132, 0.4);
}

.logo-icon ion-icon {
    color: #ffffff !important;
}

.logo-text {
    font-family: var(--font-title);
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: 1px;
    background: linear-gradient(to right, #0f172a, var(--primary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.nav-menu {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex-grow: 1;
}

.nav-item a {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.85rem 1.25rem;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--radius-md);
    font-weight: 500;
    transition: var(--transition);
}

.nav-item a:hover, .nav-item.active a {
    color: var(--text-primary);
    background-color: rgba(0, 0, 0, 0.03);
}

.nav-item.active a {
    background: linear-gradient(90deg, var(--primary-glow), transparent);
    border-left: 3px solid var(--primary);
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}

.sidebar-footer {
    color: var(--text-secondary);
    font-size: 0.8rem;
    text-align: center;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

/* Main Content Styling */
.main-content {
    flex-grow: 1;
    padding: 2.5rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    overflow-y: auto;
}

.header-panel {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.header-title h1 {
    font-family: var(--font-title);
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.header-title p {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

/* Stats Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
}

.stat-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--card-accent, var(--primary));
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
    border-color: rgba(13, 148, 136, 0.2);
}

.stat-info h3 {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.stat-value {
    font-size: 1.85rem;
    font-weight: 700;
}

.stat-icon {
    font-size: 2rem;
    opacity: 0.15;
}

/* Cards & Layout Panels */
.panel-grid {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 2rem;
    position: relative;
    z-index: 5;
}

@media (max-width: 1024px) {
    .panel-grid {
        grid-template-columns: 1fr;
    }
}

.card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.75rem;
    box-shadow: var(--shadow-md);
}

.card-title {
    font-family: var(--font-title);
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.75rem;
}

/* Forms */
.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
}

.form-control, .form-select {
    width: 100%;
    background-color: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: var(--radius-sm);
    padding: 0.75rem 1rem;
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 0.95rem;
    transition: var(--transition);
}

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

.form-select option {
    background-color: #ffffff;
    color: var(--text-primary);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-family: var(--font-sans);
    font-weight: 600;
    font-size: 0.9rem;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-sm);
    border: none;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}

.btn-primary {
    background-color: var(--primary);
    color: #ffffff;
    box-shadow: 0 2px 6px rgba(13, 148, 136, 0.2);
}

.btn-primary:hover {
    background-color: #0f766e;
    box-shadow: 0 4px 12px rgba(13, 148, 136, 0.35);
}

.btn-secondary {
    background-color: #e2e8f0;
    color: var(--text-primary);
}

.btn-secondary:hover {
    background-color: #cbd5e1;
}

.btn-success {
    background-color: var(--success);
    color: #ffffff;
}

.btn-success:hover {
    opacity: 0.9;
}

.btn-danger {
    background-color: var(--danger);
    color: #ffffff;
}

.btn-danger:hover {
    opacity: 0.9;
}

.btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
    border-radius: 4px;
}

/* Tables */
.table-responsive {
    overflow-x: auto;
    width: 100%;
}

.table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.9rem;
}

.table th, .table td {
    padding: 0.9rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
}

.table th {
    font-weight: 600;
    color: var(--text-secondary);
    background-color: rgba(0, 0, 0, 0.015);
}

.table tbody tr {
    transition: var(--transition);
}

.table tbody tr:hover {
    background-color: rgba(0, 0, 0, 0.01);
}

/* Badges */
.badge {
    display: inline-block;
    padding: 0.25rem 0.6rem;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.badge-pending {
    background-color: rgba(245, 158, 11, 0.15);
    color: var(--warning);
}

.badge-processing {
    background-color: rgba(13, 148, 136, 0.15);
    color: var(--primary);
}

.badge-completed {
    background-color: rgba(16, 185, 129, 0.15);
    color: var(--success);
}

.badge-failed {
    background-color: rgba(239, 68, 68, 0.15);
    color: var(--danger);
}

/* Pagination */
.pagination-wrapper {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1.5rem;
}

.pagination {
    display: flex;
    gap: 0.25rem;
    list-style: none;
}

.pagination li a, .pagination li span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition);
}

.pagination li a:hover {
    border-color: var(--primary);
    color: var(--text-primary);
}

.pagination li.active span {
    background-color: var(--primary);
    color: #ffffff;
    border-color: var(--primary);
}

/* Filter Bar */
.filter-bar {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    display: flex;
    gap: 1.25rem;
    flex-wrap: wrap;
    align-items: flex-end;
    margin-bottom: 1.5rem;
}

.filter-item {
    flex: 1;
    min-width: 180px;
}

.filter-buttons {
    display: flex;
    gap: 0.75rem;
}

/* Settings elements */
.settings-section {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.api-key-box {
    background-color: rgba(0, 0, 0, 0.01);
    border: 1px dashed var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.key-text {
    font-family: monospace;
    font-size: 1.1rem;
    letter-spacing: 0.5px;
    color: var(--primary);
}

.info-box {
    background-color: rgba(13, 148, 136, 0.04);
    border-left: 4px solid var(--primary);
    border-radius: 4px;
    padding: 1rem 1.25rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.info-box strong {
    color: var(--text-primary);
}

/* Alerts */
.alert {
    padding: 1rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1.5rem;
    border-left: 4px solid transparent;
}

.alert-success {
    background-color: rgba(16, 185, 129, 0.08);
    border-color: var(--success);
    color: var(--success);
}

.alert-danger {
    background-color: rgba(239, 68, 68, 0.08);
    border-color: var(--danger);
    color: var(--danger);
}

/* Authentication Page Styles (Login/Register) */
.auth-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    width: 100%;
    background-color: var(--bg-main);
}

.auth-card {
    width: 100%;
    max-width: 450px;
    padding: 2.5rem;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
}

.auth-header {
    text-align: center;
    margin-bottom: 2rem;
}

.auth-header .logo-container {
    justify-content: center;
    margin-bottom: 1rem;
}

.auth-header h2 {
    font-family: var(--font-title);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.auth-footer {
    text-align: center;
    margin-top: 1.5rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.auth-footer a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
}

.auth-footer a:hover {
    text-decoration: underline;
}

/* Dark Mode Styles for Dashboard & Auth Views */
[data-theme="dark"] {
    --bg-main: #0c110d; /* Premium deep charcoal forest */
    --bg-card: #121914; /* Emerald-tinted dark card bg */
    --bg-sidebar: #121914; /* Sidebar matches card bg */
    --border-color: #1a251d; /* Deep olive border color */
    --primary: #63b372; /* Sage green for high dark-mode contrast */
    --primary-glow: rgba(99, 179, 114, 0.12);
    --secondary: #72c281;
    --text-primary: #f5f8f6; /* Ivory cream white text */
    --text-secondary: #a2b0a5; /* Muted sage gray text */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 10px 25px rgba(0, 0, 0, 0.45);
    --shadow-lg: 0 20px 40px rgba(0, 0, 0, 0.6);
}

[data-theme="dark"] .logo-text {
    background: linear-gradient(to right, #f5f8f6, var(--primary)) !important;
    -webkit-background-clip: text !important;
    -webkit-text-fill-color: transparent !important;
}

[data-theme="dark"] .sidebar-footer {
    background-color: var(--bg-sidebar) !important;
}

[data-theme="dark"] .nav-item a:hover, 
[data-theme="dark"] .nav-item.active a {
    background-color: rgba(255, 255, 255, 0.02) !important;
}

[data-theme="dark"] .nav-item.active a {
    background: linear-gradient(90deg, var(--primary-glow), transparent) !important;
}

/* Form inputs dark mode mapping */
[data-theme="dark"] .form-control,
[data-theme="dark"] .form-select {
    background-color: #18221a !important;
    border-color: #243527 !important;
    color: #f5f8f6 !important;
}

[data-theme="dark"] .form-control:focus,
[data-theme="dark"] .form-select:focus {
    border-color: var(--primary) !important;
    box-shadow: 0 0 10px rgba(99, 179, 114, 0.25) !important;
}

[data-theme="dark"] .form-select option {
    background-color: #121914 !important;
    color: #f5f8f6 !important;
}

/* Secondary Button overrides for dark mode */
[data-theme="dark"] .btn-secondary {
    background-color: #1c2a1f !important;
    border: 1px solid #243527 !important;
    color: var(--text-secondary) !important;
}

[data-theme="dark"] .btn-secondary:hover {
    background-color: #243527 !important;
    color: var(--text-primary) !important;
}

/* Tables and cells in dark mode */
[data-theme="dark"] .table th {
    background-color: rgba(255, 255, 255, 0.02) !important;
}

[data-theme="dark"] .table tbody tr:hover {
    background-color: rgba(255, 255, 255, 0.015) !important;
}

/* Faint World Map Background for Panel */
.map-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('/images/worldmap.svg');
    background-size: cover;
    background-position: center center;
    background-repeat: no-repeat;
    opacity: 0.05;
    z-index: 0; /* Place behind container but visible through transparency */
    pointer-events: none;
}

[data-theme="dark"] .map-bg {
    filter: invert(1) brightness(0.85);
    opacity: 0.035;
}

/* ==========================================
   PREMIUM VISUAL UPGRADES & RICH AESTHETICS 
   ========================================== */

/* Sidebar Design Upgrade - Glassmorphic and Premium */
.sidebar {
    background: rgba(252, 251, 247, 0.65) !important;
    border-right: 1px solid var(--border-color) !important;
    backdrop-filter: blur(20px) saturate(180%);
    box-shadow: 4px 0 25px rgba(0, 0, 0, 0.01);
    transition: var(--transition);
}

[data-theme="dark"] .sidebar {
    background: rgba(18, 25, 20, 0.65) !important;
    box-shadow: 4px 0 25px rgba(0, 0, 0, 0.2);
}

.logo-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: transparent !important;
    border: none !important;
    padding: 0 !important;
    margin-bottom: 3rem !important;
    box-shadow: none !important;
    backdrop-filter: none !important;
    width: 100%;
    transition: var(--transition);
}

.logo-container img {
    max-height: 110px !important;
    width: auto !important;
    height: auto !important;
    object-fit: contain;
    border: none !important;
    background: transparent !important;
    box-shadow: none !important;
    transition: var(--transition);
}

.logo-container img:hover {
    transform: scale(1.03);
}

[data-theme="dark"] .logo-container img {
    /* Pure neon green glowing silhouette filter to highlight the dark text */
    filter: drop-shadow(0 0 1.5px rgba(118, 184, 132, 0.95)) 
            drop-shadow(0 0 4px rgba(93, 164, 107, 0.8))
            drop-shadow(0 0 12px rgba(93, 164, 107, 0.5));
}

.nav-item a {
    position: relative;
    border-radius: var(--radius-md) !important;
    padding: 0.95rem 1.35rem !important;
    margin: 0.2rem 0;
    font-weight: 600 !important;
    color: var(--text-secondary);
    transition: var(--transition);
    overflow: hidden;
    display: flex;
    align-items: center;
    gap: 1.1rem !important;
}

.nav-item a ion-icon {
    font-size: 1.25rem;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.nav-item a:hover ion-icon {
    transform: translateX(3px) scale(1.1);
}

/* Glassmorphic active item capsule */
.nav-item.active a {
    background: rgba(93, 164, 107, 0.08) !important;
    border: 1px solid rgba(93, 164, 107, 0.2) !important;
    color: var(--primary) !important;
    padding-left: 1.5rem !important;
    box-shadow: inset 0 0 8px rgba(93, 164, 107, 0.02) !important;
}

[data-theme="dark"] .nav-item.active a {
    background: rgba(99, 179, 114, 0.12) !important;
    border: 1px solid rgba(99, 179, 114, 0.3) !important;
    box-shadow: 0 4px 15px rgba(99, 179, 114, 0.1) !important;
}

/* User Card in Sidebar Footer */
.sidebar-footer div {
    background: rgba(255, 255, 255, 0.5) !important;
    border: 1px solid rgba(93, 164, 107, 0.15) !important;
    border-radius: var(--radius-md) !important;
    box-shadow: 0 4px 15px rgba(30, 41, 32, 0.02);
    backdrop-filter: blur(10px);
}

[data-theme="dark"] .sidebar-footer div {
    background: rgba(18, 25, 20, 0.7) !important;
    border: 1px solid rgba(99, 179, 114, 0.25) !important;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.25);
}

/* Filter Item Label Spacing */
.filter-item label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 0.75rem; /* Elegant breathing space above inputs */
    color: var(--text-secondary);
}

/* Pulse dot active status */
.pulse-dot {
    width: 8px;
    height: 8px;
    background-color: var(--primary);
    border-radius: 50%;
    display: inline-block;
    box-shadow: 0 0 8px var(--primary);
    animation: pulse-glow 1.5s infinite ease-in-out;
}

@keyframes pulse-glow {
    0%, 100% {
        transform: scale(0.85);
        opacity: 0.5;
        box-shadow: 0 0 2px var(--primary);
    }
    50% {
        transform: scale(1.15);
        opacity: 1;
        box-shadow: 0 0 10px var(--primary);
    }
}

/* Unified Stats Control Bar Redesign */
.stats-grid {
    display: grid !important;
    grid-template-columns: repeat(4, 1fr) !important;
    background: rgba(255, 255, 255, 0.45) !important;
    backdrop-filter: blur(20px) saturate(120%) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: var(--radius-md) !important;
    padding: 1.5rem 0 !important;
    gap: 0 !important;
    box-shadow: var(--shadow-sm) !important;
}

[data-theme="dark"] .stats-grid {
    background: rgba(18, 25, 20, 0.45) !important;
}

.stat-card {
    background: transparent !important;
    backdrop-filter: none !important;
    border: none !important;
    border-right: 1px solid var(--border-color) !important;
    border-radius: 0 !important;
    padding: 0.5rem 2.25rem !important;
    box-shadow: none !important;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: transform 0.3s ease !important;
    position: relative;
    overflow: hidden;
}

.stat-card::after, .stat-card::before {
    display: none !important; /* Remove individual borders/accents */
}

.stat-card:last-child {
    border-right: none !important;
}

.stat-card:hover {
    transform: translateY(-2px) !important;
    box-shadow: none !important;
}

.stat-value {
    font-size: 2.2rem !important;
    font-weight: 700;
    font-family: var(--font-title);
    background: linear-gradient(135deg, var(--text-primary), var(--card-accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.stat-icon {
    font-size: 2.5rem !important;
    color: var(--card-accent) !important;
    opacity: 0.25 !important;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.stat-card:hover .stat-icon {
    transform: scale(1.1) rotate(3deg);
    opacity: 0.5 !important;
}

@media (max-width: 1024px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        padding: 1rem 0 !important;
    }
    .stat-card {
        border-bottom: 1px solid var(--border-color) !important;
        padding: 1rem 1.5rem !important;
    }
    .stat-card:nth-child(2n) {
        border-right: none !important;
    }
    .stat-card:nth-child(3), .stat-card:nth-child(4) {
        border-bottom: none !important;
    }
}

@media (max-width: 640px) {
    .stats-grid {
        grid-template-columns: 1fr !important;
    }
    .stat-card {
        border-right: none !important;
        border-bottom: 1px solid var(--border-color) !important;
    }
    .stat-card:last-child {
        border-bottom: none !important;
    }
}

/* Cards Styling Upgrade */
.card {
    background: rgba(255, 255, 255, 0.45) !important;
    backdrop-filter: blur(10px) saturate(120%);
    border: 1px solid var(--border-color) !important;
    border-radius: var(--radius-lg) !important;
    padding: 2.25rem !important;
    box-shadow: var(--shadow-md) !important;
    transition: var(--transition);
}

[data-theme="dark"] .card {
    background: rgba(18, 25, 20, 0.45) !important;
}

.card-title {
    font-family: var(--font-title) !important;
    font-size: 1.45rem !important;
    font-weight: 700 !important;
    background: linear-gradient(135deg, var(--text-primary), var(--primary)) !important;
    -webkit-background-clip: text !important;
    -webkit-text-fill-color: transparent !important;
    border-bottom: 2px solid var(--border-color) !important;
    padding-bottom: 1rem !important;
    margin-bottom: 1.75rem !important;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Tables Styling Upgrade */
.table {
    border-collapse: separate !important;
    border-spacing: 0 8px !important; /* Floating row effect */
}

.table th {
    background-color: transparent !important;
    border-bottom: 2px solid var(--border-color) !important;
    padding: 1rem 1.25rem !important;
    font-weight: 700 !important;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.table tbody tr {
    background-color: rgba(255, 255, 255, 0.4) !important;
    border-radius: var(--radius-sm);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.01);
    transition: var(--transition);
}

[data-theme="dark"] .table tbody tr {
    background-color: rgba(18, 25, 20, 0.4) !important;
}

.table tbody tr td {
    border-top: 1px solid var(--border-color) !important;
    border-bottom: 1px solid var(--border-color) !important;
    padding: 1.1rem 1.25rem !important;
}

.table tbody tr td:first-child {
    border-left: 1px solid var(--border-color) !important;
    border-top-left-radius: var(--radius-sm);
    border-bottom-left-radius: var(--radius-sm);
}

.table tbody tr td:last-child {
    border-right: 1px solid var(--border-color) !important;
    border-top-right-radius: var(--radius-sm);
    border-bottom-right-radius: var(--radius-sm);
}

.table tbody tr:hover {
    transform: translateY(-2px);
    background-color: rgba(255, 255, 255, 0.95) !important;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.03) !important;
}

[data-theme="dark"] .table tbody tr:hover {
    background-color: rgba(24, 34, 26, 0.9) !important;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.25) !important;
}

/* Badges Styling Upgrade */
.badge {
    padding: 0.35rem 0.8rem !important;
    border-radius: 6px !important;
    font-weight: 700 !important;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.02);
}

.badge-pending {
    background-color: rgba(245, 158, 11, 0.1) !important;
    border: 1px solid rgba(245, 158, 11, 0.2) !important;
    color: #f59e0b !important;
}

.badge-processing {
    background-color: rgba(118, 184, 132, 0.1) !important;
    border: 1px solid rgba(118, 184, 132, 0.2) !important;
    color: var(--primary) !important;
}

.badge-completed {
    background-color: rgba(16, 185, 129, 0.1) !important;
    border: 1px solid rgba(16, 185, 129, 0.2) !important;
    color: #10b981 !important;
}

.badge-failed {
    background-color: rgba(239, 68, 68, 0.1) !important;
    border: 1px solid rgba(239, 68, 68, 0.2) !important;
    color: #ef4444 !important;
}

/* Form Controls & Inputs Upgrade */
.form-control, .form-select {
    border-radius: var(--radius-sm) !important;
    border: 1.5px solid var(--border-color) !important;
    padding: 0.85rem 1.1rem !important;
    font-weight: 500;
    transition: var(--transition);
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary) !important;
    box-shadow: 0 0 12px var(--primary-glow) !important;
    transform: translateY(-1px);
}

/* Custom Select Dropdown Replacement Styles */
.custom-select-wrapper {
    position: relative;
    user-select: none;
    width: 100%;
}

/* Hide native select but keep it accessible for form submission */
.form-select.custom-hidden {
    display: none !important;
}

.custom-select-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    background-color: var(--bg-card);
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 0.85rem 1.1rem;
    font-weight: 500;
    font-size: 0.95rem;
    color: var(--text-primary);
    cursor: pointer;
    transition: var(--transition);
}

.custom-select-trigger:hover {
    border-color: var(--primary);
}

.custom-select-wrapper.open .custom-select-trigger {
    border-color: var(--primary);
    box-shadow: 0 0 12px var(--primary-glow);
}

.custom-select-trigger ion-icon {
    font-size: 1.1rem;
    transition: transform 0.3s ease;
    color: var(--text-secondary);
}

.custom-select-wrapper.open .custom-select-trigger ion-icon {
    transform: rotate(180deg);
    color: var(--primary);
}

.custom-select-options {
    position: absolute;
    display: block;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    z-index: 999;
    max-height: 240px;
    overflow-y: auto;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s;
}

.custom-select-wrapper.open .custom-select-options {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.custom-option {
    padding: 0.75rem 1.1rem;
    cursor: pointer;
    font-size: 0.95rem;
    color: var(--text-primary);
    transition: var(--transition);
}

.custom-option:hover {
    background-color: rgba(118, 184, 132, 0.08);
    color: var(--primary);
}

.custom-option.selected {
    background-color: var(--primary);
    color: #ffffff !important;
    font-weight: 600;
}

[data-theme="dark"] .custom-option.selected {
    color: #0c110d !important;
}

.custom-option.disabled-placeholder {
    color: var(--text-secondary);
    opacity: 0.6;
    cursor: not-allowed;
}

/* Custom Scrollbar for Options List */
.custom-select-options::-webkit-scrollbar {
    width: 6px;
}

.custom-select-options::-webkit-scrollbar-track {
    background: transparent;
}

.custom-select-options::-webkit-scrollbar-thumb {
    background-color: var(--border-color);
    border-radius: 20px;
}

/* Hide custom select wrapper if native select is hidden dynamically by script */
.custom-select-wrapper:has(select[style*="display: none"]) {
    display: none !important;
}

/* Submit Button & Real-time Grid Actions Design Upgrade */
#taskForm button[type="submit"] {
    background: linear-gradient(135deg, var(--primary), var(--secondary)) !important;
    border: none !important;
    border-radius: var(--radius-sm) !important;
    color: #ffffff !important;
    box-shadow: 0 4px 15px rgba(93, 164, 107, 0.25) !important;
    transition: var(--transition);
    font-size: 0.95rem !important;
    padding: 0.85rem !important;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
}

#taskForm button[type="submit"]:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(93, 164, 107, 0.4), 0 0 15px var(--primary-glow) !important;
}

/* Circular modern icon buttons inside tables */
.table .btn-icon-sm {
    width: 32px;
    height: 32px;
    border-radius: 50% !important;
    padding: 0 !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.table .btn-sm {
    padding: 0.45rem 0.9rem !important;
    font-size: 0.8rem !important;
    border-radius: 6px !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    height: auto !important;
    width: auto !important;
}

.table .btn-secondary.btn-sm {
    background-color: rgba(93, 164, 107, 0.1) !important;
    border: 1px solid rgba(93, 164, 107, 0.2) !important;
    color: var(--primary) !important;
}

.table .btn-secondary.btn-sm:hover {
    background-color: var(--primary) !important;
    color: #ffffff !important;
    box-shadow: 0 0 10px rgba(93, 164, 107, 0.3) !important;
}

.table .btn-danger.btn-sm {
    background-color: rgba(239, 68, 68, 0.1) !important;
    border: 1px solid rgba(239, 68, 68, 0.2) !important;
    color: var(--danger) !important;
}

.table .btn-danger.btn-sm:hover {
    background-color: var(--danger) !important;
    color: #ffffff !important;
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.35) !important;
}

/* Glowing green aurora background shape for main content area */
.workspace-glow {
    position: absolute;
    top: 15%;
    right: 5%;
    width: 450px;
    height: 450px;
    background: radial-gradient(circle, rgba(93, 164, 107, 0.07) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
    filter: blur(50px);
}

[data-theme="dark"] .workspace-glow {
    background: radial-gradient(circle, rgba(99, 179, 114, 0.09) 0%, transparent 70%);
}

.main-content {
    position: relative;
    overflow-x: hidden;
}

/* Sidebar Role Console Badges */
.role-console-badge {
    font-size: 0.65rem !important;
    font-weight: 800 !important;
    letter-spacing: 1.5px;
    padding: 0.3rem 0.75rem !important;
    border-radius: 4px !important;
    margin-top: 0.75rem !important;
    text-align: center;
    display: inline-block;
    text-transform: uppercase;
}

.role-console-badge.admin-badge {
    background: rgba(239, 68, 68, 0.08) !important;
    border: 1px solid rgba(239, 68, 68, 0.25) !important;
    color: #ef4444 !important;
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.05);
}

.role-console-badge.client-badge {
    background: rgba(93, 164, 107, 0.08) !important;
    border: 1px solid rgba(93, 164, 107, 0.25) !important;
    color: var(--primary) !important;
    box-shadow: 0 0 10px rgba(93, 164, 107, 0.05);
}

/* Admin System Status Monitor Grid */
.system-metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.25rem;
    margin-top: 1rem;
    width: 100%;
}

.metric-item {
    background: rgba(255, 255, 255, 0.3) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: var(--radius-sm) !important;
    padding: 1.1rem 1.35rem !important;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

[data-theme="dark"] .metric-item {
    background: rgba(18, 25, 20, 0.3) !important;
}

.metric-label {
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: var(--text-secondary);
}

.metric-value {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-primary);
}

.metric-value.status-online {
    color: var(--primary) !important;
}

/* Lead Details Modal Styles */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(12, 17, 13, 0.65) !important;
    backdrop-filter: blur(8px) !important;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000 !important;
}

.modal-content {
    background: rgba(252, 251, 247, 0.9) !important; /* Cream theme base */
    backdrop-filter: blur(20px) saturate(120%) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: var(--radius-lg) !important;
    width: 90%;
    max-width: 550px;
    padding: 2.25rem !important;
    box-shadow: var(--shadow-lg) !important;
    position: relative;
    transform: scale(0.95);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), background-color 0.3s ease;
}

[data-theme="dark"] .modal-content {
    background: rgba(18, 25, 20, 0.92) !important; /* Dark green theme base */
}

.modal-close-btn {
    position: absolute;
    top: 1.25rem;
    right: 1.25rem;
    background: transparent;
    border: none;
    font-size: 1.85rem;
    color: var(--text-secondary);
    cursor: pointer;
    line-height: 1;
    transition: var(--transition);
}

.modal-close-btn:hover {
    color: var(--danger) !important;
}

.modal-header-section {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1.25rem;
    margin-bottom: 1.5rem;
}

.modal-pin-icon {
    font-size: 2rem;
    color: var(--primary);
    background: rgba(93, 164, 107, 0.1);
    padding: 0.65rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-body-section {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.25rem;
}

.info-group {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.info-group label {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
}

.info-val {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* Progress Indicator & Spinner Styles */
.progress-container {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    min-width: 175px;
    width: 100%;
}

.progress-bar-wrapper {
    height: 6px;
    background: rgba(93, 164, 107, 0.12) !important;
    border-radius: 10px !important;
    overflow: hidden;
    width: 100%;
    position: relative;
}

[data-theme="dark"] .progress-bar-wrapper {
    background: rgba(255, 255, 255, 0.08) !important;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--card-accent, #76b884)) !important;
    border-radius: 10px !important;
    transition: width 0.4s ease-out;
}

.progress-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-secondary);
}

.progress-percentage {
    color: var(--primary) !important;
}

.progress-count {
    color: var(--text-primary) !important;
}

.progress-time {
    opacity: 0.85;
    font-weight: 500;
}

/* Spinner Icon keyframes */
.spinner-icon {
    font-size: 1.15rem;
    color: var(--primary);
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
