/* ==========================================================================
   Enterprise SaaS Design System (Premium Zoho & Salesforce Inspired)
   ========================================================================== */

:root {
    /* Color Palette - Premium HSL Indigo/Violet 2026 Theme */
    --bg-main: #f8fafc;          /* Sleek ultra-light slate */
    --bg-surface: rgba(255, 255, 255, 0.7); /* Translucent glass surface */
    --bg-sidebar: #090d16;       /* Deep obsidian dark */
    --bg-sidebar-hover: #131929;
    --border-color: rgba(15, 23, 42, 0.05); /* Precision thin borders */
    
    /* Variable design system tokens for light / dark toggle */
    --bg-card: #ffffff;
    --bg-input: #f8fafc;
    --bg-th: #f1f5f9;
    --bg-hover: #f8fafc;
    --bg-topbar: rgba(248, 250, 252, 0.75);
    --bg-drawer: rgba(255, 255, 255, 0.85);
    
    /* Typography colors */
    --text-primary: #0f172a;     /* Deep slate for readability */
    --text-secondary: #475569;   /* Slate gray */
    --text-muted: #94a3b8;       /* Placeholders */
    --text-sidebar: #cbd5e1;     /* Contrast text on dark sidebar */
    
    /* Branding Colors */
    --accent-primary: #6366f1;   /* Violet Indigo */
    --accent-hover: #4f46e5;     /* Deep Indigo */
    --accent-light: rgba(99, 102, 241, 0.06);
    --accent-gradient: linear-gradient(135deg, #6366f1 0%, #4f46e5 50%, #312e81 100%);
    --accent-sidebar-gradient: linear-gradient(180deg, #090d16 0%, #020617 100%);
    --ambient-glow: radial-gradient(circle at 80% 0%, rgba(99, 102, 241, 0.05) 0%, transparent 50%);
    
    /* Semantic Status Colors (Highly curated) */
    --color-success: #10b981;    /* Emerald */
    --color-success-bg: rgba(16, 185, 129, 0.06);
    --color-success-border: rgba(16, 185, 129, 0.12);

    --color-warning: #f59e0b;    /* Amber */
    --color-warning-bg: rgba(245, 158, 11, 0.06);
    --color-warning-border: rgba(245, 158, 11, 0.12);

    --color-danger: #f43f5e;     /* Rose Red */
    --color-danger-bg: rgba(244, 63, 94, 0.06);
    --color-danger-border: rgba(244, 63, 94, 0.12);

    --color-info: #0ea5e9;       /* Sky Blue */
    --color-info-bg: rgba(14, 165, 233, 0.06);
    --color-info-border: rgba(14, 165, 233, 0.12);
    
    --color-neutral: #64748b;    
    --color-neutral-bg: rgba(100, 116, 139, 0.06);

    /* Layout & Shadow Tokens (Modern Softness) */
    --sidebar-width: 260px;
    --topbar-height: 64px;
    --border-radius-lg: 14px;    /* Fine rounded */
    --border-radius-md: 10px;
    --border-radius-sm: 6px;
    --transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1); /* Ultra-smooth ease-out */
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.02);
    --shadow-md: 0 10px 30px -10px rgba(0, 0, 0, 0.04), 0 1px 3px rgba(0, 0, 0, 0.02);
    --shadow-lg: 0 20px 48px -15px rgba(0, 0, 0, 0.08), 0 1px 5px rgba(0, 0, 0, 0.02);
}

body.dark-theme {
    /* Color Palette - Obsidian Slate Dark Theme */
    --bg-main: #020617;          /* Obsidian void background */
    --bg-surface: rgba(15, 23, 42, 0.55); /* Obsidian glass */
    --border-color: rgba(255, 255, 255, 0.035); /* Translucent thin line */
    
    /* Variable overrides */
    --bg-card: #090d1f;          /* Sleek card base */
    --bg-input: #12182c;
    --bg-th: #040816;
    --bg-hover: #12182c;
    --bg-topbar: rgba(2, 6, 23, 0.75);
    --bg-drawer: rgba(9, 13, 31, 0.85);
    
    /* Typography colors */
    --text-primary: #f8fafc;     /* Clear high contrast text */
    --text-secondary: #94a3b8;   /* Slate blue */
    --text-muted: #475569;
    --text-sidebar: #cbd5e1;
    
    --ambient-glow: radial-gradient(circle at 80% 0%, rgba(99, 102, 241, 0.15) 0%, transparent 60%);
    
    /* Semantic Status Colors (Highly visible for dark background) */
    --color-success: #34d399;    
    --color-success-bg: rgba(52, 211, 153, 0.06);
    --color-success-border: rgba(52, 211, 153, 0.15);

    --color-warning: #fbbf24;    
    --color-warning-bg: rgba(251, 191, 36, 0.06);
    --color-warning-border: rgba(251, 191, 36, 0.15);

    --color-danger: #fb7185;     
    --color-danger-bg: rgba(251, 113, 133, 0.06);
    --color-danger-border: rgba(251, 113, 133, 0.15);

    --color-info: #38bdf8;       
    --color-info-bg: rgba(56, 189, 248, 0.06);
    --color-info-border: rgba(56, 189, 248, 0.15);
    
    --color-neutral: #94a3b8;
    --color-neutral-bg: rgba(148, 163, 184, 0.08);
    
    /* Shadow glow adjustments for dark mode */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 20px 48px -15px rgba(0, 0, 0, 0.7);
}

