/* Global Styles & Reset */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&family=Inter:wght@400;500;600&display=swap');

:root {
    /* Color Palette - Matching Logo Gradient */
    --bg-dark: #0c1222;
    --bg-darker: #070d18;

    /* Primary Accents - Logo Cyan */
    --primary: #22d3ee;
    --primary-hover: #06b6d4;
    --primary-rgb: 34, 211, 238;

    /* Secondary - Logo Purple */
    --secondary: #a855f7;
    --secondary-hover: #9333ea;

    /* Gradient matching logo */
    --gradient-brand: linear-gradient(135deg, #22d3ee 0%, #a855f7 100%);

    /* Glassmorphism Surface */
    --surface: rgba(15, 23, 42, 0.8);
    --surface-hover: rgba(30, 41, 59, 0.9);
    --border: rgba(255, 255, 255, 0.08);
    --glass-blur: blur(12px);

    /* Text */
    --text-main: #f1f5f9;
    --text-muted: #94a3b8;

    /* Shadows & Glows */
    --glow: 0 0 20px rgba(34, 211, 238, 0.4);
    --glow-purple: 0 0 20px rgba(168, 85, 247, 0.4);
    --shadow-card: 0 4px 20px -2px rgba(0, 0, 0, 0.4);

    /* Status Colors - Standardized */
    --success: #22c55e;
    --success-bg: rgba(34, 197, 94, 0.15);
    --warning: #f59e0b;
    --warning-bg: rgba(245, 158, 11, 0.15);
    --danger: #ef4444;
    --danger-bg: rgba(239, 68, 68, 0.15);

    /* Solid Backgrounds (for standalone pages) */
    --card-bg-solid: #1e293b;
    --border-solid: #334155;

    --radius: 0.75rem;
}

[data-theme="light"] {
    --bg-dark: #f8fafc;
    --bg-darker: #f1f5f9;
    --primary: #0891b2;
    --primary-hover: #0e7490;
    --secondary: #9333ea;

    --surface: rgba(255, 255, 255, 0.95);
    --surface-hover: #ffffff;
    --border: rgba(0, 0, 0, 0.08);

    --text-main: #0f172a;
    --text-muted: #64748b;

    --shadow-card: 0 4px 20px -2px rgba(0, 0, 0, 0.08);
    --glow: 0 0 15px rgba(8, 145, 178, 0.2);
}

[data-theme="light"] body {
    background-color: var(--bg-dark);
    /* Which is redefined to light color above */
    color: var(--text-main);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Outfit', sans-serif;
    /* Modern headlines */
    background-color: var(--bg-dark);
    color: var(--text-main);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    background-image:
        radial-gradient(circle at 10% 20%, rgba(6, 182, 212, 0.05) 0%, transparent 20%),
        radial-gradient(circle at 90% 80%, rgba(139, 92, 246, 0.05) 0%, transparent 20%);
    background-attachment: fixed;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-weight: 700;
    letter-spacing: -0.025em;
}

p,
a,
span,
div {
    font-family: 'Inter', sans-serif;
    /* Clean body text */
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: 0.3s ease;
}

a:hover {
    color: var(--secondary);
    text-shadow: 0 0 8px rgba(139, 92, 246, 0.4);
}

/* --- Components --- */

/* Glass Card */
.card,
.auth-box,
.sidebar,
.tools-panel {
    background: var(--surface);
    backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-card);
}

/* Auth Pages */
.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.auth-box {
    width: 100%;
    max-width: 420px;
    padding: 3rem;
    background: rgba(15, 23, 42, 0.6);
    /* Slightly more opaque for readability */
}

.auth-header h1 {
    font-size: 2rem;
    background: linear-gradient(135deg, #fff 0%, #cbd5e1 100%);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.5rem;
}

/* Forms */
.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-muted);
    font-size: 0.875rem;
}

.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--bg-darker);
    /* Solid background instead of transparent */
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    color: var(--text-main);
    transition: all 0.3s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(6, 182, 212, 0.2);
    background: var(--bg-darker);
}


