/* ==========================================================================
   SEWIFT Atelier OS - Ultra Premium Glowing Glassmorphism Stylesheet
   Fonts: Outfit (Geometric Headings) & Inter (Clean UI/Body)
   Theme: Obsidian Space (Dark) & Frosted Silk Lavender (Light)
   ========================================================================== */

:root {
    /* --- Dark Mode (Default) --- */
    --bg-color: #04010a; /* Obsidian Space */
    --card-bg: rgba(12, 7, 26, 0.5); /* Semi-transparent Glass */
    --card-border: rgba(255, 255, 255, 0.04); /* Sleek sheen outline */
    --card-border-hover: rgba(139, 92, 246, 0.3); /* Glowing accent border */
    
    --text-primary: #ffffff;
    --text-secondary: #94a3b8;
    
    --accent-color: #8b5cf6; /* Royal Neon Violet */
    --accent-hover: #a78bfa;
    --accent-glow: rgba(139, 92, 246, 0.25);
    
    --success-color: #10b981; /* Emerald Green */
    --success-glow: rgba(16, 185, 129, 0.15);
    
    --danger-color: #f43f5e; /* Rose Red */
    --danger-glow: rgba(244, 63, 94, 0.15);
    
    --warning-color: #f59e0b; /* Amber Gold */
    --warning-glow: rgba(245, 158, 11, 0.15);
    
    --info-color: #0ea5e9; /* Sky Blue */
    --info-glow: rgba(14, 165, 233, 0.15);

    --sidebar-width: 290px;
    --blur-amount: 24px;
    --transition-speed: 0.4s;
    
    /* Background Glow Blobs */
    --bg-glow-1: rgba(139, 92, 246, 0.22); /* Glowing Violet */
    --bg-glow-2: rgba(236, 72, 153, 0.18); /* Glowing Pink */
    --bg-glow-3: rgba(56, 189, 248, 0.15); /* Glowing Sky Blue */

    --card-gradient: linear-gradient(135deg, rgba(16, 10, 35, 0.6) 0%, rgba(6, 4, 14, 0.85) 100%);
    --card-shadow: 0 20px 40px -15px rgba(0, 0, 0, 0.7);
    --card-shadow-hover: 0 30px 60px -15px rgba(139, 92, 246, 0.25), 0 0 30px rgba(139, 92, 246, 0.1);
    
    --input-bg: rgba(6, 4, 14, 0.6);
    --input-hover-bg: rgba(12, 7, 26, 0.75);
    --input-focus-bg: rgba(18, 11, 40, 0.9);
    
    --modal-overlay-bg: rgba(2, 1, 5, 0.85);
    --modal-bg: linear-gradient(135deg, rgba(16, 10, 35, 0.96) 0%, rgba(4, 3, 10, 0.99) 100%);
    
    --ceo-card-bg: linear-gradient(135deg, rgba(139, 92, 246, 0.1) 0%, rgba(236, 72, 153, 0.05) 100%);
    --ceo-card-border: 1px solid rgba(139, 92, 246, 0.25);
    --ceo-card-shadow: 0 20px 40px rgba(139, 92, 246, 0.08);
    
    --production-column-bg: rgba(8, 5, 18, 0.4);
    --table-row-even: rgba(255, 255, 255, 0.015);
    --table-row-hover: rgba(139, 92, 246, 0.06);
    
    --sidebar-bg: rgba(8, 5, 18, 0.6);
    --sidebar-border: rgba(255, 255, 255, 0.04);
}

body.light-mode {
    /* --- Light Mode (Frosted Silk Lavender & Rose) --- */
    --bg-color: #f1f0f7; /* Very soft cotton gray-lavender */
    --card-bg: rgba(255, 255, 255, 0.55); /* High transparency white glass */
    --card-border: rgba(255, 255, 255, 0.6); /* Pristine glass edge sheen */
    --card-border-hover: rgba(99, 102, 241, 0.25); /* Glowing lavender on hover */
    
    --text-primary: #0f172a; /* Deep slate */
    --text-secondary: #475569; /* Slate secondary */
    
    --accent-color: #6366f1; /* Electric Indigo */
    --accent-hover: #4f46e5;
    --accent-glow: rgba(99, 102, 241, 0.15);
    
    --success-color: #0d9488; /* Emerald Teal */
    --success-glow: rgba(13, 148, 136, 0.08);
    
    --danger-color: #e11d48; /* Crimson Rose */
    --danger-glow: rgba(225, 29, 72, 0.08);
    
    --warning-color: #d97706; /* Warm Amber */
    --warning-glow: rgba(217, 119, 6, 0.08);
    
    --info-color: #0284c7; /* Cashmere Sky Blue */
    --info-glow: rgba(2, 132, 199, 0.08);
    
    /* Background Glow Blobs for Light Mode (The key to the beautiful glow!) */
    --bg-glow-1: rgba(99, 102, 241, 0.14); /* Glowing Indigo */
    --bg-glow-2: rgba(236, 72, 153, 0.14); /* Glowing Pink */
    --bg-glow-3: rgba(45, 212, 191, 0.08);  /* Glowing Teal */

    --card-gradient: linear-gradient(135deg, rgba(255, 255, 255, 0.7) 0%, rgba(255, 255, 255, 0.4) 100%);
    --card-shadow: 0 15px 35px -10px rgba(99, 102, 241, 0.05);
    --card-shadow-hover: 0 25px 50px -10px rgba(99, 102, 241, 0.16), 0 0 20px rgba(99, 102, 241, 0.04);
    
    --input-bg: rgba(255, 255, 255, 0.8);
    --input-hover-bg: #ffffff;
    --input-focus-bg: #ffffff;
    
    --modal-overlay-bg: rgba(15, 23, 42, 0.35);
    --modal-bg: linear-gradient(135deg, rgba(255, 255, 255, 0.98) 0%, rgba(250, 248, 252, 0.99) 100%);
    
    --ceo-card-bg: linear-gradient(135deg, rgba(99, 102, 241, 0.04) 0%, rgba(236, 72, 153, 0.03) 100%);
    --ceo-card-border: 1px solid rgba(99, 102, 241, 0.18);
    --ceo-card-shadow: 0 20px 40px rgba(99, 102, 241, 0.03);
    
    --production-column-bg: rgba(255, 255, 255, 0.3);
    --table-row-even: rgba(99, 102, 241, 0.005);
    --table-row-hover: rgba(99, 102, 241, 0.02);
    
    --sidebar-bg: rgba(255, 255, 255, 0.55);
    --sidebar-border: rgba(255, 255, 255, 0.6);
}

/* ==========================================================================
   Base Resets & Typography
   ========================================================================== */

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: var(--bg-color);
    background-image: 
        radial-gradient(circle at 10% 20%, var(--bg-glow-1), transparent 45%),
        radial-gradient(circle at 90% 10%, var(--bg-glow-2), transparent 40%),
        radial-gradient(circle at 50% 80%, var(--bg-glow-3), transparent 45%);
    background-attachment: fixed;
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6, .logo {
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}

/* ==========================================================================
   Navigation Sidebar (Floating Frosted Panel)
   ========================================================================== */

.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    backdrop-filter: blur(var(--blur-amount));
    -webkit-backdrop-filter: blur(var(--blur-amount));
    border: 1px solid var(--sidebar-border);
    position: fixed;
    top: 24px;
    left: 24px;
    bottom: 24px;
    height: calc(100vh - 48px);
    border-radius: 24px;
    padding: 32px 0;
    display: flex;
    flex-direction: column;
    z-index: 100;
    box-shadow: var(--card-shadow);
    transition: all var(--transition-speed) cubic-bezier(0.16, 1, 0.3, 1);
}

.sidebar:hover {
    border-color: var(--card-border-hover);
}

.logo {
    font-size: 1.45rem;
    padding: 0 24px 12px;
    margin-bottom: 8px;
    border-bottom: none;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-weight: 800;
    letter-spacing: -0.03em;
}

