/* ============================================================
   SYNAGOGUE MANAGER — main.css  v2
   ============================================================ */

/* ── Variables ─────────────────────────────────────────────── */
:root {
  --c-deep:    #0f1f3d;
  --c-mid:     #1a3566;
  --c-accent:  #c8a84b;
  --c-accent2: #e8c96e;
  --c-light:   #f5f3ee;
  --c-white:   #ffffff;
  --c-border:  #ddd8cc;
  --c-text:    #1e2a3a;
  --c-muted:   #6b7280;
  --c-success: #16a34a;
  --c-danger:  #dc2626;
  --c-warn:    #d97706;
  --c-info:    #2563eb;
  --radius:    8px;
  --radius-lg: 14px;
  --shadow:    0 2px 12px rgba(15,31,61,.10);
  --shadow-lg: 0 8px 32px rgba(15,31,61,.18);
  --font-main: 'Segoe UI', system-ui, -apple-system, sans-serif;
  --font-heb:  'Frank Ruhl Libre', 'David', serif;
  --sidebar-w: 240px;
  --header-h:  60px;
  --transition: .2s ease;
}

/* ── Reset ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body { font-family: var(--font-main); background: var(--c-light); color: var(--c-text); font-size: 15px; line-height: 1.6; }
a { color: var(--c-mid); text-decoration: none; }
a:hover { color: var(--c-accent); }
img { max-width: 100%; }

/* ── RTL (hébreu) ───────────────────────────────────────────── */
body.rtl { direction: rtl; }
body.rtl * { font-family: var(--font-heb), var(--font-main); }

/* ══════════════════════════════════════════════════════════════
   LAYOUT
══════════════════════════════════════════════════════════════ */
.app-wrapper { display: flex; min-height: 100vh; }

/* ── Sidebar ─────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--c-deep);
  color: #c5cfe0;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 300;
  overflow-y: auto;
  transition: transform .25s ease;
  will-change: transform;
}
body.rtl .sidebar { left: auto; right: 0; }

.sidebar-brand { padding: 22px 20px 16px; border-bottom: 1px solid rgba(255,255,255,.08); }
.sidebar-brand .brand-name { font-size: 1.05rem; font-weight: 700; color: var(--c-accent); }
.sidebar-brand .syna-name  { font-size: .78rem; color: rgba(197,207,224,.6); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.sidebar-nav { flex: 1; padding: 12px 0; }
.nav-section-title { font-size: .68rem; text-transform: uppercase; letter-spacing: 1px; color: rgba(197,207,224,.4); padding: 10px 20px 4px; }

/* Section paramètres rétractable */
.nav-section-toggle {
  display: flex; align-items: center; justify-content: space-between;
  cursor: pointer; user-select: none;
  font-size: .68rem; text-transform: uppercase; letter-spacing: 1px;
  color: rgba(197,207,224,.4); padding: 10px 20px 4px;
  transition: color var(--transition);
}
.nav-section-toggle:hover { color: rgba(197,207,224,.65); }
.nav-settings-arrow {
  font-size: .7rem; font-weight: 700;
  background: rgba(200,168,75,.18);
  color: var(--c-accent);
  border-radius: 20px;
  padding: 2px 8px;
  letter-spacing: 0;
  transition: background var(--transition), color var(--transition);
}
.nav-section-toggle:hover .nav-settings-arrow {
  background: rgba(200,168,75,.32);
}
.nav-settings-items { }

.sidebar-nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 20px; color: #c5cfe0; font-size: .9rem;
  transition: background var(--transition), color var(--transition);
  position: relative;
}
.sidebar-nav a .nav-icon { font-size: 1rem; width: 20px; text-align: center; }
.sidebar-nav a:hover, .sidebar-nav a.active { background: rgba(200,168,75,.12); color: var(--c-accent); }
.sidebar-nav a:focus-visible {
  outline: 2px solid var(--c-accent);
  outline-offset: -2px;
  border-radius: 4px;
}
.sidebar-nav a.active::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0;
  width: 3px; background: var(--c-accent); border-radius: 0 2px 2px 0;
}
body.rtl .sidebar-nav a.active::before { left: auto; right: 0; border-radius: 2px 0 0 2px; }

.sidebar-footer { padding: 14px 20px; border-top: 1px solid rgba(255,255,255,.08); font-size: .82rem; color: rgba(197,207,224,.5); }

/* ── Overlay mobile ──────────────────────────────────────────── */
.sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 299;
  cursor: pointer;
}
.sidebar-overlay.is-open { display: block; }

