/* ==========================================
   OmniTask Design System
   Modern, Gradient-Based Print Shop UI
   ========================================== */

/* ---- CSS Variables / Design Tokens ---- */
:root {
    /* Primary Palette */
    --primary: #6366f1;
    --primary-light: #818cf8;
    --primary-dark: #4f46e5;
    --primary-50: #eef2ff;
    --primary-100: #e0e7ff;
    --primary-200: #c7d2fe;
    --primary-900: #312e81;

    /* Secondary */
    --secondary: #8b5cf6;
    --secondary-light: #a78bfa;
    --secondary-dark: #7c3aed;

    /* Accent */
    --accent: #06b6d4;
    --accent-light: #22d3ee;
    --accent-dark: #0891b2;

    /* Semantic Colors */
    --success: #10b981;
    --success-light: #d1fae5;
    --warning: #f59e0b;
    --warning-light: #fef3c7;
    --danger: #ef4444;
    --danger-light: #fee2e2;
    --info: #3b82f6;
    --info-light: #dbeafe;

    /* Neutrals */
    --gray-50: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-400: #94a3b8;
    --gray-500: #64748b;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1e293b;
    --gray-900: #0f172a;

    /* Backgrounds */
    --bg-primary: #f0f2f5;
    --bg-card: #ffffff;
    --bg-sidebar: #0f172a;
    --bg-glass: rgba(255, 255, 255, 0.8);

    /* Gradients */
    --gradient-primary: linear-gradient(135deg, #6366f1, #8b5cf6);
    --gradient-accent: linear-gradient(135deg, #06b6d4, #3b82f6);
    --gradient-success: linear-gradient(135deg, #10b981, #059669);
    --gradient-warning: linear-gradient(135deg, #f59e0b, #d97706);
    --gradient-danger: linear-gradient(135deg, #ef4444, #dc2626);
    --gradient-dark: linear-gradient(135deg, #1e293b, #0f172a);
    --gradient-purple: linear-gradient(135deg, #8b5cf6, #ec4899);
    --gradient-ocean: linear-gradient(135deg, #0ea5e9, #6366f1);
    --gradient-sunset: linear-gradient(135deg, #f97316, #ef4444);
    --gradient-emerald: linear-gradient(135deg, #10b981, #06b6d4);
    --gradient-hero: linear-gradient(135deg, #0f172a 0%, #1e1b4b 50%, #312e81 100%);

    /* Shadows */
    --shadow-xs: 0 1px 2px rgba(0,0,0,0.05);
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.1), 0 10px 10px -5px rgba(0,0,0,0.04);
    --shadow-2xl: 0 25px 50px -12px rgba(0,0,0,0.25);
    --shadow-glow: 0 0 20px rgba(99, 102, 241, 0.3);
    --shadow-card: 0 1px 3px rgba(0,0,0,0.04), 0 6px 16px rgba(0,0,0,0.04);

    /* Border Radius */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-xl: 20px;
    --radius-2xl: 24px;
    --radius-full: 9999px;

    /* Typography */
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-xs: 0.75rem;
    --font-sm: 0.8125rem;
    --font-base: 0.875rem;
    --font-md: 1rem;
    --font-lg: 1.125rem;
    --font-xl: 1.25rem;
    --font-2xl: 1.5rem;
    --font-3xl: 1.875rem;
    --font-4xl: 2.25rem;

    /* Spacing */
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.25rem;
    --space-6: 1.5rem;
    --space-8: 2rem;
    --space-10: 2.5rem;
    --space-12: 3rem;

    /* Layout */
    --sidebar-width: 260px;
    --sidebar-collapsed: 72px;
    --header-height: 64px;
    --mobile-nav-height: 64px;

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-base: 250ms ease;
    --transition-slow: 350ms ease;
    --transition-spring: 400ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ---- Reset & Base ---- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
    overflow-x: hidden;
    width: 100%;
    height: 100%;
}

body {
    font-family: var(--font-family);
    font-size: var(--font-base);
    color: var(--gray-800);
    background: var(--bg-primary);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
    width: 100%;
    display: flex;
    flex-direction: column;
}

/* Auth pages don't need flex column layout */
body.auth-page {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}

a {
    text-decoration: none;
    color: var(--primary);
    transition: color var(--transition-fast);
}

a:hover { color: var(--primary-dark); }

img { max-width: 100%; height: auto; }

button, input, select, textarea {
    font-family: inherit;
    font-size: inherit;
}

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--gray-400); }

/* ==========================================
   AUTH PAGES (Login / Register)
   ========================================== */
.auth-page {
    background: var(--gradient-hero);
    min-height: 100vh;
    position: relative;
    overflow: hidden;
    width: 100%;
}

.auth-page::before {
    content: '';
    position: absolute;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(99,102,241,0.15), transparent 70%);
    top: -200px;
    right: -200px;
    border-radius: 50%;
    animation: float 8s infinite ease-in-out;
}

.auth-page::after {
    content: '';
    position: absolute;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(139,92,246,0.12), transparent 70%);
    bottom: -100px;
    left: -100px;
    border-radius: 50%;
    animation: float 10s infinite ease-in-out reverse;
}

@keyframes float {
    0%, 100% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-30px) scale(1.05); }
}

.auth-main {
    width: 100%;
    max-width: 440px;
    padding: var(--space-6);
    position: relative;
    z-index: 1;
}

.auth-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-radius: var(--radius-2xl);
    padding: var(--space-10);
    box-shadow: var(--shadow-2xl);
    border: 1px solid rgba(255,255,255,0.2);
    animation: slideUp 0.6s ease-out;
}

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

.auth-logo {
    text-align: center;
    margin-bottom: var(--space-8);
}

.auth-logo img {
    height: 48px;
    margin-bottom: var(--space-3);
}

.auth-logo h1 {
    font-size: var(--font-2xl);
    font-weight: 800;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.5px;
}

.auth-logo p {
    color: var(--gray-500);
    font-size: var(--font-sm);
    margin-top: var(--space-1);
}

/* ---- Forms ---- */
.form-group {
    margin-bottom: var(--space-5);
    position: relative;
}

.form-label {
    display: block;
    font-size: var(--font-sm);
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: var(--space-2);
}

.form-input, .form-select, .form-textarea {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-md);
    font-size: var(--font-base);
    color: var(--gray-800);
    background: var(--bg-card);
    transition: all var(--transition-fast);
    outline: none;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

.form-input::placeholder { color: var(--gray-400); }

.form-input-icon {
    position: relative;
}

.form-input-icon .form-input {
    padding-left: 44px;
}

.form-input-icon .icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray-400);
    width: 18px;
    height: 18px;
}

.form-textarea {
    min-height: 100px;
    resize: vertical;
}

.form-select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%2364748b' viewBox='0 0 16 16'%3E%3Cpath d='M4 6l4 4 4-4'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 40px;
}

.form-check {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.form-check input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
    cursor: pointer;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-4);
}

.form-error {
    color: var(--danger);
    font-size: var(--font-xs);
    margin-top: var(--space-1);
}

/* ---- Buttons ---- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-md);
    font-size: var(--font-base);
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-base);
    position: relative;
    overflow: hidden;
    white-space: nowrap;
    text-decoration: none;
    line-height: 1.4;
}

.btn:active { transform: scale(0.97); }

.btn svg, .btn i { width: 18px; height: 18px; flex-shrink: 0; }

.btn-primary {
    background: var(--gradient-primary);
    color: white;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

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

.btn-secondary {
    background: var(--gray-100);
    color: var(--gray-700);
    border: 1px solid var(--gray-200);
}

.btn-secondary:hover {
    background: var(--gray-200);
    color: var(--gray-800);
}

.btn-accent {
    background: var(--gradient-accent);
    color: white;
    box-shadow: 0 4px 12px rgba(6, 182, 212, 0.4);
}

.btn-success {
    background: var(--gradient-success);
    color: white;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

.btn-warning {
    background: var(--gradient-warning);
    color: white;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.4);
}

.btn-danger {
    background: var(--gradient-danger);
    color: white;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
}

.btn-ghost {
    background: transparent;
    color: var(--gray-600);
    padding: 8px 12px;
}

.btn-ghost:hover { background: var(--gray-100); }

.btn-outline {
    background: transparent;
    color: var(--primary);
    border: 2px solid var(--primary);
}

.btn-outline:hover {
    background: var(--primary);
    color: white;
}

.btn-sm { padding: 6px 14px; font-size: var(--font-sm); }
.btn-lg { padding: 14px 28px; font-size: var(--font-md); }
.btn-xl { padding: 16px 32px; font-size: var(--font-lg); }
.btn-block { width: 100%; }
.btn-icon { padding: 10px; width: 40px; height: 40px; }
.btn-icon-sm { padding: 6px; width: 32px; height: 32px; }

.btn-group {
    display: flex;
    gap: var(--space-2);
    flex-wrap: wrap;
}

/* ==========================================
   LAYOUT - Sidebar + Main Content
   ========================================== */
