/* ==========================================================================
   DYNASTY IMMOBILIER - Système de gestion
   Style: Luxe sombre, accents dorés, inspiration Dynasty 8
   ========================================================================== */

/* Reset & Variables */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    /* Couleurs - palette Dynasty */
    --bg-deep: #0a0908;
    --bg-base: #11100e;
    --bg-elevated: #1a1814;
    --bg-card: #1f1c17;
    --bg-card-hover: #26221c;
    --border: #2d2820;
    --border-strong: #3d3729;
    
    /* Or & accents */
    --gold: #c9a661;
    --gold-bright: #e6c481;
    --gold-deep: #8a7340;
    --gold-soft: rgba(201, 166, 97, 0.1);
    --gold-glow: rgba(201, 166, 97, 0.25);
    
    /* Texte */
    --text-primary: #f5f1e8;
    --text-secondary: #a8a294;
    --text-muted: #6b6557;
    --text-dim: #4a4538;
    
    /* États */
    --success: #7fb069;
    --danger: #c97062;
    --warning: #d4a44b;
    --info: #6f9bb8;
    
    /* Ombres */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 20px 50px rgba(0, 0, 0, 0.5);
    --shadow-gold: 0 4px 20px rgba(201, 166, 97, 0.2);
    
    /* Typo */
    --font-display: 'Cormorant Garamond', 'Times New Roman', serif;
    --font-body: 'Outfit', -apple-system, sans-serif;
    
    /* Espacement */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
}

html, body {
    background: var(--bg-deep);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 15px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    min-height: 100vh;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, select, textarea { font-family: inherit; }

/* Scrollbar */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg-base); }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: var(--gold-deep); }

/* ==========================================================================
   PAGE DE CONNEXION
   ========================================================================== */

.login-body {
    background: var(--bg-deep);
    overflow: hidden;
}

.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    position: relative;
}

.login-bg {
    position: absolute;
    inset: 0;
    overflow: hidden;
    z-index: 0;
}

.bg-glow {
    position: absolute;
    border-radius: 50%;
    filter: blur(120px);
    opacity: 0.4;
}

.bg-glow-1 {
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, var(--gold) 0%, transparent 70%);
    top: -200px;
    left: -200px;
    animation: float 20s ease-in-out infinite;
}

.bg-glow-2 {
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, var(--gold-deep) 0%, transparent 70%);
    bottom: -150px;
    right: -150px;
    animation: float 25s ease-in-out infinite reverse;
}

.bg-grid {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(201, 166, 97, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(201, 166, 97, 0.03) 1px, transparent 1px);
    background-size: 50px 50px;
    mask-image: radial-gradient(ellipse at center, black 30%, transparent 70%);
}

@keyframes float {
    0%, 100% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(50px, -30px) scale(1.1); }
}

.login-card {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 460px;
    background: linear-gradient(145deg, rgba(31, 28, 23, 0.9), rgba(17, 16, 14, 0.95));
    backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 50px 45px;
    box-shadow: var(--shadow-lg), inset 0 1px 0 rgba(201, 166, 97, 0.1);
    animation: fadeInUp 0.8s ease;
}

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

.login-brand {
    text-align: center;
    margin-bottom: 40px;
}

.brand-mark {
    width: 70px;
    height: 70px;
    margin: 0 auto 20px;
    color: var(--gold);
    filter: drop-shadow(0 0 20px var(--gold-glow));
    animation: pulse 3s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { filter: drop-shadow(0 0 20px var(--gold-glow)); }
    50% { filter: drop-shadow(0 0 30px var(--gold-glow)); }
}

.brand-name {
    font-family: var(--font-display);
    font-size: 42px;
    font-weight: 500;
    letter-spacing: 8px;
    color: var(--text-primary);
    margin-bottom: 4px;
    background: linear-gradient(135deg, var(--gold-bright) 0%, var(--gold) 50%, var(--gold-deep) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.brand-sub {
    font-size: 10px;
    letter-spacing: 4px;
    color: var(--text-muted);
    font-weight: 500;
}

.brand-divider {
    width: 60px;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--gold), transparent);
    margin: 20px auto;
}