/* ── Header ──────────────────────────────────────────────────── */
.app-header {
  position: fixed; top: 0;
  left: var(--sidebar-w); right: 0;
  height: var(--header-h);
  background: var(--c-white);
  border-bottom: 1px solid var(--c-border);
  display: flex; align-items: center;
  padding: 0 24px; gap: 16px;
  z-index: 200;
  box-shadow: var(--shadow);
}
body.rtl .app-header { left: 0; right: var(--sidebar-w); }

.header-title  { font-size: 1.05rem; font-weight: 600; color: var(--c-deep); flex: 1; }
.header-actions { display: flex; align-items: center; gap: 10px; }

.btn-hamburger {
  display: none;
  background: none; border: none;
  font-size: 1.5rem; line-height: 1;
  cursor: pointer; color: var(--c-deep);
  padding: 6px 10px; margin-right: 4px;
  border-radius: var(--radius);
  transition: background var(--transition);
}
.btn-hamburger:hover { background: var(--c-light); }

/* ── Contenu ─────────────────────────────────────────────────── */
.app-content {
  margin-left: var(--sidebar-w);
  margin-top: var(--header-h);
  flex: 1;
  padding: 28px 28px 40px;
  min-height: calc(100vh - var(--header-h));
  min-width: 0;
}
body.rtl .app-content { margin-left: 0; margin-right: var(--sidebar-w); }