/* Modern Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    border-radius: 9999px;
    /* Pill shape */
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 100%);
    color: #fff;
    box-shadow: 0 4px 12px rgba(6, 182, 212, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(6, 182, 212, 0.5);
}

.btn-secondary {
    background: transparent !important;
    color: var(--text-main) !important;
    border: 1px solid var(--border) !important;
}

.btn-secondary:hover {
    background: var(--surface-hover) !important;
    border-color: var(--primary) !important;
    color: var(--primary) !important;
}

[data-theme="light"] .btn-secondary {
    border-color: rgba(0, 0, 0, 0.2) !important;
}

.btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.75rem;
    border-radius: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    border: 1px solid transparent;
    transition: all 0.2s;
    cursor: pointer;
}

.btn-danger {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
    background: rgba(239, 68, 68, 0.3);
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.2);
}

/* Dashboard Grid */
.app-container {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 260px;
    height: 100vh;
    position: fixed;
    border-radius: 0;
    border-right: 1px solid var(--border);
    border-top: none;
    border-bottom: none;
    border-left: none;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.brand {
    font-size: 1.75rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--text-main);
    margin-bottom: 3rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.brand span {
    color: var(--primary);
}

.nav-links {
    list-style: none;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    color: var(--text-muted);
    border-radius: 0.75rem;
    margin-bottom: 0.5rem;
    transition: all 0.3s;
}

.nav-link:hover,
.nav-link.active {
    background: rgba(6, 182, 212, 0.1);
    color: var(--primary);
    box-shadow: 0 0 15px rgba(6, 182, 212, 0.1);
}

.main-content {
    flex: 1;
    margin-left: 260px;
    padding: 3rem;
}

/* Page Headers */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 3rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

.page-title {
    font-size: 2rem;
    color: var(--text-main);
}

/* Dashboard Cards - Floating Effect */
.card {
    padding: 2rem;
    transition: transform 0.3s, box-shadow 0.3s;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px -5px rgba(0, 0, 0, 0.4);
    border-color: rgba(255, 255, 255, 0.2);
}

/* Tables */
.table-container {
    background: rgba(15, 23, 42, 0.3);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    overflow: hidden;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: 1.25rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

th {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-muted);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

td {
    color: var(--text-main);
    font-size: 0.9rem;
}

tr:last-child td {
    border-bottom: none;
}

tr:hover td {
    background: rgba(255, 255, 255, 0.02);
}

/* Badges */
.badge {
    padding: 0.35rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
}

.badge-draft {
    background: rgba(148, 163, 184, 0.2);
    color: #cbd5e1;
    border: 1px solid rgba(148, 163, 184, 0.3);
}

.badge-sent {
    background: rgba(6, 182, 212, 0.2);
    color: #22d3ee;
    border: 1px solid rgba(6, 182, 212, 0.3);
    box-shadow: 0 0 10px rgba(6, 182, 212, 0.2);
}

.badge-completed {
    background: rgba(16, 185, 129, 0.2);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.3);
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.2);
}

.badge-declined,
.status-declined {
    background: rgba(249, 115, 22, 0.2);
    color: #fdba74;
    border: 1px solid rgba(249, 115, 22, 0.3);
}

/* Status badges for document states */
.status-badge {
    display: inline-block;
    padding: 0.35rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
}

.status-draft {
    background: rgba(148, 163, 184, 0.3);
    color: #e2e8f0;
    border: 1px solid rgba(148, 163, 184, 0.4);
}

[data-theme="light"] .status-draft {
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #cbd5e1;
}

.status-pending {
    background: rgba(6, 182, 212, 0.2);
    color: #22d3ee;
    border: 1px solid rgba(6, 182, 212, 0.3);
}

[data-theme="light"] .status-pending {
    background: #cffafe;
    color: #0e7490;
    border: 1px solid #67e8f9;
}

