* { box-sizing: border-box; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    margin: 0;
    background: #f4f5f7;
    color: #1f2430;
}
.topnav {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    background: #1f2430;
    padding: 0.75rem 1.5rem;
    flex-wrap: wrap;
}
.topnav .brand { color: #fff; font-weight: 700; margin-right: 1rem; }
.topnav a { color: #c8cdd8; text-decoration: none; font-size: 0.9rem; }
.topnav a:hover { color: #fff; }

.container { max-width: 1200px; margin: 0 auto; padding: 1.5rem; }

.header-row { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 1rem; }
.year-picker a { margin-right: 0.75rem; text-decoration: none; color: #556; }
.year-picker a.active { font-weight: 700; color: #1f2430; border-bottom: 2px solid #1f2430; }

.alert-box {
    background: #fff4e5; border: 1px solid #f0b429; padding: 0.75rem 1rem;
    border-radius: 6px; margin: 1rem 0;
}

.table-scroll { overflow-x: auto; }
table.grid { border-collapse: collapse; width: 100%; background: #fff; font-size: 0.85rem; }
table.grid th, table.grid td { border: 1px solid #e2e5eb; padding: 0.4rem 0.6rem; text-align: right; }
table.grid th:first-child, table.grid td:first-child { text-align: left; }
table.grid thead th { background: #eceff3; }
table.grid tfoot td { background: #f0f2f5; font-weight: 700; }
.cat-name { font-weight: 500; }
.total-cell { font-weight: 700; }
.neg { color: #c0392b; }
tr.archived { opacity: 0.5; }

.card-form { background: #fff; padding: 1rem 1.25rem; border-radius: 8px; display: flex; flex-direction: column; gap: 0.75rem; max-width: 420px; }
.card-form.inline { flex-direction: row; align-items: center; max-width: none; flex-wrap: wrap; }
.card-form label { display: flex; flex-direction: column; font-size: 0.85rem; gap: 0.25rem; }
.card-form input, .card-form select { padding: 0.4rem; border: 1px solid #ccd; border-radius: 4px; }
.card-form button {
    background: #1f2430; color: #fff; border: none; padding: 0.5rem 1rem;
    border-radius: 6px; cursor: pointer; align-self: flex-start;
}

.hint { color: #667; font-size: 0.9rem; }

.txn-row {
    display: flex; align-items: center; gap: 0.75rem; background: #fff;
    padding: 0.6rem 1rem; border-radius: 6px; margin-bottom: 0.5rem; flex-wrap: wrap;
}
.txn-date { color: #778; width: 80px; }
.txn-libelle { flex: 1; min-width: 200px; }
.txn-montant { width: 90px; text-align: right; }
.checkbox-label { font-size: 0.8rem; display: flex; align-items: center; gap: 0.3rem; }

.filter-form { margin-bottom: 1rem; display: flex; gap: 0.75rem; }
.inline-form { display: inline; }

.flash-container { margin-bottom: 1rem; }
.flash { padding: 0.6rem 1rem; border-radius: 6px; margin-bottom: 0.5rem; }
.flash-success { background: #e3f8e9; color: #1a7a3a; }
.flash-error { background: #fde8e8; color: #b02a2a; }

section { margin-bottom: 2rem; }

.legend { display: flex; gap: 1.25rem; margin: 0.75rem 0; font-size: 0.8rem; color: #556; }
.legend-item { display: inline-flex; align-items: center; gap: 6px; }
.swatch { display: inline-block; width: 10px; height: 10px; border-radius: 2px; }
.swatch-reel { background: #1f2430; }
.swatch-prevision { background: #fff; border: 1px solid #6a8fd8; }

td.prevision-cell { padding: 2px 4px; background: #f7f9fd; }
td.prevision-cell input {
    width: 60px; text-align: right; border: 1px solid #c7d3ea; border-radius: 4px;
    padding: 0.25rem 0.35rem; font-size: 0.85rem; color: #2a4a8a; background: #fff;
}
td.prevision-cell input:focus { outline: none; border-color: #6a8fd8; box-shadow: 0 0 0 2px rgba(106,143,216,0.2); }
td.prevision-cell input::placeholder { color: #aab4c8; }

.save-bar { display: flex; align-items: center; gap: 1rem; margin-top: 1rem; }
.save-bar button {
    background: #1f2430; color: #fff; border: none; padding: 0.55rem 1.1rem;
    border-radius: 6px; cursor: pointer;
}
.save-bar .hint { font-size: 0.8rem; }

h2 { margin-top: 2rem; }
.row-calcule { background: #f7f7f9; font-style: italic; color: #556; }
.row-ecart td { font-weight: 700; }
.ecart-ok { color: #1a7a3a; }
.ecart-ko { color: #b02a2a; background: #fde8e8; }

.cloture-bar {
    display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 0.75rem;
    background: #eef2fb; border: 1px solid #c7d3ea; border-radius: 6px; padding: 0.6rem 1rem; margin-bottom: 1rem;
    font-size: 0.85rem;
}
.cloture-form { display: flex; gap: 0.5rem; align-items: center; }
.cloture-form button {
    background: #2a4a8a; color: #fff; border: none; padding: 0.4rem 0.8rem; border-radius: 5px; cursor: pointer; font-size: 0.8rem;
}
