/* ==========================================================================
   TTGYM — Design System (Fluent UI)
   Tokens : couleurs, typographie, espacement, rayons, ombres
   Ordre prioritaire : cohérence > utilisabilité > accessibilité > réutilisation
   ========================================================================== */

/* ------------------------------- Polices locales (100% offline) ---------- */
@font-face {
  font-family: "Noto Sans Arabic";
  src: url("../fonts/NotoSansArabic-400.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Noto Sans Arabic";
  src: url("../fonts/NotoSansArabic-500.woff2") format("woff2");
  font-weight: 500; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Noto Sans Arabic";
  src: url("../fonts/NotoSansArabic-600.woff2") format("woff2");
  font-weight: 600; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Noto Sans Arabic";
  src: url("../fonts/NotoSansArabic-700.woff2") format("woff2");
  font-weight: 700; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Noto Sans";
  src: url("../fonts/NotoSans-400.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Noto Sans";
  src: url("../fonts/NotoSans-500.woff2") format("woff2");
  font-weight: 500; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Noto Sans";
  src: url("../fonts/NotoSans-600.woff2") format("woff2");
  font-weight: 600; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Noto Sans";
  src: url("../fonts/NotoSans-700.woff2") format("woff2");
  font-weight: 700; font-style: normal; font-display: swap;
}

/* --------------------------------- Tokens (Light) ------------------------ */
:root, html[data-theme="light"] {
  --brand:        #0F6CBD;
  --brand-hover:  #115EA3;
  --brand-pressed:#0C3B5E;
  --brand-light:  #2899F5;
  --brand-bg:     #EBF3FC;

  --bg:           #F5F4F3;
  --surface:      #FFFFFF;
  --surface-2:    #FAFAFA;
  --text:         #242424;
  --text-2:       #616161;
  --text-3:       #979797;
  --border:       #D1D1D1;
  --stroke:       #E6E6E6;

  --success:      #0E700E; --success-bg: #EFF8EF;
  --warning:      #BC4B09; --warning-bg: #FFF9F3;
  --danger:       #C50F1F; --danger-bg:  #FDF3F4;
  --info:         #0F6CBD; --info-bg:    #EBF3FC;

  --r-sm: 4px; --r-md: 6px; --r-lg: 8px; --r-full: 999px;
  --sh-2: 0 1px 2px rgba(0,0,0,.12);
  --sh-4: 0 2px 4px rgba(0,0,0,.14), 0 0 2px rgba(0,0,0,.08);
  --sh-8: 0 4px 8px rgba(0,0,0,.14);
  --sh-16:0 8px 16px rgba(0,0,0,.14);
  --sp-1: .25rem; --sp-2: .5rem; --sp-3: .75rem; --sp-4: 1rem;
  --sp-5: 1.25rem; --sp-6: 1.5rem; --sp-8: 2rem;
  --font: "Noto Sans Arabic", "Noto Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --sb-w: 264px; --sb-w-collapsed: 68px; --topbar-h: 56px;
}

/* --------------------------------- Tokens (Dark) ------------------------- */
html[data-theme="dark"] {
  --brand:        #479EF5;
  --brand-hover:  #62ABF5;
  --brand-pressed:#2B88D8;
  --brand-light:  #479EF5;
  --brand-bg:     #12314F;

  --bg:           #141414;
  --surface:      #1F1F1F;
  --surface-2:    #292929;
  --text:         #F3F3F3;
  --text-2:       #ADADAD;
  --text-3:       #828282;
  --border:       #4A4A4A;
  --stroke:       #3D3D3D;

  --success:      #6CCB5F; --success-bg: #102810;
  --warning:      #F5A623; --warning-bg: #33210A;
  --danger:       #F1707B; --danger-bg:  #3B1214;
  --info:         #6CB8F6; --info-bg:    #0F2A43;

  --sh-2: 0 1px 2px rgba(0,0,0,.5);
  --sh-4: 0 2px 4px rgba(0,0,0,.5);
  --sh-8: 0 4px 8px rgba(0,0,0,.5);
  --sh-16:0 8px 16px rgba(0,0,0,.5);
}

/* --------------------------------- Base ---------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: .875rem;
  line-height: 1.55;
}
h1,h2,h3,h4 { margin: 0 0 var(--sp-3); font-weight: 600; line-height: 1.3; }
h1 { font-size: 1.5rem; } h2 { font-size: 1.25rem; } h3 { font-size: 1.063rem; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 2px; }
::placeholder { color: var(--text-3); opacity: 1; }

.ic { width: 20px; height: 20px; flex: none; fill: currentColor; vertical-align: -4px; }
.ic-sm { width: 16px; height: 16px; vertical-align: -3px; }
.ic-lg { width: 28px; height: 28px; }

/* --------------------------------- Shell --------------------------------- */
.shell { min-height: 100vh; }
.sidebar {
  position: fixed; inset-block: 0; inset-inline-start: 0;
  width: var(--sb-w);
  background: var(--surface);
  border-inline-end: 1px solid var(--stroke);
  display: flex; flex-direction: column;
  z-index: 60; transition: width .18s ease, inset-inline-start .18s ease;
}
.brand {
  display: flex; align-items: center; gap: 10px;
  height: var(--topbar-h); padding: 0 var(--sp-4);
  border-bottom: 1px solid var(--stroke); flex: none;
}
.brand-logo {
  width: 34px; height: 34px; border-radius: var(--r-md);
  background: var(--brand); color: #fff; display: grid; place-items: center;
  font-weight: 700; font-size: .95rem; flex: none;
}
.brand-name { font-weight: 700; font-size: 1.05rem; white-space: nowrap; }
.brand-sub { font-size: .68rem; color: var(--text-2); white-space: nowrap; }

.nav { flex: 1; overflow-y: auto; padding: var(--sp-3) var(--sp-2) var(--sp-6); }
.nav-sec {
  font-size: .68rem; text-transform: uppercase; letter-spacing: .06em;
  color: var(--text-3); margin: var(--sp-4) var(--sp-2) var(--sp-1); white-space: nowrap;
}
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; min-height: 44px;
  border-radius: var(--r-md); color: var(--text);
  white-space: nowrap; margin-bottom: 2px;
}
.nav-item:hover { background: var(--surface-2); text-decoration: none; }
html[data-theme="dark"] .nav-item:hover { background: var(--surface-2); }
.nav-item.active { background: var(--brand-bg); color: var(--brand); font-weight: 600; }
.sidebar-collapsed .sidebar { width: var(--sb-w-collapsed); }
.sidebar-collapsed .nav-item span, .sidebar-collapsed .brand-name, .sidebar-collapsed .brand-sub,
.sidebar-collapsed .nav-sec { display: none; }
.sidebar-collapsed .nav-item { justify-content: center; }

.sb-foot { padding: var(--sp-2); border-top: 1px solid var(--stroke); }

.main { margin-inline-start: var(--sb-w); min-height: 100vh; display: flex; flex-direction: column; }
.sidebar-collapsed .main { margin-inline-start: var(--sb-w-collapsed); }

.topbar {
  position: sticky; top: 0; z-index: 40;
  height: var(--topbar-h);
  display: flex; align-items: center; gap: var(--sp-3);
  padding: 0 var(--sp-5);
  background: var(--surface); border-bottom: 1px solid var(--stroke);
}
.topbar-title { font-weight: 600; font-size: 1.02rem; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar-actions { display: flex; align-items: center; gap: var(--sp-2); }
.user-chip { display: flex; align-items: center; gap: 8px; padding: 4px 10px; border-radius: var(--r-full); border: 1px solid var(--stroke); background: var(--surface); }
.user-chip b { font-size: .8rem; font-weight: 600; }
.user-chip small { color: var(--text-2); font-size: .68rem; display: block; }

.content { padding: var(--sp-5); flex: 1; max-width: 1400px; width: 100%; margin: 0 auto; }

.drawer-backdrop { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 55; }

/* --------------------------------- Boutons -------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 var(--sp-4);
  border-radius: var(--r-md); border: 1px solid transparent;
  font: inherit; font-size: .875rem; font-weight: 600;
  background: var(--surface); color: var(--text);
  border-color: var(--border); cursor: pointer;
  text-decoration: none !important;
  transition: background .12s ease;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-hover); }
.btn.primary:active { background: var(--brand-pressed); }
.btn.subtle { background: transparent; border-color: transparent; color: var(--brand); }
.btn.subtle:hover { background: var(--brand-bg); }
.btn.danger { color: var(--danger); }
.btn.danger:hover { background: var(--danger-bg); }
.btn.danger-solid { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.sm { min-height: 34px; padding: 0 10px; font-size: .78rem; border-radius: var(--r-sm); }
.btn.block { width: 100%; }
.btn:disabled, .btn[disabled] { opacity: .45; cursor: not-allowed; pointer-events: none; }
.icon-btn {
  display: inline-grid; place-items: center; width: 40px; height: 40px;
  border-radius: var(--r-md); border: none; background: transparent; color: var(--text);
  cursor: pointer; text-decoration: none !important;
}
.icon-btn:hover { background: var(--surface-2); }
.lang-switch { display: inline-flex; border: 1px solid var(--border); border-radius: var(--r-md); overflow: hidden; }
.lang-switch a { padding: 6px 10px; font-size: .78rem; color: var(--text-2); min-height: 0; }
.lang-switch a.on { background: var(--brand-bg); color: var(--brand); font-weight: 600; }

/* --------------------------------- Cartes --------------------------------- */
.card { background: var(--surface); border: 1px solid var(--stroke); border-radius: var(--r-lg); box-shadow: var(--sh-2); margin-bottom: var(--sp-5); }
.card-head { display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-4) var(--sp-5); border-bottom: 1px solid var(--stroke); flex-wrap: wrap; }
.card-head h2, .card-head h3 { margin: 0; flex: 1; min-width: 0; }
.card-body { padding: var(--sp-5); }
.card-body.tight { padding: var(--sp-3) var(--sp-5); }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(215px, 1fr)); gap: var(--sp-4); margin-bottom: var(--sp-5); }
.stat { background: var(--surface); border: 1px solid var(--stroke); border-radius: var(--r-lg); padding: var(--sp-4); display: flex; align-items: center; gap: var(--sp-3); box-shadow: var(--sh-2); }
.stat-icon { width: 44px; height: 44px; border-radius: var(--r-lg); display: grid; place-items: center; background: var(--brand-bg); color: var(--brand); flex: none; }
.stat-icon.green { background: var(--success-bg); color: var(--success); }
.stat-icon.red { background: var(--danger-bg); color: var(--danger); }
.stat-icon.amber { background: var(--warning-bg); color: var(--warning); }
.stat-val { font-size: 1.35rem; font-weight: 700; line-height: 1.2; }
.stat-lbl { color: var(--text-2); font-size: .78rem; }
.stat-link { font-size: .72rem; }