.status-completed {
    background: rgba(16, 185, 129, 0.2);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

[data-theme="light"] .status-completed {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #86efac;
}

.status-active {
    background: rgba(16, 185, 129, 0.2);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

[data-theme="light"] .status-active {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #86efac;
}

[data-theme="light"] .status-declined {
    background: #ffedd5;
    color: #c2410c;
    border: 1px solid #fed7aa;
}

/* Action badges for audit logs - visible in both themes */
.badge-action {
    background: rgba(100, 116, 139, 0.3);
    color: #e2e8f0;
    border: 1px solid rgba(148, 163, 184, 0.4);
    text-transform: uppercase;
    font-size: 0.7rem;
    letter-spacing: 0.5px;
}

[data-theme="light"] .badge-action {
    background: #e2e8f0;
    color: #334155;
    border: 1px solid #cbd5e1;
}

/* Status badges for invoices/subscriptions */
.badge-paid,
.badge-active {
    background: rgba(16, 185, 129, 0.2);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

[data-theme="light"] .badge-paid,
[data-theme="light"] .badge-active {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.badge-pending,
.badge-sent {
    background: rgba(59, 130, 246, 0.2);
    color: #60a5fa;
    border: 1px solid rgba(59, 130, 246, 0.3);
}

[data-theme="light"] .badge-pending,
[data-theme="light"] .badge-sent {
    background: #dbeafe;
    color: #1e40af;
    border: 1px solid #93c5fd;
}

.badge-cancelled,
.badge-failed {
    background: rgba(239, 68, 68, 0.2);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

[data-theme="light"] .badge-cancelled,
[data-theme="light"] .badge-failed {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.badge-expired,
.badge-warning {
    background: rgba(245, 158, 11, 0.2);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

[data-theme="light"] .badge-expired,
[data-theme="light"] .badge-warning {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fde68a;
}

/* Plan badges */
.badge-plan {
    background: rgba(99, 102, 241, 0.2);
    color: #a5b4fc;
    border: 1px solid rgba(99, 102, 241, 0.3);
    text-transform: uppercase;
    font-size: 0.7rem;
}

[data-theme="light"] .badge-plan {
    background: #ede9fe;
    color: #5b21b6;
    border: 1px solid #c4b5fd;
}

/* Upload Zone */
.upload-zone {
    border: 2px dashed var(--border);
    background: var(--surface);
    /* Theme aware */
    padding: 4rem;
    text-align: center;
    border-radius: var(--radius);
    transition: all 0.3s;
}

.upload-zone:hover {
    border-color: var(--primary);
    background: var(--surface-hover);
    box-shadow: 0 0 20px rgba(6, 182, 212, 0.1);
}

/* Designer */
.designer-container {
    height: calc(100vh - 6rem);
    gap: 2rem;
    display: flex;
}

.tools-panel {
    height: 100%;
    overflow-y: auto;
    background: var(--bg-darker);
    /* Distinct from main surface */
    border-right: 1px solid var(--border);
    width: 300px;
    padding: 1.5rem;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
}

.pdf-viewer {
    flex: 1;
    background: var(--bg-dark);
    /* Theme aware */
    /* Keep canvas dark grey for contrast */
    border-radius: var(--radius);
    padding: 3rem;
    overflow: auto;
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.05);
}

.pdf-page {
    position: relative;
    margin-bottom: 2rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.06);
}

.draggable-field {
    background: var(--surface);
    /* Theme aware */
    border: 1px solid var(--border);
    color: var(--text-main);
    padding: 1rem;
    margin-bottom: 0.75rem;
    border-radius: 0.5rem;
    cursor: grab;
    transition: all 0.2s;
}

.draggable-field:hover {
    border-color: var(--primary);
    box-shadow: 0 0 10px rgba(6, 182, 212, 0.2);
}

/* Overlays / Modals */
.signing-overlay {
    backdrop-filter: blur(8px);
    background: rgba(0, 0, 0, 0.7) !important;
    display: none;
    /* Default hidden */
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    align-items: center;
    /* Vertical Center */
    justify-content: center;
    /* Horizontal Center */
    z-index: 9999;
}

/* Signer Page specific overrides */
/* Signer Page specific overrides */
/* body:has(#pdfContainer) {} */

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-darker);
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Utility - Fixed */
.text-muted {
    color: var(--text-muted) !important;
}

/* Animations */
@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.8s ease-out;
}

.reveal.active {
    opacity: 1;
    transform: translateY(0);
}

/* --- Top Bar & User Menu --- */
.top-bar {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
}

.user-menu {
    position: relative;
    display: flex;
    align-items: center;
    gap: 1rem;
    cursor: pointer;
}

.avatar {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1rem;
    box-shadow: 0 0 15px rgba(6, 182, 212, 0.3);
    transition: all 0.3s;
}

.avatar:hover,
.user-menu:hover .avatar {
    transform: scale(1.1);
    box-shadow: 0 0 20px rgba(6, 182, 212, 0.5);
}

.user-info-text {
    text-align: right;
    display: none;
    /* Hidden on mobile */
}

@media (min-width: 768px) {
    .user-info-text {
        display: block;
    }
}

.user-name {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-main);
}

.user-role {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Dropdown */
.dropdown-menu {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    background: #1e293b;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 0.75rem;
    min-width: 220px;
    padding: 0.5rem;
    display: none;
    flex-direction: column;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(0, 0, 0, 0.1);
    z-index: 9999;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.2s, transform 0.2s;
    pointer-events: none;
}

[data-theme="light"] .dropdown-menu {
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.1);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.05);
}

.dropdown-menu.show {
    display: flex;
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.dropdown-item {
    padding: 0.75rem 1rem;
    color: var(--text-main);
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    transition: background 0.2s;
    text-decoration: none;
    white-space: nowrap;
}

.dropdown-item:hover {
    background: rgba(6, 182, 212, 0.1);
    color: var(--primary);
}

.dropdown-divider {
    height: 1px;
    background: var(--border);
    margin: 0.5rem 0;
}

.icon-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.25rem;
    cursor: pointer;
    transition: color 0.3s;
    padding: 0.5rem;
}

.draggable-field:hover {
    border-color: var(--primary);
    box-shadow: 0 0 10px rgba(6, 182, 212, 0.2);
}

/* Overlays / Modals */
.signing-overlay {
    backdrop-filter: blur(8px);
    background: rgba(0, 0, 0, 0.7) !important;
    display: none;
    /* Default hidden */
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    align-items: center;
    /* Vertical Center */
    justify-content: center;
    /* Horizontal Center */
    z-index: 9999;
}

/* Signer Page specific overrides */
/* Signer Page specific overrides */
/* body:has(#pdfContainer) {} */

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-darker);
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Utility - Fixed */
.text-muted {
    color: var(--text-muted) !important;
}

