/* ===================================
   Document Scanner - Premium Dark UI
   =================================== */

@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
    /* Dark Theme Colors (Default) */
    --bg-primary: #0a0a0f;
    --bg-secondary: #12121a;
    --bg-card: #1a1a25;
    --bg-card-hover: #22222f;
    --bg-elevated: #252532;
    
    /* Accent Colors */
    --accent-cyan: #00d4ff;
    --accent-purple: #a855f7;
    --accent-pink: #ec4899;
    --accent-green: #10b981;
    --accent-orange: #f97316;
    
    /* Gradients */
    --gradient-main: linear-gradient(135deg, #00d4ff 0%, #a855f7 50%, #ec4899 100%);
    --gradient-card: linear-gradient(145deg, #1a1a25 0%, #12121a 100%);
    --gradient-glow: linear-gradient(135deg, rgba(0, 212, 255, 0.15) 0%, rgba(168, 85, 247, 0.15) 100%);
    
    /* Text Colors */
    --text-primary: #ffffff;
    --text-secondary: #a1a1aa;
    --text-muted: #71717a;
    
    /* Borders & Shadows */
    --border-subtle: rgba(255, 255, 255, 0.06);
    --border-accent: rgba(0, 212, 255, 0.3);
    --shadow-glow: 0 0 40px rgba(0, 212, 255, 0.15);
    --shadow-card: 0 8px 32px rgba(0, 0, 0, 0.4);
    --shadow-button: 0 4px 20px rgba(0, 212, 255, 0.3);
    
    /* Sizing */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --radius-xl: 28px;
    
    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;
}

/* Light Theme */
[data-theme="light"] {
    /* Light Theme Colors */
    --bg-primary: #f8f9fa;
    --bg-secondary: #ffffff;
    --bg-card: #ffffff;
    --bg-card-hover: #f1f3f5;
    --bg-elevated: #ffffff;
    
    /* Accent Colors (Adjusted for light mode) */
    --accent-cyan: #0891b2;
    --accent-purple: #9333ea;
    --accent-pink: #db2777;
    --accent-green: #059669;
    --accent-orange: #ea580c;
    
    /* Gradients */
    --gradient-main: linear-gradient(135deg, #0891b2 0%, #9333ea 50%, #db2777 100%);
    --gradient-card: linear-gradient(145deg, #ffffff 0%, #f8f9fa 100%);
    --gradient-glow: linear-gradient(135deg, rgba(8, 145, 178, 0.1) 0%, rgba(147, 51, 234, 0.1) 100%);
    
    /* Text Colors */
    --text-primary: #1a1a1a;
    --text-secondary: #52525b;
    --text-muted: #71717a;
    
    /* Borders & Shadows */
    --border-subtle: rgba(0, 0, 0, 0.08);
    --border-accent: rgba(8, 145, 178, 0.3);
    --shadow-glow: 0 0 40px rgba(8, 145, 178, 0.1);
    --shadow-card: 0 4px 20px rgba(0, 0, 0, 0.08);
    --shadow-button: 0 4px 20px rgba(8, 145, 178, 0.2);
}

/* Smooth theme transition */
body {
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Base Styles */
*, *::before, *::after {
    box-sizing: border-box;
}

html {
    font-size: 15px;
    position: relative;
    height: 100%;
}

@media (min-width: 768px) {
    html {
        font-size: 16px;
    }
}

body {
    margin: 0;
    padding: 0;
    font-family: 'Space Grotesk', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    height: auto;
    overflow-x: hidden;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.page-wrapper {
    flex: 1 0 auto;
    display: flex;
    flex-direction: column;
}

/* Animated Background - Dark Mode */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(ellipse 80% 50% at 20% -20%, rgba(0, 212, 255, 0.12) 0%, transparent 50%),
        radial-gradient(ellipse 60% 40% at 80% 100%, rgba(168, 85, 247, 0.1) 0%, transparent 50%);
    pointer-events: none;
    z-index: -1;
    transition: opacity 0.3s ease;
}

/* Animated Background - Light Mode */
[data-theme="light"] body::before {
    background: 
        radial-gradient(ellipse 80% 50% at 20% -20%, rgba(8, 145, 178, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse 60% 40% at 80% 100%, rgba(147, 51, 234, 0.06) 0%, transparent 50%);
}

/* ==================== */
/* Theme Toggle Button */
/* ==================== */

.theme-toggle {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 9999;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 50%;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--shadow-card);
    transition: all var(--transition-normal);
}

.theme-toggle:hover {
    transform: scale(1.05);
    box-shadow: 0 8px 24px rgba(0, 212, 255, 0.3);
    border-color: var(--accent-cyan);
}

.theme-toggle svg {
    width: 24px;
    height: 24px;
    color: var(--accent-cyan);
    transition: all var(--transition-normal);
}

.theme-toggle:hover svg {
    transform: rotate(20deg);
}

/* Hide appropriate icon based on theme */
[data-theme="dark"] .theme-toggle .sun-icon {
    display: block;
}

[data-theme="dark"] .theme-toggle .moon-icon {
    display: none;
}

[data-theme="light"] .theme-toggle .sun-icon {
    display: none;
}

[data-theme="light"] .theme-toggle .moon-icon {
    display: block;
}

/* Tooltip */
.theme-toggle::after {
    content: attr(data-tooltip);
    position: absolute;
    right: 100%;
    margin-right: 0.75rem;
    padding: 0.5rem 0.75rem;
    background: var(--bg-elevated);
    color: var(--text-primary);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-fast);
    box-shadow: var(--shadow-card);
    border: 1px solid var(--border-subtle);
}

.theme-toggle:hover::after {
    opacity: 1;
}

/* Switching animation */
.theme-toggle.switching {
    animation: rotate360 0.3s ease;
}

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

/* Responsive */
@media (max-width: 640px) {
    .theme-toggle {
        top: 0.75rem;
        right: 0.75rem;
        width: 44px;
        height: 44px;
    }
    
    .theme-toggle svg {
        width: 22px;
        height: 22px;
    }
    
    .theme-toggle::after {
        display: none; /* Hide tooltip on mobile */
    }
}

/* Navbar Auth Section */
.navbar-auth-section {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-left: 1rem;
}

.navbar-user-email {
    color: var(--text-secondary);
    font-size: 0.9rem;
    max-width: 250px;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    transition: color 0.2s ease;
    flex-shrink: 1;
}

.navbar-user-email span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

.navbar-user-email:hover {
    color: var(--accent-cyan);
}

.navbar-current-project {
    color: var(--text-muted, #a1a1aa);
    font-size: 0.85rem;
    font-weight: 500;
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex-shrink: 1;
}

.btn-navbar-login,
.btn-navbar-logout {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: linear-gradient(135deg, #00d4ff 0%, #06b6d4 100%);
    border: none;
    border-radius: var(--radius-md);
    color: white;
    font-size: 0.9rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: var(--transition-normal);
    box-shadow: 0 2px 8px rgba(0, 212, 255, 0.2);
}

.btn-navbar-login:hover,
.btn-navbar-logout:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 212, 255, 0.3);
}

.btn-navbar-login svg,
.btn-navbar-logout svg {
    width: 16px;
    height: 16px;
}

@media (max-width: 1199.98px) {
    .navbar-user-email {
        display: none;
    }

    .navbar-current-project {
        display: none;
    }
    
    .navbar-auth-section {
        margin-left: 0.5rem;
    }
}

/* Theme Toggle in Navbar */
.theme-toggle-nav {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-normal);
    margin-left: 1rem;
}

.theme-toggle-nav:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 212, 255, 0.3);
    border-color: var(--accent-cyan);
}

.theme-toggle-nav svg {
    width: 20px;
    height: 20px;
    color: var(--accent-cyan);
    transition: all var(--transition-normal);
}

.theme-toggle-nav:hover svg {
    transform: rotate(20deg);
}

/* Hide appropriate icon based on theme */
[data-theme="dark"] .theme-toggle-nav .sun-icon {
    display: block;
}

[data-theme="dark"] .theme-toggle-nav .moon-icon {
    display: none;
}

[data-theme="light"] .theme-toggle-nav .sun-icon {
    display: none;
}

[data-theme="light"] .theme-toggle-nav .moon-icon {
    display: block;
}

/* Switching animation */
.theme-toggle-nav.switching {
    animation: rotate360 0.3s ease;
}

/* Responsive navbar toggle */
@media (max-width: 1199.98px) {
    .theme-toggle-nav {
        width: 36px;
        height: 36px;
        margin-left: 0.5rem;
    }
    
    .theme-toggle-nav svg {
        width: 18px;
        height: 18px;
    }
}

/* Hide default layout elements when on scanner page */
.scanner-page header,
.scanner-page footer {
    display: none !important;
}

.scanner-page .container {
    max-width: 100% !important;
    padding: 0 !important;
}

/* Sticky Header - Always visible at top */
header {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: var(--bg-primary);
}

header nav {
    background: var(--bg-secondary) !important;
    border-bottom: 1px solid var(--border-subtle) !important;
    backdrop-filter: blur(20px);
}

header .navbar-brand,
header .nav-link {
    color: var(--text-primary) !important;
    font-weight: 500;
}

header .nav-link:hover {
    color: var(--accent-cyan) !important;
}

/* Keep all header nav items on a single row */
header .navbar-nav {
    flex-wrap: nowrap;
}

header .navbar-nav .nav-link {
    white-space: nowrap;
    padding-left: 0.5rem !important;
    padding-right: 0.5rem !important;
    font-size: 0.85rem;
}

header .navbar-collapse {
    flex-wrap: nowrap;
}

header .navbar-auth-section {
    flex-shrink: 0;
}

/* Ensure mobile navbar hamburger is visible in light theme */
[data-theme="light"] .navbar-dark .navbar-toggler {
    border-color: rgba(15, 23, 42, 0.2);
}

[data-theme="light"] .navbar-dark .navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%2815, 23, 42, 0.8%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

footer {
    background: var(--bg-secondary) !important;
    border-top: 1px solid var(--border-subtle) !important;
    color: var(--text-muted) !important;
}

footer a {
    color: var(--accent-cyan) !important;
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
    box-shadow: 0 0 0 2px var(--bg-primary), 0 0 0 4px var(--accent-cyan);
}

/* ==================== */
/* Scanner Notifications */
/* ==================== */

.scanner-notifications-container {
    position: relative;
    margin-left: 1rem;
    display: flex;
    align-items: center;
}

.scanner-notifications-button {
    border: none;
    cursor: pointer;
    background: var(--bg-card);
    border-radius: var(--radius-md);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: all var(--transition-normal);
    box-shadow: 0 2px 8px rgba(0, 212, 255, 0.12);
}

.scanner-notifications-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 212, 255, 0.2);
    border-color: var(--accent-cyan);
}

.scanner-notifications-icon {
    font-size: 1.2rem;
    color: var(--accent-cyan);
}

.scanner-notifications-badge {
    position: absolute;
    top: 4px;
    right: 6px;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    border-radius: 999px;
    background: #ef4444;
    color: #fff;
    font-size: 0.7rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.scanner-notifications-panel {
    position: absolute;
    top: 48px;
    right: 0;
    width: 320px;
    max-height: 400px;
    background: var(--bg-elevated);
    border-radius: var(--radius-lg);
    box-shadow: 0 18px 45px rgba(15, 23, 42, 0.65);
    border: 1px solid var(--border-subtle);
    padding: 0.75rem 0.75rem 0.5rem;
    color: var(--text-primary);
    z-index: 1200;
}

.scanner-notifications-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.scanner-notifications-header span {
    font-weight: 600;
    color: var(--text-secondary);
}

.scanner-notifications-clear {
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 0.8rem;
    cursor: pointer;
    padding: 0.15rem 0.4rem;
    border-radius: var(--radius-sm);
    transition: background 0.15s ease, color 0.15s ease;
}

.scanner-notifications-clear:hover {
    background: rgba(148, 163, 184, 0.1);
    color: var(--text-secondary);
}

.scanner-notifications-list {
    max-height: 320px;
    overflow-y: auto;
    padding-right: 0.25rem;
}

.scanner-notifications-empty {
    margin: 0.4rem 0;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.scanner-notification-item {
    padding: 0.4rem 0.35rem;
    border-radius: var(--radius-md);
    display: flex;
    gap: 0.4rem;
    align-items: flex-start;
    font-size: 0.85rem;
    margin-bottom: 0.2rem;
}

.scanner-notification-time {
    flex-shrink: 0;
    font-size: 0.75rem;
    color: var(--text-muted);
    min-width: 42px;
}

.scanner-notification-message {
    color: var(--text-primary);
}

.scanner-notification-info {
    background: rgba(59, 130, 246, 0.12);
}

.scanner-notification-success {
    background: rgba(34, 197, 94, 0.12);
}

.scanner-notification-error {
    background: rgba(239, 68, 68, 0.12);
}

/* ==================== */
/* Scanner Container */
/* ==================== */

.scanner-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
    min-height: 100vh;
}

/* Header */
.scanner-header {
    text-align: center;
    margin-bottom: 2.5rem;
    position: relative;
}

.scanner-header::after {
    content: '';
    position: absolute;
    bottom: -1rem;
    left: 50%;
    transform: translateX(-50%);
    width: 100px;
    height: 3px;
    background: var(--gradient-main);
    border-radius: 3px;
}

.scanner-header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    background: var(--gradient-main);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
    letter-spacing: -0.02em;
}

.scanner-icon {
    width: 48px;
    height: 48px;
    stroke: var(--accent-cyan);
    filter: drop-shadow(0 0 10px rgba(0, 212, 255, 0.5));
    -webkit-text-fill-color: initial;
}

.scanner-subtitle {
    color: var(--text-secondary);
    font-size: 1.1rem;
    margin: 0;
    font-weight: 400;
}

/* Camera Controls */
.camera-controls {
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.camera-select-wrapper {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex: 1;
    background: var(--bg-card);
    padding: 1rem 1.25rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-subtle);
    box-shadow: var(--shadow-card);
}

.camera-select-wrapper label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    margin: 0;
    font-size: 0.95rem;
}

.camera-select-wrapper label svg {
    width: 22px;
    height: 22px;
    stroke: var(--accent-cyan);
}

.camera-select {
    flex: 1;
    padding: 0.625rem 1rem;
    border: 2px solid var(--border-subtle);
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    font-family: inherit;
    background: var(--bg-secondary);
    color: var(--text-primary);
    cursor: pointer;
    transition: var(--transition-normal);
}

.camera-select:focus {
    outline: none;
    border-color: var(--accent-cyan);
    box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.15);
}

.camera-select option {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.btn-flash {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    padding: 0;
    border: 2px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    background: var(--bg-card);
    color: var(--text-primary);
    cursor: pointer;
    transition: var(--transition-normal);
    box-shadow: var(--shadow-card);
    flex-shrink: 0;
}

.btn-flash:hover:not(:disabled) {
    border-color: var(--accent-cyan);
    background: var(--bg-card-hover);
    transform: translateY(-2px);
    box-shadow: 0 8px 32px rgba(0, 212, 255, 0.2);
}

.btn-flash:active:not(:disabled) {
    transform: translateY(0);
}

.btn-flash:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.btn-flash.active {
    border-color: var(--accent-cyan);
    background: var(--gradient-glow);
    box-shadow: 0 0 20px rgba(0, 212, 255, 0.3);
}

.btn-flash svg {
    width: 28px;
    height: 28px;
    stroke: var(--accent-cyan);
}

.btn-flash.active svg {
    stroke: var(--accent-cyan);
    filter: drop-shadow(0 0 4px rgba(0, 212, 255, 0.6));
}

/* Video Container */
.scanner-main {
    position: relative;
    margin-bottom: 1.5rem;
}

.video-container {
    position: relative;
    background: var(--bg-secondary);
    border-radius: var(--radius-xl);
    overflow: hidden;
    box-shadow: var(--shadow-card), var(--shadow-glow);
    /* Let the camera stream decide the exact aspect ratio (16:9, 19.5:9, 20:9, etc.)
       but make sure the preview never exceeds the viewport height on phones */
    width: 100%;
    max-height: 80vh;
    border: 1px solid var(--border-subtle);
}

#videoPreview {
    width: 100%;
    height: 100%;
    /* Umple containerul cu același aspect ratio ca ecranul (pot exista mici tăieturi pe margini) */
    object-fit: cover;
    display: none;
}

.video-placeholder {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    gap: 1.25rem;
    background: var(--gradient-glow);
}

.video-placeholder svg {
    width: 100px;
    height: 100px;
    stroke: var(--text-muted);
    opacity: 0.4;
}

.video-placeholder p {
    font-size: 0.95rem;
    margin: 0;
    font-weight: 500;
}

/* Scan Overlay - Animated Frame */
.scan-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

.scan-frame {
    width: 88%;
    height: 88%;
    position: relative;
    border: 1px solid rgba(0, 212, 255, 0.2);
    border-radius: var(--radius-md);
    animation: pulse-border 3s ease-in-out infinite;
}

@keyframes pulse-border {
    0%, 100% { border-color: rgba(0, 212, 255, 0.2); }
    50% { border-color: rgba(0, 212, 255, 0.4); }
}

.corner {
    position: absolute;
    width: 40px;
    height: 40px;
}

.corner::before,
.corner::after {
    content: '';
    position: absolute;
    background: var(--accent-cyan);
    box-shadow: 0 0 15px var(--accent-cyan);
}

.corner.top-left::before,
.corner.top-right::before,
.corner.bottom-left::before,
.corner.bottom-right::before {
    width: 4px;
    height: 100%;
    border-radius: 2px;
}

.corner.top-left::after,
.corner.top-right::after,
.corner.bottom-left::after,
.corner.bottom-right::after {
    width: 100%;
    height: 4px;
    border-radius: 2px;
}

.corner.top-left { top: 0; left: 0; }
.corner.top-left::before { top: 0; left: 0; }
.corner.top-left::after { top: 0; left: 0; }

.corner.top-right { top: 0; right: 0; }
.corner.top-right::before { top: 0; right: 0; }
.corner.top-right::after { top: 0; right: 0; }

.corner.bottom-left { bottom: 0; left: 0; }
.corner.bottom-left::before { bottom: 0; left: 0; }
.corner.bottom-left::after { bottom: 0; left: 0; }

.corner.bottom-right { bottom: 0; right: 0; }
.corner.bottom-right::before { bottom: 0; right: 0; }
.corner.bottom-right::after { bottom: 0; right: 0; }

/* Scanning Line Animation */
.scan-frame::before {
    content: '';
    position: absolute;
    left: 5%;
    width: 90%;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--accent-cyan), transparent);
    box-shadow: 0 0 20px var(--accent-cyan);
    animation: scan-line 2.5s ease-in-out infinite;
    opacity: 0.8;
}

@keyframes scan-line {
    0%, 100% { top: 10%; opacity: 0; }
    10% { opacity: 0.8; }
    90% { opacity: 0.8; }
    100% { top: 90%; opacity: 0; }
}

/* Preview Container */
.preview-container {
    display: none;
    background: var(--bg-secondary);
    border-radius: var(--radius-xl);
    overflow: hidden;
    box-shadow: var(--shadow-card);
    aspect-ratio: 9/16;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-subtle);
    position: relative;
}

.preview-container img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

#cropOverlayCanvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: auto;
    z-index: 10;
    cursor: default;
}

/* Action Buttons */
.action-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 2rem;
}

.btn-action {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.625rem;
    padding: 1rem 2rem;
    border: none;
    border-radius: 50px;
    font-size: 0.9rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: var(--transition-normal);
    position: relative;
    overflow: hidden;
}

.btn-action svg {
    width: 22px;
    height: 22px;
    transition: var(--transition-fast);
}

.btn-action:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none !important;
}

.btn-action::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.1) 0%, transparent 50%);
    opacity: 0;
    transition: var(--transition-fast);
}

.btn-action:hover::before {
    opacity: 1;
}

.btn-capture {
    background: var(--gradient-main);
    color: white;
    min-width: 180px;
    box-shadow: var(--shadow-button);
}

.btn-capture:hover:not(:disabled) {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 8px 30px rgba(0, 212, 255, 0.4);
}

.btn-capture:active:not(:disabled) {
    transform: translateY(-1px) scale(0.98);
}

.btn-retake {
    background: var(--bg-elevated);
    color: var(--text-primary);
    border: 2px solid var(--border-subtle);
}

.btn-retake:hover {
    background: var(--bg-card-hover);
    border-color: var(--accent-purple);
    transform: translateY(-2px);
}

.btn-save {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    box-shadow: 0 4px 20px rgba(16, 185, 129, 0.3);
}

.btn-save:hover:not(:disabled) {
    transform: translateY(-3px);
    box-shadow: 0 8px 30px rgba(16, 185, 129, 0.4);
}