.app-page {
    display: flex;
    min-height: 100vh;
}

/* ---- Sidebar ---- */
.sidebar {
    width: var(--sidebar-width);
    background: var(--gradient-dark);
    color: white;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    display: flex;
    flex-direction: column;
    transition: all var(--transition-base);
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar-brand {
    padding: var(--space-6);
    display: flex;
    align-items: center;
    gap: var(--space-3);
    border-bottom: 1px solid rgba(255,255,255,0.08);
    min-height: var(--header-height);
}

.sidebar-brand-logo {
    width: 40px;
    height: 40px;
    border-radius: 0;
    background: none;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.sidebar-brand-logo img {
    width: auto;
    height: 40px;
    max-width: 120px;
    object-fit: contain;
    border-radius: 0;
}

.sidebar-brand-text {
    font-weight: 700;
    font-size: var(--font-lg);
    letter-spacing: -0.3px;
}

.sidebar-nav {
    flex: 1;
    padding: var(--space-4) 0;
}

.sidebar-section {
    padding: var(--space-2) var(--space-4);
}

.sidebar-section-title {
    font-size: var(--font-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(255,255,255,0.35);
    padding: var(--space-3) var(--space-4);
    margin-top: var(--space-2);
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: 10px 20px;
    color: rgba(255,255,255,0.6);
    border-radius: var(--radius-md);
    margin: 2px 12px;
    transition: all var(--transition-fast);
    font-size: var(--font-sm);
    font-weight: 500;
    position: relative;
}

.sidebar-link:hover {
    color: white;
    background: rgba(255,255,255,0.08);
}

.sidebar-link.active {
    color: white;
    background: rgba(99, 102, 241, 0.2);
}

.sidebar-link.active::before {
    content: '';
    position: absolute;
    left: -12px;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 24px;
    background: var(--primary);
    border-radius: 0 3px 3px 0;
}

.sidebar-link svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.sidebar-link .badge {
    margin-left: auto;
    background: var(--danger);
    color: white;
    font-size: 10px;
    min-width: 20px;
    height: 20px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    padding: 0 6px;
}

/* Pulsing badge for urgent approvals (approved estimates) */
@keyframes badgePulse {
    0%   { box-shadow: 0 0 0 0 rgba(239,68,68,0.7); }
    70%  { box-shadow: 0 0 0 7px rgba(239,68,68,0); }
    100% { box-shadow: 0 0 0 0 rgba(239,68,68,0); }
}
.sidebar-link .badge.badge-pulse {
    animation: badgePulse 1.6s ease-out infinite;
    background: var(--danger);
}

.sidebar-user {
    padding: var(--space-4) var(--space-6);
    border-top: 1px solid rgba(255,255,255,0.08);
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.sidebar-user-avatar {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    background: var(--gradient-accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: var(--font-sm);
    flex-shrink: 0;
    color: white;
}

.sidebar-user-avatar img {
    width: 100%;
    height: 100%;
    border-radius: var(--radius-full);
    object-fit: cover;
}

.sidebar-user-info {
    flex: 1;
    min-width: 0;
}

.sidebar-user-name {
    font-size: var(--font-sm);
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-role {
    font-size: var(--font-xs);
    color: rgba(255,255,255,0.5);
    text-transform: capitalize;
}

/* ---- Top Header ---- */
.top-header {
    position: fixed;
    top: 0;
    left: var(--sidebar-width);
    right: 0;
    height: var(--header-height);
    background: rgba(255,255,255,0.9);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--space-8);
    z-index: 90;
    transition: left var(--transition-base);
}

.header-left {
    display: flex;
    align-items: center;
    gap: var(--space-4);
}

.header-title {
    font-size: var(--font-xl);
    font-weight: 700;
    color: var(--gray-900);
    letter-spacing: -0.3px;
}

.header-subtitle {
    font-size: var(--font-sm);
    color: var(--gray-500);
}

.header-right {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.header-search {
    position: relative;
}

.header-search input {
    padding: 8px 16px 8px 40px;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-full);
    width: 240px;
    font-size: var(--font-sm);
    transition: all var(--transition-fast);
    background: var(--gray-50);
    outline: none;
}

.header-search input:focus {
    border-color: var(--primary);
    width: 300px;
    background: white;
}

.header-search svg {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    color: var(--gray-400);
}

.header-notification {
    position: relative;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    border: none;
    background: var(--gray-100);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.header-notification:hover {
    background: var(--primary-50);
    color: var(--primary);
}

.header-notification svg { width: 20px; height: 20px; }

.header-notification .notification-dot {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 8px;
    height: 8px;
    background: var(--danger);
    border-radius: 50%;
    border: 2px solid white;
}

.menu-toggle {
    display: none;
    width: 40px;
    height: 40px;
    border: none;
    background: none;
    cursor: pointer;
    color: var(--gray-700);
}

.menu-toggle svg { width: 24px; height: 24px; }

/* ---- Main Content Area ---- */
.app-main {
    margin-left: var(--sidebar-width);
    margin-top: var(--header-height);
    padding: var(--space-6);
    flex: 1 0 auto;
    transition: margin-left var(--transition-base), width var(--transition-base);
    box-sizing: border-box;
    max-width: none;
    width: calc(100% - var(--sidebar-width));
    overflow-x: hidden;
}

/* ---- Footer ---- */
.app-footer {
    margin-left: var(--sidebar-width);
    width: calc(100% - var(--sidebar-width));
    padding: 14px var(--space-6);
    border-top: 1px solid var(--gray-100);
    text-align: center;
    color: var(--gray-400);
    font-size: 12px;
    white-space: nowrap;
    box-sizing: border-box;
    transition: margin-left var(--transition-base), width var(--transition-base);
    background: var(--bg-primary);
}

/* ---- Page Header ---- */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-8);
    flex-wrap: wrap;
    gap: var(--space-4);
}

.page-title {
    font-size: var(--font-2xl);
    font-weight: 800;
    color: var(--gray-900);
    letter-spacing: -0.5px;
}

.page-description {
    color: var(--gray-500);
    font-size: var(--font-sm);
    margin-top: var(--space-1);
}

/* ==========================================
   CARDS
   ========================================== */
.card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    border: 1px solid rgba(0,0,0,0.04);
    overflow: visible;
    transition: all var(--transition-base);
    position: relative;
}

.card:hover {
    box-shadow: var(--shadow-lg);
}

.card-header {
    padding: var(--space-5) var(--space-6);
    border-bottom: 1px solid var(--gray-100);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-title {
    font-size: var(--font-md);
    font-weight: 700;
    color: var(--gray-900);
}

.card-body {
    padding: var(--space-6);
}

.card-footer {
    padding: var(--space-4) var(--space-6);
    border-top: 1px solid var(--gray-100);
    background: var(--gray-50);
}

/* Stat Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: var(--space-6);
    margin-bottom: var(--space-8);
}

/* ==========================================
   STAT CARDS — Modern Gradient Redesign
   ========================================== */

/* Add rich gradient variants */
:root {
    --gradient-primary:  linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    --gradient-accent:   linear-gradient(135deg, #06b6d4 0%, #3b82f6 100%);
    --gradient-success:  linear-gradient(135deg, #10b981 0%, #059669 100%);
    --gradient-warning:  linear-gradient(135deg, #f59e0b 0%, #ef6c00 100%);
    --gradient-danger:   linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    --gradient-dark:     linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    --gradient-purple:   linear-gradient(135deg, #8b5cf6 0%, #ec4899 100%);
    --gradient-indigo:   linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    --gradient-teal:     linear-gradient(135deg, #14b8a6 0%, #0891b2 100%);
    --gradient-rose:     linear-gradient(135deg, #f43f5e 0%, #e11d48 100%);
    --gradient-amber:    linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    --gradient-emerald:  linear-gradient(135deg, #10b981 0%, #047857 100%);
    --gradient-sky:      linear-gradient(135deg, #0ea5e9 0%, #2563eb 100%);
    --gradient-violet:   linear-gradient(135deg, #7c3aed 0%, #a855f7 100%);
    --gradient-fuchsia:  linear-gradient(135deg, #d946ef 0%, #a21caf 100%);
    --gradient-orange:   linear-gradient(135deg, #f97316 0%, #ea580c 100%);
}

.stat-card {
    border-radius: 20px;
    padding: 24px;
    position: relative;
    overflow: hidden;
    border: none;
    transition: transform 0.25s cubic-bezier(.34,1.56,.64,1), box-shadow 0.25s ease;
    cursor: default;
    /* default fallback background */
    background: var(--gradient-primary);
    color: white;
}

.stat-card:hover {
    transform: translateY(-4px) scale(1.01);
}

/* Remove old top-bar ::after */
.stat-card::after { display: none; }

/* Subtle noise/grain texture overlay */
.stat-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse at top right, rgba(255,255,255,0.18) 0%, transparent 60%),
        radial-gradient(ellipse at bottom left, rgba(0,0,0,0.08) 0%, transparent 60%);
    pointer-events: none;
    z-index: 0;
}

/* All card content sits above the overlay */
.stat-card-inner,
.stat-card-value,
.stat-card-label,
.stat-card-change { position: relative; z-index: 1; }

/* Color variants */
.stat-card.primary  { background: var(--gradient-primary);  box-shadow: 0 8px 32px rgba(99,102,241,0.45); }
.stat-card.accent   { background: var(--gradient-accent);   box-shadow: 0 8px 32px rgba(6,182,212,0.40); }
.stat-card.success  { background: var(--gradient-success);  box-shadow: 0 8px 32px rgba(16,185,129,0.40); }
.stat-card.warning  { background: var(--gradient-warning);  box-shadow: 0 8px 32px rgba(245,158,11,0.40); }
.stat-card.danger   { background: var(--gradient-danger);   box-shadow: 0 8px 32px rgba(239,68,68,0.40); }
.stat-card.purple   { background: var(--gradient-purple);   box-shadow: 0 8px 32px rgba(139,92,246,0.40); }
.stat-card.indigo   { background: var(--gradient-indigo);   box-shadow: 0 8px 32px rgba(79,70,229,0.40); }
.stat-card.teal     { background: var(--gradient-teal);     box-shadow: 0 8px 32px rgba(20,184,166,0.40); }
.stat-card.rose     { background: var(--gradient-rose);     box-shadow: 0 8px 32px rgba(244,63,94,0.40); }
.stat-card.amber    { background: var(--gradient-amber);    box-shadow: 0 8px 32px rgba(245,158,11,0.40); }
.stat-card.emerald  { background: var(--gradient-emerald);  box-shadow: 0 8px 32px rgba(16,185,129,0.40); }
.stat-card.sky      { background: var(--gradient-sky);      box-shadow: 0 8px 32px rgba(14,165,233,0.40); }
.stat-card.violet   { background: var(--gradient-violet);   box-shadow: 0 8px 32px rgba(124,58,237,0.40); }
.stat-card.fuchsia  { background: var(--gradient-fuchsia);  box-shadow: 0 8px 32px rgba(217,70,239,0.40); }
.stat-card.orange   { background: var(--gradient-orange);   box-shadow: 0 8px 32px rgba(249,115,22,0.40); }

.stat-card:hover.primary  { box-shadow: 0 16px 48px rgba(99,102,241,0.55); }
.stat-card:hover.accent   { box-shadow: 0 16px 48px rgba(6,182,212,0.50); }
.stat-card:hover.success  { box-shadow: 0 16px 48px rgba(16,185,129,0.50); }
.stat-card:hover.warning  { box-shadow: 0 16px 48px rgba(245,158,11,0.50); }
.stat-card:hover.danger   { box-shadow: 0 16px 48px rgba(239,68,68,0.50); }
.stat-card:hover.purple   { box-shadow: 0 16px 48px rgba(139,92,246,0.50); }

.stat-card-inner {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

/* Icon: frosted glass circle */
.stat-card-icon {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    background: rgba(255,255,255,0.22);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255,255,255,0.3);
    flex-shrink: 0;
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
}
.stat-card-icon svg { width: 26px; height: 26px; }

/* Remove old colored icon variants — all icons are now frosted white */
.stat-card-icon.primary,
.stat-card-icon.accent,
.stat-card-icon.success,
.stat-card-icon.warning,
.stat-card-icon.danger,
.stat-card-icon.purple { background: rgba(255,255,255,0.22); box-shadow: 0 4px 16px rgba(0,0,0,0.12); }

.stat-card-value {
    font-size: clamp(1.6rem, 2.8vw, 2.2rem);
    font-weight: 900;
    color: white;
    line-height: 1.1;
    margin-top: 16px;
    letter-spacing: -0.5px;
    text-shadow: 0 2px 8px rgba(0,0,0,0.12);
}

.stat-card-label {
    font-size: var(--font-sm);
    color: rgba(255,255,255,0.82);
    font-weight: 500;
    margin-top: 4px;
}

/* Badge / change pill */
.stat-card-change {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: var(--font-xs);
    font-weight: 700;
    margin-top: 12px;
    padding: 4px 10px;
    border-radius: 99px;
    background: rgba(255,255,255,0.22);
    color: white;
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255,255,255,0.25);
}

.stat-card-change.up   { background: rgba(255,255,255,0.25); color: white; }
.stat-card-change.down { background: rgba(0,0,0,0.15);       color: rgba(255,255,255,0.9); }

/* =========================================== */
   ========================================== */
.table-container {
    overflow-x: auto;
    border-radius: var(--radius-lg);
}

/* When a table contains action dropdowns, the last column must not be clipped.
   We lift overflow to visible so position:absolute menus escape the scroll box,
   but keep the horizontal scroll on the inner table wrapper via a separate rule. */
.table-container.has-actions {
    overflow: visible;
}
.table-container.has-actions .table-scroll {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th {
    background: var(--gray-50);
    padding: 12px 16px;
    font-size: var(--font-xs);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--gray-500);
    text-align: left;
    border-bottom: 2px solid var(--gray-200);
    position: sticky;
    top: 0;
}

.data-table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--gray-100);
    font-size: var(--font-sm);
    color: var(--gray-700);
}

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

.data-table tbody tr:hover {
    background: var(--gray-50);
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

/* ==========================================
   BADGES / STATUS
   ========================================== */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: var(--radius-full);
    font-size: var(--font-xs);
    font-weight: 600;
    line-height: 1.4;
}

.badge-primary { background: var(--primary-100); color: var(--primary-dark); }
.badge-success { background: var(--success-light); color: #065f46; }
.badge-warning { background: var(--warning-light); color: #92400e; }
.badge-danger { background: var(--danger-light); color: #991b1b; }
.badge-info { background: var(--info-light); color: #1e40af; }
.badge-gray { background: var(--gray-100); color: var(--gray-600); }

.badge-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    display: inline-block;
}

.badge-primary .badge-dot { background: var(--primary); }
.badge-success .badge-dot { background: var(--success); }
.badge-warning .badge-dot { background: var(--warning); }
.badge-danger .badge-dot { background: var(--danger); }
.badge-info .badge-dot { background: var(--info); }

.status-pending { background: var(--warning-light); color: #92400e; }
.status-in_progress { background: var(--info-light); color: #1e40af; }
.status-ready_pickup { background: #ddd6fe; color: #5b21b6; }
.status-out_delivery { background: #fed7aa; color: #9a3412; }
.status-completed { background: var(--success-light); color: #065f46; }
.status-cancelled { background: var(--danger-light); color: #991b1b; }
.status-paid { background: var(--success-light); color: #065f46; }
.status-partial { background: var(--warning-light); color: #92400e; }
.status-overdue { background: var(--danger-light); color: #991b1b; }
.status-draft { background: var(--gray-100); color: var(--gray-600); }
.status-sent { background: var(--info-light); color: #1e40af; }

/* ==========================================
   MODAL
   ========================================== */
.modal-overlay {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-4);
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-base);
    box-sizing: border-box;
    margin: 0;
}

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

.modal {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 540px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-2xl);
    transform: scale(0.9) translateY(20px);
    transition: transform var(--transition-spring);
}

.modal-overlay.active .modal {
    transform: scale(1) translateY(0);
}

.modal-lg { max-width: 720px; }
.modal-xl { max-width: 900px; }

.modal-header {
    padding: var(--space-6);
    border-bottom: 1px solid var(--gray-100);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-title {
    font-size: var(--font-lg);
    font-weight: 700;
    color: var(--gray-900);
}

.modal-close {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    border: none;
    background: var(--gray-100);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    color: var(--gray-500);
}

.modal-close:hover {
    background: var(--danger-light);
    color: var(--danger);
}

.modal-body {
    padding: var(--space-6);
}

.modal-footer {
    padding: var(--space-4) var(--space-6);
    border-top: 1px solid var(--gray-100);
    display: flex;
    justify-content: flex-end;
    gap: var(--space-3);
}

/* ==========================================
   TASK BOARD (Trello-style)
   ========================================== */
.task-board {
    display: flex;
    gap: var(--space-4);
    min-height: 400px;
    overflow-x: auto;
    padding-bottom: var(--space-4);
    align-items: flex-start;
}

.task-board::-webkit-scrollbar { height: 6px; }
.task-board::-webkit-scrollbar-track { background: var(--gray-100); border-radius: 3px; }
.task-board::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 3px; }

.task-column {
    background: var(--gray-50);
    border-radius: var(--radius-lg);
    padding: var(--space-4);
    min-height: 300px;
    flex: 0 0 300px;
    width: 300px;
}

.task-column-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-4);
    padding-bottom: var(--space-3);
    border-bottom: 2px solid transparent;
}

.task-column.todo .task-column-header { border-color: var(--gray-300); }
.task-column.in-progress .task-column-header { border-color: var(--info); }
.task-column.done .task-column-header { border-color: var(--success); }
.task-column.getting-approval .task-column-header { border-color: #f59e0b; }
.task-column.changes-required .task-column-header { border-color: var(--danger); }
.task-column.approved .task-column-header { border-color: #10b981; }
.task-column.custom .task-column-header { border-color: var(--primary); }

.task-column-title {
    font-weight: 700;
    font-size: var(--font-sm);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.task-column.todo .task-column-title { color: var(--gray-600); }
.task-column.in-progress .task-column-title { color: var(--info); }
.task-column.done .task-column-title { color: var(--success); }
.task-column.getting-approval .task-column-title { color: #f59e0b; }
.task-column.changes-required .task-column-title { color: var(--danger); }
.task-column.approved .task-column-title { color: #10b981; }
.task-column.custom .task-column-title { color: var(--primary); }

/* Add Column Button */
.task-add-column {
    flex: 0 0 240px;
    width: 240px;
    background: transparent;
    border: 2px dashed var(--gray-200);
    border-radius: var(--radius-lg);
    padding: var(--space-4);
    min-height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-base);
    color: var(--gray-400);
    gap: 8px;
    font-size: var(--font-sm);
    font-weight: 500;
}
.task-add-column:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-50);
}

/* Column actions */
.task-column-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}
.task-column-actions button {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--gray-400);
    padding: 2px;
    border-radius: var(--radius-sm);
    transition: color 0.15s;
    display: flex;
}
.task-column-actions button:hover { color: var(--gray-700); }

/* File upload area */
.file-upload-area {
    border: 2px dashed var(--gray-200);
    border-radius: var(--radius-lg);
    padding: var(--space-5);
    text-align: center;
    cursor: pointer;
    transition: all var(--transition-fast);
    background: var(--gray-50);
}
.file-upload-area:hover, .file-upload-area.drag-over {
    border-color: var(--primary);
    background: var(--primary-50);
    color: var(--primary);
}
.file-upload-area input[type="file"] { display: none; }

/* Attachment list */
.attachment-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 8px;
}
.attachment-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--gray-50);
    border-radius: var(--radius-md);
    border: 1px solid var(--gray-100);
    font-size: var(--font-sm);
}
.attachment-item img {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: var(--radius-sm);
}
.attachment-item .attachment-icon {
    width: 40px;
    height: 40px;
    background: var(--primary-50);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
}
.attachment-item .attachment-info { flex: 1; min-width: 0; }
.attachment-item .attachment-name {
    font-weight: 500;
    color: var(--gray-700);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.attachment-item .attachment-size { font-size: var(--font-xs); color: var(--gray-400); }
.attachment-item .attachment-remove {
    background: none; border: none; cursor: pointer;
    color: var(--gray-400); padding: 4px; border-radius: var(--radius-sm);
}
.attachment-item .attachment-remove:hover { color: var(--danger); }

/* Task card attachment badge */
.task-card-attachments {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: var(--font-xs);
    color: var(--gray-400);
    margin-top: 6px;
}
.task-card-attachments svg { width: 12px; height: 12px; }

.task-column-count {
    background: var(--gray-200);
    color: var(--gray-600);
    font-size: var(--font-xs);
    font-weight: 700;
    min-width: 24px;
    height: 24px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 8px;
}

.task-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    min-height: 200px;
}

.task-card {
    background: white;
    border-radius: var(--radius-md);
    padding: var(--space-4);
    box-shadow: var(--shadow-sm);
    cursor: grab;
    transition: all var(--transition-fast);
    border: 1px solid transparent;
}

.task-card:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--primary-200);
}

.task-card.dragging {
    opacity: 0.5;
    box-shadow: var(--shadow-xl);
}

.task-card-title {
    font-weight: 600;
    font-size: var(--font-sm);
    color: var(--gray-800);
    margin-bottom: var(--space-2);
}

.task-card-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: var(--space-3);
}

.task-card-priority {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    padding: 2px 8px;
    border-radius: var(--radius-sm);
}

.task-card-priority.low { background: var(--gray-100); color: var(--gray-500); }
.task-card-priority.medium { background: var(--info-light); color: var(--info); }
.task-card-priority.high { background: var(--warning-light); color: var(--warning); }
.task-card-priority.urgent { background: var(--danger-light); color: var(--danger); }

.task-card-assignee {
    width: 28px;
    height: 28px;
    border-radius: var(--radius-full);
    background: var(--gradient-primary);
    color: white;
    font-size: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}

.task-card-due {
    font-size: var(--font-xs);
    color: var(--gray-500);
    display: flex;
    align-items: center;
    gap: 4px;
}

.task-card-due.overdue { color: var(--danger); }

.task-card-order {
    font-size: var(--font-xs);
    color: var(--primary);
    font-weight: 600;
    margin-bottom: var(--space-1);
}

/* ==========================================
   CHARTS
   ========================================== */
.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: var(--space-6);
    margin-bottom: var(--space-8);
}

.chart-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    border: 1px solid rgba(0,0,0,0.04);
    padding: var(--space-6);
}

.chart-card canvas {
    width: 100% !important;
    max-height: 300px;
}

/* ==========================================
   NOTIFICATIONS
   ========================================== */
.notification-list {
    display: flex;
    flex-direction: column;
}

.notification-item {
    display: flex;
    gap: var(--space-4);
    padding: var(--space-4) var(--space-6);
    border-bottom: 1px solid var(--gray-100);
    transition: background var(--transition-fast);
    cursor: pointer;
    align-items: flex-start;
}

.notification-item:hover { background: var(--gray-50); }
.notification-item.unread { background: var(--primary-50); }

.notification-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: white;
}

.notification-icon.order { background: var(--gradient-primary); }
.notification-icon.payment { background: var(--gradient-success); }
.notification-icon.task { background: var(--gradient-accent); }
.notification-icon.alert { background: var(--gradient-warning); }
.notification-icon.system { background: var(--gradient-dark); }

.notification-icon svg { width: 18px; height: 18px; }

.notification-content { flex: 1; min-width: 0; }

.notification-title {
    font-weight: 600;
    font-size: var(--font-sm);
    color: var(--gray-800);
}

.notification-message {
    font-size: var(--font-sm);
    color: var(--gray-500);
    margin-top: 2px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.notification-time {
    font-size: var(--font-xs);
    color: var(--gray-400);
    margin-top: var(--space-1);
}

/* Per-notification action buttons */
.notif-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
    opacity: 0;
    transition: opacity 0.15s ease;
}
.notification-item:hover .notif-actions { opacity: 1; }
.notif-btn {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, transform 0.1s;
    flex-shrink: 0;
    padding: 0;
}
.notif-btn svg { width: 13px; height: 13px; stroke-width: 2.5; }
.notif-btn:hover { transform: scale(1.1); }
.notif-btn--read  { background: var(--success-light); color: #065f46; }
.notif-btn--read:hover  { background: #a7f3d0; }
.notif-btn--delete { background: var(--danger-light); color: var(--danger); }
.notif-btn--delete:hover { background: #fecaca; }
@keyframes notifSlideOut {
    0%   { opacity:1; max-height:120px; padding-top:var(--space-4); padding-bottom:var(--space-4); }
    100% { opacity:0; max-height:0; padding-top:0; padding-bottom:0; overflow:hidden; }
}
.notification-item.removing { animation: notifSlideOut 0.25s ease forwards; pointer-events:none; }

/* ==========================================
   TOAST NOTIFICATIONS
   ========================================== */
.toast-container {
    position: fixed;
    top: var(--space-6);
    right: var(--space-6);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.toast {
    background: white;
    border-radius: var(--radius-md);
    padding: var(--space-4) var(--space-6);
    box-shadow: var(--shadow-xl);
    display: flex;
    align-items: center;
    gap: var(--space-3);
    min-width: 320px;
    max-width: 440px;
    transform: translateX(120%);
    transition: transform var(--transition-spring);
    border-left: 4px solid;
}

.toast.show { transform: translateX(0); }
.toast.success { border-color: var(--success); }
.toast.error { border-color: var(--danger); }
.toast.warning { border-color: var(--warning); }
.toast.info { border-color: var(--info); }

.toast-message {
    flex: 1;
    font-size: var(--font-sm);
    font-weight: 500;
    color: var(--gray-700);
}

.toast-close {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--gray-400);
    padding: 4px;
}

/* ==========================================
   TABS
   ========================================== */
.tabs {
    display: flex;
    gap: var(--space-1);
    border-bottom: 2px solid var(--gray-200);
    margin-bottom: var(--space-6);
    overflow-x: auto;
}

.tab {
    padding: var(--space-3) var(--space-5);
    font-size: var(--font-sm);
    font-weight: 600;
    color: var(--gray-500);
    border: none;
    background: none;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.tab:hover { color: var(--gray-700); }

.tab.active {
    color: var(--primary);
    border-color: var(--primary);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease-out;
}

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

/* ==========================================
   EMPTY STATES
   ========================================== */
.empty-state {
    text-align: center;
    padding: var(--space-12) var(--space-6);
    color: var(--gray-400);
}

.empty-state svg {
    width: 64px;
    height: 64px;
    margin-bottom: var(--space-4);
    opacity: 0.5;
}

.empty-state h3 {
    font-size: var(--font-lg);
    color: var(--gray-600);
    margin-bottom: var(--space-2);
}

.empty-state p {
    font-size: var(--font-sm);
    max-width: 400px;
    margin: 0 auto var(--space-6);
}

/* ==========================================
   DROPDOWN MENU
   ========================================== */
.dropdown {
    position: relative;
}

/* Ensure the row/cell doesn't clip the menu */
.data-table td:last-child,
.data-table th:last-child {
    overflow: visible;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    min-width: 200px;
    background: white;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-xl);
    border: 1px solid var(--gray-200);
    padding: var(--space-2);
    opacity: 0;
    visibility: hidden;
    transform: translateY(8px);
    transition: all var(--transition-fast);
    z-index: 9000;
}

.dropdown-menu.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(4px);
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-2) var(--space-3);
    font-size: var(--font-sm);
    color: var(--gray-700);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
    border: none;
    background: none;
    width: 100%;
    text-align: left;
}

.dropdown-item:hover {
    background: var(--gray-50);
    color: var(--gray-900);
}

.dropdown-item svg { width: 16px; height: 16px; }

.dropdown-divider {
    height: 1px;
    background: var(--gray-100);
    margin: var(--space-2) 0;
}

/* ==========================================
   AVATAR
   ========================================== */
.avatar {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: var(--font-sm);
    color: white;
    background: var(--gradient-primary);
    flex-shrink: 0;
    overflow: hidden;
}

.avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.avatar-sm { width: 32px; height: 32px; font-size: 12px; }
.avatar-lg { width: 56px; height: 56px; font-size: var(--font-xl); }
.avatar-xl { width: 80px; height: 80px; font-size: var(--font-2xl); }

.avatar-stack {
    display: flex;
}

.avatar-stack .avatar {
    border: 2px solid white;
    margin-left: -8px;
}

.avatar-stack .avatar:first-child {
    margin-left: 0;
}

/* ==========================================
   FILTERS / TOOLBAR
   ========================================== */
.toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
    margin-bottom: var(--space-6);
    flex-wrap: wrap;
}

.toolbar-left, .toolbar-right {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.filter-group {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    background: var(--gray-100);
    border-radius: var(--radius-md);
    padding: 4px;
}

.filter-btn {
    padding: 6px 14px;
    border: none;
    background: none;
    border-radius: var(--radius-sm);
    font-size: var(--font-sm);
    font-weight: 500;
    color: var(--gray-600);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.filter-btn.active {
    background: white;
    color: var(--gray-900);
    box-shadow: var(--shadow-sm);
    font-weight: 600;
}

/* ==========================================
   PROGRESS BAR
   ========================================== */
.progress-bar {
    height: 8px;
    background: var(--gray-200);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    border-radius: var(--radius-full);
    background: var(--gradient-primary);
    transition: width var(--transition-slow);
}

.progress-bar-fill.success { background: var(--gradient-success); }
.progress-bar-fill.warning { background: var(--gradient-warning); }
.progress-bar-fill.danger { background: var(--gradient-danger); }

/* ==========================================
   TOGGLE SWITCH
   ========================================== */
.toggle {
    position: relative;
    width: 48px;
    height: 26px;
}

.toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    inset: 0;
    background: var(--gray-300);
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: all var(--transition-base);
}

.toggle-slider::before {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: white;
    top: 3px;
    left: 3px;
    transition: transform var(--transition-base);
    box-shadow: var(--shadow-sm);
}

.toggle input:checked + .toggle-slider {
    background: var(--primary);
}

.toggle input:checked + .toggle-slider::before {
    transform: translateX(22px);
}

/* ==========================================
   INVOICE PREVIEW
   ========================================== */
.invoice-preview {
    background: white;
    max-width: 800px;
    margin: 0 auto;
    padding: var(--space-10);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
}

.invoice-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: var(--space-8);
    padding-bottom: var(--space-6);
    border-bottom: 2px solid var(--gray-200);
}

.invoice-title {
    font-size: var(--font-3xl);
    font-weight: 800;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.invoice-meta {
    text-align: right;
    font-size: var(--font-sm);
    color: var(--gray-600);
}

.invoice-meta strong {
    display: block;
    font-size: var(--font-md);
    color: var(--gray-900);
}

.invoice-parties {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-8);
    margin-bottom: var(--space-8);
}

.invoice-totals {
    text-align: right;
    margin-top: var(--space-6);
    padding-top: var(--space-4);
    border-top: 2px solid var(--gray-200);
}

.invoice-totals-row {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-8);
    padding: var(--space-2) 0;
    font-size: var(--font-sm);
}

.invoice-totals-row.total {
    font-size: var(--font-lg);
    font-weight: 800;
    color: var(--gray-900);
    border-top: 2px solid var(--gray-200);
    padding-top: var(--space-3);
    margin-top: var(--space-2);
}

/* ==========================================
   MOBILE BOTTOM NAVIGATION
   ========================================== */
.mobile-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--mobile-nav-height);
    background: white;
    border-top: 1px solid var(--gray-200);
    z-index: 100;
    justify-content: space-around;
    align-items: center;
    padding: 0 var(--space-2);
}

.mobile-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    color: var(--gray-400);
    font-size: 10px;
    font-weight: 600;
    padding: var(--space-2);
    transition: color var(--transition-fast);
}

.mobile-nav-item svg { width: 22px; height: 22px; }

.mobile-nav-item.active { color: var(--primary); }

/* ==========================================
   LOADING / SKELETON
   ========================================== */
.skeleton {
    background: linear-gradient(90deg, var(--gray-200) 25%, var(--gray-100) 50%, var(--gray-200) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-sm);
}

@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

.loading-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--gray-200);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: var(--space-8) auto;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ==========================================
   DRAG AND DROP
   ========================================== */
.drop-zone {
    border: 2px dashed var(--gray-300);
    border-radius: var(--radius-lg);
    padding: var(--space-8);
    text-align: center;
    cursor: pointer;
    transition: all var(--transition-fast);
    background: var(--gray-50);
}

.drop-zone:hover, .drop-zone.dragover {
    border-color: var(--primary);
    background: var(--primary-50);
}

.drop-zone svg {
    width: 48px;
    height: 48px;
    color: var(--gray-400);
    margin-bottom: var(--space-3);
}

.drop-zone p {
    color: var(--gray-500);
    font-size: var(--font-sm);
}

/* ==========================================
   CUSTOMER PORTAL
   ========================================== */
.portal-header {
    background: var(--gradient-primary);
    color: white;
    padding: var(--space-8);
    border-radius: var(--radius-xl);
    margin-bottom: var(--space-6);
}

.portal-header h2 {
    font-size: var(--font-2xl);
    font-weight: 800;
}

.portal-header p {
    opacity: 0.8;
    font-size: var(--font-sm);
    margin-top: var(--space-1);
}

.portal-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: var(--space-4);
    margin-top: var(--space-6);
}

.portal-stat {
    background: rgba(255,255,255,0.15);
    border-radius: var(--radius-md);
    padding: var(--space-4);
    text-align: center;
}

.portal-stat-value {
    font-size: var(--font-2xl);
    font-weight: 800;
}

.portal-stat-label {
    font-size: var(--font-xs);
    opacity: 0.8;
}

/* ==========================================
   SETTINGS PAGE
   ========================================== */
.settings-grid {
    display: grid;
    grid-template-columns: 250px 1fr;
    gap: var(--space-6);
}

.settings-nav {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}

.settings-nav-link {
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-md);
    font-size: var(--font-sm);
    font-weight: 500;
    color: var(--gray-600);
    display: flex;
    align-items: center;
    gap: var(--space-3);
    transition: all var(--transition-fast);
    cursor: pointer;
    border: none;
    background: none;
    text-align: left;
    width: 100%;
}

.settings-nav-link:hover {
    background: var(--gray-100);
    color: var(--gray-900);
}

.settings-nav-link.active {
    background: var(--primary-50);
    color: var(--primary);
    font-weight: 600;
}

.settings-nav-link svg { width: 18px; height: 18px; }

.settings-section {
    display: none;
}

.settings-section.active {
    display: block;
    animation: fadeIn 0.3s ease-out;
}

.setting-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-5) 0;
    border-bottom: 1px solid var(--gray-100);
}