/* Animations */
@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.8s ease-out;
}

.reveal.active {
    opacity: 1;
    transform: translateY(0);
}

/* --- Top Bar & User Menu --- */
.top-bar {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
}

.user-menu {
    position: relative;
    display: flex;
    align-items: center;
    gap: 1rem;
    cursor: pointer;
}

.avatar {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1rem;
    box-shadow: 0 0 15px rgba(6, 182, 212, 0.3);
    transition: all 0.3s;
}

.avatar:hover,
.user-menu:hover .avatar {
    transform: scale(1.1);
    box-shadow: 0 0 20px rgba(6, 182, 212, 0.5);
}

.user-info-text {
    text-align: right;
    display: none;
    /* Hidden on mobile */
}

@media (min-width: 768px) {
    .user-info-text {
        display: block;
    }
}

.user-name {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-main);
}

.user-role {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Dropdown */
.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 0.5rem;
    background: var(--surface);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    min-width: 200px;
    padding: 0.5rem;
    display: none;
    flex-direction: column;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    z-index: 100;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.2s;
}

.dropdown-menu.show {
    display: flex;
    opacity: 1;
    transform: translateY(0);
}

.dropdown-item {
    padding: 0.75rem 1rem;
    color: var(--text-main);
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    transition: background 0.2s;
}