/* ==========================================================================
   Core Reset & General Layout
   ========================================================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    overflow: auto;
    scroll-behavior: smooth;
}

body {
    font-family: 'Plus Jakarta Sans', 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: var(--bg-main);
    background-image: var(--ambient-glow);
    background-repeat: no-repeat;
    background-attachment: fixed;
    color: var(--text-primary);
    line-height: 1.5;
    display: flex;
    min-height: 100vh;
    overflow: auto;
}

/* Global Form Controls Styling for Theme Adaptability */
input[type="text"],
input[type="number"],
input[type="password"],
input[type="time"],
input[type="date"],
select,
textarea {
    background-color: var(--bg-input) !important;
    color: var(--text-primary) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: var(--border-radius-md);
    transition: var(--transition);
}

input[type="text"]:focus,
input[type="number"]:focus,
input[type="password"]:focus,
input[type="time"]:focus,
input[type="date"]:focus,
select:focus,
textarea:focus {
    border-color: var(--accent-primary) !important;
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.15) !important;
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: var(--bg-main);
}
::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* ==========================================================================
   Sidebar Navigation
   ========================================================================== */
.sidebar {
    width: var(--sidebar-width);
    background: var(--accent-sidebar-gradient);
    color: var(--text-sidebar);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 100;
    border-right: 1px solid rgba(255, 255, 255, 0.03);
}

.logo-container {
    height: var(--topbar-height);
    display: flex;
    align-items: center;
    padding: 0 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    gap: 12px;
}

.logo-icon {
    width: 32px;
    height: 32px;
    background: var(--accent-gradient);
    border-radius: var(--border-radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 16px;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.logo-container h2 {
    font-size: 18px;
    color: white;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.nav-menu {
    padding: 24px 16px;
    flex: 1;
    overflow-y: auto;
}

.nav-group {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: rgba(255, 255, 255, 0.4);
    margin-bottom: 10px;
    padding-left: 12px;
    font-weight: 700;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: var(--border-radius-md);
    color: var(--text-sidebar);
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    transition: var(--transition);
    margin-bottom: 6px;
}

.nav-item i {
    font-size: 18px;
    transition: transform 0.2s ease;
}

.nav-item:hover {
    background: var(--bg-sidebar-hover);
    color: white;
    transform: translateX(4px);
}

.nav-item:hover i {
    transform: scale(1.1);
}

.nav-item.active {
    background: linear-gradient(90deg, rgba(99, 102, 241, 0.15) 0%, rgba(99, 102, 241, 0.03) 100%);
    color: #a5b4fc;
    border: 1px solid rgba(99, 102, 241, 0.3);
    box-shadow: 0 4px 12px -2px rgba(99, 102, 241, 0.25), inset 0 0 8px rgba(99, 102, 241, 0.1);
    border-radius: var(--border-radius-md);
    margin-left: 0;
    padding-left: 14px;
}

.nav-item.active i {
    color: #a5b4fc;
}

/* ==========================================================================
   Main Content Layout
   ========================================================================== */
.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.topbar {
    height: var(--topbar-height);
    background: var(--bg-topbar);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    position: sticky;
    top: 0;
    z-index: 90;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.01);
}

.search-container {
    display: flex;
    align-items: center;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    padding: 8px 16px;
    width: 380px;
    transition: var(--transition);
}

.search-container:focus-within {
    background: var(--bg-card);
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.15);
}

.search-container i {
    color: var(--text-secondary);
    margin-right: 10px;
    font-size: 16px;
}

.search-container input {
    border: none;
    background: transparent;
    outline: none;
    width: 100%;
    font-size: 14px;
    font-family: inherit;
    color: var(--text-primary);
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.topbar-actions i {
    font-size: 20px;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: var(--transition);
}

.topbar-actions i:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--accent-primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
    box-shadow: 0 2px 6px rgba(15, 98, 254, 0.3);
}

/* ==========================================================================
   Dashboard Module
   ========================================================================== */
.dashboard-wrapper {
    padding: 32px;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 28px;
}

.page-header h1 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.5px;
}

/* Button UI Components - Modernized with gradients & micro-shadows */
.primary-btn {
    background: var(--accent-gradient);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: var(--border-radius-md);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.25);
    transition: var(--transition);
}

.primary-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
}

.primary-btn:active {
    transform: translateY(1px);
}

.primary-btn:disabled {
    background: var(--text-muted);
    box-shadow: none;
    cursor: not-allowed;
}

.secondary-btn {
    background: var(--bg-card);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    padding: 10px 20px;
    border-radius: var(--border-radius-md);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition);
}