.brand-tagline {
    font-family: var(--font-display);
    font-style: italic;
    font-size: 16px;
    color: var(--text-secondary);
    font-weight: 400;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-size: 11px;
    letter-spacing: 2px;
    color: var(--text-muted);
    font-weight: 600;
}

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

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--gold);
    box-shadow: 0 0 0 3px var(--gold-soft);
    background: var(--bg-elevated);
}

.btn-login {
    width: 100%;
    padding: 16px;
    background: linear-gradient(135deg, var(--gold-bright), var(--gold));
    color: var(--bg-deep);
    font-weight: 700;
    letter-spacing: 3px;
    font-size: 13px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.3s ease;
    margin-top: 10px;
    position: relative;
    overflow: hidden;
}

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

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

.btn-login:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-gold);
}

.login-footer {
    margin-top: 30px;
    text-align: center;
    font-size: 11px;
    color: var(--text-dim);
    letter-spacing: 1px;
}

/* ==========================================================================
   ALERTES
   ========================================================================== */

.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.alert-error {
    background: rgba(201, 112, 98, 0.1);
    border: 1px solid rgba(201, 112, 98, 0.3);
    color: var(--danger);
}

.alert-success {
    background: rgba(127, 176, 105, 0.1);
    border: 1px solid rgba(127, 176, 105, 0.3);
    color: var(--success);
}

/* ==========================================================================
   LAYOUT PRINCIPAL
   ========================================================================== */

.app-layout {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background: linear-gradient(180deg, var(--bg-base) 0%, var(--bg-deep) 100%);
    border-right: 1px solid var(--border);
    padding: 30px 0;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    z-index: 100;
}

.sidebar-brand {
    padding: 0 30px 30px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 30px;
    text-align: center;
}

.sidebar-brand .brand-mark {
    width: 50px;
    height: 50px;
    margin: 0 auto 12px;
}

.sidebar-brand .brand-name {
    font-size: 24px;
    letter-spacing: 5px;
}

.sidebar-brand .brand-sub {
    font-size: 9px;
    letter-spacing: 3px;
    margin-top: 2px;
}

.nav-section {
    padding: 0 20px;
    margin-bottom: 30px;
}

.nav-title {
    font-size: 10px;
    letter-spacing: 3px;
    color: var(--text-dim);
    margin-bottom: 12px;
    padding: 0 12px;
    font-weight: 600;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 4px;
    transition: all 0.2s ease;
    position: relative;
    cursor: pointer;
}

.nav-item:hover {
    background: var(--bg-elevated);
    color: var(--text-primary);
}

.nav-item.active {
    background: var(--gold-soft);
    color: var(--gold-bright);
}

.nav-item.active::before {
    content: '';
    position: absolute;
    left: -20px;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 24px;
    background: var(--gold);
    border-radius: 0 3px 3px 0;
}

.nav-item svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.sidebar-footer {
    margin-top: auto;
    padding: 20px 30px;
    border-top: 1px solid var(--border);
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.user-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--gold-bright), var(--gold-deep));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: var(--bg-deep);
    font-size: 14px;
    letter-spacing: 1px;
}

.user-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

.user-role {
    font-size: 11px;
    color: var(--text-muted);
    letter-spacing: 1px;
}

.btn-logout {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 12px;
    letter-spacing: 1px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-logout:hover {
    border-color: var(--danger);
    color: var(--danger);
}

/* Main content */
.main-content {
    flex: 1;
    margin-left: 260px;
    padding: 40px 50px;
    min-height: 100vh;
}

/* Header de page */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 40px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border);
}

.page-title-block {
    flex: 1;
}

.page-eyebrow {
    font-size: 11px;
    letter-spacing: 3px;
    color: var(--gold);
    margin-bottom: 8px;
    font-weight: 600;
}

.page-title {
    font-family: var(--font-display);
    font-size: 42px;
    font-weight: 500;
    color: var(--text-primary);
    line-height: 1.1;
    margin-bottom: 8px;
}

