:root {
    --bs-primary: #0d6efd;
    --border-color: #dee2e6;
}
body {
    font-family: 'Inter', sans-serif;
    background-color: #f7fafc;
}
.app-shell {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}
.sticky-header {
    position: sticky;
    top: 0;
    z-index: 1030;
    background-color: #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,.08);
}
.topbar {
    border-bottom: 1px solid var(--border-color);
}
.navbar-brand img {
    max-height: 50px;
}
.navbar .nav-link {
    color: #495057;
    font-weight: 500;
}
.navbar .nav-link.active {
    color: var(--bs-primary);
}
.navbar .nav-link .fa-fw {
    margin-right: 8px;
}
.user-avatar {
    width: 40px;
    height: 40px;
    cursor: pointer;
}
.page-header {
    margin-bottom: 2rem;
}
.scrollable-content {
    flex-grow: 1;
    overflow-y: auto;
}
.nav-tabs .nav-link.active {
    background-color: #f7fafc;
    border-bottom-color: #f7fafc;
}

/* Modal button spacing */
.modal-footer {
    gap: 0.5rem;
}

/* Document Preview Styles from Mockup */
.invoice-preview { font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; font-size: 14px; color: #333; }
.invoice-preview-header { padding: 30px; border-bottom: 1px solid var(--border-color); }
.invoice-preview-meta { background-color: #f8f9fa; padding: 10px 15px; border-radius: 6px; }
.invoice-preview-body { padding: 30px; }
.invoice-preview-table { width: 100%; border-collapse: collapse; }
.invoice-preview-table th { background-color: #f8f9fa; padding: 12px; text-align: left; border-bottom: 2px solid #dee2e6; color: #212529; }
.invoice-preview-table td { padding: 12px; border-bottom: 1px solid #eee; }
.invoice-preview-totals { margin-left: auto; } /* Removed min-width to allow wrapping */
.invoice-preview-totals td { border: none; }
.invoice-preview-totals .total-ttc { background-color: #2c3e50; color: white; font-size: 1.2em; font-weight: bold; }
.invoice-preview-words { border: 1px solid var(--border-color); padding: 15px; border-radius: 6px; margin-top: 1rem; }
.invoice-preview-footer { background: #f8f9fa; color: #6c757d; padding: 20px 30px; text-align: center; font-size: 0.8em; border-top: 1px solid var(--border-color); }

/* --- NEW DARK MODE PALETTE --- */
[data-bs-theme="dark"] {
    --border-color: #444444; /* New border color */
}

[data-bs-theme="dark"] body {
    background-color: #121212; /* New main background */
    color: #E0E0E0; /* New primary text color */
}

[data-bs-theme="dark"] .text-muted,
[data-bs-theme="dark"] .card-subtitle {
    color: #B0B0B0 !important; /* New secondary text color */
}

/* Update surfaces like cards, modals, and headers */
[data-bs-theme="dark"] .card,
[data-bs-theme="dark"] .modal-content,
[data-bs-theme="dark"] .sticky-header,
[data-bs-theme="dark"] .nav-tabs .nav-link.active {
    background-color: #1E1E1E; /* Slightly lighter than main bg for elevation */
    color: #E0E0E0;
}

[data-bs-theme="dark"] .nav-tabs .nav-link {
    color: #B0B0B0; /* Secondary text for inactive tabs */
}

/* Keep navbar distinct */
[data-bs-theme="dark"] .bg-light {
    background-color: #212529 !important; /* Override Bootstrap's light bg in dark mode */
}

[data-bs-theme="dark"] .navbar .nav-link {
    color: #E0E0E0; /* Primary text for nav links */
}

[data-bs-theme="dark"] .navbar .nav-link.active {
    color: #fff; /* Keep active link bright */
}

[data-bs-theme="dark"] .navbar-toggler {
    border-color: #444444;
}

[data-bs-theme="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%28224, 224, 224, 0.85%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

[data-bs-theme="dark"] .dropdown-menu {
    background-color: #1E1E1E; /* Surface color */
    border-color: #444444; /* Border color */
}

[data-bs-theme="dark"] .dropdown-item {
    color: #E0E0E0; /* Primary text */
}

[data-bs-theme="dark"] .dropdown-item:hover,
[data-bs-theme="dark"] .dropdown-item:focus {
    background-color: #444444; /* Use border color as hover */
    color: #fff;
}

/* Add a specific rule for table hover in dark mode for better feedback */
[data-bs-theme="dark"] .table-hover > tbody > tr:hover > * {
    background-color: #2a2a2a;
}