.dropdown-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--primary);
}

.dropdown-divider {
    height: 1px;
    background: var(--border);
    margin: 0.5rem 0;
}

.icon-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.25rem;
    cursor: pointer;
    transition: color 0.3s;
    padding: 0.5rem;
    border-radius: 50%;
}

.icon-btn:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.05);
}

/* Dashboard Stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--surface);
    padding: 1.5rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: transform 0.3s, box-shadow 0.3s;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
    border-color: var(--primary);
}

.stat-icon {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    flex-shrink: 0;
}

.stat-icon.blue {
    background: rgba(6, 182, 212, 0.1);
    color: var(--primary);
}

.stat-icon.purple {
    background: rgba(139, 92, 246, 0.1);
    color: var(--secondary);
}

.stat-icon.green {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
}

.stat-info {
    display: flex;
    flex-direction: column;
}

.stat-info h4 {
    font-size: 0.875rem;
    color: var(--text-muted);
    font-weight: 500;
    margin-bottom: 0.25rem;
}

.stat-info .value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-main);
    line-height: 1.2;
}

/* Toast Notifications */
#toast-container {
    position: fixed;
    top: 2rem;
    right: 2rem;
    z-index: 10005;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    pointer-events: none;
}

.toast {
    background: var(--surface);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border);
    padding: 1rem 1.5rem;
    border-radius: var(--radius);
    color: var(--text-main);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    gap: 1rem;
    min-width: 300px;
    transform: translateX(100%);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    pointer-events: auto;
    border-left: 4px solid var(--primary);
}

.toast.show {
    transform: translateX(0);
    opacity: 1;
}

.toast-success {
    border-left-color: #10b981;
}

.toast-error {
    border-left-color: #ef4444;
}

.toast-info {
    border-left-color: #3b82f6;
}

.toast-warning {
    border-left-color: #f59e0b;
}

.toast-icon {
    font-size: 1.5rem;
}

