/* ===== CSS Variables ===== */
:root {
    --primary: #4f46e5;
    --primary-dark: #4338ca;
    --primary-light: #818cf8;
    --secondary: #0ea5e9;
    --success: #10b981;
    --warning: #f59e0b;
    --warning-dark: #d97706;
    --danger: #ef4444;
    --danger-dark: #dc2626;
    
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.1), 0 10px 10px -5px rgba(0,0,0,0.04);
    
    --transition: all 0.2s ease;
}

/* ===== Reset & Base ===== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: linear-gradient(135deg, var(--gray-50) 0%, var(--gray-100) 100%);
    min-height: 100vh;
    color: var(--gray-800);
    line-height: 1.6;
    padding: 20px;
}

@media (max-width: 768px) {
    body {
        padding: 12px;
    }
}

/* ===== Typography ===== */
h1 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 0.5rem;
}

h2 {
    font-size: 1.35rem;
    font-weight: 600;
    color: var(--gray-800);
    margin-bottom: 1rem;
}

h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--gray-800);
}

@media (max-width: 480px) {
    h1 { font-size: 1.5rem; }
    h2 { font-size: 1.2rem; }
}

/* ===== Links ===== */
a {
    color: var(--primary);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 500;
    padding: 8px 0;
    margin-bottom: 16px;
}

.back-link:hover {
    gap: 10px;
}

/* ===== Buttons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    font-size: 0.95rem;
    font-weight: 600;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    box-shadow: 0 4px 14px rgba(79, 70, 229, 0.4);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(79, 70, 229, 0.5);
}

.btn-secondary {
    background: var(--gray-100);
    color: var(--gray-700);
    border: 1px solid var(--gray-300);
}

.btn-secondary:hover {
    background: var(--gray-200);
}

.btn-success {
    background: linear-gradient(135deg, var(--success) 0%, #059669 100%);
    color: white;
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger) 0%, var(--danger-dark) 100%);
    color: white;
}

.btn-sm {
    padding: 8px 14px;
    font-size: 0.85rem;
}

.btn-block {
    width: 100%;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

@media (max-width: 480px) {
    .btn {
        padding: 10px 16px;
        font-size: 0.9rem;
    }
}

/* ===== Cards ===== */
.card {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    padding: 24px;
    margin-bottom: 20px;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--gray-200);
}

.card-title {
    margin: 0;
}

/* Card Header Flex */
.card-header-flex {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--gray-200);
}

.card-header-flex h2 {
    margin: 0;
    font-size: 1.25rem;
}

@media (max-width: 480px) {
    .card {
        padding: 16px;
        border-radius: var(--radius-md);
    }
}

/* ===== Page Header ===== */
.page-header {
    background: white;
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-md);
}

.page-header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}

@media (max-width: 600px) {
    .page-header {
        padding: 16px;
    }
    
    .page-header-content {
        flex-direction: column;
        align-items: stretch;
    }
    
    .page-header-content .btn {
        width: 100%;
    }
}

/* ===== Forms ===== */
.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--gray-700);
    margin-bottom: 6px;
}

.form-control {
    width: 100%;
    padding: 12px 14px;
    font-size: 1rem;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-md);
    background: white;
    transition: var(--transition);
    -webkit-appearance: none;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.form-control::placeholder {
    color: var(--gray-400);
}

select.form-control {
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%236b7280'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 20px;
    padding-right: 40px;
}

textarea.form-control {
    min-height: 100px;
    resize: vertical;
}

/* Radio & Checkbox */
.radio-group {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 8px;
}

.radio-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: var(--gray-50);
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
    font-weight: 500;
}

.radio-item:hover {
    border-color: var(--primary-light);
    background: white;
}

.radio-item input[type="radio"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
    cursor: pointer;
}

.radio-item.active,
.radio-item:has(input:checked) {
    border-color: var(--primary);
    background: rgba(79, 70, 229, 0.05);
    color: var(--primary-dark);
}

@media (max-width: 480px) {
    .radio-group {
        flex-direction: column;
    }
    
    .radio-item {
        width: 100%;
    }
}

/* ===== Modal ===== */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1000;
    overflow-y: auto;
    padding: 20px;
}

.modal.active {
    display: flex;
    align-items: flex-start;
    justify-content: center;
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(17, 24, 39, 0.7);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    animation: fadeIn 0.2s ease;
}

.modal-container {
    position: relative;
    width: 100%;
    max-width: 600px;
    margin: 20px auto;
    z-index: 1001;
    animation: slideUp 0.3s ease;
}

.modal-content {
    background: white;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--gray-200);
    position: sticky;
    top: 0;
    background: white;
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    z-index: 10;
}

.modal-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--gray-900);
    margin: 0;
}

.modal-close {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gray-100);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: var(--transition);
    font-size: 1.25rem;
    color: var(--gray-600);
}

.modal-close:hover {
    background: var(--gray-200);
    color: var(--gray-900);
    transform: rotate(90deg);
}

.modal-body {
    padding: 24px;
    padding-bottom: 100px;
}