.sidebar-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 8px 16px 16px;
    padding: 12px 14px;
    border-radius: 16px;
    border: 1px solid var(--card-border);
    background: var(--input-bg);
    text-decoration: none;
    color: inherit;
    transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}

.sidebar-profile:hover {
    border-color: var(--accent-color);
    background: var(--accent-glow);
}

.sidebar-profile.active {
    border-color: var(--accent-color);
    background: var(--accent-glow);
    box-shadow: 0 0 0 1px rgba(139, 92, 246, 0.15);
}

.sidebar-profile-avatar {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--accent-color), #7c3aed);
    color: #fff;
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
    position: relative;
}

.sidebar-profile-avatar:has(> img) {
    background: transparent;
}

.sidebar-profile-avatar img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.sidebar-profile-text {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.sidebar-profile-name {
    font-family: 'Outfit', sans-serif;
    font-size: 0.92rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.25;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-profile-role {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-secondary);
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-profile-chevron {
    width: 16px;
    height: 16px;
    color: var(--text-secondary);
    flex-shrink: 0;
    opacity: 0.6;
}

.logo-icon {
    color: var(--accent-color);
}

.nav-links {
    list-style: none;
    flex: 1;
    overflow-y: auto;
    padding: 0 16px;
}

.nav-item {
    margin-bottom: 6px;
}

.nav-link {
    display: flex;
    align-items: center;
    position: relative;
    padding: 12px 16px;
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 550;
    font-size: 0.95rem;
    border-radius: 14px;
    transition: all 0.25s ease;
    gap: 12px;
    border: 1px solid transparent;
}

.nav-link i {
    width: 18px;
    height: 18px;
    transition: transform 0.25s ease;
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

body.light-mode .nav-link:hover {
    background: rgba(99, 102, 241, 0.05);
}

.nav-link:hover i {
    transform: translateX(3px) scale(1.05);
}

.nav-link.active {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.15) 0%, rgba(99, 102, 241, 0.02) 100%);
    color: var(--text-primary);
    border: 1px solid rgba(99, 102, 241, 0.25);
    box-shadow: 0 8px 20px rgba(99, 102, 241, 0.08);
}

body.light-mode .nav-link.active {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.12) 0%, rgba(99, 102, 241, 0.02) 100%);
    border: 1px solid rgba(99, 102, 241, 0.2);
    box-shadow: 0 8px 20px rgba(99, 102, 241, 0.04);
}

.nav-link.active i {
    color: var(--accent-color);
}

/* AI assistant special button style */
.nav-link.nav-link-ai {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.08) 0%, rgba(236, 72, 153, 0.02) 100%);
    border: 1px solid rgba(139, 92, 246, 0.2);
}

.nav-link.nav-link-ai:hover {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.12) 0%, rgba(236, 72, 153, 0.05) 100%);
    border-color: rgba(139, 92, 246, 0.35);
}

.nav-badge {
    margin-left: auto;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 999px;
    background: var(--danger-color);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.nav-badge.hidden {
    display: none;
}

/* ==========================================================================
   Main Content Layout
   ========================================================================== */

.app-main {
    flex: 1;
    min-width: 0;
    margin-left: calc(var(--sidebar-width) + 48px);
    padding: 40px 48px 40px 24px;
    min-height: 100vh;
}

.main-content {
    width: 100%;
    min-width: 0;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
    gap: 16px;
    flex-wrap: wrap;
}

.page-title {
    font-size: 2.3rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    display: flex;
    align-items: center;
    gap: 12px;
}

.page-title span {
    background: linear-gradient(135deg, var(--text-primary) 30%, var(--text-secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.page-title .title-icon {
    color: var(--accent-color);
    width: 36px;
    height: 36px;
    flex-shrink: 0;
}

/* ==========================================================================
   Modern Frosted Glass Cards (The Key Visual)
   ========================================================================== */

.glass-card {
    background: var(--card-bg);
    backdrop-filter: blur(var(--blur-amount));
    -webkit-backdrop-filter: blur(var(--blur-amount));
    border: 1px solid var(--card-border);
    border-radius: 24px;
    padding: 28px;
    margin-bottom: 28px;
    box-shadow: var(--card-shadow);
    transition: transform var(--transition-speed) cubic-bezier(0.16, 1, 0.3, 1), 
                box-shadow var(--transition-speed) ease, 
                border-color var(--transition-speed) ease;
}

.glass-card:hover {
    transform: translateY(-4px);
    border-color: var(--card-border-hover);
    box-shadow: var(--card-shadow-hover);
}

/* ==========================================================================
   Dashboard Widgets & Bento Key Stats
   ========================================================================== */

.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1.2fr;
    gap: 28px;
}

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

.stat-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 28px;
    align-items: stretch;
}

.stat-card {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 22px 24px;
    min-height: 132px;
    height: 100%;
    box-sizing: border-box;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--card-border);
    color: var(--accent-color);
    display: flex;
    justify-content: center;
    align-items: center;
    margin-right: 0;
    flex-shrink: 0;
    font-size: 1.25rem;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.stat-icon i,
.stat-icon svg {
    width: 22px;
    height: 22px;
}

.stat-card:hover .stat-icon {
    transform: scale(1.06) rotate(4deg);
    border-color: var(--accent-color);
    box-shadow: 0 0 15px var(--accent-glow);
}

.stat-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.stat-info h3 {
    font-size: 0.72rem;
    color: var(--text-secondary);
    font-weight: 700;
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    line-height: 1.3;
}

.stat-info p {
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--text-primary);
    font-family: 'Outfit', sans-serif;
    letter-spacing: -0.02em;
    margin: 0;
    line-height: 1.2;
}

.stat-info > .stat-foot {
    margin-top: auto;
    padding-top: 8px;
}

.stat-foot {
    font-size: 0.72rem;
    color: var(--text-secondary);
    line-height: 1.45;
}

/* --- Progress Bar --- */
.target-progress-track {
    position: relative;
    margin: 12px 0 8px;
    padding-bottom: 2px;
}

.target-progress-bar {
    height: 8px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    overflow: hidden;
    margin: 0;
}

body.light-mode .target-progress-bar {
    background: rgba(99, 102, 241, 0.05);
}

.target-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-color), var(--info-color));
    border-radius: 10px;
    width: 0%;
    transition: width 1.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.target-progress-marker {
    position: absolute;
    top: -3px;
    bottom: -3px;
    transform: translateX(-50%);
    z-index: 2;
    pointer-events: none;
}

.target-progress-marker-line {
    display: block;
    width: 2px;
    height: 14px;
    margin: 0 auto;
    border-radius: 1px;
    background: var(--text-secondary);
    opacity: 0.75;
    box-shadow: 0 0 0 2px var(--card-bg, rgba(0, 0, 0, 0.3));
}

.target-progress-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 16px;
    margin-bottom: 10px;
    font-size: 0.72rem;
    color: var(--text-secondary);
}

.target-progress-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.target-progress-legend-swatch {
    width: 10px;
    height: 10px;
    border-radius: 3px;
    flex-shrink: 0;
}

.target-progress-legend-swatch--done {
    background: linear-gradient(90deg, var(--accent-color), var(--info-color));
}

.target-progress-legend-swatch--tempo {
    background: transparent;
    border-left: 2px solid var(--text-secondary);
    border-radius: 0;
    width: 2px;
    height: 12px;
    opacity: 0.75;
}

/* ==========================================================================
   AI CEO Card & Analytics Panel
   ========================================================================== */

.ceo-card {
    background: var(--ceo-card-bg);
    border: var(--ceo-card-border);
    box-shadow: var(--ceo-card-shadow);
    border-radius: 24px;
    padding: 28px;
    position: relative;
    overflow: hidden;
    transition: all var(--transition-speed) ease;
}

.ceo-card:hover {
    border-color: var(--accent-color);
    box-shadow: 0 20px 45px rgba(139, 92, 246, 0.12);
}

.ceo-header-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--accent-color);
    margin-bottom: 16px;
}

.ceo-advice-block {
    background: rgba(255, 255, 255, 0.02);
    border-left: 4px solid var(--accent-color);
    padding: 14px 18px;
    border-radius: 4px 14px 14px 4px;
    font-size: 0.88rem;
    color: var(--text-primary);
    line-height: 1.5;
}

