/* ============================================================
   Invoice Desk — Modern Theme v2 (overlay)
   Loaded AFTER style.css. Safe to tweak without touching legacy.
   ============================================================ */

/* ---------- Design Tokens ---------- */
:root {
    /* Brand */
    --brand-50:  #EEF2FF;
    --brand-100: #E0E7FF;
    --brand-200: #C7D2FE;
    --brand-500: #6366F1;
    --brand-600: #4F46E5;
    --brand-700: #4338CA;
    --brand-800: #3730A3;

    /* Accent */
    --accent-500: #10B981;
    --accent-600: #059669;

    /* Warn/Danger */
    --warn-500:   #F59E0B;
    --danger-500: #EF4444;
    --danger-600: #DC2626;
    --info-500:   #0EA5E9;

    /* Neutrals */
    --gray-50:  #F9FAFB;
    --gray-100: #F3F4F6;
    --gray-200: #E5E7EB;
    --gray-300: #D1D5DB;
    --gray-400: #9CA3AF;
    --gray-500: #6B7280;
    --gray-600: #4B5563;
    --gray-700: #374151;
    --gray-800: #1F2937;
    --gray-900: #111827;

    /* Surfaces */
    --bg-body:     #F4F5F9;
    --bg-surface:  #FFFFFF;
    --bg-elevated: #FFFFFF;

    /* Sidebar */
    --sidebar-bg:     #0F172A;
    --sidebar-fg:     #E2E8F0;
    --sidebar-muted:  #94A3B8;
    --sidebar-active-bg: linear-gradient(135deg, #4F46E5 0%, #7C3AED 100%);
    --sidebar-hover:  rgba(255,255,255,0.06);
    --sidebar-section-label: #64748B;

    /* Shadows */
    --shadow-sm:  0 1px 2px 0 rgba(0,0,0,0.04);
    --shadow:     0 1px 3px 0 rgba(0,0,0,0.06), 0 1px 2px 0 rgba(0,0,0,0.04);
    --shadow-md:  0 4px 12px -2px rgba(0,0,0,0.08), 0 2px 4px -1px rgba(0,0,0,0.04);
    --shadow-lg:  0 10px 25px -5px rgba(0,0,0,0.10), 0 4px 10px -3px rgba(0,0,0,0.05);

    /* Radii */
    --radius-sm:   6px;
    --radius:      10px;
    --radius-md:   12px;
    --radius-lg:   16px;
    --radius-xl:   20px;
    --radius-pill: 999px;

    /* Typography */
    --font-ui: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-num: 'Inter', ui-monospace, 'SF Mono', Menlo, monospace;

    --fs-xs:   11px;
    --fs-sm:   12.5px;
    --fs-base: 14px;
    --fs-md:   15px;
    --fs-lg:   17px;
    --fs-xl:   22px;
    --fs-2xl:  28px;

    /* Spacing */
    --sp-1: 4px;
    --sp-2: 8px;
    --sp-3: 12px;
    --sp-4: 16px;
    --sp-5: 20px;
    --sp-6: 24px;
    --sp-8: 32px;
    --sp-10: 40px;

    /* Transitions */
    --t-fast: 120ms ease;
    --t:      180ms ease;
}

/* ---------- Base ---------- */
html, body {
    background: var(--bg-body) !important;
    color: var(--gray-800);
    font-family: var(--font-ui);
    font-size: var(--fs-base);
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

* { box-sizing: border-box; }

h1 { font-size: var(--fs-2xl); font-weight: 700; letter-spacing: -0.02em; color: var(--gray-900); }
h2 { font-size: var(--fs-xl); font-weight: 700; letter-spacing: -0.015em; color: var(--gray-900); }
h3 { font-size: var(--fs-lg); font-weight: 600; color: var(--gray-900); }

a { color: var(--brand-600); }
a:hover { color: var(--brand-700); }

.muted { color: var(--gray-500); }

/* ---------- App shell ---------- */
.app-container {
    display: block;
    min-height: 100vh;
}

.main-content {
    margin-left: 260px !important;
    padding: var(--sp-6) var(--sp-6);
    background: var(--bg-body);
    min-width: 0;
    min-height: 100vh;
}

@media (max-width: 900px) {
    .main-content { padding: var(--sp-4); margin-left: 70px !important; }
}

/* ---------- Sidebar (fixed, independent scroll) ---------- */
.sidebar {
    width: 260px;
    background: var(--sidebar-bg);
    color: var(--sidebar-fg);
    padding: 0;
    display: flex;
    flex-direction: column;
    border-right: 1px solid rgba(255,255,255,0.04);
    box-shadow: var(--shadow-md);
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    overflow: hidden;
    z-index: 100;
}

.sidebar .logo {
    padding: var(--sp-6) var(--sp-5) var(--sp-5);
    border-bottom: 1px solid rgba(255,255,255,0.06);
    display: flex;
    align-items: center;
    justify-content: center;
}
.sidebar .logo img {
    filter: brightness(1.1);
}

.sidebar nav {
    flex: 1;
    padding: var(--sp-3) var(--sp-3);
    overflow-y: auto;
}

.sidebar nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar nav ul li { margin: 2px 0; }

.sidebar .nav-section-label {
    padding: 14px 14px 6px;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--sidebar-section-label);
}

.sidebar .nav-link {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    padding: 10px 14px;
    border-radius: var(--radius);
    color: var(--sidebar-fg);
    text-decoration: none;
    font-weight: 500;
    font-size: var(--fs-base);
    transition: background var(--t-fast), color var(--t-fast), transform var(--t-fast);
    position: relative;
}

.sidebar .nav-link i {
    width: 18px;
    text-align: center;
    font-size: 14px;
    color: var(--sidebar-muted);
    transition: color var(--t-fast);
}

.sidebar .nav-link:hover {
    background: var(--sidebar-hover);
    color: #fff;
}
.sidebar .nav-link:hover i { color: #fff; }

.sidebar .nav-link.active {
    background: var(--sidebar-active-bg);
    color: #fff;
    box-shadow: 0 4px 12px rgba(79,70,229,0.35);
}
.sidebar .nav-link.active i { color: #fff; }

.logout-container {
    padding: var(--sp-4);
    border-top: 1px solid rgba(255,255,255,0.06);
}

.btn-logout {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--sp-2);
    padding: 10px;
    background: rgba(255,255,255,0.05);
    color: var(--sidebar-fg);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: var(--radius);
    cursor: pointer;
    font-weight: 500;
    transition: background var(--t-fast);
}
.btn-logout:hover { background: rgba(239,68,68,0.2); color: #fff; border-color: rgba(239,68,68,0.4); }

/* ---------- Content headers ---------- */
.content-section > header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: var(--sp-4);
    margin-bottom: var(--sp-6);
    padding-bottom: var(--sp-5);
    border-bottom: 1px solid var(--gray-200);
}
.content-section > header h1 {
    margin: 0;
    display: flex;
    align-items: center;
    gap: var(--sp-3);
}
.content-section > header h1 i {
    color: var(--brand-600);
    font-size: 0.85em;
}

/* ---------- Cards ---------- */
.form-card,
.dashboard-card,
.settings-card {
    background: var(--bg-surface);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    padding: var(--sp-6);
    transition: box-shadow var(--t);
}
.form-card:hover,
.dashboard-card:hover { box-shadow: var(--shadow); }

/* ---------- Buttons ---------- */
.btn-primary,
button[type="submit"].btn-primary {
    background: linear-gradient(135deg, var(--brand-600) 0%, var(--brand-700) 100%);
    color: #fff;
    border: none;
    padding: 10px 18px;
    border-radius: var(--radius);
    font-weight: 600;
    font-size: var(--fs-base);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: var(--sp-2);
    box-shadow: 0 2px 6px rgba(79,70,229,0.25);
    transition: transform var(--t-fast), box-shadow var(--t-fast), filter var(--t-fast);
}
.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(79,70,229,0.35);
    filter: brightness(1.05);
}
.btn-primary:active { transform: translateY(0); }

.btn-secondary {
    background: var(--bg-surface);
    color: var(--gray-700);
    border: 1px solid var(--gray-300);
    padding: 9px 16px;
    border-radius: var(--radius);
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: var(--sp-2);
    transition: all var(--t-fast);
}
.btn-secondary:hover {
    background: var(--gray-50);
    border-color: var(--gray-400);
    color: var(--gray-900);
}

.btn-sm { padding: 6px 12px; font-size: var(--fs-sm); }

.btn-link {
    background: transparent;
    border: none;
    color: var(--brand-600);
    cursor: pointer;
    padding: 4px 8px;
    font-weight: 500;
    border-radius: var(--radius-sm);
    transition: background var(--t-fast);
}
.btn-link:hover { background: var(--brand-50); }
.btn-link.text-danger { color: var(--danger-600); }
.btn-link.text-danger:hover { background: #FEE2E2; }

/* ---------- Forms ---------- */
.form-group { margin-bottom: var(--sp-4); }
.form-group label {
    display: block;
    font-size: var(--fs-sm);
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 6px;
    letter-spacing: 0.01em;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"],
.form-group input[type="number"],
.form-group input[type="date"],
.form-group input[type="tel"],
.form-group select,
.form-group textarea,
input[type="text"]:not([class]):not([type="file"]),
input[type="email"]:not([class]),
input[type="number"]:not([class]),
select:not([class]),
textarea:not([class]) {
    width: 100%;
    padding: 10px 12px;
    font-size: var(--fs-base);
    font-family: var(--font-ui);
    color: var(--gray-900);
    background: var(--bg-surface);
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    transition: border-color var(--t-fast), box-shadow var(--t-fast);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--brand-500);
    box-shadow: 0 0 0 3px rgba(99,102,241,0.15);
}

.form-group input[type="color"] {
    padding: 2px;
    height: 40px;
    cursor: pointer;
}

/* ---------- Tables ---------- */
.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: var(--bg-surface);
    border-radius: var(--radius);
    overflow: hidden;
    font-size: var(--fs-base);
}
.data-table thead th {
    background: var(--gray-50);
    color: var(--gray-600);
    font-size: var(--fs-sm);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    padding: 12px 14px;
    text-align: left;
    border-bottom: 1px solid var(--gray-200);
}
.data-table tbody td {
    padding: 14px;
    border-bottom: 1px solid var(--gray-100);
    color: var(--gray-800);
    vertical-align: middle;
}
.data-table tbody tr:hover {
    background: var(--gray-50);
}
.data-table tbody tr:last-child td { border-bottom: none; }

.table-wrapper {
    background: var(--bg-surface);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

/* ---------- Status badges ---------- */
.status-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: var(--radius-pill);
    font-size: var(--fs-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border: 1px solid transparent;
}
.status-badge.status-draft,
.status-badge.status-Draft     { background: #F3F4F6; color: #4B5563; border-color: #E5E7EB; }
.status-badge.status-sent,
.status-badge.status-Sent      { background: #DBEAFE; color: #1E40AF; border-color: #BFDBFE; }
.status-badge.status-paid,
.status-badge.status-Paid      { background: #D1FAE5; color: #065F46; border-color: #A7F3D0; }
.status-badge.status-overdue,
.status-badge.status-Overdue   { background: #FEE2E2; color: #991B1B; border-color: #FECACA; }
.status-badge.status-cancelled,
.status-badge.status-Cancelled { background: #F3F4F6; color: #6B7280; border-color: #E5E7EB; text-decoration: line-through; }
.status-badge.status-active    { background: #D1FAE5; color: #065F46; border-color: #A7F3D0; }
.status-badge.status-paused    { background: #FEF3C7; color: #92400E; border-color: #FDE68A; }
.status-badge.status-ended     { background: #F3F4F6; color: #6B7280; border-color: #E5E7EB; }
.status-badge.status-issued,
.status-badge.status-Issued    { background: #E0E7FF; color: #3730A3; border-color: #C7D2FE; }
.status-badge.status-applied,
.status-badge.status-Applied   { background: #D1FAE5; color: #065F46; border-color: #A7F3D0; }

/* ---------- KPI cards (reports, statements) ---------- */
.kpi-grid,
#reports-section .kpi-grid,
#notes-section .kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: var(--sp-4);
    margin-bottom: var(--sp-6);
}

.kpi-card,
#reports-section .kpi-card,
#notes-section .kpi-card {
    background: var(--bg-surface);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-md);
    padding: var(--sp-5);
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
    transition: transform var(--t-fast), box-shadow var(--t-fast);
}
.kpi-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}
.kpi-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 3px;
    height: 100%;
    background: var(--brand-600);
}
.kpi-label {
    font-size: var(--fs-xs);
    font-weight: 600;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: var(--sp-2);
}
.kpi-value {
    font-size: var(--fs-xl);
    font-weight: 700;
    color: var(--gray-900);
    font-family: var(--font-num);
    letter-spacing: -0.01em;
}

/* ---------- Tabs ---------- */
.tabs {
    display: flex;
    gap: 4px;
    border-bottom: 1px solid var(--gray-200);
    margin-bottom: var(--sp-5);
}
.tab-btn {
    background: transparent;
    border: none;
    padding: 10px 18px;
    font-weight: 600;
    font-size: var(--fs-base);
    color: var(--gray-500);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all var(--t-fast);
    display: inline-flex;
    align-items: center;
    gap: var(--sp-2);
}
.tab-btn:hover { color: var(--brand-600); }
.tab-btn.active {
    color: var(--brand-600);
    border-bottom-color: var(--brand-600);
}

/* ---------- Modals ---------- */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(15,23,42,0.55);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: var(--sp-5);
}
.modal.hidden { display: none !important; }
.modal-content {
    background: var(--bg-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    max-width: 680px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalIn 180ms ease;
}
@keyframes modalIn {
    from { transform: translateY(12px) scale(0.98); opacity: 0; }
    to   { transform: translateY(0) scale(1); opacity: 1; }
}
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--sp-5) var(--sp-6);
    border-bottom: 1px solid var(--gray-200);
}
.modal-header h3 { margin: 0; }
.modal-content form { padding: var(--sp-6); }

/* ---------- Dashboard specific ---------- */
#dashboard-section .dashboard-summary,
#dashboard-section .kpi-grid {
    margin-bottom: var(--sp-6);
}

/* ---------- Bulk bar tweak ---------- */
.bulk-bar {
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
}

/* ---------- Auth ---------- */
.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #EEF2FF 0%, #F5F3FF 50%, #FEF3C7 100%);
    padding: var(--sp-5);
}
.auth-card {
    background: var(--bg-surface);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    padding: var(--sp-8);
    max-width: 440px;
    width: 100%;
}

/* ---------- Scrollbars (subtle) ---------- */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--gray-300) transparent;
}
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-thumb {
    background: var(--gray-300);
    border-radius: var(--radius-pill);
}
*::-webkit-scrollbar-thumb:hover { background: var(--gray-400); }

/* ---------- Responsive sidebar ---------- */
@media (max-width: 900px) {
    .sidebar {
        width: 70px;
    }
    .sidebar .logo img { max-width: 40px !important; }
    .sidebar .nav-link {
        justify-content: center;
        padding: 12px 0;
    }
    .sidebar .nav-link span,
    .sidebar .nav-link:not(:has(i))::after { display: none; }
    .sidebar .nav-section-label,
    .sidebar .btn-logout span { display: none; }
}

/* ---------- Utility ---------- */
.text-center { text-align: center; }
.text-danger { color: var(--danger-600); }
.text-success { color: var(--accent-600); }
.text-warning { color: var(--warn-500); }

/* Rounded tag pills */
.tag-container {
    display: flex;
    flex-wrap: wrap;
    gap: var(--sp-2);
}
.tag-container > * {
    background: var(--brand-50);
    color: var(--brand-700);
    padding: 4px 12px;
    border-radius: var(--radius-pill);
    font-size: var(--fs-sm);
    font-weight: 500;
    border: 1px solid var(--brand-100);
}

/* ---------- Fixes v2.1 ---------- */

/* Topbar user profile: horizontal layout */
.dashboard-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--sp-4);
    margin-bottom: var(--sp-6);
}
.dashboard-header .user-profile {
    display: inline-flex !important;
    align-items: center;
    gap: var(--sp-3);
    padding: 6px 14px 6px 6px;
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-pill);
    box-shadow: var(--shadow-sm);
}
.dashboard-header .user-profile #user-name-display {
    font-weight: 600;
    color: var(--gray-800);
    font-size: var(--fs-sm);
    order: 2;
}
.dashboard-header .avatar-circle {
    order: 1;
    width: 34px; height: 34px;
    border-radius: 50%;
    background: var(--sidebar-active-bg);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    flex-shrink: 0;
}