.secondary-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    border-color: var(--border-color);
    transform: translateY(-1px);
}

/* Metrics Grid styling - Lift transition and accent shadow glows */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
    margin-bottom: 32px;
}

.metric-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: var(--transition);
}

.metric-card:hover {
    transform: translateY(-4px) scale(1.01);
    box-shadow: var(--shadow-lg);
    border-color: rgba(99, 102, 241, 0.2);
}

.metric-info h3 {
    font-size: 11px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    font-weight: 700;
    margin-bottom: 8px;
}

.metric-info h2 {
    font-size: 26px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.5px;
}

.metric-icon {
    width: 52px;
    height: 52px;
    border-radius: var(--border-radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.bg-blue { background: rgba(99, 102, 241, 0.08); color: var(--accent-primary); }
.bg-green { background: var(--color-success-bg); color: var(--color-success); }
.bg-orange { background: var(--color-warning-bg); color: var(--color-warning); }
.bg-red { background: var(--color-danger-bg); color: var(--color-danger); }

/* Dashboard layout grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1.2fr;
    gap: 32px;
    margin-bottom: 32px;
}

.dashboard-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.card-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-header h2 {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
}

.card-body {
    padding: 24px;
}

/* Collection progress widget styling - Modern gradient progress */
.collection-progress-container {
    padding: 8px 0;
}

.progress-bar-wrapper {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 12px;
}

.progress-bar-bg {
    flex: 1;
    height: 10px;
    background: var(--border-color);
    border-radius: 5px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: var(--accent-gradient);
    border-radius: 5px;
    transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.progress-label {
    font-weight: 700;
    font-size: 18px;
    color: var(--accent-primary);
    min-width: 50px;
    text-align: right;
}

.analytics-subtext {
    font-size: 13px;
    color: var(--text-secondary);
}

/* Compliance tracker dashboard stats */
.compliance-summary-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.compliance-stat {
    text-align: center;
    padding: 20px;
    border-radius: var(--border-radius-md);
    background: var(--bg-hover);
    border: 1px solid var(--border-color);
    transition: var(--transition);
}

.compliance-stat:hover {
    background: var(--bg-card);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.stat-number {
    display: block;
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 4px;
    letter-spacing: -1px;
}

.stat-number.text-green { color: var(--color-success); }
.stat-number.text-orange { color: var(--color-warning); }

.stat-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ==========================================================================
   Data Toolbar and Filter Controls
   ========================================================================== */
.data-table-container {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.table-toolbar {
    padding: 18px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-th);
    gap: 16px;
}

.toolbar-search {
    display: flex;
    align-items: center;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    padding: 6px 14px;
    width: 320px;
    transition: var(--transition);
}

.toolbar-search:focus-within {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.toolbar-search i {
    color: var(--text-secondary);
    margin-right: 8px;
    font-size: 14px;
}

.toolbar-search input {
    border: none;
    outline: none;
    width: 100%;
    font-size: 13px;
    font-family: inherit;
    background: transparent;
    color: var(--text-primary);
}

.toolbar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.toolbar-actions select {
    border: 1px solid var(--border-color);
    padding: 8px 14px;
    border-radius: var(--border-radius-md);
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    background: var(--bg-input);
    outline: none;
    cursor: pointer;
    transition: var(--transition);
}

.toolbar-actions select:hover {
    border-color: var(--text-muted);
}

.toolbar-actions select:focus {
    border-color: var(--accent-primary);
}

/* ==========================================================================
   Premium Table Design
   ========================================================================== */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

th {
    padding: 16px 24px;
    font-size: 11px;
    font-weight: 700;
    color: var(--text-secondary);
    background: var(--bg-th);
    border-bottom: 1px solid var(--border-color);
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

td {
    padding: 16px 24px;
    font-size: 14px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
    vertical-align: middle;
    transition: background-color 0.2s ease;
}

tr:hover td {
    background: var(--bg-hover);
}

tr:last-child td {
    border-bottom: none;
}

/* Table helper layouts */
.client-name-cell {
    display: flex;
    flex-direction: column;
}

.client-name {
    font-weight: 600;
    color: var(--accent-primary);
    cursor: pointer;
    transition: var(--transition);
}

.client-name:hover {
    color: var(--accent-hover);
    text-decoration: underline;
}

.client-id {
    font-size: 11px;
    color: var(--text-secondary);
    font-family: monospace;
    background: var(--bg-hover);
    border: 1px solid var(--border-color);
    padding: 1px 6px;
    border-radius: 4px;
    width: fit-content;
    margin-top: 4px;
}

.client-contact-cell {
    font-size: 13px;
    color: var(--text-secondary);
}

.client-contact-cell i {
    margin-right: 4px;
    font-size: 14px;
}

.client-type-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    background: var(--bg-hover);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.financial-cell {
    font-weight: 600;
    font-size: 14px;
}

.pending-text {
    color: var(--color-danger);
    font-size: 12px;
    font-weight: 500;
    display: block;
    margin-top: 2px;
}

.settled-text {
    color: var(--color-success);
    font-size: 12px;
    font-weight: 500;
    display: block;
    margin-top: 2px;
}

/* Status Badges - Rounded and clean */
.status-badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 1px solid transparent;
}

.status-badge::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    display: inline-block;
}

.status-active {
    background: var(--color-info-bg);
    color: var(--color-info);
    border-color: var(--color-info-border);
}
.status-active::before { background: var(--color-info); }

.status-paid {
    background: var(--color-success-bg);
    color: var(--color-success);
    border-color: var(--color-success-border);
}
.status-paid::before { background: var(--color-success); }

.status-pending {
    background: var(--color-warning-bg);
    color: var(--color-warning);
    border-color: var(--color-warning-border);
}
.status-pending::before { background: var(--color-warning); }

.status-overdue {
    background: var(--color-danger-bg);
    color: var(--color-danger);
    border-color: var(--color-danger-border);
}
.status-overdue::before { background: var(--color-danger); }

.status-waived {
    background: var(--color-neutral-bg);
    color: var(--color-neutral);
    border-color: var(--border-color);
}
.status-waived::before { background: var(--color-neutral); }

.status-inactive {
    background: var(--color-neutral-bg);
    color: var(--color-neutral);
    border-color: var(--border-color);
}
.status-inactive::before { background: var(--color-neutral); }

/* Table action buttons */
.row-action-btn {
    color: var(--accent-primary);
    background: transparent;
    border: 1px solid var(--border-color);
    padding: 6px 12px;
    border-radius: var(--border-radius-md);
    font-weight: 600;
    cursor: pointer;
    font-size: 12px;
    transition: var(--transition);
}

.row-action-btn:hover {
    background: var(--accent-gradient);
    color: white;
    border-color: transparent;
    box-shadow: 0 4px 10px rgba(99, 102, 241, 0.2);
}

.row-action-btn.danger {
    color: var(--color-danger);
    border-color: var(--color-danger-border);
}

.row-action-btn.danger:hover {
    background: var(--color-danger);
    color: white;
    border-color: transparent;
    box-shadow: 0 4px 10px rgba(244, 63, 94, 0.2);
}

.icon-action-btn {
    color: var(--text-secondary);
    background: transparent;
    border: none;
    font-size: 18px;
    cursor: pointer;
    padding: 6px;
    border-radius: 50%;
    transition: var(--transition);
    margin-left: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.icon-action-btn:hover {
    background: var(--bg-hover);
    color: var(--accent-primary);
}

.icon-action-btn.whatsapp-btn:hover {
    color: #25d366;
    background: rgba(37, 211, 102, 0.1);
}

/* Compact dashboard table formatting */
.compact-table td {
    padding: 12px 20px;
    font-size: 13px;
}
.compact-table th {
    padding: 10px 20px;
}

/* ==========================================================================
   Slide-out Detail Drawer
   ========================================================================== */
.drawer-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(4px);
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
    z-index: 999;
}

.drawer-overlay.active {
    opacity: 1;
    visibility: visible;
}

.drawer {
    position: fixed;
    top: 0;
    right: -520px;
    width: 500px;
    height: 100vh;
    background: var(--bg-drawer);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-left: 1px solid var(--border-color);
    box-shadow: -12px 0 40px rgba(99, 102, 241, 0.08);
    z-index: 1000;
    transition: right 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    flex-direction: column;
}

.drawer.active {
    right: 0;
}

.drawer-header {
    padding: 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-th);
}

.drawer-title h2 {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.drawer-id {
    font-size: 11px;
    color: var(--text-secondary);
    font-family: monospace;
    background: var(--bg-hover);
    border: 1px solid var(--border-color);
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 600;
}

.close-drawer {
    background: none;
    border: none;
    font-size: 20px;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    display: flex;
    transition: var(--transition);
}

.close-drawer:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.drawer-content {
    padding: 24px;
    flex: 1;
    overflow-y: auto;
}

.drawer-section {
    margin-bottom: 8px;
}

.drawer-section h3 {
    font-size: 14px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    font-weight: 700;
    margin-bottom: 16px;
}

.drawer-divider {
    border: 0;
    height: 1px;
    background: var(--border-color);
    margin: 24px 0;
}

/* Profile details grid styling */
.profile-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.profile-item {
    font-size: 13px;
    color: var(--text-primary);
}

.profile-item strong {
    display: block;
    color: var(--text-secondary);
    font-weight: 500;
    margin-bottom: 2px;
}

/* Compliance Badges Layout */
.compliance-badges {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.compliance-badge-item {
    background: var(--bg-hover);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    padding: 10px 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.compliance-badge-item span {
    font-size: 13px;
    font-weight: 600;
}

.compliance-status {
    font-size: 11px !important;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 700;
    text-transform: uppercase;
}

.comp-filed { background: var(--color-success-bg); color: var(--color-success); }
.comp-pending { background: var(--color-warning-bg); color: var(--color-warning); }
.comp-na { background: var(--color-neutral-bg); color: var(--color-neutral); }

/* Timeline vertical checklist */
.timeline {
    position: relative;
    padding-left: 28px;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 7px;
    top: 6px;
    bottom: 6px;
    width: 2px;
    background: var(--border-color);
}

.timeline-item {
    position: relative;
    margin-bottom: 24px;
}

.timeline-item:last-child {
    margin-bottom: 0;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -28px;
    top: 5px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--bg-card);
    border: 3px solid var(--border-color);
    z-index: 1;
}

.timeline-item.paid::before {
    border-color: var(--color-success);
    background: var(--color-success);
}

.timeline-item.pending::before {
    border-color: var(--color-warning);
    background: var(--bg-card);
}

.timeline-item.overdue::before {
    border-color: var(--color-danger);
    background: var(--color-danger);
}

.timeline-item.waived::before {
    border-color: var(--color-neutral);
    background: var(--color-neutral);
}

.timeline-item h4 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.timeline-item p {
    font-size: 12px;
    color: var(--text-secondary);
}

.amount-badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: var(--border-radius-sm);
    font-size: 12px;
    font-weight: 600;
    margin-top: 6px;
}

.amount-badge.paid { background: var(--color-success-bg); color: var(--color-success); }
.amount-badge.pending { background: var(--color-warning-bg); color: var(--color-warning); }
.amount-badge.overdue { background: var(--color-danger-bg); color: var(--color-danger); }
.amount-badge.waived { background: var(--color-neutral-bg); color: var(--color-neutral); }

/* ==========================================================================
   Reports / Analytics View Layout
   ========================================================================== */
.reports-grid {
    display: grid;
    grid-template-columns: 1fr 1.2fr;
    gap: 32px;
    margin-bottom: 32px;
}

.report-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 24px;
}

.report-card h3 {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 12px;
}

/* Custom CSS Segment Bar Charts */
.segment-chart-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.chart-bar-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.chart-bar-label-grid {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
}

.chart-bar-bg {
    height: 8px;
    background: var(--border-color);
    border-radius: 4px;
    overflow: hidden;
}

.chart-bar-fill {
    height: 100%;
    background: var(--accent-primary);
    border-radius: 4px;
}

/* Aging receivables summary card slots */
.aging-bar-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    text-align: center;
}

.aging-slot {
    background: var(--bg-hover);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 24px 16px;
    transition: var(--transition);
}

.aging-slot:hover {
    background: var(--bg-card);
    border-color: var(--accent-primary);
    box-shadow: var(--shadow-md);
}

.aging-duration {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: block;
    margin-bottom: 12px;
}

.aging-slot h2 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 4px;
}

.aging-slot:nth-child(1) h2 { color: var(--accent-primary); }
.aging-slot:nth-child(2) h2 { color: var(--color-warning); }
.aging-slot:nth-child(3) h2 { color: var(--color-danger); }

.aging-count {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
}

/* ==========================================================================
   Modals
   ========================================================================== */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(4px);
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
    z-index: 1001;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    position: fixed;
    top: 50%; left: 50%;
    transform: translate(-50%, -43%);
    width: 480px;
    max-height: 90vh;
    background: var(--bg-card);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-lg);
    z-index: 1002;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    display: flex;
    flex-direction: column;
}