.shortcut-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: var(--sp-3); }
.shortcut {
  display: flex; flex-direction: column; align-items: flex-start; gap: var(--sp-2);
  background: var(--surface); border: 1px solid var(--stroke); border-radius: var(--r-lg);
  padding: var(--sp-4); text-decoration: none !important; color: var(--text);
}
.shortcut:hover { border-color: var(--brand); box-shadow: var(--sh-4); }
.shortcut .ic { color: var(--brand); width: 24px; height: 24px; }
.shortcut b { font-size: .84rem; }

/* --------------------------------- Formulaires ---------------------------- */
.field { margin-bottom: var(--sp-4); }
.field > label { display: block; font-size: .8rem; font-weight: 600; margin-bottom: 6px; }
.field .hint { font-size: .72rem; color: var(--text-2); margin-top: 4px; }
.req::after { content: " *"; color: var(--danger); }
.input, .select, .textarea {
  width: 100%; min-height: 44px; padding: 10px 12px;
  font: inherit; font-size: 1rem; /* >= 16px anti-zoom mobile */
  color: var(--text); background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--r-md);
}
.textarea { min-height: 88px; resize: vertical; }
.input:focus, .select:focus, .textarea:focus {
  outline: none; border-color: var(--brand); border-bottom-width: 2px; padding-bottom: 9px;
}
.input:disabled, .select:disabled { background: var(--surface-2); color: var(--text-3); cursor: not-allowed; }
.input[aria-invalid="true"], .input.error { border-color: var(--danger); }
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0 var(--sp-5); }
.form-grid .span2 { grid-column: 1 / -1; }
.input-wrap { position: relative; }
.input-wrap .input { padding-inline-end: 44px; }
.eye-btn {
  position: absolute; inset-inline-end: 4px; top: 50%; transform: translateY(-50%);
  width: 36px; height: 36px; border: none; background: transparent; color: var(--text-2);
  border-radius: var(--r-sm); cursor: pointer; display: grid; place-items: center;
}
.eye-btn:hover { background: var(--surface-2); color: var(--text); }
.field-error { color: var(--danger); font-size: .74rem; margin-top: 4px; }
.checkbox-row { display: flex; align-items: center; gap: 10px; min-height: 44px; }
.checkbox-row input[type="checkbox"] { width: 20px; height: 20px; accent-color: var(--brand); }
.searchbar { display: flex; gap: var(--sp-2); flex-wrap: wrap; align-items: center; }
.searchbar .input { max-width: 320px; }
.filters { display: flex; gap: var(--sp-2); flex-wrap: wrap; align-items: center; }
.filters .select { min-height: 40px; width: auto; max-width: 200px; font-size: .84rem; }