.modal-footer {
    display: flex;
    gap: 12px;
    padding: 20px 24px;
    border-top: 1px solid var(--gray-200);
    position: sticky;
    bottom: 0;
    background: var(--gray-50);
    border-radius: 0 0 var(--radius-xl) var(--radius-xl);
    z-index: 10;
}

.modal-footer .btn {
    flex: 1;
}

@media (max-width: 600px) {
    .modal {
        padding: 0;
    }
    
    .modal-container {
        margin: 0;
        max-width: 100%;
        width: 100%;
        min-height: 100vh;
    }
    
    .modal-content {
        border-radius: 0;
        min-height: 100vh;
        max-height: 100vh;
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
    }
    
    .modal-header {
        border-radius: 0;
        padding: 16px;
    }
    
    .modal-body {
        padding: 16px;
        padding-bottom: 140px;
        overflow-x: hidden;
        max-width: 100%;
    }
    
    .modal-footer {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        border-radius: 0;
        flex-direction: column;
        padding: 16px;
        box-shadow: 0 -4px 20px rgba(0,0,0,0.1);
    }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===== Tables ===== */
.table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 -24px;
    padding: 0 24px;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

th, td {
    padding: 14px 12px;
    text-align: left;
    border-bottom: 1px solid var(--gray-200);
}

th {
    background: var(--gray-50);
    font-weight: 600;
    color: var(--gray-700);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
    position: sticky;
    top: 0;
}

tr:hover td {
    background: var(--gray-50);
}

td {
    color: var(--gray-700);
}

/* Mobile cards for tables */
@media (max-width: 900px) {
    .table-wrapper {
        margin: 0;
        padding: 0;
    }
    
    .responsive-table {
        display: none;
    }
    
    .mobile-cards {
        display: block;
    }
}

@media (min-width: 901px) {
    .mobile-cards {
        display: none;
    }
}

.doc-card {
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-md);
    padding: 16px;
    margin-bottom: 12px;
}

.doc-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--gray-100);
}

.doc-card-category {
    display: inline-block;
    padding: 4px 10px;
    background: var(--primary);
    color: white;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.doc-card-date {
    font-size: 0.85rem;
    color: var(--gray-500);
}

.doc-card-partner {
    font-weight: 600;
    font-size: 1.05rem;
    color: var(--gray-900);
    margin-bottom: 8px;
}

.doc-card-row {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    font-size: 0.9rem;
}

.doc-card-label {
    color: var(--gray-500);
}

.doc-card-value {
    font-weight: 500;
    color: var(--gray-800);
}

.doc-card-value.danger {
    color: var(--danger);
}

.doc-card-value.success {
    color: var(--success);
}

.doc-card-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--gray-100);
}

.doc-card-actions .btn {
    flex: 1;
}

/* ===== Firm Cards Grid ===== */
.firms-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.firm-card {
    background: white;
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--gray-100);
    transition: var(--transition);
    display: flex;
    flex-direction: column;
}

.firm-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-light);
}

.firm-card-icon {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin-bottom: 16px;
}

.firm-card h3 {
    margin-bottom: 12px;
    color: var(--gray-900);
}

.firm-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

.firm-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    background: var(--gray-100);
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--gray-600);
}

.firm-badge.tva-yes {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

.firm-badge.tva-no {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning);
}

.firm-card-link {
    margin-top: auto;
    padding-top: 16px;
    border-top: 1px solid var(--gray-100);
}

.firm-card-link a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-weight: 600;
}

.firm-card-link a:hover {
    text-decoration: none;
    gap: 8px;
}

.firm-card-header-actions {
    position: absolute;
    top: 12px;
    right: 12px;
    display: flex;
    gap: 6px;
    opacity: 0;
    transition: var(--transition);
}

.firm-card:hover .firm-card-header-actions {
    opacity: 1;
}

.firm-card {
    position: relative;
}

.firm-rate {
    font-size: 0.85rem;
    color: var(--gray-600);
    margin-top: 8px;
    padding: 6px 10px;
    background: var(--gray-50);
    border-radius: var(--radius-sm);
    display: inline-block;
}

/* ===== Icon Buttons ===== */
.btn-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.9rem;
}

.btn-icon:hover {
    background: var(--gray-100);
    border-color: var(--gray-300);
    transform: scale(1.05);
}

.btn-icon-danger:hover {
    background: rgba(239, 68, 68, 0.1);
    border-color: var(--danger);
}

/* ===== Form Row (side by side) ===== */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

@media (max-width: 480px) {
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .firm-card-header-actions {
        opacity: 1;
    }
}

/* ===== Dashboard Menu ===== */
.dashboard-menu {
    list-style: none;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
}

.dashboard-menu li a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    background: white;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-200);
    transition: var(--transition);
    font-weight: 500;
}

.dashboard-menu li a:hover {
    text-decoration: none;
    transform: translateX(4px);
    border-color: var(--primary);
    box-shadow: var(--shadow-md);
}

.dashboard-menu li a .icon {
    font-size: 1.25rem;
}