/* ══════════════════════════════════════════════════════════════
   PAGE DE CONNEXION
══════════════════════════════════════════════════════════════ */
.login-page {
  min-height: 100vh;
  background: linear-gradient(135deg, var(--c-deep) 0%, var(--c-mid) 60%, #2a4d8f 100%);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.login-box { background: var(--c-white); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); width: 100%; max-width: 420px; overflow: hidden; }
.login-header { background: var(--c-deep); padding: 32px 36px 24px; text-align: center; }
.login-header::after { content: ''; display: block; width: 48px; height: 2px; background: var(--c-accent); margin: 12px auto 0; border-radius: 2px; }
.login-header .logo-star { font-size: 2.8rem; line-height: 1; margin-bottom: 6px; }
.login-header h1 { color: var(--c-white); font-size: 1.3rem; font-weight: 700; }
.login-header p  { color: rgba(255,255,255,.6); font-size: .82rem; margin-top: 4px; }
.login-body { padding: 28px 36px 32px; }
.lang-switcher-login { display: flex; justify-content: center; gap: 8px; margin-bottom: 22px; }
.lang-btn { background: var(--c-light); border: 1px solid var(--c-border); border-radius: 6px; padding: 4px 12px; font-size: .78rem; cursor: pointer; color: var(--c-muted); transition: all var(--transition); }
.lang-btn.active, .lang-btn:hover { background: var(--c-deep); color: var(--c-accent); border-color: var(--c-deep); }

/* ══════════════════════════════════════════════════════════════
   COMPOSANTS
══════════════════════════════════════════════════════════════ */

/* ── Forms ───────────────────────────────────────────────────── */
.form-group { margin-bottom: 18px; }
.form-group label { display: block; font-size: .82rem; font-weight: 600; color: var(--c-muted); margin-bottom: 5px; text-transform: uppercase; letter-spacing: .4px; }
.form-control { width: 100%; padding: 10px 13px; border: 1.5px solid var(--c-border); border-radius: var(--radius); font-size: .95rem; font-family: inherit; color: var(--c-text); background: var(--c-white); transition: border-color var(--transition), box-shadow var(--transition); outline: none; }
.form-control:focus { border-color: var(--c-mid); box-shadow: 0 0 0 3px rgba(26,53,102,.12); }
.form-control.is-invalid { border-color: var(--c-danger); }
.form-control[readonly] { background: var(--c-light); }
textarea.form-control { resize: vertical; min-height: 80px; }
select.form-control { cursor: pointer; }

/* ── Boutons ─────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 20px; border-radius: var(--radius);
  font-size: .9rem; font-weight: 600;
  cursor: pointer; border: none;
  transition: all var(--transition);
  white-space: nowrap; text-decoration: none;
  line-height: 1.4;
  vertical-align: middle;
}
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary  { background: var(--c-mid);    color: var(--c-white); box-shadow: 0 1px 3px rgba(26,53,102,.35); }
.btn-primary:hover  { background: var(--c-deep);   color: var(--c-white); box-shadow: 0 3px 8px rgba(26,53,102,.45); transform: translateY(-1px); }
.btn-gold     { background: var(--c-accent); color: var(--c-deep); box-shadow: 0 1px 3px rgba(200,168,75,.35); }
.btn-gold:hover     { background: var(--c-accent2); color: var(--c-deep); box-shadow: 0 3px 8px rgba(200,168,75,.45); transform: translateY(-1px); }
.btn-outline  { background: transparent; border: 1.5px solid var(--c-mid); color: var(--c-mid); box-shadow: 0 1px 3px rgba(15,31,61,.12); }
.btn-outline:hover  { background: var(--c-mid); color: var(--c-white); box-shadow: 0 3px 8px rgba(15,31,61,.22); transform: translateY(-1px); }
.btn-danger   { background: var(--c-danger); color: #fff; box-shadow: 0 1px 3px rgba(220,38,38,.35); }
.btn-danger:hover   { background: #b91c1c; color: #fff; box-shadow: 0 3px 8px rgba(220,38,38,.45); transform: translateY(-1px); }
.btn-success  { background: var(--c-success); color: #fff; box-shadow: 0 1px 3px rgba(22,163,74,.35); }
.btn-success:hover  { box-shadow: 0 3px 8px rgba(22,163,74,.45); transform: translateY(-1px); }
.btn-view     { background: #0ea5e9; color: #fff; box-shadow: 0 1px 3px rgba(14,165,233,.35); }
.btn-view:hover     { background: #0284c7; color: #fff; box-shadow: 0 3px 8px rgba(14,165,233,.45); transform: translateY(-1px); }
.btn-email    { background: #7c3aed; color: #fff; box-shadow: 0 1px 3px rgba(124,58,237,.35); }
.btn-email:hover    { background: #6d28d9; color: #fff; box-shadow: 0 3px 8px rgba(124,58,237,.45); transform: translateY(-1px); }
/* ── Icône Éditer (crayon) ────────────────────────────────────── */
.icon-edit {
  display: inline-block;
  width: 14px; height: 14px;
  flex-shrink: 0;
  background-color: currentColor;
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M3 17.25V21h3.75L17.81 9.94l-3.75-3.75L3 17.25zM20.71 7.04c.39-.39.39-1.02 0-1.41l-2.34-2.34c-.39-.39-1.02-.39-1.41 0l-1.83 1.83 3.75 3.75 1.83-1.83z' fill='%23000'/%3E%3C/svg%3E");
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-position: center;
  -webkit-mask-size: contain;
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M3 17.25V21h3.75L17.81 9.94l-3.75-3.75L3 17.25zM20.71 7.04c.39-.39.39-1.02 0-1.41l-2.34-2.34c-.39-.39-1.02-.39-1.41 0l-1.83 1.83 3.75 3.75 1.83-1.83z' fill='%23000'/%3E%3C/svg%3E");
  mask-repeat: no-repeat;
  mask-position: center;
  mask-size: contain;
  vertical-align: -2px;
}

/* ── Icône Voir (œil) ─────────────────────────────────────────── */
.icon-view {
  display: inline-block;
  width: 14px; height: 14px;
  flex-shrink: 0;
  background-color: currentColor;
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 4.5C7 4.5 2.73 7.61 1 12c1.73 4.39 6 7.5 11 7.5s9.27-3.11 11-7.5c-1.73-4.39-6-7.5-11-7.5zm0 12.5c-2.76 0-5-2.24-5-5s2.24-5 5-5 5 2.24 5 5-2.24 5-5 5zm0-8c-1.66 0-3 1.34-3 3s1.34 3 3 3 3-1.34 3-3-1.34-3-3-3z' fill='%23000'/%3E%3C/svg%3E");
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-position: center;
  -webkit-mask-size: contain;
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 4.5C7 4.5 2.73 7.61 1 12c1.73 4.39 6 7.5 11 7.5s9.27-3.11 11-7.5c-1.73-4.39-6-7.5-11-7.5zm0 12.5c-2.76 0-5-2.24-5-5s2.24-5 5-5 5 2.24 5 5-2.24 5-5 5zm0-8c-1.66 0-3 1.34-3 3s1.34 3 3 3 3-1.34 3-3-1.34-3-3-3z' fill='%23000'/%3E%3C/svg%3E");
  mask-repeat: no-repeat;
  mask-position: center;
  mask-size: contain;
  vertical-align: -2px;
}

/* ── Icône Supprimer (corbeille) ──────────────────────────────── */
.icon-delete {
  display: inline-block;
  width: 14px; height: 14px;
  flex-shrink: 0;
  background-color: currentColor;
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12zM19 4h-3.5l-1-1h-5l-1 1H5v2h14V4z' fill='%23000'/%3E%3C/svg%3E");
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-position: center;
  -webkit-mask-size: contain;
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12zM19 4h-3.5l-1-1h-5l-1 1H5v2h14V4z' fill='%23000'/%3E%3C/svg%3E");
  mask-repeat: no-repeat;
  mask-position: center;
  mask-size: contain;
  vertical-align: -2px;
}

/* ── Icône Email (@) ──────────────────────────────────────────── */
.icon-email {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px; height: 14px;
  flex-shrink: 0;
  font-size: 13px;
  font-weight: 800;
  line-height: 1;
  font-family: Georgia, 'Times New Roman', serif;
  color: currentColor;
  vertical-align: -2px;
}

/* ── WhatsApp ──────────────────────────────────────────────── */
.icon-whatsapp {
  display: inline-block;
  width: 14px; height: 14px;
  flex-shrink: 0;
  background-color: currentColor;
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Cpath d='M16.001 3C9.096 3 3.5 8.596 3.5 15.5c0 2.42.687 4.68 1.877 6.598L3 29l7.09-2.335A12.44 12.44 0 0 0 16 28c6.905 0 12.5-5.596 12.5-12.5S22.906 3 16.001 3zm6.86 17.66c-.29.816-1.44 1.5-1.977 1.583-.506.078-1.15.11-1.856-.117-.428-.137-.977-.32-1.68-.626-2.955-1.276-4.887-4.234-5.033-4.43-.146-.196-1.207-1.605-1.207-3.062s.766-2.174 1.038-2.47c.27-.297.59-.371.787-.371.196 0 .393.002.564.01.18.008.423-.068.662.505.245.588.833 2.032.907 2.18.073.146.122.317.024.512-.098.196-.147.317-.29.489-.147.171-.31.382-.442.514-.147.146-.3.305-.13.6.172.294.762 1.259 1.636 2.04 1.124 1.002 2.072 1.312 2.367 1.46.294.147.465.122.637-.074.171-.196.735-.858.93-1.152.196-.294.393-.245.66-.147.27.098 1.708.807 2.002.954.294.147.49.22.563.343.074.122.074.71-.216 1.527z' fill='%23000'/%3E%3C/svg%3E");
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-position: center;
  -webkit-mask-size: contain;
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Cpath d='M16.001 3C9.096 3 3.5 8.596 3.5 15.5c0 2.42.687 4.68 1.877 6.598L3 29l7.09-2.335A12.44 12.44 0 0 0 16 28c6.905 0 12.5-5.596 12.5-12.5S22.906 3 16.001 3zm6.86 17.66c-.29.816-1.44 1.5-1.977 1.583-.506.078-1.15.11-1.856-.117-.428-.137-.977-.32-1.68-.626-2.955-1.276-4.887-4.234-5.033-4.43-.146-.196-1.207-1.605-1.207-3.062s.766-2.174 1.038-2.47c.27-.297.59-.371.787-.371.196 0 .393.002.564.01.18.008.423-.068.662.505.245.588.833 2.032.907 2.18.073.146.122.317.024.512-.098.196-.147.317-.29.489-.147.171-.31.382-.442.514-.147.146-.3.305-.13.6.172.294.762 1.259 1.636 2.04 1.124 1.002 2.072 1.312 2.367 1.46.294.147.465.122.637-.074.171-.196.735-.858.93-1.152.196-.294.393-.245.66-.147.27.098 1.708.807 2.002.954.294.147.49.22.563.343.074.122.074.71-.216 1.527z' fill='%23000'/%3E%3C/svg%3E");
  mask-repeat: no-repeat;
  mask-position: center;
  mask-size: contain;
  vertical-align: -2px;
}
.btn-whatsapp {
  background: #25D366; color: #fff;
  box-shadow: 0 1px 3px rgba(37,211,102,.35);
}
.btn-whatsapp:hover {
  background: #20bd5a; color: #fff;
  box-shadow: 0 3px 8px rgba(37,211,102,.45);
  transform: translateY(-1px);
}
.btn-whatsapp .icon-whatsapp { color: #fff; }
.badge-whatsapp {
  background: #dcf8e8; color: #128c4a;
  display: inline-flex; align-items: center; gap: 5px;
}
.badge-whatsapp .icon-whatsapp { color: #128c4a; width: 12px; height: 12px; }
.badge .icon-whatsapp, .badge .icon-email, .badge .icon-edit, .badge .icon-view, .badge .icon-delete { width: 11px; height: 11px; vertical-align: -1px; }
.badge .icon-email { font-size: 10px; }
.btn-sm  { padding: 5px 12px; font-size: .8rem; }
.btn-lg  { padding: 12px 28px; font-size: 1rem; width: 100%; justify-content: center; }
.btn-icon { width: 34px; height: 34px; padding: 0; justify-content: center; border-radius: 6px; }

/* ── Cards ───────────────────────────────────────────────────── */
.card { background: var(--c-white); border-radius: var(--radius-lg); box-shadow: var(--shadow); margin-bottom: 24px; overflow: hidden; }
.card-header { padding: 16px 22px; border-bottom: 1px solid var(--c-border); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.card-header h2 { font-size: 1rem; font-weight: 700; color: var(--c-deep); }
.card-body { padding: 22px; }

/* ── Tables ──────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.data-table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.data-table th { background: var(--c-light); color: var(--c-muted); font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; padding: 10px 14px; text-align: left; border-bottom: 2px solid var(--c-border); white-space: nowrap; }
body.rtl .data-table th { text-align: right; }
.data-table td { padding: 11px 14px; border-bottom: 1px solid #f0ede6; vertical-align: middle; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: #faf8f3; }
.data-table .actions-cell { white-space: nowrap; text-align: right; }

/* ── Badges ──────────────────────────────────────────────────── */
.badge { display: inline-block; padding: 2px 9px; border-radius: 20px; font-size: .73rem; font-weight: 700; }
.badge-success { background: #dcfce7; color: #15803d; }
.badge-danger  { background: #fee2e2; color: #b91c1c; }
.badge-warn    { background: #fef3c7; color: #92400e; }
.badge-info    { background: #dbeafe; color: #1d4ed8; }
.badge-neutral { background: #f3f4f6; color: #6b7280; }

/* Montants par statut */
.montant-paye       { color: #16a34a; font-weight: 700; }
.montant-promesse   { color: #92400e; font-weight: 700; }
.montant-annule     { color: #dc2626; font-weight: 700; text-decoration: line-through; }
.montant-correction { color: #dc2626; font-weight: 700; }

/* ── Stats ───────────────────────────────────────────────────── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 28px; }
.stat-card { background: var(--c-white); border-radius: var(--radius-lg); padding: 20px 22px; box-shadow: var(--shadow); display: flex; align-items: center; gap: 16px; border-left: 4px solid var(--c-accent); }
body.rtl .stat-card { border-left: none; border-right: 4px solid var(--c-accent); }
.stat-icon { font-size: 1.8rem; width: 52px; height: 52px; background: var(--c-light); border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.stat-info .stat-num   { font-size: 1.6rem; font-weight: 800; color: var(--c-deep); line-height: 1; }
.stat-info .stat-label { font-size: .78rem; color: var(--c-muted); margin-top: 3px; }

/* ── Alerts ──────────────────────────────────────────────────── */
.alert { padding: 12px 16px; border-radius: var(--radius); margin-bottom: 16px; font-size: .9rem; display: flex; align-items: center; gap: 10px; }
.alert-danger  { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.alert-success { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.alert-info    { background: #dbeafe; color: #1e40af; border: 1px solid #bfdbfe; }
.alert-warn    { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }

/* ── Modals ──────────────────────────────────────────────────── */
.modal-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(15,31,61,.6);
  z-index: 1000;
  align-items: center; justify-content: center;
  padding: 16px;
  overflow-y: auto;
}
.modal-overlay.is-open { display: flex; }
.modal-box { background: var(--c-white); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); width: 100%; max-width: 600px; animation: slideIn .2s ease; margin: auto; }
.modal-box.modal-lg { max-width: 860px; }
@keyframes slideIn { from { transform: translateY(-20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.modal-header { padding: 18px 24px; border-bottom: 1px solid var(--c-border); display: flex; align-items: center; justify-content: space-between; }
.modal-header h3 { font-size: 1rem; font-weight: 700; color: var(--c-deep); }
.modal-close { background: none; border: none; font-size: 1.4rem; cursor: pointer; color: var(--c-muted); padding: 2px 6px; line-height: 1; border-radius: 4px; }
.modal-close:hover { background: var(--c-light); }
.modal-body   { padding: 22px 24px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--c-border); display: flex; justify-content: flex-end; gap: 10px; }

/* ── Tabs ────────────────────────────────────────────────────── */
.tabs-nav { display: flex; border-bottom: 2px solid var(--c-border); margin-bottom: 22px; gap: 0; flex-wrap: wrap; }
.tab-btn { padding: 9px 20px; background: none; border: none; border-bottom: 2px solid transparent; margin-bottom: -2px; font-size: .88rem; font-weight: 600; color: var(--c-muted); cursor: pointer; transition: all var(--transition); }
.tab-btn.active, .tab-btn:hover { color: var(--c-mid); border-bottom-color: var(--c-mid); }
.tab-pane { display: none; }
.tab-pane.active { display: block; }

/* ── Grid ────────────────────────────────────────────────────── */
.row   { display: flex; flex-wrap: wrap; gap: 16px; }
.col   { flex: 1 1 0; min-width: 0; }
.col-2 { flex: 0 0 calc(50% - 8px); min-width: 0; }
.col-3 { flex: 0 0 calc(33.33% - 11px); min-width: 0; }

/* ── Page header ─────────────────────────────────────────────── */
.page-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 24px; gap: 12px; flex-wrap: wrap; }
.page-header h1 { font-size: 1.5rem; font-weight: 800; color: var(--c-deep); }
.breadcrumb { font-size: .8rem; color: var(--c-muted); display: flex; align-items: center; gap: 6px; margin-top: 2px; flex-wrap: wrap; }
.breadcrumb a { color: var(--c-muted); }
.breadcrumb a:hover { color: var(--c-mid); }

/* ── Autocomplete ────────────────────────────────────────────── */
.search-block { position: relative; }
.search-block .search-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--c-muted); pointer-events: none; }
.search-block .form-control { padding-left: 36px; }
.ui-autocomplete { max-height: 280px; overflow-y: auto; border: 1px solid var(--c-border) !important; border-radius: var(--radius) !important; box-shadow: var(--shadow-lg) !important; font-size: .88rem !important; background: var(--c-white) !important; z-index: 9999 !important; }
.ui-menu-item-wrapper { padding: 8px 14px !important; color: var(--c-text) !important; }
.ui-state-active, .ui-menu-item-wrapper:hover { background: var(--c-light) !important; color: var(--c-mid) !important; border: none !important; }

/* ── Spinner ─────────────────────────────────────────────────── */
.spinner { display: inline-block; width: 18px; height: 18px; border: 2px solid rgba(255,255,255,.3); border-top-color: #fff; border-radius: 50%; animation: spin .6s linear infinite; vertical-align: middle; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Toast ───────────────────────────────────────────────────── */
#toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; max-width: 340px; }
body.rtl #toast-container { right: auto; left: 24px; }
.toast { background: var(--c-deep); color: #fff; padding: 12px 18px; border-radius: var(--radius); box-shadow: var(--shadow-lg); font-size: .88rem; animation: toastIn .3s ease; display: flex; align-items: center; gap: 10px; }
.toast.toast-success { background: var(--c-success); }
.toast.toast-error   { background: var(--c-danger); }
.toast.toast-warn    { background: var(--c-warn); }
@keyframes toastIn { from { opacity:0; transform: translateX(20px); } }

/* ══════════════════════════════════════════════════════════════
   RESPONSIVE
══════════════════════════════════════════════════════════════ */
@media (max-width: 900px) {
  /* Sidebar */
  .sidebar { transform: translateX(-100%); box-shadow: none; }
  body.rtl .sidebar { transform: translateX(100%); left: auto; right: 0; }
  .sidebar.is-open { transform: translateX(0) !important; box-shadow: var(--shadow-lg); }

  /* Header & contenu */
  .app-header { left: 0 !important; right: 0 !important; padding: 0 12px; }
  .app-content { margin-left: 0 !important; margin-right: 0 !important; padding: 16px 14px 32px; }
  .btn-hamburger { display: flex !important; }

  /* Grilles */
  .col-2, .col-3 { flex: 0 0 100%; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .row { gap: 12px; }

  /* Colonnes flottantes en pleine largeur */
  .row > .col,
  .row > [style*="flex:0 0"],
  .row > [style*="flex: 0 0"] {
    flex: 0 0 100% !important;
    min-width: 0 !important;
    width: 100% !important;
  }

  /* Tables standard : scroll horizontal */
  .std-table-wrap .data-table { min-width: 550px; }
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .data-table { min-width: 0; }

  /* Dashboard : tableau "derniers dons" en mode carte */
  .dash-table-wrap .data-table thead { display: none; }
  .dash-table-wrap .data-table tbody,
  .dash-table-wrap .data-table tr,
  .dash-table-wrap .data-table td { display: block; width: 100%; box-sizing: border-box; }
  .dash-table-wrap .data-table tr {
    border-bottom: 2px solid var(--c-border);
    padding: 12px 16px;
    margin: 0;
  }
  .dash-table-wrap .data-table tr:last-child { border-bottom: none; }
  .dash-table-wrap .data-table td {
    padding: 2px 0;
    border: none;
    font-size: .85rem;
  }
  .dash-table-wrap .data-table td[data-label]::before {
    content: attr(data-label) " : ";
    font-size: .7rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--c-muted);
  }
  .dash-table-wrap .data-table td.actions-cell { padding-top: 8px; }
}

@media (max-width: 540px) {
  .stats-grid { grid-template-columns: 1fr; }
  .page-header { flex-direction: column; }
  .page-header > div:last-child { width: 100%; }
  .modal-box { border-radius: var(--radius); }
  .login-body { padding: 20px; }
  .login-header { padding: 24px 20px 18px; }
  .header-actions .btn { display: none; }
  .header-actions .btn:first-child { display: inline-flex; }
  .dash-montants-grid { grid-template-columns: 1fr !important; }
}

@media print {
  .sidebar, .app-header, .no-print { display: none !important; }
  .app-content { margin: 0 !important; padding: 0 !important; }
  .card { box-shadow: none !important; }
}

/* ── Tutoriel interactif ─────────────────────────────────────── */
#tuto-overlay {
  position: fixed; inset: 0; z-index: 9000; pointer-events: none;
}
#tuto-spotlight {
  position: fixed; z-index: 9001; pointer-events: none;
  border-radius: 8px;
  box-shadow: 0 0 0 9999px rgba(10,20,45,.72);
  outline: 3px solid var(--c-accent); outline-offset: 2px;
  transition: top .35s cubic-bezier(.4,0,.2,1),
              left .35s cubic-bezier(.4,0,.2,1),
              width .35s cubic-bezier(.4,0,.2,1),
              height .35s cubic-bezier(.4,0,.2,1);
}
#tuto-bubble {
  position: fixed; z-index: 9100;
  background: #fff; border-radius: 12px;
  box-shadow: 0 8px 40px rgba(10,20,45,.28);
  padding: 20px;
  max-width: 320px;
  transition: top .35s cubic-bezier(.4,0,.2,1), left .35s cubic-bezier(.4,0,.2,1);
  border-top: 4px solid var(--c-accent);
}
.tuto-step-badge {
  font-size: .68rem; font-weight: 700; text-transform: uppercase;
  color: var(--c-accent); margin-bottom: 6px; letter-spacing: .5px;
}
.tuto-bubble-title {
  font-size: 1rem; font-weight: 700; color: var(--c-deep);
  margin-bottom: 8px;
}
.tuto-bubble-text {
  font-size: .875rem; color: var(--c-muted); line-height: 1.6;
  margin-bottom: 16px;
}
.tuto-bubble-actions {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.tuto-nav { display: flex; gap: 6px; }
.tuto-btn-nav {
  padding: 7px 14px; border-radius: 6px; font-size: .82rem; font-weight: 600;
  border: 1px solid var(--c-border); background: var(--c-light);
  color: var(--c-text); cursor: pointer; transition: all var(--transition);
}
.tuto-btn-nav:hover { background: var(--c-border); }
.tuto-btn-primary {
  background: var(--c-accent); color: var(--c-deep);
  border-color: var(--c-accent);
}
.tuto-btn-primary:hover { background: var(--c-accent2); border-color: var(--c-accent2); }
.tuto-btn-skip {
  background: none; border: none; color: var(--c-muted);
  font-size: .78rem; cursor: pointer; padding: 4px 0;
  text-decoration: underline;
}
.tuto-btn-skip:hover { color: var(--c-text); }
.tuto-no-show {
  display: flex; align-items: center; gap: 6px;
  font-size: .75rem; color: var(--c-muted); margin-top: 12px; cursor: pointer;
}
/* Écran de bienvenue */
#tuto-welcome {
  position: fixed; inset: 0; z-index: 9200;
  background: rgba(10,20,45,.78);
  display: flex; align-items: center; justify-content: center;
}
.tuto-welcome-box {
  background: #fff; border-radius: 16px;
  padding: 36px 32px; max-width: 400px; width: 90%;
  text-align: center;
  box-shadow: 0 16px 60px rgba(10,20,45,.35);
  border-top: 5px solid var(--c-accent);
}
.tuto-welcome-icon { font-size: 3rem; margin-bottom: 12px; }
.tuto-welcome-title { font-size: 1.25rem; font-weight: 800; color: var(--c-deep); margin: 0 0 10px; }
.tuto-welcome-sub   { color: var(--c-muted); font-size: .9rem; line-height: 1.6; margin: 0 0 24px; }
.tuto-welcome-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

/* Bouton relancer tutoriel dans la nav */
.tuto-restart-btn {
  display: flex; align-items: center; gap: 10px;
  width: 100%; padding: 9px 20px;
  background: none; border: none; cursor: pointer;
  color: #c5cfe0; font-size: .9rem; font-family: inherit;
  transition: background var(--transition), color var(--transition);
  text-align: left;
}
.tuto-restart-btn:hover { background: rgba(200,168,75,.12); color: var(--c-accent); }
body.rtl .tuto-restart-btn { text-align: right; }

/* ── Utilitaires globaux ─────────────────────────────────────── */

/* Tables de détail (reçus, dons, fidèles) */
.tbl-detail            { border-collapse:collapse; width:100%; }
.tbl-detail td, .td-label, .td-label-full, .td-value, .td-value-bold,
.td-amount-pos, .td-amount-neg { padding:8px 12px; }
.td-label       { background:#f5f3ee; font-weight:600; width:40%; }
.td-label-full  { background:var(--c-light); font-weight:600; }
.td-value       { border-bottom:1px solid var(--c-border); }
.td-value-bold  { border-bottom:1px solid var(--c-border); font-weight:700; }
.td-amount-pos  { font-size:1.1rem; font-weight:700; color:var(--c-success); }
.td-amount-neg  { font-size:1.1rem; font-weight:700; color:var(--c-danger); }

/* Tables avec margin */
.tbl-margin { border-collapse:collapse; width:100%; margin:16px 0; }

/* Texte meta / label section */
.text-meta     { font-size:.72rem; color:var(--c-muted); }
.text-meta-sm  { font-size:.65rem; color:var(--c-muted); }
.section-label {
  display:block; font-size:.72rem; font-weight:700;
  text-transform:uppercase; color:var(--c-muted);
  letter-spacing:.4px; margin-bottom:8px;
}

/* Layouts flex courants */
.flex-gap-8  { display:flex; gap:8px; flex-wrap:wrap; }
.flex-gap-10 { display:flex; gap:10px; flex-wrap:wrap; }
.flex-gap-12 { display:flex; gap:12px; flex-wrap:wrap; }
.flex-gap-14 { display:flex; gap:14px; flex-wrap:wrap; }
.flex-gap-16 { display:flex; gap:16px; flex-wrap:wrap; }

/* Espacement courant */
.mb-0  { margin-bottom:0; }
.mb-8  { margin-bottom:8px; }
.mb-12 { margin-bottom:12px; }
.mb-16 { margin-bottom:16px; }
.mb-20 { margin-bottom:20px; }
.mb-24 { margin-bottom:24px; }
.mt-8  { margin-top:8px; }
.mt-12 { margin-top:12px; }
.mt-14 { margin-top:14px; }
.mt-16 { margin-top:16px; }
.p-0   { padding:0; }

/* Texte centré avec marge */
.text-center-margin { text-align:center; margin:24px 0; }

/* Lien bouton reçu dans les emails */
.btn-recu-link {
  display:inline-block; padding:14px 28px;
  background:#1a3566; color:white; text-decoration:none;
  border-radius:8px; font-weight:700; font-size:1rem;
}
.btn-recu-link:hover { background:#243f7a; }

/* Font-weight utilitaires */
.fw-400 { font-weight:400; text-transform:none; }
.fw-600 { font-weight:600; }
.fw-700 { font-weight:700; }
.fw-800 { font-weight:800; }

/* Alertes spéciales */
.alert-legal {
  border-left:4px solid #f59e0b;
  background:#fffbeb;
}

/* Card padding-0 (tableaux bord à bord) */
.card-body-flush { padding:0; }

/* Layout tickets */
.tickets-layout {
  display: grid;
  grid-template-columns: 1fr 1.6fr;
  gap: 20px;
  align-items: start;
}
@media (max-width: 700px) {
  .tickets-layout {
    grid-template-columns: 1fr;
  }
}