.setting-row:last-child { border-bottom: none; }

.setting-info h4 {
    font-size: var(--font-sm);
    font-weight: 600;
    color: var(--gray-900);
}

.setting-info p {
    font-size: var(--font-xs);
    color: var(--gray-500);
    margin-top: 2px;
}

/* ==========================================
   SEARCH HIGHLIGHT
   ========================================== */
.search-highlight {
    background: rgba(99, 102, 241, 0.15);
    padding: 1px 4px;
    border-radius: 3px;
}

/* ==========================================
   RESPONSIVE
   ========================================== */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .top-header {
        left: 0;
    }

    .app-main {
        margin-left: 0;
        width: 100%;
        padding: var(--space-5);
    }

    .app-footer {
        margin-left: 0;
        width: 100%;
    }

    .menu-toggle { display: flex; }

    .charts-grid {
        grid-template-columns: 1fr;
    }

    .task-board {
        flex-direction: row;
        flex-wrap: nowrap;
        overflow-x: auto;
    }
    .task-column {
        flex: 0 0 260px;
        width: 260px;
    }

    .settings-grid {
        grid-template-columns: 1fr;
    }

    .invoice-parties {
        grid-template-columns: 1fr;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    /* Sidebar overlay */
    .sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.5);
        z-index: 99;
    }

    .sidebar-overlay.show { display: block; }
}