/* ===== Dropzone ===== */
.dropzone {
    border: 2px dashed var(--gray-300);
    border-radius: var(--radius-lg);
    padding: 32px 20px;
    text-align: center;
    background: var(--gray-50);
    transition: var(--transition);
    cursor: pointer;
    max-width: 100%;
    box-sizing: border-box;
}

.dropzone:hover,
.dropzone.dragover {
    border-color: var(--primary);
    background: rgba(79, 70, 229, 0.05);
}

.dropzone-icon {
    font-size: 2.5rem;
    margin-bottom: 12px;
}

.dropzone-text {
    color: var(--gray-600);
    font-size: 0.95rem;
}

.dropzone input[type="file"] {
    display: none;
}

.dropzone-browse {
    color: var(--primary);
    font-weight: 600;
    cursor: pointer;
}

/* ===== Preview ===== */
.preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 12px;
    margin-top: 16px;
    max-width: 100%;
}

.preview-item {
    position: relative;
    background: var(--gray-100);
    border-radius: var(--radius-md);
    overflow: hidden;
    aspect-ratio: 1;
}

.preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.preview-item-pdf {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 12px;
    font-size: 0.75rem;
    text-align: center;
    color: var(--gray-600);
}

.preview-item-pdf .icon {
    font-size: 2rem;
    margin-bottom: 6px;
}

.preview-remove {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 28px;
    height: 28px;
    background: var(--danger);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    opacity: 1;
    transition: var(--transition);
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

.preview-remove:hover {
    transform: scale(1.1);
    background: var(--danger-dark);
}

/* Make preview items clickable for zoom */
.preview-item {
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.preview-item:hover {
    transform: scale(1.03);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.preview-item img {
    pointer-events: none;
}

/* ===== Image Lightbox ===== */
.lightbox {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.95);
    z-index: 10000;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.lightbox.active {
    display: flex;
}

.lightbox img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: var(--radius-md);
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.5);
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    color: white;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.lightbox-close:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: white;
}

.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 50px;
    height: 80px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    font-size: 28px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.lightbox-nav:hover {
    background: rgba(255, 255, 255, 0.2);
}

.lightbox-nav.prev {
    left: 10px;
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

.lightbox-nav.next {
    right: 10px;
    border-radius: var(--radius-md) 0 0 var(--radius-md);
}

.lightbox-counter {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    color: white;
    font-size: 14px;
    background: rgba(0, 0, 0, 0.5);
    padding: 8px 16px;
    border-radius: 20px;
}

/* Lightbox Actions */
.lightbox-actions {
    position: absolute;
    bottom: 70px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 16px;
    z-index: 10;
}

.lightbox-action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: 30px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    border: 2px solid transparent;
}

.lightbox-btn-delete {
    background: var(--danger);
    color: white;
}

.lightbox-btn-delete:hover {
    background: var(--danger-dark);
    transform: scale(1.05);
}

.lightbox-btn-retake {
    background: rgba(255,255,255,0.15);
    color: white;
    border-color: rgba(255,255,255,0.3);
}

.lightbox-btn-retake:hover {
    background: rgba(255,255,255,0.25);
    border-color: white;
    transform: scale(1.05);
}

@media (max-width: 600px) {
    .lightbox-actions {
        bottom: 80px;
        gap: 12px;
    }
    
    .lightbox-action-btn {
        padding: 10px 18px;
        font-size: 13px;
    }
}

/* ===== Camera ===== */
.camera-section {
    margin-bottom: 20px;
    max-width: 100%;
    overflow: hidden;
}

.camera-buttons {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.camera-wrapper {
    position: relative;
    display: none;
    max-width: 100%;
    overflow: hidden;
}

.camera-wrapper.active {
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    max-width: 100%;
    z-index: 9999;
    background: #000;
    border-radius: 0;
}

.camera-wrapper video,
.camera-video {
    width: 100%;
    max-width: 100%;
    height: auto;
    border-radius: var(--radius-md);
    background: var(--gray-900);
    display: block;
}

.camera-wrapper.active video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 0;
}

.camera-capture-overlay {
    position: absolute;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
}

.btn-capture {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: white;
    border: 4px solid var(--gray-300);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}

.btn-capture:hover {
    transform: scale(1.1);
}

.btn-capture:active {
    transform: scale(0.95);
    background: var(--gray-100);
}

.btn-capture-inner {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--danger);
    transition: var(--transition);
}

.btn-capture:hover .btn-capture-inner {
    background: var(--danger-dark);
}

.camera-controls {
    position: absolute;
    top: 12px;
    right: 12px;
    display: flex;
    gap: 8px;
    z-index: 10;
}

.btn-camera-control {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(0,0,0,0.5);
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    transition: var(--transition);
}

.btn-camera-control:hover {
    background: rgba(0,0,0,0.7);
}

.btn-camera-control.active {
    background: var(--warning);
    color: var(--gray-900);
}

/* ===== Camera Flash Effect ===== */
.camera-flash-effect {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: white;
    opacity: 0;
    pointer-events: none;
    z-index: 50;
    transition: opacity 0.15s ease-out;
}

