/* ============================================================================
   FinanceCI — design system v3 : classique, sobre, vivant.
   Inter + JetBrains Mono. Cream + ink + accents tintés.
============================================================================ */

/* ─── 1. TOKENS ──────────────────────────────────────────────────────────── */
:root {
  /* Texte & surface */
  --ink:        #0f172a;
  --ink-2:      #1e293b;
  --ink-3:      #334155;
  --paper:      #f6f4ef;
  --paper-2:    #ede9df;
  --surface:    #ffffff;
  --surface-2:  #fbfaf6;

  /* Filets */
  --rule:       #d8d2c2;
  --rule-1:     #e7e2d2;
  --rule-2:     #c4bda9;

  /* Texte secondaire */
  --mute:       #6b6555;
  --mute-2:     #8a8473;
  --mute-3:     #afa996;

  /* Accents — palette vivante mais retenue */
  --indigo:     #4f46e5;
  --indigo-bg:  #eef0ff;
  --indigo-rim: #c7caf6;

  --emerald:    #059669;
  --emerald-bg: #e6f6ef;
  --emerald-rim:#a8e0c2;

  --amber:      #c2780b;
  --amber-bg:   #fbf2dd;
  --amber-rim:  #ecd49a;

  --rose:       #be123c;
  --rose-bg:    #fbe8ea;
  --rose-rim:   #efb9c1;

  --teal:       #0d7490;
  --teal-bg:    #d8eef3;
  --teal-rim:   #9bd0db;

  --terracotta: #b54818;
  --terracotta-bg:#f3e1d4;

  /* Statuts unifiés */
  --pos:        var(--emerald);
  --pos-bg:     var(--emerald-bg);
  --warn:       var(--amber);
  --warn-bg:    var(--amber-bg);
  --neg:        var(--rose);
  --neg-bg:     var(--rose-bg);
  --info:       var(--teal);
  --info-bg:    var(--teal-bg);

  /* Typographie — Inter only (classique) */
  --font-body:  'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono:  'JetBrains Mono', ui-monospace, 'SF Mono', monospace;

  /* Spacing & radii */
  --r-sm: 4px;
  --r:    8px;
  --r-lg: 12px;
  --r-xl: 16px;

  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow:    0 1px 3px rgba(15, 23, 42, 0.05), 0 0 0 1px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 12px 32px -8px rgba(15, 23, 42, 0.12);
}

/* ─── 2. RESET ───────────────────────────────────────────────────────────── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
body {
  font-family: var(--font-body);
  font-size: 14px;
  font-feature-settings: 'cv11', 'ss01';
  line-height: 1.5;
  color: var(--ink);
  background: var(--paper);
  min-height: 100vh;
  letter-spacing: -0.005em;
}
img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: none; }
a { color: inherit; text-decoration: none; }
table { border-collapse: collapse; width: 100%; }
th { text-align: left; font-weight: 500; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: var(--rule-2); border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: var(--mute-2); }
::selection { background: var(--ink); color: var(--paper); }

input:focus, select:focus, textarea:focus {
  border-color: var(--ink) !important;
  box-shadow: 0 0 0 3px rgba(15, 23, 42, 0.08);
  background: var(--surface);
}

.tnum { font-variant-numeric: tabular-nums; font-feature-settings: 'tnum'; }

/* ─── 3. LAYOUT ──────────────────────────────────────────────────────────── */
.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: 240px;
  background: var(--ink);
  color: rgba(255,255,255,0.78);
  position: sticky;
  top: 0;
  height: 100vh;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  padding: 22px 0 16px;
  overflow-y: auto;
  border-right: 1px solid rgba(255,255,255,0.06);
}

.brand {
  padding: 4px 22px 24px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.brand-mark {
  font-weight: 800;
  font-size: 20px;
  letter-spacing: -0.02em;
  color: white;
  line-height: 1;
}
.brand-mark span { color: var(--terracotta); }
.brand-sub {
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.4);
  margin-top: 5px;
  font-weight: 500;
}