/* --------------------------------- Tableaux ------------------------------- */
.tbl-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: 0 0 var(--r-lg) var(--r-lg); }
.tbl { width: 100%; border-collapse: collapse; min-width: 640px; }
.tbl th, .tbl td { padding: 11px 14px; text-align: start; border-bottom: 1px solid var(--stroke); vertical-align: middle; }
.tbl th { font-size: .74rem; text-transform: uppercase; letter-spacing: .04em; color: var(--text-2); background: var(--surface-2); white-space: nowrap; position: sticky; top: 0; }
.tbl tbody tr:hover { background: var(--surface-2); }
.tbl .num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.tbl .actions { display: flex; gap: 4px; justify-content: flex-end; }
.avatar { width: 38px; height: 38px; border-radius: 50%; object-fit: cover; background: var(--surface-2); border: 1px solid var(--stroke); }
.avatar-lg { width: 84px; height: 84px; }
.cell-member { display: flex; align-items: center; gap: 10px; min-width: 190px; }
.cell-member b { font-weight: 600; }
.cell-member small { color: var(--text-2); display: block; font-size: .72rem; }

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: var(--r-full);
  font-size: .72rem; font-weight: 600; white-space: nowrap;
  background: var(--surface-2); color: var(--text-2); border: 1px solid var(--stroke);
}
.badge.green { background: var(--success-bg); color: var(--success); border-color: transparent; }
.badge.red { background: var(--danger-bg); color: var(--danger); border-color: transparent; }
.badge.amber { background: var(--warning-bg); color: var(--warning); border-color: transparent; }
.badge.blue { background: var(--info-bg); color: var(--info); border-color: transparent; }