.page-subtitle {
    color: var(--text-secondary);
    font-size: 15px;
}

.page-actions {
    display: flex;
    gap: 12px;
}

/* ==========================================================================
   BOUTONS
   ========================================================================== */

.btn {
    padding: 11px 22px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 1.5px;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    border: none;
}

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

.btn-primary {
    background: linear-gradient(135deg, var(--gold-bright), var(--gold));
    color: var(--bg-deep);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-gold);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border-strong);
    color: var(--text-primary);
}

.btn-outline:hover {
    border-color: var(--gold);
    color: var(--gold-bright);
}

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

.btn-ghost:hover {
    background: var(--bg-card-hover);
}

.btn-danger {
    background: rgba(201, 112, 98, 0.15);
    color: var(--danger);
    border: 1px solid rgba(201, 112, 98, 0.3);
}

.btn-danger:hover {
    background: rgba(201, 112, 98, 0.25);
}

.btn-sm {
    padding: 7px 14px;
    font-size: 11px;
}

/* ==========================================================================
   CARDS & STATS
   ========================================================================== */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.stat-card {
    background: linear-gradient(145deg, var(--bg-card), var(--bg-elevated));
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--gold), transparent);
    opacity: 0.5;
}

.stat-card:hover {
    transform: translateY(-2px);
    border-color: var(--gold-deep);
}

.stat-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-sm);
    background: var(--gold-soft);
    color: var(--gold);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
}

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

.stat-label {
    font-size: 11px;
    letter-spacing: 2px;
    color: var(--text-muted);
    margin-bottom: 8px;
    font-weight: 600;
}

.stat-value {
    font-family: var(--font-display);
    font-size: 32px;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1;
}

.stat-change {
    margin-top: 12px;
    font-size: 12px;
    color: var(--text-secondary);
}

.stat-change.positive { color: var(--success); }
.stat-change.negative { color: var(--danger); }

/* ==========================================================================
   SECTION & PANELS
   ========================================================================== */

.panel {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    margin-bottom: 30px;
}

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

.panel-title {
    font-family: var(--font-display);
    font-size: 22px;
    font-weight: 500;
    color: var(--text-primary);
}

.panel-subtitle {
    font-size: 12px;
    color: var(--text-muted);
    letter-spacing: 1px;
    margin-top: 2px;
}

.panel-body {
    padding: 28px;
}

.panel-body.no-padding { padding: 0; }

/* ==========================================================================
   FORMS
   ========================================================================== */

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.form-row-3 {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.form-row-4 {
    display: grid;
    grid-template-columns: 3fr 1fr 1fr 1fr 40px;
    gap: 12px;
    margin-bottom: 12px;
    align-items: end;
}

.form-section {
    margin-bottom: 30px;
    padding-bottom: 30px;
    border-bottom: 1px solid var(--border);
}

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

.form-section-title {
    font-size: 12px;
    letter-spacing: 3px;
    color: var(--gold);
    margin-bottom: 20px;
    font-weight: 600;
}

textarea.form-control {
    min-height: 80px;
    resize: vertical;
    font-family: var(--font-body);
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23c9a661' d='M6 8L0 0h12z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    padding-right: 40px;
}

/* ==========================================================================
   TABLE
   ========================================================================== */

.table-wrapper {
    overflow-x: auto;
}

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

.data-table thead {
    background: var(--bg-elevated);
}

.data-table th {
    padding: 14px 20px;
    text-align: left;
    font-size: 11px;
    letter-spacing: 2px;
    color: var(--text-muted);
    font-weight: 600;
    border-bottom: 1px solid var(--border);
}

.data-table td {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
    color: var(--text-primary);
}

.data-table tr:hover td {
    background: rgba(201, 166, 97, 0.03);
}

.data-table tr:last-child td {
    border-bottom: none;
}

.cell-money { font-family: var(--font-display); font-size: 16px; font-weight: 600; color: var(--gold-bright); }
.cell-id { font-family: 'Courier New', monospace; font-size: 12px; color: var(--text-muted); }

.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 100px;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 1.5px;
}