.btn-download {
    background: linear-gradient(135deg, #a855f7 0%, #7c3aed 100%);
    color: white;
    box-shadow: 0 4px 20px rgba(168, 85, 247, 0.3);
}

.btn-download:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 30px rgba(168, 85, 247, 0.4);
}

/* Enhancement Panel */
.enhancement-panel {
    background: var(--bg-card);
    padding: 1.75rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-subtle);
    box-shadow: var(--shadow-card);
    margin-bottom: 2rem;
}

.enhancement-panel h3 {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 1.25rem 0;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.enhancement-panel h3::before {
    content: '';
    width: 4px;
    height: 18px;
    background: var(--gradient-main);
    border-radius: 2px;
}

.enhancement-options {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.enhancement-option {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.enhancement-option label {
    min-width: 90px;
    font-weight: 500;
    color: var(--text-secondary);
    margin: 0;
    font-size: 0.9rem;
}

.enhancement-option input[type="range"] {
    flex: 1;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    background: var(--bg-secondary);
    border-radius: 3px;
    outline: none;
}

.enhancement-option input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    background: var(--gradient-main);
    border-radius: 50%;
    cursor: pointer;
    transition: var(--transition-fast);
    box-shadow: 0 2px 10px rgba(0, 212, 255, 0.4);
}

.enhancement-option input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.enhancement-option span {
    min-width: 40px;
    text-align: center;
    font-weight: 600;
    font-family: 'JetBrains Mono', monospace;
    color: var(--accent-cyan);
    font-size: 0.9rem;
}

.filter-buttons {
    display: flex;
    gap: 0.75rem;
    margin-top: 0.75rem;
    flex-wrap: wrap;
}

.btn-filter {
    padding: 0.625rem 1.25rem;
    border: 2px solid var(--border-subtle);
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: var(--transition-normal);
    color: var(--text-secondary);
}

.btn-filter:hover {
    border-color: var(--accent-cyan);
    color: var(--accent-cyan);
    background: rgba(0, 212, 255, 0.05);
}

.btn-filter.active {
    background: var(--accent-cyan);
    border-color: var(--accent-cyan);
    color: var(--bg-primary);
}

.btn-filter.btn-reset {
    border-color: var(--accent-orange);
    color: var(--accent-orange);
}

.btn-filter.btn-reset:hover {
    background: var(--accent-orange);
    color: var(--bg-primary);
}

/* Scans Gallery */
.scans-gallery {
    background: var(--bg-card);
    padding: 1.75rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-subtle);
    box-shadow: var(--shadow-card);
}

.scans-gallery h3 {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 1.25rem 0;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: flex;
    align-items: center;
    gap: 0.625rem;
}

.scans-gallery h3 svg {
    width: 20px;
    height: 20px;
    stroke: var(--accent-purple);
}

.scans-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 1.25rem;
}

.no-scans {
    grid-column: 1 / -1;
    text-align: center;
    color: var(--text-muted);
    padding: 3rem 2rem;
    margin: 0;
    font-size: 0.95rem;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    border: 2px dashed var(--border-subtle);
}

.scan-item {
    position: relative;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid var(--border-subtle);
    transition: var(--transition-normal);
}

.scan-item:hover {
    transform: translateY(-4px);
    border-color: var(--accent-cyan);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3), 0 0 20px rgba(0, 212, 255, 0.1);
}

.scan-item img {
    width: 100%;
    aspect-ratio: 4/3;
    object-fit: cover;
    display: block;
    transition: var(--transition-normal);
}

.scan-item:hover img {
    transform: scale(1.05);
}

.scan-info {
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
    background: var(--bg-elevated);
}

.scan-date {
    font-size: 0.7rem;
    font-family: 'JetBrains Mono', monospace;
    color: var(--text-muted);
}

.scan-actions {
    display: flex;
    gap: 0.5rem;
}

.btn-scan-action {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border: none;
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition-fast);
    text-decoration: none;
}

.btn-scan-action svg {
    width: 16px;
    height: 16px;
}

.btn-scan-action:hover {
    background: var(--accent-cyan);
    color: var(--bg-primary);
    transform: scale(1.1);
}

.btn-scan-action.btn-view-linked-invoice {
    color: var(--accent-cyan);
}

.btn-scan-action.btn-view-linked-invoice:hover {
    background: var(--accent-cyan);
    color: var(--bg-primary);
}

.btn-view-linked-doc {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.7rem;
    margin-left: 0.5rem;
    background: var(--accent-cyan, #00b8d4);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm, 6px);
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 500;
    transition: filter 0.15s ease, transform 0.15s ease;
}

.btn-view-linked-doc:hover {
    filter: brightness(1.08);
    transform: translateY(-1px);
}

.btn-view-linked-doc svg {
    flex: 0 0 auto;
}

.btn-icon.btn-linked-doc {
    color: var(--accent-cyan, #06b6d4);
}

.btn-icon.btn-linked-doc:hover {
    background: var(--accent-cyan, #06b6d4);
    color: var(--bg-primary, #0f172a);
}

.btn-scan-action.btn-delete:hover {
    background: #ef4444;
    color: white;
}

/* OCR status indicator (hourglass / green check) – same size as action buttons, centered */
.scan-status-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    flex-shrink: 0;
    border-radius: var(--radius-sm);
    background: transparent;
}

.scan-status-indicator svg {
    width: 16px;
    height: 16px;
}

/* Aceeași clepsidră ca pe Proiecte/Bonuri (⏳ În așteptare OCR) */
.scan-status-pending {
    font-size: 1.35rem;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.scan-status-complete svg {
    color: #22c55e;
    width: 22px;
    height: 22px;
    stroke-width: 2.5;
}

/* Toast Notification */
.toast {
    position: fixed;
    top: 20px;
    bottom: auto;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    padding: 1rem 1.75rem;
    border-radius: 50px;
    font-weight: 600;
    font-size: 0.95rem;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    /* Must be above modal overlays (which use z-index: 9999) */
    z-index: 20000;
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    pointer-events: none;
    backdrop-filter: blur(10px);
    /* Fallback dacă lipsește clasa toast-{type} (contrast mereu OK) */
    background: #1e293b;
    color: #f8fafc;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.toast-success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
}

.toast-error {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
}

.toast-info {
    background: var(--gradient-main);
    color: white;
}

.toast-warning {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: #1c1917;
}

/* Modern Toast Notification */
.modern-toast {
    position: fixed;
    top: 2rem;
    right: 2rem;
    min-width: 320px;
    max-width: 480px;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.05);
    z-index: 20000;
    opacity: 0;
    transform: translateX(400px) scale(0.95);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    pointer-events: none;
    overflow: hidden;
}

.modern-toast.show {
    opacity: 1;
    transform: translateX(0) scale(1);
    pointer-events: all;
}

.modern-toast-content {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.25rem;
}

.modern-toast-icon {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modern-toast-icon svg {
    width: 100%;
    height: 100%;
}

.modern-toast-message {
    flex: 1;
    font-size: 0.95rem;
    font-weight: 500;
    line-height: 1.5;
    color: var(--text-primary);
}

.modern-toast-close {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition-fast);
    padding: 0;
}

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

.modern-toast-close svg {
    width: 16px;
    height: 16px;
}

/* Success Toast */
.modern-toast-success {
    border-left: 4px solid var(--accent-green);
    background: linear-gradient(135deg, var(--bg-card) 0%, rgba(16, 185, 129, 0.05) 100%);
}

.modern-toast-success .modern-toast-icon {
    color: var(--accent-green);
}

.modern-toast-success::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--accent-green) 0%, rgba(16, 185, 129, 0.3) 100%);
}

/* Error Toast */
.modern-toast-error {
    border-left: 4px solid #ef4444;
    background: linear-gradient(135deg, var(--bg-card) 0%, rgba(239, 68, 68, 0.05) 100%);
}

.modern-toast-error .modern-toast-icon {
    color: #ef4444;
}

.modern-toast-error::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, #ef4444 0%, rgba(239, 68, 68, 0.3) 100%);
}

/* Responsive */
@media (max-width: 640px) {
    .modern-toast {
        top: 1rem;
        right: 1rem;
        left: 1rem;
        min-width: auto;
        max-width: none;
        transform: translateY(-100px) scale(0.95);
    }

    .modern-toast.show {
        transform: translateY(0) scale(1);
    }
}

/* Spinner */
.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

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

/* Responsive Design */
@media (max-width: 640px) {
    .scanner-container {
        padding: 1.25rem 1rem;
    }

    .scanner-header h1 {
        font-size: 1.5rem;
    }

    .scanner-icon {
        width: 36px;
        height: 36px;
    }

    .camera-select-wrapper {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }

    .action-buttons {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0.75rem;
    }

    .btn-action {
        padding: 0.875rem 1rem;
    }

    .btn-capture {
        grid-column: 1 / -1;
    }

    .enhancement-option {
        flex-wrap: wrap;
    }

    .enhancement-option label {
        min-width: 100%;
        margin-bottom: 0.25rem;
    }

    .scans-container {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }

    .video-container,
    .preview-container {
        border-radius: var(--radius-lg);
    }
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--bg-elevated);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Selection */
::selection {
    background: rgba(0, 212, 255, 0.3);
    color: white;
}

/* ==================== */
/* Light Quality Indicator */
/* ==================== */

.light-indicator {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: var(--bg-card);
    padding: 1rem 1.25rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-subtle);
    box-shadow: var(--shadow-card);
    margin-bottom: 1.5rem;
    transition: var(--transition-normal);
}

.light-icon {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: var(--transition-normal);
}

.light-icon svg {
    width: 26px;
    height: 26px;
}

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

.light-status {
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 0.5rem;
    transition: var(--transition-fast);
}

.light-meter-container {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.light-meter-bg {
    flex: 1;
    height: 8px;
    background: var(--bg-secondary);
    border-radius: 4px;
    overflow: hidden;
}

.light-meter-fill {
    height: 100%;
    width: 0%;
    border-radius: 4px;
    transition: width 0.3s ease, background 0.3s ease;
}

.light-value {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.95rem;
    font-weight: 600;
    min-width: 35px;
    text-align: right;
}

/* Light Quality States */

/* Too Dark */
.light-indicator.light-too-dark {
    border-color: #ef4444;
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.1) 0%, var(--bg-card) 100%);
}

.light-indicator.light-too-dark .light-icon {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

.light-indicator.light-too-dark .light-status {
    color: #ef4444;
}

.light-indicator.light-too-dark .light-meter-fill {
    background: linear-gradient(90deg, #ef4444, #f87171);
}

.light-indicator.light-too-dark .light-value {
    color: #ef4444;
}

/* Low Light */
.light-indicator.light-low {
    border-color: var(--accent-orange);
    background: linear-gradient(135deg, rgba(249, 115, 22, 0.1) 0%, var(--bg-card) 100%);
}

.light-indicator.light-low .light-icon {
    background: rgba(249, 115, 22, 0.2);
    color: var(--accent-orange);
}

.light-indicator.light-low .light-status {
    color: var(--accent-orange);
}

.light-indicator.light-low .light-meter-fill {
    background: linear-gradient(90deg, var(--accent-orange), #fb923c);
}

.light-indicator.light-low .light-value {
    color: var(--accent-orange);
}

/* Good */
.light-indicator.light-good {
    border-color: var(--accent-green);
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.1) 0%, var(--bg-card) 100%);
}

.light-indicator.light-good .light-icon {
    background: rgba(16, 185, 129, 0.2);
    color: var(--accent-green);
    animation: pulse-glow 2s ease-in-out infinite;
}

@keyframes pulse-glow {
    0%, 100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4); }
    50% { box-shadow: 0 0 20px 5px rgba(16, 185, 129, 0.2); }
}

.light-indicator.light-good .light-status {
    color: var(--accent-green);
}

.light-indicator.light-good .light-meter-fill {
    background: linear-gradient(90deg, var(--accent-green), #34d399);
}

.light-indicator.light-good .light-value {
    color: var(--accent-green);
}

/* Bright */
.light-indicator.light-bright {
    border-color: #fbbf24;
    background: linear-gradient(135deg, rgba(251, 191, 36, 0.1) 0%, var(--bg-card) 100%);
}

.light-indicator.light-bright .light-icon {
    background: rgba(251, 191, 36, 0.2);
    color: #fbbf24;
}

.light-indicator.light-bright .light-status {
    color: #fbbf24;
}

.light-indicator.light-bright .light-meter-fill {
    background: linear-gradient(90deg, #fbbf24, #fcd34d);
}

.light-indicator.light-bright .light-value {
    color: #fbbf24;
}

/* Too Bright */
.light-indicator.light-too-bright {
    border-color: #ef4444;
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.1) 0%, var(--bg-card) 100%);
}

.light-indicator.light-too-bright .light-icon {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
    animation: flash-warning 0.8s ease-in-out infinite;
}

@keyframes flash-warning {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.light-indicator.light-too-bright .light-status {
    color: #ef4444;
}

.light-indicator.light-too-bright .light-meter-fill {
    background: linear-gradient(90deg, #fbbf24, #ef4444);
}

.light-indicator.light-too-bright .light-value {
    color: #ef4444;
}

/* Uneven */
.light-indicator.light-uneven {
    border-color: var(--accent-purple);
    background: linear-gradient(135deg, rgba(168, 85, 247, 0.1) 0%, var(--bg-card) 100%);
}

.light-indicator.light-uneven .light-icon {
    background: rgba(168, 85, 247, 0.2);
    color: var(--accent-purple);
}

.light-indicator.light-uneven .light-status {
    color: var(--accent-purple);
}

.light-indicator.light-uneven .light-meter-fill {
    background: linear-gradient(90deg, var(--accent-purple), #c084fc);
}

.light-indicator.light-uneven .light-value {
    color: var(--accent-purple);
}

/* Checking */
.light-indicator.light-checking .light-icon {
    background: rgba(161, 161, 170, 0.2);
    color: var(--text-secondary);
    animation: spin 1s linear infinite;
}

.light-indicator.light-checking .light-status {
    color: var(--text-secondary);
}

.light-indicator.light-checking .light-meter-fill {
    background: var(--text-muted);
    width: 50% !important;
    animation: loading-pulse 1.5s ease-in-out infinite;
}

@keyframes loading-pulse {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 0.7; }
}

.light-indicator.light-checking .light-value {
    color: var(--text-muted);
}

/* Responsive */
@media (max-width: 640px) {
    .light-indicator {
        padding: 0.875rem 1rem;
    }

    .light-icon {
        width: 40px;
        height: 40px;
    }

    .light-icon svg {
        width: 22px;
        height: 22px;
    }

    .light-status {
        font-size: 0.9rem;
    }
}

/* ==================== */
/* Angle Detection Indicator */
/* ==================== */

.angle-indicator {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: var(--bg-card);
    padding: 1rem 1.25rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-subtle);
    box-shadow: var(--shadow-card);
    margin-bottom: 1.5rem;
    transition: var(--transition-normal);
}

.angle-icon {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: var(--transition-normal);
}

.angle-icon svg {
    width: 26px;
    height: 26px;
}

.angle-info {
    flex: 1;
}

.angle-status {
    font-weight: 600;
    font-size: 0.9375rem;
    margin-bottom: 0.5rem;
    letter-spacing: 0.01em;
}

.angle-meter-container {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.angle-meter-bg {
    flex: 1;
    height: 6px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 3px;
    overflow: hidden;
    position: relative;
}

.angle-meter-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.3s ease, background 0.3s ease;
    box-shadow: 0 0 10px rgba(0, 212, 255, 0.3);
}

.angle-value {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 500;
    font-size: 0.9rem;
    min-width: 45px;
    text-align: right;
}

/* Perfect Angle */
.angle-indicator.angle-perfect {
    border-color: var(--accent-green);
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.15) 0%, var(--bg-card) 100%);
}

.angle-indicator.angle-perfect .angle-icon {
    background: rgba(16, 185, 129, 0.2);
    color: var(--accent-green);
    animation: pulse-glow 2s ease-in-out infinite;
}

.angle-indicator.angle-perfect .angle-status {
    color: var(--accent-green);
    font-weight: 700;
}

.angle-indicator.angle-perfect .angle-meter-fill {
    background: linear-gradient(90deg, var(--accent-green), #34d399);
}

.angle-indicator.angle-perfect .angle-value {
    color: var(--accent-green);
}

/* Good Angle */
.angle-indicator.angle-good {
    border-color: var(--accent-cyan);
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.1) 0%, var(--bg-card) 100%);
}

.angle-indicator.angle-good .angle-icon {
    background: rgba(0, 212, 255, 0.2);
    color: var(--accent-cyan);
}

.angle-indicator.angle-good .angle-status {
    color: var(--accent-cyan);
}

.angle-indicator.angle-good .angle-meter-fill {
    background: linear-gradient(90deg, var(--accent-cyan), #7dd3fc);
}

.angle-indicator.angle-good .angle-value {
    color: var(--accent-cyan);
}

/* Fair Angle */
.angle-indicator.angle-fair {
    border-color: #fbbf24;
    background: linear-gradient(135deg, rgba(251, 191, 36, 0.1) 0%, var(--bg-card) 100%);
}

.angle-indicator.angle-fair .angle-icon {
    background: rgba(251, 191, 36, 0.2);
    color: #fbbf24;
}

.angle-indicator.angle-fair .angle-status {
    color: #fbbf24;
}

.angle-indicator.angle-fair .angle-meter-fill {
    background: linear-gradient(90deg, #fbbf24, #fcd34d);
}

.angle-indicator.angle-fair .angle-value {
    color: #fbbf24;
}

/* Poor Angle */
.angle-indicator.angle-poor {
    border-color: var(--accent-orange);
    background: linear-gradient(135deg, rgba(249, 115, 22, 0.1) 0%, var(--bg-card) 100%);
}

.angle-indicator.angle-poor .angle-icon {
    background: rgba(249, 115, 22, 0.2);
    color: var(--accent-orange);
}

.angle-indicator.angle-poor .angle-status {
    color: var(--accent-orange);
}

.angle-indicator.angle-poor .angle-meter-fill {
    background: linear-gradient(90deg, var(--accent-orange), #fb923c);
}

.angle-indicator.angle-poor .angle-value {
    color: var(--accent-orange);
}

/* Bad Angle */
.angle-indicator.angle-bad {
    border-color: #ef4444;
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.1) 0%, var(--bg-card) 100%);
}

.angle-indicator.angle-bad .angle-icon {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
    animation: flash-warning 0.8s ease-in-out infinite;
}

.angle-indicator.angle-bad .angle-status {
    color: #ef4444;
}

.angle-indicator.angle-bad .angle-meter-fill {
    background: linear-gradient(90deg, #ef4444, #f87171);
}

.angle-indicator.angle-bad .angle-value {
    color: #ef4444;
}

/* Responsive */
@media (max-width: 640px) {
    .angle-indicator {
        padding: 0.875rem 1rem;
    }

    .angle-icon {
        width: 40px;
        height: 40px;
    }

    .angle-icon svg {
        width: 22px;
        height: 22px;
    }

    .angle-status {
        font-size: 0.9rem;
    }
}

/* ==================== */
/* Mode Selector */
/* ==================== */

.mode-selector {
    display: flex;
    gap: 0.5rem;
    background: var(--bg-card);
    padding: 0.5rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-subtle);
    box-shadow: var(--shadow-card);
    margin-bottom: 1.5rem;
}

.mode-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.875rem 1.25rem;
    background: transparent;
    border: none;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-normal);
    position: relative;
}

.mode-btn svg {
    width: 20px;
    height: 20px;
    transition: var(--transition-fast);
}

.mode-btn:hover {
    color: var(--text-primary);
    background: var(--bg-secondary);
}

.mode-btn.active {
    background: var(--gradient-main);
    color: white;
    box-shadow: var(--shadow-button);
}

.mode-btn.active svg {
    stroke: white;
}

.page-count {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    background: white;
    color: var(--bg-primary);
    border-radius: 11px;
    font-size: 0.75rem;
    font-weight: 700;
    margin-left: 0.25rem;
}

.mode-btn.active .page-count {
    background: rgba(255, 255, 255, 0.9);
}

/* ==================== */
/* Multi-Page Strip */
/* ==================== */

.multi-page-strip {
    background: var(--bg-card);
    padding: 1.25rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-subtle);
    box-shadow: var(--shadow-card);
    margin-bottom: 1.5rem;
}

.multi-page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.multi-page-header h4 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
}

.multi-page-header h4 svg {
    width: 18px;
    height: 18px;
    stroke: var(--accent-purple);
}

.btn-clear-all {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.5rem 0.875rem;
    background: transparent;
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: var(--radius-sm);
    color: #ef4444;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-normal);
}

.btn-clear-all svg {
    width: 14px;
    height: 14px;
}

.btn-clear-all:hover {
    background: rgba(239, 68, 68, 0.1);
    border-color: #ef4444;
}