.modal.active {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, -50%);
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-th);
    border-radius: var(--border-radius-lg) var(--border-radius-lg) 0 0;
}

.modal-header h2 {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
}

.close-modal {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 6px;
    border-radius: 50%;
    display: flex;
    transition: var(--transition);
}

.close-modal:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

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

.form-group {
    margin-bottom: 18px;
}

.form-group:last-child {
    margin-bottom: 0;
}

.form-group label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    font-family: inherit;
    font-size: 14px;
    color: var(--text-primary);
    outline: none;
    transition: var(--transition);
    background: var(--bg-input);
}

.form-group input:focus,
.form-group select:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.modal-footer {
    padding: 18px 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    background: var(--bg-th);
    border-radius: 0 0 var(--border-radius-lg) var(--border-radius-lg);
}

/* ==========================================================================
   Animations & Transition Effects
   ========================================================================== */
.view-section {
    display: none;
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.view-section.active {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

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

.animate-fade-in {
    animation: fadeIn 0.3s ease forwards;
}

/* Compliance Dropdown Selectors */
.compliance-select {
    border: none;
    outline: none;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    padding: 3px 8px;
    border-radius: 10px;
    cursor: pointer;
    transition: var(--transition);
    appearance: none; /* Hide default browser arrow */
    -webkit-appearance: none;
    text-align: center;
}

.compliance-select.comp-filed {
    background: var(--color-success-bg);
    color: var(--color-success);
}

.compliance-select.comp-pending {
    background: var(--color-warning-bg);
    color: var(--color-warning);
}

.compliance-select:focus {
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

/* ==========================================================================
   AI Assistant Chatbot Widgets
   ========================================================================== */
.ai-chat-toggle {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--accent-gradient);
    border: none;
    color: white;
    font-size: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(99, 102, 241, 0.4);
    z-index: 1000;
    transition: var(--transition);
}

.ai-chat-toggle:hover {
    transform: scale(1.08) translateY(-2px);
    box-shadow: 0 12px 28px rgba(99, 102, 241, 0.5);
}

.ai-pulse {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #10b981;
    border: 2px solid white;
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    animation: ai-pulse-anim 2s infinite;
}

@keyframes ai-pulse-anim {
    0% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    }
    70% {
        transform: scale(1);
        box-shadow: 0 0 0 6px rgba(16, 185, 129, 0);
    }
    100% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
    }
}

