/* ==========================================================================
   AJAMAT Gestion — Design System
   Application de gestion des cartes de membre et de la trésorerie
   Version 1.0 — socle
   ========================================================================== */

/* ---------- Polices auto-hébergées (aucune ressource externe) ---------- */
@font-face {
  font-family: 'Manrope';
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
  src: url('../fonts/manrope-latin.woff2') format('woff2');
}
@font-face {
  font-family: 'Instrument Serif';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../fonts/instrument-serif-latin.woff2') format('woff2');
}
@font-face {
  font-family: 'Instrument Serif';
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url('../fonts/instrument-serif-italic-latin.woff2') format('woff2');
}

/* ---------- Jetons ---------- */
:root {
  --brand-950: #072A20;
  --brand-900: #0A3B2E;
  --brand-800: #0C4A3A;
  --brand-700: #0F5A45;
  --brand-600: #137056;
  --brand-500: #17876A;
  --brand-300: #7DBDA8;
  --brand-100: #E4F1EC;
  --brand-50:  #F1F8F5;

  --gold-700: #8A6113;
  --gold-600: #A9761B;
  --gold-500: #C08A2E;
  --gold-200: #EBD9B0;
  --gold-100: #F7EEDA;

  --ink:      #101B16;
  --ink-2:    #34443D;
  --ink-3:    #556B62;
  --muted:    #6E8078;
  --faint:    #94A39C;

  --line:        #E3E9E5;
  --line-strong: #D2DCD6;

  --bg:        #F2F5F3;
  --surface:   #FFFFFF;
  --surface-2: #F8FAF9;
  --surface-3: #EFF3F1;

  --pos:      #1B7F4B;
  --pos-bg:   #E6F4EC;
  --neg:      #B4232A;
  --neg-bg:   #FBE9EA;
  --warn:     #A96200;
  --warn-bg:  #FCEFDD;
  --info:     #1A649E;
  --info-bg:  #E6F0F8;
  --neutral-bg:#EDF1EF;

  --r-xs: 5px;
  --r-sm: 8px;
  --r:    11px;
  --r-lg: 15px;
  --r-xl: 22px;

  --sh-1: 0 1px 2px rgba(16, 27, 22, .05);
  --sh-2: 0 2px 4px rgba(16, 27, 22, .05), 0 6px 18px -8px rgba(16, 27, 22, .12);
  --sh-3: 0 24px 60px -20px rgba(7, 42, 32, .38), 0 3px 10px rgba(7, 42, 32, .10);

  --sidebar-w: 254px;
  --font-sans: 'Manrope', 'Segoe UI', system-ui, -apple-system, 'Helvetica Neue', Arial, sans-serif;
  --font-display: 'Instrument Serif', 'Iowan Old Style', Georgia, serif;
  --font-mono: 'Cascadia Mono', 'SFMono-Regular', Consolas, 'Liberation Mono', monospace;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
h1, h2, h3, h4 { margin: 0; font-weight: 700; letter-spacing: -.015em; line-height: 1.2; }
p { margin: 0; }
a { color: var(--brand-600); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font: inherit; color: inherit; }
svg { display: block; }
/* Taille par défaut de toute icône : évite qu'une icône isolée s'étire dans un
   conteneur flex. Les règles contextuelles (.btn svg, .icon-btn svg, .empty svg…)
   restent prioritaires par spécificité. */
.ic { width: 1.15em; height: 1.15em; flex: none; }
.icon-inline { width: 18px; height: 18px; flex: none; }
.icon-lg { width: 22px; height: 22px; flex: none; }
::selection { background: var(--brand-100); }
.num { font-variant-numeric: tabular-nums; }

/* ---------- Scrollbars ---------- */
* { scrollbar-width: thin; scrollbar-color: #C3CFC9 transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: #CBD6D1; border: 3px solid transparent; background-clip: content-box; border-radius: 99px; }
*::-webkit-scrollbar-thumb:hover { background: #AEBCB5; background-clip: content-box; }

/* ==========================================================================
   Layout
   ========================================================================== */
.app { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; position: relative; z-index: 1; }

/* ---------- Filigrane (logo en trame) ---------- */
.bg-watermark {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background-repeat: no-repeat; background-position: center;
  background-size: min(62vw, 640px) auto; opacity: .10;
}

/* ---------- Sidebar ---------- */
.sidebar {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column;
  background:
    radial-gradient(120% 60% at 100% 0%, rgba(192, 138, 46, .16), transparent 60%),
    linear-gradient(178deg, var(--brand-800) 0%, var(--brand-950) 100%);
  color: #E7F0EC;
  padding: 18px 14px 14px;
  z-index: 40;
}
.brand { display: flex; align-items: center; gap: 11px; padding: 6px 8px 18px; }
.brand__mark {
  width: 40px; height: 40px; flex: none; border-radius: 11px; overflow: hidden;
  background: linear-gradient(150deg, var(--gold-500), var(--gold-700));
  color: #2A1B02; display: grid; place-items: center;
  font-family: var(--font-display); font-size: 21px; font-weight: 400;
  box-shadow: 0 6px 16px -6px rgba(0, 0, 0, .55), inset 0 1px 0 rgba(255,255,255,.45);
  letter-spacing: .5px;
}
.brand__mark img { width: 100%; height: 100%; object-fit: cover; display: block; }
.brand__name { font-size: 15px; font-weight: 700; letter-spacing: -.01em; color: #FFFFFF; }
.brand__tag { font-size: 10.5px; text-transform: uppercase; letter-spacing: .14em; color: var(--brand-300); margin-top: 1px; }

.nav { flex: 1; overflow-y: auto; padding: 2px 0 8px; }
.nav__group { margin: 14px 0 4px; }
.nav__label {
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .16em;
  color: rgba(231, 240, 236, .42); padding: 0 12px 7px;
}
.nav__item {
  position: relative; display: flex; align-items: center; gap: 11px;
  width: 100%; padding: 9px 12px; margin: 1px 0;
  border: 0; background: transparent; border-radius: var(--r-sm);
  color: rgba(231, 240, 236, .82); font-size: 13.4px; font-weight: 600;
  cursor: pointer; text-align: left; transition: background .14s, color .14s;
}
.nav__item svg { width: 18px; height: 18px; flex: none; opacity: .85; }
.nav__item:hover { background: rgba(255, 255, 255, .07); color: #FFFFFF; }
.nav__item.is-active { background: rgba(255, 255, 255, .13); color: #FFFFFF; }
.nav__item.is-active::before {
  content: ''; position: absolute; left: -14px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 20px; border-radius: 0 3px 3px 0; background: var(--gold-500);
}
.nav__count {
  margin-left: auto; font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 99px;
  background: rgba(255, 255, 255, .14); color: #EAF3EF; font-variant-numeric: tabular-nums;
}
.sidebar__foot { padding: 12px 10px 4px; border-top: 1px solid rgba(255, 255, 255, .1); }
.version-chip {
  display: flex; align-items: center; gap: 8px; font-size: 11.5px; color: var(--brand-300);
}
.version-chip b { color: #EAF3EF; font-weight: 700; }
.dot { width: 6px; height: 6px; border-radius: 50%; background: #4CC38A; box-shadow: 0 0 0 3px rgba(76, 195, 138, .18); }
.version-chip--warn .dot { background: #F5A623; box-shadow: 0 0 0 3px rgba(245, 166, 35, .18); }
.version-chip--err .dot { background: #E5484D; box-shadow: 0 0 0 3px rgba(229, 72, 77, .18); }

/* ---------- Main ---------- */
.main { display: flex; flex-direction: column; min-width: 0; }
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 18px;
  padding: 14px 28px; min-height: 68px;
  background: rgba(255, 255, 255, .86); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar__title { min-width: 0; }
.topbar__title h1 { font-size: 19px; }
.topbar__title p { font-size: 12.5px; color: var(--muted); margin-top: 1px; }
.topbar__spacer { flex: 1; }
.topbar__tools { display: flex; align-items: center; gap: 10px; }

.search-wrap { position: relative; width: 250px; }
.search {
  position: relative; width: 100%;
}
.search svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--faint); }
.search input {
  width: 100%; padding: 8px 12px 8px 34px; border: 1px solid var(--line-strong);
  border-radius: 99px; background: var(--surface-2); font-size: 13px; color: var(--ink);
}
.search input:focus { outline: none; border-color: var(--brand-500); background: #fff; box-shadow: 0 0 0 3px var(--brand-100); }

.search__panel {
  position: absolute; top: calc(100% + 8px); left: 0; width: min(430px, 88vw);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  box-shadow: var(--sh-3); max-height: 62vh; overflow-y: auto; padding: 6px; z-index: 70;
}
.search__group { padding: 4px 0; border-bottom: 1px solid var(--line); }
.search__group:last-child { border-bottom: 0; }
.search__label { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .12em; color: var(--faint); padding: 6px 10px 3px; }
.search__item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 7px 10px; border: 0; background: transparent; border-radius: var(--r-sm); cursor: pointer; text-align: left; }
.search__item:hover { background: var(--surface-2); }
.search__item svg { width: 16px; height: 16px; color: var(--brand-500); flex: none; }
.search__item span { min-width: 0; display: flex; flex-direction: column; }
.search__item b { font-size: 12.8px; font-weight: 700; }
.search__item em { font-style: normal; font-size: 11.4px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search__empty { padding: 14px 12px; font-size: 12.5px; color: var(--muted); }

.content { padding: 24px 28px 72px; flex: 1; }

/* ==========================================================================
   Primitives
   ========================================================================== */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  box-shadow: var(--sh-1);
}
.card__head {
  display: flex; align-items: center; gap: 12px; padding: 15px 18px;
  border-bottom: 1px solid var(--line);
}
.card__head h3 { font-size: 14.5px; }
.card__head p { font-size: 12px; color: var(--muted); margin-top: 2px; }
.card__head .spacer { flex: 1; }
.card__body { padding: 18px; }
.card__body--flush { padding: 0; }

.grid { display: grid; gap: 16px; }
.grid--kpi { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid--main { grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); }
.grid--main-r { grid-template-columns: minmax(0, 1fr) minmax(0, 1.7fr); }

.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; align-items: center; gap: 10px; }
.row--wrap { flex-wrap: wrap; }
.spacer { flex: 1; }

/* ---------- KPI ---------- */
.kpi { position: relative; padding: 17px 18px; overflow: hidden; }
.kpi__label { display: flex; align-items: center; gap: 7px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
.kpi__label svg { width: 15px; height: 15px; color: var(--brand-500); }
.kpi__value { font-size: 27px; font-weight: 700; letter-spacing: -.02em; margin-top: 9px; font-variant-numeric: tabular-nums; }
.kpi__value small { font-size: 13px; font-weight: 600; color: var(--muted); margin-left: 4px; letter-spacing: 0; }
.kpi__foot { display: flex; align-items: center; gap: 8px; margin-top: 9px; font-size: 12px; color: var(--muted); }
.kpi__accent { position: absolute; inset: 0 auto 0 0; width: 3px; background: var(--brand-500); opacity: .9; }
.kpi--gold .kpi__accent { background: var(--gold-500); }
.kpi--gold .kpi__label svg { color: var(--gold-600); }
.kpi--pos .kpi__accent { background: var(--pos); }
.kpi--neg .kpi__accent { background: var(--neg); }
.kpi--info .kpi__accent { background: var(--info); }
.kpi--info .kpi__label svg { color: var(--info); }

/* ---------- Pill / badge ---------- */
.pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 9px; border-radius: 99px; font-size: 11.5px; font-weight: 700;
  background: var(--neutral-bg); color: var(--ink-2); white-space: nowrap;
}
.pill::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .85; }
.pill--plain::before { display: none; }
.pill--ok   { background: var(--pos-bg);  color: var(--pos); }
.pill--warn { background: var(--warn-bg); color: var(--warn); }
.pill--bad  { background: var(--neg-bg);  color: var(--neg); }
.pill--info { background: var(--info-bg); color: var(--info); }
.pill--gold { background: var(--gold-100); color: var(--gold-700); }
.pill--muted{ background: var(--surface-3); color: var(--muted); }
.pill--lg { font-size: 12.5px; padding: 4px 11px; }

.delta { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 700; }
.delta svg { width: 13px; height: 13px; }
.delta--up { color: var(--pos); }
.delta--down { color: var(--neg); }
.delta--flat { color: var(--muted); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 8px 14px; border-radius: var(--r-sm); border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--ink-2); font-size: 13px; font-weight: 700;
  cursor: pointer; transition: background .14s, border-color .14s, color .14s, box-shadow .14s;
  white-space: nowrap;
}
.btn svg { width: 16px; height: 16px; }
.btn:hover { background: var(--surface-2); border-color: var(--line); }
.btn:active { transform: translateY(.5px); }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--brand-100); border-color: var(--brand-500); }
.btn--primary { background: var(--brand-600); border-color: var(--brand-600); color: #fff; }
.btn--primary:hover { background: var(--brand-700); border-color: var(--brand-700); }
.btn--gold { background: var(--gold-500); border-color: var(--gold-500); color: #2A1B02; }
.btn--gold:hover { background: var(--gold-600); border-color: var(--gold-600); }
.btn--danger { background: var(--neg); border-color: var(--neg); color: #fff; }
.btn--danger:hover { background: #971E24; border-color: #971E24; }
.btn--ghost { background: transparent; border-color: transparent; color: var(--ink-3); }
.btn--ghost:hover { background: var(--surface-3); }
.btn--sm { padding: 5px 10px; font-size: 12.2px; border-radius: var(--r-xs); }
.btn--sm svg { width: 14px; height: 14px; }
.btn--block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.icon-btn {
  display: grid; place-items: center; width: 30px; height: 30px; border-radius: var(--r-xs);
  border: 1px solid transparent; background: transparent; color: var(--ink-3); cursor: pointer;
  transition: background .13s, color .13s;
}
.icon-btn svg { width: 16px; height: 16px; }
.icon-btn:hover { background: var(--surface-3); color: var(--ink); }
.icon-btn--danger:hover { background: var(--neg-bg); color: var(--neg); }

.segmented { display: inline-flex; padding: 3px; gap: 2px; background: var(--surface-3); border-radius: var(--r-sm); }
.segmented button {
  border: 0; background: transparent; padding: 6px 12px; border-radius: 6px; font-size: 12.5px;
  font-weight: 700; color: var(--muted); cursor: pointer;
}
.segmented button.is-active { background: var(--surface); color: var(--ink); box-shadow: var(--sh-1); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: 13.2px; }
table.table th {
  text-align: left; font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .09em;
  color: var(--muted); padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap;
  background: var(--surface-2); position: sticky; top: 0;
}
table.table td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.table tbody tr:last-child td { border-bottom: 0; }
table.table tbody tr:hover { background: var(--surface-2); }
table.table .ta-r { text-align: right; font-variant-numeric: tabular-nums; }
table.table .ta-c { text-align: center; }
.cell-strong { font-weight: 700; }
.cell-sub { font-size: 12px; color: var(--muted); }
.money { font-variant-numeric: tabular-nums; font-weight: 600; }
.money--in { color: var(--pos); }
.money--out { color: var(--neg); }
.row-actions { display: flex; gap: 2px; justify-content: flex-end; }

.who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.avatar {
  width: 34px; height: 34px; flex: none; border-radius: 50%; display: grid; place-items: center;
  font-size: 12px; font-weight: 700; color: var(--brand-700); background: var(--brand-100);
  border: 1px solid var(--brand-300);
}
.avatar--lg { width: 56px; height: 56px; font-size: 18px; }
.avatar--gold { background: var(--gold-100); color: var(--gold-700); border-color: var(--gold-200); }
.avatar--photo { padding: 0; overflow: hidden; background: #fff; }
.avatar--photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.who__name { font-weight: 700; font-size: 13.4px; }
.who__meta { font-size: 11.8px; color: var(--muted); }

.empty { padding: 46px 20px; text-align: center; color: var(--muted); }
.empty svg { width: 34px; height: 34px; margin: 0 auto 12px; color: var(--faint); }
.empty h4 { color: var(--ink-2); font-size: 14.5px; margin-bottom: 4px; }
.empty p { font-size: 12.8px; max-width: 380px; margin: 0 auto; }

/* ---------- Progress ---------- */
.progress { height: 7px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: 99px; background: var(--brand-500); }
.progress--gold > span { background: var(--gold-500); }
.progress--over > span { background: var(--neg); }
.progress-meta { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--muted); margin-top: 6px; }

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.label { font-size: 12px; font-weight: 700; color: var(--ink-2); }
.label .req { color: var(--neg); }
.input, .select, .textarea {
  width: 100%; padding: 9px 11px; border: 1px solid var(--line-strong); border-radius: var(--r-sm);
  background: var(--surface); font-size: 13.2px; color: var(--ink); font-family: inherit;
}
.textarea { min-height: 76px; resize: vertical; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--brand-500); box-shadow: 0 0 0 3px var(--brand-100); }
.input:disabled, .select:disabled { background: var(--surface-3); color: var(--muted); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 0 14px; }
.form-grid--3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.form-grid .span-2 { grid-column: span 2; }
.hint { font-size: 11.5px; color: var(--muted); }
.form-error { font-size: 12px; color: var(--neg); font-weight: 600; }
.check { display: flex; align-items: center; gap: 9px; font-size: 13px; font-weight: 600; color: var(--ink-2); cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--brand-600); }

/* ==========================================================================
   Modal / Drawer / Toast
   ========================================================================== */
.overlay {
  position: fixed; inset: 0; z-index: 100; display: flex; align-items: flex-start; justify-content: center;
  padding: 5vh 18px; background: rgba(7, 30, 23, .46); backdrop-filter: blur(3px); overflow-y: auto;
  animation: fade .16s ease;
}
.modal {
  width: 100%; max-width: 620px; background: var(--surface); border-radius: var(--r-xl);
  box-shadow: var(--sh-3); animation: pop .2s cubic-bezier(.2, .9, .3, 1.1); overflow: hidden;
}
.modal--lg { max-width: 860px; }
.modal--sm { max-width: 440px; }
.modal__head { display: flex; align-items: flex-start; gap: 12px; padding: 18px 20px 14px; border-bottom: 1px solid var(--line); }
.modal__head h3 { font-size: 16.5px; }
.modal__head p { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.modal__head .icon-btn { margin-left: auto; }
.modal__body { padding: 20px; }
.modal__foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 20px; border-top: 1px solid var(--line); background: var(--surface-2); }

@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(-8px) scale(.985); } }

.toast-root { position: fixed; right: 20px; bottom: 20px; z-index: 200; display: flex; flex-direction: column; gap: 10px; }
.toast {
  display: flex; align-items: center; gap: 11px; min-width: 260px; max-width: 380px;
  padding: 12px 15px; border-radius: var(--r); background: var(--brand-900); color: #EAF3EF;
  box-shadow: var(--sh-2); font-size: 13px; font-weight: 600; animation: slide .22s ease;
}
.toast svg { width: 18px; height: 18px; flex: none; }
.toast--ok svg { color: #5CD39A; }
.toast--err { background: #5C1519; }
.toast--err svg { color: #F1A9AD; }
.toast--info svg { color: #8FC6F0; }
@keyframes slide { from { opacity: 0; transform: translateX(16px); } }

/* ==========================================================================
   Charts
   ========================================================================== */
.chart { width: 100%; height: auto; }
.chart .grid-line { stroke: var(--line); stroke-width: 1; }
.chart .axis-text { fill: var(--faint); font-size: 10.5px; font-family: var(--font-sans); font-weight: 600; }
.chart .bar-in { fill: var(--brand-500); }
.chart .bar-out { fill: var(--gold-500); }
.chart .bar-ghost { fill: var(--surface-3); }
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12px; color: var(--muted); font-weight: 600; }
.legend i { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 6px; }

.donut-legend { display: flex; flex-direction: column; gap: 9px; }
.donut-legend__row { display: flex; align-items: center; gap: 9px; font-size: 12.6px; }
.donut-legend__row i { width: 9px; height: 9px; border-radius: 2px; flex: none; }
.donut-legend__row b { margin-left: auto; font-variant-numeric: tabular-nums; }

/* ---------- Misc lists ---------- */
.feed { display: flex; flex-direction: column; }
.feed__item { display: flex; gap: 12px; padding: 12px 18px; border-bottom: 1px solid var(--line); }
.feed__item:last-child { border-bottom: 0; }
.feed__icon { width: 32px; height: 32px; flex: none; border-radius: 9px; display: grid; place-items: center; background: var(--surface-3); color: var(--ink-3); }
.feed__icon svg { width: 16px; height: 16px; }
.feed__icon.in { background: var(--pos-bg); color: var(--pos); }
.feed__icon.out { background: var(--gold-100); color: var(--gold-700); }
.feed__body { min-width: 0; flex: 1; }
.feed__title { font-size: 13.2px; font-weight: 700; }
.feed__meta { font-size: 11.8px; color: var(--muted); }
.feed__amt { font-variant-numeric: tabular-nums; font-weight: 700; font-size: 13.2px; }

.kv { display: grid; grid-template-columns: 130px 1fr; gap: 9px 14px; font-size: 13px; }
.kv dt { color: var(--muted); font-weight: 600; }
.kv dd { margin: 0; font-weight: 600; }

.list-links { display: flex; flex-direction: column; }
.list-link { display: flex; align-items: center; gap: 12px; padding: 12px 18px; border-bottom: 1px solid var(--line); cursor: pointer; background: transparent; border-left: 0; border-right: 0; border-top: 0; text-align: left; width: 100%; }
.list-link:last-child { border-bottom: 0; }
.list-link:hover { background: var(--surface-2); }
.list-link__body { flex: 1; min-width: 0; }
.list-link__title { font-size: 13.2px; font-weight: 700; }
.list-link__meta { font-size: 11.8px; color: var(--muted); }

/* ---------- Member card (printable) ---------- */
.mcard {
  width: 100%; max-width: 460px; aspect-ratio: 85.6 / 54; border-radius: 16px; overflow: hidden;
  background: linear-gradient(150deg, var(--brand-700), var(--brand-950));
  color: #EAF3EF; position: relative; box-shadow: var(--sh-2); border: 1px solid var(--brand-800);
}
.mcard::after {
  content: ''; position: absolute; right: -40px; top: -60px; width: 220px; height: 220px; border-radius: 50%;
  background: radial-gradient(circle, rgba(192,138,46,.34), transparent 68%);
}
.mcard__top { display: flex; align-items: center; gap: 10px; padding: 15px 17px 0; position: relative; z-index: 1; }
.mcard__mark { width: 34px; height: 34px; border-radius: 9px; overflow: hidden; background: linear-gradient(150deg, var(--gold-500), var(--gold-700)); color: #2A1B02; display: grid; place-items: center; font-family: var(--font-display); font-size: 18px; }
.mcard__logo { width: 100%; height: 100%; object-fit: cover; display: block; }
.mcard__org { font-size: 13px; font-weight: 700; color: #fff; }
.mcard__org small { display: block; font-size: 9.5px; text-transform: uppercase; letter-spacing: .16em; color: var(--brand-300); font-weight: 700; }
.mcard__type { margin-left: auto; font-size: 9.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .17em; color: var(--gold-500); }
.mcard__mid { display: flex; align-items: center; gap: 14px; padding: 14px 17px 0; position: relative; z-index: 1; }
.mcard__photo { width: 74px; height: 74px; flex: none; border-radius: 12px; overflow: hidden; background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.25); display: grid; place-items: center; font-family: var(--font-display); font-size: 30px; color: #fff; }
.mcard__photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.mcard__name { font-size: 19px; font-weight: 700; color: #fff; line-height: 1.15; }
.mcard__fn { font-size: 11.5px; color: var(--gold-200); font-weight: 700; text-transform: uppercase; letter-spacing: .08em; margin-top: 3px; }
.mcard__id { font-size: 12.5px; color: var(--brand-300); margin-top: 5px; font-variant-numeric: tabular-nums; }
.mcard__foot { position: absolute; left: 17px; right: 17px; bottom: 12px; display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; z-index: 1; }
.mcard__dates { display: flex; gap: 18px; font-size: 10px; }
.mcard__dates b { display: block; font-size: 12.5px; color: #fff; font-variant-numeric: tabular-nums; }
.mcard__dates span { text-transform: uppercase; letter-spacing: .1em; color: var(--brand-300); font-weight: 700; }
.mcard__valid { margin-left: auto; text-align: right; font-size: 9.5px; text-transform: uppercase; letter-spacing: .1em; color: var(--brand-300); font-weight: 700; }
.mcard__advance { flex-basis: 100%; margin-top: 7px; padding-top: 6px; border-top: 1px solid rgba(255,255,255,.16); font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .09em; color: var(--gold-500); }

/* Liste des exercices à émettre (renouvellement, y compris paiement d'avance) */
.renew-years { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 12px; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: var(--surface-2); }
.renew-year { margin: 0; font-size: 12.5px; align-items: center; }
.renew-year input[disabled] ~ span { color: var(--muted); }

/* ==========================================================================
   Utilities & responsive
   ========================================================================== */
.mt-0 { margin-top: 0; } .mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; }
.mb-2 { margin-bottom: 16px; }
.text-muted { color: var(--muted); }
.text-sm { font-size: 12.5px; }
.text-right { text-align: right; }
.nowrap { white-space: nowrap; }
.hide { display: none !important; }
.mobile-toggle { display: none; }

@media (max-width: 1180px) {
  .grid--kpi { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid--main, .grid--main-r { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 900px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: fixed; inset: 0 auto 0 0; width: 264px; transform: translateX(-100%);
    transition: transform .22s ease; box-shadow: var(--sh-3);
  }
  body.nav-open .sidebar { transform: none; }
  body.nav-open::after { content: ''; position: fixed; inset: 0; background: rgba(7,30,23,.44); z-index: 35; }
  .mobile-toggle { display: grid; }
  .search-wrap { width: 160px; }
  .content { padding: 18px 16px 64px; }
  .topbar { padding: 12px 16px; }
}
@media (max-width: 620px) {
  .grid--kpi, .grid--2, .grid--3 { grid-template-columns: minmax(0, 1fr); }
  .form-grid, .form-grid--3 { grid-template-columns: minmax(0, 1fr); }
  .form-grid .span-2 { grid-column: auto; }
  .search-wrap { display: none; }
}

/* ==========================================================================
   Logo & rapport chiffré (écran + impression + PDF)
   ========================================================================== */
.logo-preview {
  width: 92px; height: 92px; flex: none; border-radius: 14px; overflow: hidden;
  border: 1px dashed var(--line-strong); background: var(--surface-2);
  display: grid; place-items: center; color: var(--faint);
}
.photo-preview {
  width: 96px; height: 120px; flex: none; border-radius: 12px; overflow: hidden;
  border: 1px dashed var(--line-strong); background: var(--surface-2);
  display: grid; place-items: center; color: var(--faint);
}
.photo-preview img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-preview svg { width: 26px; height: 26px; }
.logo-preview img { width: 100%; height: 100%; object-fit: contain; background: #fff; }
.logo-preview svg { width: 26px; height: 26px; }

.report-host { background: var(--surface); }
.report { color: var(--ink); font-size: 12.5px; }
.report__head { display: flex; justify-content: space-between; gap: 18px; align-items: flex-start; border-bottom: 2px solid var(--brand-600); padding-bottom: 12px; }
.report__brand { display: flex; gap: 12px; align-items: center; min-width: 0; }
.report__logo { width: 54px; height: 54px; object-fit: contain; border-radius: 8px; flex: none; }
.report__org { font-size: 15px; font-weight: 800; color: var(--brand-800); }
.report__org-sub { font-size: 11px; color: var(--muted); }
.report__title { text-align: right; }
.report__title h3 { font-size: 14.5px; }
.report__title p { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.report__meta { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 20px; margin: 14px 0; }
.report__meta-item { display: flex; justify-content: space-between; gap: 10px; font-size: 12px; border-bottom: 1px dotted var(--line); padding-bottom: 3px; }
.report__meta-item span { color: var(--muted); }
.report__kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-bottom: 18px; }
.report__kpi { border: 1px solid var(--line); border-left: 3px solid var(--brand-500); border-radius: 8px; padding: 9px 11px; background: var(--surface-2); }
.report__kpi--pos { border-left-color: var(--pos); }
.report__kpi--neg { border-left-color: var(--neg); }
.report__kpi-label { font-size: 9.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.report__kpi-value { font-size: 14px; font-weight: 700; margin-top: 3px; font-variant-numeric: tabular-nums; }
.report__section { margin-bottom: 16px; }
.report__section h4 { font-size: 11.5px; text-transform: uppercase; letter-spacing: .07em; color: var(--brand-600); margin-bottom: 6px; }
.report__table { width: 100%; border-collapse: collapse; font-size: 11.5px; }
.report__table th { text-align: left; font-size: 10px; text-transform: uppercase; letter-spacing: .06em; color: var(--brand-700); background: var(--brand-50); padding: 6px 8px; border-bottom: 1px solid var(--line-strong); }
.report__table td { padding: 6px 8px; border-bottom: 1px solid var(--line); }
.report__table tr:nth-child(even) td { background: #FBFCFB; }
.report__foot { border-top: 1px solid var(--line); margin-top: 14px; padding-top: 10px; font-size: 11px; color: var(--muted); }
.report__sign { display: flex; justify-content: space-between; gap: 20px; margin-top: 24px; font-size: 11px; color: var(--muted); }
.report__sign span { border-top: 1px solid var(--line-strong); padding-top: 4px; min-width: 170px; text-align: center; }

/* ==========================================================================
   Connexion & utilisateur
   ========================================================================== */
body.auth-locked .app { display: none; }
body.auth-locked .bg-watermark { opacity: .06; }
#loginRoot { position: relative; z-index: 60; }
.login { min-height: 100vh; display: grid; place-items: center; padding: 26px 18px; }
.login__card { width: 100%; max-width: 430px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-xl); box-shadow: var(--sh-2); padding: 26px; }
.login__card--wide { max-width: 640px; }
.login__brand { display: flex; gap: 12px; align-items: center; }
.login__logo { width: 46px; height: 46px; border-radius: 12px; object-fit: cover; }
.login__org { font-size: 16px; font-weight: 800; color: var(--brand-800); }
.login__sub { font-size: 11.5px; color: var(--muted); }
.login__note { display: flex; gap: 8px; margin-top: 14px; font-size: 11px; color: var(--muted); line-height: 1.55; }
.login__note svg { width: 15px; height: 15px; flex: none; margin-top: 1px; color: var(--gold-600); }

.sidebar__user { display: flex; align-items: center; gap: 10px; padding: 8px 6px 12px; }
.sidebar__user-info { min-width: 0; flex: 1; }
.sidebar__user-name { font-size: 12.5px; font-weight: 700; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar__user-role { font-size: 10.5px; color: var(--brand-300); text-transform: uppercase; letter-spacing: .08em; }
.sidebar__user .icon-btn { color: var(--brand-300); }
.sidebar__user .icon-btn:hover { background: rgba(255, 255, 255, .1); color: #fff; }
.app-signature { font-size: 10.5px; color: var(--brand-300); letter-spacing: .04em; padding: 6px 10px 0; }
.app-signature b { color: #EAF3EF; }
.login__signature { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--line); text-align: center; font-size: 11.5px; color: var(--muted); letter-spacing: .04em; }
.login__signature b { color: var(--brand-700); }

/* ---------- Impression ---------- */
@media print {
  .app, .bg-watermark, .toast-root, .no-print { display: none !important; }
  body { background: #fff; }
  .overlay { position: static !important; background: none !important; padding: 0 !important; backdrop-filter: none !important; overflow: visible !important; display: block !important; }
  .modal { box-shadow: none !important; max-width: none !important; border-radius: 0 !important; animation: none !important; }
  .modal__head, .modal__foot { display: none !important; }
  .modal__body { padding: 0 !important; }
  .report { font-size: 11.5px; }
  .report__kpi, .report__section, .report__table tr { break-inside: avoid; }
  .mcard { box-shadow: none; max-width: 340px; }
}

@page { margin: 14mm; }