.multi-page-thumbnails {
    display: flex;
    gap: 0.75rem;
    overflow-x: auto;
    padding-bottom: 0.5rem;
    scrollbar-width: thin;
    scrollbar-color: var(--bg-elevated) transparent;
}

.multi-page-thumbnails::-webkit-scrollbar {
    height: 6px;
}

.multi-page-thumbnails::-webkit-scrollbar-track {
    background: transparent;
}

.multi-page-thumbnails::-webkit-scrollbar-thumb {
    background: var(--bg-elevated);
    border-radius: 3px;
}

.page-thumbnail {
    position: relative;
    flex-shrink: 0;
    width: 100px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    border: 2px solid var(--border-subtle);
    cursor: pointer;
    transition: var(--transition-normal);
}

.page-thumbnail:hover {
    border-color: var(--accent-cyan);
    transform: translateY(-2px);
}

.page-thumbnail img {
    width: 100%;
    aspect-ratio: 3/4;
    object-fit: cover;
    display: block;
}

.page-number {
    position: absolute;
    bottom: 4px;
    left: 4px;
    padding: 2px 8px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    backdrop-filter: blur(4px);
}

.remove-page-btn {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(239, 68, 68, 0.9);
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    opacity: 0;
    transition: var(--transition-fast);
}

.remove-page-btn svg {
    width: 14px;
    height: 14px;
}

.page-thumbnail:hover .remove-page-btn {
    opacity: 1;
}

.remove-page-btn:hover {
    background: #ef4444;
    transform: scale(1.1);
}

.add-page-placeholder {
    flex-shrink: 0;
    width: 100px;
    aspect-ratio: 3/4;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    background: var(--bg-secondary);
    border: 2px dashed var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition-normal);
}

.add-page-placeholder svg {
    width: 24px;
    height: 24px;
}

.add-page-placeholder span {
    font-size: 0.7rem;
    font-weight: 600;
}

.add-page-placeholder:hover {
    border-color: var(--accent-cyan);
    color: var(--accent-cyan);
    background: rgba(0, 212, 255, 0.05);
}

.multi-page-hint {
    margin: 0.75rem 0 0 0;
    font-size: 0.9rem;
    color: var(--text-muted);
    text-align: center;
}

/* ==================== */
/* Multi-Page Preview */
/* ==================== */

.multi-preview-container {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--bg-secondary);
    border-radius: var(--radius-xl);
    overflow: hidden;
    box-shadow: var(--shadow-card);
    aspect-ratio: 4/3;
    border: 1px solid var(--border-subtle);
    position: relative;
    cursor: pointer;
}

.multi-preview-container img {
    max-width: 100%;
    max-height: calc(100% - 50px);
    object-fit: contain;
}

.multi-preview-nav {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 0.75rem;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
}

.preview-nav-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 50%;
    color: var(--text-primary);
    cursor: pointer;
    transition: var(--transition-fast);
}

.preview-nav-btn svg {
    width: 20px;
    height: 20px;
}

.preview-nav-btn:hover:not(:disabled) {
    background: var(--accent-cyan);
    color: var(--bg-primary);
}

.preview-nav-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.preview-page-indicator {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.9rem;
    font-weight: 600;
    color: white;
    min-width: 60px;
    text-align: center;
}

/* Multi-capture button */
.btn-multi-capture {
    background: linear-gradient(135deg, var(--accent-purple) 0%, var(--accent-pink) 100%);
    color: white;
    min-width: 180px;
    box-shadow: 0 4px 20px rgba(168, 85, 247, 0.3);
}

.btn-multi-capture:hover:not(:disabled) {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 8px 30px rgba(168, 85, 247, 0.4);
}

.btn-multi-capture:active:not(:disabled) {
    transform: translateY(-1px) scale(0.98);
}

/* Save multi button */
.btn-save-multi {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    box-shadow: 0 4px 20px rgba(16, 185, 129, 0.3);
}

.btn-save-multi:hover:not(:disabled) {
    transform: translateY(-3px);
    box-shadow: 0 8px 30px rgba(16, 185, 129, 0.4);
}

/* Multi-page scan badge */
.scan-item.multi-page-scan {
    position: relative;
}

.multi-page-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    padding: 4px 10px;
    background: linear-gradient(135deg, var(--accent-purple) 0%, var(--accent-pink) 100%);
    color: white;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 700;
    box-shadow: 0 2px 8px rgba(168, 85, 247, 0.4);
}

/* Image Modal/Popup */
.image-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease-out;
}

.image-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(8px);
}

.image-modal-content {
    position: relative;
    width: 90%;
    max-width: 1200px;
    max-height: 90vh;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    z-index: 1;
    animation: slideUp 0.3s ease-out;
}

.image-modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 40px;
    height: 40px;
    border: none;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    transition: var(--transition-fast);
    backdrop-filter: blur(10px);
}

.image-modal-close:hover {
    background: rgba(0, 0, 0, 0.8);
    transform: scale(1.1);
}

.image-modal-close svg {
    width: 20px;
    height: 20px;
}

.image-modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-shrink: 0;
}

.image-modal-header h3 {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.image-modal-nav {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.image-nav-btn {
    width: 36px;
    height: 36px;
    border: none;
    background: var(--bg-secondary);
    color: var(--text-primary);
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-fast);
}

.image-nav-btn:hover:not(:disabled) {
    background: var(--accent-cyan);
    color: var(--bg-primary);
    transform: scale(1.05);
}

.image-nav-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.image-nav-btn svg {
    width: 18px;
    height: 18px;
}

.image-nav-indicator {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary);
    min-width: 60px;
    text-align: center;
    font-family: 'JetBrains Mono', monospace;
}

.image-modal-body {
    flex: 1;
    overflow: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    min-height: 0;
}

.image-modal-body img {
    max-width: 100%;
    max-height: calc(90vh - 200px);
    object-fit: contain;
    border-radius: var(--radius-md);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

/* OCR modal: top-aligned content, better on mobile */
#ocrModal .image-modal-body {
    align-items: flex-start;
    justify-content: flex-start;
    padding: 1rem 1.5rem;
}

/* OCR Modal Layout */
.ocr-modal-body-content {
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.ocr-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 1.4fr);
    gap: 1.5rem;
}

.ocr-column {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.ocr-section {
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    padding: 1rem 1.25rem;
    border: 1px solid var(--border-subtle);
}

.ocr-section h4 {
    margin: 0 0 0.75rem 0;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
}

.ocr-section p {
    margin: 0.15rem 0;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.ocr-section p strong {
    color: var(--text-primary);
}

.ocr-vat-rates ul {
    margin: 0.35rem 0 0;
    padding-left: 1.1rem;
    font-size: 0.88rem;
    color: var(--text-secondary);
}

.ocr-vat-rates li {
    margin-bottom: 0.1rem;
}

.ocr-items-section {
    max-height: 360px;
    display: flex;
    flex-direction: column;
}

.ocr-items-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.ocr-items-header h4 {
    margin: 0;
}

.ocr-items-count {
    font-size: 0.9rem;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    background: rgba(56, 189, 248, 0.12);
    color: var(--accent-cyan);
    border: 1px solid rgba(56, 189, 248, 0.4);
}

.ocr-items-table-wrapper {
    flex: 1;
    overflow: auto;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-subtle);
    background: var(--bg-primary);
}

.ocr-items-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.86rem;
}

.ocr-items-table thead {
    position: sticky;
    top: 0;
    background: var(--bg-secondary);
    z-index: 1;
}

.ocr-items-table th,
.ocr-items-table td {
    padding: 0.4rem 0.5rem;
    border-bottom: 1px solid var(--border-subtle);
    text-align: left;
    white-space: nowrap;
}

.ocr-items-table th {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.ocr-items-table td:nth-child(1) {
    text-align: center;
    width: 36px;
}

.ocr-items-table td:nth-child(3),
.ocr-items-table td:nth-child(4),
.ocr-items-table td:nth-child(5),
.ocr-items-table td:nth-child(6) {
    text-align: right;
}

.ocr-items-table tbody tr:hover {
    background: rgba(56, 189, 248, 0.06);
}

@media (max-width: 992px) {
    .ocr-layout {
        grid-template-columns: minmax(0, 1fr);
    }
}

.image-modal-footer {
    padding: 1.5rem;
    border-top: 1px solid var(--border-subtle);
    display: flex;
    justify-content: center;
    flex-shrink: 0;
}

.btn-image-action {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: var(--gradient-main);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    text-decoration: none;
    transition: var(--transition-fast);
}

.btn-image-action:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 212, 255, 0.3);
}

.btn-image-action svg {
    width: 18px;
    height: 18px;
}

.scan-item {
    cursor: pointer;
}

.scan-item:hover {
    cursor: pointer;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

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

@media (max-width: 640px) {
    .image-modal-content {
        width: 95%;
        max-height: 95vh;
    }

    .image-modal-header {
        padding: 1rem;
    }

    .image-modal-header h3 {
        font-size: 0.95rem;
    }

    .image-modal-body {
        padding: 1rem;
    }

    .image-modal-body img {
        max-height: calc(95vh - 180px);
    }

    .image-modal-footer {
        padding: 1rem;
    }

    .image-modal-close {
        top: 0.5rem;
        right: 0.5rem;
        width: 36px;
        height: 36px;
    }

    .image-nav-btn {
        width: 32px;
        height: 32px;
    }

    .image-nav-indicator {
        font-size: 0.95rem;
        min-width: 50px;
    }
}

/* Responsive for mode selector and multi-page */
@media (max-width: 640px) {
    .mode-selector {
        padding: 0.375rem;
    }

    .mode-btn {
        padding: 0.75rem 0.5rem;
        font-size: 0.95rem;
    }

    .mode-btn svg {
        width: 18px;
        height: 18px;
    }

    .mode-btn span:not(.page-count) {
        display: none;
    }

    .multi-page-strip {
        padding: 1rem;
    }

    .page-thumbnail {
        width: 80px;
    }

    .add-page-placeholder {
        width: 80px;
    }

    .multi-page-header h4 span {
        display: none;
    }

    .btn-clear-all span {
        display: none;
    }

    .btn-clear-all {
        padding: 0.5rem;
    }
}

/* ==================== */
/* Card Management */
/* ==================== */

.cards-container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

.cards-content-wrapper {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    align-items: start;
}

.cards-content-wrapper.employee-view {
    grid-template-columns: 1fr;
}

.cards-header {
    text-align: center;
    margin-bottom: 2.5rem;
    position: relative;
}

.cards-header::after {
    content: '';
    position: absolute;
    bottom: -1rem;
    left: 50%;
    transform: translateX(-50%);
    width: 100px;
    height: 3px;
    background: linear-gradient(135deg, #f97316 0%, #ec4899 100%);
    border-radius: 3px;
}

.cards-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, #f97316 0%, #ec4899 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
    letter-spacing: -0.02em;
}

.cards-icon {
    width: 48px;
    height: 48px;
    stroke: #f97316;
    filter: drop-shadow(0 0 10px rgba(249, 115, 22, 0.5));
    -webkit-text-fill-color: initial;
}

.cards-subtitle {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin: 0;
    font-weight: 400;
}

/* Card Form Panel */
.card-form-panel {
    background: var(--bg-card);
    padding: 1.75rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-subtle);
    box-shadow: var(--shadow-card);
}

.form-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}

.form-header h3 {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.form-header h3 svg {
    width: 20px;
    height: 20px;
    stroke: var(--accent-orange);
}

.btn-close-form {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition-fast);
}

.btn-close-form:hover {
    background: rgba(239, 68, 68, 0.1);
    border-color: #ef4444;
    color: #ef4444;
}

.btn-close-form svg {
    width: 18px;
    height: 18px;
}

/* Card Preview */
.card-preview {
    position: relative;
    width: 100%;
    max-width: 380px;
    aspect-ratio: 1.586;
    margin: 0 auto 1.5rem;
    padding: 1.5rem;
    border-radius: 16px;
    background: linear-gradient(135deg, #1a1a2e 0%, #2d2d44 100%);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
    color: white;
    overflow: hidden;
    transition: background 0.5s ease;
}

.card-preview::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Ccircle cx='100' cy='100' r='80' fill='none' stroke='rgba(255,255,255,0.03)' stroke-width='40'/%3E%3C/svg%3E");
    background-size: 150% 150%;
    background-position: -25% -25%;
    pointer-events: none;
}

.card-chip {
    width: 50px;
    height: 40px;
    margin-bottom: 1.5rem;
}

.card-chip svg {
    width: 100%;
    height: 100%;
}

.card-type-logo {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    font-size: 1.5rem;
}

.card-number-display {
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.4rem;
    letter-spacing: 0.1em;
    margin-bottom: 1.5rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.card-details-row {
    display: flex;
    justify-content: space-between;
    gap: 2rem;
}

.card-holder-display,
.card-expiry-display {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.card-holder-display .label,
.card-expiry-display .label {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    opacity: 0.7;
}

.card-holder-display .value,
.card-expiry-display .value {
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: 0.05em;
}

/* Form Styles */
.card-form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.form-group label svg {
    width: 16px;
    height: 16px;
    stroke: var(--accent-orange);
}

.form-input {
    padding: 0.875rem 1rem;
    background: var(--bg-secondary);
    border: 2px solid var(--border-subtle);
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 0.9rem;
    color: var(--text-primary);
    transition: var(--transition-normal);
}

.form-input::placeholder {
    color: var(--text-muted);
}

/* Drag and Drop Zone Styles */
.drop-zone {
    position: relative;
    border: 2px dashed var(--border-subtle);
    border-radius: var(--radius-md);
    background: var(--bg-card);
    padding: 2rem;
    text-align: center;
    transition: all var(--transition-normal);
    cursor: pointer;
    min-height: 180px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.drop-zone:hover {
    border-color: var(--accent-purple);
    background: var(--bg-card-hover);
    box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.1);
}

.drop-zone.drag-over {
    border-color: var(--accent-cyan);
    background: var(--bg-elevated);
    box-shadow: 0 0 0 4px rgba(0, 212, 255, 0.15), var(--shadow-glow);
    transform: scale(1.02);
}

.drop-zone-content {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    position: relative;
}

.drop-zone-icon {
    width: 48px;
    height: 48px;
    color: var(--accent-purple);
    transition: all var(--transition-normal);
}

.drop-zone.drag-over .drop-zone-icon {
    color: var(--accent-cyan);
    transform: translateY(-5px) scale(1.1);
}

.drop-zone-text {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-secondary);
}

.drop-zone-text-main {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.drop-zone.drag-over .drop-zone-text-main {
    color: var(--accent-cyan);
}

.drop-zone-text-sub {
    font-size: 0.875rem;
    color: var(--text-muted);
}

.drop-zone-input {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    cursor: pointer;
    z-index: 10;
}

/* Selected Files List Styles */
.selected-files-container {
    margin-top: 0.5rem;
}

.selected-files-list {
    list-style: none;
    padding: 0;
    margin: 0;
    max-height: 200px;
    overflow-y: auto;
    overflow-x: hidden;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    background: var(--bg-secondary);
    padding: 0.5rem;
}

.selected-files-list::-webkit-scrollbar {
    width: 8px;
}

.selected-files-list::-webkit-scrollbar-track {
    background: var(--bg-card);
    border-radius: 4px;
}

.selected-files-list::-webkit-scrollbar-thumb {
    background: var(--accent-purple);
    border-radius: 4px;
    opacity: 0.6;
}

.selected-files-list::-webkit-scrollbar-thumb:hover {
    opacity: 1;
}

.selected-files-list li {
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-subtle);
    transition: background-color var(--transition-fast);
}

.selected-files-list li:last-child {
    border-bottom: none;
}

.selected-files-list li:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}

/* Import Status Text Styles */
#importStatusText {
    word-wrap: break-word;
    max-width: 100%;
}

#importStatusText strong {
    display: block;
    margin-top: 0.5rem;
    font-weight: 600;
}

#importStatusText span {
    display: block;
    margin-top: 0.25rem;
    word-break: break-all;
    max-height: 150px;
    overflow-y: auto;
    padding: 0.5rem;
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-subtle);
    text-align: left;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
}

#importStatusText span::-webkit-scrollbar {
    width: 6px;
}

#importStatusText span::-webkit-scrollbar-track {
    background: var(--bg-secondary);
    border-radius: 3px;
}

#importStatusText span::-webkit-scrollbar-thumb {
    background: var(--accent-orange);
    border-radius: 3px;
    opacity: 0.6;
}

#importStatusText span::-webkit-scrollbar-thumb:hover {
    opacity: 1;
}

.form-input:focus {
    outline: none;
    border-color: var(--accent-orange);
    box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.15);
}

.input-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
}

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

.form-actions {
    display: flex;
    gap: 1rem;
    margin-top: 0.5rem;
}

.btn-cancel {
    flex: 1;
    padding: 0.875rem 1.5rem;
    background: var(--bg-elevated);
    border: 2px solid var(--border-subtle);
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition-normal);
}

.btn-cancel:hover {
    background: var(--bg-card-hover);
    border-color: var(--text-muted);
    color: var(--text-primary);
}

.btn-submit {
    flex: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.875rem 1.5rem;
    background: linear-gradient(135deg, #f97316 0%, #ec4899 100%);
    border: none;
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    color: white;
    cursor: pointer;
    transition: var(--transition-normal);
    box-shadow: 0 4px 20px rgba(249, 115, 22, 0.3);
}

.btn-submit:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(249, 115, 22, 0.4);
}

.btn-submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-submit svg {
    width: 20px;
    height: 20px;
}

/* Cards List Panel */
.cards-list-panel {
    background: var(--bg-card);
    padding: 1.75rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-subtle);
    box-shadow: var(--shadow-card);
}

.list-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
}

.list-header h3 {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.list-header h3 svg {
    width: 18px;
    height: 18px;
    stroke: var(--accent-pink);
}

.card-count {
    font-size: 0.95rem;
    color: var(--text-muted);
    font-weight: 500;
}

.cards-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.no-cards {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 2rem;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    border: 2px dashed var(--border-subtle);
    text-align: center;
}

.no-cards svg {
    width: 60px;
    height: 60px;
    stroke: var(--text-muted);
    opacity: 0.5;
    margin-bottom: 1rem;
}

.no-cards p {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin: 0 0 0.25rem 0;
}

.no-cards span {
    font-size: 0.95rem;
    color: var(--text-muted);
}

/* Card Item */
.card-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
    transition: var(--transition-normal);
}

.card-item:hover {
    border-color: var(--accent-orange);
    box-shadow: 0 4px 20px rgba(249, 115, 22, 0.1);
}

.card-item-visual {
    position: relative;
    width: 80px;
    height: 50px;
    border-radius: 6px;
    padding: 0.5rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    flex-shrink: 0;
}