.nav-section {
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.34);
  padding: 16px 22px 6px;
  font-weight: 600;
}
.nav-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 22px;
  font-size: 13.5px;
  color: rgba(255,255,255,0.62);
  font-weight: 500;
  position: relative;
  transition: all 0.15s ease;
  border-left: 2px solid transparent;
}
.nav-link:hover { color: white; background: rgba(255,255,255,0.04); }
.nav-link.is-active {
  color: white;
  font-weight: 600;
  background: rgba(255,255,255,0.06);
  border-left-color: var(--terracotta);
}
.nav-num {
  font-family: var(--font-mono);
  font-size: 11px;
  color: rgba(255,255,255,0.34);
  font-variant-numeric: tabular-nums;
  font-weight: 500;
}

.sidebar-foot {
  margin-top: auto;
  padding: 16px 22px 0;
  border-top: 1px solid rgba(255,255,255,0.06);
}
.alert-mini {
  background: rgba(190, 18, 60, 0.14);
  border: 1px solid rgba(190, 18, 60, 0.3);
  border-radius: var(--r);
  padding: 10px 12px;
  margin-bottom: 14px;
  font-size: 12px;
  color: #f5b3bf;
}
.alert-mini strong {
  display: block;
  font-weight: 700;
  font-size: 14px;
  color: white;
  margin-bottom: 2px;
}
.alert-mini-amount { font-family: var(--font-mono); font-size: 11px; color: #f3a3b1; }

.user-block {
  font-size: 12px;
  color: rgba(255,255,255,0.5);
  line-height: 1.55;
}
.user-block .who {
  color: white;
  display: block;
  font-weight: 600;
  font-size: 13px;
  margin-bottom: 1px;
  letter-spacing: -0.01em;
}
.btn-logout {
  margin-top: 12px;
  width: 100%;
  padding: 8px 12px;
  background: transparent;
  border: 1px solid rgba(255,255,255,0.14);
  color: rgba(255,255,255,0.7);
  border-radius: var(--r);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 600;
  transition: all 0.15s ease;
}
.btn-logout:hover { background: rgba(255,255,255,0.06); color: white; }

/* ─── 4. MAIN ────────────────────────────────────────────────────────────── */
.main {
  flex: 1;
  padding: 36px 48px 80px;
  overflow-x: auto;
  min-width: 0;
  max-width: 100%;
}

/* En-tête de page */
.page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 20px;
  padding-bottom: 20px;
  margin-bottom: 28px;
  border-bottom: 1px solid var(--rule-1);
}
.page-eyebrow {
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--mute);
  font-weight: 700;
  margin-bottom: 8px;
}
.page-title {
  font-weight: 800;
  font-size: 30px;
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: var(--ink);
}
.page-title em { font-style: normal; color: var(--terracotta); font-weight: 800; }
.page-sub {
  margin-top: 6px;
  color: var(--mute);
  font-size: 13.5px;
  max-width: 60ch;
}

/* ─── 5. CARDS ───────────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--rule-1);
  border-radius: var(--r-lg);
  padding: 24px 26px;
  position: relative;
  overflow: hidden;
}
.card-tight { padding: 18px; }
.card-flush { padding: 0; overflow: hidden; }

/* Cards avec accent coloré (top stripe) */
.card.accent-indigo   { box-shadow: inset 0 3px 0 var(--indigo); }
.card.accent-emerald  { box-shadow: inset 0 3px 0 var(--emerald); }
.card.accent-amber    { box-shadow: inset 0 3px 0 var(--amber); }
.card.accent-rose     { box-shadow: inset 0 3px 0 var(--rose); }
.card.accent-teal     { box-shadow: inset 0 3px 0 var(--teal); }
.card.accent-terra    { box-shadow: inset 0 3px 0 var(--terracotta); }