body.light-mode .ceo-advice-block {
    background: rgba(255, 255, 255, 0.7);
}

/* ==========================================================================
   Interactive Buttons
   ========================================================================== */

.btn {
    padding: 12px 22px;
    border-radius: 14px;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    border: 1px solid transparent;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: 0.9rem;
    line-height: 1.2;
}

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

.btn-primary {
    background: linear-gradient(135deg, var(--accent-color) 0%, #7c3aed 100%);
    color: #ffffff;
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.25);
}

.btn-primary:hover {
    transform: translateY(-2px);
    background: linear-gradient(135deg, #a78bfa 0%, var(--accent-color) 100%);
    box-shadow: 0 8px 22px rgba(139, 92, 246, 0.35);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-primary);
    border: 1px solid var(--card-border);
}

body.light-mode .btn-secondary {
    background: rgba(255, 255, 255, 0.6);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--text-secondary);
}

.btn-danger {
    background: rgba(244, 63, 94, 0.06);
    color: var(--danger-color);
    border: 1px solid rgba(244, 63, 94, 0.2);
}

.btn-danger:hover {
    background: rgba(244, 63, 94, 0.12);
    border-color: var(--danger-color);
}

.btn-success {
    background: rgba(16, 185, 129, 0.06);
    color: var(--success-color);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.btn-success:hover {
    background: rgba(16, 185, 129, 0.12);
    border-color: var(--success-color);
}

.btn-sm {
    padding: 8px 16px;
    font-size: 0.825rem;
    border-radius: 10px;
}

/* ==========================================================================
   Data Tables
   ========================================================================== */

.table-container {
    width: 100%;
    overflow-x: auto;
}

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

th, td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--card-border);
    font-size: 0.86rem;
}

th {
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    font-family: 'Outfit', sans-serif;
    border-bottom: 1px solid rgba(139, 92, 246, 0.2);
}

body.light-mode th {
    border-bottom: 1px solid rgba(99, 102, 241, 0.15);
}

tbody tr {
    transition: background-color 0.2s ease;
}

tbody tr:nth-child(even) {
    background-color: var(--table-row-even);
}

tbody tr:hover {
    background-color: var(--table-row-hover) !important;
}

td strong {
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
}

/* ==========================================================================
   Forms & Custom Controls
   ========================================================================== */

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

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

.form-control {
    width: 100%;
    padding: 12px 18px;
    background: var(--input-bg);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    font-size: 0.95rem;
    transition: all 0.25s ease;
}

.form-control:hover {
    border-color: var(--text-secondary);
    background: var(--input-hover-bg);
}

.form-control:focus {
    outline: none;
    border-color: var(--accent-color);
    background: var(--input-focus-bg);
    box-shadow: 0 0 0 4px var(--accent-glow);
}

/* ==========================================================================
   Modals
   ========================================================================== */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--modal-overlay-bg);
    backdrop-filter: blur(16px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.modal {
    background: var(--modal-bg);
    backdrop-filter: blur(var(--blur-amount));
    -webkit-backdrop-filter: blur(var(--blur-amount));
    border: 1px solid var(--card-border);
    border-radius: 28px;
    width: 100%;
    max-width: 600px;
    max-height: 85vh;
    overflow-y: auto;
    padding: 36px;
    transform: scale(0.95) translateY(15px);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 30px 70px rgba(0, 0, 0, 0.5);
}

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

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 28px;
    border-bottom: 1px solid var(--card-border);
    padding-bottom: 14px;
}

.modal-title {
    font-size: 1.7rem;
    font-weight: 800;
}

.close-btn {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--card-border);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

.close-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.1);
}

/* ==========================================================================
   Product Cards Catalog
   ========================================================================== */

.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
}

.product-card {
    background: var(--card-gradient);
    border: 1px solid var(--card-border);
    border-radius: 20px;
    overflow: hidden;
    box-shadow: var(--card-shadow);
    display: flex;
    flex-direction: column;
    transition: transform var(--transition-speed) cubic-bezier(0.16, 1, 0.3, 1), box-shadow var(--transition-speed) ease;
}

.product-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--card-shadow-hover);
    border-color: var(--card-border-hover);
}

.product-card-img-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    background: linear-gradient(160deg, rgba(139, 92, 246, 0.06) 0%, rgba(236, 72, 153, 0.04) 100%);
}

.product-card-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center top;
    display: block;
    transition: transform var(--transition-speed) ease;
}

.product-card:hover .product-card-img {
    transform: scale(1.04);
}

.product-card-badge {
    position: absolute;
    bottom: 14px;
    left: 14px;
}

.product-card-content {
    padding: 24px;
}

.product-card-title {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 12px;
}

.product-card-details {
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-size: 0.88rem;
    color: var(--text-secondary);
    margin-bottom: 20px;
}

.product-card-price {
    font-family: 'Outfit', sans-serif;
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--accent-color);
    margin-bottom: 16px;
}

/* ==========================================================================
   Warehouse Resource Cards
   ========================================================================== */

.resource-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
    gap: 18px;
}

.resource-card {
    background: var(--card-gradient);
    border: 1px solid var(--card-border);
    border-radius: 18px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    box-shadow: var(--card-shadow);
    transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.resource-card:hover {
    transform: translateY(-2px);
    border-color: var(--card-border-hover);
    box-shadow: var(--card-shadow-hover);
}

.resource-card--low {
    border-color: rgba(244, 63, 94, 0.35);
    background: linear-gradient(135deg, rgba(244, 63, 94, 0.04) 0%, var(--card-bg) 60%);
}

.resource-card-top {
    display: flex;
    gap: 14px;
    align-items: flex-start;
}

.resource-card-icon {
    flex-shrink: 0;
    width: 56px;
    height: 56px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--card-border);
}

.resource-card-icon i {
    width: 24px;
    height: 24px;
    color: var(--accent-color);
}

.resource-card-info {
    flex: 1;
    min-width: 0;
}

.resource-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
}

.resource-card-name {
    font-size: 1.05rem;
    font-weight: 700;
    font-family: 'Outfit', sans-serif;
    color: var(--text-primary);
    margin: 0;
    line-height: 1.2;
}

.resource-card-alert {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--danger-color);
    margin-bottom: 8px;
}

.resource-card-alert i {
    width: 13px;
    height: 13px;
}