.card-item-visual.card-type-visa {
    background: linear-gradient(135deg, #1a1f71 0%, #2d338e 100%);
}

.card-item-visual.card-type-mastercard {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
}

.card-item-visual.card-type-amex {
    background: linear-gradient(135deg, #006fcf 0%, #00a1e0 100%);
}

.card-item-visual.card-type-discover {
    background: linear-gradient(135deg, #ff6000 0%, #ff8533 100%);
}

.card-item-visual.card-type-card,
.card-item-visual.card-type-unknown {
    background: linear-gradient(135deg, #1a1a2e 0%, #2d2d44 100%);
}

.card-item-chip {
    width: 18px;
    height: 12px;
    background: #d4af37;
    border-radius: 2px;
}

.card-item-type {
    position: absolute;
    top: 4px;
    right: 6px;
    font-size: 0.5rem;
    font-weight: 700;
    color: white;
}

.card-item-number {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.5rem;
    color: rgba(255, 255, 255, 0.9);
    letter-spacing: 0.05em;
}

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

.card-item-nickname {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--accent-primary);
    margin-bottom: 0.25rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.card-item-holder {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.card-item-expiry {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.card-item-date {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.card-item-actions {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
}

.btn-edit,
.btn-delete-card {
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition-fast);
}

.btn-edit svg,
.btn-delete-card svg {
    width: 18px;
    height: 18px;
}

.btn-edit:hover {
    background: var(--accent-cyan);
    border-color: var(--accent-cyan);
    color: var(--bg-primary);
}

.btn-delete-card:hover {
    background: #ef4444;
    border-color: #ef4444;
    color: white;
}

/* Delete Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    z-index: 9999;
    backdrop-filter: blur(4px);
}

/* Modern Modal Styles for Add Team Member */
.modern-modal {
    background: var(--bg-card);
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    width: 100%;
    max-width: 700px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--border-subtle);
}

.modal-header-modern {
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-card);
}

.modal-header-modern h2 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.close-btn-modern {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    width: 36px;
    height: 36px;
}

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

.close-btn-modern svg {
    width: 20px;
    height: 20px;
}

.modal-body-modern {
    padding: 2rem;
    overflow-y: auto;
    flex: 1;
}

.form-group-modern {
    margin-bottom: 1.5rem;
}

.form-group-modern label {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
}

.form-group-modern label svg {
    width: 20px;
    height: 20px;
    color: var(--text-secondary);
    flex-shrink: 0;
}

.form-input-modern {
    width: 100%;
    padding: 0.875rem 1rem;
    background: var(--bg-elevated);
    border: 2px solid var(--border-subtle);
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 0.95rem;
    font-family: inherit;
    transition: all 0.2s ease;
    box-sizing: border-box;
}

.form-input-modern:focus {
    outline: none;
    border-color: #8b5cf6;
    background: var(--bg-card);
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
}

.form-input-modern:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.form-input-modern::placeholder {
    color: var(--text-muted);
}

.toggle-btn {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 2px solid var(--border-subtle);
    border-radius: 10px;
    background: var(--bg-card);
    color: var(--text-primary);
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
}

.toggle-btn.active {
    background: linear-gradient(135deg, #8b5cf6, #7c3aed) !important;
    border-color: #8b5cf6 !important;
    color: white !important;
    box-shadow: 0 2px 8px rgba(139, 92, 246, 0.3);
}

.toggle-btn:not(.active) {
    background: var(--bg-card) !important;
    border-color: var(--border-subtle) !important;
    color: var(--text-primary) !important;
}

.toggle-btn:not(.active):hover {
    background: var(--bg-elevated) !important;
    border-color: var(--border-color) !important;
}

.modal-actions-modern {
    padding: 1.5rem 2rem;
    border-top: 1px solid var(--border-subtle);
    display: flex;
    gap: 1rem;
    background: var(--bg-card);
}

.btn-cancel-modern,
.btn-save-modern {
    flex: 1;
    padding: 0.875rem 1.5rem;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    border: none;
    font-family: inherit;
}

.btn-cancel-modern {
    background: var(--bg-elevated);
    color: var(--text-secondary);
    border: 2px solid var(--border-subtle);
}

.btn-cancel-modern:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
    border-color: var(--border-color);
}

.btn-save-modern {
    background: linear-gradient(135deg, #8b5cf6, #7c3aed);
    color: white;
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3);
}

.btn-save-modern:hover {
    background: linear-gradient(135deg, #7c3aed, #6d28d9);
    box-shadow: 0 6px 16px rgba(139, 92, 246, 0.4);
    transform: translateY(-1px);
}

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

.modal-content {
    background: var(--bg-card);
    padding: 2rem;
    border-radius: var(--radius-lg);
    max-width: 400px;
    width: 100%;
    text-align: center;
    border: 1px solid var(--border-subtle);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.modal-icon {
    width: 60px;
    height: 60px;
    margin: 0 auto 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(239, 68, 68, 0.1);
    border-radius: 50%;
}

.modal-icon svg {
    width: 32px;
    height: 32px;
    stroke: #ef4444;
}

.modal-content h3 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 0.5rem 0;
}

.modal-content p {
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin: 0 0 1rem 0;
}

.modal-card-info {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.9rem;
    color: var(--text-primary);
    background: var(--bg-secondary);
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1.5rem;
}

.modal-actions {
    display: flex;
    gap: 1rem;
}

.btn-modal-cancel,
.btn-modal-delete {
    flex: 1;
    padding: 0.875rem 1rem;
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-normal);
}

.btn-modal-cancel {
    background: var(--bg-elevated);
    border: 2px solid var(--border-subtle);
    color: var(--text-secondary);
}

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

.btn-modal-delete {
    background: #ef4444;
    border: none;
    color: white;
}

.btn-modal-delete:hover:not(:disabled) {
    background: #dc2626;
}

.btn-modal-delete:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Disabled icon button (used when no XLS budget file is available) */
.btn-icon.btn-icon-disabled {
    opacity: 0.4;
    cursor: default;
    pointer-events: none;
}

/* Responsive */
@media (max-width: 992px) {
    .cards-content-wrapper {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
}

@media (max-width: 640px) {
    .cards-container {
        padding: 1.25rem 1rem;
    }

    .cards-header h1 {
        font-size: 1.5rem;
    }

    .cards-icon {
        width: 36px;
        height: 36px;
    }

    .card-preview {
        padding: 1.25rem;
    }

    .card-number-display {
        font-size: 0.95rem;
    }

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

    .form-actions {
        flex-direction: column;
    }

    .btn-cancel,
    .btn-submit {
        flex: none;
    }

    .card-item {
        flex-wrap: wrap;
    }

    .card-item-info {
        flex: 1 1 100%;
        order: 2;
    }

    .card-item-actions {
        order: 1;
        margin-left: auto;
    }
}

/* ==================== */
/* Card Statements */
/* ==================== */

.cardstatements-container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 1.25rem 1rem;
}

.cardstatements-header {
    text-align: center;
    margin-bottom: 1.25rem;
    position: relative;
}

.cardstatements-header::after {
    content: '';
    position: absolute;
    bottom: -0.75rem;
    left: 50%;
    transform: translateX(-50%);
    width: 100px;
    height: 3px;
    background: linear-gradient(135deg, #f97316 0%, #06b6d4 100%);
    border-radius: 3px;
}

.cardstatements-header h1 {
    font-size: 1.7rem;
    font-weight: 700;
    background: linear-gradient(135deg, #f97316 0%, #06b6d4 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 0.25rem;
}

.cardstatements-icon {
    width: 44px;
    height: 44px;
    stroke: #f97316;
}

.cardstatements-subtitle {
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-top: 0.25rem;
}

.cardstatements-toolbar {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
    align-items: stretch;
    background: var(--bg-card);
    padding: 1rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-subtle);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08), 0 1px 3px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.8) 0%, rgba(30, 41, 59, 0.8) 100%);
    position: relative;
    overflow: visible;
}

.cardstatements-toolbar::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, #f97316 0%, #06b6d4 50%, #ec4899 100%);
    opacity: 0.6;
}

.cardstatements-toolbar .search-box {
    width: 100%;
    min-width: 0;
    position: relative;
}

.cardstatements-toolbar .search-box svg {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    stroke: var(--text-muted);
    pointer-events: none;
    z-index: 1;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.cardstatements-toolbar .search-box input {
    width: 100%;
    padding: 0.6rem 0.9rem 0.6rem 2.4rem;
    background: rgba(15, 23, 42, 0.6);
    border: 1.5px solid var(--border-subtle);
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 0.85rem;
    color: var(--text-primary);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05), inset 0 1px 2px rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(10px);
    height: 38px;
    font-weight: 400;
}

.cardstatements-toolbar .search-box input::placeholder {
    color: var(--text-muted);
    font-weight: 400;
    transition: opacity 0.3s;
}

.cardstatements-toolbar .search-box:hover svg,
.cardstatements-toolbar .search-box input:focus ~ svg,
.cardstatements-toolbar .search-box:focus-within svg {
    stroke: #f97316;
    transform: translateY(-50%) scale(1.1);
}

.cardstatements-toolbar .search-box input:hover {
    border-color: rgba(249, 115, 22, 0.4);
    box-shadow: 0 4px 12px rgba(249, 115, 22, 0.1), inset 0 1px 2px rgba(255, 255, 255, 0.05);
    background: rgba(15, 23, 42, 0.8);
}

.cardstatements-toolbar .search-box input:focus {
    outline: none;
    border-color: #f97316;
    box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.15), 0 4px 20px rgba(249, 115, 22, 0.2), inset 0 1px 2px rgba(255, 255, 255, 0.1);
    background: rgba(15, 23, 42, 0.9);
    transform: translateY(-1px);
}

.cardstatements-toolbar .search-box input:focus::placeholder {
    opacity: 0.5;
}

.cardstatements-filters {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.filters-row {
    display: flex;
    gap: 0.75rem;
    width: 100%;
}

.filters-row-amount .filter-group {
    flex: 1 1 0;
}

.filters-row .filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    flex: 1 1 0;
    min-width: 0;
}

.filters-row.filters-row-dates .filter-group {
    max-width: 260px;
    flex: 1 1 0;
    flex-direction: row;
    align-items: center;
    gap: 0.6rem;
}

.filters-row .filter-full {
    flex: 1 1 auto;
}

.filters-row label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.filters-row-dates .form-input {
    flex: 1 1 auto;
    color: var(--text-muted);
}

/* For date inputs, force the text color to match placeholder style */
.filters-row-dates input[type="date"] {
    color: var(--text-muted) !important;
}

/* Make the date picker icon visible in both themes */
input[type="date"]::-webkit-calendar-picker-indicator {
    opacity: 0.9;
    cursor: pointer;
}
[data-theme="dark"] input[type="date"]::-webkit-calendar-picker-indicator {
    filter: invert(1) brightness(1.2);
}
[data-theme="light"] input[type="date"]::-webkit-calendar-picker-indicator {
    filter: none;
}

.filters-row .form-input {
    padding: 0.6rem 0.8rem;
    background: rgba(15, 23, 42, 0.6);
    border: 1.5px solid var(--border-subtle);
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 0.85rem;
    color: var(--text-primary);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05), inset 0 1px 2px rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(10px);
    height: 38px;
}

.filters-row .form-input::placeholder {
    color: var(--text-muted);
    font-weight: 400;
}

/* Selects (bancă / sens) */
.filters-row select.form-input {
    color: var(--text-primary);
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: none;
}

.filters-row select.form-input option {
    color: var(--text-primary);
}

.filters-row select.form-input option[value=""] {
    color: var(--text-muted);
}

/* Când select-ul se află pe „placeholder” (Toate băncile / Toate sensurile) */
.filters-row select.form-input.is-placeholder {
    color: var(--text-muted);
}

.filters-row .form-input:hover {
    border-color: rgba(6, 182, 212, 0.4);
    box-shadow: 0 4px 12px rgba(6, 182, 212, 0.1), inset 0 1px 2px rgba(255, 255, 255, 0.05);
    background: rgba(15, 23, 42, 0.8);
}

.filters-row .form-input:focus {
    outline: none;
    border-color: #06b6d4;
    box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.15), 0 4px 20px rgba(6, 182, 212, 0.2), inset 0 1px 2px rgba(255, 255, 255, 0.1);
    background: rgba(15, 23, 42, 0.9);
    transform: translateY(-1px);
}

.amount-range-inputs {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    gap: 0.5rem;
    align-items: center;
}

.amount-separator {
    color: var(--text-muted);
    font-size: 0.9rem;
    text-align: center;
}

.filters-error {
    margin-top: 0.35rem;
    font-size: 0.8rem;
    color: #f97373;
}


/* Light mode adjustments for toolbar and filters */
[data-theme="light"] .cardstatements-toolbar {
    background: var(--bg-card);
    box-shadow: var(--shadow-card);
}

[data-theme="light"] .cardstatements-toolbar .search-box input,
[data-theme="light"] .cardstatements-filters .form-input {
    background: #f9fafb;
    border-color: rgba(148, 163, 184, 0.6);
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
    color: var(--text-primary);
}

[data-theme="light"] .cardstatements-toolbar .search-box input:hover,
[data-theme="light"] .cardstatements-filters .form-input:hover {
    background: #ffffff;
    box-shadow: 0 4px 10px rgba(15, 23, 42, 0.06);
}

[data-theme="light"] .cardstatements-toolbar .search-box input:focus,
[data-theme="light"] .cardstatements-filters .form-input:focus {
    background: #ffffff;
}

[data-theme="light"] .filters-row .form-input::placeholder,
[data-theme="light"] .cardstatements-toolbar .search-box input::placeholder {
    color: rgba(15, 23, 42, 0.5);
}

[data-theme="light"] .date-filter input {
    background: #f9fafb;
    border-color: rgba(148, 163, 184, 0.6);
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
}

[data-theme="light"] .date-filter input:hover {
    background: #ffffff;
    box-shadow: 0 4px 10px rgba(15, 23, 42, 0.06);
}

[data-theme="light"] .date-filter input:focus {
    background: #ffffff;
}

.btn-apply-filters {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1rem;
    border-radius: var(--radius-md);
    border: none;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    color: #ffffff;
    background: linear-gradient(135deg, #f97316 0%, #ec4899 100%);
    box-shadow: 0 4px 16px rgba(249, 115, 22, 0.3), 0 2px 8px rgba(236, 72, 153, 0.2);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    height: 38px;
    position: relative;
    overflow: hidden;
}

.btn-apply-filters::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.btn-apply-filters:hover::before {
    left: 100%;
}

.btn-apply-filters svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
    flex-shrink: 0;
}

.btn-apply-filters:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(249, 115, 22, 0.4), 0 4px 12px rgba(236, 72, 153, 0.3);
    background: linear-gradient(135deg, #fb923c 0%, #f472b6 100%);
}

.btn-apply-filters:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(249, 115, 22, 0.3);
}

.btn-clear-filters {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    border: 1.5px solid var(--border-subtle);
    background: rgba(15, 23, 42, 0.6);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(10px);
    flex-shrink: 0;
}

/* Light mode style for clear-filters button */
[data-theme="light"] .btn-clear-filters {
    background: #f9fafb;
    border-color: rgba(148, 163, 184, 0.7);
    color: var(--text-secondary);
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
}

.btn-clear-filters svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
    transition: transform 0.3s;
}

.btn-clear-filters:hover {
    background: rgba(239, 68, 68, 0.15);
    border-color: #ef4444;
    color: #ef4444;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.2);
}

.btn-clear-filters:hover svg {
    transform: rotate(90deg);
}

.btn-clear-filters:active {
    transform: translateY(0);
}

[data-theme="light"] .btn-clear-filters:hover {
    background: rgba(239, 68, 68, 0.08);
    border-color: #ef4444;
    color: #ef4444;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.16);
}

/* Responsive styles for cardstatements toolbar */
@media (max-width: 768px) {
    .cardstatements-toolbar {
        padding: 1.25rem;
        gap: 1rem;
    }

    .cardstatements-toolbar .search-box {
        min-width: 100%;
        width: 100%;
    }

    .filters-row {
        flex-direction: column;
    }

    .btn-apply-filters {
        justify-content: center;
    }
}

@media (max-width: 640px) {
    .cardstatements-toolbar {
        padding: 1rem;
        gap: 0.875rem;
    }

    .cardstatements-toolbar .search-box input {
        font-size: 0.9rem;
        padding: 0.75rem 0.875rem 0.75rem 2.5rem;
        height: 42px;
    }

    .filters-row .form-input {
        height: 42px;
        font-size: 0.9rem;
    }

    .btn-apply-filters,
    .btn-clear-filters {
        height: 42px;
    }

    .btn-apply-filters {
        font-size: 0.8125rem;
        padding: 0.625rem 1rem;
    }
}

.cardstatements-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 0.6rem;
    margin-bottom: 1.25rem;
}

.btn-clear-filters-toolbar {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    border-radius: var(--radius-md);
    border: 1.5px solid var(--border-subtle);
    background: rgba(15, 23, 42, 0.8);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(10px);
    z-index: 10;
    padding: 0.5rem 0.75rem;
    font-size: 0.85rem;
    font-weight: 500;
    white-space: nowrap;
}

.btn-clear-filters-toolbar:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.5);
    color: #fca5a5;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.2);
}

.btn-clear-filters-toolbar:active {
    transform: translateY(0);
}

.btn-clear-filters-toolbar svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
}

[data-theme="light"] .btn-clear-filters-toolbar {
    background: rgba(249, 250, 251, 0.9);
    border-color: rgba(148, 163, 184, 0.7);
    color: var(--text-secondary);
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08);
}

[data-theme="light"] .btn-clear-filters-toolbar:hover {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.5);
    color: #dc2626;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.15);
}

.cardstatements-layout {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.cardstatements-panel {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-subtle);
    box-shadow: var(--shadow-card);
    display: flex;
    flex-direction: column;
    overflow: hidden; /* Asigură că headerele tabelelor nu ies din colțurile rotunjite */
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-subtle);
    background: var(--bg-secondary);
}

.panel-header h3 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.panel-header h3 svg {
    width: 18px;
    height: 18px;
    stroke: #ec4899;
}

.panel-body {
    padding: 1rem 1rem 1.1rem;
}

.panel-tag {
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    background: rgba(59, 130, 246, 0.1);
    color: #3b82f6;
}

.file-upload-area {
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: var(--transition-normal);
    background: var(--bg-secondary);
    margin-bottom: 1rem;
}

.file-upload-area:hover {
    border-color: #ec4899;
    background: rgba(236, 72, 153, 0.05);
}

.file-upload-area.dragover {
    border-color: #ec4899;
    background: rgba(236, 72, 153, 0.1);
    transform: scale(1.02);
}

.file-upload-content svg {
    width: 48px;
    height: 48px;
    color: #ec4899;
    margin-bottom: 1rem;
}

.file-upload-label {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0.5rem 0;
}

.file-upload-hint {
    font-size: 0.95rem;
    color: var(--text-muted);
    margin: 0;
}

.file-upload-area .btn-upload-file {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 1.1rem;
    margin-left: 0.35rem;
    border-radius: var(--radius-md);
    border: none;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 600;
    color: white;
    background: linear-gradient(135deg, #06b6d4 0%, #3b82f6 100%);
    box-shadow: 0 4px 16px rgba(6, 182, 212, 0.35);
    transition: var(--transition-normal);
    line-height: 1;
}

.file-upload-area .btn-upload-file svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
    margin-bottom: unset;
}

.file-upload-area .btn-upload-file:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 24px rgba(6, 182, 212, 0.45);
}

.upload-status {
    margin-top: 0.75rem;
    font-size: 0.9rem;
    border-radius: var(--radius-md);
    padding: 0.5rem 0.75rem;
}

.upload-status.success {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.upload-status.error {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.transactions-table-wrapper {
    max-height: 520px;
    overflow-y: auto;
}

.table-compact {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
}

.table-compact thead th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: var(--bg-secondary);
    padding: 0.5rem 0.6rem;
    font-weight: 600;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-subtle);
}

.table-compact thead th:first-child {
    border-top-left-radius: var(--radius-md);
}

.table-compact thead th:last-child {
    border-top-right-radius: var(--radius-md);
}

.table-compact tbody td {
    padding: 0.45rem 0.6rem;
    border-bottom: 1px solid rgba(148, 163, 184, 0.2);
    color: var(--text-primary);
}

.table-compact tbody tr:nth-child(even) {
    background: rgba(15, 23, 42, 0.4);
}

.table-compact .empty-row td {
    text-align: center;
    color: var(--text-muted);
    padding: 1.25rem 0.6rem;
}

.iban-cell {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    white-space: nowrap;
}

.details-cell {
    max-width: 260px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.amount-plus {
    color: #16a34a;
    font-weight: 600;
}

.amount-minus {
    color: #f97316;
    font-weight: 600;
}

.btn-view-tx {
    padding: 0.25rem 0.6rem;
    font-size: 0.9rem;
    border-radius: 999px;
    border: 1px solid var(--border-subtle);
    background: rgba(15, 23, 42, 0.8);
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition-normal);
}

.btn-view-tx:hover {
    background: rgba(59, 130, 246, 0.15);
    color: #bfdbfe;
    border-color: rgba(59, 130, 246, 0.7);
}

/* Light mode adjustments for table rows and buttons */
[data-theme="light"] .table-compact tbody tr:nth-child(even) {
    background: rgba(148, 163, 184, 0.06);
}

[data-theme="light"] .btn-view-tx {
    background: #f9fafb;
    color: var(--text-secondary);
}

[data-theme="light"] .btn-view-tx:hover {
    background: rgba(59, 130, 246, 0.08);
    color: #1d4ed8;
}

.bank-badge {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.bank-brd {
    background: rgba(249, 115, 22, 0.15);
    color: #f97316;
    border: 1px solid rgba(249, 115, 22, 0.3);
}

.bank-unicredit {
    background: rgba(6, 182, 212, 0.15);
    color: #06b6d4;
    border: 1px solid rgba(6, 182, 212, 0.3);
}

.tx-details-body {
    padding: 1.5rem 1.75rem 1.75rem;
}

.tx-details-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.25rem 1.5rem;
    margin-bottom: 1.5rem;
}

.tx-details-group h4 {
    font-size: 0.95rem;
    font-weight: 600;
    margin: 0 0 0.5rem;
    color: var(--text-primary);
}

.tx-details-group dl {
    margin: 0;
}

.tx-details-group dl > div {
    display: grid;
    grid-template-columns: minmax(0, 40%) minmax(0, 60%);
    gap: 0.3rem 0.75rem;
    font-size: 0.95rem;
    padding: 0.15rem 0;
}

.tx-details-group dt {
    color: var(--text-muted);
}

.tx-details-group dd {
    margin: 0;
    color: var(--text-primary);
    word-break: break-word;
}

.tx-details-notes {
    margin-bottom: 1rem;
}

.tx-details-notes h4 {
    font-size: 0.95rem;
    font-weight: 600;
    margin: 0 0 0.4rem;
}