.badge-success { background: rgba(127, 176, 105, 0.15); color: var(--success); }
.badge-danger { background: rgba(201, 112, 98, 0.15); color: var(--danger); }
.badge-info { background: rgba(111, 155, 184, 0.15); color: var(--info); }
.badge-warning { background: rgba(212, 164, 75, 0.15); color: var(--warning); }
.badge-gold { background: var(--gold-soft); color: var(--gold-bright); }

.cell-actions {
    display: flex;
    gap: 6px;
    justify-content: flex-end;
}

.btn-icon {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    background: var(--bg-elevated);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    border: 1px solid var(--border);
}

.btn-icon:hover {
    color: var(--gold-bright);
    border-color: var(--gold);
}

.btn-icon.danger:hover {
    color: var(--danger);
    border-color: var(--danger);
}

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

/* État vide */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state svg {
    width: 48px;
    height: 48px;
    color: var(--text-dim);
    margin-bottom: 16px;
}

.empty-state h3 {
    font-family: var(--font-display);
    font-size: 22px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.empty-state p {
    font-size: 14px;
    margin-bottom: 20px;
}

/* ==========================================================================
   FACTURE - Style document
   ========================================================================== */

.invoice-builder {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
}

.invoice-form-side .panel {
    margin-bottom: 0;
}

.line-item {
    display: grid;
    grid-template-columns: 3fr 1fr 1fr 1fr 36px;
    gap: 10px;
    align-items: end;
    margin-bottom: 10px;
}

.line-item .form-group {
    margin: 0;
}

.line-item input {
    padding: 10px 12px;
    font-size: 13px;
}

.btn-remove-line {
    width: 36px;
    height: 40px;
    border-radius: var(--radius-sm);
    background: rgba(201, 112, 98, 0.1);
    color: var(--danger);
    border: 1px solid rgba(201, 112, 98, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.btn-remove-line:hover {
    background: rgba(201, 112, 98, 0.25);
}

.invoice-totals {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

.totals-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    font-size: 14px;
}

.totals-row.grand-total {
    border-top: 1px solid var(--gold-deep);
    margin-top: 12px;
    padding-top: 16px;
    font-family: var(--font-display);
    font-size: 22px;
    color: var(--gold-bright);
    font-weight: 600;
}

/* Aperçu facture */
.invoice-preview {
    background: #ffffff;
    color: #1a1814;
    padding: 50px;
    border-radius: var(--radius-md);
    font-family: 'Outfit', sans-serif;
    box-shadow: var(--shadow-lg);
    min-height: 600px;
    position: relative;
}

.invoice-preview::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 6px;
    background: linear-gradient(90deg, #8a7340, #c9a661, #e6c481, #c9a661, #8a7340);
    border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.preview-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 40px;
    padding-bottom: 25px;
    border-bottom: 2px solid #e8e3d6;
}

.preview-brand {
    color: #1a1814;
}

.preview-brand-name {
    font-family: var(--font-display);
    font-size: 28px;
    font-weight: 600;
    letter-spacing: 4px;
    background: linear-gradient(135deg, #8a7340, #c9a661);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 4px;
}

.preview-brand-sub {
    font-size: 9px;
    letter-spacing: 3px;
    color: #6b6557;
    margin-bottom: 10px;
}

.preview-agency-info {
    font-size: 11px;
    color: #4a4538;
    line-height: 1.6;
}

.preview-meta {
    text-align: right;
}

.preview-doc-type {
    font-family: var(--font-display);
    font-size: 32px;
    font-weight: 500;
    color: #c9a661;
    letter-spacing: 6px;
    margin-bottom: 10px;
}

.preview-meta-item {
    font-size: 12px;
    color: #4a4538;
    margin-bottom: 3px;
}

.preview-meta-item strong { color: #1a1814; }

.preview-parties {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-bottom: 35px;
}

.preview-party-label {
    font-size: 9px;
    letter-spacing: 3px;
    color: #c9a661;
    font-weight: 600;
    margin-bottom: 8px;
}

.preview-party-name {
    font-family: var(--font-display);
    font-size: 18px;
    font-weight: 600;
    color: #1a1814;
    margin-bottom: 4px;
}

.preview-party-info {
    font-size: 12px;
    color: #4a4538;
    line-height: 1.6;
    white-space: pre-line;
}

.preview-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 25px;
}

.preview-table thead {
    background: #1a1814;
    color: #c9a661;
}

.preview-table th {
    padding: 12px 14px;
    font-size: 10px;
    letter-spacing: 2px;
    font-weight: 600;
    text-align: left;
}

.preview-table th:not(:first-child) { text-align: right; }

.preview-table td {
    padding: 14px;
    border-bottom: 1px solid #e8e3d6;
    font-size: 13px;
    color: #1a1814;
}

.preview-table td:not(:first-child) { text-align: right; }

.preview-totals {
    margin-left: auto;
    width: 280px;
    margin-top: 20px;
}

.preview-totals-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    font-size: 13px;
    color: #4a4538;
}

.preview-totals-row.grand {
    border-top: 2px solid #c9a661;
    margin-top: 8px;
    padding-top: 14px;
    font-family: var(--font-display);
    font-size: 20px;
    font-weight: 600;
    color: #1a1814;
}

.preview-footer {
    margin-top: 50px;
    padding-top: 25px;
    border-top: 1px solid #e8e3d6;
    text-align: center;
    font-size: 11px;
    color: #6b6557;
    line-height: 1.8;
}

.preview-footer strong { color: #c9a661; letter-spacing: 2px; }

/* ==========================================================================
   COMPTABILITÉ - Document à imprimer
   ========================================================================== */

.compta-summary-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 30px;
}

.summary-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    position: relative;
    overflow: hidden;
}

.summary-card.income { border-color: rgba(127, 176, 105, 0.3); }
.summary-card.expense { border-color: rgba(201, 112, 98, 0.3); }
.summary-card.balance { border-color: var(--gold-deep); }

.summary-label {
    font-size: 11px;
    letter-spacing: 2px;
    color: var(--text-muted);
    margin-bottom: 10px;
    font-weight: 600;
}

.summary-value {
    font-family: var(--font-display);
    font-size: 36px;
    font-weight: 600;
    line-height: 1;
}

.summary-card.income .summary-value { color: var(--success); }
.summary-card.expense .summary-value { color: var(--danger); }
.summary-card.balance .summary-value { color: var(--gold-bright); }

.tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 24px;
    border-bottom: 1px solid var(--border);
}

.tab {
    padding: 12px 22px;
    font-size: 12px;
    letter-spacing: 2px;
    color: var(--text-muted);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
}

.tab:hover { color: var(--text-secondary); }

.tab.active {
    color: var(--gold-bright);
    border-color: var(--gold);
}

.tab-content { display: none; }
.tab-content.active { display: block; }

/* Filtres */
.filters {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    align-items: center;
}

.filter-input {
    background: var(--bg-base);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 9px 14px;
    color: var(--text-primary);
    font-size: 13px;
    min-width: 160px;
}

.filter-input:focus {
    outline: none;
    border-color: var(--gold);
}

/* Document comptable (export) */
.compta-document {
    background: #ffffff;
    color: #1a1814;
    padding: 40px;
    border-radius: var(--radius-md);
    font-family: 'Outfit', sans-serif;
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    position: relative;
}

.compta-document::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 5px;
    background: linear-gradient(90deg, #8a7340, #c9a661, #e6c481, #c9a661, #8a7340);
    border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.compta-doc-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #e8e3d6;
}

.compta-doc-title {
    font-family: var(--font-display);
    font-size: 28px;
    font-weight: 500;
    color: #1a1814;
    letter-spacing: 4px;
    margin-bottom: 6px;
}

.compta-doc-subtitle {
    font-size: 11px;
    letter-spacing: 2px;
    color: #c9a661;
    font-weight: 600;
    margin-bottom: 4px;
}

.compta-doc-period {
    font-size: 13px;
    color: #4a4538;
}

.compta-doc-section {
    margin-bottom: 25px;
}

.compta-section-title {
    font-family: var(--font-display);
    font-size: 18px;
    color: #1a1814;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid #c9a661;
    display: flex;
    align-items: center;
    gap: 8px;
}

.compta-doc-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 14px;
}