.resource-card-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.resource-stat {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.resource-stat-label {
    font-size: 0.68rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.resource-stat strong {
    font-size: 0.82rem;
    color: var(--text-primary);
    font-family: 'Outfit', sans-serif;
}

.resource-stat strong.text-danger {
    color: var(--danger-color);
}

.resource-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    font-size: 0.75rem;
    color: var(--text-secondary);
    padding-top: 4px;
    border-top: 1px solid var(--card-border);
}

.resource-card-meta span {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.resource-card-meta i {
    width: 13px;
    height: 13px;
    opacity: 0.7;
}

.resource-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
}

.resource-stock-controls {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

.resource-stock-controls .btn {
    padding: 4px 8px !important;
    font-size: 0.72rem !important;
    min-width: 36px;
}

.resource-card-actions {
    display: flex;
    gap: 6px;
    margin-left: auto;
}

.resource-empty-state {
    text-align: center;
    padding: 60px 24px;
    color: var(--text-secondary);
}

.resource-empty-state i {
    width: 48px;
    height: 48px;
    margin-bottom: 12px;
    opacity: 0.4;
}

/* ==========================================================================
   Production board (row cards)
   ========================================================================== */

.production-board {
    display: flex;
    flex-direction: column;
    gap: 24px;
    margin-top: 8px;
    padding-bottom: 48px;
}

.production-pipeline {
    display: flex;
    align-items: center;
    gap: 0;
    margin-bottom: 16px;
    padding: 12px 16px;
    background: var(--card-gradient);
    border: 1px solid var(--card-border);
    border-radius: 14px;
    backdrop-filter: blur(var(--blur-amount));
    box-shadow: var(--card-shadow);
    overflow-x: auto;
}

body.light-mode .production-pipeline {
    background: linear-gradient(145deg, #ffffff 0%, #f6f5fb 100%);
    border-color: rgba(99, 102, 241, 0.14);
    box-shadow: 0 4px 18px rgba(99, 102, 241, 0.07);
}

.production-pipeline-step {
    display: flex;
    align-items: center;
    flex: 1;
    min-width: 88px;
    gap: 8px;
    border: none;
    background: transparent;
    cursor: pointer;
    padding: 6px 4px;
    border-radius: 10px;
    font: inherit;
    transition: background 0.2s ease;
}

.production-pipeline-step:hover {
    background: rgba(139, 92, 246, 0.06);
}

.production-pipeline-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.production-pipeline-label {
    font-size: 0.76rem;
    font-weight: 600;
    color: var(--text-secondary);
    white-space: nowrap;
}

.production-pipeline-count {
    font-size: 0.68rem;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 999px;
    background: rgba(139, 92, 246, 0.1);
    color: var(--accent-color);
}

.production-pipeline-line {
    flex: 1;
    height: 2px;
    background: var(--card-border);
    margin: 0 10px;
    min-width: 16px;
}

.production-total-badge {
    font-size: 0.8rem;
    padding: 8px 14px;
}

.production-stage {
    border-left: 4px solid var(--stage-color, var(--accent-color));
    border-radius: 16px;
    padding: 16px 18px 16px 14px;
    scroll-margin-top: 88px;
    transition: background 0.4s ease, box-shadow 0.3s ease;
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.07) 0%, rgba(255, 255, 255, 0.02) 100%);
    border: 1px solid var(--card-border);
    border-left-width: 4px;
    border-left-color: var(--stage-color, var(--accent-color));
    box-shadow: var(--card-shadow);
}

body.light-mode .production-stage {
    background: linear-gradient(145deg, #ffffff 0%, #f9f8fd 55%, color-mix(in srgb, var(--stage-color) 6%, #ffffff) 100%);
    border-color: color-mix(in srgb, var(--stage-color) 18%, transparent);
    border-left-color: var(--stage-color, var(--accent-color));
    box-shadow: 0 6px 22px rgba(15, 23, 42, 0.05);
}

.production-stage--highlight {
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--stage-color) 25%, transparent), var(--card-shadow-hover);
}

.production-stage-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}

.production-stage-heading {
    display: flex;
    align-items: center;
    gap: 12px;
}

.production-stage-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.production-stage-icon i {
    width: 18px;
    height: 18px;
}

.production-stage-title {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    font-family: 'Outfit', sans-serif;
    color: var(--text-primary);
}

.production-stage-sub {
    margin: 2px 0 0;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.production-stage-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.production-stage-empty {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    padding: 12px 14px;
    font-size: 0.8rem;
    color: var(--text-secondary);
    background: color-mix(in srgb, var(--stage-color) 5%, transparent);
    border: 1px dashed color-mix(in srgb, var(--stage-color) 22%, var(--card-border));
    border-radius: 10px;
}

body.light-mode .production-stage-empty {
    background: color-mix(in srgb, var(--stage-color) 7%, #ffffff);
}

.production-stage-empty i {
    width: 16px;
    height: 16px;
    opacity: 0.5;
}

.production-row {
    display: flex;
    gap: 16px;
    padding: 16px 18px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 14px;
    align-items: flex-start;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

body.light-mode .production-row {
    background: #ffffff;
    border-color: rgba(99, 102, 241, 0.12);
    box-shadow: 0 4px 16px rgba(15, 23, 42, 0.06);
}

.production-row:hover {
    border-color: color-mix(in srgb, var(--stage-color, var(--accent-color)) 35%, transparent);
    box-shadow: 0 10px 24px color-mix(in srgb, var(--stage-color, var(--accent-color)) 12%, transparent);
    transform: translateY(-1px);
}

.production-row-thumb {
    width: 108px;
    flex-shrink: 0;
    position: relative;
}

.production-row-thumb img {
    width: 108px;
    height: 108px;
    object-fit: cover;
    border-radius: 14px;
    display: block;
    background: linear-gradient(160deg, rgba(139, 92, 246, 0.08), rgba(236, 72, 153, 0.05));
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

body.light-mode .production-row-thumb img {
    border-color: rgba(99, 102, 241, 0.1);
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.1);
}

.production-row-qty {
    position: absolute;
    left: 6px;
    right: 6px;
    bottom: 6px;
    padding: 4px 8px;
    border-radius: 8px;
    font-size: 0.68rem;
    font-weight: 700;
    text-align: center;
    color: #fff;
    background: rgba(15, 23, 42, 0.72);
    backdrop-filter: blur(4px);
}

.production-row-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding-top: 2px;
}

.production-row-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.production-row-title {
    margin: 0 0 6px;
    font-size: 1.05rem;
    font-weight: 700;
    font-family: 'Outfit', sans-serif;
    color: var(--text-primary);
    line-height: 1.3;
}

.production-row-meta {
    margin: 0;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 0.78rem;
    color: var(--text-secondary);
}

.production-row-meta i {
    width: 12px;
    height: 12px;
}

.production-row-meta-dot {
    opacity: 0.45;
}

.production-row-nav {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.production-row-nav .btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    min-height: 36px;
    padding: 8px 12px !important;
    font-size: 0.78rem;
}

.production-row-nav .btn i {
    width: 14px;
    height: 14px;
}

.production-row-team {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    padding: 12px 14px;
    border-radius: 12px;
    background: color-mix(in srgb, var(--stage-color, var(--accent-color)) 6%, transparent);
    border: 1px solid color-mix(in srgb, var(--stage-color, var(--accent-color)) 12%, var(--card-border));
}

body.light-mode .production-row-team {
    background: color-mix(in srgb, var(--stage-color, var(--accent-color)) 5%, #ffffff);
    border-color: color-mix(in srgb, var(--stage-color, var(--accent-color)) 14%, #e8e6f0);
}

.production-team-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.production-team-label {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--text-secondary);
    white-space: nowrap;
}

.production-team-label i {
    width: 11px;
    height: 11px;
}

.production-team-select {
    width: 100%;
    border-radius: 8px;
    border: 1px solid var(--card-border);
    background: var(--input-bg);
    color: var(--text-primary);
    padding: 9px 11px;
    font-size: 0.8rem;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

body.light-mode .production-team-select {
    background: #ffffff;
    border-color: rgba(99, 102, 241, 0.15);
}

.production-team-select:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px var(--accent-glow);
}

.production-row-wip {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 8px;
    background: rgba(139, 92, 246, 0.04);
    border: 1px solid rgba(139, 92, 246, 0.12);
}

.production-row-wip-label {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--accent-color);
    flex-shrink: 0;
}

.production-row-wip-label i {
    width: 12px;
    height: 12px;
}

.production-wip-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.production-wip-tag {
    font-size: 0.72rem;
    padding: 3px 8px;
    border-radius: 6px;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    color: var(--text-secondary);
}

.production-wip-tag em {
    font-style: normal;
    font-weight: 700;
    color: var(--text-primary);
}

.production-row.stage-new { border-left: 3px solid var(--warning-color); }
.production-row.stage-cutting { border-left: 3px solid var(--info-color); }
.production-row.stage-sewing { border-left: 3px solid #f59e0b; }
.production-row.stage-qc { border-left: 3px solid var(--danger-color); }
.production-row.stage-ready { border-left: 3px solid var(--success-color); }

@media (max-width: 900px) {
    .production-row {
        flex-direction: column;
    }

    .production-row-thumb {
        display: flex;
        align-items: center;
        gap: 10px;
        width: 100%;
    }

    .production-row-thumb img {
        width: 88px;
        height: 88px;
    }

    .production-row-qty {
        position: static;
        width: auto;
        color: var(--text-secondary);
        background: rgba(139, 92, 246, 0.1);
    }

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

    .production-row-head {
        flex-direction: column;
    }

    .production-row-nav {
        width: 100%;
        justify-content: flex-end;
    }
}

/* ==========================================================================
   Status Badges
   ========================================================================== */

.badge {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.badge-warning {
    background: rgba(245, 158, 11, 0.08);
    color: var(--warning-color);
    border: 1px solid rgba(245, 158, 11, 0.18);
}

.badge-info {
    background: rgba(14, 165, 233, 0.08);
    color: var(--info-color);
    border: 1px solid rgba(14, 165, 233, 0.18);
}

.badge-primary {
    background: rgba(139, 92, 246, 0.08);
    color: var(--accent-hover);
    border: 1px solid rgba(139, 92, 246, 0.18);
}

.badge-success {
    background: rgba(16, 185, 129, 0.08);
    color: var(--success-color);
    border: 1px solid rgba(16, 185, 129, 0.18);
}

.badge-purple {
    background: rgba(168, 85, 247, 0.1);
    color: #a855f7;
    border: 1px solid rgba(168, 85, 247, 0.22);
}

.badge-danger {
    background: rgba(244, 63, 94, 0.08);
    color: var(--danger-color);
    border: 1px solid rgba(244, 63, 94, 0.18);
}

/* ==========================================================================
   AI Copilot & UI Chat elements
   ========================================================================== */

.copilot-layout {
    display: grid;
    grid-template-columns: 1fr minmax(280px, 340px);
    gap: 24px;
    height: calc(100vh - 190px);
    min-height: 480px;
}

.copilot-panel {
    margin-bottom: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 0;
    min-height: 0;
}

.copilot-panel-header {
    padding: 20px 22px;
    border-bottom: 1px solid var(--card-border);
    flex-shrink: 0;
}

.copilot-agent {
    display: flex;
    align-items: center;
    gap: 14px;
}

.copilot-agent-avatar {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.2), rgba(236, 72, 153, 0.1));
    border: 1px solid rgba(139, 92, 246, 0.25);
    color: var(--accent-color);
}

.copilot-agent-avatar i {
    width: 20px;
    height: 20px;
}

.copilot-agent h3 {
    margin: 0 0 2px;
    font-size: 1rem;
    font-family: 'Outfit', sans-serif;
    color: var(--text-primary);
}

.copilot-agent p {
    margin: 0;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.copilot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 18px 22px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    min-height: 0;
}

.copilot-messages::-webkit-scrollbar,
.copilot-guide-list::-webkit-scrollbar,
.ai-drawer-messages::-webkit-scrollbar {
    width: 6px;
}

.copilot-messages::-webkit-scrollbar-thumb,
.copilot-guide-list::-webkit-scrollbar-thumb,
.ai-drawer-messages::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 4px;
}

.copilot-msg {
    display: flex;
    width: 100%;
}

.copilot-msg.msg-user {
    justify-content: flex-end;
}

.copilot-msg.msg-ai {
    justify-content: flex-start;
}

.msg-bubble {
    max-width: 88%;
    padding: 14px 18px;
    font-size: 0.88rem;
    line-height: 1.55;
    color: var(--text-primary);
}

.msg-bubble--ai {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--card-border);
    border-radius: 18px 18px 18px 4px;
}