.camera-flash-effect.active {
    opacity: 0.6;
    transition: none;
}

/* ===== Camera Thumbnails Overlay ===== */
.camera-thumbs-overlay {
    position: absolute;
    bottom: 100px;
    left: 10px;
    right: 10px;
    display: flex;
    gap: 8px;
    flex-wrap: nowrap;
    justify-content: center;
    z-index: 30;
    overflow-x: auto;
    padding: 8px;
    -webkit-overflow-scrolling: touch;
}

.camera-thumb {
    width: 50px;
    height: 50px;
    min-width: 50px;
    border-radius: 8px;
    border: 2px solid white;
    box-shadow: 0 2px 10px rgba(0,0,0,0.5);
    object-fit: cover;
    cursor: pointer;
    transition: transform 0.2s ease;
    background: var(--gray-800);
}

.camera-thumb:hover {
    transform: scale(1.15);
}

.camera-thumb-count {
    position: absolute;
    bottom: 100px;
    right: 15px;
    background: var(--primary);
    color: white;
    min-width: 32px;
    height: 32px;
    padding: 0 8px;
    border-radius: 16px;
    font-size: 14px;
    font-weight: 700;
    z-index: 31;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.4);
}

@media (max-width: 600px) {
    .camera-thumbs-overlay {
        bottom: 110px;
        gap: 6px;
    }
    
    .camera-thumb {
        width: 44px;
        height: 44px;
        min-width: 44px;
    }
    
    .camera-thumb-count {
        bottom: 115px;
        min-width: 28px;
        height: 28px;
        font-size: 12px;
    }
}

@media (max-width: 600px) {
    .btn-capture {
        width: 72px;
        height: 72px;
    }
    
    .btn-capture-inner {
        width: 56px;
        height: 56px;
    }
}

/* ===== Scan Handles (Document Corner Points) ===== */
.scan-handle {
    position: absolute;
    width: 32px;
    height: 32px;
    background: rgba(0, 209, 255, 0.9);
    border: 3px solid white;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    cursor: grab;
    z-index: 20;
    display: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
    transition: transform 0.1s ease, background 0.2s ease;
    /* CRITICAL: Prevent scroll when dragging */
    touch-action: none;
    -webkit-user-select: none;
    user-select: none;
}

.scan-handle.active {
    display: block;
}

.scan-handle:hover {
    background: rgba(0, 255, 128, 0.9);
    transform: translate(-50%, -50%) scale(1.2);
}

.scan-handle:active {
    cursor: grabbing;
    background: rgba(255, 200, 0, 0.9);
    transform: translate(-50%, -50%) scale(1.1);
}

/* Labels for corners */
.scan-handle[data-h="0"]::after { content: "1"; }
.scan-handle[data-h="1"]::after { content: "2"; }
.scan-handle[data-h="2"]::after { content: "3"; }
.scan-handle[data-h="3"]::after { content: "4"; }

.scan-handle::after {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 11px;
    font-weight: bold;
    color: white;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
    pointer-events: none;
}

@media (max-width: 600px) {
    .scan-handle {
        width: 44px;
        height: 44px;
        border-width: 4px;
    }
    
    .scan-handle::after {
        font-size: 14px;
    }
}

/* ===== Status Badges ===== */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

.badge-warning {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning);
}

.badge-danger {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

.badge-primary {
    background: rgba(79, 70, 229, 0.1);
    color: var(--primary);
}

.badge-secondary {
    background: var(--gray-100);
    color: var(--gray-600);
}

.badge-info {
    background: rgba(14, 165, 233, 0.1);
    color: var(--secondary);
}

/* ===== Separator ===== */
.separator {
    height: 1px;
    background: var(--gray-200);
    margin: 24px 0;
}

/* ===== Month Select ===== */
.month-select-wrapper {
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.month-select {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    background: white;
    padding: 8px 12px 8px 16px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-200);
}

.month-select label {
    font-weight: 600;
    color: var(--gray-700);
    font-size: 0.9rem;
}

.month-select select {
    padding: 8px 32px 8px 12px;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    cursor: pointer;
    background: white;
}

/* Export Buttons Group */
.export-buttons {
    display: flex;
    gap: 8px;
    background: white;
    padding: 6px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-200);
}

.btn-export {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    font-size: 0.85rem;
    font-weight: 600;
    border: none;
    border-radius: var(--radius-sm);
    text-decoration: none;
    transition: var(--transition);
    cursor: pointer;
}

.btn-export .export-icon {
    font-size: 1rem;
}

.btn-export .export-text {
    font-size: 0.85rem;
}

/* Excel Button - Green */
.btn-export-excel {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    box-shadow: 0 2px 6px rgba(16, 185, 129, 0.25);
}

.btn-export-excel:hover {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    color: white;
    text-decoration: none;
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(16, 185, 129, 0.35);
}

/* CSV Button - Gray/Secondary */
.btn-export-csv {
    background: var(--gray-100);
    color: var(--gray-700);
    border: 1px solid var(--gray-300);
}