/* KPI grid — pack 4 across on wide, 2 on medium, 1 on narrow */
.stats-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    gap: var(--sp-4) !important;
}
@media (max-width: 1100px) {
    .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
}
@media (max-width: 600px) {
    .stats-grid { grid-template-columns: 1fr !important; }
}

/* Quick action cards row */
.quick-actions-grid,
.dashboard-quick-actions {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: var(--sp-4);
    margin-bottom: var(--sp-6);
}
@media (max-width: 1100px) {
    .quick-actions-grid,
    .dashboard-quick-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Stat card polish */
.stat-card {
    padding: var(--sp-4) !important;
    border-radius: var(--radius-lg) !important;
    border: 1px solid var(--gray-100);
    box-shadow: var(--shadow-sm) !important;
    transition: transform .15s ease, box-shadow .15s ease;
}
.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md) !important;
}

/* Client card row — tidy layout */
.client-card {
    border-radius: var(--radius-lg);
    border: 1px solid var(--gray-100);
    box-shadow: var(--shadow-sm);
    transition: box-shadow .15s ease, transform .15s ease;
}
.client-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

/* Footer branding text */
.app-footer,
.content-footer {
    text-align: center;
    color: var(--gray-400);
    font-size: var(--fs-xs);
    padding: var(--sp-4) 0;
}

