/* ==========================================================================
   GESCO 2.0 — Dark Premium Hybride
   Navigation et Accueil sombres, espaces de travail clairs, mobile d'abord.
   ========================================================================== */

:root {
  --midnight: #101c33;
  --deep: #091426;
  --navy-2: #1b2c49;
  --turquoise: #12c8c0;
  --gold: #c9a96e;
  --gold-light: #e4cc98;
  --ivory: #f7f5ef;
  --white: #ffffff;
  --ink: #101c33;
  --muted: #687386;
  --success: #24866a;
  --warning: #d49a43;
  --danger: #c65b5b;
  --line: #e6e2d8;
  --line-soft: #efede6;
  --surface: #ffffff;
  --surface-2: #fbfaf6;
  --shadow-sm: 0 1px 2px rgba(16, 28, 51, .04), 0 10px 28px rgba(16, 28, 51, .045);
  --shadow-md: 0 22px 60px rgba(9, 20, 38, .16);
  --radius: 18px;
  --radius-sm: 12px;
  --nav-width: 252px;
  --font: "Manrope", "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  min-width: 320px;
  background: var(--ivory);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .55; }
a { color: inherit; }
img, svg { display: block; }
h1, h2, h3, p { margin-top: 0; }
h1, h2, h3 { letter-spacing: -.02em; }
::selection { background: rgba(201, 169, 110, .3); }
:focus-visible { outline: 3px solid rgba(18, 200, 192, .55); outline-offset: 2px; }