.msg-bubble--user {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.15) 0%, rgba(139, 92, 246, 0.02) 100%);
    border: 1px solid rgba(139, 92, 246, 0.25);
    border-radius: 18px 18px 4px 18px;
    box-shadow: 0 6px 18px rgba(139, 92, 246, 0.06);
}

.msg-bubble--typing {
    padding: 14px 18px;
    min-width: 200px;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.08) 0%, rgba(255, 255, 255, 0.02) 100%);
    border-color: rgba(139, 92, 246, 0.2);
    animation: copilot-pulse-border 1.5s ease-in-out infinite;
}

@keyframes copilot-pulse-border {
    0%, 100% { border-color: rgba(139, 92, 246, 0.15); box-shadow: 0 0 0 0 rgba(139, 92, 246, 0); }
    50% { border-color: rgba(139, 92, 246, 0.45); box-shadow: 0 0 20px rgba(139, 92, 246, 0.12); }
}

.ai-typing-card {
    display: flex;
    align-items: center;
    gap: 12px;
}

.ai-typing-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(139, 92, 246, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    animation: copilot-spin 2s linear infinite;
}

.ai-typing-icon i,
.ai-typing-icon svg {
    width: 18px;
    height: 18px;
    color: var(--accent-color);
}

@keyframes copilot-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.ai-typing-label {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.ai-typing-hint {
    font-size: 0.72rem;
    color: var(--text-secondary);
    margin-top: 4px;
}

.typing-indicator {
    display: flex;
    align-items: center;
    gap: 5px;
    height: 10px;
}

.typing-indicator span {
    display: block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--accent-color);
    opacity: 0.35;
    animation: typing-bounce 1.2s ease-in-out infinite;
}

.typing-indicator span:nth-child(1) { animation-delay: 0s; }
.typing-indicator span:nth-child(2) { animation-delay: 0.15s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.3s; }

@keyframes typing-bounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.35; }
    30% { transform: translateY(-6px); opacity: 1; }
}

.copilot-compose--loading,
.ai-drawer-form.copilot-compose--loading {
    position: relative;
    pointer-events: none;
    opacity: 0.85;
}

.copilot-compose--loading::after,
.ai-drawer-form.copilot-compose--loading::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, rgba(139, 92, 246, 0.06), transparent);
    animation: copilot-shimmer 1.5s infinite;
    pointer-events: none;
    border-radius: 0 0 16px 16px;
}

@keyframes copilot-shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.copilot-send--loading,
.ai-drawer-send.copilot-send--loading {
    position: relative;
    pointer-events: none;
    min-width: 44px;
}

.copilot-send--loading i,
.copilot-send--loading svg {
    opacity: 0;
}

.copilot-send--loading::after,
.ai-drawer-send.copilot-send--loading::after {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: copilot-spin 0.7s linear infinite;
}

.copilot-messages--waiting,
.ai-drawer-messages.copilot-messages--waiting {
    scroll-behavior: smooth;
}

.copilot-panel--chat.copilot-panel--busy {
    box-shadow: 0 0 0 1px rgba(139, 92, 246, 0.25), 0 8px 32px rgba(139, 92, 246, 0.08);
}

.ai-widget-drawer.ai-drawer--busy {
    box-shadow: 0 0 0 1px rgba(139, 92, 246, 0.3), 0 12px 40px rgba(0, 0, 0, 0.2);
}