.btn-export-csv:hover {
    background: var(--gray-200);
    color: var(--gray-800);
    text-decoration: none;
    transform: translateY(-1px);
}

@media (max-width: 600px) {
    .month-select-wrapper {
        flex-direction: column;
        align-items: stretch;
    }
    
    .month-select {
        width: 100%;
        justify-content: space-between;
    }
    
    .export-buttons {
        width: 100%;
        justify-content: center;
    }
    
    .btn-export {
        flex: 1;
        justify-content: center;
        padding: 10px 12px;
    }
}

/* ===== TVA Report ===== */
.tva-report {
    margin-bottom: 20px;
    padding: 0;
    overflow: visible;
}

.tva-report-header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    padding: 16px 24px;
    margin: -24px -24px 20px -24px;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.tva-report-header h3 {
    color: white;
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
}

.tva-report-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

.tva-card {
    display: flex;
    align-items: center;
    gap: 14px;
    background: var(--gray-50);
    padding: 16px;
    border-radius: var(--radius-md);
    border: 1px solid var(--gray-200);
    transition: var(--transition);
}

.tva-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.tva-card-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    flex-shrink: 0;
    background: white;
    box-shadow: var(--shadow-sm);
}

.tva-card-content {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.tva-card-label {
    font-size: 0.7rem;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 700;
    margin-bottom: 2px;
}

.tva-card-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--gray-900);
    line-height: 1.2;
}

.tva-card-sub {
    font-size: 0.75rem;
    color: var(--gray-400);
    margin-top: 4px;
}

/* Card variants */
.tva-card-income {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.08) 0%, rgba(16, 185, 129, 0.02) 100%);
    border-color: rgba(16, 185, 129, 0.2);
}

.tva-card-income .tva-card-icon {
    background: var(--success);
    color: white;
}

.tva-card-income .tva-card-value {
    color: var(--success);
}

.tva-card-expense {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.08) 0%, rgba(245, 158, 11, 0.02) 100%);
    border-color: rgba(245, 158, 11, 0.2);
}

.tva-card-expense .tva-card-icon {
    background: var(--warning);
    color: white;
}

.tva-card-expense .tva-card-value {
    color: var(--warning-dark);
}

.tva-card-utility {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.08) 0%, rgba(99, 102, 241, 0.02) 100%);
    border-color: rgba(99, 102, 241, 0.2);
}

.tva-card-utility .tva-card-icon {
    background: var(--primary);
    color: white;
}

.tva-card-utility .tva-card-value {
    color: var(--primary);
}

.tva-card-topay {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.08) 0%, rgba(239, 68, 68, 0.02) 100%);
    border-color: rgba(239, 68, 68, 0.2);
}

.tva-card-topay .tva-card-icon {
    background: var(--danger);
    color: white;
}

.tva-card-topay .tva-card-value {
    color: var(--danger);
}

.tva-card-torecover {
    background: linear-gradient(135deg, rgba(14, 165, 233, 0.08) 0%, rgba(14, 165, 233, 0.02) 100%);
    border-color: rgba(14, 165, 233, 0.2);
}

.tva-card-torecover .tva-card-icon {
    background: var(--secondary);
    color: white;
}

.tva-card-torecover .tva-card-value {
    color: var(--secondary);
}

.tva-card-info {
    grid-column: 1 / -1;
    background: linear-gradient(135deg, rgba(107, 114, 128, 0.08) 0%, rgba(107, 114, 128, 0.02) 100%);
    border-color: rgba(107, 114, 128, 0.2);
}

.tva-card-info .tva-card-icon {
    background: var(--gray-500);
    color: white;
}

/* Table totals row */
.totals-row {
    background: var(--gray-100);
    border-top: 2px solid var(--gray-300);
}

.totals-row td {
    padding-top: 14px;
    padding-bottom: 14px;
    font-weight: 600;
}

/* Mobile totals card */
.totals-card {
    background: var(--gray-100);
    border: 2px solid var(--gray-300);
}

@media (max-width: 1200px) {
    .tva-report-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 600px) {
    .tva-report-header {
        margin: -16px -16px 16px -16px;
        padding: 14px 16px;
    }
    
    .tva-report-grid {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }
    
    .tva-card {
        padding: 12px;
        flex-direction: column;
        text-align: center;
        gap: 10px;
    }
    
    .tva-card-icon {
        width: 40px;
        height: 40px;
        font-size: 1.1rem;
    }
    
    .tva-card-value {
        font-size: 1rem;
    }
    
    .tva-card-info {
        flex-direction: row;
        text-align: left;
    }
}

@media (max-width: 400px) {
    .tva-report-grid {
        grid-template-columns: 1fr;
    }
    
    .tva-card {
        flex-direction: row;
        text-align: left;
    }
}

/* ===== Empty State ===== */
.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--gray-500);
}