.ai-chat-card {
    position: fixed;
    bottom: 100px;
    right: 24px;
    width: 360px;
    height: 460px;
    max-height: calc(100vh - 140px);
    max-width: calc(100vw - 48px);
    background: var(--bg-card);
    border-radius: var(--border-radius-lg);
    box-shadow: 0 12px 36px rgba(15, 23, 42, 0.18);
    border: 1px solid var(--border-color);
    display: none;
    flex-direction: column;
    overflow: hidden;
    z-index: 1000;
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease;
    transform: translateY(20px);
    opacity: 0;
    /* Allow user to drag the bottom-left corner to resize */
    resize: both;
    min-width: 280px;
    min-height: 320px;
}

/* Compact mode toggle: clicking the minimize button shrinks card to a small bar */
.ai-chat-card.compact {
    height: 56px !important;
    min-height: 56px;
    overflow: hidden;
}
.ai-chat-card.compact .ai-chat-body,
.ai-chat-card.compact .ai-chat-footer {
    display: none;
}

/* On narrow screens, make it dock to bottom and use full width minus margin */
@media (max-width: 768px) {
    .ai-chat-card {
        width: calc(100vw - 24px);
        right: 12px;
        bottom: 90px;
        height: 60vh;
    }
}

.ai-chat-card.active {
    display: flex;
    transform: translateY(0);
    opacity: 1;
}