/* Invoice list bulk-action bar spacing */
.bulk-action-bar {
    border-radius: var(--radius-lg) !important;
    box-shadow: var(--shadow-sm);
}

/* Let content sections breathe the full width of main-content */
.content-section {
    max-width: 100% !important;
    width: 100%;
}

/* Sidebar nav: custom thin scrollbar for its independent scroll area */
.sidebar nav::-webkit-scrollbar { width: 6px; }
.sidebar nav::-webkit-scrollbar-track { background: transparent; }
.sidebar nav::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.08);
    border-radius: 3px;
}
.sidebar nav::-webkit-scrollbar-thumb:hover {
    background: rgba(255,255,255,0.15);
}
.sidebar nav { scrollbar-width: thin; scrollbar-color: rgba(255,255,255,0.08) transparent; }

/* Keep logout button pinned at sidebar bottom, outside scroll area */
.sidebar .btn-logout,
.sidebar .logout-btn,
.sidebar > .logout {
    margin-top: auto;
    flex-shrink: 0;
}

/* ============================================================
   Dashboard Redesign v2.2
   ============================================================ */

/* Hero-style greeting header */
#dashboard-section .dashboard-header {
    background: linear-gradient(135deg, #4F46E5 0%, #7C3AED 55%, #EC4899 100%);
    color: #fff;
    border-radius: var(--radius-xl);
    padding: var(--sp-6) var(--sp-7) !important;
    margin-bottom: var(--sp-5) !important;
    box-shadow: 0 10px 30px -10px rgba(79, 70, 229, 0.45);
    border: none !important;
    position: relative;
    overflow: hidden;
}
#dashboard-section .dashboard-header::before {
    content: "";
    position: absolute;
    top: -80px; right: -80px;
    width: 260px; height: 260px;
    background: radial-gradient(circle, rgba(255,255,255,0.15), transparent 70%);
    pointer-events: none;
}
#dashboard-section .dashboard-header::after {
    content: "";
    position: absolute;
    bottom: -60px; left: 20%;
    width: 220px; height: 220px;
    background: radial-gradient(circle, rgba(255,255,255,0.08), transparent 70%);
    pointer-events: none;
}
#dashboard-section .dashboard-header h1 {
    color: #fff !important;
    font-size: 1.75rem;
    font-weight: 700;
    margin: 0 0 4px 0;
    position: relative;
    z-index: 1;
}
#dashboard-section .dashboard-header .text-muted,
#dashboard-section .dashboard-header p {
    color: rgba(255,255,255,0.85) !important;
    margin: 0;
    position: relative;
    z-index: 1;
}
#dashboard-section .dashboard-header .user-profile {
    background: rgba(255,255,255,0.18) !important;
    border: 1px solid rgba(255,255,255,0.25) !important;
    backdrop-filter: blur(10px);
    position: relative;
    z-index: 1;
}
#dashboard-section .dashboard-header .user-profile #user-name-display {
    color: #fff !important;
}
#dashboard-section .dashboard-header .avatar-circle {
    background: #fff !important;
    color: var(--brand-600) !important;
}