.compta-doc-table th {
    background: #1a1814;
    color: #c9a661;
    padding: 10px 12px;
    font-size: 10px;
    letter-spacing: 2px;
    text-align: left;
    font-weight: 600;
}

.compta-doc-table th:last-child { text-align: right; }

.compta-doc-table td {
    padding: 10px 12px;
    font-size: 12px;
    color: #1a1814;
    border-bottom: 1px solid #e8e3d6;
}

.compta-doc-table td:last-child { text-align: right; font-weight: 600; }

.compta-section-total {
    text-align: right;
    font-family: var(--font-display);
    font-size: 16px;
    font-weight: 600;
    padding: 10px 12px;
    background: #f8f5ed;
    border-radius: 4px;
}

.compta-summary-final {
    background: #1a1814;
    color: #f5f1e8;
    padding: 20px 24px;
    border-radius: 8px;
    margin-top: 20px;
}

.compta-summary-final-row {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    font-size: 13px;
}

.compta-summary-final-row.balance {
    border-top: 1px solid #c9a661;
    margin-top: 8px;
    padding-top: 12px;
    font-family: var(--font-display);
    font-size: 22px;
    color: #c9a661;
    font-weight: 600;
}

.compta-doc-footer {
    margin-top: 30px;
    padding-top: 16px;
    border-top: 1px solid #e8e3d6;
    text-align: center;
    font-size: 10px;
    color: #6b6557;
    letter-spacing: 1px;
}