.card-title {
  font-weight: 700;
  font-size: 16px;
  letter-spacing: -0.01em;
  color: var(--ink);
  margin-bottom: 4px;
}
.card-subtitle {
  font-size: 12.5px;
  color: var(--mute);
  margin-bottom: 22px;
}
.card-divider {
  height: 1px;
  background: var(--rule-1);
  margin: 18px 0;
}

/* ─── 6. KPI tintés ──────────────────────────────────────────────────────── */
.kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}
.kpi-cell {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--rule-1);
  border-radius: var(--r-lg);
  padding: 22px 24px;
  overflow: hidden;
  transition: transform .15s ease, box-shadow .15s ease;
}
.kpi-cell::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--mute-3);
}
.kpi-cell:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.kpi-cell.tint-indigo   { background: linear-gradient(180deg, var(--indigo-bg)  0%, var(--surface) 100%); border-color: var(--indigo-rim); }
.kpi-cell.tint-indigo::before  { background: var(--indigo); }
.kpi-cell.tint-indigo .kpi-value { color: var(--indigo); }

.kpi-cell.tint-emerald  { background: linear-gradient(180deg, var(--emerald-bg) 0%, var(--surface) 100%); border-color: var(--emerald-rim); }
.kpi-cell.tint-emerald::before { background: var(--emerald); }
.kpi-cell.tint-emerald .kpi-value { color: var(--emerald); }

.kpi-cell.tint-amber    { background: linear-gradient(180deg, var(--amber-bg)   0%, var(--surface) 100%); border-color: var(--amber-rim); }
.kpi-cell.tint-amber::before   { background: var(--amber); }
.kpi-cell.tint-amber .kpi-value { color: var(--amber); }

.kpi-cell.tint-rose     { background: linear-gradient(180deg, var(--rose-bg)    0%, var(--surface) 100%); border-color: var(--rose-rim); }
.kpi-cell.tint-rose::before    { background: var(--rose); }
.kpi-cell.tint-rose .kpi-value { color: var(--rose); }

.kpi-label {
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--mute);
  font-weight: 700;
  margin-bottom: 12px;
}
.kpi-value {
  font-weight: 700;
  font-size: 26px;
  line-height: 1.05;
  color: var(--ink);
  letter-spacing: -0.025em;
  font-variant-numeric: tabular-nums;
  display: flex;
  align-items: baseline;
  gap: 6px;
}
.kpi-value .kpi-currency {
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 11px;
  color: var(--mute);
  letter-spacing: 0.04em;
}
.kpi-meta {
  margin-top: 12px;
  font-size: 11.5px;
  color: var(--mute);
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 12px;
}
.kpi-spark { opacity: 0.9; flex-shrink: 0; }

/* ─── 7. BUTTONS ─────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 16px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.005em;
  border-radius: var(--r);
  border: 1px solid transparent;
  transition: all 0.15s ease;
  white-space: nowrap;
  line-height: 1.2;
  font-family: var(--font-body);
  text-decoration: none;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-primary  { background: var(--ink);        color: white; }
.btn-primary:hover { background: var(--ink-2); }
.btn-accent   { background: var(--terracotta); color: white; }
.btn-accent:hover { background: #963710; }
.btn-ghost    { background: transparent; color: var(--ink-2); border-color: var(--rule-2); }
.btn-ghost:hover { background: var(--surface-2); border-color: var(--ink-3); }
.btn-quiet    { background: transparent; color: var(--mute); padding: 6px 10px; }
.btn-quiet:hover { color: var(--ink); background: var(--paper-2); }
.btn-danger   { background: transparent; color: var(--neg); border-color: rgba(190, 18, 60, 0.3); }
.btn-danger:hover { background: var(--neg-bg); }
.btn-sm { padding: 7px 12px; font-size: 12px; }
.btn-lg { padding: 12px 22px; font-size: 14px; }
.btn-block { width: 100%; }

/* ─── 8. FORMS ───────────────────────────────────────────────────────────── */
.field { margin-bottom: 16px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.field-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
.field label, .label {
  display: block;
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--ink-2);
  font-weight: 600;
  margin-bottom: 6px;
}
.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 10px 13px;
  background: var(--surface);
  border: 1px solid var(--rule-2);
  border-radius: var(--r);
  font-size: 14px;
  color: var(--ink);
  transition: all 0.15s ease;
  font-family: var(--font-body);
}
.field input[readonly] { background: var(--paper-2); color: var(--mute); cursor: not-allowed; }
.field input[type="number"], .field input[type="date"] { font-variant-numeric: tabular-nums; font-family: var(--font-mono); font-size: 13px; }
.field textarea { resize: vertical; min-height: 88px; line-height: 1.5; }
.field-help { margin-top: 5px; font-size: 11.5px; color: var(--mute); }