.ai-chat-header {
    padding: 16px 20px;
    background: var(--bg-sidebar);
    color: white;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.ai-chat-header-title {
    display: flex;
    align-items: center;
    gap: 12px;
}

.ai-chat-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: #60a5fa;
}

.ai-chat-header-title h4 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 2px;
    letter-spacing: 0.3px;
    color: white;
}

.ai-status {
    font-size: 11px;
    color: #94a3b8;
    display: flex;
    align-items: center;
    gap: 5px;
}

.status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #10b981;
    display: inline-block;
}

.ai-chat-close {
    background: none;
    border: none;
    color: #94a3b8;
    font-size: 20px;
    cursor: pointer;
    padding: 4px;
    border-radius: 50%;
    display: flex;
    transition: var(--transition);
}

.ai-chat-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.ai-chat-body {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: var(--bg-main);
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.chat-message {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 13.5px;
    line-height: 1.5;
    word-break: break-word;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.chat-message.bot {
    align-self: flex-start;
    background: var(--bg-card);
    color: var(--text-primary);
    border-bottom-left-radius: 4px;
    border: 1px solid var(--border-color);
}

.chat-message.user {
    align-self: flex-end;
    background: var(--accent-primary);
    color: white;
    border-bottom-right-radius: 4px;
}

.chat-message table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 8px;
    font-size: 12px;
}

.chat-message th, .chat-message td {
    padding: 6px 8px;
    border: 1px solid var(--border-color);
    text-transform: none;
    font-weight: normal;
    letter-spacing: normal;
    font-size: 11px;
}

.chat-message th {
    background: var(--bg-th);
    font-weight: 600;
}

.chat-message .profile-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--accent-light);
    color: var(--accent-primary);
    border: 1px solid var(--accent-primary);
    padding: 6px 12px;
    border-radius: var(--border-radius-md);
    font-weight: 600;
    cursor: pointer;
    font-size: 12px;
    margin-top: 10px;
    transition: var(--transition);
}

.chat-message .profile-btn:hover {
    background: var(--accent-primary);
    color: white;
}

.chat-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: auto;
    padding-top: 12px;
}

.suggest-tag {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 1px 2px rgba(0,0,0,0.02);
}

.suggest-tag:hover {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
    background: var(--accent-light);
}

.ai-chat-footer {
    padding: 14px 20px;
    background: var(--bg-th);
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 12px;
}

.ai-chat-footer input {
    flex: 1;
    border: 1px solid var(--border-color);
    border-radius: 24px;
    padding: 10px 18px;
    font-size: 13px;
    outline: none;
    transition: var(--transition);
    background: var(--bg-input);
    color: var(--text-primary);
}

.ai-chat-footer input:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.ai-chat-footer button {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--accent-primary);
    color: white;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 16px;
    transition: var(--transition);
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.25);
}

.ai-chat-footer button:hover {
    background: var(--accent-hover);
    transform: scale(1.05);
}