@media (max-width: 768px) {
    .app-main {
        padding: var(--space-4);
        width: 100%;
        padding-bottom: calc(var(--mobile-nav-height) + var(--space-4));
    }

    .mobile-nav { display: flex; }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--space-4);
    }

    .stat-card { padding: 18px; border-radius: 16px; }
    .stat-card-value { font-size: var(--font-xl); }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .page-title { font-size: var(--font-xl); }

    .toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .toolbar-left, .toolbar-right {
        width: 100%;
        flex-wrap: wrap;
    }

    .header-search { display: none; }

    .data-table { font-size: var(--font-xs); }
    .data-table th, .data-table td { padding: 10px 8px; }

    .auth-card { padding: var(--space-6); }

    .toast-container {
        left: var(--space-4);
        right: var(--space-4);
        top: var(--space-4);
    }

    .toast { min-width: auto; }

    .modal { margin: var(--space-4); }
}

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

    .portal-stats {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ==========================================
   PRINT STYLES
   ========================================== */
@media print {
    .sidebar, .top-header, .mobile-nav, .btn, .toast-container {
        display: none !important;
    }

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

    .invoice-preview {
        box-shadow: none;
        border: none;
    }
}

/* ==========================================
   UTILITY CLASSES
   ========================================== */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-sm { font-size: var(--font-sm); }
.text-xs { font-size: var(--font-xs); }
.text-muted { color: var(--gray-500); }
.text-primary { color: var(--primary); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }

.mt-1 { margin-top: var(--space-1); }
.mt-2 { margin-top: var(--space-2); }
.mt-3 { margin-top: var(--space-3); }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
.mt-8 { margin-top: var(--space-8); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }
.mr-2 { margin-right: var(--space-2); }
.ml-auto { margin-left: auto; }

.p-4 { padding: var(--space-4); }
.p-6 { padding: var(--space-6); }

.d-flex { display: flex; }
.d-grid { display: grid; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.flex-wrap { flex-wrap: wrap; }
.flex-1 { flex: 1; }

.rounded { border-radius: var(--radius-md); }
.rounded-lg { border-radius: var(--radius-lg); }

.hidden { display: none !important; }
.w-full { width: 100%; }
.overflow-hidden { overflow: hidden; }
.cursor-pointer { cursor: pointer; }
.no-select { user-select: none; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ==========================================
   OMNITASK UI REFRESH — Appended Overrides
   Modern, Full-Width, Gradient Polish
   ========================================== */

/* Force all direct children of app-main to fill available width */
.app-main > *,
.app-main > .card,
.app-main > .page-header,
.app-main > [style] {
    width: 100%;
    box-sizing: border-box;
    max-width: none !important;
}

/* Ensure cards, tables and grids fill their container */
.card { width: 100%; box-sizing: border-box; }
.data-table { width: 100%; }
.table-container { width: 100%; }
.stats-grid { width: 100%; }
.charts-grid { width: 100%; }
.reports-grid { width: 100%; }
.analytics-grid { width: 100%; }

/* --- Full-Width Content Area --- */
.app-main {
    padding: var(--space-5) var(--space-6);
    max-width: none;
    width: calc(100% - var(--sidebar-width));
    box-sizing: border-box;
    overflow-x: hidden;
    flex: 1 0 auto;
}

/* Better background texture */
body.app-page {
    background: #f0f2f7;
    background-image: 
        radial-gradient(circle at 20% 50%, rgba(99,102,241,0.03) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(139,92,246,0.03) 0%, transparent 50%);
}

/* --- Enhanced Sidebar --- */
.sidebar {
    background: linear-gradient(180deg, #0c1330 0%, #111827 40%, #0f172a 100%);
    border-right: 1px solid rgba(255,255,255,0.04);
}

.sidebar-brand {
    background: transparent;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}

.sidebar-brand-logo {
    background: none;
    box-shadow: none;
}

.sidebar-link {
    border-radius: var(--radius-md);
    transition: all 200ms cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-link:hover {
    background: rgba(255,255,255,0.07);
    color: white;
    transform: translateX(2px);
}

.sidebar-link.active {
    background: linear-gradient(135deg, rgba(99,102,241,0.25), rgba(139,92,246,0.15));
    color: white;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.08);
}

.sidebar-link.active::before {
    background: linear-gradient(to bottom, var(--primary-light), var(--secondary));
    width: 3px;
    border-radius: 0 4px 4px 0;
}

/* --- Enhanced Top Header --- */
.top-header {
    background: rgba(255,255,255,0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(0,0,0,0.06);
    box-shadow: 0 1px 20px rgba(0,0,0,0.04);
}

/* --- Enhanced Cards --- */
.card {
    border: none;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06), 0 1px 3px rgba(0,0,0,0.04);
    transition: box-shadow 0.25s ease;
}

.card:hover {
    box-shadow: 0 6px 24px rgba(0,0,0,0.09);
}

.card-header {
    background: linear-gradient(to right, #fafbfc, #ffffff);
    border-bottom: 1px solid rgba(0,0,0,0.05);
}

.card-title {
    font-weight: 700;
    letter-spacing: -0.2px;
}

/* --- Chart Cards Enhanced --- */
.chart-card {
    border: none;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
}

/* --- Dashboard Drag Grid --- */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: var(--space-6);
    margin-bottom: var(--space-6);
}

.widget-container {
    position: relative;
    cursor: default;
}

.widget-container[draggable="true"] {
    cursor: grab;
}

.widget-container[draggable="true"]:active {
    cursor: grabbing;
}

.widget-container.dragging {
    opacity: 0.4;
    transform: scale(0.98);
    z-index: 1000;
}

.widget-container.drag-over {
    outline: 2px dashed var(--primary);
    outline-offset: 4px;
    border-radius: var(--radius-lg);
    background: var(--primary-50);
}

.widget-drag-handle {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 28px;
    height: 28px;
    border-radius: var(--radius-sm);
    background: var(--gray-100);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s ease;
    cursor: grab;
    z-index: 10;
    color: var(--gray-400);
}

.widget-container:hover .widget-drag-handle {
    opacity: 1;
}

.widget-drag-handle:hover {
    background: var(--gray-200);
    color: var(--gray-600);
}

.widget-drag-handle svg { width: 14px; height: 14px; }

/* col spans for dashboard grid */
.col-span-4 { grid-column: span 4; }
.col-span-3 { grid-column: span 3; }
.col-span-6 { grid-column: span 6; }
.col-span-8 { grid-column: span 8; }
.col-span-12 { grid-column: span 12; }

/* --- Enhanced Table --- */
.data-table th {
    background: linear-gradient(to bottom, #f8fafc, #f1f5f9);
    font-size: 11px;
    letter-spacing: 0.6px;
    color: var(--gray-500);
    font-weight: 700;
}

.data-table tbody tr:hover {
    background: linear-gradient(to right, var(--primary-50), transparent);
}

/* --- Enhanced Buttons --- */
.btn {
    font-weight: 600;
    letter-spacing: 0.1px;
}

.btn-primary {
    background: var(--gradient-primary);
    box-shadow: 0 2px 8px rgba(99,102,241,0.3);
}

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

.btn-accent {
    background: var(--gradient-accent);
    box-shadow: 0 2px 8px rgba(6,182,212,0.3);
}

.btn-success {
    background: var(--gradient-success);
    box-shadow: 0 2px 8px rgba(16,185,129,0.3);
}

/* --- Page Header Enhancement --- */
.page-header {
    padding-bottom: var(--space-6);
    border-bottom: 1px solid rgba(0,0,0,0.05);
    margin-bottom: var(--space-6);
}

.page-title {
    font-size: clamp(1.3rem, 2vw, 1.6rem);
    background: linear-gradient(135deg, var(--gray-900), var(--gray-700));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* --- Toolbar Enhancement --- */
.toolbar {
    background: white;
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-lg);
    box-shadow: 0 1px 6px rgba(0,0,0,0.04);
    margin-bottom: var(--space-5);
    border: 1px solid rgba(0,0,0,0.04);
}

/* --- Wave-Style Invoice --- */
.wave-invoice {
    background: white;
    max-width: 860px;
    margin: 0 auto;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    overflow: hidden;
    font-family: var(--font-family);
}

.wave-invoice-header {
    background: linear-gradient(135deg, #1e293b 0%, #312e81 60%, #4f46e5 100%);
    padding: 40px 48px;
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.wave-invoice-brand h1 {
    font-size: 24px;
    font-weight: 800;
    letter-spacing: -0.5px;
    margin-bottom: 4px;
}

.wave-invoice-brand p {
    opacity: 0.7;
    font-size: 13px;
    line-height: 1.6;
}

.wave-invoice-number {
    text-align: right;
}

.wave-invoice-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    opacity: 0.6;
    margin-bottom: 6px;
}

.wave-invoice-num-value {
    font-size: 28px;
    font-weight: 800;
    letter-spacing: -1px;
}

.wave-invoice-type-badge {
    display: inline-block;
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.2);
    padding: 4px 14px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-top: 8px;
}

.wave-invoice-body {
    padding: 40px 48px;
}

.wave-invoice-parties {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    margin-bottom: 36px;
    padding-bottom: 36px;
    border-bottom: 1px solid var(--gray-100);
}

.wave-invoice-party-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--primary);
    margin-bottom: 10px;
}

.wave-invoice-party-name {
    font-size: 17px;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 4px;
}

.wave-invoice-party-detail {
    font-size: 13px;
    color: var(--gray-500);
    line-height: 1.7;
}

.wave-invoice-meta-row {
    display: flex;
    gap: 32px;
    margin-bottom: 32px;
    flex-wrap: wrap;
}

.wave-invoice-meta-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.wave-invoice-meta-item .label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--gray-400);
}

.wave-invoice-meta-item .value {
    font-size: 14px;
    font-weight: 600;
    color: var(--gray-800);
}

/* Invoice items table */
.wave-invoice-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 24px;
}