.empty-state-icon {
    font-size: 3rem;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state-text {
    font-size: 1.1rem;
}

/* ===== Utilities ===== */
.text-success { color: var(--success) !important; }
.text-danger { color: var(--danger) !important; }
.text-warning { color: var(--warning) !important; }
.text-muted { color: var(--gray-500) !important; }

.font-bold { font-weight: 700 !important; }
.font-semibold { font-weight: 600 !important; }

.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }

.flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }

/* ===== Login Page ===== */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-container {
    width: 100%;
    max-width: 420px;
}

.login-card {
    background: white;
    border-radius: var(--radius-xl);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    overflow: hidden;
    animation: slideUp 0.4s ease;
}

.login-header {
    text-align: center;
    padding: 40px 40px 20px;
    background: linear-gradient(135deg, var(--gray-50) 0%, white 100%);
}

.login-logo {
    width: 72px;
    height: 72px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    margin: 0 auto 20px;
    box-shadow: 0 10px 30px rgba(79, 70, 229, 0.3);
}

.login-header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 8px;
}

.login-header p {
    color: var(--gray-500);
    font-size: 0.95rem;
}

.login-form {
    padding: 30px 40px;
}

.login-footer {
    text-align: center;
    padding: 20px 40px 30px;
    border-top: 1px solid var(--gray-100);
}

.login-footer p {
    color: var(--gray-400);
    font-size: 0.85rem;
    margin: 0;
}

/* Input with icon */
.input-icon-wrapper {
    position: relative;
}

.input-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.1rem;
    pointer-events: none;
    z-index: 1;
}

.form-control-icon {
    padding-left: 46px;
}

/* Alerts */
.alert {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 20px;
    margin: 0 40px;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-weight: 500;
}

.alert-danger {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.alert-success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.alert-icon {
    font-size: 1.1rem;
}

/* Large button variant */
.btn-lg {
    padding: 14px 24px;
    font-size: 1rem;
}

@media (max-width: 480px) {
    .login-page {
        padding: 0;
        align-items: stretch;
    }
    
    .login-container {
        max-width: 100%;
    }
    
    .login-card {
        min-height: 100vh;
        border-radius: 0;
        display: flex;
        flex-direction: column;
    }
    
    .login-header {
        padding: 50px 24px 24px;
    }
    
    .login-form {
        padding: 24px;
        flex: 1;
    }
    
    .login-footer {
        padding: 20px 24px 30px;
    }
    
    .alert {
        margin: 0 24px;
    }
}

/* ===== Bank Statements ===== */
.bank-statements-card {
    margin-top: 24px;
}

.bank-statements-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--gray-200);
}

.bank-statements-header h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--gray-800);
}

.bank-dropzone {
    border: 2px dashed var(--primary);
    background: rgba(99, 102, 241, 0.05);
    margin-bottom: 16px;
}

.bank-dropzone:hover {
    background: rgba(99, 102, 241, 0.1);
}

.bank-statements-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.bank-statement-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--gray-50);
    border-radius: var(--radius-md);
    border: 1px solid var(--gray-200);
    transition: var(--transition);
}

.bank-statement-item:hover {
    background: var(--gray-100);
    border-color: var(--gray-300);
}

.bank-statement-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
    flex: 1;
    overflow: hidden;
}

.bank-statement-link {
    font-weight: 500;
    color: var(--primary);
    text-decoration: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    display: block;
}

.bank-statement-link:hover {
    text-decoration: underline;
}

.bank-statement-date {
    font-size: 0.75rem;
    color: var(--gray-500);
}

.empty-state-small {
    padding: 24px;
    text-align: center;
    color: var(--gray-500);
}

.empty-state-small p {
    margin: 0;
}

/* No activity checkbox */
.no-activity-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: var(--gray-600);
    cursor: pointer;
}

.no-activity-checkbox input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
}

/* ===== Table Totals Row ===== */
.totals-row {
    background: var(--gray-100);
    border-top: 2px solid var(--gray-300);
}

.totals-row td {
    padding-top: 14px !important;
    padding-bottom: 14px !important;
    font-weight: 600;
}

/* ===== Mobile Totals Card ===== */
.totals-card {
    background: var(--gray-100);
    border: 2px solid var(--gray-300);
}

/* ===== Missing Statements Alert ===== */
.missing-statements-alert {
    background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
    border: 2px solid var(--danger);
    border-radius: var(--radius-lg);
    padding: 20px 24px;
    margin-bottom: 24px;
}

.missing-statements-alert h3 {
    color: var(--danger);
    margin: 0 0 12px 0;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.missing-statements-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.missing-firm-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: white;
    border: 1px solid var(--danger);
    border-radius: var(--radius-md);
    color: var(--danger);
    font-weight: 600;
    font-size: 0.9rem;
    text-decoration: none;
    transition: var(--transition);
}

.missing-firm-badge:hover {
    background: var(--danger);
    color: white;
}

/* ===== Stats Grid ===== */
.stats-grid {
    display: grid !important;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-top: 24px;
    margin-bottom: 24px;
}

@media (max-width: 1100px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 600px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
}

