/* =================================
   FACTURES APP - STYLE
   Application de gestion de factures
   ================================= */

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

:root {
    --primary: #6366f1;
    --primary-light: #818cf8;
    --primary-dark: #4f46e5;
    --success: #10b981;
    --success-light: #d1fae5;
    --warning: #f59e0b;
    --warning-light: #fef3c7;
    --danger: #ef4444;
    --danger-light: #fee2e2;
    --info: #3b82f6;
    --info-light: #dbeafe;

    --bg-dark: #0f172a;
    --bg-card: #1e293b;
    --bg-input: #334155;
    --border: #334155;
    --border-light: #475569;

    --text: #f1f5f9;
    --text-muted: #94a3b8;
    --text-dark: #64748b;

    --sidebar-width: 260px;
    --header-height: 70px;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-dark);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

a {
    text-decoration: none;
    color: inherit;
}

/* =================================
   LOGIN PAGE
   ================================= */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--bg-dark) 0%, #1a1a2e 100%);
    padding: 2rem;
}

.login-container {
    width: 100%;
    max-width: 420px;
}

.login-logo {
    text-align: center;
    margin-bottom: 2rem;
}

.login-logo h1 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.login-logo h1 span {
    color: var(--primary);
}

.login-logo p {
    color: var(--text-muted);
    margin-top: 0.5rem;
}

.login-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 2.5rem;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
}

.login-card h2 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.login-card > p {
    color: var(--text-muted);
    margin-bottom: 2rem;
}

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

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.875rem 1rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 1rem;
    transition: all 0.2s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

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

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

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

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.875rem 1.5rem;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
}

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

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--bg-input);
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--border);
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-success:hover {
    background: #059669;
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
}

.btn-block {
    width: 100%;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
}

.btn-icon {
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: var(--radius-sm);
}

.login-footer {
    text-align: center;
    margin-top: 1.5rem;
    color: var(--text-muted);
}

.login-footer a {
    color: var(--primary);
    font-weight: 500;
}

/* =================================
   APP LAYOUT
   ================================= */
.app-layout {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-card);
    border-right: 1px solid var(--border);
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    z-index: 100;
}

.sidebar-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border);
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.25rem;
    font-weight: 700;
}

.sidebar-logo svg {
    width: 32px;
    height: 32px;
    color: var(--primary);
}

.sidebar-logo span {
    color: var(--primary);
}

.sidebar-nav {
    flex: 1;
    padding: 1.5rem 1rem;
    overflow-y: auto;
}

.nav-section {
    margin-bottom: 2rem;
}

.nav-section-title {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-dark);
    padding: 0 0.75rem;
    margin-bottom: 0.75rem;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    transition: all 0.2s ease;
    margin-bottom: 0.25rem;
}

.nav-link:hover {
    background: var(--bg-input);
    color: var(--text);
}

.nav-link.active {
    background: var(--primary);
    color: white;
}

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

.nav-link .badge {
    margin-left: auto;
    background: var(--danger);
    color: white;
    font-size: 0.7rem;
    padding: 0.15rem 0.5rem;
    border-radius: 50px;
}

.sidebar-footer {
    padding: 1rem;
    border-top: 1px solid var(--border);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    border-radius: var(--radius-sm);
    transition: background 0.2s ease;
}

.user-info:hover {
    background: var(--bg-input);
}

.user-avatar {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: white;
}

.user-details {
    flex: 1;
}

.user-name {
    font-weight: 600;
    font-size: 0.9rem;
}

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

/* Main Content */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.app-header {
    height: var(--header-height);
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    position: sticky;
    top: 0;
    z-index: 50;
}

.header-title h1 {
    font-size: 1.5rem;
    font-weight: 700;
}