.wave-invoice-table thead tr {
    background: linear-gradient(to right, var(--gray-900), #1e1b4b);
    color: white;
}

.wave-invoice-table th {
    padding: 12px 16px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    text-align: left;
    color: rgba(255,255,255,0.8);
}

.wave-invoice-table th:last-child,
.wave-invoice-table td:last-child {
    text-align: right;
}

.wave-invoice-table th:first-child { border-radius: 8px 0 0 8px; }
.wave-invoice-table th:last-child { border-radius: 0 8px 8px 0; }

.wave-invoice-table tbody tr {
    border-bottom: 1px solid var(--gray-100);
}

.wave-invoice-table tbody tr:last-child {
    border-bottom: none;
}

.wave-invoice-table tbody tr:hover {
    background: var(--gray-50);
}

.wave-invoice-table td {
    padding: 14px 16px;
    font-size: 13px;
    color: var(--gray-700);
    vertical-align: top;
}

.wave-invoice-table td .item-desc {
    font-weight: 600;
    color: var(--gray-900);
    margin-bottom: 2px;
}

.wave-invoice-table td .item-note {
    font-size: 12px;
    color: var(--gray-400);
}

/* Totals section */
.wave-invoice-totals {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 32px;
}

.wave-invoice-totals-box {
    width: 300px;
    border: 1px solid var(--gray-100);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.wave-invoice-totals-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 20px;
    font-size: 13px;
    border-bottom: 1px solid var(--gray-100);
}

.wave-invoice-totals-row:last-child {
    border-bottom: none;
}

.wave-invoice-totals-row.grand-total {
    background: linear-gradient(135deg, #1e293b, #312e81);
    color: white;
    font-size: 15px;
    font-weight: 700;
    padding: 14px 20px;
}

.wave-invoice-totals-row .row-label {
    color: var(--gray-500);
    font-weight: 500;
}

.wave-invoice-totals-row.grand-total .row-label {
    color: rgba(255,255,255,0.8);
    font-weight: 600;
}

/* Balance due accent */
.wave-invoice-balance {
    background: linear-gradient(135deg, rgba(239,68,68,0.06), rgba(239,68,68,0.02));
    border: 1px solid rgba(239,68,68,0.15);
    border-radius: var(--radius-md);
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
}

.wave-invoice-balance.paid {
    background: linear-gradient(135deg, rgba(16,185,129,0.06), rgba(16,185,129,0.02));
    border-color: rgba(16,185,129,0.15);
}

.wave-invoice-balance .balance-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--gray-700);
}