/* --- Page Load Animations --- */
/* Initial hidden state for animated elements */
.fade-in {
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInUp 0.6s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Staggered animation delays for sequential reveal */
.fade-in-delay-1 {
    animation-delay: 0.1s;
}

.fade-in-delay-2 {
    animation-delay: 0.2s;
}

.fade-in-delay-3 {
    animation-delay: 0.3s;
}

.fade-in-delay-4 {
    animation-delay: 0.4s;
}

.fade-in-delay-5 {
    animation-delay: 0.5s;
}

.fade-in-delay-6 {
    animation-delay: 0.6s;
}

/* Scale up animation for stat cards */
.scale-in {
    opacity: 0;
    transform: scale(0.95);
    animation: scaleIn 0.5s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Slide in from left for sidebar */
.slide-in-left {
    opacity: 0;
    transform: translateX(-20px);
    animation: slideInLeft 0.5s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Shimmer loading effect (optional for skeleton) */
@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }

    100% {
        background-position: 200% 0;
    }
}

.skeleton {
    background: linear-gradient(90deg, var(--surface) 25%, var(--surface-hover) 50%, var(--surface) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius);
}

/* Page content wrapper for coordinated animations */
.main-content>* {
    opacity: 0;
    animation: fadeInUp 0.6s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.main-content>*:nth-child(1) {
    animation-delay: 0.05s;
}

.main-content>*:nth-child(2) {
    animation-delay: 0.1s;
}

.main-content>*:nth-child(3) {
    animation-delay: 0.15s;
}

.main-content>*:nth-child(4) {
    animation-delay: 0.2s;
}

.main-content>*:nth-child(5) {
    animation-delay: 0.25s;
}

.main-content>*:nth-child(6) {
    animation-delay: 0.3s;
}

.main-content>*:nth-child(7) {
    animation-delay: 0.35s;
}

.main-content>*:nth-child(8) {
    animation-delay: 0.4s;
}

/* Stats grid stagger */
.stats-grid .stat-card {
    opacity: 0;
    animation: scaleIn 0.5s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.stats-grid .stat-card:nth-child(1) {
    animation-delay: 0.15s;
}

.stats-grid .stat-card:nth-child(2) {
    animation-delay: 0.25s;
}

.stats-grid .stat-card:nth-child(3) {
    animation-delay: 0.35s;
}

.stats-grid .stat-card:nth-child(4) {
    animation-delay: 0.45s;
}

/* Table rows staggered with subtle effect */
tbody tr {
    opacity: 0;
    animation: fadeInUp 0.4s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

tbody tr:nth-child(1) {
    animation-delay: 0.3s;
}

tbody tr:nth-child(2) {
    animation-delay: 0.35s;
}

tbody tr:nth-child(3) {
    animation-delay: 0.4s;
}

tbody tr:nth-child(4) {
    animation-delay: 0.45s;
}

tbody tr:nth-child(5) {
    animation-delay: 0.5s;
}

tbody tr:nth-child(6) {
    animation-delay: 0.55s;
}

tbody tr:nth-child(7) {
    animation-delay: 0.6s;
}

tbody tr:nth-child(8) {
    animation-delay: 0.65s;
}

tbody tr:nth-child(9) {
    animation-delay: 0.7s;
}

tbody tr:nth-child(10) {
    animation-delay: 0.75s;
}

/* Smooth sidebar reveal */
.sidebar {
    opacity: 0;
    animation: slideInLeft 0.5s cubic-bezier(0.22, 1, 0.36, 1) 0.1s forwards;
    overflow-y: auto;
}

/* Nav links stagger */
.nav-links .nav-item {
    opacity: 0;
    animation: fadeInUp 0.4s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.nav-links .nav-item:nth-child(1) {
    animation-delay: 0.2s;
}

.nav-links .nav-item:nth-child(2) {
    animation-delay: 0.25s;
}

.nav-links .nav-item:nth-child(3) {
    animation-delay: 0.3s;
}

.nav-links .nav-item:nth-child(4) {
    animation-delay: 0.35s;
}

.nav-links .nav-item:nth-child(5) {
    animation-delay: 0.4s;
}

.nav-links .nav-item:nth-child(6) {
    animation-delay: 0.45s;
}

.nav-links .nav-item:nth-child(7) {
    animation-delay: 0.5s;
}

.nav-links .nav-item:nth-child(8) {
    animation-delay: 0.55s;
}

/* Tool cards grid stagger */
.tools-grid .tool-card {
    opacity: 0;
    animation: scaleIn 0.4s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.tools-grid .tool-card:nth-child(1) {
    animation-delay: 0.1s;
}

.tools-grid .tool-card:nth-child(2) {
    animation-delay: 0.15s;
}

.tools-grid .tool-card:nth-child(3) {
    animation-delay: 0.2s;
}

.tools-grid .tool-card:nth-child(4) {
    animation-delay: 0.25s;
}

.tools-grid .tool-card:nth-child(5) {
    animation-delay: 0.3s;
}

.tools-grid .tool-card:nth-child(6) {
    animation-delay: 0.35s;
}

.tools-grid .tool-card:nth-child(7) {
    animation-delay: 0.4s;
}

.tools-grid .tool-card:nth-child(8) {
    animation-delay: 0.45s;
}

.tools-grid .tool-card:nth-child(9) {
    animation-delay: 0.5s;
}

.tools-grid .tool-card:nth-child(10) {
    animation-delay: 0.55s;
}

.tools-grid .tool-card:nth-child(11) {
    animation-delay: 0.6s;
}

.tools-grid .tool-card:nth-child(12) {
    animation-delay: 0.65s;
}