/* Quick action cards — modern, tactile */
.quick-actions-bar {
    display: grid !important;
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    gap: var(--sp-4) !important;
    margin-bottom: var(--sp-5) !important;
}
@media (max-width: 1100px) {
    .quick-actions-bar { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
}
.quick-actions-bar .action-card {
    background: #fff;
    border: 1px solid var(--gray-100);
    border-radius: var(--radius-lg);
    padding: var(--sp-4) var(--sp-5) !important;
    display: flex !important;
    align-items: center;
    gap: var(--sp-4);
    cursor: pointer;
    transition: all .2s ease;
    box-shadow: var(--shadow-sm);
    text-align: left;
    position: relative;
    overflow: hidden;
}
.quick-actions-bar .action-card::after {
    content: "\f061";
    font-family: "Font Awesome 6 Free", "FontAwesome";
    font-weight: 900;
    margin-left: auto;
    color: var(--gray-300);
    font-size: 14px;
    transition: transform .2s ease, color .2s ease;
}
.quick-actions-bar .action-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 24px -12px rgba(79,70,229,0.25);
    border-color: var(--brand-200);
}
.quick-actions-bar .action-card:hover::after {
    transform: translateX(4px);
    color: var(--brand-500);
}
.quick-actions-bar .action-card .icon-circle {
    width: 44px; height: 44px;
    border-radius: var(--radius-md);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 18px;
}
.quick-actions-bar .action-card strong {
    display: block;
    font-size: var(--fs-md);
    color: var(--gray-800);
    margin-bottom: 2px;
}