/* Inline Installment Editing Styles */
.edit-inst-input {
    width: 100%;
    padding: 6px 10px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm, 4px);
    font-family: inherit;
    font-size: 13px;
    color: var(--text-primary);
    background: var(--bg-input);
    outline: none;
    transition: var(--transition);
}

.edit-inst-input:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

/* Settings view grid layout and card headers */
.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 24px;
    margin-top: 20px;
}

.card-icon-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.card-icon-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

/* ==========================================================================
   Print Styles (@media print)
   ========================================================================== */
@media print {
    /* Hide layout chrome like sidebar, topbar, buttons, search, and float buttons */
    .sidebar,
    .topbar,
    .primary-btn,
    .secondary-btn,
    .row-action-btn,
    .icon-action-btn,
    .table-toolbar,
    .page-header div,
    .ai-chat-bubble-container,
    .settings-grid,
    .ai-chat-widget,
    #ai-assistant-toggle-btn {
        display: none !important;
    }

    /* Reset main content alignment */
    body {
        background: white !important;
        color: black !important;
    }

    .main-content {
        margin-left: 0 !important;
        padding: 0 !important;
    }

    .dashboard-wrapper {
        padding: 0 !important;
    }

    .page-header h1 {
        font-size: 24px !important;
        text-align: center;
        margin-bottom: 20px;
        border-bottom: 2px solid #333;
        padding-bottom: 8px;
    }

    /* Table styling for print */
    .data-table-container {
        border: none !important;
        box-shadow: none !important;
        overflow: visible !important;
    }

    table {
        width: 100% !important;
        border-collapse: collapse !important;
        page-break-inside: auto;
    }

    tr {
        page-break-inside: avoid;
        page-break-after: auto;
    }

    th, td {
        border: 1px solid #ddd !important;
        padding: 8px !important;
        font-size: 11px !important;
        color: black !important;
    }

    th {
        background-color: #f1f5f9 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    /* Status badge adjustments */
    .status-badge {
        border: 1px solid #000 !important;
        background: transparent !important;
        color: black !important;
        padding: 2px 6px !important;
        border-radius: 4px !important;
        font-size: 9px !important;
    }
}





/* ===== Toggle Switch (used in client drawer) ===== */
.toggle-switch input:checked + .toggle-slider {
    background: var(--accent-primary, #6366f1) !important;
}
.toggle-switch .toggle-slider:before {
    content: "";
    position: absolute;
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background: white;
    border-radius: 50%;
    transition: .2s;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .15);
}
.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(20px);
}
.toggle-switch input:disabled + .toggle-slider {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Muted client badge in lists */
.muted-pill {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    background: #fef3c7;
    color: #92400e;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 10px;
    font-weight: 600;
    margin-left: 6px;
}


/* ===== Modern Toast Notifications ===== */
#toastContainer {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 100000;
    display: flex;
    flex-direction: column;
    gap: 12px;
    pointer-events: none;
    max-width: 380px;
}

.toast {
    pointer-events: auto;
    display: flex;
    align-items: flex-start;
    gap: 14px;
    background: var(--bg-surface);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-radius: 14px;
    padding: 16px 18px;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
    transform: translateX(120%) scale(0.96);
    opacity: 0;
    transition: transform 0.45s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.35s ease;
    position: relative;
    overflow: hidden;
}

.toast.show {
    transform: translateX(0) scale(1);
    opacity: 1;
}

.toast.hide {
    transform: translateX(120%) scale(0.96);
    opacity: 0;
}

