/* Dépenses Magal — thème */
:root {
  --m-green: #14532d;
  --m-green-2: #166534;
  --m-green-soft: #e8f3ec;
  --m-sand: #f6f1e7;
  --m-ink: #1c1917;
  --m-line: #e7e2d8;
  --bs-body-bg: #faf8f4;
  --bs-body-color: #1f2421;
  --bs-border-color: #e5e1d8;
  --bs-primary: #166534;
  --bs-primary-rgb: 22, 101, 52;
  --bs-link-color: #166534;
  --bs-link-color-rgb: 22, 101, 52;
  --bs-link-hover-color: #14532d;
  --bs-font-sans-serif: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
body { font-feature-settings: "tnum" 1; }

.btn-primary {
  --bs-btn-bg: #166534; --bs-btn-border-color: #166534;
  --bs-btn-hover-bg: #14532d; --bs-btn-hover-border-color: #14532d;
  --bs-btn-active-bg: #0f3f22; --bs-btn-active-border-color: #0f3f22;
  --bs-btn-disabled-bg: #166534; --bs-btn-disabled-border-color: #166534;
}
.btn-outline-primary {
  --bs-btn-color: #166534; --bs-btn-border-color: #166534;
  --bs-btn-hover-bg: #166534; --bs-btn-hover-border-color: #166534;
  --bs-btn-active-bg: #14532d; --bs-btn-active-border-color: #14532d;
}
.btn-outline-secondary.active, .btn-outline-secondary:active { background: #166534; border-color: #166534; color: #fff; }
.progress { --bs-progress-bar-bg: #166534; background: #e7efe9; }
.form-control:focus, .form-select:focus { border-color: #4d9a6a; box-shadow: 0 0 0 .2rem rgba(22, 101, 52, .15); }
.form-check-input:checked { background-color: #166534; border-color: #166534; }

/* barre de navigation */
.app-nav { background: var(--m-green); }
.app-nav .navbar-brand, .app-nav .nav-link { color: rgba(255, 255, 255, .86); }
.app-nav .navbar-brand { color: #fff; font-weight: 600; letter-spacing: .01em; }
.app-nav .nav-link:hover, .app-nav .nav-link:focus { color: #fff; }
.app-nav .nav-link.active { color: #fff; font-weight: 600; box-shadow: inset 0 -2px 0 #e9c46a; }
.app-nav .navbar-toggler { border-color: rgba(255, 255, 255, .3); }
.app-nav .navbar-toggler-icon { filter: invert(1); }

/* cartes et tableaux */
.card { border-color: var(--m-line); border-radius: .75rem; box-shadow: 0 1px 2px rgba(28, 25, 23, .04); }
.card-header { background: #fff; border-bottom-color: var(--m-line); }
.card-header:first-child { border-radius: .75rem .75rem 0 0; }
.card-footer { background: #fdfcfa; border-top-color: var(--m-line); }
.table { --bs-table-bg: transparent; margin-bottom: 0; }
.table > :not(caption) > * > * { border-bottom-color: #efebe3; }
.table thead th { font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: #6b6458; font-weight: 600; white-space: nowrap; background: #fbfaf7; }
.table-money td.text-end, .table-money th.text-end { font-variant-numeric: tabular-nums; white-space: nowrap; }
.table-lignes tr.group td { background: var(--m-sand); font-weight: 600; font-size: .85rem; padding-top: .55rem; padding-bottom: .55rem; }
.table-lignes tr.subtotal td { font-size: .82rem; color: #57534e; font-weight: 600; border-bottom-width: 2px; }
.row-link { cursor: pointer; }
.table-scroll { max-height: 440px; overflow-y: auto; }
.dot { display: inline-block; width: .6rem; height: .6rem; border-radius: 50%; margin-right: .45rem; vertical-align: .05em; }
.eyebrow { font-size: .75rem; text-transform: uppercase; letter-spacing: .08em; color: #8a7f6c; font-weight: 600; }

/* indicateurs */
.kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: .75rem; }
.kpis.kpis-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.kpi { background: #fff; border: 1px solid var(--m-line); border-radius: .75rem; padding: .85rem 1rem; }
.kpi .k { font-size: .75rem; color: #6b6458; text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
.kpi .v { font-size: 1.45rem; font-weight: 650; line-height: 1.2; margin-top: .2rem; font-variant-numeric: tabular-nums; }
.kpi .s { font-size: .78rem; color: #8a8378; margin-top: .15rem; }
.kpi-solde.pos { background: var(--m-green-soft); border-color: #cfe5d6; }
.kpi-solde.neg { background: #fdeeee; border-color: #f3cccc; }
.kpi-solde.neg .v { color: #b42318; }
@media (max-width: 991.98px) { .kpis, .kpis.kpis-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .kpis .kpi-solde { grid-column: 1 / -1; } }
.kpis-mini .k { font-size: .72rem; color: #8a8378; text-transform: uppercase; letter-spacing: .04em; }
.kpis-mini .v { font-weight: 600; font-variant-numeric: tabular-nums; }

.edition-card { transition: transform .12s ease, box-shadow .12s ease; }
.edition-card:hover { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(28, 25, 23, .08); }
.badge-statut-preparation { background: #fff4d6; color: #7a5300; }
.badge-statut-en_cours { background: #dbeafe; color: #1e40af; }
.badge-statut-cloture { background: #ece9e2; color: #57534e; }

.nav-tabs { border-bottom: 0; }
.nav-tabs .nav-link { color: #57534e; border: 1px solid transparent; border-bottom: 0; border-radius: .6rem .6rem 0 0; }
.nav-tabs .nav-link.active { background: #fff; border-color: var(--m-line); color: var(--m-ink); font-weight: 600; }
.card-tabbed { border-top-left-radius: 0; }

.chart-box { position: relative; width: 100%; }
.form-narrow { max-width: 820px; }
.notes { white-space: normal; line-height: 1.6; }
.heat td[style] { background: rgba(22, 101, 52, calc(var(--a) * .22)); }

/* connexion */
body.bare { background: radial-gradient(1200px 600px at 20% -10%, #e5f0e8 0, transparent 60%), #f6f1e7; min-height: 100vh; }
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1rem; }
.login-card { width: 100%; max-width: 400px; background: #fff; border: 1px solid var(--m-line); border-radius: 1rem; padding: 2rem 1.75rem; box-shadow: 0 10px 30px rgba(28, 25, 23, .08); }

@media (max-width: 575.98px) {
  .kpi .v { font-size: 1.2rem; }
  h1.h3 { font-size: 1.4rem; }
  .table > :not(caption) > * > * { padding: .45rem .4rem; }
}

/* impression */
@media print {
  .no-print, .breadcrumb, .btn, .modal { display: none !important; }
  body { background: #fff; }
  .tab-content > .tab-pane { display: block !important; opacity: 1 !important; margin-bottom: 1.5rem; }
  .card { box-shadow: none; break-inside: avoid-page; }
  .kpis { grid-template-columns: repeat(5, 1fr); }
  a { color: inherit !important; text-decoration: none !important; }
}
.chart-box > .svg-chart { width: 100%; height: 100%; } .svg-chart svg { display: block; max-width: 100%; height: auto; }
h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6 { color: var(--m-ink); }
.btn-primary { background-image: none; }
.cron-cmd { background: #f4f1ea; border: 1px solid var(--m-line); border-radius: .5rem; padding: .5rem .65rem; font-size: .78rem; white-space: pre-wrap; word-break: break-all; user-select: all; }
.auto-next { background: #fbfaf7; border: 1px solid var(--m-line); border-radius: .6rem; padding: .65rem .8rem; }
.col-eur { color: #57534e; }