/* Subscription details — compact, elegant */
#license-dashboard-card {
    background: #fff !important;
    border: 1px solid var(--gray-100) !important;
    border-radius: var(--radius-lg) !important;
    padding: var(--sp-5) var(--sp-6) !important;
    margin-bottom: var(--sp-5) !important;
    box-shadow: var(--shadow-sm) !important;
}
#license-dashboard-card h3 {
    font-size: var(--fs-md) !important;
    color: var(--gray-800) !important;
}

/* KPI stat cards — redesign with accent bar + typography */
.stats-grid { margin-bottom: var(--sp-5) !important; }
.stats-grid .stat-card {
    position: relative;
    padding: var(--sp-5) !important;
    border-radius: var(--radius-lg) !important;
    background: #fff !important;
    border: 1px solid var(--gray-100) !important;
    box-shadow: var(--shadow-sm) !important;
    display: flex !important;
    align-items: center;
    gap: var(--sp-4);
    overflow: hidden;
    transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.stats-grid .stat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 24px -12px rgba(17,24,39,0.12) !important;
    border-color: var(--gray-200) !important;
}
.stats-grid .stat-card .icon {
    width: 52px; height: 52px;
    border-radius: var(--radius-md);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}
.stats-grid .stat-card .info h3 {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--gray-500);
    margin: 0 0 6px 0;
    font-weight: 600;
}
.stats-grid .stat-card .info p {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--gray-900);
    margin: 0;
    line-height: 1.1;
}