.pager { display: flex; gap: 6px; align-items: center; padding: var(--sp-4) var(--sp-5); flex-wrap: wrap; }
.pager a, .pager span.cur { min-width: 36px; height: 36px; display: inline-grid; place-items: center; border-radius: var(--r-sm); border: 1px solid var(--border); font-size: .8rem; }
.pager a:hover { background: var(--surface-2); }
.pager span.cur { background: var(--brand); border-color: var(--brand); color: #fff; }
.pager .info { color: var(--text-2); font-size: .78rem; margin-inline-end: auto; }

/* --------------------------------- États ---------------------------------- */
.empty { text-align: center; padding: var(--sp-8) var(--sp-4); color: var(--text-2); }
.empty .ic { width: 44px; height: 44px; color: var(--text-3); }
.empty b { display: block; color: var(--text); margin: var(--sp-3) 0 4px; }
.alert { display: flex; gap: 10px; align-items: flex-start; padding: var(--sp-3) var(--sp-4); border-radius: var(--r-md); margin-bottom: var(--sp-4); font-size: .84rem; border: 1px solid transparent; }
.alert .ic { margin-top: 1px; }
.alert.info { background: var(--info-bg); color: var(--info); }
.alert.success { background: var(--success-bg); color: var(--success); }
.alert.warning { background: var(--warning-bg); color: var(--warning); }
.alert.danger { background: var(--danger-bg); color: var(--danger); }
.alert ul { margin: 4px 0 0; padding-inline-start: 18px; }

.spinner { width: 22px; height: 22px; border: 3px solid var(--stroke); border-top-color: var(--brand); border-radius: 50%; animation: spin .8s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading-block { display: flex; align-items: center; gap: 10px; color: var(--text-2); padding: var(--sp-5); justify-content: center; }

/* --------------------------------- Modales -------------------------------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 90;
  display: none; align-items: center; justify-content: center; padding: var(--sp-4);
}
.modal-backdrop.open { display: flex; }
.modal { background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--sh-16); width: 100%; max-width: 520px; max-height: 90vh; overflow: auto; }
.modal-head { display: flex; align-items: center; padding: var(--sp-4) var(--sp-5); border-bottom: 1px solid var(--stroke); }
.modal-head h3 { margin: 0; flex: 1; }
.modal-body { padding: var(--sp-5); }
.modal-foot { display: flex; gap: var(--sp-2); justify-content: flex-end; padding: var(--sp-3) var(--sp-5) var(--sp-5); }

/* --------------------------------- Toasts --------------------------------- */
.toasts { position: fixed; inset-block-end: 20px; inset-inline-end: 20px; z-index: 120; display: flex; flex-direction: column; gap: 10px; max-width: 92vw; }
.toast {
  display: flex; align-items: center; gap: 10px; min-width: 240px; max-width: 420px;
  background: var(--surface); border: 1px solid var(--stroke); border-inline-start: 4px solid var(--info);
  border-radius: var(--r-md); box-shadow: var(--sh-8); padding: 12px 14px; font-size: .84rem;
  animation: toast-in .25s ease;
}
.toast.success { border-inline-start-color: var(--success); }
.toast.success .ic { color: var(--success); }
.toast.warning { border-inline-start-color: var(--warning); }
.toast.warning .ic { color: var(--warning); }
.toast.error { border-inline-start-color: var(--danger); }
.toast.error .ic { color: var(--danger); }
.toast.info .ic { color: var(--info); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* --------------------------------- Divers --------------------------------- */
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-5); }
.kv { display: grid; grid-template-columns: 160px 1fr; gap: 6px var(--sp-4); font-size: .84rem; }
.kv dt { color: var(--text-2); }
.kv dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }
.divider { border: 0; border-top: 1px solid var(--stroke); margin: var(--sp-5) 0; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--stroke); overflow-x: auto; }
.tab { padding: 10px 16px; color: var(--text-2); border-bottom: 2px solid transparent; white-space: nowrap; font-weight: 600; font-size: .84rem; }
.tab:hover { color: var(--text); text-decoration: none; }
.tab.active { color: var(--brand); border-bottom-color: var(--brand); }
.chip { display: inline-flex; align-items: center; gap: 6px; background: var(--surface-2); border: 1px solid var(--stroke); border-radius: var(--r-full); padding: 4px 12px; font-size: .78rem; }
.mono { font-variant-numeric: tabular-nums; font-family: ui-monospace, monospace; font-size: .82rem; }
.money { font-variant-numeric: tabular-nums; white-space: nowrap; }
.page-head { display: flex; align-items: center; gap: var(--sp-3); margin-bottom: var(--sp-5); flex-wrap: wrap; }
.page-head h1 { margin: 0; flex: 1; min-width: 0; }
.section-title { font-size: .95rem; font-weight: 600; margin: var(--sp-5) 0 var(--sp-3); }
.qr-note { color: var(--text-3); font-size: .74rem; }