.wave-invoice-balance .balance-amount {
    font-size: 20px;
    font-weight: 800;
    color: var(--danger);
}

.wave-invoice-balance.paid .balance-amount {
    color: var(--success);
}

/* Invoice notes / footer */
.wave-invoice-footer {
    border-top: 1px solid var(--gray-100);
    padding-top: 24px;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 24px;
}

.wave-invoice-notes {
    flex: 1;
}

.wave-invoice-notes h4 {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--gray-400);
    margin-bottom: 6px;
}

.wave-invoice-notes p {
    font-size: 13px;
    color: var(--gray-500);
    line-height: 1.6;
}

.wave-invoice-stamp {
    text-align: center;
    flex-shrink: 0;
}

.wave-invoice-stamp .stamp {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    border: 3px solid;
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transform: rotate(-15deg);
}

.stamp-paid { border-color: var(--success); color: var(--success); }
.stamp-overdue { border-color: var(--danger); color: var(--danger); }
.stamp-draft { border-color: var(--gray-300); color: var(--gray-400); }
.stamp-sent { border-color: var(--info); color: var(--info); }

/* --- Enhanced Badge --- */
.badge {
    font-weight: 600;
}

/* --- Modal improvements --- */
.modal-header {
    background: linear-gradient(to right, #fafbfc, #ffffff);
}

/* --- Notification item enhanced --- */
.notification-item.unread {
    background: linear-gradient(to right, var(--primary-50), white);
    border-left: 3px solid var(--primary);
    padding-left: calc(var(--space-6) - 3px);
}

/* --- Settings page enhancement --- */
.settings-grid {
    grid-template-columns: 240px 1fr;
    gap: var(--space-8);
}

.settings-nav-card {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
    padding: var(--space-4);
    position: sticky;
    top: calc(var(--header-height) + var(--space-4));
}

.settings-nav-link.active {
    background: linear-gradient(135deg, var(--primary-50), rgba(139,92,246,0.06));
    color: var(--primary);
}

/* --- Loyalty config row enhancement --- */
.loyalty-rate-config {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--primary-50);
    border: 1px solid var(--primary-100);
    border-radius: var(--radius-md);
    padding: 12px 16px;
    font-size: 13px;
    font-weight: 500;
    color: var(--primary-dark);
    margin-top: 8px;
}