/* Accent strip on the left edge */
.toast::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
}
.toast-success::before { background: linear-gradient(180deg, #10b981, #059669); }
.toast-error::before   { background: linear-gradient(180deg, #ef4444, #dc2626); }
.toast-warning::before { background: linear-gradient(180deg, #f59e0b, #d97706); }
.toast-info::before    { background: linear-gradient(180deg, #6366f1, #4f46e5); }

.toast-icon {
    flex-shrink: 0;
    width: 38px;
    height: 38px;
    border-radius: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: #fff;
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}

.toast-success .toast-icon { background: linear-gradient(135deg, #10b981, #059669); }
.toast-error   .toast-icon { background: linear-gradient(135deg, #ef4444, #dc2626); }
.toast-warning .toast-icon { background: linear-gradient(135deg, #f59e0b, #d97706); }
.toast-info    .toast-icon { background: linear-gradient(135deg, #6366f1, #4f46e5); }

.toast-content {
    flex: 1;
    min-width: 0;
    padding-top: 2px;
}

.toast-title {
    font-weight: 700;
    font-size: 14px;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.toast-message {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.45;
    white-space: pre-line;
    word-wrap: break-word;
}

.toast-close {
    flex-shrink: 0;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 16px;
    padding: 2px;
    line-height: 1;
    transition: color 0.15s;
}
.toast-close:hover { color: var(--text-primary); }

/* Progress bar that shows time-to-dismiss */
.toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    width: 100%;
    transform-origin: left;
}
.toast-success .toast-progress { background: #10b981; }
.toast-error   .toast-progress { background: #ef4444; }
.toast-warning .toast-progress { background: #f59e0b; }
.toast-info    .toast-progress { background: #6366f1; }

@keyframes toastProgress {
    from { transform: scaleX(1); }
    to   { transform: scaleX(0); }
}

/* ===== Modern Confirm Dialog ===== */
.confirm-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(3px);
    z-index: 100001;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}
.confirm-overlay.show { opacity: 1; pointer-events: auto; }

.confirm-box {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 28px;
    width: 420px;
    max-width: calc(100vw - 48px);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
    transform: scale(0.92) translateY(10px);
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    text-align: center;
}
.confirm-overlay.show .confirm-box { transform: scale(1) translateY(0); }

.confirm-icon {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    margin: 0 auto 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 30px;
    color: #fff;
}
.confirm-icon.warning { background: linear-gradient(135deg, #f59e0b, #d97706); }
.confirm-icon.danger  { background: linear-gradient(135deg, #ef4444, #dc2626); }
.confirm-icon.info    { background: linear-gradient(135deg, #6366f1, #4f46e5); }

.confirm-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}
.confirm-message {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.55;
    margin-bottom: 24px;
    white-space: pre-line;
}
.confirm-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}
.confirm-btn {
    padding: 10px 24px;
    border-radius: 9px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.15s;
}
.confirm-btn-cancel {
    background: var(--bg-hover);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}
.confirm-btn-cancel:hover { background: var(--border-color); }
.confirm-btn-confirm {
    background: var(--accent-primary, #6366f1);
    color: #fff;
}
.confirm-btn-confirm:hover { filter: brightness(1.08); }
.confirm-btn-confirm.danger { background: #dc2626; }
.confirm-btn-confirm.danger:hover { background: #b91c1c; }


/* ===== Clickable metric cards ===== */
.clickable-metric {
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    position: relative;
}
.clickable-metric:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.12);
}
.clickable-metric::after {
    content: "View →";
    position: absolute;
    bottom: 10px;
    right: 14px;
    font-size: 10px;
    font-weight: 600;
    color: var(--accent-primary, #6366f1);
    opacity: 0;
    transition: opacity 0.15s;
}
.clickable-metric:hover::after { opacity: 0.7; }

/* ===== Metric detail slide-over panel ===== */
.metric-detail-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(2px);
    z-index: 9998;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}
.metric-detail-overlay.active { opacity: 1; pointer-events: auto; }

.metric-detail-panel {
    position: fixed;
    top: 0;
    right: 0;
    height: 100vh;
    width: 560px;
    max-width: calc(100vw - 40px);
    background: var(--bg-drawer);
    box-shadow: -12px 0 40px rgba(0, 0, 0, 0.2);
    border-left: 1px solid var(--border-color);
    z-index: 9999;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    flex-direction: column;
}
.metric-detail-panel.active { transform: translateX(0); }

.metric-detail-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-th);
    color: var(--text-primary);
}
.metric-detail-header h2 { color: var(--text-primary); margin: 0; font-size: 18px; }
.metric-detail-header .secondary-btn {
    background: var(--bg-card);
    color: var(--text-primary);
    border-color: var(--border-color);
}
.metric-detail-header .secondary-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}
.metric-detail-header .close-drawer { color: var(--text-secondary); }

.metric-detail-body {
    flex: 1;
    overflow-y: auto;
    padding: 0;
}
.metric-detail-body table { width: 100%; border-collapse: collapse; }
.metric-detail-body th {
    text-align: left;
    padding: 12px 16px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    background: var(--bg-th);
    position: sticky;
    top: 0;
    border-bottom: 1px solid var(--border-color);
}
.metric-detail-body td {
    padding: 12px 16px;
    font-size: 13px;
    border-bottom: 1px solid var(--border-color);
}
.metric-detail-body tr:hover td { background: var(--bg-hover); }

/* Reminder Tab Buttons */
.reminder-tab-btn {
    padding: 10px 18px;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}
.reminder-tab-btn:hover {
    color: var(--text-primary);
}
.reminder-tab-btn.active {
    border-bottom: 3px solid var(--accent-primary);
    color: var(--text-primary);
}

/* ==========================================================================
   Campaign and Reminder Search/Filter Core Form Controls
   ========================================================================== */
#campaignName,
#campaignAudience,
#campaignChannel,
#campaignTemplate,
#campaignPrompt,
#campaignTemplate:focus,
#clientsSearch,
#clientsFilter {
    background: var(--bg-input) !important;
    color: var(--text-primary) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: var(--border-radius-md) !important;
    outline: none !important;
    font-family: inherit;
    transition: var(--transition);
}

#campaignName:focus,
#campaignAudience:focus,
#campaignChannel:focus,
#campaignTemplate:focus,
#campaignPrompt:focus,
#clientsSearch:focus,
#clientsFilter:focus {
    border-color: var(--accent-primary) !important;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15) !important;
}

/* Disable inner/outer spin button scrollers on number inputs */
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none !important;
    margin: 0 !important;
}
input[type="number"] {
    -moz-appearance: textfield !important;
}