.header-title p {
    font-size: 0.875rem;
    color: var(--text-muted);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.search-box {
    position: relative;
}

.search-box input {
    width: 280px;
    padding: 0.625rem 1rem 0.625rem 2.5rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 0.9rem;
}

.search-box svg {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    color: var(--text-dark);
}

.notification-btn {
    position: relative;
    width: 42px;
    height: 42px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.notification-btn:hover {
    background: var(--border);
}

.notification-btn svg {
    width: 20px;
    height: 20px;
    color: var(--text-muted);
}

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

/* Page Content */
.page-content {
    flex: 1;
    padding: 2rem;
}

/* =================================
   DASHBOARD
   ================================= */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 1.5rem;
    border: 1px solid var(--border);
}

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

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-icon.primary {
    background: rgba(99, 102, 241, 0.15);
    color: var(--primary);
}

.stat-icon.success {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success);
}

.stat-icon.warning {
    background: rgba(245, 158, 11, 0.15);
    color: var(--warning);
}

.stat-icon.danger {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger);
}

.stat-icon svg {
    width: 24px;
    height: 24px;
}

.stat-trend {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.8rem;
    font-weight: 600;
}

.stat-trend.up {
    color: var(--success);
}

.stat-trend.down {
    color: var(--danger);
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.stat-label {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Charts */
.charts-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.chart-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 1.5rem;
    border: 1px solid var(--border);
}

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

.chart-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
}

.chart-filters {
    display: flex;
    gap: 0.5rem;
}

.chart-filter-btn {
    padding: 0.4rem 0.8rem;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.chart-filter-btn:hover,
.chart-filter-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.chart-container {
    height: 300px;
}

/* Recent invoices */
.recent-section {
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border);
}

.section-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
}

.section-header a {
    color: var(--primary);
    font-size: 0.9rem;
    font-weight: 500;
}

/* =================================
   TABLES
   ================================= */
.table-container {
    overflow-x: auto;
}

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

.data-table th,
.data-table td {
    padding: 1rem 1.5rem;
    text-align: left;
}

.data-table th {
    background: var(--bg-input);
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.data-table td {
    border-bottom: 1px solid var(--border);
}

.data-table tbody tr:hover {
    background: rgba(99, 102, 241, 0.05);
}

.data-table .invoice-number {
    font-weight: 600;
    color: var(--primary);
}

.data-table .client-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.client-avatar {
    width: 36px;
    height: 36px;
    background: var(--bg-input);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.client-name {
    font-weight: 500;
}

.client-email {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.amount {
    font-weight: 600;
    font-family: 'JetBrains Mono', monospace;
}

/* Status badges */
.status {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 0.75rem;
    border-radius: 50px;
    font-size: 0.8rem;
    font-weight: 600;
}

.status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
}

.status.paid {
    background: var(--success-light);
    color: #065f46;
}

.status.paid .status-dot {
    background: var(--success);
}

.status.pending {
    background: var(--warning-light);
    color: #92400e;
}

.status.pending .status-dot {
    background: var(--warning);
}

.status.overdue {
    background: var(--danger-light);
    color: #991b1b;
}

.status.overdue .status-dot {
    background: var(--danger);
}

.status.draft {
    background: var(--bg-input);
    color: var(--text-muted);
}

.status.draft .status-dot {
    background: var(--text-dark);
}

/* Actions */
.actions {
    display: flex;
    gap: 0.5rem;
}

.action-btn {
    width: 34px;
    height: 34px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--text-muted);
}

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

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

/* =================================
   FILTERS & TOOLBAR
   ================================= */
.page-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.toolbar-filters {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.filter-select {
    padding: 0.625rem 2rem 0.625rem 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 0.9rem;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%2394a3b8' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
}

.toolbar-search {
    position: relative;
}

.toolbar-search input {
    width: 250px;
    padding: 0.625rem 1rem 0.625rem 2.5rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 0.9rem;
}

.toolbar-search svg {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    color: var(--text-dark);
}

/* =================================
   CARDS LIST
   ================================= */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
}

.client-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 1.5rem;
    border: 1px solid var(--border);
    transition: all 0.2s ease;
}

.client-card:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
}

.client-card-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.client-card-avatar {
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 1.1rem;
    color: white;
}

.client-card-info h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.client-card-info p {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.client-card-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.client-stat {
    text-align: center;
}

.client-stat-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary);
}

.client-stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* =================================
   INVOICE FORM
   ================================= */