.fieldset {
  border: 1px solid var(--rule-1);
  border-radius: var(--r-lg);
  padding: 22px 24px 6px;
  margin-bottom: 22px;
  background: var(--surface);
  position: relative;
}
.fieldset-title {
  display: inline-block;
  background: var(--paper);
  padding: 0 10px;
  font-weight: 700;
  font-size: 12.5px;
  color: var(--ink);
  position: absolute;
  top: -8px;
  left: 18px;
  letter-spacing: -0.005em;
}

.form-actions {
  display: flex;
  gap: 10px;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--rule-1);
  justify-content: flex-end;
  align-items: center;
}
.form-actions.split { justify-content: space-between; }

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--ink);
  font-weight: 500;
  cursor: pointer;
}
.toggle input { width: 16px; height: 16px; accent-color: var(--ink); cursor: pointer; }

/* ─── 9. TABLES ──────────────────────────────────────────────────────────── */
.tbl-wrap {
  background: var(--surface);
  border: 1px solid var(--rule-1);
  border-radius: var(--r-lg);
  overflow: hidden;
}
.tbl { width: 100%; border-collapse: collapse; }
.tbl th {
  text-align: left;
  padding: 14px 20px;
  font-size: 10.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--mute);
  border-bottom: 1px solid var(--rule-1);
  background: var(--surface-2);
  font-weight: 700;
  white-space: nowrap;
}
.tbl td {
  padding: 14px 20px;
  font-size: 13.5px;
  color: var(--ink-2);
  border-bottom: 1px solid var(--rule-1);
  vertical-align: middle;
}
.tbl tbody tr { transition: background .12s ease; }
.tbl tbody tr:hover { background: var(--surface-2); }
.tbl tbody tr:last-child td { border-bottom: none; }
.tbl .num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-size: 13px; }
.tbl .ref { font-family: var(--font-mono); font-size: 12px; color: var(--ink-2); letter-spacing: -0.01em; font-weight: 500; }
.tbl .lead { font-weight: 600; color: var(--ink); }
.tbl .right { text-align: right; }
.tbl .center { text-align: center; }
.tbl-actions { display: flex; gap: 4px; justify-content: flex-end; align-items: center; }
.tbl-row-foot td {
  background: var(--paper-2);
  font-weight: 600;
  border-top: 2px solid var(--rule-2);
}

.empty {
  padding: 70px 32px;
  text-align: center;
  color: var(--mute);
}
.empty-mark {
  font-weight: 200;
  font-size: 56px;
  color: var(--rule-2);
  margin-bottom: 10px;
  line-height: 1;
}
.empty-text { font-size: 14px; max-width: 36ch; margin: 0 auto; }
.empty .link { color: var(--terracotta); }

/* ─── 10. TAGS / badges ──────────────────────────────────────────────────── */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  border: 1px solid;
  border-radius: 20px;
  white-space: nowrap;
}
.tag::before {
  content: '';
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
}
.tag-pos   { color: var(--pos);   background: var(--pos-bg);   border-color: var(--emerald-rim); }
.tag-warn  { color: var(--warn);  background: var(--warn-bg);  border-color: var(--amber-rim); }
.tag-neg   { color: var(--neg);   background: var(--neg-bg);   border-color: var(--rose-rim); }
.tag-info  { color: var(--info);  background: var(--info-bg);  border-color: var(--teal-rim); }
.tag-quiet { color: var(--mute);  background: var(--paper-2);  border-color: var(--rule-2); }