.tx-details-notes p {
    margin: 0;
    font-size: 0.95rem;
    color: var(--text-secondary);
    white-space: pre-wrap;
}

.tx-details-meta {
    font-size: 0.9rem;
    color: var(--text-muted);
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.tx-rawline {
    margin: 0;
    padding: 0.5rem 0.75rem;
    background: rgba(15, 23, 42, 0.9);
    color: #e5e7eb;
    border-radius: var(--radius-md);
    font-size: 0.75rem;
    max-height: 140px;
    overflow: auto;
}

/* ==================== */
/* ==================== */
/* Persons Management */
/* ==================== */

.persons-container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

.persons-header {
    text-align: center;
    margin-bottom: 2rem;
    position: relative;
}

.persons-header::after {
    content: '';
    position: absolute;
    bottom: -0.75rem;
    left: 50%;
    transform: translateX(-50%);
    width: 100px;
    height: 3px;
    background: linear-gradient(135deg, #10b981 0%, #06b6d4 100%);
    border-radius: 3px;
}

.persons-header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, #10b981 0%, #06b6d4 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
    letter-spacing: -0.02em;
}

.persons-icon {
    width: 48px;
    height: 48px;
    stroke: #10b981;
    filter: drop-shadow(0 0 10px rgba(16, 185, 129, 0.5));
    -webkit-text-fill-color: initial;
}

.persons-subtitle {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin: 0;
    font-weight: 400;
}

/* Toolbar */
.persons-toolbar {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.search-box {
    flex: 1;
    min-width: 200px;
    position: relative;
    display: flex;
    align-items: center;
}

.search-box > svg {
    position: absolute;
    left: 1rem;
    width: 20px;
    height: 20px;
    stroke: var(--text-muted);
    pointer-events: none;
}

.search-box input {
    width: 100%;
    padding: 0.875rem 1rem 0.875rem 3rem;
    background: var(--bg-card);
    border: 2px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    font-family: inherit;
    font-size: 0.95rem;
    color: var(--text-primary);
    transition: var(--transition-normal);
}

.search-box input::placeholder {
    color: var(--text-muted);
}

.search-box input:focus {
    outline: none;
    border-color: #10b981;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}

.btn-clear-search {
    position: absolute;
    right: 0.75rem;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-elevated);
    border: none;
    border-radius: 50%;
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition-fast);
}

.btn-clear-search:hover {
    background: var(--text-muted);
    color: var(--bg-primary);
}

.btn-clear-search svg {
    width: 14px;
    height: 14px;
}

.btn-add-person {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.875rem 1.5rem;
    background: linear-gradient(135deg, #10b981 0%, #06b6d4 100%);
    border: none;
    border-radius: var(--radius-lg);
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 600;
    color: white;
    cursor: pointer;
    transition: var(--transition-normal);
    box-shadow: 0 4px 20px rgba(16, 185, 129, 0.3);
    white-space: nowrap;
}

.btn-add-person:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(16, 185, 129, 0.4);
}

.btn-add-person svg {
    width: 20px;
    height: 20px;
}

.btn-import-excel {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.875rem 1.5rem;
    background: linear-gradient(135deg, var(--accent-purple) 0%, #ec4899 100%);
    border: none;
    border-radius: var(--radius-lg);
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 600;
    color: white;
    cursor: pointer;
    transition: var(--transition-normal);
    box-shadow: 0 4px 20px rgba(168, 85, 247, 0.3);
    white-space: nowrap;
}

.btn-import-excel:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(168, 85, 247, 0.4);
}

.btn-import-excel svg {
    width: 20px;
    height: 20px;
}

.btn-bulk-delete {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.875rem 1.5rem;
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    border: none;
    border-radius: var(--radius-lg);
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 600;
    color: white;
    cursor: pointer;
    transition: var(--transition-normal);
    box-shadow: 0 4px 20px rgba(239, 68, 68, 0.3);
    white-space: nowrap;
}

.btn-bulk-delete:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(239, 68, 68, 0.4);
}

.btn-bulk-delete svg {
    width: 20px;
    height: 20px;
}

.btn-delete-multiple {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.875rem 1.5rem;
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    border: none;
    border-radius: var(--radius-lg);
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 600;
    color: white;
    cursor: pointer;
    transition: var(--transition-normal);
    box-shadow: 0 4px 20px rgba(239, 68, 68, 0.3);
    white-space: nowrap;
}

.btn-delete-multiple:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(239, 68, 68, 0.4);
}

.btn-delete-multiple svg {
    width: 20px;
    height: 20px;
}

.btn-clear-selection {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.875rem 1.5rem;
    background: var(--bg-secondary);
    border: 2px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    cursor: pointer;
    transition: var(--transition-normal);
    white-space: nowrap;
}

.btn-clear-selection:hover {
    background: var(--bg-card);
    border-color: var(--accent-purple);
    color: var(--accent-purple);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(168, 85, 247, 0.2);
}

.btn-clear-selection svg {
    width: 20px;
    height: 20px;
}

/* Import Excel Modal */
.import-instructions {
    background: rgba(59, 130, 246, 0.1);
    border-left: 3px solid #3b82f6;
    padding: 1rem;
    margin-bottom: 1.5rem;
    border-radius: var(--radius-md);
}

.instruction-item {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

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

.instruction-item svg {
    width: 20px;
    height: 20px;
    color: #3b82f6;
    flex-shrink: 0;
    margin-top: 0.2rem;
}

.instruction-item p {
    margin: 0;
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.file-upload-area {
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-lg);
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: var(--transition-normal);
    background: var(--bg-secondary);
    margin-bottom: 1.5rem;
}

.file-upload-area:hover {
    border-color: var(--accent-purple);
    background: rgba(168, 85, 247, 0.05);
}

.file-upload-area.dragover {
    border-color: var(--accent-purple);
    background: rgba(168, 85, 247, 0.1);
    transform: scale(1.02);
}

.file-upload-content svg {
    width: 48px;
    height: 48px;
    color: var(--accent-purple);
    margin-bottom: 1rem;
}

.file-upload-label {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0.5rem 0;
}

.file-upload-hint {
    font-size: 0.95rem;
    color: var(--text-muted);
    margin: 0;
}

.file-name {
    margin-top: 1rem;
    padding: 0.5rem 1rem;
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
    border-radius: var(--radius-md);
    font-weight: 600;
    display: inline-block;
}

.import-preview {
    margin-bottom: 1.5rem;
}

.import-preview h4 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.import-preview h4 svg {
    width: 20px;
    height: 20px;
    color: var(--accent-purple);
}

.preview-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-box {
    background: var(--bg-secondary);
    padding: 1rem;
    border-radius: var(--radius-md);
    text-align: center;
    border: 1px solid var(--border-color);
}

.stat-number {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent-purple);
    margin-bottom: 0.25rem;
}

.stat-text {
    display: block;
    font-size: 0.9rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.preview-list {
    max-height: 250px;
    overflow-y: auto;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 0.5rem;
}

.preview-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
}

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

.preview-item.duplicate {
    opacity: 0.5;
    background: var(--bg-secondary);
}

.preview-item .icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.preview-item .icon.new {
    color: #10b981;
}

.preview-item .icon.duplicate {
    color: #ef4444;
}

.preview-item .name {
    font-weight: 600;
    color: var(--text-primary);
    flex: 1;
}

.preview-item .detail {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Person Preview Modal */
.preview-person-content {
    padding: 0;
}

.preview-person-header {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: 2rem;
    background: linear-gradient(135deg, rgba(168, 85, 247, 0.1) 0%, rgba(59, 130, 246, 0.1) 100%);
    border-bottom: 1px solid var(--border-color);
}

.preview-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-purple) 0%, #3b82f6 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 700;
    color: white;
    flex-shrink: 0;
    box-shadow: 0 4px 20px rgba(168, 85, 247, 0.3);
}

.preview-header-info h2 {
    margin: 0;
    font-size: 1.5rem;
    color: var(--text-primary);
    font-weight: 700;
}

.preview-id {
    margin: 0.5rem 0 0 0;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.9rem;
    color: var(--text-muted);
    background: var(--bg-secondary);
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-sm);
    display: inline-block;
}

.preview-person-details {
    padding: 2rem;
    display: grid;
    gap: 1.5rem;
}

.preview-detail-group {
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 1rem;
    align-items: start;
    padding: 1rem;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    transition: var(--transition-normal);
}

.preview-detail-group:hover {
    border-color: var(--accent-purple);
    background: rgba(168, 85, 247, 0.05);
}

.preview-detail-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.preview-detail-label svg {
    width: 18px;
    height: 18px;
    color: var(--accent-purple);
}

.preview-detail-value {
    font-size: 0.9rem;
    color: var(--text-primary);
    word-break: break-word;
}

.preview-detail-value:empty::before {
    content: '—';
    color: var(--text-muted);
}

.preview-actions {
    display: flex;
    gap: 1rem;
    padding: 1.5rem 2rem;
    border-top: 1px solid var(--border-color);
    background: var(--bg-secondary);
}

.btn-preview-edit,
.btn-preview-delete {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.875rem 1.5rem;
    border: none;
    border-radius: var(--radius-lg);
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-normal);
}

.btn-preview-edit {
    background: linear-gradient(135deg, #10b981 0%, #06b6d4 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}

.btn-preview-edit:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(16, 185, 129, 0.4);
}

.btn-preview-edit svg,
.btn-preview-delete svg {
    width: 18px;
    height: 18px;
}

.btn-preview-delete {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.3);
}

.btn-preview-delete:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(239, 68, 68, 0.4);
}

/* Responsive */
@media (max-width: 768px) {
    .preview-person-header {
        flex-direction: column;
        text-align: center;
        padding: 1.5rem;
    }

    .preview-avatar {
        width: 60px;
        height: 60px;
        font-size: 1.5rem;
    }

    .preview-header-info h2 {
        font-size: 1.5rem;
    }

    .preview-detail-group {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }

    .preview-person-details {
        padding: 1rem;
    }

    .preview-actions {
        flex-direction: column;
    }
}

/* Stats */
.persons-stats {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-item {
    background: var(--bg-card);
    padding: 1rem 1.5rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #10b981;
}

.stat-label {
    font-size: 0.9rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Persons List */
.persons-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.empty-state,
.loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 2px dashed var(--border-subtle);
    text-align: center;
}

.empty-state svg,
.loading-state svg {
    width: 80px;
    height: 80px;
    stroke: var(--text-muted);
    opacity: 0.4;
    margin-bottom: 1rem;
}

.empty-state p,
.loading-state p {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin: 0 0 0.25rem 0;
}

.empty-state span {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.spinner-large {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-subtle);
    border-top-color: #10b981;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 1rem;
}

/* Person Card */
.person-card {
    position: relative;
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-subtle);
    transition: var(--transition-normal);
}

.person-checkbox-container {
    position: absolute;
    top: 1rem;
    left: 1rem;
    z-index: 10;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.person-checkbox-container input[type="checkbox"] {
    width: 24px;
    height: 24px;
    cursor: pointer;
    margin: 0;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background: var(--bg-card);
    border: 2px solid var(--border-subtle);
    border-radius: 6px;
    position: relative;
    transition: all var(--transition-normal);
    flex-shrink: 0;
}

.person-checkbox-container input[type="checkbox"]:hover {
    border-color: var(--accent-purple);
    background: var(--bg-card-hover);
    box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.1);
}

.person-checkbox-container input[type="checkbox"]:checked {
    background: var(--accent-purple);
    border-color: var(--accent-purple);
    box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.2);
}

.person-checkbox-container input[type="checkbox"]:checked::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%) rotate(45deg);
    width: 6px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
}

.person-card:hover .person-checkbox-container input[type="checkbox"] {
    border-color: var(--accent-purple);
}

.custom-checkbox {
    width: 20px;
    height: 20px;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background: var(--bg-card);
    border: 2px solid var(--border-subtle);
    border-radius: 5px;
    position: relative;
    transition: all var(--transition-normal);
    flex-shrink: 0;
}

.custom-checkbox:hover {
    border-color: var(--accent-purple);
    background: var(--bg-card-hover);
    box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.1);
}

.custom-checkbox:checked {
    background: var(--accent-purple);
    border-color: var(--accent-purple);
    box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.2);
}

.custom-checkbox:checked::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%) rotate(45deg);
    width: 5px;
    height: 9px;
    border: solid white;
    border-width: 0 2px 2px 0;
}

.custom-checkbox:indeterminate {
    background: var(--accent-purple);
    border-color: var(--accent-purple);
}

.custom-checkbox:indeterminate::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 10px;
    height: 2px;
    background: white;
    border-radius: 1px;
}

.person-card:hover {
    border-color: #10b981;
    box-shadow: 0 4px 20px rgba(16, 185, 129, 0.1);
}

.person-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    font-weight: 700;
    color: white;
    flex-shrink: 0;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

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

.person-name {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.375rem;
}

.person-details {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.detail-item {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.95rem;
    color: var(--text-secondary);
}

.detail-item svg {
    width: 14px;
    height: 14px;
    stroke: var(--text-muted);
    flex-shrink: 0;
}

.person-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.meta-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.25rem 0.625rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

.meta-badge svg {
    width: 12px;
    height: 12px;
}

.meta-department {
    background: rgba(168, 85, 247, 0.15);
    color: var(--accent-purple);
    font-weight: 600;
}

.meta-department svg {
    stroke: var(--accent-purple);
}

.meta-firma {
    background: rgba(99, 102, 241, 0.15);
    color: #818cf8;
}

.meta-firma svg {
    stroke: #818cf8;
}

.meta-buget {
    background: rgba(245, 158, 11, 0.15);
    color: #fbbf24;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.9rem;
    padding: 0.25rem 0.75rem;
}

.person-actions {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
}

.btn-action-edit,
.btn-action-delete {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition-fast);
}

.btn-action-edit svg,
.btn-action-delete svg {
    width: 18px;
    height: 18px;
}

.btn-action-edit:hover {
    background: #10b981;
    border-color: #10b981;
    color: white;
}

.btn-action-delete:hover {
    background: #ef4444;
    border-color: #ef4444;
    color: white;
}

/* Modal Large */
.modal-large {
    max-width: 500px;
    text-align: left;
}

/* Modal Full Width */
.modal-fullwidth {
    max-width: 95vw;
    width: 95vw;
    text-align: left;
    padding: 1.5rem;
    max-height: 95vh;
    display: flex;
    flex-direction: column;
}

.modal-fullwidth .modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 0;
    margin-top: 1rem;
}

.modal-fullwidth .modal-header {
    flex-shrink: 0;
    margin-bottom: 1rem;
}

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

.modal-header h3 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.5rem;
    margin: 0;
}

.modal-header h3 svg {
    width: 24px;
    height: 24px;
    stroke: #10b981;
}

.modal-header-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-reset-analysis-header {
    padding: 0.35rem 0.65rem;
    font-size: 0.8rem;
    white-space: nowrap;
}

.btn-close-modal {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition-fast);
}

.btn-close-modal:hover {
    background: rgba(239, 68, 68, 0.1);
    border-color: #ef4444;
    color: #ef4444;
}

.btn-close-modal svg {
    width: 18px;
    height: 18px;
}

.btn-edit-preview-modal {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition-fast);
}

.btn-edit-preview-modal:hover {
    background: rgba(16, 185, 129, 0.1);
    border-color: #10b981;
    color: #10b981;
}

.btn-edit-preview-modal svg {
    width: 18px;
    height: 18px;
}

.btn-edit-preview-modal.active-edit {
    background: rgba(16, 185, 129, 0.15);
    border-color: #10b981;
    color: #10b981;
}

/* Bon Preview Edit Form */
.bon-edit-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.bon-edit-section {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.bon-edit-section h3 {
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    margin: 0 0 0.25rem 0;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-subtle);
}

.bon-edit-grid {
    display: grid;
    /* minmax(0,1fr) prevents grid children from overflowing and visually clipping into the gap */
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 0.75rem;
}

.bon-edit-field {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    min-width: 0; /* critical for preventing overflow in CSS grid */
}

.bon-edit-field label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.bon-edit-field input,
.bon-edit-field select {
    background: var(--bg-input, var(--bg-secondary));
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    padding: 0.45rem 0.65rem;
    font-size: 0.9rem;
    transition: var(--transition-fast);
    width: 100%;
}

.bon-edit-field input:focus,
.bon-edit-field select:focus {
    outline: none;
    border-color: #10b981;
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.15);
}

.bon-edit-lines-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}

.bon-edit-lines-table th {
    text-align: left;
    padding: 0.5rem 0.6rem;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-subtle);
}

.bon-edit-lines-table td {
    padding: 0.35rem 0.4rem;
    vertical-align: middle;
}

.bon-edit-lines-table td input {
    background: var(--bg-input, var(--bg-secondary));
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    padding: 0.35rem 0.5rem;
    font-size: 0.85rem;
    width: 100%;
    min-width: 60px;
}

/* Remove number input spinners (manual input only) */
.bon-edit-form input[type="number"]::-webkit-outer-spin-button,
.bon-edit-form input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
.bon-edit-form input[type="number"] {
    -moz-appearance: textfield; /* Firefox */
    appearance: textfield;
}

.bon-edit-lines-table td input:focus {
    outline: none;
    border-color: #10b981;
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.12);
}

.bon-edit-lines-table tr:hover td {
    background: rgba(255,255,255,0.02);
}

.btn-delete-line {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition-fast);
    flex-shrink: 0;
}

.btn-delete-line:hover {
    background: rgba(239, 68, 68, 0.1);
    border-color: #ef4444;
    color: #ef4444;
}

.btn-delete-line svg {
    width: 14px;
    height: 14px;
}

.btn-add-line {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    background: transparent;
    border: 1px dashed var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.45rem 0.9rem;
    font-size: 0.85rem;
    transition: var(--transition-fast);
    margin-top: 0.5rem;
}

.btn-add-line:hover {
    border-color: #10b981;
    color: #10b981;
    background: rgba(16, 185, 129, 0.05);
}

.btn-add-line svg {
    width: 15px;
    height: 15px;
}

.bon-edit-footer {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
    padding-top: 1rem;
    border-top: 1px solid var(--border-subtle);
    margin-top: 0.5rem;
}

.btn-save-bon-edit {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    background: #10b981;
    border: none;
    border-radius: var(--radius-sm);
    color: #fff;
    cursor: pointer;
    padding: 0.55rem 1.2rem;
    font-size: 0.9rem;
    font-weight: 600;
    transition: var(--transition-fast);
}

.btn-save-bon-edit:hover {
    background: #059669;
}

.btn-save-bon-edit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-cancel-bon-edit {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    background: transparent;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.55rem 1.2rem;
    font-size: 0.9rem;
    font-weight: 600;
    transition: var(--transition-fast);
}

.btn-cancel-bon-edit:hover {
    border-color: var(--text-secondary);
    color: var(--text-primary);
}

/* Person Form */
.person-form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.person-form .form-group label svg {
    stroke: #10b981;
}

.person-form .form-input:focus {
    border-color: #10b981;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}

.person-form .btn-submit {
    background: linear-gradient(135deg, #10b981 0%, #06b6d4 100%);
    box-shadow: 0 4px 20px rgba(16, 185, 129, 0.3);
}

.person-form .btn-submit:hover:not(:disabled) {
    box-shadow: 0 8px 30px rgba(16, 185, 129, 0.4);
}

.modal-person-info {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    background: var(--bg-secondary);
    padding: 0.875rem 1.25rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1.5rem;
}

.modal-icon-danger {
    background: rgba(239, 68, 68, 0.1);
}

.modal-icon-danger svg {
    stroke: #ef4444;
}

/* Responsive */
@media (max-width: 640px) {
    .persons-container {
        padding: 1.25rem 1rem;
    }

    .persons-header h1 {
        font-size: 1.5rem;
    }

    .persons-icon {
        width: 36px;
        height: 36px;
    }

    .persons-toolbar {
        flex-direction: column;
    }

    .btn-add-person {
        width: 100%;
        justify-content: center;
    }

    .person-card {
        flex-wrap: wrap;
    }

    .person-avatar {
        width: 45px;
        height: 45px;
        font-size: 0.9rem;
    }

    .person-info {
        flex: 1 1 calc(100% - 110px);
    }

    .person-actions {
        margin-left: auto;
    }

    .person-details {
        flex-direction: column;
        gap: 0.375rem;
    }

    .modal-large {
        margin: 1rem;
        max-height: calc(100vh - 2rem);
        overflow-y: auto;
    }
}

/* ==================== */
/* Projects Management */
/* ==================== */

.projects-container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

.projects-header {
    text-align: center;
    margin-bottom: 2rem;
    position: relative;
}

.projects-header::after {
    content: '';
    position: absolute;
    bottom: -0.75rem;
    left: 50%;
    transform: translateX(-50%);
    width: 100px;
    height: 3px;
    background: linear-gradient(135deg, #8b5cf6 0%, #6366f1 100%);
    border-radius: 3px;
}

.projects-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, #8b5cf6 0%, #6366f1 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
    letter-spacing: -0.02em;
}

.projects-icon {
    width: 48px;
    height: 48px;
    stroke: #8b5cf6;
    filter: drop-shadow(0 0 10px rgba(139, 92, 246, 0.5));
    -webkit-text-fill-color: initial;
}

.projects-subtitle {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin: 0;
    font-weight: 400;
}

/* Stats Cards */
.projects-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: var(--bg-card);
    padding: 1rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    gap: 0.875rem;
    transition: var(--transition-normal);
}

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

.stat-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

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

.stat-content {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
}

.stat-card .stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1;
}