/* --- Reports full-width grid --- */
.reports-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
    gap: var(--space-6);
}

/* --- Responsive fixes for full-width --- */
@media (max-width: 1200px) {
    .col-span-4 { grid-column: span 6; }
    .col-span-3 { grid-column: span 6; }
}

@media (max-width: 900px) {
    .col-span-4, .col-span-3, .col-span-6, .col-span-8 { grid-column: span 12; }
    .wave-invoice-header { padding: 24px 28px; flex-direction: column; gap: 16px; }
    .wave-invoice-body { padding: 24px 28px; }
    .wave-invoice-parties { grid-template-columns: 1fr; gap: 24px; }
}

@media (max-width: 1024px) {
    .dashboard-grid {
        grid-template-columns: repeat(6, 1fr);
    }
}

/* --- Print enhancements for Wave invoice --- */
@media print {
    .wave-invoice {
        box-shadow: none;
        border-radius: 0;
    }
    .wave-invoice-header {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    .wave-invoice-table thead tr {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
}

/* ---- Typography upgrade ---- */
:root {
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-display: 'Plus Jakarta Sans', 'Inter', sans-serif;
}

h1, h2, h3, .page-title, .card-title, .stat-card-value, .modal-title {
    font-family: var(--font-display);
}

.sidebar-brand-text {
    font-family: var(--font-display);
    font-weight: 800;
    letter-spacing: -0.3px;
}

/* ---- Sidebar active glow ---- */
.sidebar-link.active {
    box-shadow: 0 2px 12px rgba(99,102,241,0.2), inset 0 1px 0 rgba(255,255,255,0.06);
}

/* ---- Top header search enhancement ---- */
.header-search input {
    background: var(--gray-50);
    border-radius: var(--radius-md);
    transition: all 0.2s ease;
}

.header-search input:focus {
    background: white;
    box-shadow: 0 0 0 3px rgba(99,102,241,0.12);
}

/* ---- Smooth card reveal animation ---- */
@keyframes cardReveal {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

.stat-card, .card, .chart-card {
    animation: cardReveal 0.35s ease-out both;
}

.stat-card:nth-child(1) { animation-delay: 0.04s; }
.stat-card:nth-child(2) { animation-delay: 0.08s; }
.stat-card:nth-child(3) { animation-delay: 0.12s; }
.stat-card:nth-child(4) { animation-delay: 0.16s; }
.stat-card:nth-child(5) { animation-delay: 0.20s; }
.stat-card:nth-child(6) { animation-delay: 0.24s; }

/* ---- Reports/Analytics full-width grid ---- */
.analytics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--space-6);
    margin-bottom: var(--space-6);
}

/* ---- Form input improvements ---- */
.form-input:focus, .form-select:focus, .form-textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99,102,241,0.12);
    background: white;
}