/* ─── 11. FLASH ──────────────────────────────────────────────────────────── */
.flash {
  padding: 12px 18px;
  border-radius: var(--r);
  margin-bottom: 20px;
  font-size: 13.5px;
  border: 1px solid;
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 500;
}
.flash::before {
  font-weight: 700;
  font-size: 14px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: currentColor;
  color: white;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.flash-success { background: var(--pos-bg);  border-color: var(--emerald-rim); color: var(--pos); }
.flash-success::before { content: '✓'; }
.flash-error   { background: var(--neg-bg);  border-color: var(--rose-rim);    color: var(--neg); }
.flash-error::before { content: '!'; }
.flash-warning { background: var(--warn-bg); border-color: var(--amber-rim);   color: var(--warn); }
.flash-warning::before { content: '!'; }
.flash-info    { background: var(--info-bg); border-color: var(--teal-rim);    color: var(--info); }
.flash-info::before { content: 'i'; }

/* ─── 12. FILTERS — ligne dédiée ─────────────────────────────────────────── */
.filters {
  display: flex;
  gap: 12px;
  align-items: flex-end;
  background: var(--surface);
  border: 1px solid var(--rule-1);
  border-radius: var(--r-lg);
  padding: 14px 16px;
  margin-bottom: 22px;
  flex-wrap: wrap;
}
.filters .field { margin: 0; flex: 1; min-width: 130px; }
.filters .field input, .filters .field select { padding: 9px 12px; font-size: 13px; }
.filters .field label { font-size: 10px; margin-bottom: 4px; letter-spacing: 0.06em; color: var(--mute); font-weight: 600; }

/* Filtre-bar étroite (dashboard) — date du / au + bouton */
.filter-bar {
  display: flex;
  gap: 12px;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--rule-1);
  border-radius: var(--r-lg);
  padding: 12px 18px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.filter-bar .filter-label {
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--mute);
  font-weight: 700;
  padding-right: 4px;
}
.filter-bar .field { margin: 0; }
.filter-bar .field label { display: none; }
.filter-bar .field input, .filter-bar .field select { padding: 8px 12px; font-size: 13px; min-width: 150px; }
.filter-bar .filter-sep { width: 1px; height: 22px; background: var(--rule-1); margin: 0 4px; }

/* ─── 13. UTILS ──────────────────────────────────────────────────────────── */
.muted { color: var(--mute); }
.dim   { color: var(--mute-2); }
.right { text-align: right; }
.center { text-align: center; }
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.link { color: var(--terracotta); border-bottom: 1px solid currentColor; padding-bottom: 1px; font-weight: 500; }
.link:hover { color: #963710; }
.lead { font-weight: 600; color: var(--ink); }

/* ─── 14. DASHBOARD éléments ─────────────────────────────────────────────── */
.editorial-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
@media (max-width: 1100px) { .editorial-grid { grid-template-columns: 1fr; } }

.bar-row { margin-bottom: 14px; }
.bar-row:last-child { margin-bottom: 0; }
.bar-label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 13px;
  margin-bottom: 6px;
  gap: 10px;
}
.bar-label .name { color: var(--ink); font-weight: 600; }
.bar-label .val  { font-family: var(--font-mono); font-size: 11.5px; color: var(--mute); white-space: nowrap; }
.bar-track { height: 6px; background: var(--paper-2); border-radius: 3px; overflow: hidden; }
.bar-fill { height: 100%; transition: width .6s cubic-bezier(.2,.8,.2,1); border-radius: 3px; }