.stat-card .stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

/* Stat card colors */
.stat-total .stat-icon {
    background: rgba(139, 92, 246, 0.15);
}
.stat-total .stat-icon svg {
    stroke: white;
}
.stat-total .stat-value {
    color: #8b5cf6;
}

.stat-active .stat-icon {
    background: rgba(16, 185, 129, 0.15);
}
.stat-active .stat-icon svg {
    stroke: #10b981;
}
.stat-active .stat-value {
    color: #10b981;
}

.stat-planned .stat-icon {
    background: rgba(6, 182, 212, 0.15);
}
.stat-planned .stat-icon svg {
    stroke: #06b6d4;
}
.stat-planned .stat-value {
    color: #06b6d4;
}

.stat-completed .stat-icon {
    background: rgba(34, 197, 94, 0.15);
}
.stat-completed .stat-icon svg {
    stroke: #22c55e;
}
.stat-completed .stat-value {
    color: #22c55e;
}

/* Projects Toolbar */
.projects-toolbar {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.projects-toolbar .search-box {
    flex: 1;
    min-width: 200px;
}

.filter-group {
    display: flex;
    gap: 0.5rem;
}

.status-filter {
    padding: 0.875rem 1rem;
    background: var(--bg-card);
    border: 2px solid var(--border-subtle);
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 0.95rem;
    color: var(--text-primary);
    cursor: pointer;
    transition: var(--transition-normal);
    min-width: 160px;
}

.status-filter:focus {
    outline: none;
    border-color: #8b5cf6;
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.15);
}

.status-filter option {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.btn-add-project {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.875rem 1.5rem;
    background: linear-gradient(135deg, #8b5cf6 0%, #6366f1 100%);
    border: none;
    border-radius: var(--radius-lg);
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 600;
    color: white;
    cursor: pointer;
    transition: var(--transition-normal);
    box-shadow: 0 4px 20px rgba(139, 92, 246, 0.3);
    white-space: nowrap;
}

.btn-add-project:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(139, 92, 246, 0.4);
}

.btn-add-project svg {
    width: 20px;
    height: 20px;
}

/* Projects List */
.projects-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Project Card */
.project-card {
    background: var(--bg-card);
    padding: 1.25rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-subtle);
    transition: var(--transition-normal);
}

.project-card:hover {
    border-color: #8b5cf6;
    box-shadow: 0 4px 20px rgba(139, 92, 246, 0.1);
}

.project-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.project-title-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    flex: 1;
}

.project-name {
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.project-status {
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.status-active {
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
}

.status-planned {
    background: rgba(6, 182, 212, 0.15);
    color: #06b6d4;
}

.status-completed {
    background: rgba(34, 197, 94, 0.15);
    color: #22c55e;
}

.project-actions {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
}

.project-dates {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    margin-bottom: 1rem;
}

.date-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
}

.date-item svg {
    width: 16px;
    height: 16px;
    stroke: var(--text-muted);
}

.date-label {
    color: var(--text-muted);
}

.date-value {
    color: var(--text-primary);
    font-weight: 500;
}

.date-value.no-date {
    color: var(--text-muted);
    font-style: italic;
}

/* Progress Bar */
.project-progress {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.progress-bar {
    flex: 1;
    height: 8px;
    background: var(--bg-secondary);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #8b5cf6 0%, #6366f1 100%);
    border-radius: 4px;
    transition: width 0.5s ease;
}

.progress-text {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.95rem;
    font-weight: 600;
    color: #8b5cf6;
    min-width: 45px;
    text-align: right;
}

.project-duration {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.project-duration svg {
    width: 16px;
    height: 16px;
    stroke: var(--text-muted);
}

/* Project Form */
.project-form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.project-form .form-group label svg {
    stroke: #8b5cf6;
}

.project-form .form-input:focus {
    border-color: #8b5cf6;
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.15);
}

.project-form .btn-submit {
    background: linear-gradient(135deg, #8b5cf6 0%, #6366f1 100%);
    box-shadow: 0 4px 20px rgba(139, 92, 246, 0.3);
}

.project-form .btn-submit:hover:not(:disabled) {
    box-shadow: 0 8px 30px rgba(139, 92, 246, 0.4);
}

.project-form .modal-header h3 svg {
    stroke: #8b5cf6;
}

.label-hint {
    font-weight: 400;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.form-hint {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: rgba(139, 92, 246, 0.1);
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    color: var(--text-secondary);
}

.form-hint svg {
    width: 18px;
    height: 18px;
    stroke: #8b5cf6;
    flex-shrink: 0;
}

.modal-project-info {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    background: var(--bg-secondary);
    padding: 0.875rem 1.25rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1.5rem;
}

/* Responsive */
@media (max-width: 768px) {
    .projects-stats {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 640px) {
    .projects-container {
        padding: 1.25rem 1rem;
    }

    .projects-header h1 {
        font-size: 1.5rem;
    }

    .projects-icon {
        width: 36px;
        height: 36px;
    }

    .projects-stats {
        grid-template-columns: 1fr 1fr;
        gap: 0.75rem;
    }

    .stat-card {
        padding: 0.875rem;
    }

    .stat-icon {
        width: 38px;
        height: 38px;
    }

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

    .stat-card .stat-value {
        font-size: 1.5rem;
    }

    .projects-toolbar {
        flex-direction: column;
    }

    .filter-group {
        width: 100%;
    }

    .status-filter {
        flex: 1;
    }

    .btn-add-project {
        width: 100%;
        justify-content: center;
    }

    .project-header {
        flex-direction: column;
        gap: 0.75rem;
    }

    .project-actions {
        width: 100%;
        justify-content: flex-end;
    }

    .project-dates {
        flex-direction: column;
        gap: 0.5rem;
    }
}

/* ==================== */
/* Budgets Management */
/* ==================== */

.budgets-container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

.budgets-header {
    text-align: center;
    margin-bottom: 2rem;
    position: relative;
}

.budgets-header::after {
    content: '';
    position: absolute;
    bottom: -0.75rem;
    left: 50%;
    transform: translateX(-50%);
    width: 100px;
    height: 3px;
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    border-radius: 3px;
}

.budgets-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
    letter-spacing: -0.02em;
}

.budgets-icon {
    width: 48px;
    height: 48px;
    stroke: #f59e0b;
    filter: drop-shadow(0 0 10px rgba(245, 158, 11, 0.5));
    -webkit-text-fill-color: initial;
}

.budgets-subtitle {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin: 0;
    font-weight: 400;
}

/* Two-Panel Layout */
.budgets-layout {
    display: grid;
    grid-template-columns: 1fr 1.2fr;
    gap: 1.5rem;
    min-height: 500px;
}

/* Single-column variant used when right panel is intentionally hidden */
.budgets-layout.budgets-layout-single {
    grid-template-columns: 1fr;
}

.budgets-panel,
.lines-panel {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-subtle);
    background: var(--bg-secondary);
}

.panel-header h3 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.panel-header h3 svg {
    width: 18px;
    height: 18px;
    stroke: #f59e0b;
}

.panel-actions {
    display: flex;
    gap: 0.5rem;
}

.btn-add-budget,
.btn-import {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    border: none;
    border-radius: var(--radius-sm);
    color: white;
    cursor: pointer;
    transition: var(--transition-normal);
}

.btn-add-budget:hover,
.btn-import:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(245, 158, 11, 0.3);
}

.btn-add-budget svg,
.btn-import svg {
    width: 18px;
    height: 18px;
}

.btn-import {
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
}

.btn-import:hover {
    background: #10b981;
    border-color: #10b981;
    color: white;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}

/* Budgets List */
.budgets-list {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.budget-card {
    display: flex;
    align-items: center;
    padding: 1rem;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    border: 2px solid transparent;
    cursor: pointer;
    transition: var(--transition-normal);
}

.budget-card:hover {
    background: var(--bg-elevated);
    border-color: var(--border-subtle);
}

.budget-card.active {
    background: rgba(245, 158, 11, 0.1);
    border-color: #f59e0b;
}

.budget-card-header {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    flex: 1;
    min-width: 0;
}

.budget-icon {
    width: 42px;
    height: 42px;
    background: rgba(245, 158, 11, 0.15);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.budget-icon svg {
    width: 22px;
    height: 22px;
    stroke: #f59e0b;
}

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

.budget-info .budget-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 0.25rem 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.budget-curs-euro-group {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    flex-shrink: 0;
    align-self: center;
    margin-right: 0.35rem;
    padding-right: 0.65rem;
    border-right: 1px solid rgba(148, 163, 184, 0.18);
}

.budget-curs-euro-label {
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: 500;
    white-space: nowrap;
}

.budget-curs-euro-input {
    width: 6.75rem;
    max-width: 28vw;
    padding: 0.28rem 0.5rem !important;
    font-size: 0.82rem !important;
    height: 2rem;
    box-sizing: border-box;
}

.budget-curs-euro-save {
    appearance: none;
    padding: 0.38rem 0.95rem;
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    border-radius: 999px;
    border: 1px solid rgba(16, 185, 129, 0.55);
    background: linear-gradient(180deg, rgba(16, 185, 129, 0.22), rgba(16, 185, 129, 0.1));
    color: #6ee7b7;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.06) inset;
}

.budget-curs-euro-save:hover {
    background: linear-gradient(180deg, rgba(16, 185, 129, 0.35), rgba(16, 185, 129, 0.18));
    border-color: rgba(52, 211, 153, 0.85);
    color: #a7f3d0;
    box-shadow: 0 0 0 1px rgba(16, 185, 129, 0.2), 0 4px 12px rgba(16, 185, 129, 0.15);
}

.budget-curs-euro-save:active {
    transform: translateY(1px);
}

.budget-meta {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.date-created {
    color: var(--text-muted);
}

.budget-card-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.375rem 0.5rem;
    margin-left: 0.5rem;
}

.budget-file-status {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.38rem 0.8rem;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.9);
    border: 1px solid rgba(148, 163, 184, 0.12);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
    font-size: 0.82rem;
    font-weight: 700;
    white-space: nowrap;
    margin-right: 0.375rem;
    letter-spacing: 0.01em;
}

.budget-file-status-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1rem;
    height: 1rem;
    font-size: 0.9rem;
    line-height: 1;
}

.budget-file-status.is-uploaded {
    color: #10b981;
}

.budget-file-status.is-missing {
    color: #f87171;
}

.budget-file-status.is-uploaded .budget-file-status-icon {
    color: #34d399;
}

.budget-file-status.is-missing .budget-file-status-icon {
    color: #fb7185;
}

.btn-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition-fast);
}

.btn-icon svg {
    width: 16px;
    height: 16px;
}

.btn-icon.btn-select:hover {
    background: #f59e0b;
    color: white;
}

.btn-icon.btn-delete:hover {
    background: #ef4444;
    color: white;
}

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

/* Lines Panel */
.lines-panel {
    position: relative;
}

.panel-placeholder {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    text-align: center;
}

.panel-placeholder svg {
    width: 80px;
    height: 80px;
    stroke: var(--text-muted);
    opacity: 0.3;
    margin-bottom: 1rem;
}

.panel-placeholder p {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin: 0 0 0.25rem 0;
}

.panel-placeholder span {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.lines-content {
    display: flex;
    flex-direction: column;
    flex: 1;
}

.lines-header-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex: 1;
}

.selected-budget-name {
    font-size: 0.95rem;
    color: #f59e0b;
    padding: 0.25rem 0.75rem;
    background: rgba(245, 158, 11, 0.1);
    border-radius: var(--radius-sm);
}

.btn-add-line {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.5rem 1rem;
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    border: none;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 600;
    color: white;
    cursor: pointer;
    transition: var(--transition-normal);
}

.btn-add-line:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(245, 158, 11, 0.3);
}

.btn-add-line svg {
    width: 16px;
    height: 16px;
}

/* Lines List */
.lines-list {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.line-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.875rem 1rem;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
    transition: var(--transition-normal);
}

.line-card:hover {
    border-color: #f59e0b;
    background: rgba(245, 158, 11, 0.05);
}

.line-letter {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
    border-radius: var(--radius-sm);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.95rem;
    font-weight: 700;
    flex-shrink: 0;
}

.line-name {
    flex: 1;
    font-size: 0.95rem;
    color: var(--text-primary);
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.line-actions {
    display: flex;
    gap: 0.375rem;
}

/* Import Modal */
.modal-medium {
    max-width: 600px;
    text-align: left;
}

.import-content {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.import-dropzone {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2.5rem 2rem;
    background: var(--bg-secondary);
    border: 2px dashed var(--border-subtle);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition-normal);
    text-align: center;
}

.import-dropzone:hover,
.import-dropzone.dragover {
    border-color: #10b981;
    background: rgba(16, 185, 129, 0.05);
}

.import-dropzone svg {
    width: 48px;
    height: 48px;
    stroke: var(--text-muted);
    margin-bottom: 1rem;
    transition: var(--transition-fast);
}

.import-dropzone:hover svg,
.import-dropzone.dragover svg {
    stroke: #10b981;
}

.import-dropzone p {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin: 0 0 0.5rem 0;
}

.import-dropzone span {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.import-preview {
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.import-preview h4 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
    padding: 0.875rem 1rem;
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border-subtle);
}

.import-preview h4 svg {
    width: 16px;
    height: 16px;
    stroke: #10b981;
}

.preview-table-container {
    max-height: 200px;
    overflow-y: auto;
}

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

.preview-table th {
    padding: 0.625rem 1rem;
    text-align: left;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    background: var(--bg-elevated);
    position: sticky;
    top: 0;
}

.preview-table td {
    padding: 0.625rem 1rem;
    font-size: 0.9rem;
    color: var(--text-primary);
    border-top: 1px solid var(--border-subtle);
}

.preview-letter {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
    border-radius: 4px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.95rem;
    font-weight: 700;
}

.import-actions {
    display: flex;
    gap: 1rem;
    padding-top: 0.5rem;
}

.form-select {
    width: 100%;
    padding: 0.875rem 1rem;
    background: var(--bg-secondary);
    border: 2px solid var(--border-subtle);
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 0.95rem;
    color: var(--text-primary);
    cursor: pointer;
    transition: var(--transition-normal);
}

.form-select:focus {
    outline: none;
    border-color: #f59e0b;
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.15);
}

.form-select option {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

/* Budget Form */
.budget-form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.budget-form .form-group label svg {
    stroke: #f59e0b;
}

.budget-form .form-select:focus {
    border-color: #f59e0b;
}

.budget-form .btn-submit {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    box-shadow: 0 4px 20px rgba(245, 158, 11, 0.3);
}

.budget-form .btn-submit:hover:not(:disabled) {
    box-shadow: 0 8px 30px rgba(245, 158, 11, 0.4);
}

/* Line Form */
.line-form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.line-form .form-group label svg {
    stroke: #f59e0b;
}

.line-form .form-input:focus {
    border-color: #f59e0b;
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.15);
}

.line-form .btn-submit {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    box-shadow: 0 4px 20px rgba(245, 158, 11, 0.3);
}

.line-form .btn-submit:hover:not(:disabled) {
    box-shadow: 0 8px 30px rgba(245, 158, 11, 0.4);
}

/* Modal info box */
.modal-info {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    background: var(--bg-secondary);
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1.5rem;
}

/* Responsive */
@media (max-width: 900px) {
    .budgets-layout {
        grid-template-columns: 1fr;
    }
    
    .lines-panel {
        min-height: 400px;
    }
}

@media (max-width: 640px) {
    .budgets-container {
        padding: 1.25rem 1rem;
    }

    .budgets-header h1 {
        font-size: 1.5rem;
    }

    .budgets-icon {
        width: 36px;
        height: 36px;
    }

    .panel-header {
        padding: 0.875rem 1rem;
    }

    .budgets-list,
    .lines-list {
        padding: 0.75rem;
    }

    .budget-card {
        padding: 0.875rem;
    }

    .budget-icon {
        width: 36px;
        height: 36px;
    }

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

    .line-card {
        padding: 0.75rem;
    }

    .line-letter {
        width: 34px;
        height: 34px;
        font-size: 0.95rem;
    }

    .btn-add-line span {
        display: none;
    }

    .modal-medium,
    .modal-large {
        margin: 0.75rem;
        max-height: calc(100vh - 1.5rem);
        overflow-y: auto;
    }
}

/* CR Analysis Styles */
.btn-cr-analysis {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    padding: 0.55rem 0.9rem;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    border: none;
    border-radius: 999px;
    color: white;
    cursor: pointer;
    transition: var(--transition-normal);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.cr-preload-warning {
    width: 100%;
    margin-top: 0.5rem;
    padding: 0.55rem 0.75rem;
    border-radius: var(--radius-md);
    background: rgba(245, 158, 11, 0.10);
    border: 1px solid rgba(245, 158, 11, 0.25);
    color: rgba(245, 158, 11, 1);
    font-size: 0.85rem;
    font-weight: 600;
    display: none;
}

.cr-preload-warning.show {
    display: block;
}

.btn-cr-analysis:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
}

.btn-cr-analysis svg {
    width: 16px;
    height: 16px;
}

.btn-cr-analysis span {
    font-size: 0.8rem;
    font-weight: 600;
    white-space: nowrap;
}

.modal-xlarge {
    width: 95%;
    max-width: 1400px;
    max-height: 90vh;
}

/* CR sheets modal should occupy ~90% of viewport */
#crSheetsModal .modal-content {
    width: 90vw;
    max-width: 90vw;
    height: 90vh;
    max-height: 90vh;
}

#crSheetsModal .cr-analysis-content {
    height: calc(90vh - 100px);
    max-height: calc(90vh - 100px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#crSheetsModal #crSheetsContent {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    height: 100%;
    min-height: 0;
}

#crSheetsModal .cr-sheets-content-panel {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    height: 100%;
    min-height: 0;
}

#crSheetsModal .cr-table-container {
    flex: 1 1 auto;
    height: 100%;
    max-height: 100%;
    min-height: 0;
}

.cr-analysis-content {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 1rem;
    max-height: calc(90vh - 100px);
    overflow-y: auto;
}

.cr-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    gap: 1rem;
}

.cr-loading p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.cr-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.cr-stat {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: 0.75rem;
    text-align: center;
    transition: var(--transition-normal);
}

.cr-stat-clickable {
    cursor: pointer;
}

.cr-stat-clickable:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 212, 255, 0.2);
    border-color: var(--accent-cyan);
}

.cr-stat-clickable.active {
    border-color: var(--accent-cyan);
    box-shadow: 0 0 0 2px rgba(0, 212, 255, 0.3);
}

.cr-stat-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.cr-stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.cr-stat-success {
    border-color: #10b981;
    background: rgba(16, 185, 129, 0.05);
}

.cr-stat-success .cr-stat-value {
    color: #10b981;
}

.cr-stat-danger {
    border-color: #ef4444;
    background: rgba(239, 68, 68, 0.05);
}

.cr-stat-danger .cr-stat-value {
    color: #ef4444;
}

.cr-stat-warning {
    border-color: #f59e0b;
    background: rgba(245, 158, 11, 0.05);
}

.cr-stat-warning .cr-stat-value {
    color: #f59e0b;
}

.cr-stat-deficit {
    border-color: #dc2626;
    background: rgba(220, 38, 38, 0.05);
}

.cr-stat-deficit .cr-stat-value {
    color: #dc2626;
    font-size: 1.15rem;
}

.cr-tabs {
    display: flex;
    gap: 0.5rem;
    border-bottom: 2px solid var(--border-subtle);
    margin-bottom: 1rem;
}

.cr-tab {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.875rem 1.25rem;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    color: var(--text-muted);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition-fast);
    margin-bottom: -2px;
}

.cr-tab svg {
    width: 18px;
    height: 18px;
}

.cr-tab:hover {
    color: var(--text-secondary);
    background: var(--bg-card-hover);
}

.cr-tab.active {
    color: var(--accent-cyan);
    border-bottom-color: var(--accent-cyan);
}

.cr-tab-content {
    display: none;
}

.cr-tab-content.active {
    display: block;
}