.invoice-form-container {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 1.5rem;
}

.invoice-form-main {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 1.5rem;
    border: 1px solid var(--border);
}

.invoice-form-sidebar {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.form-section {
    margin-bottom: 2rem;
}

.form-section:last-child {
    margin-bottom: 0;
}

.form-section-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
}

/* Invoice lines */
.invoice-lines {
    margin-top: 1rem;
}

.invoice-line {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr auto;
    gap: 1rem;
    margin-bottom: 1rem;
    align-items: start;
}

.invoice-line-header {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr auto;
    gap: 1rem;
    margin-bottom: 0.75rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
}

.invoice-line input {
    padding: 0.75rem;
}

.remove-line {
    width: 38px;
    height: 38px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-muted);
    transition: all 0.2s ease;
}

.remove-line:hover {
    background: var(--danger);
    border-color: var(--danger);
    color: white;
}

.add-line-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: transparent;
    border: 2px dashed var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s ease;
    width: 100%;
    justify-content: center;
}

.add-line-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

/* Invoice summary */
.invoice-summary {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 1.5rem;
    border: 1px solid var(--border);
}

.summary-row {
    display: flex;
    justify-content: space-between;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border);
}

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

.summary-row.total {
    font-size: 1.25rem;
    font-weight: 700;
    padding-top: 1rem;
    margin-top: 0.5rem;
    border-top: 2px solid var(--border);
    border-bottom: none;
}

.summary-row.total .summary-value {
    color: var(--primary);
}

/* =================================
   INVOICE VIEW
   ================================= */
.invoice-view-container {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 1.5rem;
}

.invoice-paper {
    background: white;
    border-radius: var(--radius);
    padding: 3rem;
    color: #1a1a1a;
}

.invoice-paper-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 3rem;
}

.invoice-company h2 {
    font-size: 1.5rem;
    color: var(--primary);
    margin-bottom: 0.5rem;
}

.invoice-company p {
    color: #666;
    font-size: 0.9rem;
    line-height: 1.6;
}

.invoice-title {
    text-align: right;
}

.invoice-title h1 {
    font-size: 2.5rem;
    color: var(--primary);
    margin-bottom: 0.5rem;
}

.invoice-title .invoice-num {
    font-size: 1.1rem;
    color: #666;
}

.invoice-meta {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 2px solid #eee;
}

.invoice-meta-section h4 {
    font-size: 0.8rem;
    text-transform: uppercase;
    color: #999;
    margin-bottom: 0.5rem;
}

.invoice-meta-section p {
    color: #333;
    line-height: 1.6;
}

.invoice-meta-section strong {
    color: #1a1a1a;
}

.invoice-table {
    width: 100%;
    margin-bottom: 2rem;
    border-collapse: collapse;
}

.invoice-table th {
    background: #f8f9fa;
    padding: 1rem;
    text-align: left;
    font-size: 0.8rem;
    text-transform: uppercase;
    color: #666;
    border-bottom: 2px solid #eee;
}

.invoice-table td {
    padding: 1rem;
    border-bottom: 1px solid #eee;
    color: #333;
}

.invoice-table .text-right {
    text-align: right;
}

.invoice-totals {
    display: flex;
    justify-content: flex-end;
}

.invoice-totals-table {
    width: 280px;
}

.invoice-totals-table tr td {
    padding: 0.5rem 0;
}

.invoice-totals-table tr td:last-child {
    text-align: right;
    font-weight: 500;
}

.invoice-totals-table tr.total td {
    padding-top: 1rem;
    border-top: 2px solid #eee;
    font-size: 1.25rem;
    font-weight: 700;
}

.invoice-totals-table tr.total td:last-child {
    color: var(--primary);
}

.invoice-footer {
    margin-top: 3rem;
    padding-top: 1.5rem;
    border-top: 1px solid #eee;
    text-align: center;
    color: #999;
    font-size: 0.85rem;
}

/* Invoice actions sidebar */
.invoice-actions-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 1.5rem;
    border: 1px solid var(--border);
}

.invoice-actions-card h3 {
    font-size: 1rem;
    margin-bottom: 1rem;
}