/* --------------------------------- Login ---------------------------------- */
.login-wrap { display: flex; min-height: 100vh; }
.login-left { flex: 1 1 50%; display: flex; flex-direction: column; background: var(--surface); padding: var(--sp-5); }
.login-right {
  flex: 1 1 50%; display: flex; flex-direction: column; justify-content: center; align-items: center;
  background: linear-gradient(160deg, var(--brand) 0%, var(--brand-pressed) 100%);
  color: #fff; padding: var(--sp-8) var(--sp-6); text-align: center;
  position: relative; overflow: hidden;
  transition: flex 0s;
}
.login-right h2 { color: #fff; font-size: 1.8rem; margin-bottom: var(--sp-3); }
.login-right p { max-width: 420px; opacity: .92; font-size: .92rem; }
.login-topbar { display: flex; justify-content: flex-end; margin-bottom: var(--sp-6); }
.login-card { width: 100%; max-width: 420px; margin: auto; }
.login-logo { display: flex; flex-direction: column; align-items: center; gap: 10px; margin-bottom: var(--sp-6); text-align: center; }
.login-logo .brand-logo { width: 56px; height: 56px; font-size: 1.3rem; border-radius: 14px; }
.login-logo h1 { margin: 0; font-size: 1.4rem; }
.login-logo small { color: var(--text-2); }
.login-card .field { margin-bottom: var(--sp-4); }
.login-support { display: flex; justify-content: center; gap: 12px; margin-top: var(--sp-6); }
.support-ico {
  width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center;
  border: 1px solid var(--border); color: var(--text-2); background: var(--surface);
  transition: all .15s ease;
}
.support-ico:hover { color: #fff; background: var(--brand); border-color: var(--brand); transform: translateY(-2px); }
.login-right .support-ico { border-color: rgba(255,255,255,.4); color: rgba(255,255,255,.85); background: transparent; }
.reg-cta { margin-top: var(--sp-6); display: flex; flex-direction: column; align-items: center; gap: 10px; }
.btn-white { background: #fff; color: var(--brand-pressed); border-color: #fff; font-weight: 700; }
.btn-white:hover { background: #EAF2FB; }

/* Expansion du panneau bleu -> inscription plein écran */
@media (min-width: 901px) {
  .login-wrap.reg-open .login-right { flex: 1 1 100%; position: absolute; inset: 0; z-index: 5; transition: flex-basis .45s cubic-bezier(.4,0,.2,1); }
}
.login-wrap.reg-open .login-left { visibility: hidden; }
.reg-center { display: none; }
.login-wrap.reg-open .reg-intro { display: none; }
.login-wrap.reg-open .reg-center { display: block; width: 100%; max-width: 560px; margin: auto; }
.reg-card { background: var(--surface); color: var(--text); border-radius: var(--r-lg); padding: var(--sp-6); box-shadow: var(--sh-16); text-align: start; }
.login-back { position: absolute; top: 16px; inset-inline-start: 16px; }

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* --------------------------------- Impression ----------------------------- */
.print-area { display: none; }
@media print {
  .sidebar, .topbar, .toasts, .no-print, .modal-backdrop, .pager { display: none !important; }
  .main { margin: 0 !important; }
  body { background: #fff; }
  .content { padding: 0; max-width: none; }
  .print-area { display: block !important; }
  .card { box-shadow: none; border: none; }
  .tbl th { background: #eee !important; color: #000; }
}
/* Reçu de paiement A5-ish */
.receipt { width: 100%; max-width: 720px; margin: 0 auto; background: #fff; color: #111; padding: 24px; border: 1px solid #ccc; border-radius: 8px; font-size: .92rem; }
.receipt-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; border-bottom: 2px solid #222; padding-bottom: 12px; margin-bottom: 14px; }
.receipt-head img.org-logo { max-height: 52px; }
.receipt h2 { margin: 0; }
.receipt table { width: 100%; border-collapse: collapse; margin: 10px 0; }
.receipt th, .receipt td { border-bottom: 1px solid #ddd; padding: 8px 6px; text-align: start; }
.receipt .total { font-weight: 700; font-size: 1.05rem; }
.receipt-foot { display: flex; justify-content: space-between; align-items: flex-end; margin-top: 18px; font-size: .8rem; color: #444; }

/* Carte adhérent CR80 85.6 x 54 mm */
.idcard {
  width: 85.6mm; height: 54mm; border-radius: 4mm; position: relative;
  background: #fff; color: #111; border: 1px solid #bbb; overflow: hidden;
  display: flex; flex-direction: column; font-size: 9.5pt;
}
.idcard-band { background: var(--brand); color: #fff; padding: 2.2mm 4mm; display: flex; align-items: center; gap: 3mm; }
.idcard-band .org-name { font-weight: 700; font-size: 11pt; }
.idcard-band img { height: 8mm; }
.idcard-body { display: flex; gap: 4mm; padding: 3mm 4mm; flex: 1; }
.idcard-photo { width: 20mm; height: 25mm; object-fit: cover; border-radius: 2mm; border: 1px solid #ccc; background: #f4f4f4; flex: none; }
.idcard-fields { flex: 1; }
.idcard-fields .row { display: flex; gap: 2mm; }
.idcard-fields .lbl { color: #555; font-size: 7.5pt; }
.idcard-fields .val { font-weight: 600; font-size: 9.5pt; margin-bottom: 1mm; }
.idcard-bar { position: absolute; bottom: 1.5mm; inset-inline: 4mm; display: flex; align-items: center; justify-content: space-between; gap: 2mm; }
.idcard-bar svg { height: 9mm; }
.idcard-num { font-size: 7pt; color: #333; text-align: center; }

/* --------------------------------- Responsive / Mobile-first --------------- */
@media (max-width: 900px) {
  .sidebar {
    transform: translateX(-110%);
    width: min(84vw, 320px) !important;
    box-shadow: var(--sh-16);
  }
  html[dir="rtl"] .sidebar { transform: translateX(110%); }
  .drawer-open .sidebar { transform: translateX(0) !important; }
  .drawer-open .drawer-backdrop { display: block; }
  .main { margin-inline-start: 0 !important; }
  .content { padding: var(--sp-3); }
  .sidebar-collapsed .nav-item span, .sidebar-collapsed .brand-name,
  .sidebar-collapsed .brand-sub, .sidebar-collapsed .nav-sec { display: block; }
  .sidebar-collapsed .sidebar { width: min(84vw, 320px) !important; }
  .menu-btn { display: inline-grid !important; }

  /* Tables -> cartes verticales */
  .tbl { min-width: 0; border: 0; }
  .tbl thead { display: none; }
  .tbl tr { display: block; border: 1px solid var(--stroke); border-radius: var(--r-md); margin: 0 0 10px; background: var(--surface); }
  .tbl td { display: flex; justify-content: space-between; align-items: center; gap: 12px; border: 0; border-bottom: 1px solid var(--stroke); padding: 9px 12px; }
  .tbl td:last-child { border-bottom: 0; }
  .tbl td::before {
    content: attr(data-l);
    color: var(--text-2); font-size: .72rem; font-weight: 600; text-transform: uppercase;
  }
  .tbl td.actions { justify-content: flex-end; }
  .form-grid { grid-template-columns: 1fr; }
  .grid2 { grid-template-columns: 1fr; }
  .kv { grid-template-columns: 1fr; }
  .kv dt { margin-top: 8px; }
  .searchbar .input { max-width: none; width: 100%; }
  .login-wrap { flex-direction: column; }
  .login-right { min-height: 260px; order: -1; }
  .stat-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
}
.menu-btn { display: none; }

@media (max-width: 640px) {
  .user-chip small { display: none; }
  .topbar { padding: 0 var(--sp-3); }
  h1 { font-size: 1.25rem; }
  .card-body { padding: var(--sp-4); }
}
