:root {
  --purple: #3B0A6D;
  --purple-dark: #180830;
  --purple-light: #5B21B6;
  --red: #E5484D;
  --red-light: #FF7A7A;
  --ink: #15101F;
  --ink-soft: #6b6478;
  --white: #FFFFFF;
  --bg-soft: #F4EFFB;
  --border: #E3DCF0;
  --success: #16A34A;
  --success-bg: #dcfce7;
  --warn: #991b1b;
  --warn-bg: #fee2e2;
  --amber: #b45309;
  --amber-bg: #fef3c7;
  --shadow-sm: 0 4px 16px rgba(59,10,109,.06);
  --shadow-md: 0 12px 32px rgba(59,10,109,.10);
  --radius: 16px;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: 'Manrope', 'Segoe UI', Arial, sans-serif;
  background: var(--bg-soft);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { font-family: 'Sora', 'Segoe UI', Arial, sans-serif; }
a { color: var(--purple-light); text-decoration: none; }

/* ---------- App shell : sidebar + topbar + content ---------- */
.app-shell { display: flex; min-height: 100vh; }
.sidebar-toggle-checkbox { display: none; }
.app-sidebar {
  width: 264px; flex-shrink: 0; background: linear-gradient(180deg, var(--purple), var(--purple-dark));
  color: #fff; display: flex; flex-direction: column; padding: 1.5rem 1rem 1rem; gap: .15rem;
  position: sticky; top: 0; height: 100vh; overflow-y: auto; z-index: 70;
  transition: transform .28s ease;
}
.app-sidebar .brand { font-weight: 800; font-size: 1.25rem; margin-bottom: 1.4rem; display: flex; align-items: center; gap: .6rem; }
.app-sidebar .brand .logo-badge {
  width: 36px; height: 36px; border-radius: 10px; background: linear-gradient(135deg, var(--purple-light), var(--red));
  display: flex; align-items: center; justify-content: center; font-size: 1rem; font-weight: 800; flex-shrink: 0;
}
.app-sidebar .brand .brand-text span { display: block; font-size: .65rem; font-weight: 700; color: var(--red-light); text-transform: uppercase; letter-spacing: .1em; }
.app-sidebar .nav-group-label {
  font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .09em;
  color: rgba(255,255,255,.4); margin: 1rem .8rem .4rem;
}
.app-sidebar .nav-group-label:first-of-type { margin-top: .2rem; }
.app-sidebar a.nav-link {
  color: rgba(255,255,255,.82); padding: .6rem .8rem; border-radius: 10px;
  display: flex; align-items: center; gap: .7rem; font-size: .88rem; font-weight: 600;
  transition: background .15s ease, color .15s ease;
}
.app-sidebar a.nav-link .icon { flex-shrink: 0; opacity: .85; }
.app-sidebar a.nav-link:hover { background: rgba(255,255,255,.08); color: #fff; }
.app-sidebar a.nav-link.active { background: rgba(255,255,255,.14); color: #fff; box-shadow: inset 3px 0 0 var(--red-light); }
.app-sidebar a.nav-link.active .icon { opacity: 1; }
.app-sidebar a.nav-link.nav-link-sub { padding: .48rem .8rem .48rem 2rem; font-size: .82rem; font-weight: 500; color: rgba(255,255,255,.66); gap: .6rem; }
.app-sidebar a.nav-link.nav-link-sub .icon { opacity: .7; }
.app-sidebar a.nav-link.nav-link-sub:hover { color: #fff; }
.app-sidebar a.nav-link.nav-link-sub.active { box-shadow: inset 3px 0 0 var(--red-light); background: rgba(255,255,255,.1); }
.app-sidebar .logout { margin-top: .8rem; color: #FF9B9B; }

.sidebar-backdrop { display: none; }
.menu-toggle {
  display: none; align-items: center; justify-content: center; width: 40px; height: 40px;
  border-radius: 10px; border: 1px solid var(--border); background: #fff; cursor: pointer;
  color: var(--ink); flex-shrink: 0;
}
.menu-toggle:hover { border-color: var(--purple-light); color: var(--purple-light); }

/* Sidebar devient un tiroir hors-écran sur tablette/mobile ; bascule via la checkbox cachée
   (fonctionne sans dépendre d'un rendermode interactif Blazor sur le layout). */
@media (max-width: 1080px) {
  .app-sidebar {
    position: fixed; top: 0; left: 0; height: 100dvh;
    transform: translateX(-100%);
    box-shadow: 24px 0 60px rgba(0,0,0,.35);
  }
  .sidebar-toggle-checkbox:checked ~ .app-sidebar { transform: translateX(0); }
  .sidebar-backdrop {
    display: block; position: fixed; inset: 0; background: rgba(21,16,31,.5);
    z-index: 65; opacity: 0; pointer-events: none; transition: opacity .22s ease; cursor: pointer;
  }
  .sidebar-toggle-checkbox:checked ~ .sidebar-backdrop { opacity: 1; pointer-events: auto; }
  .menu-toggle { display: inline-flex; }
}

.app-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.app-topbar {
  height: 68px; flex-shrink: 0; background: #fff; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; padding: 0 2rem; gap: 1rem;
  position: sticky; top: 0; z-index: 40;
}
.app-topbar .topbar-left { display: flex; align-items: center; gap: .9rem; min-width: 0; }
.app-topbar .topbar-title { font-family: 'Sora', sans-serif; font-weight: 700; font-size: 1.05rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.app-topbar .topbar-user { display: flex; align-items: center; gap: .7rem; font-size: .85rem; flex-shrink: 0; }
.app-topbar .topbar-user .avatar {
  width: 38px; height: 38px; border-radius: 999px; background: linear-gradient(135deg, var(--purple-light), var(--red));
  color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: .8rem; flex-shrink: 0;
}
.app-topbar .topbar-user .who .name { font-weight: 700; }
.app-topbar .topbar-user .who .role { color: var(--ink-soft); font-size: .74rem; }

/* Le conteneur principal reste centré et sa largeur maximale s'élargit par palier
   sur les très grands écrans (laptop large / desktop / TV) au lieu de laisser un vide. */
.app-content { flex: 1; padding: 1.8rem 2rem 3rem; max-width: 1360px; width: 100%; margin: 0 auto; }
@media (min-width: 1680px) { .app-content { max-width: 1560px; } }
@media (min-width: 2100px) { .app-content { max-width: 1880px; } }
@media (min-width: 2600px) { .app-content { max-width: 2240px; } }

@media (max-width: 1080px) {
  .app-topbar { padding: 0 1.25rem; }
  .app-content { padding: 1.4rem 1.25rem 2.5rem; }
}
@media (max-width: 640px) {
  .app-topbar { padding: 0 .9rem; height: 60px; }
  .app-topbar .topbar-title { font-size: .9rem; }
  .app-topbar .topbar-user .who { display: none; }
  .app-content { padding: 1rem .8rem 2rem; }
}

.auth-shell {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(160deg, var(--purple) 0%, #180830 100%);
  padding: 2rem;
}

/* ---------- Écran d'authentification plein écran, panneau de marque + formulaire ---------- */
@keyframes floatLogo { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
@keyframes ringSpin { to { transform: rotate(360deg); } }
@keyframes haloPulse { 0%, 100% { opacity: .35; transform: scale(1); } 50% { opacity: .6; transform: scale(1.08); } }
@keyframes driftGlow { 0%, 100% { transform: translate(0, 0); } 50% { transform: translate(20px, -16px); } }

.auth-split { min-height: 100vh; display: flex; }
.auth-split .brand-panel {
  flex: 0 0 42%; max-width: 560px; min-width: 340px;
  background: linear-gradient(165deg, var(--purple) 0%, var(--purple-dark) 100%);
  color: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 3rem 2.5rem; position: relative; overflow: hidden; text-align: center;
}
.auth-split .brand-panel .glow-a, .auth-split .brand-panel .glow-b {
  position: absolute; border-radius: 50%; filter: blur(10px); pointer-events: none;
}
.auth-split .brand-panel .glow-a { width: 260px; height: 260px; background: radial-gradient(circle, var(--red-light) 0%, transparent 70%); opacity: .25; top: -60px; right: -60px; animation: driftGlow 8s ease-in-out infinite; }
.auth-split .brand-panel .glow-b { width: 220px; height: 220px; background: radial-gradient(circle, var(--purple-light) 0%, transparent 70%); opacity: .3; bottom: -70px; left: -50px; animation: driftGlow 10s ease-in-out infinite reverse; }
.auth-split .brand-panel .logo-orbit { position: relative; width: 150px; height: 150px; margin-bottom: 1.8rem; animation: floatLogo 4.5s ease-in-out infinite; }
.auth-split .brand-panel .logo-orbit .ring {
  position: absolute; inset: 0; border-radius: 50%;
  background: conic-gradient(from 0deg, transparent, var(--red-light) 30%, #fff 55%, transparent 75%);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 3px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 3px));
  animation: ringSpin 6s linear infinite;
}
.auth-split .brand-panel .logo-orbit .halo {
  position: absolute; inset: 14px; border-radius: 50%;
  background: radial-gradient(circle, rgba(255,122,122,.45) 0%, transparent 72%);
  animation: haloPulse 2.6s ease-in-out infinite;
}
.auth-split .brand-panel .logo-orbit .logo-frame {
  position: absolute; inset: 16px; border-radius: 50%; background: #fff; padding: 8px;
  box-shadow: 0 18px 46px rgba(0,0,0,.4); display: flex; align-items: center; justify-content: center;
}
.auth-split .brand-panel .logo-orbit .logo-frame img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.auth-split .brand-panel h2 { font-family: 'Sora', sans-serif; font-size: 1.55rem; font-weight: 800; margin: 0 0 .5rem; position: relative; }
.auth-split .brand-panel .tagline { color: rgba(255,255,255,.78); font-size: .9rem; max-width: 300px; line-height: 1.5; position: relative; }
.auth-split .brand-panel .brand-badge {
  margin-top: 2.2rem; display: inline-flex; align-items: center; gap: .4rem; font-size: .68rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .1em; color: var(--red-light); position: relative;
}
.auth-split .form-panel { flex: 1; display: flex; align-items: center; justify-content: center; background: var(--bg-soft); padding: 2.5rem 2rem; }
.auth-split .form-panel .auth-card { box-shadow: none; border: 1px solid var(--border); }
@media (max-width: 860px) {
  .auth-split { flex-direction: column; }
  .auth-split .brand-panel { max-width: none; padding: 2.2rem 1.5rem; flex: none; }
  .auth-split .brand-panel .logo-orbit { width: 96px; height: 96px; margin-bottom: 1rem; }
  .auth-split .brand-panel h2 { font-size: 1.2rem; }
}
@media (max-width: 420px) {
  .auth-split .brand-panel { padding: 1.6rem 1.1rem; }
  .auth-split .brand-panel .logo-orbit { width: 72px; height: 72px; margin-bottom: .7rem; }
  .auth-split .brand-panel h2 { font-size: 1.05rem; }
  .auth-split .brand-panel .tagline { font-size: .8rem; }
  .auth-split .brand-panel .brand-badge { margin-top: 1.2rem; }
  .auth-split .form-panel { padding: 1.6rem 1rem; }
  .auth-card { padding: 1.6rem 1.3rem; }
}
.auth-card {
  background: var(--white); border-radius: 16px; padding: 2.2rem; width: 100%; max-width: 420px;
  box-shadow: 0 20px 60px rgba(0,0,0,.35);
}
.auth-card h1 { font-size: 1.4rem; margin: 0 0 .3rem; }
.auth-card p.subtitle { color: #6b6478; font-size: .9rem; margin: 0 0 1.4rem; }
.auth-card label { display: block; font-size: .82rem; font-weight: 600; margin-bottom: .3rem; margin-top: .9rem; }
.auth-card input[type=text], .auth-card input[type=password], .auth-card input[type=email] {
  width: 100%; padding: .65rem .8rem; border: 1px solid var(--border); border-radius: 8px; font-size: .95rem;
}
.auth-card .btn {
  width: 100%; margin-top: 1.4rem; padding: .75rem; border: none; border-radius: 999px;
  background: linear-gradient(135deg, var(--purple-light), var(--red)); color: #fff; font-weight: 700; cursor: pointer;
}
.auth-card .btn:disabled { opacity: .6; cursor: default; }
.auth-card .error { color: var(--red); font-size: .85rem; margin-top: .8rem; }
.auth-card .success { color: #1a7d43; font-size: .85rem; margin-top: .8rem; }
.auth-card .foot-link { display: block; text-align: center; margin-top: 1.2rem; font-size: .85rem; }

table.data-table { width: 100%; border-collapse: collapse; background: #fff; border-radius: 10px; overflow: hidden; }
table.data-table th, table.data-table td { padding: .65rem .8rem; border-bottom: 1px solid var(--border); font-size: .88rem; text-align: left; }
table.data-table th { background: var(--bg-soft); font-weight: 700; }
.badge { display: inline-flex; align-items: center; gap: .3rem; padding: .2rem .6rem; border-radius: 999px; font-size: .75rem; font-weight: 700; }
.badge.ok { background: #dcfce7; color: #166534; }
.badge.warn { background: #fee2e2; color: #991b1b; }
.badge.attention { background: #fef3e2; color: #b45309; }
.stat-row { display: flex; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.5rem; }
.stat-card { background: #fff; border-radius: 12px; padding: 1.2rem; min-width: 160px; flex: 1; box-shadow: 0 4px 16px rgba(0,0,0,.06); }
.stat-card .value { font-size: 1.6rem; font-weight: 800; color: var(--purple); }
.stat-card .label { font-size: .8rem; color: #6b6478; }
.toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; gap: 1rem; flex-wrap: wrap; }
.btn-sm { padding: .4rem .8rem; border-radius: 999px; border: none; background: var(--purple-light); color: #fff; font-size: .8rem; cursor: pointer; margin-right: .3rem; }
.btn-sm.danger { background: var(--red); }

/* ============================================================
   Design system premium — pages GFC (dashboard, membres, crédits,
   cotisations, remboursements, réservations, rapports)
   ============================================================ */

@keyframes fadeSlideUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes popIn { from { opacity: 0; transform: scale(.94); } to { opacity: 1; transform: scale(1); } }
@keyframes shimmer { 0% { background-position: -400px 0; } 100% { background-position: 400px 0; } }
@keyframes spin { to { transform: rotate(360deg); } }

.page-header { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; margin-bottom: 1.6rem; flex-wrap: wrap; animation: fadeSlideUp .35s ease; }
.page-header .title-block h1 { font-size: 1.5rem; margin: 0 0 .25rem; font-weight: 800; color: var(--ink); }
.page-header .title-block .subtitle { color: var(--ink-soft); font-size: .88rem; margin: 0; }
.page-header .actions { display: flex; gap: .6rem; flex-wrap: wrap; }

/* Boutons */
.btn-primary, .btn-secondary, .btn-ghost, .btn-danger-outline {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  padding: .68rem 1.3rem; border-radius: 999px; font-weight: 700; font-size: .86rem;
  border: none; cursor: pointer; transition: transform .12s ease, box-shadow .12s ease, opacity .12s ease;
  font-family: inherit;
}
.btn-primary { background: linear-gradient(135deg, var(--purple-light), var(--red)); color: #fff; box-shadow: 0 8px 20px rgba(229,72,77,.28); }
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 10px 26px rgba(229,72,77,.36); }
.btn-primary:disabled { opacity: .55; cursor: default; transform: none; box-shadow: none; }
.btn-secondary { background: var(--bg-soft); color: var(--purple); }
.btn-secondary:hover { background: var(--border); }
.btn-ghost { background: transparent; color: var(--ink-soft); border: 1px solid var(--border); }
.btn-ghost:hover { border-color: var(--purple-light); color: var(--purple-light); }
.btn-danger-outline { background: #fff; color: var(--red); border: 1px solid #f3c9cb; }
.btn-danger-outline:hover { background: var(--warn-bg); }
.btn-icon { width: 34px; height: 34px; border-radius: 10px; border: 1px solid var(--border); background: #fff; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; color: var(--ink-soft); transition: all .12s; }
.btn-icon:hover { border-color: var(--purple-light); color: var(--purple-light); }
.btn-icon.ok { border-color: rgba(22,163,74,.3); color: var(--success); }
.btn-icon.ok:hover { background: var(--success-bg); border-color: var(--success); }
.btn-icon.danger { border-color: rgba(153,27,27,.28); color: var(--warn); }
.btn-icon.danger:hover { background: var(--warn-bg); border-color: var(--warn); }
.btn-icon.attention { border-color: rgba(180,83,9,.32); color: #b45309; }
.btn-icon.attention:hover { background: #fef3e2; border-color: #b45309; }

.spinner { width: 16px; height: 16px; border-radius: 50%; border: 2.4px solid rgba(255,255,255,.4); border-top-color: #fff; animation: spin .7s linear infinite; display: inline-block; }
.spinner.dark { border-color: rgba(59,10,109,.25); border-top-color: var(--purple); }

/* Cartes premium (KPI) — 4 cartes par ligne, fixe sur desktop, dégradé propre en dessous */
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin-bottom: 1.8rem; }
@media (max-width: 1240px) {
  .kpi-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 860px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 480px) {
  .kpi-grid { grid-template-columns: 1fr; gap: .8rem; margin-bottom: 1.3rem; }
}
.kpi-card {
  background: #fff; border-radius: var(--radius); padding: 1.3rem 1.4rem; box-shadow: var(--shadow-sm);
  position: relative; overflow: hidden; animation: fadeSlideUp .4s ease backwards;
  border: 1px solid var(--border);
}
.kpi-card::after {
  content: ''; position: absolute; top: -30px; right: -30px; width: 100px; height: 100px; border-radius: 50%;
  background: radial-gradient(circle, var(--kpi-tint, var(--purple-light)) 0%, transparent 70%); opacity: .12;
}
.kpi-card .kpi-top { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: .8rem; }
.kpi-card .kpi-icon {
  width: 42px; height: 42px; border-radius: 12px; display: flex; align-items: center; justify-content: center;
  background: color-mix(in srgb, var(--kpi-tint, var(--purple-light)) 14%, white); color: var(--kpi-tint, var(--purple-light));
}
.kpi-card .kpi-trend { font-size: .74rem; font-weight: 700; padding: .15rem .5rem; border-radius: 999px; }
.kpi-card .kpi-trend.up { color: var(--success); background: var(--success-bg); }
.kpi-card .kpi-trend.down { color: var(--warn); background: var(--warn-bg); }
.kpi-card .kpi-value { font-family: 'Sora', sans-serif; font-size: 1.55rem; font-weight: 800; color: var(--ink); line-height: 1.1; }
.kpi-card .kpi-label { font-size: .8rem; color: var(--ink-soft); margin-top: .3rem; }

/* Cartes de contenu génériques */
.panel { background: #fff; border-radius: var(--radius); padding: 1.5rem; box-shadow: var(--shadow-sm); border: 1px solid var(--border); animation: fadeSlideUp .4s ease; }
.panel + .panel { margin-top: 1.2rem; }
.panel .panel-title { font-family: 'Sora', sans-serif; font-weight: 700; font-size: 1rem; margin: 0 0 1rem; display: flex; align-items: center; gap: .5rem; }
.panel-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 1.2rem; align-items: start; }
@media (min-width: 1680px) { .panel-grid { grid-template-columns: 1.6fr 1fr; gap: 1.5rem; } }
@media (max-width: 980px) { .panel-grid { grid-template-columns: 1fr; } }
@media (max-width: 480px) { .panel { padding: 1.1rem; } }

/* Donut chart (CSS conic-gradient, sans librairie) */
.donut { width: 132px; height: 132px; border-radius: 50%; position: relative; margin: 0 auto; }
.donut .donut-hole { position: absolute; inset: 16px; background: #fff; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-direction: column; }
.donut .donut-hole .n { font-family: 'Sora', sans-serif; font-weight: 800; font-size: 1.15rem; color: var(--ink); }
.donut .donut-hole .t { font-size: .65rem; color: var(--ink-soft); }
.legend { display: flex; flex-direction: column; gap: .5rem; margin-top: 1rem; }
.legend .legend-item { display: flex; align-items: center; gap: .55rem; font-size: .82rem; }
.legend .dot { width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; }
.legend .legend-item .lv { margin-left: auto; font-weight: 700; }

/* Barres simples (tendance) */
.bar-chart { display: flex; align-items: flex-end; gap: .5rem; height: 120px; padding-top: .5rem; }
.bar-chart .bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: .35rem; height: 100%; justify-content: flex-end; }
.bar-chart .bar { width: 100%; max-width: 28px; border-radius: 6px 6px 2px 2px; background: linear-gradient(180deg, var(--purple-light), var(--purple)); animation: fadeSlideUp .5s ease backwards; }
.bar-chart .bar-label { font-size: .68rem; color: var(--ink-soft); }

/* Timeline transactions */
.tx-list { display: flex; flex-direction: column; }
.tx-row {
  display: flex; align-items: center; gap: .9rem; padding: .8rem .3rem; border-bottom: 1px solid var(--border);
  animation: fadeSlideUp .35s ease backwards; cursor: pointer; border-radius: 10px; transition: background .12s;
}
.tx-row:hover { background: var(--bg-soft); }
.tx-row:last-child { border-bottom: none; }
.tx-row .tx-icon { width: 40px; height: 40px; border-radius: 11px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; background: var(--bg-soft); color: var(--purple); }
.tx-row .tx-info { flex: 1; min-width: 0; }
.tx-row .tx-info .tx-title { font-weight: 700; font-size: .88rem; }
.tx-row .tx-info .tx-sub { font-size: .76rem; color: var(--ink-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tx-row .tx-amount { text-align: right; flex-shrink: 0; }
.tx-row .tx-amount .amt { font-weight: 800; font-size: .9rem; }
.tx-row .tx-amount .amt.debit { color: var(--red); }
.tx-row .tx-amount .amt.credit { color: var(--success); }

/* Recherche / filtres */
.search-bar { display: flex; align-items: center; gap: .6rem; background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: .55rem .9rem; flex: 1; min-width: 220px; max-width: 380px; }
@media (max-width: 480px) { .search-bar { min-width: 0; max-width: none; width: 100%; } }
.search-bar input { border: none; outline: none; flex: 1; font-size: .88rem; font-family: inherit; background: transparent; }
.search-bar .icon { color: var(--ink-soft); flex-shrink: 0; }
.filter-chip {
  padding: .45rem .9rem; border-radius: 999px; border: 1px solid var(--border); background: #fff; font-size: .8rem;
  font-weight: 700; color: var(--ink-soft); cursor: pointer; transition: all .12s;
}
.filter-chip.active { background: var(--purple); color: #fff; border-color: var(--purple); }
.filter-chip:hover:not(.active) { border-color: var(--purple-light); color: var(--purple-light); }

/* Table premium — défilement horizontal sécurisé sur petits écrans plutôt que colonnes écrasées */
.table-wrap { background: #fff; border-radius: var(--radius); overflow-x: auto; box-shadow: var(--shadow-sm); border: 1px solid var(--border); -webkit-overflow-scrolling: touch; }
.table-premium { width: 100%; border-collapse: collapse; min-width: 640px; }
.table-premium th { background: var(--bg-soft); text-align: left; padding: .8rem 1rem; font-size: .74rem; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-soft); white-space: nowrap; }
.table-premium td { padding: .85rem 1rem; border-top: 1px solid var(--border); font-size: .86rem; vertical-align: middle; }
@media (max-width: 640px) {
  .table-premium th, .table-premium td { padding: .65rem .75rem; font-size: .8rem; }
}
.table-premium tbody tr { transition: background .12s; animation: fadeIn .3s ease backwards; }
.table-premium tbody tr:hover { background: var(--bg-soft); }
.table-premium .cell-strong { font-weight: 700; }
.table-premium .cell-muted { color: var(--ink-soft); font-size: .8rem; }

/* Tableaux "ledger" ultra premium — Journal des opérations / Grand Livre : présentation d'ensemble
   (en-tête, corps, pied) élevée au rang de rapport imprimé, sans toucher .table-premium ailleurs. */
.table-wrap-ultra { border-radius: var(--radius); box-shadow: 0 20px 48px -20px rgba(59,10,109,.32), var(--shadow-sm); border: 1px solid rgba(91,33,182,.16); }
.table-ledger { width: 100%; border-collapse: separate; border-spacing: 0; min-width: 760px; }
.table-ledger thead th {
  background: linear-gradient(135deg, #3B0A6D 0%, var(--purple-light) 100%); color: #fff;
  padding: 1rem 1.15rem; font-size: .72rem; font-weight: 800; text-transform: uppercase;
  letter-spacing: .07em; text-align: left; white-space: nowrap; box-shadow: inset 0 -3px 0 var(--red);
}
.table-ledger thead tr:first-child th:first-child { border-top-left-radius: var(--radius); }
.table-ledger thead tr:first-child th:last-child { border-top-right-radius: var(--radius); }
.table-ledger thead th.ledger-group { text-align: center; border-left: 1px solid rgba(255,255,255,.22); }
.table-ledger thead th[colspan] { text-align: center; font-size: .78rem; letter-spacing: .1em; }
.table-ledger thead tr:nth-child(2) th { font-size: .68rem; padding-top: .55rem; padding-bottom: .55rem; }
.table-ledger tbody td { padding: .85rem 1.15rem; font-size: .86rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table-ledger tbody tr { transition: background .12s; animation: fadeIn .3s ease backwards; }
.table-ledger tbody tr:nth-child(even):not(.ledger-row-ouverture) { background: var(--bg-soft); }
.table-ledger tbody tr:hover:not(.ledger-row-ouverture) { background: color-mix(in srgb, var(--purple-light) 8%, white); }
.table-ledger tbody tr.ledger-row-ouverture td {
  background: linear-gradient(90deg, rgba(91,33,182,.11), rgba(229,72,77,.05)); font-weight: 800;
  border-top: 2px solid var(--purple-light); border-bottom: 2px solid var(--purple-light);
  text-transform: uppercase; font-size: .78rem; letter-spacing: .03em; color: var(--purple-light);
}
.table-ledger .cell-strong { font-weight: 700; }
.table-ledger .cell-muted { color: var(--ink-soft); font-size: .8rem; }
.table-ledger td.num, .table-ledger th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table-ledger tfoot td { background: linear-gradient(135deg, var(--purple-light) 0%, #3B0A6D 100%); color: #fff; font-weight: 800; padding: .82rem 1.15rem; }
.table-ledger tfoot tr.ledger-subtotal td { opacity: .85; font-size: .78rem; box-shadow: inset 0 1px 0 rgba(255,255,255,.18); }
.table-ledger tfoot tr.ledger-grandtotal td { font-size: .95rem; border-top: 3px solid var(--red); }
.table-ledger tfoot tr.ledger-grandtotal td:first-child { border-bottom-left-radius: var(--radius); }
.table-ledger tfoot tr.ledger-grandtotal td:last-child { border-bottom-right-radius: var(--radius); }
@media (max-width: 640px) {
  .table-ledger thead th, .table-ledger tbody td, .table-ledger tfoot td { padding: .65rem .8rem; font-size: .8rem; }
}
.avatar-mini { width: 32px; height: 32px; border-radius: 999px; background: linear-gradient(135deg, var(--purple-light), var(--red)); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-weight: 800; font-size: .72rem; margin-right: .6rem; vertical-align: middle; }

/* Badges étendus */
.badge.info { background: #dbeafe; color: #1e40af; }
.badge.pending { background: var(--amber-bg); color: var(--amber); }
.badge.neutral { background: var(--bg-soft); color: var(--ink-soft); }
.badge-icon { display: inline-flex; align-items: center; gap: .3rem; }

/* Pagination */
.pagination { display: flex; align-items: center; justify-content: center; gap: .4rem; padding: 1rem; }
.pagination button {
  min-width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--border); background: #fff;
  cursor: pointer; font-size: .82rem; font-weight: 700; color: var(--ink-soft);
}
.pagination button.active { background: var(--purple); color: #fff; border-color: var(--purple); }
.pagination button:disabled { opacity: .4; cursor: default; }

/* Pagination ultra premium — sélecteur de taille de page + navigation prev/next centrée */
.pagination-premium {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 1.6rem;
  padding: 1.2rem 1rem; border-top: 1px solid var(--border); background: var(--bg-soft);
}
.pagination-size { display: flex; align-items: center; gap: .5rem; font-size: .82rem; color: var(--ink-soft); font-weight: 600; }
.pagination-size select {
  padding: .4rem .7rem; border: 1px solid var(--border); border-radius: 999px; background: #fff;
  font-size: .82rem; font-weight: 700; color: var(--ink); cursor: pointer; transition: border-color .15s;
}
.pagination-size select:hover, .pagination-size select:focus { outline: none; border-color: var(--purple-light); }
.pagination-nav { display: flex; align-items: center; gap: 1rem; }
.pagination-btn {
  width: 38px; height: 38px; border-radius: 999px; border: 1px solid var(--border); background: #fff;
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer; color: var(--purple-light);
  transition: all .15s;
}
.pagination-btn:hover:not(:disabled) { background: linear-gradient(135deg, var(--purple-light), var(--red)); color: #fff; border-color: transparent; box-shadow: 0 6px 16px rgba(91,33,182,.28); }
.pagination-btn:disabled { opacity: .35; cursor: default; color: var(--ink-soft); }
.pagination-status { font-size: .84rem; font-weight: 600; color: var(--ink); white-space: nowrap; }
.pagination-status strong { color: var(--purple-light); font-weight: 800; }
.pagination-total { color: var(--ink-soft); font-weight: 500; }
@media (max-width: 640px) {
  .pagination-premium { gap: .8rem; padding: 1rem .8rem; }
  .pagination-status { font-size: .78rem; }
  .pagination-total { display: block; }
}

/* Etat vide / skeleton */
.empty-state { text-align: center; padding: 3rem 1.5rem; color: var(--ink-soft); }
.empty-state .icon { color: var(--border); margin-bottom: .8rem; }
.empty-state .title { font-weight: 700; color: var(--ink); margin-bottom: .3rem; }
.skeleton { background: linear-gradient(90deg, var(--bg-soft) 0%, #ece3f8 50%, var(--bg-soft) 100%); background-size: 800px 100%; animation: shimmer 1.4s linear infinite; border-radius: 8px; }

/* Modal */
.modal-backdrop { position: fixed; inset: 0; background: rgba(21,16,31,.55); display: flex; align-items: center; justify-content: center; z-index: 100; padding: 1.5rem; animation: fadeIn .18s ease; }
.modal-card { background: #fff; border-radius: 20px; width: 100%; max-width: 560px; max-height: 90vh; overflow-y: auto; box-shadow: 0 30px 80px rgba(0,0,0,.4); animation: popIn .18s ease; }
.modal-card .modal-header { display: flex; justify-content: space-between; align-items: center; padding: 1.3rem 1.5rem; border-bottom: 1px solid var(--border); }
.modal-card .modal-header h3 { margin: 0; font-family: 'Sora', sans-serif; }
.modal-card .modal-body { padding: 1.5rem; }
.modal-card .modal-footer { display: flex; justify-content: flex-end; gap: .7rem; padding: 1.1rem 1.5rem; border-top: 1px solid var(--border); }
@media (max-width: 480px) {
  .modal-backdrop { padding: 0; align-items: flex-end; }
  .modal-card { border-radius: 20px 20px 0 0; max-height: 94vh; animation: fadeSlideUp .22s ease; }
  .modal-card .modal-body { padding: 1.2rem; }
  .modal-card .modal-header, .modal-card .modal-footer { padding: 1rem 1.2rem; }
  .modal-card .modal-footer { flex-direction: column-reverse; }
  .modal-card .modal-footer .btn-primary, .modal-card .modal-footer .btn-secondary, .modal-card .modal-footer .btn-ghost { width: 100%; }
}

/* Variante large et aérée pour les formulaires complexes à plusieurs sections (ex : Nouveau crédit) */
.modal-card.modal-card-xl { max-width: 900px; }
@media (max-width: 960px) { .modal-card.modal-card-xl { max-width: 96vw; } }
.modal-card .modal-body.modal-body-airy { padding: 1.9rem 2.2rem; }
@media (max-width: 480px) { .modal-card .modal-body.modal-body-airy { padding: 1.2rem; } }
.form-grid.form-grid-airy { gap: 1.35rem 1.8rem; }
.modal-section-label {
  flex-direction: row; align-items: center; gap: .45rem;
  font-size: .72rem; font-weight: 800; text-transform: uppercase; letter-spacing: .07em;
  color: var(--purple-light); margin: .3rem 0 -.35rem; padding-top: .9rem; border-top: 1px solid var(--border);
}

/* Formulaires premium */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 640px) { .form-grid { grid-template-columns: 1fr; } }
.field { display: flex; flex-direction: column; gap: .35rem; }
.field label { font-size: .78rem; font-weight: 700; color: var(--ink); }
.field input, .field select, .field textarea {
  padding: .62rem .8rem; border: 1px solid var(--border); border-radius: 10px; font-size: .88rem; font-family: inherit;
  background: var(--bg-soft);
}
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--purple-light); background: #fff; }
.field.span-2 { grid-column: span 2; }
@media (max-width: 640px) { .field.span-2 { grid-column: span 1; } }
.field-error { color: var(--red); font-size: .76rem; }
.field-hint { font-size: .74rem; color: var(--ink-soft); }
.field input:disabled, .field select:disabled, .field input[readonly] { background: var(--border); color: var(--ink-soft); cursor: not-allowed; }
.outstanding-panel { display: flex; flex-wrap: wrap; align-items: center; gap: 1.2rem; background: var(--bg-soft); border: 1px solid var(--border); border-radius: 12px; padding: .8rem 1rem; }
.outstanding-panel .field-hint { display: block; }
.outstanding-panel strong { font-size: .95rem; }

/* Détail du calcul de pénalité de retard */
.penalty-detail { background: #fef2f2; border: 1px solid #fecaca; border-radius: 12px; padding: .9rem 1rem; }
.penalty-detail-title { font-weight: 700; font-size: .82rem; color: #991b1b; margin-bottom: .5rem; }
.penalty-detail-row { display: flex; justify-content: space-between; font-size: .82rem; padding: .2rem 0; color: var(--ink); }
.penalty-detail-row span:first-child { color: var(--ink-soft); }
.penalty-detail-formula { font-family: 'Courier New', monospace; font-size: .78rem; color: #991b1b; background: #fff; border-radius: 8px; padding: .5rem .7rem; margin: .5rem 0; }
.penalty-detail-total { display: flex; justify-content: space-between; align-items: center; font-size: .9rem; font-weight: 700; color: #991b1b; border-top: 1px dashed #fecaca; padding-top: .5rem; margin-top: .3rem; }
.penalty-detail-note { font-size: .76rem; color: #991b1b; margin: .6rem 0 0; line-height: 1.4; }

.alert-verification { display: flex; align-items: center; gap: .5rem; background: #fef2f2; border: 1px solid #fecaca; border-radius: 12px; padding: .8rem 1rem; font-size: .82rem; color: #991b1b; }

/* Menu contextuel "..." par ligne de tableau */
.row-menu-overlay { position: fixed; inset: 0; z-index: 60; background: transparent; }
.row-menu {
  position: absolute; top: calc(100% + .3rem); right: 0; z-index: 70; min-width: 180px;
  background: #fff; border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 12px 32px rgba(59,10,109,.16);
  display: flex; flex-direction: column; padding: .35rem; animation: fadeSlideUp .15s ease;
}
.row-menu-item {
  display: flex; align-items: center; gap: .6rem; padding: .55rem .7rem; border-radius: 8px; border: none;
  background: transparent; text-align: left; font-size: .85rem; font-weight: 600; color: var(--ink); cursor: pointer;
}
.row-menu-item:hover { background: var(--bg-soft); }
.row-menu-item.danger { color: var(--red, #dc2626); }
.row-menu-item.danger:hover { background: #fee2e2; }
.row-menu-confirm { padding: .6rem; font-size: .8rem; color: var(--ink); }
.row-menu-confirm span { display: block; margin-bottom: .5rem; font-weight: 600; }
.row-menu-confirm .btn-ghost, .row-menu-confirm .btn-primary { padding: .4rem .7rem; font-size: .78rem; flex: 1; }

/* Toasts */
.toast-stack { position: fixed; top: 1.2rem; right: 1.2rem; z-index: 200; display: flex; flex-direction: column; gap: .6rem; }
.toast { min-width: 280px; max-width: 360px; background: #fff; border-radius: 12px; padding: .9rem 1.1rem; box-shadow: 0 14px 40px rgba(0,0,0,.2); display: flex; gap: .7rem; align-items: flex-start; animation: fadeSlideUp .25s ease; border-left: 4px solid var(--purple-light); }
.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--red); }
.toast .toast-title { font-weight: 700; font-size: .86rem; }
.toast .toast-msg { font-size: .8rem; color: var(--ink-soft); margin-top: .1rem; }
.toast .toast-close { margin-left: auto; cursor: pointer; color: var(--ink-soft); background: none; border: none; font-size: 1rem; }

/* Tabs */
.tabs { display: flex; gap: .3rem; border-bottom: 1px solid var(--border); margin-bottom: 1.3rem; }
.tabs button { padding: .7rem 1.1rem; border: none; background: none; font-weight: 700; font-size: .86rem; color: var(--ink-soft); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs button.active { color: var(--purple); border-bottom-color: var(--purple-light); }

/* Rangée d'onglets avec un groupe détaché à droite (ex : Configuration, séparée des onglets
   d'usage courant) — les deux groupes .tabs restent alignés sur la même ligne, chacun avec sa
   propre soulignure. */
.tabs-row { display: flex; justify-content: space-between; align-items: flex-end; flex-wrap: wrap; gap: .4rem 1.4rem; }
.tabs-row .tabs { margin-bottom: 1.3rem; }
.tabs-row .tabs.tabs-detached { border-bottom-color: var(--border); }

/* ---------- Champ texte/nombre/date avec icône préfixe (module Opérations comptables et au-delà) :
   l'icône est positionnée en absolu, le champ récupère juste le padding-left nécessaire — le
   placeholder natif du navigateur se positionne alors automatiquement au bon endroit. ---------- */
.field-icon { position: relative; }
.field-icon .fi-icon {
  position: absolute; left: .8rem; top: 50%; transform: translateY(-50%);
  color: var(--ink-soft); pointer-events: none; display: flex;
}
/* Champ autonome : mêmes bordure/rayon/fond que ".field input" (ne dépend pas d'un ancêtre .field —
   utilisé aussi bien dans un formulaire que dans une cellule de tableau, ex : Débit/Crédit). */
.field-icon input, .field-icon select, .field-icon textarea {
  padding: .62rem .8rem .62rem 2.3rem; width: 100%; box-sizing: border-box;
  border: 1px solid var(--border); border-radius: 10px; font-size: .88rem; font-family: inherit;
  background: var(--bg-soft);
}
.field-icon input:focus, .field-icon select:focus, .field-icon textarea:focus {
  outline: none; border-color: var(--purple-light); background: #fff; box-shadow: 0 0 0 3px rgba(91,33,182,.1);
}

/* Barre de recherche de l'Historique (Opérations comptables) : jamais pleine largeur — cadrée à
   droite de la barre d'outils, forme pilule pour signaler une recherche intelligente à la volée. */
.hist-search { margin-left: auto; width: 100%; max-width: 380px; }
.hist-search input { border-radius: 999px; }
@media (max-width: 640px) { .hist-search { max-width: 100%; } }

/* Variante compacte pour les colonnes Débit/Crédit d'un tableau (ex : Opérations diverses) —
   icône teintée verte (entrée/débit) ou rouge (sortie/crédit) pour les distinguer d'un coup d'œil,
   quelle que soit la ligne (y compris les lignes ajoutées dynamiquement). Le sélecteur natif +/-
   du navigateur est masqué pour rester cohérent avec le style épuré des autres champs. */
.field-icon-amount input {
  font-variant-numeric: tabular-nums; font-weight: 600; min-width: 130px;
}
.field-icon-amount .fi-icon-debit { color: #16a34a; }
.field-icon-amount .fi-icon-credit { color: #dc2626; }
.field-icon-amount input::-webkit-outer-spin-button,
.field-icon-amount input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.field-icon-amount input[type=number] { -moz-appearance: textfield; }

/* ---------- Combobox à recherche intelligente (SearchableSelect.razor) : affiche 10 résultats par
   défaut, filtre en tapant, sans dépendance JS. ---------- */
.searchable-select { position: relative; }
.searchable-select .ss-icon {
  position: absolute; left: .8rem; top: 50%; transform: translateY(-50%);
  color: var(--ink-soft); pointer-events: none; display: flex; z-index: 1;
}
.searchable-select .ss-input {
  width: 100%; box-sizing: border-box; padding: .62rem .8rem .62rem 2.3rem;
  border: 1px solid var(--border); border-radius: 10px; font-size: .88rem; font-family: inherit;
  background: var(--bg-soft); cursor: text; transition: border-color .15s ease, background .15s ease;
}
.searchable-select .ss-input:focus { outline: none; border-color: var(--purple-light); background: #fff; box-shadow: 0 0 0 3px rgba(91,33,182,.1); }
.searchable-select .ss-selected-badge {
  position: absolute; right: .7rem; top: 50%; transform: translateY(-50%);
  color: #16a34a; display: flex; pointer-events: none;
}
.searchable-select .ss-dropdown {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 50;
  background: #fff; border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-md);
  max-height: 280px; overflow-y: auto; padding: .35rem; animation: fadeSlideUp .15s ease;
}
.searchable-select .ss-option { padding: .55rem .7rem; border-radius: 8px; font-size: .85rem; cursor: pointer; color: var(--ink); }
.searchable-select .ss-option:hover { background: var(--bg-soft); }
.searchable-select .ss-option.selected { background: color-mix(in srgb, var(--purple-light) 12%, white); font-weight: 700; color: var(--purple-light); }
.searchable-select .ss-empty, .searchable-select .ss-hint { padding: .6rem .7rem; font-size: .78rem; color: var(--ink-soft); }

/* ---------- Carte de statut d'équilibre (module Opérations comptables — Opérations diverses) :
   couleur, icône et animation changent dynamiquement selon l'état réel (équilibrée/déséquilibrée). ---------- */
.balance-status-card {
  display: flex; align-items: center; gap: .9rem; border-radius: 16px; padding: 1.1rem 1.3rem;
  border: 1px solid transparent; transition: background .3s ease, border-color .3s ease;
}
.balance-status-card .bsc-icon {
  display: flex; align-items: center; justify-content: center; width: 42px; height: 42px;
  border-radius: 50%; flex: 0 0 auto; color: #fff;
}
.balance-status-card .bsc-text { display: flex; flex-direction: column; gap: .15rem; }
.balance-status-card .bsc-title { font-weight: 800; font-size: .95rem; }
.balance-status-card .bsc-detail { font-size: .8rem; font-weight: 500; opacity: .85; }
.balance-status-card.ok {
  background: linear-gradient(135deg, #ecfdf5, #d1fae5); border-color: #6ee7b7; color: #065f46;
  animation: bscPulseGreen 2.4s ease-in-out infinite;
}
.balance-status-card.ok .bsc-icon { background: #10b981; }
.balance-status-card.warn {
  background: linear-gradient(135deg, #fef2f2, #fee2e2); border-color: #fca5a5; color: #991b1b;
  animation: bscShakeRed .5s ease;
}
.balance-status-card.warn .bsc-icon { background: #ef4444; animation: bscRingPulse 1.4s ease-in-out infinite; }
@keyframes bscPulseGreen {
  0%, 100% { box-shadow: 0 0 0 0 rgba(16,185,129,.35); }
  50% { box-shadow: 0 0 0 8px rgba(16,185,129,0); }
}
@keyframes bscRingPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.12); }
}
@keyframes bscShakeRed {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-4px); }
  40% { transform: translateX(4px); }
  60% { transform: translateX(-3px); }
  80% { transform: translateX(3px); }
}

/* Progress bar (calendrier d'amortissement) */
.progress-track { background: var(--bg-soft); border-radius: 999px; height: 8px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--purple-light), var(--red)); transition: width .4s ease; }

/* Member search autocomplete - premium */
.member-search { position: relative; }
.member-search .icon { position: absolute; left: .7rem; top: 50%; transform: translateY(-50%); z-index: 1; color: var(--ink-soft); pointer-events: none; }
.member-search input { width: 100%; padding: .65rem .8rem .65rem 2.2rem; border: 1px solid var(--border); border-radius: 10px; font-size: .88rem; font-family: inherit; background: var(--bg-soft); color: var(--ink); transition: border-color .15s, box-shadow .15s; }
.member-search input:focus { outline: none; border-color: var(--purple-light); box-shadow: 0 0 0 3px rgba(59,10,109,.08); background: #fff; }
.member-search input::placeholder { color: var(--ink-soft); opacity: .7; }
.member-suggestions { position: absolute; top: calc(100% + .3rem); left: 0; right: 0; background: #fff; border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 12px 32px rgba(59,10,109,.12); z-index: 50; max-height: 220px; overflow-y: auto; animation: fadeSlideUp .2s ease; }
.member-suggestion { padding: .55rem .8rem; cursor: pointer; font-size: .84rem; border-bottom: 1px solid var(--border); transition: background .12s; display: flex; align-items: center; gap: .6rem; color: var(--ink); }
.member-suggestion:last-child { border-bottom: none; }
.member-suggestion:hover { background: var(--bg-soft); }
.member-suggestion .suggestion-code { font-weight: 700; color: var(--purple-light); min-width: 55px; font-size: .78rem; }
.member-suggestion .suggestion-name { color: var(--ink); font-weight: 500; }

/* ---------- Scanner de reçu (pistolet code-barres) ---------- */
.scan-grid { display: grid; grid-template-columns: 1.55fr .95fr; gap: 1.2rem; align-items: start; }
@media (max-width: 980px) { .scan-grid { grid-template-columns: 1fr; } }

.scan-bar {
  display: flex; align-items: center; gap: .7rem; background: var(--bg-soft);
  border: 2px solid var(--border); border-radius: 14px; padding: .85rem 1.1rem; transition: border-color .15s, box-shadow .15s;
}
.scan-bar:focus-within { border-color: var(--purple-light); box-shadow: 0 0 0 4px rgba(91,33,182,.12); background: #fff; }
.scan-bar .icon { color: var(--purple-light); flex-shrink: 0; }
.scan-bar input { border: none; outline: none; flex: 1; font-size: 1rem; font-weight: 700; letter-spacing: .03em; font-family: inherit; background: transparent; color: var(--ink); }
.scan-bar input::placeholder { font-weight: 500; letter-spacing: normal; color: var(--ink-soft); opacity: .8; }
.scan-hint { display: flex; align-items: center; gap: .4rem; font-size: .76rem; color: var(--ink-soft); margin-top: .6rem; }

.scan-history { margin-top: 1.3rem; padding-top: 1.1rem; border-top: 1px solid var(--border); }
.scan-history .panel-title { font-family: 'Sora', sans-serif; font-weight: 700; font-size: .82rem; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-soft); margin: 0 0 .6rem; }
.scan-history-row { display: flex; align-items: center; gap: .6rem; padding: .55rem 0; border-bottom: 1px solid var(--border); cursor: pointer; transition: opacity .12s; }
.scan-history-row:last-child { border-bottom: none; }
.scan-history-row:hover { opacity: .7; }
.scan-history-row .dot { width: 8px; height: 8px; border-radius: 999px; flex-shrink: 0; background: var(--success); }
.scan-history-row.not-found .dot { background: var(--red); }
.scan-history-row .info { flex: 1; min-width: 0; }
.scan-history-row .info .code { font-weight: 700; font-size: .82rem; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.scan-history-row .info .meta { font-size: .72rem; color: var(--ink-soft); }

.receipt-kind-badge {
  display: inline-flex; align-items: center; gap: .4rem; padding: .35rem .8rem; border-radius: 999px;
  font-size: .78rem; font-weight: 800; letter-spacing: .02em;
  background: color-mix(in srgb, var(--kind-tint, var(--purple)) 14%, white); color: var(--kind-tint, var(--purple));
}
.receipt-total-bar {
  display: flex; align-items: baseline; justify-content: space-between; padding: 1rem 0;
  border-top: 2px solid var(--ink); border-bottom: 2px solid var(--ink); margin: 1.1rem 0;
}
.receipt-total-bar .label { font-size: .82rem; font-weight: 800; letter-spacing: .03em; color: var(--ink); }
.receipt-total-bar .value { font-size: 1.7rem; font-weight: 900; color: var(--ink); }

.receipt-lines { display: flex; flex-direction: column; }
.receipt-line-row { display: flex; justify-content: space-between; gap: 1rem; padding: .6rem 0; border-bottom: 1px solid var(--border); }
.receipt-line-row:last-child { border-bottom: none; }
.receipt-line-row .label { font-weight: 700; font-size: .88rem; color: var(--ink); }
.receipt-line-row .detail { font-size: .76rem; color: var(--ink-soft); margin-top: .1rem; }
.receipt-line-row .amount { font-weight: 700; font-size: .88rem; color: var(--ink); white-space: nowrap; }
.receipt-line-row.deduction .amount { color: var(--red); }

.receipt-member-card { display: flex; align-items: center; gap: .8rem; background: var(--bg-soft); border-radius: 14px; padding: .9rem 1rem; margin-top: 1.2rem; }
.receipt-member-card .who { flex: 1; min-width: 0; }
.receipt-member-card .name { font-weight: 800; font-size: .92rem; color: var(--ink); }
.receipt-member-card .code { font-size: .78rem; color: var(--ink-soft); }

.scan-not-found .icon { color: var(--red); }
.member-suggestion .suggestion-sep { color: var(--border); margin: 0 .3rem; }

/* ---------- Rôle Admin / Utilisateur (page "Membre Role") ---------- */
.badge.admin { background: linear-gradient(135deg, var(--purple-light), var(--purple)); color: #fff; }

.role-switch { position: relative; display: inline-flex; align-items: center; gap: .6rem; cursor: pointer; user-select: none; border: none; background: none; padding: 0; font-family: inherit; }
.role-switch .track {
  width: 44px; height: 24px; border-radius: 999px; background: var(--border); transition: background .22s ease;
  position: relative; flex-shrink: 0;
}
.role-switch .track .thumb {
  position: absolute; top: 2px; left: 2px; width: 20px; height: 20px; border-radius: 50%; background: #fff;
  box-shadow: 0 2px 6px rgba(0,0,0,.25); transition: transform .22s cubic-bezier(.4,0,.2,1);
}
.role-switch.on .track { background: linear-gradient(135deg, var(--purple-light), var(--purple)); }
.role-switch.on .track .thumb { transform: translateX(20px); }
.role-switch.disabled { opacity: .45; cursor: not-allowed; }
.role-switch .role-switch-label { font-size: .8rem; font-weight: 700; color: var(--ink-soft); transition: color .18s ease; }
.role-switch.on .role-switch-label { color: var(--purple); }
.role-switch:not(.disabled):hover .track { box-shadow: 0 0 0 4px rgba(91,33,182,.1); }

/* ---------- Lettre à en-tête premium (rapports Comptabilité : Journal, Grand Livre...) ----------
   Reproduit fidèlement l'en-tête historique VECOBU : logo en haut à gauche, coordonnées de
   l'organisation juste en-dessous (même colonne gauche), date d'impression en orange en haut à
   droite, fine ligne de séparation, titre centré en dessous. ---------- */
.letterhead { position: relative; text-align: left; padding: .3rem 1rem 1.1rem; }
.letterhead-logo { width: 104px; height: 104px; max-width: 104px; max-height: 104px; object-fit: contain; display: block; margin: 0 0 .5rem; }
.letterhead-org { font-weight: 800; font-size: .95rem; color: #17356b; }
.letterhead-address { font-size: .85rem; color: #17356b; font-weight: 600; margin-top: .1rem; }
.letterhead-printed { position: absolute; top: .3rem; right: 1rem; font-size: .82rem; color: #c2540c; font-weight: 700; }
.letterhead-divider { margin: 1.1rem 0 0; height: 1px; background: var(--border); }
.letterhead-title { margin: .9rem 0 0; font-size: 1.05rem; font-weight: 800; letter-spacing: .01em; color: var(--ink); text-align: center; }
.letterhead-sub { font-size: .75rem; color: var(--ink-soft); margin-top: .3rem; }

/* ---------- Barre d'actions des états financiers (Charger + Imprimer/PDF/Excel sur une même ligne) :
   utilisée par Journal, Grand Livre, Balance, Bilan, Compte de résultat, Annexe Bilan. ---------- */
.report-toolbar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .8rem; margin-top: 1.2rem; }
.report-toolbar .toolbar-actions { display: flex; gap: .6rem; flex-wrap: wrap; }
.report-toolbar .toolbar-actions .btn-ghost, .report-toolbar .toolbar-actions a.btn-ghost {
  display: inline-flex; align-items: center; gap: .45rem; text-decoration: none;
}

/* ---------- Feuille de rapport unique (en-tête + tableau réunis dans UNE seule carte,
   comme une vraie feuille imprimée) — utilisée par Journal, Grand Livre, Balance, Bilan... ---------- */
.doc-sheet { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow-sm); border: 1px solid var(--border); overflow: hidden; }
.doc-sheet .letterhead { padding: 1.7rem 1.9rem .3rem; }
.doc-sheet-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.doc-sheet-scroll .table-premium, .doc-sheet-scroll .table-ledger { border-radius: 0; }
.doc-sheet .empty-state { padding-bottom: 2.4rem; }
.doc-sheet-body { padding: 0 1.9rem 1.7rem; }
.doc-sheet-body + .doc-sheet-body { padding-top: 0; }

/* ---------- Grille des notes de l'Annexe Bilan : toujours 2 cartes par ligne (jamais plus, jamais
   moins — nombre de cartes 100% dynamique selon les notes réellement mouvementées), chaque carte
   assez large pour montrer ses colonnes sans barre de défilement horizontale. ---------- */
.annexe-notes-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1.2rem; }
.annexe-note-card { overflow-x: visible; }
.annexe-note-card .table-ledger { min-width: 0; width: 100%; table-layout: fixed; }
.annexe-note-card .table-ledger td, .annexe-note-card .table-ledger th { overflow-wrap: break-word; white-space: normal; }
.annexe-note-card .table-ledger th:nth-child(1), .annexe-note-card .table-ledger td:nth-child(1) { width: 15%; }
.annexe-note-card .table-ledger th:nth-child(2), .annexe-note-card .table-ledger td:nth-child(2) { width: 40%; }
.annexe-note-card .table-ledger th:nth-child(3), .annexe-note-card .table-ledger td:nth-child(3),
.annexe-note-card .table-ledger th:nth-child(4), .annexe-note-card .table-ledger td:nth-child(4) { width: 22.5%; }
@media (max-width: 900px) {
  .annexe-notes-grid { grid-template-columns: 1fr; }
}

/* Impression : n'imprimer que la lettre à en-tête + le tableau, jamais le chrome de l'application */
@media print {
  .app-sidebar, .app-topbar, .no-print, .sidebar-backdrop { display: none !important; }
  .app-main, .app-content { margin: 0 !important; padding: 0 !important; width: 100% !important; }
  body, .app-shell { background: #fff !important; }
  .table-wrap { box-shadow: none !important; border: none !important; border-radius: 0 !important; }
  .table-wrap-ultra { box-shadow: none !important; }
  .doc-sheet { box-shadow: none !important; border: none !important; border-radius: 0 !important; }
}