.copilot-welcome-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.copilot-chip {
    border: 1px solid var(--card-border);
    background: var(--input-bg);
    color: var(--text-secondary);
    font-size: 0.75rem;
    padding: 6px 12px;
    border-radius: 999px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.copilot-chip:hover {
    border-color: var(--accent-color);
    color: var(--accent-color);
    background: rgba(139, 92, 246, 0.08);
}

.copilot-compose {
    padding: 14px 18px 18px;
    border-top: 1px solid var(--card-border);
    flex-shrink: 0;
}

.copilot-quick-bar {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 10px;
    margin-bottom: 10px;
    scrollbar-width: none;
}

.copilot-quick-bar::-webkit-scrollbar {
    display: none;
}

.copilot-quick-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    padding: 7px 12px;
    font-size: 0.78rem;
    border-radius: 10px;
    border: 1px solid var(--card-border);
    background: var(--input-bg);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.copilot-quick-btn i {
    width: 14px;
    height: 14px;
}

.copilot-quick-btn:hover {
    border-color: var(--accent-color);
    color: var(--accent-color);
}

.copilot-form {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: nowrap;
}

.copilot-attach-plus {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    border: 1px solid var(--card-border);
    background: var(--input-bg);
    color: var(--text-secondary);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.copilot-attach-plus:hover,
.copilot-attach-plus--active {
    border-color: var(--accent-color);
    color: var(--accent-color);
    background: rgba(139, 92, 246, 0.12);
}

.copilot-attach-plus i {
    width: 20px;
    height: 20px;
}

.copilot-attachment-chip {
    padding: 0 18px 10px;
}

.copilot-attachment-chip.hidden {
    display: none;
}

.copilot-chip-file {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px 6px 6px;
    border-radius: 10px;
    border: 1px solid rgba(139, 92, 246, 0.35);
    background: rgba(139, 92, 246, 0.1);
    font-size: 0.82rem;
    color: var(--text-primary);
}

.copilot-chip-file--excel i {
    width: 18px;
    height: 18px;
    color: var(--accent-color);
}

.copilot-chip-thumb {
    width: 32px;
    height: 32px;
    object-fit: cover;
    border-radius: 6px;
}

.copilot-chip-remove {
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 1.1rem;
    cursor: pointer;
    line-height: 1;
    padding: 0 2px;
}

.copilot-attach-btn {
    flex-shrink: 0;
    width: 42px;
    height: 42px;
    border-radius: 12px;
    border: 1px solid var(--card-border);
    background: var(--input-bg);
    color: var(--text-secondary);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.copilot-attach-btn--inline {
    width: 44px;
    height: 44px;
}

.copilot-attach-btn:hover,
.copilot-attach-btn--active {
    border-color: var(--accent-color);
    color: var(--accent-color);
    background: rgba(139, 92, 246, 0.1);
}

.copilot-attach-btn i {
    width: 18px;
    height: 18px;
}

.copilot-attach-preview {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 8px 4px 4px;
    border-radius: 10px;
    border: 1px solid rgba(139, 92, 246, 0.35);
    background: rgba(139, 92, 246, 0.08);
}

.copilot-attach-preview.hidden {
    display: none;
}

.copilot-attach-preview img {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: 8px;
}

.copilot-attach-clear {
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 1.1rem;
    cursor: pointer;
    line-height: 1;
    padding: 0 4px;
}

.copilot-user-image-wrap {
    margin-bottom: 8px;
}

.copilot-user-image {
    max-width: 200px;
    max-height: 160px;
    border-radius: 10px;
    object-fit: cover;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.copilot-action-thumb {
    width: 100%;
    max-height: 120px;
    object-fit: cover;
    border-radius: 10px;
    margin-bottom: 10px;
}

.copilot-input {
    flex: 1;
    min-width: 0;
}

.copilot-send {
    flex-shrink: 0;
    padding: 12px 16px !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.copilot-send i {
    width: 18px;
    height: 18px;
}

.copilot-guide-header {
    padding: 20px 22px 12px;
    border-bottom: 1px solid var(--card-border);
    flex-shrink: 0;
}

.copilot-guide-header h3 {
    margin: 0 0 4px;
    font-size: 1rem;
    font-family: 'Outfit', sans-serif;
    color: var(--text-primary);
}

.copilot-guide-header p {
    margin: 0;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.copilot-guide-list {
    flex: 1;
    overflow-y: auto;
    padding: 12px 16px 18px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.copilot-guide-item {
    display: flex;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid var(--card-border);
    background: rgba(255, 255, 255, 0.02);
}

.copilot-guide-icon {
    width: 32px;
    height: 32px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(139, 92, 246, 0.1);
    color: var(--accent-color);
    flex-shrink: 0;
}

.copilot-guide-icon i {
    width: 15px;
    height: 15px;
}

.copilot-guide-item h4 {
    margin: 0 0 4px;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-primary);
}

.copilot-guide-item code {
    display: block;
    font-size: 0.72rem;
    line-height: 1.45;
    color: var(--text-secondary);
    font-family: ui-monospace, monospace;
}

@media (max-width: 1024px) {
    .copilot-layout {
        grid-template-columns: 1fr;
        height: auto;
    }

    .copilot-panel--chat {
        min-height: 420px;
    }

    .copilot-panel--guide {
        max-height: 360px;
    }
}

.copilot-msg.msg-user .msg-bubble {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.15) 0%, rgba(139, 92, 246, 0.02) 100%);
    border: 1px solid rgba(139, 92, 246, 0.25);
    border-radius: 18px 18px 4px 18px;
    box-shadow: 0 8px 24px rgba(139, 92, 246, 0.06);
}

.copilot-action-card {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(139, 92, 246, 0.25);
    border-radius: 16px;
    padding: 16px;
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

body.light-mode .copilot-action-card {
    background: rgba(255, 255, 255, 0.6);
    border-color: rgba(99, 102, 241, 0.2);
}

.action-card-header {
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--accent-color);
    display: flex;
    align-items: center;
    gap: 6px;
}

.action-card-detail {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* Health Score gauge and currency labels */
.health-circle-bg {
    fill: none;
    stroke: var(--card-border);
    stroke-width: 5px;
}

.health-circle-bar {
    fill: none;
    stroke-width: 5px;
    stroke-linecap: round;
    transition: stroke-dashoffset 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.health-score-text {
    font-size: 1.15rem;
    font-weight: 700;
    font-family: 'Outfit', sans-serif;
    fill: var(--text-primary);
}

.currency-label {
    font-size: 0.76rem;
    font-weight: 400;
    color: var(--text-secondary);
    margin-left: 2px;
}

/* Custom dashboard chart modifications */
.chart-wrapper {
    flex: 1;
    min-height: 200px;
    margin-top: 4px;
    display: flex;
    align-items: stretch;
}

.chart-wrapper svg {
    width: 100%;
    height: 100%;
    min-height: 200px;
}

.chart-card {
    display: flex;
    flex-direction: column;
    min-height: 280px;
    height: 100%;
}

.dashboard-panel-card {
    display: flex;
    flex-direction: column;
    min-height: 280px;
    height: 100%;
    padding: 24px;
    margin-bottom: 0;
}

.dashboard-panel-title {
    font-family: 'Outfit', sans-serif;
    font-size: 1.2rem;
    font-weight: 700;
    margin: 0 0 18px;
    color: var(--text-primary);
}

.dashboard-panel-title--inline {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 0;
}

.dashboard-panel-title--inline i,
.dashboard-panel-title--inline svg {
    width: 18px;
    height: 18px;
    color: var(--danger-color);
}

.dashboard-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.dashboard-analysis-list {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 12px;
    font-size: 0.9rem;
}

/* Customizable dashboard widgets */
.dashboard-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    padding: 14px 18px;
    margin-bottom: 20px;
}

.dashboard-toolbar-month {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

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

.dashboard-custom--edit .dashboard-widget {
    position: relative;
}

.dashboard-section {
    display: grid;
    gap: 20px;
    margin-bottom: 28px;
    align-items: stretch;
}

.dashboard-section--hero {
    grid-template-columns: 1fr 1.2fr;
}

.dashboard-section--stats {
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.dashboard-section--panels {
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}

.dashboard-section--full {
    grid-template-columns: 1fr;
}

.dashboard-widget--stats,
.dashboard-widget--panels,
.dashboard-widget--hero {
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.dashboard-widget--stats .dashboard-widget-body,
.dashboard-widget--panels .dashboard-widget-body,
.dashboard-widget--hero .dashboard-widget-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.dashboard-widget--stats .dashboard-widget-body > .glass-card,
.dashboard-widget--stats .dashboard-widget-body > .ceo-card,
.dashboard-widget--panels .dashboard-widget-body > .glass-card,
.dashboard-widget--hero .dashboard-widget-body > .glass-card,
.dashboard-widget--hero .dashboard-widget-body > .ceo-card {
    flex: 1;
    width: 100%;
}

.dashboard-widget--hero .dashboard-widget-body > .glass-card,
.dashboard-widget--hero .dashboard-widget-body > .ceo-card {
    margin-bottom: 0;
}

.dashboard-widget--edit .dashboard-widget-body > .glass-card,
.dashboard-widget--edit .dashboard-widget-body > .ceo-card {
    border-radius: 0;
    border: none;
    box-shadow: none;
    margin-bottom: 0;
}

.dashboard-widget--stats .dashboard-widget-body > .glass-card {
    margin-bottom: 0;
}

.dashboard-widget--panels .dashboard-widget-body > .glass-card {
    margin-bottom: 0;
}

.dashboard-widget {
    min-width: 0;
}

.dashboard-widget-body {
    min-width: 0;
}

.dashboard-widget--edit {
    border: 2px dashed var(--card-border);
    border-radius: 18px;
    padding: 0;
    overflow: hidden;
    transition: border-color 0.2s ease, background 0.2s ease;
}

.dashboard-widget--edit.dashboard-widget--drop-target {
    border-color: var(--accent-color);
    background: rgba(181, 144, 30, 0.04);
}

.dashboard-widget--dragging {
    opacity: 0.45;
}

.dashboard-widget-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: var(--btn-secondary-bg);
    border-bottom: 1px solid var(--card-border);
    font-size: 0.78rem;
    color: var(--text-secondary);
}

.dashboard-widget-grip {
    cursor: grab;
    display: flex;
    align-items: center;
    color: var(--text-secondary);
    padding: 2px;
}

.dashboard-widget-grip i,
.dashboard-widget-grip svg {
    width: 16px;
    height: 16px;
}

.dashboard-widget-grip:active {
    cursor: grabbing;
}

.dashboard-widget-label {
    flex: 1;
    font-weight: 600;
    color: var(--text-primary);
}

.dashboard-widget-remove {
    border: none;
    background: transparent;
    color: var(--danger-color);
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    margin-left: auto;
}

.dashboard-widget-remove i,
.dashboard-widget-remove svg {
    width: 15px;
    height: 15px;
}

.dashboard-widget-remove:hover {
    background: var(--danger-glow);
}

.dashboard-section-empty {
    padding: 20px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.85rem;
    border: 2px dashed var(--card-border);
    background: transparent;
}

.dashboard-add-panel {
    padding: 20px;
    margin-bottom: 28px;
}

.dashboard-add-group {
    margin-bottom: 14px;
}

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

.dashboard-add-group-label {
    display: block;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.dashboard-add-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.dashboard-add-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border-radius: 99px;
    border: 1px solid var(--card-border);
    background: var(--btn-secondary-bg);
    color: var(--text-primary);
    font-size: 0.8rem;
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease;
}

.dashboard-add-chip:hover {
    border-color: var(--accent-color);
    background: var(--accent-glow);
}

.dashboard-add-chip i {
    width: 14px;
    height: 14px;
    color: var(--accent-color);
}

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

/* Animations */
.animate-fade-in {
    animation: fadeIn 0.4s ease forwards;
}

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

.animate-spin {
    animation: spin 1s linear infinite;
}

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

/* Expense view grid */
.expense-split-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 28px;
}

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

/* ==========================================================================
   Global Floating AI Assistant Widget
   ========================================================================== */

.ai-floating-widget {
    position: fixed;
    bottom: 24px;
    right: 28px;
    z-index: 9999;
    font-family: 'Inter', sans-serif;
}

.ai-widget-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    border-radius: 50px;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #a855f7 100%);
    color: #ffffff;
    font-weight: 600;
    font-size: 0.88rem;
    border: none;
    box-shadow: 0 8px 24px rgba(99, 102, 241, 0.35);
    cursor: pointer;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.ai-widget-btn i {
    width: 18px;
    height: 18px;
}

body.light-mode .ai-widget-btn {
    box-shadow: 0 8px 24px rgba(99, 102, 241, 0.25);
}

.ai-widget-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 32px rgba(139, 92, 246, 0.4);
}

.ai-widget-drawer {
    position: absolute;
    bottom: 56px;
    right: 0;
    width: 400px;
    max-width: calc(100vw - 32px);
    height: 520px;
    max-height: calc(100vh - 120px);
    display: flex;
    flex-direction: column;
    padding: 0;
    border-radius: 18px;
    overflow: hidden;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
    transition: opacity 0.25s ease, transform 0.25s ease;
    transform-origin: bottom right;
}

.ai-widget-drawer.hidden {
    opacity: 0;
    pointer-events: none;
    transform: translateY(12px) scale(0.96);
}

.ai-drawer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 18px;
    border-bottom: 1px solid var(--card-border);
    flex-shrink: 0;
}

.ai-drawer-brand {
    display: flex;
    align-items: center;
    gap: 10px;
}

.ai-drawer-brand-icon {
    width: 36px;
    height: 36px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.2), rgba(236, 72, 153, 0.1));
    color: var(--accent-color);
}

.ai-drawer-brand-icon i {
    width: 18px;
    height: 18px;
}

.ai-drawer-brand strong {
    display: block;
    font-size: 0.9rem;
    color: var(--text-primary);
}

.ai-drawer-brand span {
    font-size: 0.7rem;
    color: var(--text-secondary);
}

.ai-drawer-close {
    width: 32px;
    height: 32px;
    border-radius: 10px;
    border: 1px solid var(--card-border);
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ai-drawer-close i {
    width: 16px;
    height: 16px;
}

.ai-drawer-messages {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 14px 18px;
    min-height: 0;
}

.ai-drawer-form {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
    padding: 14px 16px 16px;
    border-top: 1px solid var(--card-border);
    flex-shrink: 0;
}

.ai-drawer-form .form-control {
    flex: 1;
    min-width: 0;
    font-size: 0.85rem;
}

.ai-drawer-send {
    flex-shrink: 0;
    padding: 10px 14px !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.ai-drawer-send i {
    width: 16px;
    height: 16px;
}

@media (max-width: 480px) {
    .ai-widget-btn span {
        display: none;
    }

    .ai-widget-btn {
        width: 52px;
        height: 52px;
        padding: 0;
        justify-content: center;
        border-radius: 50%;
    }
}

/* --- Login Screen (Ultra Premium Glassmorphism) --- */
.login-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: var(--bg-color);
    background-image: 
        radial-gradient(circle at 10% 20%, var(--bg-glow-1), transparent 45%),
        radial-gradient(circle at 90% 10%, var(--bg-glow-2), transparent 40%),
        radial-gradient(circle at 50% 80%, var(--bg-glow-3), transparent 45%);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}
.login-card {
    background: var(--card-bg);
    backdrop-filter: blur(var(--blur-amount));
    -webkit-backdrop-filter: blur(var(--blur-amount));
    border: 1px solid var(--card-border);
    border-radius: 24px;
    padding: 48px;
    width: 100%;
    max-width: 420px;
    margin: 16px;
    box-shadow: var(--card-shadow);
    transition: all var(--transition-speed) ease;
}
.login-card:hover {
    border-color: var(--card-border-hover);
}
.login-header {
    text-align: center;
    margin-bottom: 32px;
}
.login-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: 1.85rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 8px;
}
.login-logo i {
    color: var(--accent-color);
}
.login-subtitle {
    font-size: 0.85rem;
    color: var(--text-secondary);
}
.login-form .form-group {
    margin-bottom: 20px;
}
.login-form label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.login-form .form-control {
    width: 100%;
    padding: 14px 16px;
    background: var(--input-bg);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.95rem;
    transition: all 0.3s ease;
}
.login-form .form-control:focus {
    outline: none;
    border-color: var(--accent-color);
    background: var(--input-focus-bg);
    box-shadow: 0 0 0 4px var(--accent-glow);
}
.login-btn {
    width: 100%;
    margin-top: 12px;
    padding: 14px;
    font-size: 1rem;
    font-weight: 600;
}
.login-error {
    background: var(--danger-glow);
    border: 1px solid var(--danger-color);
    color: var(--text-primary);
    border-radius: 12px;
    padding: 12px;
    font-size: 0.85rem;
    margin-bottom: 20px;
    text-align: center;
    line-height: 1.45;
}

.login-hint {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin: 0 0 16px;
    line-height: 1.5;
    text-align: center;
}

.login-hint code {
    font-size: 0.72rem;
    padding: 2px 6px;
    border-radius: 4px;
    background: rgba(139, 92, 246, 0.08);
    color: var(--accent-color);
}

.login-footer {
    text-align: center;
    margin-top: 18px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

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

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

.login-footer--muted {
    line-height: 1.5;
    font-size: 0.82rem;
}

.login-footer--muted strong {
    color: var(--text-primary);
    font-weight: 600;
}

body.login-active .sidebar {
    display: none !important;
}
body.login-active .app-main {
    margin-left: 0 !important;
    padding: 0 !important;
    max-width: 100% !important;
    width: 100vw !important;
}
body.login-active .main-content {
    margin-left: 0 !important;
    padding: 0 !important;
    max-width: 100% !important;
    width: 100% !important;
}
body.login-active .ai-floating-widget {
    display: none !important;
}
body.login-active .mobile-menu-btn,
body.login-active .sidebar-backdrop {
    display: none !important;
}

/* ==========================================================================
   Premium spacing, layout fixes & worker UI adjustments
   ========================================================================== */

/* Spacing and margins inside grids to prevent clashing */
.metrics-grid .glass-card {
    margin-bottom: 0 !important;
}

/* Breathe room inside data tables */
.table-container th,
.table-container td {
    padding: 14px 20px;
}

/* Worker shaxsiy vazifalar kartochkalari */
.worker-task-card {
    padding: 22px !important;
    border: 1px solid var(--card-border) !important;
    border-radius: 20px !important;
    background: var(--card-bg) !important;
    backdrop-filter: blur(var(--blur-amount)) !important;
    -webkit-backdrop-filter: blur(var(--blur-amount)) !important;
    box-shadow: var(--card-shadow) !important;
    transition: all var(--transition-speed) cubic-bezier(0.16, 1, 0.3, 1) !important;
}

.worker-task-card:hover {
    transform: translateY(-3px) !important;
    border-color: var(--card-border-hover) !important;
    box-shadow: var(--card-shadow-hover) !important;
}

/* --- Premium Action Buttons (Edit/Delete) --- */
.btn-action {
    width: 34px;
    height: 34px;
    padding: 0 !important;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    border-radius: 50% !important;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
.btn-action i, .btn-action svg {
    width: 14px !important;
    height: 14px !important;
}
.btn-action.btn-edit {
    background: rgba(99, 102, 241, 0.08) !important;
    color: var(--accent-color) !important;
    border-color: rgba(99, 102, 241, 0.2) !important;
}
.btn-action.btn-edit:hover {
    background: var(--accent-color) !important;
    color: #ffffff !important;
    border-color: var(--accent-color) !important;
    transform: scale(1.1) rotate(5deg);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.35);
}
.btn-action.btn-delete {
    background: rgba(244, 63, 94, 0.08) !important;
    color: var(--danger-color) !important;
    border-color: rgba(244, 63, 94, 0.2) !important;
}
.btn-action.btn-delete:hover {
    background: var(--danger-color) !important;
    color: #ffffff !important;
    border-color: var(--danger-color) !important;
    transform: scale(1.1) rotate(-5deg);
    box-shadow: 0 4px 12px rgba(244, 63, 94, 0.35);
}

/* --- Expense Form Grid --- */
.expense-form-grid {
    display: grid;
    grid-template-columns: minmax(180px, 2fr) minmax(140px, 1.2fr) minmax(140px, 1.2fr) auto;
    gap: 16px 20px;
    align-items: end;
}

.expense-form-grid .form-group {
    margin-bottom: 0;
}

.expense-form-grid .form-group label {
    margin-bottom: 8px;
}

.expense-form-grid .form-control {
    min-height: 46px;
}

.expense-form-submit {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    min-width: 120px;
}

.expense-form-submit .btn {
    min-height: 46px;
    width: 100%;
    justify-content: center;
}

@media (max-width: 768px) {
    .expense-form-grid {
        grid-template-columns: 1fr;
        align-items: stretch;
    }

    .expense-form-submit {
        min-width: 0;
    }
}

/* --- CRM Metrics Grid --- */
.crm-metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

/* --- Sync error toast --- */
.sync-toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    max-width: 360px;
    padding: 14px 18px;
    border-radius: 12px;
    background: rgba(220, 53, 69, 0.95);
    color: #fff;
    font-size: 0.875rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
    opacity: 0;
    transform: translateY(12px);
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s ease;
}

.sync-toast--visible {
    opacity: 1;
    transform: translateY(0);
}

.form-grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px 16px;
    margin-bottom: 16px;
}

.form-grid-2 > .form-group {
    margin-bottom: 0;
}

@media (max-width: 640px) {
    .form-grid-2 {
        grid-template-columns: 1fr;
        gap: 14px;
    }
}

.modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--card-border);
}