.invoice-status-badge {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem;
    background: var(--bg-input);
    border-radius: var(--radius-sm);
    margin-bottom: 1.5rem;
}

.invoice-actions-btns {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.invoice-actions-btns .btn {
    justify-content: flex-start;
}

.invoice-history {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}

.invoice-history h4 {
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.history-item {
    display: flex;
    gap: 0.75rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border);
}

.history-item:last-child {
    border-bottom: none;
}

.history-dot {
    width: 8px;
    height: 8px;
    background: var(--primary);
    border-radius: 50%;
    margin-top: 0.4rem;
}

.history-content p {
    font-size: 0.85rem;
}

.history-content span {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* =================================
   SETTINGS
   ================================= */
.settings-grid {
    display: grid;
    grid-template-columns: 250px 1fr;
    gap: 1.5rem;
}

.settings-nav {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 1rem;
    border: 1px solid var(--border);
    height: fit-content;
}

.settings-nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    transition: all 0.2s ease;
    margin-bottom: 0.25rem;
}

.settings-nav-link:hover {
    background: var(--bg-input);
    color: var(--text);
}

.settings-nav-link.active {
    background: var(--primary);
    color: white;
}

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

.settings-content {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 2rem;
    border: 1px solid var(--border);
}

.settings-section {
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--border);
}

.settings-section:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.settings-section h3 {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}

.settings-section > p {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
}

.logo-upload {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.logo-preview {
    width: 100px;
    height: 100px;
    background: var(--bg-input);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px dashed var(--border);
}

.logo-preview svg {
    width: 32px;
    height: 32px;
    color: var(--text-dark);
}

/* =================================
   PAGINATION
   ================================= */
.pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border);
}

.pagination-info {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.pagination-buttons {
    display: flex;
    gap: 0.5rem;
}

.pagination-btn {
    padding: 0.5rem 1rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.pagination-btn:hover:not(:disabled) {
    background: var(--primary);
    border-color: var(--primary);
}

.pagination-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pagination-btn.active {
    background: var(--primary);
    border-color: var(--primary);
}

/* =================================
   EMPTY STATE
   ================================= */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
}

.empty-state svg {
    width: 80px;
    height: 80px;
    color: var(--text-dark);
    margin-bottom: 1.5rem;
}

.empty-state h3 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
}

.empty-state p {
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

/* =================================
   SETTINGS PAGE
   ================================= */
.settings-layout {
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: 2rem;
}

.settings-nav {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    position: sticky;
    top: 1rem;
    height: fit-content;
}

.settings-nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: var(--radius);
    transition: all 0.2s ease;
}

.settings-nav-link:hover {
    background: var(--bg-hover);
    color: var(--text);
}

.settings-nav-link.active {
    background: rgba(99, 102, 241, 0.15);
    color: var(--primary);
}

.settings-content {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.settings-section {
    scroll-margin-top: 2rem;
}

.settings-section-header {
    margin-bottom: 1.5rem;
}

.settings-section-header h2 {
    font-size: 1.5rem;
    margin-bottom: 0.25rem;
}

.settings-section-header p {
    color: var(--text-muted);
}

.settings-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
}

.settings-card + .settings-card {
    margin-top: 1rem;
}

.settings-card-header {
    margin-bottom: 1.25rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

.settings-card-header h3 {
    font-size: 1rem;
    font-weight: 600;
}

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

/* Logo Upload */
.logo-upload-area {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.logo-preview {
    width: 100px;
    height: 100px;
    background: var(--bg-input);
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-dark);
}

.logo-upload-info {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.logo-upload-info p {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* TVA List */
.tva-list {
    margin-top: 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.tva-list-header {
    padding: 0.75rem 1rem;
    background: var(--bg-input);
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-muted);
}

.tva-list-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1rem;
    border-top: 1px solid var(--border);
}

.tva-list-item span:first-child {
    font-weight: 600;
    min-width: 50px;
}

.tva-label {
    color: var(--text-muted);
    font-size: 0.9rem;
    flex: 1;
}

.btn-icon {
    background: none;
    border: none;
    padding: 0.25rem;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
}

.btn-icon:hover {
    color: var(--danger);
    background: rgba(239, 68, 68, 0.1);
}

/* Checkbox styles */
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
}

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

.checkbox-text {
    color: var(--text);
}

.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 0.5rem;
}