/* Colored top accent bar per card (matches icon color) */
.stats-grid .stat-card::before {
    content: "";
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: var(--brand-500);
    opacity: 0.85;
}
.stats-grid .stat-card:nth-child(1)::before { background: #3B82F6; }
.stats-grid .stat-card:nth-child(2)::before { background: #10B981; }
.stats-grid .stat-card:nth-child(3)::before { background: #F59E0B; }
.stats-grid .stat-card:nth-child(4)::before { background: #8B5CF6; }
.stats-grid.stats-grid-secondary .stat-card:nth-child(1)::before { background: #EF4444; }
.stats-grid.stats-grid-secondary .stat-card:nth-child(2)::before { background: #64748B; }
.stats-grid.stats-grid-secondary .stat-card:nth-child(3)::before { background: #6366F1; }
.stats-grid.stats-grid-secondary .stat-card:nth-child(4)::before { background: #14B8A6; }

/* Charts row */
.charts-row {
    display: grid !important;
    grid-template-columns: 1.4fr 1fr !important;
    gap: var(--sp-4) !important;
    margin-bottom: var(--sp-5) !important;
}
@media (max-width: 1100px) {
    .charts-row { grid-template-columns: 1fr !important; }
}
.chart-card {
    background: #fff !important;
    border: 1px solid var(--gray-100) !important;
    border-radius: var(--radius-lg) !important;
    padding: var(--sp-5) !important;
    box-shadow: var(--shadow-sm) !important;
}
.chart-card h3 {
    font-size: var(--fs-md);
    color: var(--gray-800);
    margin: 0 0 var(--sp-4) 0;
    font-weight: 600;
}

/* Recent invoices / top clients rows */
.dashboard-bottom-row,
.recent-activity-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--sp-4);
}
@media (max-width: 1100px) {
    .dashboard-bottom-row,
    .recent-activity-row { grid-template-columns: 1fr; }
}
.recent-invoice-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--sp-3) 0;
    border-bottom: 1px solid var(--gray-100);
}
.recent-invoice-item:last-child { border-bottom: none; }
.recent-invoice-item .ri-left {
    display: flex; align-items: center; gap: var(--sp-3);
}
.recent-invoice-item .ri-icon {
    width: 36px; height: 36px;
    border-radius: var(--radius-md);
    display: inline-flex;
    align-items: center; justify-content: center;
}
.recent-invoice-item h4 {
    margin: 0; font-size: var(--fs-sm); font-weight: 600; color: var(--gray-800);
}
.recent-invoice-item span {
    font-size: var(--fs-xs); color: var(--gray-500);
}
.recent-invoice-item .ri-amount {
    font-weight: 700; color: var(--gray-900);
}

/* ============================================================
   Dashboard v2.3 — Compact hero + new sections
   ============================================================ */

/* Compact hero */
#dashboard-section .dashboard-header {
    padding: var(--sp-5) var(--sp-6) !important;
    margin-bottom: var(--sp-4) !important;
}
#dashboard-section .dashboard-header h1 {
    font-size: 1.5rem;
}

/* Quick action cards — prevent text wrap, tighter */
.quick-actions-bar .action-card strong {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.quick-actions-bar .action-card .text-muted {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 11px !important;
}
.quick-actions-bar .action-card > div:not(.icon-circle) {
    min-width: 0; flex: 1;
}
.quick-actions-bar .action-card .icon-circle {
    width: 40px; height: 40px;
    font-size: 16px;
}

/* Stat cards — let label wrap to two lines cleanly, keep number prominent */
.stats-grid .stat-card .info {
    min-width: 0;
    flex: 1;
}
.stats-grid .stat-card .info h3 {
    font-size: 11px;
    line-height: 1.25;
    letter-spacing: 0.08em;
    min-height: 28px;
    display: flex; align-items: center;
}
.stats-grid .stat-card .icon {
    width: 46px; height: 46px;
    font-size: 18px;
}
.stats-grid .stat-card .info p {
    font-size: 1.55rem;
}

/* Subscription card compact */
#license-dashboard-card {
    padding: var(--sp-4) var(--sp-5) !important;
}

/* ---------- Pulse row (Goal · Aging · Upcoming) ---------- */
.pulse-row {
    display: grid;
    grid-template-columns: 1fr 1.1fr 1fr;
    gap: var(--sp-4);
    margin-bottom: var(--sp-5);
}
@media (max-width: 1200px) {
    .pulse-row { grid-template-columns: 1fr; }
}
.pulse-card {
    background: #fff;
    border: 1px solid var(--gray-100);
    border-radius: var(--radius-lg);
    padding: var(--sp-5);
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    min-height: 220px;
}
.pulse-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--sp-3);
    margin-bottom: var(--sp-4);
}
.pulse-header h3 {
    font-size: var(--fs-md);
    font-weight: 600;
    color: var(--gray-800);
    margin: 0 0 2px 0;
}
.pulse-header p.muted {
    font-size: var(--fs-xs);
    color: var(--gray-500);
    margin: 0;
}
.pulse-edit-btn {
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    width: 30px; height: 30px;
    border-radius: var(--radius-md);
    color: var(--gray-500);
    cursor: pointer;
    transition: all .15s ease;
}
.pulse-edit-btn:hover {
    background: var(--brand-50);
    color: var(--brand-600);
    border-color: var(--brand-200);
}
.pulse-total {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--gray-900);
}
.pulse-link {
    font-size: var(--fs-xs);
    color: var(--brand-600);
    font-weight: 600;
    text-decoration: none;
}
.pulse-link:hover { text-decoration: underline; }

