:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --danger: #dc2626;
    --secondary: #059669;
    --bg: #f1f5f9;
    --card-bg: #ffffff;
    --text: #1e293b;
    --text-light: #64748b;
    --border: #e2e8f0;
    --radius: 8px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
}

/* Navigation */
nav {
    background: var(--primary);
    color: white;
    padding: 0.75rem 2rem;
    display: flex;
    align-items: center;
    gap: 2rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
.nav-brand { font-weight: 700; font-size: 1.2rem; }
.nav-links { display: flex; gap: 1rem; flex: 1; }
.nav-links a { color: rgba(255,255,255,0.9); text-decoration: none; padding: 0.25rem 0.5rem; border-radius: 4px; }
.nav-links a:hover { background: rgba(255,255,255,0.15); }
.nav-right { display: flex; align-items: center; gap: 0.75rem; margin-left: auto; }
.nav-role { font-size: 0.8rem; color: rgba(255,255,255,0.7); background: rgba(255,255,255,0.15); padding: 0.2rem 0.6rem; border-radius: 12px; }
.btn-logout { color: rgba(255,255,255,0.9); text-decoration: none; font-size: 0.85rem; padding: 0.25rem 0.5rem; border-radius: 4px; }
.btn-logout:hover { background: rgba(255,255,255,0.15); }

/* Main */
main { max-width: 1400px; margin: 0 auto; padding: 1.5rem; }
h1 { margin-bottom: 1rem; color: var(--text); }
h2 { margin-bottom: 0.75rem; color: var(--text); font-size: 1.1rem; }

/* Cards */
.card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

/* Tables */
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th, td { padding: 0.5rem 0.75rem; border-bottom: 1px solid var(--border); text-align: left; }
th { background: #f8fafc; font-weight: 600; font-size: 0.8rem; text-transform: uppercase; color: var(--text-light); }
.text-right { text-align: right; }
.row-inactive { opacity: 0.5; }
.row-total td { border-top: 2px solid var(--text); font-weight: 600; background: #f8fafc; }

/* Table répartition */
.table-responsive { overflow-x: auto; }
.table-repartition { min-width: 900px; }
.table-repartition .pct { color: var(--text-light); font-size: 0.8rem; }
.table-repartition .montant { font-variant-numeric: tabular-nums; }
.col-prat { background: #f0f9ff; }
.sub-header { font-size: 0.7rem; color: var(--text-light); }

/* Forms */
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 1rem; align-items: end; }
.form-group label { display: block; font-size: 0.85rem; font-weight: 500; margin-bottom: 0.25rem; color: var(--text-light); }
.form-group input, .form-group select { width: 100%; padding: 0.5rem; border: 1px solid var(--border); border-radius: 4px; font-size: 0.9rem; }
.form-inline { display: flex; gap: 0.75rem; align-items: center; flex-wrap: wrap; }
.form-inline input, .form-inline select { padding: 0.5rem; border: 1px solid var(--border); border-radius: 4px; }
.form-group-inline { display: flex; flex-direction: column; gap: 0.25rem; }
.form-group-inline label { font-size: 0.8rem; color: var(--text-light); }
.custom-form { padding: 0.75rem; background: #fefce8; border-radius: 4px; }
.custom-row td { padding: 0.5rem; }
.table-custom { width: auto; min-width: 400px; margin-bottom: 0; }
.table-custom th, .table-custom td { padding: 0.3rem 0.5rem; }
.input-pct { width: 90px; text-align: right; }

input[type="text"], input[type="number"], select {
    padding: 0.4rem 0.5rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 0.85rem;
}
.input-small { width: 80px; }
.input-montant { width: 130px; text-align: right; -moz-appearance: textfield; }
.input-montant::-webkit-outer-spin-button,
.input-montant::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    text-decoration: none;
    color: var(--text);
    background: var(--border);
    transition: background 0.15s;
}
.btn:hover { background: #cbd5e1; }
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: var(--secondary); color: white; }
.btn-secondary:hover { background: #047857; }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #b91c1c; }
.btn-small { padding: 0.3rem 0.6rem; font-size: 0.8rem; }

.actions { display: flex; gap: 0.5rem; }
.actions-bar { display: flex; gap: 0.75rem; margin-bottom: 1rem; }
.inline { display: inline; }

/* Badge */
.badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    background: #e0f2fe;
    color: #0369a1;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
}

/* Annees row */
.annee-row { display: flex; align-items: center; gap: 0.75rem; padding: 0.75rem 1rem; background: #f8fafc; border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 0.5rem; }
.annee-label { font-size: 1.3rem; font-weight: 700; color: var(--primary); min-width: 60px; }

/* Recap */
.recap-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 1rem; }
.recap-card {
    background: linear-gradient(135deg, #eff6ff, #f0f9ff);
    border: 1px solid #bfdbfe;
    border-radius: var(--radius);
    padding: 1rem;
    text-align: center;
}
.recap-card h3 { font-size: 1rem; color: var(--primary-dark); }
.recap-card-total { background: linear-gradient(135deg, #1e3a5f, #1d4ed8); border-color: #1d4ed8; }
.recap-card-total h3, .recap-card-total .recap-montant, .recap-card-total .recap-pct, .recap-card-total .recap-type { color: white; }
.recap-type { font-size: 0.8rem; color: var(--text-light); text-transform: capitalize; margin: 0.25rem 0; }
.recap-montant { font-size: 1.4rem; font-weight: 700; color: var(--text); margin: 0.5rem 0 0.25rem; }
.recap-pct { font-size: 0.9rem; color: var(--text-light); }