/* ==========================================================================
   MODAL
   ========================================================================== */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(10, 9, 8, 0.85);
    backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

.modal-overlay.active {
    display: flex;
    animation: fadeIn 0.2s ease;
}

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

.modal {
    background: var(--bg-card);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: scaleIn 0.3s ease;
}

@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

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

.modal-title {
    font-family: var(--font-display);
    font-size: 22px;
    color: var(--text-primary);
}

.modal-close {
    color: var(--text-muted);
    font-size: 24px;
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

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

.modal-body {
    padding: 28px;
}

.modal-footer {
    padding: 20px 28px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* ==========================================================================
   MOBILE
   ========================================================================== */

@media (max-width: 1024px) {
    .invoice-builder {
        grid-template-columns: 1fr;
    }
    .compta-summary-grid {
        grid-template-columns: 1fr;
    }
    .form-row, .form-row-3 {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; padding: 24px 20px; }
    .page-header { flex-direction: column; gap: 16px; }
    .page-title { font-size: 32px; }
}

/* ==========================================================================
   UTILS
   ========================================================================== */

.text-gold { color: var(--gold-bright); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-muted { color: var(--text-muted); }
.text-right { text-align: right; }
.text-center { text-align: center; }

.mt-0 { margin-top: 0; } .mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; }
.mb-0 { margin-bottom: 0; } .mb-1 { margin-bottom: 8px; } .mb-2 { margin-bottom: 16px; } .mb-3 { margin-bottom: 24px; }
.gap-1 { gap: 8px; } .gap-2 { gap: 16px; } .gap-3 { gap: 24px; }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }
.w-full { width: 100%; }

.flash-message {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 14px 20px;
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    border: 1px solid var(--border-strong);
    color: var(--text-primary);
    font-size: 14px;
    z-index: 2000;
    box-shadow: var(--shadow-md);
    animation: slideIn 0.3s ease;
}

.flash-message.success { border-color: var(--success); color: var(--success); }
.flash-message.error { border-color: var(--danger); color: var(--danger); }

@keyframes slideIn {
    from { transform: translateX(100%); }
    to { transform: translateX(0); }
}