/* Goal ring */
.pulse-goal-body {
    display: flex;
    align-items: center;
    gap: var(--sp-5);
    flex: 1;
}
.pulse-goal-ring {
    --pct: 0;
    width: 120px; height: 120px;
    border-radius: 50%;
    background: conic-gradient(var(--brand-600) calc(var(--pct) * 1%), var(--gray-100) 0);
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    transition: background 0.6s ease;
}
.pulse-goal-ring-inner {
    width: 92px; height: 92px;
    background: #fff;
    border-radius: 50%;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.pulse-goal-ring-inner strong {
    font-size: 1.25rem;
    color: var(--gray-900);
    font-weight: 700;
    line-height: 1;
}
.pulse-goal-ring-inner span {
    font-size: 10px;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-top: 2px;
}
.pulse-goal-meta {
    flex: 1; min-width: 0;
    display: flex; flex-direction: column; gap: var(--sp-2);
}
.pulse-goal-meta > div {
    display: flex; justify-content: space-between; align-items: baseline;
    padding: 4px 0;
    border-bottom: 1px dashed var(--gray-100);
}
.pulse-goal-meta > div:last-child { border-bottom: none; }
.pulse-goal-meta span {
    font-size: var(--fs-xs);
    color: var(--gray-500);
}
.pulse-goal-meta strong {
    font-size: var(--fs-sm);
    color: var(--gray-900);
    font-weight: 700;
}

/* Aging list */
.pulse-aging-list {
    list-style: none; padding: 0; margin: 0;
    display: flex; flex-direction: column; gap: var(--sp-3);
    flex: 1;
}
.pulse-aging-list li {
    display: grid;
    grid-template-columns: 14px 1fr auto;
    grid-template-rows: auto auto;
    gap: 2px 10px;
    align-items: center;
}
.pulse-dot {
    grid-row: 1 / 3;
    width: 10px; height: 10px;
    border-radius: 50%;
    align-self: center;
}
.pulse-aging-label {
    font-size: var(--fs-sm);
    color: var(--gray-700);
    font-weight: 500;
}
.pulse-aging-amt {
    font-size: var(--fs-sm);
    color: var(--gray-900);
    font-weight: 700;
}
.pulse-bar {
    grid-column: 2 / 4;
    height: 5px;
    background: var(--gray-100);
    border-radius: 99px;
    overflow: hidden;
}
.pulse-bar-fill {
    height: 100%;
    border-radius: 99px;
    transition: width 0.6s ease;
}

/* Upcoming due list */
.pulse-upcoming-list {
    list-style: none; padding: 0; margin: 0;
    display: flex; flex-direction: column; gap: var(--sp-2);
    flex: 1; overflow-y: auto; max-height: 240px;
}
.pulse-upcoming-list li.pulse-upcoming-item {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    padding: var(--sp-2) var(--sp-3);
    background: var(--gray-50);
    border-radius: var(--radius-md);
    border-left: 3px solid var(--brand-500);
    transition: transform .15s ease;
}
.pulse-upcoming-list li.pulse-upcoming-item:hover {
    transform: translateX(2px);
    background: #fff;
    box-shadow: var(--shadow-sm);
}
.pulse-upcoming-list li.pulse-upcoming-item.overdue { border-left-color: var(--danger-500); }
.pulse-upcoming-list li.pulse-upcoming-item.soon { border-left-color: var(--warn-500); }
.pulse-upcoming-list .pu-client {
    font-size: var(--fs-sm); font-weight: 600; color: var(--gray-800);
    flex: 1; min-width: 0;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pulse-upcoming-list .pu-meta {
    font-size: 11px; color: var(--gray-500); display: block;
}
.pulse-upcoming-list .pu-amount {
    font-size: var(--fs-sm); font-weight: 700; color: var(--gray-900);
}
.pulse-empty, .timeline-empty {
    text-align: center;
    color: var(--gray-400);
    font-size: var(--fs-sm);
    padding: var(--sp-6) 0;
    font-style: italic;
}

/* ---------- Activity timeline ---------- */
.activity-timeline-card {
    background: #fff;
    border: 1px solid var(--gray-100);
    border-radius: var(--radius-lg);
    padding: var(--sp-5) var(--sp-6);
    box-shadow: var(--shadow-sm);
    margin-bottom: var(--sp-5);
}
.activity-timeline {
    list-style: none; padding: 0; margin: 0;
    position: relative;
}
.activity-timeline::before {
    content: "";
    position: absolute;
    left: 15px; top: 8px; bottom: 8px;
    width: 2px;
    background: linear-gradient(to bottom, var(--brand-200), var(--gray-100));
}
.activity-timeline li.timeline-item {
    position: relative;
    padding: var(--sp-3) 0 var(--sp-3) var(--sp-6);
    display: flex;
    align-items: flex-start;
    gap: var(--sp-3);
}
.activity-timeline li.timeline-item::before {
    content: "";
    position: absolute;
    left: 9px; top: 20px;
    width: 14px; height: 14px;
    border-radius: 50%;
    background: #fff;
    border: 3px solid var(--brand-500);
    z-index: 1;
    box-shadow: 0 0 0 3px #fff;
}
.activity-timeline li.timeline-item.t-paid::before { border-color: var(--accent-500); }
.activity-timeline li.timeline-item.t-created::before { border-color: var(--brand-500); }
.activity-timeline li.timeline-item.t-overdue::before { border-color: var(--danger-500); }
.activity-timeline li.timeline-item.t-client::before { border-color: var(--info-500); }
.activity-timeline .ti-content {
    flex: 1;
    background: var(--gray-50);
    border-radius: var(--radius-md);
    padding: var(--sp-3) var(--sp-4);
    transition: background .15s ease;
}
.activity-timeline li.timeline-item:hover .ti-content {
    background: #fff;
    box-shadow: var(--shadow-sm);
}
.activity-timeline .ti-title {
    font-size: var(--fs-sm);
    color: var(--gray-800);
    font-weight: 500;
}
.activity-timeline .ti-title strong { color: var(--gray-900); font-weight: 700; }
.activity-timeline .ti-meta {
    font-size: 11px;
    color: var(--gray-500);
    margin-top: 2px;
}
.activity-timeline .ti-amount {
    font-size: var(--fs-sm);
    font-weight: 700;
    color: var(--gray-900);
    white-space: nowrap;
}

/* ============================================================
   v2.5 — Email tracking: dashboard widget + invoice row chips
   ============================================================ */

.engagement-card {
    background: #fff;
    border: 1px solid var(--gray-100);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-sm);
    padding: 20px 22px 10px;
    margin-top: 18px;
}
.engagement-card .pulse-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}
.engagement-card h3 {
    font-size: 15px;
    font-weight: 700;
    color: var(--gray-900);
    margin: 0 0 2px;
    display: flex; align-items: center; gap: 8px;
}
.engagement-card h3 i { color: var(--brand-500); }
.engagement-kpis {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
}
.ekpi {
    background: var(--gray-50);
    border: 1px solid var(--gray-100);
    border-radius: 10px;
    padding: 8px 14px;
    min-width: 82px;
    text-align: center;
}
.ekpi-n { font-size: 18px; font-weight: 700; color: var(--gray-900); line-height: 1.1; }
.ekpi-l { font-size: 11px; color: var(--gray-500); text-transform: uppercase; letter-spacing: 0.04em; margin-top: 2px; font-weight: 600; }