/* ---------- Boot / fatal ---------- */
.boot { min-height: 100dvh; display: grid; place-content: center; justify-items: center; gap: 18px; background: var(--deep); color: #fff; }
.boot-mark { width: 64px; height: 64px; border-radius: 18px; box-shadow: 0 12px 30px rgba(0, 0, 0, .3); }
.boot p { color: #b9c4d4; font-size: 13px; letter-spacing: .08em; text-transform: uppercase; }
.fatal { min-height: 100dvh; display: grid; place-content: center; justify-items: center; gap: 12px; padding: 30px; text-align: center; background: var(--ivory); }
.fatal img { width: 58px; height: 58px; border-radius: 16px; }
.fatal h1 { font-size: 24px; margin: 0; }
.fatal p { max-width: 460px; color: var(--muted); margin: 0; }

/* ---------- Navigation latérale ---------- */
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 40;
  width: var(--nav-width);
  display: flex;
  flex-direction: column;
  padding: 22px 14px 16px;
  background: var(--deep);
  color: #fff;
  border-right: 1px solid rgba(255, 255, 255, .07);
}
.brand { display: flex; align-items: center; gap: 12px; padding: 4px 10px 24px; color: #fff; text-decoration: none; }
.brand img { width: 42px; height: 42px; border-radius: 12px; }
.brand > span { font-weight: 800; font-size: 22px; letter-spacing: .08em; line-height: 1; }
.brand small { display: block; margin-top: 5px; color: #93a2b7; font-size: 9.5px; font-weight: 500; letter-spacing: .02em; }
.sidebar nav { display: flex; flex-direction: column; gap: 5px; overflow-y: auto; }
.nav-link {
  width: 100%;
  min-height: 46px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 13px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: #b8c3d3;
  font-size: 13.5px;
  font-weight: 550;
  text-align: left;
  transition: background .2s ease, color .2s ease, box-shadow .2s ease;
}
.nav-link:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.nav-link.active { background: rgba(201, 169, 110, .13); color: #fff; box-shadow: inset 3px 0 0 var(--gold); }
.nav-icon { display: grid; place-items: center; width: 20px; height: 20px; color: var(--gold-light); }
.nav-icon svg { width: 19px; height: 19px; }
.nav-link.active .nav-icon { color: var(--turquoise); }
.sidebar-footer { margin-top: auto; padding: 15px 10px 4px; border-top: 1px solid rgba(255, 255, 255, .09); color: #b7c2d1; font-size: 11px; line-height: 1.4; }
.sidebar-footer small { display: block; margin-top: 5px; color: #8190a5; font-size: 10px; }
.online-dot { display: inline-block; width: 7px; height: 7px; margin-right: 6px; border-radius: 50%; background: var(--turquoise); box-shadow: 0 0 0 3px rgba(18, 200, 192, .12); }

/* ---------- Zone principale et en-tête ---------- */
.main { min-height: 100dvh; margin-left: var(--nav-width); background: var(--ivory); }
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  height: 68px;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 0 clamp(18px, 3vw, 38px);
  background: var(--midnight);
  color: #fff;
  border-bottom: 1px solid rgba(255, 255, 255, .08);
}
.menu-btn { display: none; width: 38px; height: 38px; border: 1px solid rgba(255, 255, 255, .16); border-radius: 10px; background: transparent; color: #fff; }
.topbar-brand { display: none; align-items: center; gap: 8px; color: #fff; text-decoration: none; font-weight: 800; letter-spacing: .06em; }
.topbar-brand img { width: 28px; height: 28px; border-radius: 8px; }
.crumb { flex: none; font-size: 13px; font-weight: 650; letter-spacing: .04em; color: var(--gold-light); text-transform: uppercase; }
.global-search {
  flex: 1;
  max-width: 470px;
  height: 42px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 13px;
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 12px;
  background: rgba(255, 255, 255, .07);
  color: #aeb9c9;
  transition: border-color .2s ease, background .2s ease;
}
.global-search:focus-within { border-color: var(--turquoise); background: rgba(255, 255, 255, .1); }
.global-search span { display: grid; place-items: center; }
.global-search svg { width: 17px; height: 17px; }
.global-search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: #fff; font-size: 13px; }
.global-search input::placeholder { color: #8f9caf; }
.top-date { margin-left: auto; color: #b7c2d1; font-size: 12px; white-space: nowrap; }
.admin-chip { display: flex; align-items: center; padding-left: 14px; border-left: 1px solid rgba(255, 255, 255, .14); color: #d7dee8; font-size: 11.5px; white-space: nowrap; }
.content { width: 100%; max-width: 1480px; margin: 0 auto; padding: 30px clamp(18px, 3vw, 40px) 48px; }
.mobile-nav, .mobile-shade { display: none; }

/* ---------- Titres et éléments communs ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 22px; }
.page-head > div:first-child { min-width: 0; }
.page-head h1 { margin: 3px 0 5px; font-size: clamp(25px, 3vw, 32px); line-height: 1.1; color: var(--midnight); }
.page-head .muted { max-width: 66ch; margin: 0; color: var(--muted); font-size: 13.5px; }
.page-head > .primary-btn, .page-head > .outline-btn { flex: none; }
.eyebrow { margin: 0; color: var(--muted); font-size: 9.5px; font-weight: 750; letter-spacing: .15em; text-transform: uppercase; }
.eyebrow span { color: var(--gold); }
.muted { color: var(--muted); }
.subsection-title { margin: 22px 0 10px; font-size: 13px; font-weight: 750; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.money { font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ---------- Boutons ---------- */
.primary-btn, .outline-btn, .small-btn, .file-button, .text-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 12px;
  font-weight: 700;
  text-decoration: none;
  transition: background-color .2s ease, border-color .2s ease, color .2s ease, transform .18s ease, box-shadow .2s ease;
}
.primary-btn { min-height: 44px; padding: 0 18px; border: 1px solid var(--gold); background: var(--gold); color: var(--deep); font-size: 13px; box-shadow: 0 8px 20px rgba(201, 169, 110, .2); }
.primary-btn:hover { background: var(--gold-light); border-color: var(--gold-light); transform: translateY(-1px); }
.primary-btn:active { transform: translateY(0); }
.primary-btn span { font-size: 16px; line-height: 1; }
.outline-btn { min-height: 44px; padding: 0 16px; border: 1px solid var(--line); background: var(--surface); color: var(--midnight); font-size: 13px; }
.outline-btn:hover { border-color: var(--gold); background: #fdfaf2; }
.small-btn { min-height: 34px; padding: 6px 11px; border: 1px solid var(--line); background: var(--surface-2); color: var(--midnight); font-size: 11.5px; font-weight: 650; }
.small-btn:hover { border-color: var(--gold); background: #fdf8ec; }
.icon-btn { display: inline-grid; place-items: center; width: 38px; height: 38px; flex: none; padding: 0; border: 1px solid transparent; border-radius: 10px; background: transparent; color: var(--muted); font-size: 22px; line-height: 1; transition: background .18s ease, color .18s ease; }
.icon-btn:hover { background: var(--surface-2); color: var(--midnight); }
.icon-btn svg { width: 18px; height: 18px; }
.row-menu { width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--muted); }
.row-menu:hover { border-color: var(--gold); color: var(--midnight); }
.text-action { padding: 0; border: 0; background: none; color: var(--gold); font-size: 12px; }
.text-action:hover { color: var(--gold-light); }
.file-button { min-height: 44px; padding: 0 16px; border: 1px dashed var(--line); background: var(--surface-2); color: var(--midnight); font-size: 12.5px; cursor: pointer; }
.file-button:hover { border-color: var(--gold); background: #fdf8ec; }

/* ---------- Badges, avatars, tags ---------- */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 4px 9px; border-radius: 999px; font-size: 10.5px; font-weight: 750; line-height: 1.35; white-space: nowrap; }
.badge.green { background: rgba(36, 134, 106, .11); color: #1d6d56; }
.badge.amber { background: rgba(212, 154, 67, .14); color: #9a671d; }
.badge.red { background: rgba(198, 91, 91, .12); color: #a43d3d; }
.badge.gray { background: #eef0f3; color: #5f6b7c; }
.avatar { display: grid; place-items: center; width: 40px; height: 40px; flex: none; border-radius: 50%; background: var(--navy-2); color: var(--gold-light); font-size: 12px; font-weight: 800; letter-spacing: .04em; }
.receipt-tag { display: inline-block; padding: 4px 8px; border-radius: 7px; background: #f4efe2; color: #725c32; font-size: 10.5px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.cell-sub { display: block; margin-top: 2px; color: var(--muted); font-size: 10.5px; font-weight: 400; }
.count-label { margin-left: auto; color: var(--muted); font-size: 11px; white-space: nowrap; }
.missing-cell { color: #aab3bf; text-align: center; }

/* ---------- Cartes et étiquettes statistiques ---------- */
.card { margin-bottom: 16px; padding: 21px 22px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-sm); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 15px; }
.card h2 { margin: 0; font-size: 15px; font-weight: 750; color: var(--midnight); }
.stat-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.stat-card { position: relative; display: flex; flex-direction: column; gap: 5px; min-width: 0; min-height: 104px; padding: 16px 17px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); box-shadow: 0 1px 2px rgba(16, 28, 51, .03); }
.stat-label { color: var(--muted); font-size: 10.5px; font-weight: 650; letter-spacing: .04em; text-transform: uppercase; }
.stat-card strong { color: var(--midnight); font-size: 21px; font-weight: 800; line-height: 1.15; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.stat-card small { color: var(--muted); font-size: 10.5px; }
.stat-card.late-metric { border-top: 3px solid var(--danger); }

/* ---------- Accueil sombre ---------- */
body[data-page="home"] { background: var(--deep); }
body[data-page="home"] .main,
body[data-page="home"] .content { background: var(--deep); }
body[data-page="home"] .topbar { background: var(--deep); border-bottom-color: rgba(255, 255, 255, .07); }
.home-alert { width: 100%; display: flex; align-items: center; gap: 13px; margin-bottom: 16px; padding: 13px 16px; border: 1px solid rgba(212, 154, 67, .35); border-radius: 14px; background: rgba(212, 154, 67, .12); color: #f4e7cf; text-align: left; }
.home-alert:hover { border-color: var(--gold); background: rgba(212, 154, 67, .18); }
.home-alert-icon { display: grid; place-items: center; width: 34px; height: 34px; flex: none; border-radius: 50%; background: rgba(201, 169, 110, .2); color: var(--gold-light); }
.home-alert-icon svg { width: 18px; height: 18px; }
.home-alert strong { display: block; font-size: 12.5px; }
.home-alert small { display: block; margin-top: 1px; color: #cbbd9f; font-size: 11px; }
.home-alert-arrow { margin-left: auto; font-size: 18px; color: var(--gold-light); }
.home-banner { position: relative; display: flex; align-items: flex-end; justify-content: space-between; gap: 22px; margin-bottom: 18px; padding: clamp(22px, 4vw, 36px); overflow: hidden; border: 1px solid rgba(255, 255, 255, .08); border-radius: 24px; background: var(--midnight); color: #fff; box-shadow: 0 22px 50px rgba(0, 0, 0, .22); }
.home-banner h1 { margin: 5px 0 8px; font-size: clamp(27px, 4vw, 38px); line-height: 1.06; letter-spacing: -.035em; }
.home-banner p:not(.eyebrow) { max-width: 54ch; margin: 0; color: #b9c4d4; font-size: 13px; }
.home-banner .eyebrow { color: var(--gold-light); }
.home-banner time { position: relative; z-index: 1; flex: none; color: #aeb9c9; font-size: 11.5px; text-align: right; text-transform: none; }
.home-actions { display: flex; flex-wrap: wrap; gap: 9px; margin-bottom: 18px; }
.home-actions .primary-btn, .home-actions .outline-btn { min-height: 46px; }
.home-actions .outline-btn { border-color: rgba(255, 255, 255, .16); background: rgba(255, 255, 255, .05); color: #fff; }
.home-actions .outline-btn:hover { border-color: var(--turquoise); background: rgba(18, 200, 192, .1); }
.home-metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 11px; margin-bottom: 18px; }
.home-metrics .stat-card { min-height: 116px; border-color: rgba(255, 255, 255, .08); background: rgba(255, 255, 255, .045); box-shadow: none; }
.home-metrics .stat-label { color: #94a3b8; }
.home-metrics .stat-card strong { color: #fff; font-size: 23px; }
.home-metrics .stat-card small { color: #8fa0b6; }
.home-metrics .late-metric { border-top-color: var(--danger); }
.home-lower { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(280px, .7fr); gap: 16px; align-items: start; }
.home-lower .card { margin: 0; border-color: rgba(255, 255, 255, .08); background: #0d1a2e; box-shadow: none; }
.home-lower .card h2 { color: #fff; }
.activity-list { display: grid; gap: 2px; }
.activity-item { display: flex; gap: 11px; padding: 11px 0; border-bottom: 1px solid rgba(255, 255, 255, .07); }
.activity-item:last-child { border-bottom: 0; }
.activity-dot { width: 8px; height: 8px; margin-top: 5px; flex: none; border-radius: 50%; background: var(--turquoise); box-shadow: 0 0 0 3px rgba(18, 200, 192, .12); }
.activity-item strong { display: block; color: #f2f5fa; font-size: 12px; }
.activity-item p { margin: 2px 0; color: #a5b1c2; font-size: 11.5px; overflow-wrap: anywhere; }
.activity-item small { color: #7f8da2; font-size: 10.5px; }
.home-side-card { position: relative; overflow: hidden; padding: 23px; border: 1px solid rgba(201, 169, 110, .28); border-radius: var(--radius); background: linear-gradient(150deg, #1b2c49, #101c33 70%); color: #fff; }
.home-side-icon { display: grid; place-items: center; width: 42px; height: 42px; margin-bottom: 18px; border-radius: 12px; background: rgba(201, 169, 110, .14); color: var(--gold-light); }
.home-side-icon svg { width: 20px; height: 20px; }
.home-side-card .eyebrow { color: var(--gold-light); }
.home-side-card > strong { display: block; margin: 6px 0 2px; font-size: 27px; letter-spacing: -.03em; }
.home-side-card > span:not(.home-side-icon) { display: block; color: #9fadc1; font-size: 11.5px; }
.home-side-card .text-action { margin-top: 18px; color: var(--gold-light); font-size: 11.5px; }

/* ---------- Barre d'outils, recherche, tableaux ---------- */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 15px; }
.toolbar > label { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 11px; font-weight: 650; }
.toolbar select, .toolbar input, .inline-form input, .inline-form select { min-height: 40px; padding: 0 11px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); font-size: 12.5px; }
.search { display: flex; align-items: center; gap: 8px; min-width: min(330px, 100%); height: 42px; padding: 0 12px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface); color: var(--muted); }
.search:focus-within { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(201, 169, 110, .12); }
.search > span { font-size: 18px; line-height: 1; color: #98a3b3; }
.search input { flex: 1; min-width: 0; height: 100%; border: 0; outline: 0; background: transparent; font-size: 12.5px; }
.table-wrap { width: 100%; overflow-x: auto; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
table { width: 100%; border-collapse: collapse; }
th { padding: 11px 12px; border-bottom: 1px solid var(--line); background: var(--surface-2); color: var(--muted); font-size: 9.5px; font-weight: 750; letter-spacing: .07em; text-align: left; text-transform: uppercase; white-space: nowrap; }
td { padding: 12px; border-bottom: 1px solid var(--line-soft); color: #334154; font-size: 12.5px; vertical-align: middle; }
td:last-child { white-space: nowrap; width: 1%; }
th:last-child { width: 1%; }
td:last-child .small-btn, td:last-child .row-menu { vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fcfbf7; }
td strong { color: var(--midnight); font-weight: 700; }
td .small-btn { margin: 2px 2px 2px 0; }
.void-row { opacity: .62; }
.void-row td { background: #fcf9f9; }
.empty { display: grid; place-items: center; gap: 4px; padding: 34px 16px; border: 1px dashed var(--line); border-radius: 13px; color: var(--muted); text-align: center; }
.empty > span { font-size: 26px; color: var(--gold); }
.empty strong { color: var(--midnight); font-size: 13px; }
.empty p { margin: 0; font-size: 11.5px; }
.empty.compact { padding: 22px 12px; }

/* ---------- Onglets de module ---------- */
.module-tabs { display: flex; width: fit-content; max-width: 100%; gap: 3px; margin: 0 0 20px; padding: 4px; overflow-x: auto; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-2); scrollbar-width: none; }
.module-tabs::-webkit-scrollbar { display: none; }
.module-tab { min-height: 38px; flex: 0 0 auto; padding: 0 15px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); font-size: 12px; font-weight: 700; white-space: nowrap; transition: background .18s ease, color .18s ease, box-shadow .18s ease; }
.module-tab:hover { color: var(--midnight); }
.module-tab.active { background: var(--surface); color: var(--midnight); box-shadow: 0 2px 8px rgba(16, 28, 51, .08); }
.module-tab[aria-pressed="true"] { position: relative; }
.module-tab[aria-pressed="true"]::after { content: ""; position: absolute; left: 50%; bottom: 3px; width: 16px; height: 2px; border-radius: 2px; background: var(--gold); transform: translateX(-50%); }

/* ---------- Formulaires ---------- */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-grid label, .form-field { display: grid; gap: 6px; min-width: 0; color: var(--midnight); font-size: 11.5px; font-weight: 650; }
.form-grid input, .form-grid select, .form-grid textarea, .form-field input, .form-field select, .form-field textarea { width: 100%; min-height: 44px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); font-size: 13px; font-weight: 450; transition: border-color .18s ease, box-shadow .18s ease; }
.form-grid textarea, .form-field textarea { min-height: 74px; resize: vertical; }
.form-grid input:focus, .form-grid select:focus, .form-grid textarea:focus, .form-field input:focus, .form-field select:focus, .form-field textarea:focus { outline: 0; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(201, 169, 110, .13); }
.form-grid input:disabled, .form-field input:disabled, .form-field select:disabled, .form-field input[readonly] { background: #f1f2f4; color: var(--muted); }
.form-grid label.full, .form-note.full, .form-field.full { grid-column: 1 / -1; }
.form-note { margin: 0; color: var(--muted); font-size: 10.5px; line-height: 1.55; }
.form-grid .form-note.full, .form-field .form-note.full { padding: 10px 12px; border-radius: 10px; background: #f7f4ec; }
.field-label { display: block; margin-bottom: 6px; color: var(--midnight); font-size: 11.5px; font-weight: 650; }
.choice-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.choice { display: flex; align-items: center; gap: 7px; min-height: 38px; padding: 0 11px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: #3b4a5e; font-size: 11.5px; font-weight: 550; cursor: pointer; }
.choice:hover { border-color: var(--gold); }
.choice input { width: 15px; height: 15px; margin: 0; accent-color: var(--gold); }
.inline-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; }
.inline-form label { display: grid; gap: 6px; min-width: 185px; flex: 1 1 185px; color: var(--midnight); font-size: 11.5px; font-weight: 650; }
.inline-form label small { color: var(--muted); font-weight: 400; }
.inline-form select[multiple] { min-height: 82px; padding: 6px; }
.inline-form .primary-btn { flex: none; }

/* ---------- Fenêtres ---------- */
body.modal-open { overflow: hidden; }
.modal-backdrop { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; padding: 20px; background: rgba(9, 20, 38, .64); backdrop-filter: blur(3px); animation: fade-in .18s ease; }
.modal { position: relative; width: min(720px, 100%); max-height: calc(100dvh - 40px); overflow: auto; border: 1px solid rgba(255, 255, 255, .35); border-radius: 22px; background: var(--surface); box-shadow: var(--shadow-md); animation: modal-in .2s ease; }
.modal.wide { width: min(1040px, 100%); }
.modal-head { position: sticky; top: 0; z-index: 3; display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 21px 23px 15px; border-bottom: 1px solid var(--line-soft); background: var(--surface); }
.modal-head h2 { margin: 3px 0 0; font-size: 21px; line-height: 1.15; }
.modal-head .icon-btn { margin-top: -4px; }
.modal-head-actions { display: flex; align-items: center; gap: 4px; }
.modal-footer { display: flex; justify-content: flex-end; gap: 9px; padding: 15px 23px 20px; border-top: 1px solid var(--line-soft); background: var(--surface); }
.modal form { padding: 20px 23px 0; }
.modal form .modal-footer { margin: 8px -23px 0; }
.modal .form-grid { padding: 20px 23px; }
.profile-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 18px 23px; }
.profile-grid > div { min-width: 0; padding: 11px 12px; border: 1px solid var(--line-soft); border-radius: 11px; background: var(--surface-2); }
.profile-grid small { display: block; margin-bottom: 4px; color: var(--muted); font-size: 9.5px; font-weight: 650; letter-spacing: .05em; text-transform: uppercase; }
.profile-grid strong { display: block; color: var(--midnight); font-size: 12px; overflow-wrap: anywhere; }
.modal > h3.subsection-title, .modal > .table-wrap { margin-left: 23px; margin-right: 23px; }
.modal > .table-wrap { margin-bottom: 18px; }
.modal .table-wrap th { white-space: normal; }
.modal .table-wrap th, .modal .table-wrap td { padding: 9px 8px; font-size: 11px; }
.modal .table-wrap td .small-btn { min-height: 30px; font-size: 10.5px; padding: 5px 8px; }
.modal > p.form-note { margin: 0 23px 12px; }
.message-preview { display: grid; gap: 6px; margin: 0 23px 14px; color: var(--muted); font-size: 10.5px; font-weight: 650; }
.message-preview textarea { width: 100%; min-height: 112px; padding: 10px 11px; resize: vertical; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); color: #3a4759; font-size: 12px; font-weight: 450; line-height: 1.55; }
.payment-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 23px 16px; }

/* ---------- Parcours de paiement ---------- */
.payment-modal { width: min(1000px, 100%); }
.payment-form { padding-bottom: 0; }
.payment-form .modal-footer { position: sticky; bottom: 0; z-index: 4; margin-top: 8px; box-shadow: 0 -10px 24px rgba(16, 28, 51, .05); }
.pay-progress { display: flex; gap: 7px; padding: 13px 23px; border-bottom: 1px solid var(--line-soft); background: var(--surface-2); font-size: 10px; font-weight: 700; color: #9aa4b2; letter-spacing: .02em; }
.pay-progress span { padding: 4px 9px; border-radius: 999px; }
.pay-progress span.is-active { background: var(--midnight); color: var(--gold-light); }
.pay-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 24px; padding: 4px 23px 0; }
.pay-main { min-width: 0; }
.pay-block { padding: 18px 0; border-bottom: 1px solid var(--line-soft); }
.pay-block:last-child { border-bottom: 0; }
.pay-block-head { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 14px; }
.pay-block-head h3 { margin: 1px 0 2px; font-size: 15px; }
.pay-block-head p { margin: 0; color: var(--muted); font-size: 11px; }
.pay-step { display: grid; place-items: center; width: 25px; height: 25px; flex: none; border-radius: 50%; background: var(--gold); color: var(--deep); font-size: 11px; font-weight: 800; }
.pay-search { display: flex; align-items: center; gap: 8px; height: 42px; margin-bottom: 10px; padding: 0 11px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--muted); }
.pay-search:focus-within { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(201, 169, 110, .12); }
.pay-search svg { width: 16px; height: 16px; flex: none; }
.pay-search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font-size: 12px; }
.pay-field { display: grid; gap: 6px; min-width: 0; color: var(--midnight); font-size: 11px; font-weight: 650; }
.pay-field input, .pay-field select { width: 100%; min-height: 44px; padding: 8px 11px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); font-size: 13px; font-weight: 500; }
.pay-field input:focus, .pay-field select:focus { outline: 0; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(201, 169, 110, .13); }
.pay-student-card { margin-top: 10px; padding: 11px; border: 1px solid var(--line-soft); border-radius: 12px; background: var(--surface-2); }
.pay-student-identity { display: flex; align-items: center; gap: 10px; }
.pay-student-identity > div { min-width: 0; flex: 1; }
.pay-student-identity strong { display: block; font-size: 12.5px; }
.pay-student-identity small { display: block; margin-top: 1px; color: var(--muted); font-size: 10.5px; overflow-wrap: anywhere; }
.pay-empty { margin: 0; color: var(--muted); font-size: 11.5px; }
.pay-kind { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; margin-bottom: 12px; }
.pay-kind-option { position: relative; display: flex; align-items: center; justify-content: center; min-height: 42px; padding: 0 8px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: #536176; font-size: 11.5px; font-weight: 700; text-align: center; cursor: pointer; transition: border-color .18s ease, background .18s ease, color .18s ease; }
.pay-kind-option input { position: absolute; opacity: 0; pointer-events: none; }
.pay-kind-option.is-selected { border-color: var(--gold); background: #fdf8ec; color: var(--midnight); box-shadow: inset 0 -2px 0 var(--gold); }
.pay-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 12px; }
.pay-fields .is-hidden, .is-hidden { display: none !important; }
.pay-amount-label { margin-bottom: 8px; }
.pay-amount { display: flex; align-items: center; gap: 8px; padding: 5px 12px; border: 1px solid var(--line); border-radius: 13px; background: var(--surface); }
.pay-amount:focus-within { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(201, 169, 110, .13); }
.pay-amount input { flex: 1; min-width: 0; height: 48px; border: 0; outline: 0; background: transparent; color: var(--midnight); font-size: 30px; font-weight: 800; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.pay-amount > span { color: var(--muted); font-size: 11px; font-weight: 750; letter-spacing: .08em; }
.pay-quick { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; margin-bottom: 15px; }
.pay-owed-label { margin-left: auto; color: var(--muted); font-size: 10.5px; }
.pay-methods { margin-bottom: 14px; }
.pay-method-grid { display: flex; flex-wrap: wrap; gap: 6px; }
.pay-method { position: relative; display: flex; align-items: center; min-height: 36px; padding: 0 10px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); color: #536176; font-size: 10.5px; font-weight: 650; cursor: pointer; }
.pay-method input { position: absolute; opacity: 0; pointer-events: none; }
.pay-method:has(input:checked) { border-color: var(--turquoise); background: rgba(18, 200, 192, .08); color: #0b6b66; }
.pay-meta { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.pay-side { display: grid; align-content: start; gap: 10px; padding: 18px 0 0; }
.pay-side-card { padding: 14px; border: 1px solid var(--line); border-radius: 13px; background: var(--surface-2); }
.pay-side-card .eyebrow { margin-bottom: 10px; }
.pay-situation-row { display: flex; align-items: baseline; justify-content: space-between; gap: 9px; padding: 7px 0; border-bottom: 1px solid var(--line-soft); font-size: 10.5px; }
.pay-situation-row:last-of-type { border-bottom: 0; }
.pay-situation-row span { color: var(--muted); }
.pay-situation-row strong { font-size: 10.5px; text-align: right; }
.pay-situation-row .is-due { color: #9a671d; }
.pay-situation-row .is-clear { color: var(--success); }
.pay-situation-total { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-top: 8px; padding-top: 9px; border-top: 1px solid var(--line); }
.pay-situation-total span { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.pay-situation-total strong { color: var(--midnight); font-size: 15px; }
.pay-after { background: var(--midnight); border-color: var(--midnight); color: #fff; }
.pay-after > span { display: block; color: #a7b4c6; font-size: 10px; font-weight: 650; letter-spacing: .06em; text-transform: uppercase; }
.pay-after > strong { display: block; margin: 4px 0 2px; color: var(--gold-light); font-size: 27px; letter-spacing: -.03em; }
.pay-after > small { color: #93a2b6; font-size: 10px; }
.pay-after > strong.is-over { color: #f0a3a3; }
.pay-side-note { display: flex; gap: 8px; padding: 4px 2px; color: var(--muted); }
.pay-side-note svg { width: 15px; height: 15px; flex: none; margin-top: 2px; color: var(--success); }
.pay-side-note p { margin: 0; font-size: 9.5px; line-height: 1.5; }

/* ---------- Récapitulatif et confirmation ---------- */
.recap-modal, .payment-confirm { width: min(620px, 100%); }
.recap-hero { display: flex; align-items: center; gap: 14px; margin: 18px 23px; padding: 16px; border: 1px solid rgba(201, 169, 110, .3); border-radius: 15px; background: #fdf9ef; }
.recap-check, .confirm-icon { display: grid; place-items: center; width: 46px; height: 46px; flex: none; border-radius: 50%; background: var(--gold); color: var(--deep); }
.recap-check svg, .confirm-icon svg { width: 22px; height: 22px; }
.recap-hero > div { min-width: 0; }
.recap-hero span:not(.recap-check) { display: block; color: var(--muted); font-size: 10px; font-weight: 650; text-transform: uppercase; letter-spacing: .06em; }
.recap-hero strong { display: block; margin: 1px 0; color: var(--midnight); font-size: 28px; font-weight: 800; letter-spacing: -.03em; }
.recap-hero small { color: var(--muted); font-size: 11px; }
.recap-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; margin: 0 23px 14px; }
.recap-grid > div { padding: 10px 11px; border: 1px solid var(--line-soft); border-radius: 10px; background: var(--surface-2); }
.recap-grid small { display: block; margin-bottom: 3px; color: var(--muted); font-size: 9px; font-weight: 650; letter-spacing: .05em; text-transform: uppercase; }
.recap-grid strong { display: block; font-size: 11.5px; overflow-wrap: anywhere; }
.recap-balance { display: flex; align-items: center; gap: 12px; margin: 0 23px 14px; padding: 13px 15px; border-radius: 12px; background: var(--midnight); color: #fff; }
.recap-balance > div { flex: 1; min-width: 0; }
.recap-balance span:not(.recap-arrow) { display: block; color: #9dadc2; font-size: 9.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.recap-balance strong { display: block; margin-top: 2px; color: var(--gold-light); font-size: 17px; }
.recap-arrow { color: var(--turquoise); font-size: 19px; }
.confirm-hero { display: flex; align-items: center; gap: 12px; margin: 18px 23px 12px; padding: 13px 14px; border-radius: 13px; background: var(--surface-2); border: 1px solid var(--line-soft); }
.confirm-hero > div { min-width: 0; }
.confirm-hero strong { display: block; font-size: 13px; }
.confirm-hero small { display: block; margin-top: 2px; color: var(--muted); font-size: 10.5px; }
.confirm-details { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 0 23px 13px; }
.confirm-details > div { padding: 9px 10px; border: 1px solid var(--line-soft); border-radius: 9px; }
.confirm-details small { display: block; color: var(--muted); font-size: 9px; font-weight: 650; text-transform: uppercase; letter-spacing: .05em; }
.confirm-details strong { display: block; margin-top: 1px; font-size: 11px; overflow-wrap: anywhere; }
.payment-confirm > p { margin: 0 23px 10px; color: var(--muted); font-size: 11.5px; line-height: 1.55; }

/* ---------- Menus d'actions contextuels ---------- */
body.action-open { overflow: hidden; }
.action-layer { position: fixed; inset: 0; z-index: 200; }
.action-scrim { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: rgba(9, 20, 38, .42); cursor: default; }
.action-menu { position: fixed; z-index: 201; width: min(318px, calc(100vw - 20px)); overflow: hidden; border: 1px solid rgba(255, 255, 255, .12); border-radius: 20px; background: #0d1a2e; color: #fff; box-shadow: 0 26px 70px rgba(0, 0, 0, .42); animation: menu-in .16s ease; }
.action-menu-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 11px 8px 15px; border-bottom: 1px solid rgba(255, 255, 255, .07); color: #aeb9c9; font-size: 9.5px; font-weight: 750; letter-spacing: .09em; text-transform: uppercase; }
.action-menu-head .icon-btn { width: 30px; height: 30px; color: #aeb9c9; }
.action-menu-head .icon-btn:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.action-menu-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; max-height: min(58vh, 380px); padding: 10px; overflow: auto; }
.action-tile { display: grid; place-items: center; align-content: center; gap: 6px; min-height: 78px; padding: 9px 5px; border: 1px solid rgba(255, 255, 255, .065); border-radius: 13px; background: rgba(255, 255, 255, .045); color: #e9eef6; text-align: center; transition: background .18s ease, border-color .18s ease; }
.action-tile:hover, .action-tile:focus-visible { border-color: rgba(201, 169, 110, .55); background: rgba(201, 169, 110, .13); outline: 0; }
.action-tile-icon { display: grid; place-items: center; width: 30px; height: 30px; color: var(--gold-light); }
.action-tile-icon svg { width: 20px; height: 20px; }
.action-tile-label { display: block; max-width: 100%; color: inherit; font-size: 9.5px; font-weight: 600; line-height: 1.25; overflow-wrap: anywhere; }
.action-tile.tone-danger .action-tile-icon { color: #f0a3a3; }
.action-tile.tone-danger .action-tile-label { color: #f0c0c0; }
.action-tile.tone-success .action-tile-icon { color: var(--turquoise); }
.action-close { display: none; position: fixed; z-index: 202; place-items: center; width: 46px; height: 46px; padding: 0; border: 1px solid rgba(255, 255, 255, .16); border-radius: 50%; background: #0d1a2e; color: #fff; box-shadow: 0 12px 30px rgba(0, 0, 0, .35); }
.action-close svg { width: 18px; height: 18px; }
.action-sheet { left: 10px; right: 76px; bottom: calc(96px + env(safe-area-inset-bottom)); width: auto; border-radius: 20px; animation: sheet-in .2s ease; }
.action-sheet .action-menu-grid { max-height: 48dvh; }
.action-sheet .action-head-close { display: none; }
.action-sheet + .action-close { right: 12px; bottom: calc(96px + env(safe-area-inset-bottom)); }
@media (max-width: 760px) { .action-close { display: grid; } }

/* ---------- Paramètres / sauvegardes ---------- */
.settings-hero { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; padding: 18px 20px; border: 1px solid var(--line); border-left: 4px solid var(--success); border-radius: 15px; background: var(--surface); box-shadow: var(--shadow-sm); }
.settings-hero.is-warning { border-left-color: var(--warning); background: #fffaf0; }
.settings-hero-icon { display: grid; place-items: center; width: 44px; height: 44px; flex: none; border-radius: 12px; background: rgba(36, 134, 106, .1); color: var(--success); }
.settings-hero.is-warning .settings-hero-icon { background: rgba(212, 154, 67, .13); color: var(--warning); }
.settings-hero-icon svg { width: 21px; height: 21px; }
.settings-hero > div:nth-child(2) { flex: 1; min-width: 0; }
.settings-hero strong { display: block; margin: 2px 0; font-size: 14px; }
.settings-hero small { display: block; color: var(--muted); font-size: 10.5px; }
.settings-hero .primary-btn { flex: none; }
.backup-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-bottom: 16px; }
.backup-card { display: flex; flex-direction: column; align-items: flex-start; gap: 9px; margin: 0; padding: 21px; }
.backup-icon { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; background: #f6f0e2; color: #8b6d36; }
.backup-icon svg { width: 20px; height: 20px; }
.backup-card h2 { font-size: 15px; }
.backup-card p { margin: 0; color: var(--muted); font-size: 11.5px; line-height: 1.55; }
.backup-card .primary-btn, .backup-card .file-button { margin-top: 2px; }
.backup-card .form-note { font-size: 9.5px; }
.local-info { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.local-info > div { padding: 13px; border: 1px solid var(--line-soft); border-radius: 11px; background: var(--surface-2); }
.local-info span { display: block; color: var(--muted); font-size: 9.5px; font-weight: 650; text-transform: uppercase; letter-spacing: .05em; }
.local-info strong { display: block; margin-top: 3px; font-size: 19px; }
.security-note { padding: 14px 15px; border: 1px solid rgba(212, 154, 67, .3); border-radius: 12px; background: #fffaf0; }
.security-note strong { display: block; margin-bottom: 4px; color: #80551b; font-size: 12px; }
.security-note p { margin: 0; color: #7b6648; font-size: 11px; line-height: 1.6; }
.app-version { padding: 8px 0 4px; color: var(--muted); font-size: 10px; text-align: center; }

/* ---------- Rapports ---------- */
.report-columns { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(300px, .8fr); gap: 16px; }
.report-columns .card { margin-bottom: 16px; }
.bar-chart { display: grid; gap: 8px; }
.bar-row { display: grid; grid-template-columns: 128px minmax(0, 1fr) 104px; align-items: center; gap: 10px; }
.bar-row > span { color: var(--muted); font-size: 10px; text-transform: capitalize; }
.bar-row > strong { color: var(--midnight); font-size: 10.5px; font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }
.bar-track { height: 8px; overflow: hidden; border-radius: 999px; background: #f0ede5; }
.bar-track i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--gold), var(--turquoise)); }
.ledger-filters { display: grid; grid-template-columns: repeat(6, minmax(120px, 1fr)); gap: 9px; align-items: end; }
.ledger-filters label { display: grid; gap: 5px; }
.ledger-filters .count-label { grid-column: 1 / -1; margin-left: 0; }
.print-only { display: none; }
.print-report-head { align-items: center; gap: 12px; margin-bottom: 16px; padding-bottom: 12px; border-bottom: 2px solid var(--gold); }
.print-report-head img { width: 42px; height: 42px; border-radius: 11px; }
.print-report-head strong { display: block; font-size: 17px; }
.print-report-head span { display: block; margin-top: 2px; color: var(--muted); font-size: 11px; }

/* ---------- Notifications ---------- */
.toast { position: fixed; right: 22px; bottom: 22px; z-index: 300; max-width: min(420px, calc(100vw - 32px)); padding: 12px 15px; border: 1px solid rgba(255, 255, 255, .13); border-radius: 12px; background: var(--midnight); color: #fff; box-shadow: 0 16px 40px rgba(9, 20, 38, .3); font-size: 12px; font-weight: 550; line-height: 1.45; opacity: 0; transform: translateY(10px); pointer-events: none; transition: opacity .2s ease, transform .2s ease; }
.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { background: #7e2f2f; border-color: rgba(255, 255, 255, .16); }

/* ---------- Tablettes ---------- */
@media (max-width: 1180px) {
  .home-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .home-lower { grid-template-columns: 1fr; }
  .home-side-card { display: grid; grid-template-columns: auto 1fr; column-gap: 15px; align-items: center; }
  .home-side-icon { grid-row: 1 / 4; margin: 0; }
  .home-side-card > strong { margin: 0; }
  .home-side-card .text-action { margin-top: 6px; }
  .stat-grid, .stat-grid.three { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .report-columns { grid-template-columns: 1fr; }
  .ledger-filters { grid-template-columns: repeat(3, minmax(120px, 1fr)); }
  .pay-layout { grid-template-columns: minmax(0, 1fr) 270px; gap: 18px; }
}
@media (max-width: 980px) {
  :root { --nav-width: 224px; }
  .top-date { display: none; }
  .pay-layout { grid-template-columns: 1fr; }
  .pay-side { grid-template-columns: repeat(2, minmax(0, 1fr)); padding-bottom: 6px; }
  .pay-side-note { grid-column: 1 / -1; }
  .backup-grid { grid-template-columns: 1fr; }
  .local-info { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ---------- Mobile ---------- */
@media (max-width: 760px) {
  body { font-size: 14px; }
  .sidebar { transform: translateX(-100%); width: min(300px, 84vw); box-shadow: 18px 0 60px rgba(0, 0, 0, .3); transition: transform .22s ease; }
  .menu-open .sidebar { transform: translateX(0); }
  .menu-open .mobile-shade { display: block; position: fixed; inset: 0; z-index: 35; background: rgba(9, 20, 38, .48); }
  .main { margin-left: 0; }
  .topbar { height: 60px; gap: 10px; padding: 0 13px; }
  .menu-btn { display: none; }
  .topbar-brand { display: flex; }
  .topbar-brand span { display: none; }
  .topbar-brand img { width: 31px; height: 31px; }
  .crumb { font-size: 11px; letter-spacing: .03em; }
  .global-search { height: 38px; max-width: none; padding: 0 10px; }
  .global-search input { font-size: 12px; }
  .admin-chip, .top-date { display: none; }
  .content { padding: 18px 13px calc(108px + env(safe-area-inset-bottom)); }
  .page-head { align-items: flex-start; flex-direction: column; gap: 12px; margin-bottom: 16px; }
  .page-head h1 { font-size: 25px; }
  .page-head .muted { font-size: 12px; }
  .page-head > .primary-btn, .page-head > .outline-btn { width: 100%; justify-content: center; }
  .card { padding: 15px 13px; border-radius: 15px; }
  .card-head { align-items: flex-start; }
  .card h2 { font-size: 14px; }
  .stat-grid, .stat-grid.three, .home-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .stat-card { min-height: 91px; padding: 12px; border-radius: 13px; }
  .stat-card strong { font-size: 17px; }
  .stat-label { font-size: 9px; }
  .stat-card small { font-size: 9.5px; }
  .home-banner { align-items: flex-start; flex-direction: column; gap: 12px; padding: 22px 18px; border-radius: 19px; }
  .home-banner h1 { font-size: 28px; }
  .home-banner time { text-align: left; }
  .home-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .home-actions .primary-btn, .home-actions .outline-btn { min-height: 46px; padding-inline: 10px; font-size: 11.5px; }
  .home-actions .outline-btn { grid-column: 1 / -1; }
  .home-metrics .stat-card { min-height: 98px; padding: 13px; }
  .home-metrics .stat-card strong { font-size: 19px; }
  .home-side-card { display: block; padding: 20px; }
  .home-side-icon { margin-bottom: 14px; }
  .home-side-card > strong { font-size: 25px; }
  .module-tabs { width: 100%; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin-bottom: 15px; }
  .module-tab { min-height: 38px; width: 100%; padding-inline: 6px; font-size: 10.5px; }
  .toolbar { gap: 8px; }
  .search { min-width: 100%; flex: 1 1 100%; }
  .toolbar select, .toolbar input { flex: 1 1 130px; }
  .count-label { width: 100%; margin-left: 0; }
  .table-wrap { overflow: visible; border: 0; background: transparent; }
  .table-wrap table, .table-wrap tbody, .table-wrap tr, .table-wrap td { display: block; width: 100%; }
  .table-wrap thead { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
  .table-wrap tbody { display: grid; gap: 9px; }
  .table-wrap tbody tr { padding: 6px 12px; border: 1px solid var(--line); border-radius: 13px; background: var(--surface); box-shadow: 0 2px 8px rgba(16, 28, 51, .035); }
  .table-wrap td { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line-soft); text-align: right; white-space: normal; overflow-wrap: anywhere; }
  .table-wrap td:last-child { justify-content: flex-start; flex-wrap: wrap; padding-top: 9px; border-bottom: 0; }
  .table-wrap td::before { content: attr(data-label); flex: 0 0 38%; color: var(--muted); font-size: 10px; font-weight: 650; text-align: left; }
  .table-wrap td:last-child::before { content: "Actions"; }
  .table-wrap td:last-child:empty { display: none; }
  .table-wrap td .small-btn { white-space: normal; }
  .form-grid { grid-template-columns: 1fr; gap: 11px; }
  .form-grid label.full, .form-note.full, .form-field.full { grid-column: auto; }
  .inline-form { flex-direction: column; align-items: stretch; }
  .inline-form label { min-width: 0; }
  .inline-form .primary-btn { width: 100%; }
  .modal-backdrop { align-items: flex-end; padding: 0; }
  .modal, .modal.wide { width: 100%; max-height: 94dvh; border-radius: 22px 22px 0 0; }
  .modal-head { padding: 17px 17px 12px; }
  .modal-head h2 { font-size: 20px; }
  .modal form { padding: 15px 17px 0; }
  .modal form .modal-footer { margin-inline: -17px; }
  .modal-footer { flex-wrap: wrap; padding: 12px 17px calc(15px + env(safe-area-inset-bottom)); }
  .modal-footer > * { flex: 1 1 auto; }
  .modal .form-grid { padding: 15px 17px; }
  .profile-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); margin: 14px 17px; }
  .modal > h3.subsection-title, .modal > .table-wrap, .modal > p.form-note, .message-preview, .payment-actions { margin-left: 17px; margin-right: 17px; }
  .pay-progress { padding: 11px 17px; overflow-x: auto; }
  .pay-layout { padding: 0 17px; }
  .pay-side { grid-template-columns: 1fr; }
  .pay-after > strong { font-size: 25px; }
  .pay-kind { grid-template-columns: 1fr; }
  .pay-kind-option { min-height: 44px; }
  .pay-fields, .pay-meta { grid-template-columns: 1fr; }
  .pay-amount input { font-size: 27px; }
  .recap-hero, .recap-grid, .recap-balance, .confirm-hero, .confirm-details, .payment-confirm > p { margin-left: 17px; margin-right: 17px; }
  .recap-grid, .confirm-details { grid-template-columns: 1fr 1fr; }
  .recap-balance { align-items: flex-start; flex-wrap: wrap; }
  .recap-arrow { display: none; }
  .recap-balance > div { flex: 1 1 40%; }
  .settings-hero { align-items: flex-start; flex-wrap: wrap; padding: 15px; }
  .settings-hero .primary-btn { width: 100%; }
  .backup-grid { gap: 10px; }
  .local-info { gap: 8px; }
  .bar-row { grid-template-columns: 88px minmax(0, 1fr); }
  .bar-row > strong { grid-column: 2; text-align: left; }
  .ledger-filters { grid-template-columns: 1fr 1fr; }
  .ledger-filters .count-label { grid-column: 1 / -1; }
  .topbar-brand, .crumb, .global-search { flex: none; }
  .topbar-brand { margin-right: 1px; }
  .crumb { max-width: 80px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
  .global-search { flex: 1; min-width: 0; }
  .toast { left: 12px; right: 12px; bottom: calc(86px + env(safe-area-inset-bottom)); max-width: none; text-align: center; }
  .action-scrim { background: rgba(9, 20, 38, .38); }
  .mobile-nav {
    position: fixed;
    z-index: 45;
    left: 10px;
    right: 10px;
    bottom: max(9px, env(safe-area-inset-bottom));
    display: flex;
    justify-content: space-around;
    gap: 2px;
    padding: 7px 7px calc(7px + env(safe-area-inset-bottom));
    border: 1px solid rgba(255, 255, 255, .1);
    border-radius: 21px;
    background: rgba(9, 20, 38, .97);
    box-shadow: 0 14px 38px rgba(9, 20, 38, .34);
    backdrop-filter: blur(14px);
  }
  .mobile-nav-link { display: flex; flex: 1; min-width: 0; min-height: 53px; align-items: center; justify-content: center; flex-direction: column; gap: 3px; padding: 4px 2px; border: 0; border-radius: 14px; background: transparent; color: #9eacbf; }
  .mobile-nav-link svg { width: 20px; height: 20px; }
  .mobile-nav-link small { font-size: 9px; font-weight: 650; white-space: nowrap; }
  .mobile-nav-link.active { background: var(--navy-2); color: var(--gold-light); }
  .mobile-nav-link.active svg { color: var(--turquoise); }
  .mobile-nav-link.active::after { content: ""; width: 14px; height: 2px; border-radius: 2px; background: var(--gold); }
  body[data-page="home"] .mobile-nav { border-color: rgba(201, 169, 110, .18); }
}
@media (max-width: 390px) {
  .home-actions { grid-template-columns: 1fr; }
  .home-actions .outline-btn { grid-column: auto; }
  .stat-grid, .stat-grid.three, .home-metrics { gap: 7px; }
  .stat-card { padding: 10px; }
  .stat-card strong { font-size: 15px; }
  .pay-amount input { font-size: 24px; }
  .recap-grid, .confirm-details { grid-template-columns: 1fr; }
  .mobile-nav-link small { font-size: 8.5px; }
}

/* ---------- Animations réduites ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes modal-in { from { opacity: 0; transform: translateY(8px) scale(.99); } to { opacity: 1; transform: none; } }
@keyframes menu-in { from { opacity: 0; transform: translateY(-4px) scale(.99); } to { opacity: 1; transform: none; } }
@keyframes sheet-in { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: none; } }

/* ---------- Impression ---------- */
@media print {
  @page { margin: 12mm; }
  body { background: #fff !important; color: #111; font-size: 11px; }
  .sidebar, .topbar, .mobile-nav, .mobile-shade, .toast, .action-layer,
  .home-actions, .page-head > button, .module-tabs, .toolbar, .small-btn,
  .primary-btn, .outline-btn, .icon-btn, .file-button, .backup-grid, .settings-hero,
  .ledger-filters, .no-print { display: none !important; }
  .print-only { display: flex !important; }
  .main { margin: 0 !important; }
  .content { max-width: none; padding: 0 !important; }
  .card { break-inside: avoid; box-shadow: none !important; border: 1px solid #ddd; padding: 12px; }
  .stat-grid, .stat-grid.three { grid-template-columns: repeat(3, 1fr); }
  .stat-card { break-inside: avoid; border: 1px solid #ddd; }
  .report-columns { grid-template-columns: 1fr 1fr; }
  .table-wrap { overflow: visible; border: 1px solid #ddd; }
  table { font-size: 9px; }
  th, td { padding: 5px 6px; }
  .print-only { display: flex !important; }
  a { text-decoration: none; }
}