/* ─── 15. COMPTES (cartes) ───────────────────────────────────────────────── */
.compte-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 16px;
}
.compte-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--rule-1);
  border-radius: var(--r-lg);
  padding: 22px 24px;
  display: block;
  transition: all .2s ease;
  overflow: hidden;
}
.compte-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(79,70,229,0.04) 0%, rgba(255,255,255,0) 60%);
  pointer-events: none;
}
.compte-card::after {
  content: '→';
  position: absolute;
  top: 22px;
  right: 22px;
  color: var(--mute-3);
  font-size: 18px;
  transition: all .2s ease;
}
.compte-card:hover {
  border-color: var(--ink-3);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}
.compte-card:hover::after { color: var(--terracotta); transform: translate(4px, 0); }

.compte-name {
  font-weight: 700;
  font-size: 17px;
  color: var(--ink);
  letter-spacing: -0.015em;
  line-height: 1.2;
  margin-bottom: 2px;
  padding-right: 28px;
  position: relative;
}
.compte-co {
  font-size: 11.5px;
  color: var(--mute);
  letter-spacing: 0.04em;
  margin-bottom: 18px;
  position: relative;
}
.compte-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px 22px;
  padding-top: 16px;
  border-top: 1px solid var(--rule-1);
  position: relative;
}
.compte-stat-l {
  font-size: 9.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--mute);
  font-weight: 700;
  margin-bottom: 4px;
}
.compte-stat-v {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: -0.01em;
}
.compte-stat.is-pos .compte-stat-v { color: var(--pos); }
.compte-stat.is-warn .compte-stat-v { color: var(--warn); }
.compte-stat.is-neg .compte-stat-v { color: var(--neg); }

/* ─── 16. RELEVÉ ─────────────────────────────────────────────────────────── */
.releve-head {
  background: linear-gradient(135deg, var(--ink) 0%, var(--ink-2) 100%);
  color: white;
  border-radius: var(--r-lg);
  padding: 32px 38px;
  margin-bottom: 20px;
  position: relative;
  overflow: hidden;
}
.releve-head::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(at 88% 25%, rgba(181, 72, 24, 0.22) 0%, transparent 50%);
}
.releve-head-inner { position: relative; }
.releve-eyebrow {
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.55);
  font-weight: 700;
  margin-bottom: 8px;
}
.releve-title {
  font-weight: 800;
  font-size: 30px;
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: white;
  margin-bottom: 6px;
}
.releve-sub { color: rgba(255,255,255,0.62); font-size: 14px; }
.releve-meta {
  margin-top: 14px;
  font-size: 12px;
  color: rgba(255,255,255,0.55);
  display: flex;
  flex-wrap: wrap;
  gap: 6px 22px;
  font-family: var(--font-mono);
}
.releve-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-start; }
.releve-actions .btn-ghost { color: white; border-color: rgba(255,255,255,0.22); }
.releve-actions .btn-ghost:hover { background: rgba(255,255,255,0.06); border-color: rgba(255,255,255,0.4); }

.releve-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px;
  margin-bottom: 22px;
}
.releve-kpi {
  background: var(--surface);
  border: 1px solid var(--rule-1);
  border-radius: var(--r-lg);
  padding: 16px 20px;
  position: relative;
  overflow: hidden;
}
.releve-kpi::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: var(--mute-3);
}
.releve-kpi.tint-indigo::before  { background: var(--indigo); }
.releve-kpi.tint-emerald::before { background: var(--emerald); }
.releve-kpi.tint-amber::before   { background: var(--amber); }
.releve-kpi.tint-rose::before    { background: var(--rose); }

.releve-kpi-l {
  font-size: 9.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--mute);
  font-weight: 700;
  margin-bottom: 8px;
}
.releve-kpi-v {
  font-weight: 700;
  font-size: 22px;
  color: var(--ink);
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  line-height: 1.05;
}
.releve-kpi-s { margin-top: 4px; font-size: 11px; color: var(--mute); }

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--mute);
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 600;
  margin-bottom: 16px;
  transition: color .15s ease;
}
.back-link:hover { color: var(--terracotta); }