.engagement-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-height: 420px;
    overflow-y: auto;
}
.engagement-list li {
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 12px;
    align-items: center;
    padding: 10px 12px;
    border-radius: 10px;
    transition: background .15s;
    border-bottom: 1px solid var(--gray-50);
}
.engagement-list li:last-child { border-bottom: none; }
.engagement-list li:hover { background: var(--gray-50); }
.engagement-list .eng-subject {
    font-size: 13px;
    color: var(--gray-900);
    font-weight: 600;
    margin-bottom: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.engagement-list .eng-meta {
    font-size: 11.5px;
    color: var(--gray-500);
}
.engagement-list .eng-metrics {
    display: flex;
    gap: 6px;
}
.engagement-list .engagement-empty {
    text-align: center;
    color: var(--gray-500);
    font-size: 13px;
    padding: 30px 16px;
    display: block;
}

/* Tracking chips — used in invoice list + engagement list */
.track-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 999px;
    background: var(--gray-100);
    color: var(--gray-600);
    border: 1px solid transparent;
    white-space: nowrap;
}
.track-chip i { font-size: 10px; }
.track-chip.chip-sent { background: #E0E7FF; color: #3730A3; }
.track-chip.chip-opened { background: #DCFCE7; color: #166534; }
.track-chip.chip-clicked { background: #FEF3C7; color: #92400E; }
.track-chip.chip-dead { background: var(--gray-50); color: var(--gray-400); }
.track-chip.chip-btn { cursor: pointer; transition: transform .12s, box-shadow .12s; }
.track-chip.chip-btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-sm); }

/* Invoice card: row of chips under client name */
.invoice-tracking {
    display: flex;
    gap: 6px;
    margin-top: 6px;
    flex-wrap: wrap;
    min-height: 20px;
}

/* Email Activity modal body */
.ea-event {
    padding: 12px 14px;
    border: 1px solid var(--gray-100);
    border-radius: 10px;
    margin-bottom: 10px;
    background: #fff;
}
.ea-event-head {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    font-size: 13px;
    font-weight: 600;
    color: var(--gray-900);
    margin-bottom: 4px;
}
.ea-event-head .ea-type {
    font-size: 11px;
    text-transform: uppercase;
    background: var(--brand-500);
    color: #fff;
    padding: 2px 8px;
    border-radius: 4px;
    letter-spacing: 0.04em;
}
.ea-event-meta { font-size: 11.5px; color: var(--gray-500); margin-bottom: 8px; }
.ea-event-counts { display: flex; gap: 8px; flex-wrap: wrap; }
.ea-hit-list {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px dashed var(--gray-200);
    font-size: 11.5px;
    color: var(--gray-600);
}
.ea-hit-list div { padding: 2px 0; }
.ea-hit-list .ea-ua { color: var(--gray-400); font-size: 10.5px; }