/* Keep CR sheets panel independent from Buget vs CR tab switching */
.cr-sheets-content-panel {
    display: block;
}

.cr-table-container {
    max-height: 450px;
    overflow: auto;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
}

.cr-table-container::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.cr-table-container::-webkit-scrollbar-track {
    background: var(--bg-secondary);
    border-radius: 4px;
}

.cr-table-container::-webkit-scrollbar-thumb {
    background: var(--text-muted);
    border-radius: 4px;
}

.cr-table-container::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

.cr-table {
    width: 100%;
    min-width: 600px;
    border-collapse: collapse;
    font-size: 0.95rem;
}

.cr-table thead {
    position: sticky;
    top: 0;
    background: var(--bg-elevated);
    z-index: 10;
}

.cr-table th {
    padding: 0.75rem 0.875rem;
    text-align: left;
    font-weight: 600;
    color: var(--text-secondary);
    border-bottom: 2px solid var(--border-subtle);
    white-space: nowrap;
    font-size: 0.9rem;
}

.cr-table td {
    padding: 0.625rem 0.875rem;
    border-bottom: 1px solid var(--border-subtle);
    color: var(--text-primary);
    text-align: left;
}

.lines-panel .cr-table tbody tr {
    background: rgba(0, 212, 255, 0.08);
}

.cr-table tbody tr:hover {
    background: var(--bg-card-hover);
}

.cr-table tbody tr.cr-row-clickable {
    cursor: pointer;
}

.cr-group-cell {
    font-weight: 700;
    font-size: 0.9rem;
    color: #f59e0b;
    text-align: left;
    background: rgba(245, 158, 11, 0.08);
    vertical-align: middle;
    min-width: 60px;
}

.cr-number-cell {
    text-align: left;
    font-family: 'JetBrains Mono', monospace;
    font-weight: 500;
    min-width: 100px;
    white-space: nowrap;
}

.cr-row-negative {
    background: rgba(239, 68, 68, 0.12) !important;
    border-left: 3px solid #ef4444;
}

.cr-row-negative:hover {
    background: rgba(239, 68, 68, 0.18) !important;
}

.cr-row-missing {
    background: rgba(251, 191, 36, 0.12) !important;
    border-left: 3px solid #f59e0b;
}

.cr-row-missing:hover {
    background: rgba(251, 191, 36, 0.18) !important;
}

.cr-row-total {
    background: rgba(168, 85, 247, 0.14) !important;
    border-left: 3px solid #a855f7;
}

.cr-row-total:hover {
    background: rgba(168, 85, 247, 0.2) !important;
}

.cr-row-invoice-amount-ok {
    background: rgba(34, 197, 94, 0.16) !important;
    border-left: 3px solid #22c55e;
}

.cr-row-invoice-amount-ok:hover {
    background: rgba(34, 197, 94, 0.24) !important;
}

.cr-row-invoice-amount-bad {
    background: rgba(239, 68, 68, 0.14) !important;
    border-left: 3px solid #ef4444;
}

.cr-row-invoice-amount-bad:hover {
    background: rgba(239, 68, 68, 0.2) !important;
}

.cr-row-needs-association {
    background: rgba(239, 68, 68, 0.08) !important;
}

.cr-invoice-cell {
    vertical-align: middle;
}

.cr-invoice-cell-inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

.cr-invoice-cell-inner .cr-invoice-numbers {
    font-size: 0.85rem;
    line-height: 1.4;
}

.cr-btn-needs-association {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.35rem 0.65rem;
    border: none;
    border-radius: var(--radius-sm);
    background: #ef4444;
    color: #fff;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s ease;
}

.cr-btn-needs-association:hover {
    background: #dc2626;
}

.cr-diff-negative {
    color: #ef4444;
    font-weight: 700;
}

.cr-margin-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    margin-bottom: 0.75rem;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
}

.cr-margin-label-wrapper {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.cr-margin-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.cr-margin-help {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.cr-margin-control {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 220px;
}

.cr-margin-control input[type="range"] {
    flex: 1;
    accent-color: var(--accent-cyan);
}

.cr-margin-value {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--accent-cyan);
}

@media (max-width: 768px) {
    .cr-margin-bar {
        flex-direction: column;
        align-items: flex-start;
    }

    .cr-margin-control {
        width: 100%;
    }
}

.btn-download-template {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 0.9rem;
    border-radius: 999px;
    border: 1px solid var(--border-subtle);
    background: rgba(15, 23, 42, 0.7);
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition-fast);
}

.btn-download-template svg {
    width: 16px;
    height: 16px;
}

.btn-download-template:hover {
    background: rgba(56, 189, 248, 0.08);
    border-color: var(--accent-cyan);
    color: var(--accent-cyan);
    transform: translateY(-1px);
}

.budget-template-upload {
    display: none;
}

.budget-template-header h3 {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.budget-template-header span {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.budget-template-form {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.budget-template-fields {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.budget-template-input {
    font-size: 0.8rem;
    color: var(--text-primary);
}

.budget-template-message {
    font-size: 0.8rem;
    color: var(--accent-cyan);
}

@media (max-width: 768px) {
    .budget-template-upload {
        margin-top: 1rem;
    }
}

/* CR Analysis Responsive */
@media (max-width: 768px) {
    .modal-xlarge {
        width: 98%;
        max-width: none;
        margin: 0.5rem;
    }
    
    .cr-summary {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .cr-stat {
        padding: 0.5rem;
    }
    
    .cr-stat-label {
        font-size: 0.65rem;
    }
    
    .cr-stat-value {
        font-size: 0.9rem;
    }
    
    .cr-table {
        font-size: 0.75rem;
    }
    
    .cr-table th,
    .cr-table td {
        padding: 0.5rem 0.625rem;
    }
}

/* ==========================================
   FACTURI STYLES - MODERN DESIGN
   ========================================== */

.facturi-container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 2.5rem 1.5rem;
}

.facturi-header {
    text-align: center;
    margin-bottom: 3rem;
    position: relative;
    padding-bottom: 2rem;
}

.facturi-header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 120px;
    height: 4px;
    background: var(--gradient-main);
    border-radius: 2px;
    box-shadow: 0 0 20px rgba(0, 212, 255, 0.5);
}

.facturi-header h1 {
    font-size: 3rem;
    font-weight: 700;
    background: var(--gradient-main);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 0.75rem;
    letter-spacing: -0.02em;
}

.facturi-icon {
    width: 56px;
    height: 56px;
    stroke: url(#gradient);
    filter: drop-shadow(0 0 12px rgba(0, 212, 255, 0.5));
    transition: transform var(--transition-normal);
}

.facturi-header:hover .facturi-icon {
    transform: scale(1.05) rotate(5deg);
}

.facturi-subtitle {
    color: var(--text-secondary);
    font-size: 1.15rem;
    margin-top: 0.75rem;
    font-weight: 400;
}

.facturi-toolbar {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    background: transparent;
    padding: 0;
    border: none;
    box-shadow: none;
    width: 100%;
}

.facturi-toolbar-row {
    display: flex;
    gap: 0.625rem;
    align-items: center;
    flex-wrap: wrap;
    width: 100%;
    min-height: 42px;
    box-sizing: border-box;
    position: relative;
    overflow: visible;
}

/* Row 2: filters — full width like search bar */
.facturi-toolbar-filters {
    gap: 0.5rem;
    flex-wrap: nowrap;
}

/* Row 3: action buttons — equal width, fill the row */
.facturi-toolbar-actions {
    gap: 0.5rem;
    flex-wrap: nowrap;
    width: 100%;
}

.facturi-toolbar-actions .btn-toolbar-action {
    flex: 1 1 0;
    width: auto !important;
    min-width: 0;
    padding: 0.625rem 0.5rem;
}

.facturi-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2.5rem;
}

.stat-item {
    background: var(--gradient-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 1.75rem;
    text-align: center;
    transition: all var(--transition-normal);
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-card);
}

.stat-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--gradient-main);
    opacity: 0;
    transition: opacity var(--transition-normal);
}

.stat-item:hover {
    border-color: var(--accent-cyan);
    transform: translateY(-4px);
    box-shadow: 0 12px 40px rgba(0, 212, 255, 0.2);
}

.stat-item:hover::before {
    opacity: 1;
}

/* Active filter state for clickable stat items */
.stat-item.stat-filter-active {
    border-color: var(--accent-purple, #a855f7);
    box-shadow: 0 0 0 2px rgba(168, 85, 247, 0.3), 0 8px 30px rgba(168, 85, 247, 0.2);
    transform: translateY(-2px);
}

.stat-item.stat-filter-active::before {
    opacity: 1;
    background: linear-gradient(135deg, #a855f7, #ec4899);
}

.stat-item.stat-filter-active::after {
    content: '✕';
    position: absolute;
    top: 0.5rem;
    right: 0.75rem;
    font-size: 0.75rem;
    color: var(--text-muted, #71717a);
    opacity: 0.6;
    transition: opacity 0.2s;
}

.stat-item.stat-filter-active:hover::after {
    opacity: 1;
}

.stat-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    background: var(--gradient-main);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.5rem;
    line-height: 1.2;
}

.stat-label {
    display: block;
    font-size: 0.9rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 600;
}

.facturi-list {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.factura-card {
    background: var(--gradient-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 2rem;
    transition: all var(--transition-normal);
    box-shadow: var(--shadow-card);
    position: relative;
    overflow: hidden;
}

.factura-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--gradient-main);
    opacity: 0;
    transition: opacity var(--transition-normal);
}

.factura-card:hover {
    border-color: var(--accent-cyan);
    transform: translateY(-2px);
    box-shadow: 0 12px 40px rgba(0, 212, 255, 0.15);
}

.factura-card:hover::before {
    opacity: 1;
}

.factura-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-subtle);
}

.factura-title {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex: 1;
}

/* Factura Checkbox Styling - Modern Design */
.factura-checkbox {
    width: 24px;
    height: 24px;
    cursor: pointer;
    margin: 0;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background: var(--bg-elevated);
    border: 2px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    position: relative;
    transition: all var(--transition-normal);
    flex-shrink: 0;
}

.factura-checkbox:hover {
    border-color: var(--accent-purple);
    background: var(--bg-card-hover);
    box-shadow: 0 0 0 4px rgba(168, 85, 247, 0.15);
    transform: scale(1.1);
}

.factura-checkbox:checked {
    background: var(--gradient-main);
    border-color: transparent;
    box-shadow: 0 0 0 4px rgba(168, 85, 247, 0.2), 0 4px 12px rgba(168, 85, 247, 0.4);
}

.factura-checkbox:checked::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%) rotate(45deg);
    width: 6px;
    height: 10px;
    border: solid white;
    border-width: 0 2.5px 2.5px 0;
    animation: checkmark-appear 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.factura-checkbox:focus {
    outline: none;
    box-shadow: 0 0 0 4px rgba(168, 85, 247, 0.25);
}

.factura-card:hover .factura-checkbox:not(:checked) {
    border-color: var(--accent-cyan);
}

@keyframes checkmark-appear {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) rotate(45deg) scale(0.3);
    }
    50% {
        transform: translate(-50%, -50%) rotate(45deg) scale(1.2);
    }
    100% {
        opacity: 1;
        transform: translate(-50%, -50%) rotate(45deg) scale(1);
    }
}

.factura-title h3 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
    letter-spacing: -0.01em;
}

.factura-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.btn-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-normal);
    color: var(--text-primary);
    position: relative;
}

.btn-icon::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: var(--radius-md);
    background: var(--gradient-main);
    opacity: 0;
    transition: opacity var(--transition-normal);
}

.btn-icon svg {
    width: 20px;
    height: 20px;
    position: relative;
    z-index: 1;
    transition: transform var(--transition-fast);
}

.btn-icon:hover {
    border-color: var(--accent-cyan);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 212, 255, 0.3);
}

.btn-icon:hover::before {
    opacity: 0.1;
}

.btn-icon:hover svg {
    transform: scale(1.1);
    stroke: var(--accent-cyan);
}

.btn-icon.btn-delete:hover {
    border-color: #ef4444;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.btn-icon.btn-delete:hover::before {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.2) 0%, rgba(220, 38, 38, 0.2) 100%);
    opacity: 1;
}

.btn-icon.btn-delete:hover svg {
    stroke: #ef4444;
}

.factura-body {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.factura-info {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1.25rem;
}

.factura-info-row {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: stretch;
}

.factura-info-row .info-item {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.875rem;
    background: var(--bg-elevated);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
    transition: all var(--transition-normal);
    flex: 1 1 auto;
    min-width: 140px;
    max-width: 100%;
}

.factura-info-row .info-item .info-label {
    display: block;
    line-height: 1.2;
}

.factura-info-row .info-item .info-value {
    display: block;
    line-height: 1.4;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.info-item-articole {
    flex: 1 1 220px;
    min-width: 160px;
    max-width: 100%;
}

.factura-articole-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    max-width: 100%;
}

.factura-articol-item {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
    line-height: 1.35;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    padding: 0.2rem 0;
}

.factura-articol-more {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-muted);
    letter-spacing: 0.15em;
    margin-top: -0.26rem; /* ~1/4 din gap-ul listei (0.35rem) față de ultimul articol */
    padding: 0;
    line-height: 1;
    list-style: none;
    cursor: help;
}

.info-value-muted {
    color: var(--text-muted);
    font-style: italic;
}

.info-item {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 1rem;
    background: var(--bg-elevated);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
    transition: all var(--transition-normal);
    flex: 0 1 auto;
    min-width: 0;
}

.info-item-light .info-label {
    font-weight: 500;
}

.info-item-light .info-value {
    font-weight: 400;
}

.info-item:hover {
    border-color: var(--accent-cyan);
    background: var(--bg-card-hover);
    transform: translateX(4px);
}

.info-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 700;
}

.info-value {
    font-size: 0.95rem;
    color: var(--text-primary);
    font-weight: 600;
    line-height: 1.4;
}

.info-link {
    color: var(--accent-cyan);
    text-decoration: none;
    font-weight: 600;
    transition: all var(--transition-normal);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.info-link:hover {
    color: var(--accent-purple);
    text-decoration: none;
    transform: translateX(4px);
}

.info-link::after {
    content: '→';
    transition: transform var(--transition-fast);
}

.info-link:hover::after {
    transform: translateX(4px);
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all var(--transition-normal);
}

.badge:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.badge-success {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.2) 0%, rgba(5, 150, 105, 0.2) 100%);
    color: #10b981;
    border: 1px solid rgba(16, 185, 129, 0.4);
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.2);
}

.badge-warning {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.2) 0%, rgba(217, 119, 6, 0.2) 100%);
    color: #f59e0b;
    border: 1px solid rgba(245, 158, 11, 0.4);
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.2);
}

.badge-info {
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.2) 0%, rgba(59, 130, 246, 0.2) 100%);
    color: var(--accent-cyan);
    border: 1px solid rgba(0, 212, 255, 0.4);
    box-shadow: 0 2px 8px rgba(0, 212, 255, 0.2);
}

.btn-add-factura {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.75rem;
    background: var(--gradient-main);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--transition-normal);
    box-shadow: var(--shadow-button);
    position: relative;
    overflow: hidden;
}

.btn-add-factura::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.2) 0%, transparent 100%);
    opacity: 0;
    transition: opacity var(--transition-normal);
}

.btn-add-factura:hover {
    box-shadow: 0 8px 30px rgba(0, 212, 255, 0.5);
    transform: translateY(-3px);
}

.btn-add-factura:hover::before {
    opacity: 1;
}

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

.btn-add-factura svg {
    width: 20px;
    height: 20px;
    stroke: white;
    position: relative;
    z-index: 1;
    transition: transform var(--transition-fast);
}

.btn-add-factura:hover svg {
    transform: scale(1.1) rotate(5deg);
}

.factura-form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.factura-form .form-group label svg {
    stroke: #06b6d4;
}

/* Facturi-specific search box - Modern & Beautiful */
.facturi-toolbar .search-box {
    width: 100%;
    position: relative;
    box-sizing: border-box;
}

.facturi-toolbar .search-box input {
    background: var(--bg-card);
    border: 1.5px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 0.75rem 2.75rem 0.75rem 2.75rem;
    font-size: 0.9rem;
    color: var(--text-primary);
    transition: all var(--transition-normal);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05), inset 0 1px 2px rgba(255, 255, 255, 0.05);
    height: 42px;
    width: 100%;
    font-weight: 400;
    backdrop-filter: blur(10px);
}

.facturi-toolbar .search-box input::placeholder {
    color: var(--text-muted);
    font-weight: 400;
    transition: opacity var(--transition-normal);
}

.facturi-toolbar .search-box input:hover {
    border-color: rgba(0, 212, 255, 0.3);
    box-shadow: 0 4px 12px rgba(0, 212, 255, 0.08);
    background: var(--bg-elevated);
}

.facturi-toolbar .search-box input:focus {
    outline: none;
    border-color: var(--accent-cyan);
    box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.15), 0 4px 20px rgba(0, 212, 255, 0.25), inset 0 1px 2px rgba(255, 255, 255, 0.1);
    background: var(--bg-elevated);
    transform: translateY(-1px);
}

.facturi-toolbar .search-box input:focus::placeholder {
    opacity: 0.6;
}

.facturi-toolbar .search-box svg {
    width: 18px;
    height: 18px;
    left: 1rem;
    stroke: var(--text-muted);
    transition: all var(--transition-normal);
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    z-index: 1;
}

.facturi-toolbar .search-box:hover svg,
.facturi-toolbar .search-box input:focus ~ svg,
.facturi-toolbar .search-box:focus-within svg {
    stroke: var(--accent-cyan);
    transform: translateY(-50%) scale(1.1);
}

.facturi-toolbar .btn-clear-search {
    width: 28px;
    height: 28px;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-normal);
    opacity: 0.7;
}

.facturi-toolbar .btn-clear-search:hover {
    background: rgba(239, 68, 68, 0.1);
    border-color: #ef4444;
    opacity: 1;
    transform: translateY(-50%) scale(1.1) rotate(90deg);
}

.facturi-toolbar .btn-clear-search svg {
    width: 14px;
    height: 14px;
    stroke: var(--text-muted);
    transition: stroke var(--transition-fast);
}

.facturi-toolbar .btn-clear-search:hover svg {
    stroke: #ef4444;
}

/* Facturi-specific form selects — visual only; layout in .facturi-toolbar-filters */
.facturi-toolbar-row .form-select {
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: 0.5rem 2rem 0.5rem 0.75rem;
    font-size: 0.875rem;
    transition: all var(--transition-fast);
    box-shadow: none;
    height: 42px;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23a1a1aa' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.5rem center;
    background-size: 12px;
    text-overflow: ellipsis;
}

/* Re-apply filter layout — equal columns, full row width */
.facturi-toolbar-filters .form-select {
    flex: 1 1 0;
    min-width: 0;
    width: 100%;
    max-width: none;
}

.facturi-toolbar-row .form-select:hover {
    border-color: var(--accent-cyan);
}

.facturi-toolbar-row .form-select:focus {
    outline: none;
    border-color: var(--accent-cyan);
    box-shadow: 0 0 0 2px rgba(0, 212, 255, 0.1);
}

.facturi-toolbar .form-select:hover {
    border-color: var(--accent-cyan);
}

.facturi-toolbar .form-select:focus {
    outline: none;
    border-color: var(--accent-cyan);
    box-shadow: 0 0 0 2px rgba(0, 212, 255, 0.1);
}

/* Toolbar action buttons */
.facturi-toolbar-row .btn-toolbar-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.625rem 1rem;
    height: 42px;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-normal);
    font-size: 0.875rem;
    font-weight: 600;
    border: none;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    overflow: visible;
}

.facturi-toolbar-filters input[type="date"].form-select {
    font-size: 0.875rem;
    color: var(--text-primary);
    font-weight: 500;
    letter-spacing: 0.01em;
}

.facturi-toolbar-row input[type="date"].form-select::-webkit-calendar-picker-indicator {
    opacity: 1;
    filter: invert(81%) sepia(7%) saturate(458%) hue-rotate(191deg) brightness(96%) contrast(91%);
}

.facturi-toolbar-row .btn-toolbar-action svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
    flex-shrink: 0;
}

.facturi-toolbar-row .btn-toolbar-action span {
    font-weight: 600;
    letter-spacing: 0.01em;
    display: inline-block;
    overflow: visible;
    line-height: 1.2;
}

/* ANAF Download Button */
.facturi-toolbar-row .btn-anaf {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.facturi-toolbar-row .btn-anaf:hover:not(:disabled) {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.4);
    transform: translateY(-2px);
}