/* ─── 17. LOGIN ──────────────────────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--paper);
}
@media (max-width: 900px) { .login-page { grid-template-columns: 1fr; } }

.login-aside {
  background: linear-gradient(135deg, var(--ink) 0%, var(--ink-2) 100%);
  color: white;
  padding: 56px;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
@media (max-width: 900px) { .login-aside { display: none; } }
.login-aside::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(at 80% 10%, rgba(181, 72, 24, 0.22) 0%, transparent 55%),
    radial-gradient(at 5% 100%, rgba(79,70,229, 0.18) 0%, transparent 55%);
}
.login-aside-content { position: relative; z-index: 1; }
.login-mark {
  font-weight: 800;
  font-size: 28px;
  letter-spacing: -0.02em;
  color: white;
  line-height: 1;
}
.login-mark span { color: var(--terracotta); }
.login-quote {
  position: relative;
  z-index: 1;
  font-weight: 600;
  font-size: 26px;
  line-height: 1.3;
  letter-spacing: -0.01em;
  color: white;
  margin-top: auto;
  max-width: 460px;
}
.login-quote-attr {
  margin-top: 18px;
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.5);
}
.login-form-side {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 56px;
}
.login-form { width: 100%; max-width: 380px; }
.login-eyebrow {
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--mute);
  font-weight: 700;
  margin-bottom: 12px;
}
.login-h1 {
  font-weight: 800;
  font-size: 34px;
  line-height: 1.1;
  letter-spacing: -0.025em;
  color: var(--ink);
  margin-bottom: 10px;
}
.login-sub { color: var(--mute); font-size: 14px; margin-bottom: 32px; }
.login-mark-mobile {
  display: none;
  font-weight: 800;
  font-size: 24px;
  letter-spacing: -0.02em;
  margin-bottom: 24px;
}
.login-mark-mobile span { color: var(--terracotta); }
@media (max-width: 900px) { .login-mark-mobile { display: block; } }

/* ─── 18. LIGNES facture ─────────────────────────────────────────────────── */
.lignes {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}
.lignes th {
  text-align: left;
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--mute);
  font-weight: 700;
  padding: 10px 12px;
  border-bottom: 1px solid var(--rule-1);
}
.lignes td { padding: 6px; vertical-align: top; }
.lignes input {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--rule-1);
  border-radius: var(--r);
  background: var(--paper);
  font-size: 13px;
  color: var(--ink);
}
.lignes input:focus { background: var(--surface); }
.lignes .col-sm { width: 90px; }
.lignes .col-md { width: 150px; }
.lignes .col-act { width: 36px; }
.icon-x {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  color: var(--mute-2);
  font-size: 14px;
  border: 1px solid var(--rule-2);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 4px auto;
  transition: all .15s ease;
}
.icon-x:hover { color: var(--neg); border-color: var(--neg); background: var(--neg-bg); }

.totals {
  margin-top: 20px;
  padding: 20px 22px;
  background: linear-gradient(180deg, var(--surface-2) 0%, var(--paper-2) 100%);
  border: 1px solid var(--rule-1);
  border-radius: var(--r-lg);
}
.totals-row {
  display: flex;
  justify-content: space-between;
  padding: 5px 0;
  font-size: 14px;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}
.totals-row .lbl { color: var(--mute); font-family: var(--font-body); font-weight: 500; }
.totals-row.is-total {
  font-weight: 800;
  font-size: 22px;
  margin-top: 12px;
  padding-top: 14px;
  border-top: 1px solid var(--rule-2);
  letter-spacing: -0.02em;
  color: var(--ink);
}
.totals-row.is-total .lbl { font-family: var(--font-body); font-weight: 700; color: var(--ink); font-size: 15px; }

/* ─── 19. PRINT ──────────────────────────────────────────────────────────── */
@media print {
  .sidebar, .no-print { display: none !important; }
  .main { padding: 0; }
  body { background: white; }
}