.stat-card {
    display: flex !important;
    align-items: center;
    gap: 16px;
    background: white;
    padding: 20px 24px;
    border-radius: 16px;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
    border: 1px solid #e5e7eb;
    transition: all 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
}

.stat-card .stat-icon {
    width: 56px;
    height: 56px;
    min-width: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    background: #f3f4f6;
    border-radius: 10px;
}

.stat-card .stat-content {
    display: flex;
    flex-direction: column;
}

.stat-card .stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: #111827;
    line-height: 1.2;
}

.stat-card .stat-label {
    font-size: 0.85rem;
    color: #6b7280;
    font-weight: 500;
}

.stat-card.stat-card-warning .stat-icon {
    background: rgba(245, 158, 11, 0.1);
}

.stat-card.stat-card-warning .stat-value {
    color: #f59e0b;
}

.stat-card.stat-card-success .stat-icon {
    background: rgba(16, 185, 129, 0.1);
}

.stat-card.stat-card-success .stat-value {
    color: #10b981;
}

.stat-card.stat-card-danger .stat-icon {
    background: rgba(239, 68, 68, 0.1);
}

.stat-card.stat-card-danger .stat-value {
    color: #ef4444;
}

@media (max-width: 600px) {
    .bank-statements-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .bank-statement-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    .bank-statement-item .btn {
        align-self: flex-end;
    }
    
    .bank-statement-info {
        width: 100%;
        max-width: 100%;
    }
    
    .bank-statement-link {
        max-width: calc(100vw - 100px);
    }
    
    .missing-statements-alert {
        padding: 16px;
    }
    
    /* Camera fixes for mobile */
    .camera-section {
        max-width: 100%;
        overflow: hidden;
    }
    
    .camera-wrapper {
        max-width: 100%;
    }
    
    .camera-wrapper video {
        max-width: 100%;
        width: 100%;
    }
    
    /* Modal body overflow fix */
    .modal-body {
        overflow-x: hidden;
    }
    
    /* Preview grid fix */
    .preview-grid {
        max-width: 100%;
    }
    
    .preview-item {
        max-width: 100%;
    }
}

/* ===== Accountant Notes ===== */
.accountant-notes-card {
    margin-top: 24px;
}

.accountant-notes-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--gray-200);
}

.accountant-notes-header h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--gray-800);
}

.add-note-form {
    background: var(--gray-50);
    padding: 16px;
    border-radius: var(--radius-md);
    margin-bottom: 16px;
    border: 1px solid var(--gray-200);
}

.add-note-form .form-group {
    margin-bottom: 12px;
}

.add-note-form .form-group:last-of-type {
    margin-bottom: 12px;
}

.add-note-form textarea {
    min-height: 60px;
    resize: vertical;
}

.accountant-notes-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.accountant-note-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px;
    background: white;
    border-radius: var(--radius-md);
    border: 2px solid var(--gray-200);
    transition: var(--transition);
}

.accountant-note-item:hover {
    border-color: var(--gray-300);
}

.accountant-note-item.resolved {
    opacity: 0.7;
    background: var(--gray-50);
}

.accountant-note-item.resolved .note-text {
    text-decoration: line-through;
    color: var(--gray-500);
}

/* Culori pe tip */
.accountant-note-item.note-type-lipsa_document {
    border-left: 4px solid var(--danger);
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.03) 0%, white 100%);
}

.accountant-note-item.note-type-urgent {
    border-left: 4px solid var(--warning);
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.03) 0%, white 100%);
}

.accountant-note-item.note-type-observatie {
    border-left: 4px solid var(--secondary);
    background: linear-gradient(135deg, rgba(14, 165, 233, 0.03) 0%, white 100%);
}

.note-icon {
    font-size: 1.25rem;
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.note-content {
    flex: 1;
    min-width: 0;
}

.note-firm-name {
    font-size: 0.85rem;
    margin-bottom: 4px;
}

.note-firm-name a {
    font-weight: 600;
    color: var(--primary);
}

.note-firm-name a:hover {
    text-decoration: underline;
}

.note-text {
    font-size: 0.95rem;
    color: var(--gray-800);
    margin-bottom: 8px;
    line-height: 1.5;
}

.note-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    font-size: 0.75rem;
    color: var(--gray-500);
}

.note-meta span {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.note-resolved-badge {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 600;
}

.note-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

/* Alert pentru mențiuni nerezolvate */
.unresolved-notes-alert {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border: 2px solid var(--warning);
    border-radius: var(--radius-lg);
    padding: 20px 24px;
    margin-bottom: 24px;
}

.unresolved-notes-alert h3 {
    color: var(--warning-dark);
    margin: 0 0 12px 0;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.unresolved-notes-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 12px;
}

.unresolved-note-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: white;
    border: 1px solid var(--warning);
    border-radius: var(--radius-md);
    color: var(--gray-800);
    font-size: 0.9rem;
    text-decoration: none;
    transition: var(--transition);
}

.unresolved-note-badge:hover {
    background: var(--warning);
    color: white;
    text-decoration: none;
}

.unresolved-note-badge .note-firm {
    font-weight: 600;
    color: var(--warning-dark);
}