/* ---- Table row hover gradient ---- */
.data-table tbody tr:hover td:first-child {
    border-left: 3px solid var(--primary);
    padding-left: 13px;
}

/* ---- Improved empty state ---- */
.empty-state {
    background: radial-gradient(circle at 50% 40%, var(--primary-50), transparent 70%);
}

/* ---- Widget container base for dashboard ---- */
.widget-container > * {
    height: 100%;
}

.widget-container.col-span-3 > .stat-card,
.widget-container.col-span-3 > .card {
    height: auto;
}

/* ─── Customer Smart Search ──────────────────────────── */
.customer-search-wrap { position: relative; }

.customer-search-dropdown {
    display: none;
    position: absolute;
    z-index: 1000;
    width: 100%;
    top: calc(100% + 4px);
    left: 0;
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-md);
    box-shadow: 0 8px 24px rgba(0,0,0,.12);
    max-height: 240px;
    overflow-y: auto;
}

.cs-result-item {
    padding: 10px 14px;
    cursor: pointer;
    border-bottom: 1px solid var(--gray-100);
    font-size: var(--font-sm);
    transition: background .12s;
}
.cs-result-item:last-child { border-bottom: none; }
.cs-result-item:hover { background: var(--gray-50); }
.cs-result-item .cs-name { font-weight: 600; color: var(--gray-800); }
.cs-result-item .cs-sub  { color: var(--gray-400); font-size: var(--font-xs); margin-top: 1px; }

.customer-selected-chip {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 6px;
    padding: 7px 12px;
    background: var(--gray-50);
    border: 1px solid var(--primary);
    border-radius: var(--radius-sm);
    font-size: var(--font-sm);
}
.customer-selected-chip .chip-name  { font-weight: 600; color: var(--primary); }
.customer-selected-chip .chip-email { color: var(--gray-400); font-size: var(--font-xs); }

/* ─── Convert to Order modal header ─────────────────── */
#convertToOrderModal .modal-header {
    background: var(--gradient-primary);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

/* ─── Invoice creation table ────────────────────────── */
.inv-table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--font-sm);
}
.inv-table thead th {
    padding: 8px 10px;
    background: var(--gray-50);
    border-bottom: 2px solid var(--gray-200);
    color: var(--gray-500);
    font-weight: 600;
    font-size: var(--font-xs);
    text-transform: uppercase;
    letter-spacing: .04em;
    white-space: nowrap;
}
.inv-table tbody tr.line-item td {
    padding: 6px 6px;
    border-bottom: 1px solid var(--gray-100);
    vertical-align: middle;
}
.inv-table tbody tr.line-item:hover td { background: var(--gray-50); }
.inv-table .form-input {
    border: 1px solid transparent;
    background: transparent;
    padding: 6px 8px;
    font-size: var(--font-sm);
}
.inv-table .form-input:focus {
    border-color: var(--primary);
    background: white;
    box-shadow: 0 0 0 2px rgba(99,102,241,.1);
}

/* Inventory item dropdown */
.inv-item-drop {
    position: absolute;
    z-index: 1000;
    left: 0; right: 0;
    top: calc(100% + 2px);
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-md);
    box-shadow: 0 10px 30px rgba(0,0,0,.13);
    max-height: 210px;
    overflow-y: auto;
}
.iid-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 9px 12px;
    cursor: pointer;
    border-bottom: 1px solid var(--gray-100);
    font-size: var(--font-sm);
    gap: 12px;
    transition: background .1s;
}
.iid-row:last-child { border-bottom: none; }
.iid-row:hover { background: var(--gray-50); }
.iid-name  { font-weight: 500; color: var(--gray-800); }
.iid-sku   { font-size: var(--font-xs); color: var(--gray-400); background: var(--gray-100);
             padding: 1px 5px; border-radius: 4px; margin-left: 5px; }
.iid-right { display: flex; align-items: center; gap: 10px; flex-shrink: 0; font-size: var(--font-xs); }
.iid-price { font-weight: 700; color: var(--primary); }
.iid-ok    { color: #059669; }
.iid-low   { color: #d97706; }
.iid-out   { color: var(--danger); }
.iid-msg   { padding: 10px 12px; color: var(--gray-400); font-size: var(--font-sm); }

/* Stock chip below item row */
.inv-stock-chip {
    display: none;
    align-items: center;
    gap: 4px;
    font-size: 10px;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 20px;
    margin-top: 3px;
    line-height: 1.6;
    width: fit-content;
}
.sc-ok  { background: #d1fae5; color: #065f46; }
.sc-low { background: #fef3c7; color: #92400e; }
.sc-out { background: #fee2e2; color: #991b1b; }

/* ─── Convert to Order modal header  ─────────────────── */
#convertToOrderModal .modal-header {
    background: var(--gradient-primary);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

/* ─── Invoice Line Item Grid ─────────────────────────── */
.line-item {
    border: 1px solid var(--gray-100);
    border-radius: var(--radius-md);
    padding: 10px 12px;
    margin-bottom: 10px;
    background: var(--white);
    transition: border-color .15s;
}
.line-item:hover { border-color: var(--gray-200); }

.li-grid {
    display: grid;
    grid-template-columns: 3fr 90px 110px 110px 36px;
    gap: 8px;
    align-items: start;
}

.li-desc-col { display: flex; flex-direction: column; }

/* Product picker inside line item */
.li-product-wrap { position: relative; margin-bottom: 5px; }

.li-product-dropdown {
    display: none;
    position: absolute;
    z-index: 999;
    width: 100%;
    min-width: 280px;
    top: calc(100% + 2px);
    left: 0;
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-md);
    box-shadow: 0 8px 28px rgba(0,0,0,.14);
    max-height: 200px;
    overflow-y: auto;
}

.ps-result {
    padding: 9px 13px;
    cursor: pointer;
    border-bottom: 1px solid var(--gray-100);
    transition: background .1s;
}
.ps-result:last-child { border-bottom: none; }
.ps-result:hover { background: var(--gray-50); }

.ps-result-main { display: flex; align-items: center; gap: 8px; }
.ps-name  { font-weight: 600; font-size: var(--font-sm); color: var(--gray-800); }
.ps-sku   { font-size: var(--font-xs); color: var(--gray-400); background: var(--gray-100); padding: 1px 6px; border-radius: 4px; }

.ps-result-meta { display: flex; justify-content: space-between; margin-top: 3px; font-size: var(--font-xs); }
.ps-price { color: var(--primary); font-weight: 600; }

.ps-stock-ok  { color: var(--success); }
.ps-stock-low { color: var(--warning, #f59e0b); }
.ps-stock-out { color: var(--danger); }

.ps-msg { padding: 10px 13px; font-size: var(--font-sm); color: var(--gray-400); }

/* Stock badge on selected product */
.li-stock-badge {
    display: none;
    align-items: center;
    gap: 5px;
    font-size: var(--font-xs);
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 20px;
    margin-top: 3px;
    width: fit-content;
}
.li-stock-badge i { width: 11px; height: 11px; }

.li-stock-badge.stock-ok  { background: #d1fae5; color: #065f46; }
.li-stock-badge.stock-low { background: #fef3c7; color: #92400e; }
.li-stock-badge.stock-out { background: #fee2e2; color: #991b1b; }