/* Import XML Button */
.facturi-toolbar-row .btn-import {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.facturi-toolbar-row .btn-import:hover:not(:disabled) {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
    transform: translateY(-2px);
}

/* Saga XML Button */
.facturi-toolbar-row .btn-saga {
    background: linear-gradient(135deg, #a855f7 0%, #9333ea 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(168, 85, 247, 0.3);
}

.facturi-toolbar-row .btn-saga:hover:not(:disabled) {
    background: linear-gradient(135deg, #9333ea 0%, #7e22ce 100%);
    box-shadow: 0 6px 20px rgba(168, 85, 247, 0.4);
    transform: translateY(-2px);
}

/* Export Raport — indigo, distinct from Saga purple */
.facturi-toolbar-row .btn-export {
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.35);
}

.facturi-toolbar-row .btn-export:hover:not(:disabled) {
    background: linear-gradient(135deg, #4f46e5 0%, #4338ca 100%);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.45);
    transform: translateY(-2px);
}

/* Approve Multiple Button (teal — distinct from Import XML green) */
.facturi-toolbar-row .btn-approve-multiple {
    background: linear-gradient(135deg, #14b8a6 0%, #0d9488 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(20, 184, 166, 0.35);
}

.facturi-toolbar-row .btn-approve-multiple:hover:not(:disabled) {
    background: linear-gradient(135deg, #0d9488 0%, #0f766e 100%);
    box-shadow: 0 6px 20px rgba(20, 184, 166, 0.45);
    transform: translateY(-2px);
}

/* Delete Multiple Button (when enabled) */
.facturi-toolbar-row .btn-delete:not(:disabled) {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.facturi-toolbar-row .btn-delete:hover:not(:disabled) {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
    box-shadow: 0 6px 20px rgba(239, 68, 68, 0.4);
    transform: translateY(-2px);
}

.facturi-toolbar-row .btn-toolbar-action:active:not(:disabled) {
    transform: translateY(0);
}

.facturi-toolbar-row .btn-toolbar-action:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: linear-gradient(135deg, #6b7280 0%, #4b5563 100%);
    box-shadow: none;
}

.facturi-toolbar-row .btn-toolbar-action:disabled:hover {
    transform: none;
}

.factura-form .form-input:focus,
.factura-form .form-select:focus {
    border-color: var(--accent-cyan);
    box-shadow: 0 0 0 4px rgba(0, 212, 255, 0.15);
}

.factura-form .btn-submit {
    background: var(--gradient-main);
    box-shadow: var(--shadow-button);
}

.factura-form .btn-submit:hover:not(:disabled) {
    box-shadow: 0 8px 30px rgba(0, 212, 255, 0.5);
    transform: translateY(-2px);
}

/* Empty state styling */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 2px dashed var(--border-subtle);
}

.empty-state svg {
    width: 80px;
    height: 80px;
    stroke: var(--text-muted);
    margin-bottom: 1.5rem;
    opacity: 0.5;
}

.empty-state p {
    font-size: 1.5rem;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    font-weight: 500;
}

.loading-state {
    text-align: center;
    padding: 4rem 2rem;
}

.spinner-large {
    width: 48px;
    height: 48px;
    border: 4px solid var(--border-subtle);
    border-top-color: var(--accent-cyan);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 1.5rem;
}

/* Bulk selection header */
.bulk-selection-header {
    background: linear-gradient(135deg, rgba(168, 85, 247, 0.15) 0%, rgba(236, 72, 153, 0.15) 100%);
    border: 2px solid var(--accent-purple);
    border-radius: var(--radius-lg);
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.5rem;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 20px rgba(168, 85, 247, 0.2);
    transition: all var(--transition-normal);
}

.bulk-selection-header:hover {
    box-shadow: 0 6px 30px rgba(168, 85, 247, 0.3);
    transform: translateY(-2px);
}

.bulk-selection-header .custom-checkbox {
    width: 24px;
    height: 24px;
}

/* Narrow screens: allow wrap */
@media (max-width: 992px) {
    .facturi-toolbar-filters,
    .facturi-toolbar-actions {
        flex-wrap: wrap;
    }

    .facturi-toolbar-filters .form-select {
        flex: 1 1 calc(33.333% - 0.35rem);
        min-width: 9rem;
    }

    .facturi-toolbar-actions .btn-toolbar-action {
        flex: 1 1 calc(50% - 0.25rem);
        min-width: calc(50% - 0.25rem);
    }
}

/* Responsive */
@media (max-width: 768px) {
    .facturi-container {
        padding: 1.5rem 1rem;
    }

    .facturi-header h1 {
        font-size: 1.5rem;
    }

    .facturi-icon {
        width: 40px;
        height: 40px;
    }

    .facturi-toolbar {
        gap: 0.5rem;
    }

    .facturi-toolbar-filters .form-select {
        flex: 1 1 calc(50% - 0.25rem);
        min-width: calc(50% - 0.25rem);
    }

    .facturi-toolbar-actions .btn-toolbar-action {
        flex: 1 1 calc(50% - 0.25rem);
        min-width: calc(50% - 0.25rem);
        justify-content: center;
        font-size: 0.8rem;
        padding: 0.5rem 0.65rem;
    }

    .facturi-toolbar-row .btn-toolbar-action span {
        display: inline;
        white-space: nowrap;
    }

    .facturi-toolbar-row .btn-toolbar-action svg {
        width: 18px;
        height: 18px;
    }

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

    .stat-item {
        padding: 1.25rem;
    }

    .stat-value {
        font-size: 1.5rem;
    }

    .factura-card {
        padding: 1.25rem;
    }

    .factura-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .factura-actions {
        width: 100%;
        justify-content: flex-start;
    }

    .factura-info {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .factura-info-row {
        flex-direction: column;
        gap: 0.875rem;
    }

    .info-item {
        padding: 0.875rem;
    }
}

.btn-download-anaf {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.75rem;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--transition-normal);
    box-shadow: 0 4px 20px rgba(59, 130, 246, 0.3);
    position: relative;
    overflow: hidden;
}

.btn-download-anaf::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.2) 0%, transparent 100%);
    opacity: 0;
    transition: opacity var(--transition-normal);
}

.btn-download-anaf:hover:not(:disabled) {
    box-shadow: 0 8px 30px rgba(59, 130, 246, 0.5);
    transform: translateY(-3px);
}

.btn-download-anaf:hover:not(:disabled)::before {
    opacity: 1;
}

.btn-download-anaf:disabled {
    background: linear-gradient(135deg, #9ca3af 0%, #6b7280 100%);
    cursor: not-allowed;
    opacity: 0.6;
    box-shadow: none;
}

.btn-download-anaf:disabled:hover {
    transform: none;
}

.btn-download-anaf:disabled::before {
    display: none;
}

.btn-download-anaf svg {
    width: 20px;
    height: 20px;
    stroke: white;
    position: relative;
    z-index: 1;
    transition: transform var(--transition-fast);
}

.btn-download-anaf:hover:not(:disabled) svg {
    transform: translateY(-2px);
}

.btn-refresh-tokens {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition-normal);
}

.btn-refresh-tokens:hover {
    background: var(--bg-elevated);
    border-color: #06b6d4;
    color: #06b6d4;
}

.btn-refresh-tokens svg {
    width: 16px;
    height: 16px;
}

.progress-bar-container {
    width: 100%;
    height: 8px;
    background: var(--bg-secondary);
    border-radius: 4px;
    overflow: hidden;
    margin-top: 1rem;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #06b6d4 0%, #3b82f6 100%);
    border-radius: 4px;
    transition: width 0.3s ease;
    width: 0%;
}

.spinner-small {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    display: inline-block;
}

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

@media (max-width: 640px) {
    .facturi-header h1 {
        font-size: 1.5rem;
        flex-direction: column;
        gap: 0.5rem;
    }

    .facturi-stats {
        grid-template-columns: 1fr;
    }

    .stat-value {
        font-size: 1.5rem;
    }

    .btn-download-anaf span,
    .btn-add-factura span {
        display: none;
    }

    .btn-download-anaf,
    .btn-add-factura {
        padding: 0.875rem;
        min-width: 48px;
    }

    .factura-title h3 {
        font-size: 1.5rem;
    }
}

/* ===================================
   Invoice Preview Styles
   =================================== */

.preview-invoice {
    padding: 1.5rem;
}

.preview-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--border-subtle);
}

.preview-header h2 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
}

.preview-section {
    margin-bottom: 1rem;
}

.preview-section h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    padding-bottom: 0.25rem;
    border-bottom: 1px solid var(--border-subtle);
}

.preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 0.5rem;
}

.preview-item {
    padding: 0.5rem;
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-subtle);
}

.preview-item strong {
    display: block;
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-bottom: 0.15rem;
    font-weight: 500;
}

.preview-item:not(:has(strong)) {
    color: var(--text-primary);
    font-size: 0.85rem;
}

.preview-party {
    margin-bottom: 0.75rem;
    padding: 0.75rem;
    background: var(--bg-card);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
}

.preview-party h4 {
    margin: 0 0 0.5rem 0;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--accent-cyan);
}

.preview-table-container {
    overflow-x: auto;
    margin-top: 0.5rem;
}

.preview-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.preview-table thead {
    background: var(--bg-elevated);
}

.preview-table th {
    padding: 0.5rem 0.625rem;
    text-align: left;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.8rem;
    border-bottom: 2px solid var(--border-subtle);
}

.preview-table td {
    padding: 0.5rem 0.625rem;
    color: var(--text-secondary);
    font-size: 0.85rem;
    border-bottom: 1px solid var(--border-subtle);
}

.preview-table tbody tr:hover {
    background: var(--bg-card-hover);
}

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

.preview-note {
    padding: 0.5rem 0.75rem;
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--accent-cyan);
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 0.25rem;
    font-size: 0.85rem;
}

.modal-body {
    padding: 1rem;
}

@media (max-width: 768px) {
    .modal-fullwidth {
        max-width: 100vw;
        width: 100vw;
        max-height: 100vh;
        padding: 1rem;
        border-radius: 0;
    }

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

    .preview-table-container {
        font-size: 0.9rem;
    }

    .preview-table th,
    .preview-table td {
        padding: 0.5rem;
    }
}

/* ===================================
   Cod Contabil Module Styles
   =================================== */

.cod-contabil-container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

.cod-contabil-header {
    text-align: center;
    margin-bottom: 2rem;
    position: relative;
}

.cod-contabil-header::after {
    content: '';
    position: absolute;
    bottom: -0.75rem;
    left: 50%;
    transform: translateX(-50%);
    width: 100px;
    height: 3px;
    background: linear-gradient(135deg, #14b8a6 0%, #06b6d4 100%);
    border-radius: 3px;
}

.cod-contabil-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, #14b8a6 0%, #06b6d4 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
    letter-spacing: -0.02em;
}

.cod-contabil-icon {
    width: 48px;
    height: 48px;
    stroke: #14b8a6;
    filter: drop-shadow(0 0 10px rgba(20, 184, 166, 0.5));
    -webkit-text-fill-color: initial;
}

.cod-contabil-subtitle {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin: 0;
    font-weight: 400;
}

/* Toolbar */
.cod-contabil-toolbar {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    align-items: center;
    background: var(--bg-card);
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-subtle);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08), 0 1px 3px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.8) 0%, rgba(30, 41, 59, 0.8) 100%);
    position: relative;
    overflow: hidden;
}

.cod-contabil-toolbar::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, #14b8a6 0%, #06b6d4 50%, #14b8a6 100%);
    opacity: 0.6;
}

.cod-contabil-toolbar .search-box {
    flex: 1;
    min-width: 280px;
    position: relative;
}

.cod-contabil-toolbar .search-box svg {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    stroke: var(--text-muted);
    pointer-events: none;
    z-index: 1;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.cod-contabil-toolbar .search-box input {
    width: 100%;
    padding: 0.875rem 1rem 0.875rem 2.75rem;
    background: rgba(15, 23, 42, 0.6);
    border: 1.5px solid var(--border-subtle);
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 0.9rem;
    color: var(--text-primary);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05), inset 0 1px 2px rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(10px);
    height: 44px;
    font-weight: 400;
}

.cod-contabil-toolbar .search-box input::placeholder {
    color: var(--text-muted);
    font-weight: 400;
    transition: opacity 0.3s;
}

.cod-contabil-toolbar .search-box:hover svg,
.cod-contabil-toolbar .search-box input:focus ~ svg,
.cod-contabil-toolbar .search-box:focus-within svg {
    stroke: #14b8a6;
    transform: translateY(-50%) scale(1.1);
}

.cod-contabil-toolbar .search-box input:hover {
    border-color: rgba(20, 184, 166, 0.4);
    box-shadow: 0 4px 12px rgba(20, 184, 166, 0.1), inset 0 1px 2px rgba(255, 255, 255, 0.05);
    background: rgba(15, 23, 42, 0.8);
}

.cod-contabil-toolbar .search-box input:focus {
    outline: none;
    border-color: #14b8a6;
    box-shadow: 0 0 0 3px rgba(20, 184, 166, 0.15), 0 4px 20px rgba(20, 184, 166, 0.2), inset 0 1px 2px rgba(255, 255, 255, 0.1);
    background: rgba(15, 23, 42, 0.9);
    transform: translateY(-1px);
}

.cod-contabil-toolbar .search-box input:focus::placeholder {
    opacity: 0.5;
}

.cod-contabil-toolbar .btn-clear-search {
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: 50%;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 0.7;
    cursor: pointer;
    z-index: 2;
}

/* Light mode adjustments for Cod Contabil toolbar */
[data-theme="light"] .cod-contabil-toolbar {
    background: var(--bg-card);
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
}

[data-theme="light"] .cod-contabil-toolbar .search-box input {
    background: #f9fafb;
    border-color: rgba(148, 163, 184, 0.6);
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
}

[data-theme="light"] .cod-contabil-toolbar .search-box input:hover {
    background: #ffffff;
    box-shadow: 0 4px 10px rgba(15, 23, 42, 0.06);
}

[data-theme="light"] .cod-contabil-toolbar .search-box input:focus {
    background: #ffffff;
}

[data-theme="light"] .cod-contabil-toolbar .btn-clear-search {
    background: #f9fafb;
}

.cod-contabil-toolbar .btn-clear-search:hover {
    background: rgba(239, 68, 68, 0.1);
    border-color: #ef4444;
    opacity: 1;
    transform: translateY(-50%) scale(1.1) rotate(90deg);
}

.cod-contabil-toolbar .btn-clear-search svg {
    width: 14px;
    height: 14px;
    stroke: var(--text-muted);
    transition: stroke 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.cod-contabil-toolbar .btn-clear-search:hover svg {
    stroke: #ef4444;
}

.filter-select {
    padding: 0.875rem 1rem;
    background: var(--bg-card);
    border: 2px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    font-family: inherit;
    font-size: 0.95rem;
    color: var(--text-primary);
    cursor: pointer;
    transition: var(--transition-normal);
    min-width: 180px;
}

.filter-select:focus {
    outline: none;
    border-color: #14b8a6;
    box-shadow: 0 0 0 3px rgba(20, 184, 166, 0.15);
}

.btn-add-cod-contabil {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.875rem 1.5rem;
    background: linear-gradient(135deg, #14b8a6 0%, #06b6d4 100%);
    border: none;
    border-radius: var(--radius-lg);
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 600;
    color: white;
    cursor: pointer;
    transition: var(--transition-normal);
    box-shadow: 0 4px 20px rgba(20, 184, 166, 0.3);
    white-space: nowrap;
}

.btn-add-cod-contabil:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(20, 184, 166, 0.4);
}

.btn-add-cod-contabil svg {
    width: 20px;
    height: 20px;
}

/* Stats */
.cod-contabil-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.cod-contabil-stats .stat-item {
    background: var(--bg-card);
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    text-align: center;
    border: 2px solid var(--border-subtle);
    transition: var(--transition-normal);
    cursor: pointer;
}

.cod-contabil-stats .stat-item:hover {
    border-color: #14b8a6;
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(20, 184, 166, 0.2);
}

.cod-contabil-stats .stat-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    color: #14b8a6;
    margin-bottom: 0.5rem;
}

.cod-contabil-stats .stat-item.active {
    border-color: #14b8a6;
    box-shadow: 0 4px 20px rgba(20, 184, 166, 0.25);
}

.cod-contabil-stats .stat-label {
    display: block;
    font-size: 0.9rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* List */
.cod-contabil-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 1.5rem;
}

.cod-contabil-card {
    background: var(--bg-card);
    border: 2px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    transition: var(--transition-normal);
    position: relative;
    overflow: hidden;
}

.cod-contabil-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #14b8a6 0%, #06b6d4 100%);
    opacity: 0;
    transition: var(--transition-normal);
}

.cod-contabil-card:hover {
    border-color: #14b8a6;
    transform: translateY(-4px);
    box-shadow: 0 8px 32px rgba(20, 184, 166, 0.2);
}

.cod-contabil-card:hover::before {
    opacity: 1;
}

.cod-contabil-card.inactive {
    opacity: 0.7;
    border-color: var(--text-muted);
}

.cod-contabil-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-subtle);
}

.cod-contabil-code {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.cod-contabil-code strong {
    font-size: 1.5rem;
    color: var(--text-primary);
    font-family: 'JetBrains Mono', monospace;
}

.badge-active,
.badge-inactive {
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-active {
    background: rgba(20, 184, 166, 0.2);
    color: #14b8a6;
    border: 1px solid rgba(20, 184, 166, 0.3);
}

.badge-inactive {
    background: rgba(113, 113, 122, 0.2);
    color: var(--text-muted);
    border: 1px solid rgba(113, 113, 122, 0.3);
}

.cod-contabil-actions {
    display: flex;
    gap: 0.5rem;
}

.btn-edit,
.btn-delete {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition-fast);
    background: var(--bg-elevated);
    color: var(--text-secondary);
}

.btn-edit:hover {
    background: rgba(20, 184, 166, 0.2);
    color: #14b8a6;
    transform: scale(1.1);
}

.btn-delete:hover {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
    transform: scale(1.1);
}

.btn-delete.btn-activate:hover {
    background: rgba(16, 185, 129, 0.2);
    color: #10b981;
    transform: scale(1.1);
}

.btn-edit svg,
.btn-delete svg {
    width: 18px;
    height: 18px;
}

.cod-contabil-card-body {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.cod-contabil-detail {
    display: flex;
    gap: 0.5rem;
    font-size: 0.9rem;
}

.detail-label {
    color: var(--text-muted);
    font-weight: 500;
    min-width: 80px;
}

.detail-value {
    color: var(--text-primary);
    flex: 1;
}

.detail-value.editable-denumire {
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    transition: var(--transition-fast);
    display: inline-block;
    min-width: 100px;
}

.detail-value.editable-denumire:hover {
    background: rgba(20, 184, 166, 0.1);
    color: #14b8a6;
}

.inline-edit-input {
    font-family: inherit;
    font-size: inherit;
    color: var(--text-primary);
    background: var(--bg-card);
}

/* Form */
.cod-contabil-form {
    padding: 1.5rem;
}

.cod-contabil-form .form-group {
    margin-bottom: 1.5rem;
}

.cod-contabil-form label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
}

.cod-contabil-form label svg {
    width: 18px;
    height: 18px;
    color: #14b8a6;
}

.cod-contabil-form .form-input {
    width: 100%;
    padding: 0.875rem 1rem;
    background: var(--bg-secondary);
    border: 2px solid var(--border-subtle);
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 0.95rem;
    color: var(--text-primary);
    transition: var(--transition-normal);
}

.cod-contabil-form .form-input:focus {
    outline: none;
    border-color: #14b8a6;
    box-shadow: 0 0 0 3px rgba(20, 184, 166, 0.15);
}

.cod-contabil-form .form-input:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.input-hint {
    display: block;
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
    font-style: italic;
}

.cod-contabil-form .custom-checkbox {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: #14b8a6;
}

.modal-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-subtle);
}

.btn-cancel,
.btn-save {
    padding: 0.875rem 2rem;
    border: none;
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-normal);
}

.btn-cancel {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 2px solid var(--border-subtle);
}

.btn-cancel:hover {
    background: var(--bg-card);
    border-color: var(--text-muted);
}

.btn-save {
    background: linear-gradient(135deg, #14b8a6 0%, #06b6d4 100%);
    color: white;
    box-shadow: 0 4px 20px rgba(20, 184, 166, 0.3);
}

.btn-save:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(20, 184, 166, 0.4);
}

/* Responsive */
@media (max-width: 768px) {
    .cod-contabil-container {
        padding: 1rem;
    }

    .cod-contabil-header h1 {
        font-size: 1.5rem;
    }

    .cod-contabil-list {
        grid-template-columns: 1fr;
    }

    .cod-contabil-toolbar {
        flex-direction: column;
    }

    .cod-contabil-toolbar .search-box {
        min-width: 100%;
        width: 100%;
    }

    .cod-contabil-toolbar .search-box input {
        font-size: 0.9rem;
        padding: 0.75rem 0.875rem 0.75rem 2.5rem;
        height: 42px;
    }

    .filter-select {
        width: 100%;
    }
}