.unresolved-note-badge:hover .note-firm {
    color: white;
}

.unresolved-note-badge .note-preview {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--gray-600);
}

.unresolved-note-badge:hover .note-preview {
    color: rgba(255,255,255,0.9);
}

@media (max-width: 600px) {
    .accountant-note-item {
        flex-direction: column;
        gap: 8px;
    }
    
    .note-actions {
        align-self: flex-end;
    }
    
    .note-meta {
        flex-direction: column;
        gap: 4px;
    }
    
    .unresolved-note-badge {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* ===== Autocomplete Partner ===== */
.autocomplete-wrapper {
    position: relative;
}

.autocomplete-list {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 2px solid var(--primary);
    border-top: none;
    border-radius: 0 0 var(--radius-md) var(--radius-md);
    max-height: 200px;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: var(--shadow-lg);
    display: none;
}

.autocomplete-list.active {
    display: block;
}

.autocomplete-item {
    padding: 12px 14px;
    cursor: pointer;
    font-size: 0.95rem;
    border-bottom: 1px solid var(--gray-100);
    transition: var(--transition);
}

.autocomplete-item:last-child {
    border-bottom: none;
}

.autocomplete-item:hover,
.autocomplete-item.selected {
    background: var(--primary);
    color: white;
}

.autocomplete-item mark {
    background: rgba(255, 255, 0, 0.4);
    color: inherit;
    padding: 0 2px;
    border-radius: 2px;
}

.autocomplete-item.selected mark,
.autocomplete-item:hover mark {
    background: rgba(255, 255, 255, 0.3);
}

/* ===== Previous Months Alert ===== */
.prev-months-alert {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border: 2px solid #f59e0b;
    border-radius: var(--radius-lg);
    padding: 16px 20px;
    margin-bottom: 20px;
}

.prev-months-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.prev-months-icon {
    font-size: 1.25rem;
}

.prev-months-title {
    font-weight: 600;
    color: #92400e;
    font-size: 0.95rem;
}

.prev-months-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.prev-month-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: white;
    border: 1px solid #f59e0b;
    border-radius: var(--radius-md);
    color: #92400e;
    font-size: 0.85rem;
    font-weight: 500;
    text-decoration: none;
    transition: var(--transition);
}

.prev-month-badge:hover {
    background: #f59e0b;
    color: white;
    text-decoration: none;
}

.prev-month-badge:hover .prev-month-count {
    background: white;
    color: #f59e0b;
}

.prev-month-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 24px;
    padding: 0 8px;
    background: #f59e0b;
    color: white;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 700;
}

/* ===== Registered Checkbox ===== */
.registered-checkbox {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: var(--success);
}

.registered-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: var(--gray-100);
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.85rem;
    transition: var(--transition);
}

.registered-label:has(input:checked) {
    background: rgba(16, 185, 129, 0.1);
    border-color: var(--success);
    color: var(--success);
}

.btn-register-all {
    white-space: nowrap;
}

.text-center {
    text-align: center;
}

/* ===== Duplicate Alert ===== */
.duplicate-alert {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border: 2px solid var(--warning);
    border-radius: var(--radius-md);
    padding: 14px 16px;
    margin-top: 12px;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.duplicate-alert-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    color: var(--warning-dark);
    margin-bottom: 10px;
}

.duplicate-alert-header .icon {
    font-size: 1.25rem;
}

.duplicate-alert-close {
    margin-left: auto;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.1rem;
    color: var(--gray-500);
    padding: 4px;
    line-height: 1;
}

.duplicate-alert-close:hover {
    color: var(--gray-700);
}

.duplicate-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.duplicate-item {
    display: flex;
    align-items: center;
    gap: 12px;
    background: white;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--gray-200);
    font-size: 0.85rem;
}

.duplicate-item-type {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    flex-shrink: 0;
}

.duplicate-item-type.type-suma {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

.duplicate-item-type.type-doc_no {
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary);
}

.duplicate-item-info {
    flex: 1;
    min-width: 0;
}

.duplicate-item-partner {
    font-weight: 600;
    color: var(--gray-800);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.duplicate-item-details {
    font-size: 0.75rem;
    color: var(--gray-500);
    margin-top: 2px;
}

.duplicate-item-amount {
    font-weight: 700;
    color: var(--gray-900);
    white-space: nowrap;
}

/* Input cu loading */
.form-control.loading {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Cstyle%3E.spinner{animation:rotate 1s linear infinite;transform-origin:center}@keyframes rotate{100%{transform:rotate(360deg)}}%3C/style%3E%3Ccircle class='spinner' cx='12' cy='12' r='8' stroke='%234f46e5' stroke-width='2' fill='none' stroke-dasharray='50 14'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 20px;
}

/* Highlight câmp cu potențial duplicat */
.form-control.has-warning {
    border-color: var(--warning);
    background-color: rgba(245, 158, 11, 0.05);
}

@media (max-width: 600px) {
    .duplicate-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }
    
    .duplicate-item-amount {
        align-self: flex-end;
    }
}