.payment-methods label {
    color: var(--text-muted);
    font-size: 0.9rem;
    display: block;
    margin-bottom: 0.5rem;
}

/* Notifications */
.notifications-list {
    display: flex;
    flex-direction: column;
}

.notification-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 0;
    border-bottom: 1px solid var(--border);
}

.notification-item:last-child {
    border-bottom: none;
}

.notification-info h4 {
    font-size: 0.95rem;
    margin-bottom: 0.25rem;
}

.notification-info p {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Toggle Switch */
.toggle {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 26px;
    flex-shrink: 0;
}

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

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 26px;
    transition: all 0.3s ease;
}

.toggle-slider::before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 2px;
    bottom: 2px;
    background: var(--text-muted);
    border-radius: 50%;
    transition: all 0.3s ease;
}

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

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

/* Password Requirements */
.password-requirements {
    background: var(--bg-input);
    border-radius: var(--radius);
    padding: 1rem;
    margin: 0.5rem 0;
}

.password-requirements p {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.password-requirements ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.25rem;
}

.password-requirements li {
    font-size: 0.85rem;
    color: var(--text-muted);
    padding-left: 1.25rem;
    position: relative;
}

.password-requirements li::before {
    content: "•";
    position: absolute;
    left: 0;
    color: var(--text-dark);
}

/* Two Factor */
.two-factor-status {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.two-factor-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.two-factor-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.two-factor-icon.inactive {
    background: var(--bg-input);
    color: var(--text-muted);
}

.two-factor-icon.active {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success);
}

.two-factor-info h4 {
    font-size: 0.95rem;
    margin-bottom: 0.25rem;
}

.two-factor-info p {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Sessions */
.sessions-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.session-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: var(--bg-input);
    border-radius: var(--radius);
}

.session-icon {
    width: 40px;
    height: 40px;
    background: var(--bg-card);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
}

.session-info {
    flex: 1;
}

.session-info h4 {
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.session-info p {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.badge-success {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success);
    font-size: 0.7rem;
    padding: 0.2rem 0.5rem;
    border-radius: 9999px;
    font-weight: 500;
}

.btn-sm {
    padding: 0.4rem 0.75rem;
    font-size: 0.8rem;
}

/* Danger Zone */
.settings-card.danger {
    border-color: rgba(239, 68, 68, 0.3);
}

.settings-card.danger .settings-card-header {
    border-bottom-color: rgba(239, 68, 68, 0.2);
}

.settings-card.danger .settings-card-header h3 {
    color: var(--danger);
}

.danger-zone {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.danger-info h4 {
    font-size: 0.95rem;
    margin-bottom: 0.25rem;
}

.danger-info p {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.btn-danger {
    background: var(--danger);
    color: white;
    border: none;
    padding: 0.6rem 1.25rem;
    border-radius: var(--radius);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-danger:hover {
    background: #dc2626;
}

/* Settings Actions */
.settings-actions {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border);
}

/* =================================
   RESPONSIVE
   ================================= */
@media (max-width: 1200px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

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

    .invoice-form-container,
    .invoice-view-container {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 992px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }

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

    .main-content {
        margin-left: 0;
    }

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

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

    .settings-nav {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 0.5rem;
        position: static;
    }

    .settings-nav-link {
        padding: 0.5rem 0.75rem;
        font-size: 0.9rem;
    }

    .settings-nav-link svg {
        display: none;
    }

    .two-factor-status,
    .danger-zone {
        flex-direction: column;
        align-items: flex-start;
    }

    .two-factor-status .btn,
    .danger-zone .btn {
        width: 100%;
    }
}

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

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

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

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

    .invoice-line-header {
        display: none;
    }

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

    .app-header {
        padding: 0 1rem;
    }

    .page-content {
        padding: 1rem;
    }

    .search-box {
        display: none;
    }
}