/* --- System status banners (DB / offline) --- */
.system-banners {
    padding: 0 0 12px;
    width: 100%;
}

.system-banner {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 0.875rem;
    line-height: 1.45;
    margin-bottom: 8px;
}

.system-banner svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    margin-top: 2px;
}

.system-banner--warning {
    background: rgba(245, 158, 11, 0.15);
    border: 1px solid rgba(245, 158, 11, 0.35);
    color: var(--text-primary);
}

.system-banner--danger {
    background: rgba(220, 53, 69, 0.12);
    border: 1px solid rgba(220, 53, 69, 0.35);
}

.system-banner--success {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.25);
    color: var(--text-secondary);
}

.system-banner--compact {
    padding: 8px 14px;
    font-size: 0.8rem;
}

.system-banner__btn {
    background: transparent;
    border: none;
    color: var(--accent-color);
    font-weight: 600;
    cursor: pointer;
    text-decoration: underline;
    padding: 0;
    font-size: inherit;
}

@media (max-width: 900px) {
    .header {
        flex-direction: column;
        align-items: stretch;
    }

    .page-title {
        font-size: 1.65rem;
    }

    .page-title .title-icon {
        width: 28px;
        height: 28px;
    }

    .header-actions {
        width: 100%;
    }

    .mobile-menu-btn {
        display: flex;
        position: fixed;
        top: 16px;
        left: 16px;
        z-index: 110;
        width: 44px;
        height: 44px;
        align-items: center;
        justify-content: center;
        border-radius: 12px;
        border: 1px solid var(--card-border);
        background: var(--card-bg);
        backdrop-filter: blur(var(--blur-amount));
        color: var(--text-primary);
        cursor: pointer;
        box-shadow: var(--card-shadow);
    }

    .sidebar-backdrop {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.45);
        z-index: 99;
    }

    body.sidebar-open .sidebar-backdrop {
        display: block;
    }

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

    .sidebar {
        transform: translateX(calc(-100% - 32px));
        transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
        z-index: 101;
    }

    .app-main {
        margin-left: 0;
        padding: 72px 16px 24px;
        width: 100%;
    }

    .ai-floating-widget {
        bottom: 20px;
        right: 16px;
    }
}

@media (min-width: 901px) {
    .mobile-menu-btn,
    .sidebar-backdrop {
        display: none !important;
    }
}

.sidebar-footer {
    padding: 0 24px;
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sidebar-footer-btn {
    justify-content: center;
    gap: 8px;
}

.sidebar-footer-btn i {
    width: 14px;
    height: 14px;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: 'Outfit', sans-serif;
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text-secondary);
    text-align: center;
    margin-top: 8px;
    padding-top: 12px;
    border-top: 1px solid var(--card-border);
    opacity: 0.9;
}

.sidebar-brand-icon {
    width: 18px;
    height: 18px;
    color: var(--accent-color);
    flex-shrink: 0;
}

.sidebar-version {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-align: center;
    margin-top: 4px;
}

.mobile-menu-btn {
    display: none;
}

/* --- AI Import modal --- */
.import-modal-overlay {
    z-index: 10050;
}

.import-modal-card {
    max-width: 640px;
    width: calc(100% - 32px);
    max-height: 90vh;
    overflow: auto;
}

.import-map-table {
    font-size: 0.85rem;
    width: 100%;
}

.import-map-table td {
    padding: 6px 8px;
    border-bottom: 1px solid var(--card-border);
}

.import-preview-block {
    max-height: 160px;
    overflow: auto;
    background: var(--input-bg);
    border-radius: 10px;
    padding: 10px;
}

.import-preview-row {
    font-size: 0.75rem;
    margin: 0 0 6px;
    white-space: pre-wrap;
    word-break: break-all;
}

.import-modal-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin-bottom: 8px;
}


