/* =========================================================
   Fondation TULUKA — Espace Admin (design pro, style SaaS)
   HTML / CSS / JS natif uniquement
   ========================================================= */

:root {
  --bordeaux: #7a1f2b;
  --bordeaux-dark: #5c141d;
  --bordeaux-soft: #f6eced;
  --green: #2f6b4f;
  --green-soft: #e9f2ec;
  --ink: #201a1b;
  --ink-soft: #6a5f61;
  --line: #e7e1e2;
  --line-strong: #d8d0d1;
  --paper: #f7f5f3;
  --bg: #f1eef0;
  --white: #ffffff;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(32, 26, 27, 0.06), 0 2px 8px rgba(32, 26, 27, 0.05);
  --shadow: 0 12px 30px -12px rgba(32, 26, 27, 0.22);
  --sidebar-w: 264px;
  --topbar-h: 64px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  background: var(--bg);
}

body {
  font-family: "Poppins", system-ui, -apple-system, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  max-width: 100%;
  display: block;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

/* ---------------- Buttons ---------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 20px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.92rem;
  transition: transform 0.15s ease, box-shadow 0.2s ease, background 0.2s ease,
    opacity 0.2s ease;
  white-space: nowrap;
}

.btn svg {
  width: 18px;
  height: 18px;
}

.btn--primary {
  background: var(--bordeaux);
  color: #fff;
  box-shadow: 0 10px 22px -10px rgba(122, 31, 43, 0.7);
}

.btn--primary:hover {
  background: var(--bordeaux-dark);
  transform: translateY(-1px);
}

.btn--ghost {
  background: var(--white);
  color: var(--ink);
  border: 1px solid var(--line-strong);
}

.btn--ghost:hover {
  border-color: var(--bordeaux);
  color: var(--bordeaux);
}

.btn--block {
  width: 100%;
}

/* ---------------- Login ---------------- */
.login {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: radial-gradient(
      1100px 700px at 15% -10%,
      rgba(122, 31, 43, 0.14),
      transparent 60%
    ),
    radial-gradient(900px 600px at 100% 100%, rgba(47, 107, 79, 0.12), transparent 55%),
    var(--bg);
}

.login__card {
  width: 100%;
  max-width: 410px;
  background: var(--white);
  border-radius: 20px;
  padding: 40px 34px;
  box-shadow: var(--shadow);
  border: 1px solid var(--line);
  animation: pop 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes pop {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.login__brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 26px;
}

.login__brand img {
  width: 46px;
  height: 46px;
  border-radius: 12px;
}

.login__brand strong {
  display: block;
  font-size: 1.05rem;
  letter-spacing: 0.04em;
}

.login__brand span {
  font-size: 0.76rem;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.login h1 {
  font-size: 1.5rem;
  letter-spacing: -0.02em;
  margin-bottom: 6px;
}

.login__sub {
  color: var(--ink-soft);
  font-size: 0.92rem;
  margin-bottom: 26px;
}

.login__error {
  display: none;
  background: var(--bordeaux-soft);
  color: var(--bordeaux-dark);
  border: 1px solid #e6c9cd;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 500;
  margin-bottom: 16px;
}

.login__error.is-visible {
  display: block;
}

.login__hint {
  margin-top: 22px;
  text-align: center;
  font-size: 0.8rem;
  color: var(--ink-soft);
}

.login__hint a {
  color: var(--bordeaux);
  font-weight: 600;
}

/* ---------------- Field (shared) ---------------- */
.field {
  margin-bottom: 16px;
}

.field label {
  display: block;
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 7px;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  font-family: inherit;
  font-size: 0.93rem;
  color: var(--ink);
  padding: 11px 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--white);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.field textarea {
  resize: vertical;
  min-height: 92px;
  line-height: 1.55;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--bordeaux);
  box-shadow: 0 0 0 3px rgba(122, 31, 43, 0.13);
}

.field__hint {
  font-size: 0.76rem;
  color: var(--ink-soft);
  margin-top: 6px;
}

.input-password {
  position: relative;
}

.input-password button {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-soft);
  border-radius: 8px;
}

.input-password button:hover {
  color: var(--bordeaux);
}

.input-password svg {
  width: 18px;
  height: 18px;
}

/* ---------------- App shell ---------------- */
.app {
  display: none;
  min-height: 100vh;
}

.app.is-active {
  display: block;
}

/* Sidebar */
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-w);
  background: var(--bordeaux-dark);
  color: #fff;
  display: flex;
  flex-direction: column;
  z-index: 40;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar__brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 22px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar__brand img {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: #fff;
}

.sidebar__brand strong {
  font-size: 1rem;
  letter-spacing: 0.05em;
}

.sidebar__brand span {
  display: block;
  font-size: 0.68rem;
  opacity: 0.7;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.sidebar__nav {
  flex: 1;
  padding: 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow-y: auto;
}

.sidebar__label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  opacity: 0.55;
  padding: 14px 12px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: 10px;
  color: rgba(255, 255, 255, 0.82);
  font-size: 0.92rem;
  font-weight: 500;
  transition: background 0.2s ease, color 0.2s ease;
  text-align: left;
  width: 100%;
}

.nav-item svg {
  width: 19px;
  height: 19px;
  flex-shrink: 0;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.nav-item.is-active {
  background: #fff;
  color: var(--bordeaux-dark);
  font-weight: 600;
}

.sidebar__foot {
  padding: 16px 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar__foot a {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.85rem;
  opacity: 0.82;
  transition: opacity 0.2s ease;
}

.sidebar__foot a:hover {
  opacity: 1;
}

.sidebar__foot svg {
  width: 17px;
  height: 17px;
}

/* Main area */
.main {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  height: var(--topbar-h);
  background: rgba(247, 245, 243, 0.85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 clamp(16px, 3vw, 32px);
}

.topbar__left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar h1 {
  font-size: 1.12rem;
  letter-spacing: -0.01em;
}

.topbar__actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.menu-btn {
  display: none;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line-strong);
  background: #fff;
  color: var(--ink);
}

.menu-btn svg {
  width: 20px;
  height: 20px;
}

.avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--bordeaux);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
}

.content {
  padding: clamp(18px, 3vw, 34px);
  flex: 1;
}

/* Panels */
.panel {
  display: none;
  animation: fade 0.35s ease;
  max-width: 920px;
}

.panel.is-active {
  display: block;
}

@keyframes fade {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.panel__head {
  margin-bottom: 22px;
}

.panel__head h2 {
  font-size: 1.4rem;
  letter-spacing: -0.02em;
}

.panel__head p {
  color: var(--ink-soft);
  font-size: 0.92rem;
  margin-top: 4px;
}

/* Cards */
.card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: clamp(18px, 2.4vw, 28px);
  box-shadow: var(--shadow-sm);
  margin-bottom: 20px;
}

.card__title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.02rem;
  font-weight: 600;
  margin-bottom: 4px;
}

.card__title svg {
  width: 20px;
  height: 20px;
  color: var(--bordeaux);
}

.card__desc {
  color: var(--ink-soft);
  font-size: 0.86rem;
  margin-bottom: 18px;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.grid-2 .field {
  margin-bottom: 0;
}

.grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.grid-4 .field {
  margin-bottom: 0;
}

/* Stats overview cards */
.stat-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}

.stat-card__icon {
  width: 42px;
  height: 42px;
  border-radius: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bordeaux-soft);
  color: var(--bordeaux);
  margin-bottom: 14px;
}

.stat-card__icon svg {
  width: 21px;
  height: 21px;
}

.stat-card__num {
  font-size: 1.7rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1;
}

.stat-card__label {
  color: var(--ink-soft);
  font-size: 0.84rem;
  margin-top: 5px;
}

/* Save bar */
.savebar {
  position: sticky;
  bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: var(--white);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 14px 20px;
  box-shadow: var(--shadow);
  margin-top: 24px;
}

.savebar span {
  font-size: 0.86rem;
  color: var(--ink-soft);
}

.savebar__actions {
  display: flex;
  gap: 10px;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 26px;
  left: 50%;
  transform: translate(-50%, 20px);
  background: var(--green);
  color: #fff;
  padding: 13px 22px;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 9px;
  box-shadow: 0 14px 30px -10px rgba(47, 107, 79, 0.6);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
  z-index: 100;
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.toast svg {
  width: 18px;
  height: 18px;
}

/* Preview image thumb */
.img-row {
  display: flex;
  align-items: center;
  gap: 16px;
}

.img-thumb {
  width: 84px;
  height: 60px;
  border-radius: 10px;
  object-fit: cover;
  border: 1px solid var(--line);
  flex-shrink: 0;
}

.img-row .field {
  flex: 1;
  margin-bottom: 0;
}

/* Demandes reçues (cartes) */
.req-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}

.req-card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px 16px;
  box-shadow: 0 2px 10px -6px rgba(24, 16, 18, 0.15);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.req-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.req-card__date {
  font-size: 0.78rem;
  color: var(--ink-soft);
}

.req-card__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 18px;
}

.req-field {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.req-field__label {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-soft);
}

.req-field__value {
  font-size: 0.9rem;
  color: var(--ink);
  overflow-wrap: anywhere;
  word-break: break-word;
}

.req-card__message {
  border-top: 1px solid var(--line);
  padding-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.req-card__message p {
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--ink);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.req-card__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.btn--sm {
  padding: 7px 14px;
  font-size: 0.82rem;
}

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  background: var(--green-soft);
  color: var(--green);
}

@media (max-width: 560px) {
  .req-list {
    grid-template-columns: 1fr;
  }
  .req-card__grid {
    grid-template-columns: 1fr;
  }
}

.empty {
  text-align: center;
  padding: 48px 20px;
  color: var(--ink-soft);
}

.empty svg {
  width: 42px;
  height: 42px;
  opacity: 0.4;
  margin-bottom: 12px;
}

/* Backdrop for mobile sidebar */
.backdrop {
  position: fixed;
  inset: 0;
  background: rgba(24, 16, 18, 0.5);
  z-index: 35;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.backdrop.is-visible {
  opacity: 1;
  pointer-events: auto;
}

/* ---------------- Responsive ---------------- */
@media (max-width: 900px) {
  .grid-4 {
    grid-template-columns: 1fr 1fr;
  }
  .stat-cards {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 760px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.is-open {
    transform: translateX(0);
  }
  .main {
    margin-left: 0;
  }
  .menu-btn {
    display: flex;
  }
}

@media (max-width: 560px) {
  .grid-2,
  .grid-4,
  .stat-cards {
    grid-template-columns: 1fr;
  }
  .savebar {
    flex-direction: column;
    align-items: stretch;
  }
  .savebar__actions {
    flex-direction: column;
  }
}

.panel__head--row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

/* =========================================================
   MEMBRES & LISTE
   ========================================================= */
.member-list__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.member-search {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 14px;
  min-width: 240px;
  flex: 1 1 240px;
  max-width: 340px;
}

.member-search svg {
  width: 16px;
  height: 16px;
  color: var(--ink-soft);
  flex: 0 0 auto;
}

.member-search input {
  border: none;
  background: transparent;
  outline: none;
  width: 100%;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--ink);
  text-transform: none;
  letter-spacing: normal;
}

.member-search input::placeholder {
  color: var(--ink-soft);
}

.member-list {
  display: flex;
  flex-direction: column;
}

.member-row__actions {
  flex: 0 0 auto;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.btn--danger {
  background: #c0453e;
  color: #fff;
  border-color: #c0453e;
}

.btn--danger:hover {
  background: #a63a34;
  border-color: #a63a34;
}

@media (max-width: 640px) {
  .member-search {
    max-width: none;
    width: 100%;
  }
}

.member-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
}

.member-row:last-child {
  border-bottom: none;
}

.member-row__photo {
  flex: 0 0 auto;
  width: 46px;
  height: 46px;
  border-radius: 10px;
  object-fit: cover;
  background: var(--paper);
  border: 1px solid var(--line);
}

.member-row__photo--empty {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #b8aca4;
}

.member-row__photo--empty svg {
  width: 22px;
  height: 22px;
}

.member-row__info {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.member-row__name {
  font-weight: 600;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.member-row__meta {
  font-size: 0.8rem;
  color: var(--ink-soft);
}

.member-row__tag {
  flex: 0 0 auto;
  font-size: 0.74rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--green-soft);
  color: var(--green);
}

@media (max-width: 560px) {
  .member-row__tag {
    display: none;
  }
}

/* =========================================================
   CARTE DE MEMBRE (recto / verso)
   ========================================================= */
.mcard-faces {
  display: flex;
  flex-wrap: wrap;
  gap: 28px;
  justify-content: center;
}

.mcard-face {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.mcard-face__tag {
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-soft);
}

.mcard {
  width: 460px;
  height: 290px;
  border-radius: 16px;
  overflow: hidden;
  position: relative;
  background: #fffdf7;
  box-shadow: 0 14px 34px -14px rgba(32, 26, 27, 0.4);
  font-family: "Poppins", system-ui, sans-serif;
  color: var(--ink);
  display: flex;
  flex-direction: column;
}

/* ---- Recto ---- */
.mcard__header {
  background: var(--bordeaux);
  color: #fff;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
}

.mcard__logo {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: #fff;
  object-fit: contain;
  padding: 3px;
  flex: 0 0 auto;
}

.mcard__titles {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.mcard__country {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  opacity: 0.92;
}

.mcard__org {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.mcard__badge {
  align-self: flex-start;
  margin-top: 3px;
  background: #e8b53a;
  color: #3a2408;
  font-size: 0.66rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 2px 10px;
  border-radius: 4px;
}

.mcard__badge--dark {
  background: var(--bordeaux);
  color: #fff;
}

.mcard__body {
  flex: 1 1 auto;
  display: grid;
  grid-template-columns: 108px 1fr auto;
  gap: 14px;
  padding: 14px 16px;
  align-items: start;
  background:
    linear-gradient(135deg, rgba(47, 107, 79, 0.06), rgba(232, 181, 58, 0.08));
}

.mcard__photo {
  width: 108px;
  height: 134px;
  border-radius: 8px;
  overflow: hidden;
  background: #ece6e2;
  border: 2px solid #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
}

.mcard__photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.mcard__photo-empty svg {
  width: 44px;
  height: 44px;
  color: #b8aca4;
}

.mcard__fields {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}

.mcard__line {
  display: flex;
  align-items: baseline;
  gap: 5px;
  font-size: 0.74rem;
}

.mcard__label {
  flex: 0 0 auto;
  width: 82px;
  font-weight: 600;
  color: var(--bordeaux);
}

.mcard__sep {
  color: var(--ink-soft);
}

.mcard__value {
  flex: 1 1 auto;
  font-weight: 600;
  color: var(--ink);
  border-bottom: 1px dotted var(--line-strong);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mcard__qr {
  width: 74px;
  height: 74px;
  align-self: end;
  border-radius: 6px;
  background: #fff;
  padding: 3px;
  border: 1px solid var(--line);
}

.mcard__footer {
  background: var(--green);
  color: #fff;
  font-size: 0.72rem;
  font-style: italic;
  font-weight: 600;
  padding: 6px 16px;
}

/* ---- Verso ---- */
.mcard--verso {
  align-items: center;
  justify-content: center;
  text-align: center;
  background: linear-gradient(160deg, #fffdf7, #f3efe6);
}

.mcard__verso-watermark {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.06;
}

.mcard__verso-watermark img {
  width: 200px;
  height: 200px;
  object-fit: contain;
}

.mcard__verso-content {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 20px 26px;
}

.mcard__verso-logo {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: #fff;
  object-fit: contain;
  padding: 3px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.mcard--verso .mcard__country {
  color: var(--bordeaux);
  font-weight: 700;
}

.mcard__verso-org {
  font-weight: 800;
  font-size: 1rem;
  color: var(--ink);
}

.mcard__verso-addr {
  font-size: 0.76rem;
  color: var(--ink-soft);
  max-width: 320px;
  line-height: 1.5;
}

.mcard__verso-note {
  font-size: 0.68rem;
  color: var(--ink-soft);
  max-width: 320px;
  font-style: italic;
}

@media (max-width: 520px) {
  .mcard {
    width: 100%;
    max-width: 340px;
    height: auto;
    aspect-ratio: 460 / 290;
  }
  .mcard__body {
    grid-template-columns: 84px 1fr;
  }
  .mcard__qr {
    grid-column: 1 / -1;
    justify-self: end;
  }
}

/* =========================================================
   MODALE CARTE
   ========================================================= */
.card-modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.card-modal[hidden] {
  display: none;
}

.card-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(24, 16, 18, 0.6);
}

.card-modal__dialog {
  position: relative;
  z-index: 1;
  background: var(--white);
  border-radius: var(--radius);
  width: 100%;
  max-width: 1040px;
  max-height: 92vh;
  overflow: auto;
  box-shadow: var(--shadow);
}

.card-modal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
}

.card-modal__head h3 {
  font-size: 1.1rem;
  font-weight: 700;
}

.card-modal__close {
  background: var(--paper);
  border: none;
  border-radius: 8px;
  width: 34px;
  height: 34px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink);
}

.card-modal__close svg {
  width: 18px;
  height: 18px;
}

.card-modal__body {
  padding: 28px 22px;
  background: var(--bg);
}

.card-modal__foot {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 22px;
  border-top: 1px solid var(--line);
}

/* =========================================================
   RÉPARTITION PAR PROVINCE
   ========================================================= */
.prov-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 18px;
}

.prov-stat {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  box-shadow: var(--shadow-sm);
}

.prov-stat__num {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--bordeaux);
  line-height: 1.1;
}

.prov-stat__label {
  font-size: 0.82rem;
  color: var(--ink-soft);
}

.prov-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.prov-row__top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 6px;
}

.prov-row__name {
  font-weight: 600;
  color: var(--ink);
}

.prov-row__count {
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--ink-soft);
}

.prov-bar {
  height: 10px;
  border-radius: 999px;
  background: var(--paper);
  overflow: hidden;
}

.prov-bar__fill {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--bordeaux), var(--green));
}

@media (max-width: 560px) {
  .prov-summary {
    grid-template-columns: 1fr;
  }
}

/* =========================================================
   IMPRESSION DE LA CARTE
   ========================================================= */
#cardPrintArea {
  display: none;
}

@media print {
  body.printing-card * {
    visibility: hidden !important;
  }
  body.printing-card #cardPrintArea,
  body.printing-card #cardPrintArea * {
    visibility: visible !important;
  }
  body.printing-card #cardPrintArea {
    display: block !important;
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    padding: 20px;
  }
  body.printing-card #cardPrintArea .mcard-faces {
    gap: 20px;
  }
  body.printing-card #cardPrintArea .mcard-face__tag {
    color: #333 !important;
  }
  .mcard {
    box-shadow: none !important;
    border: 1px solid #ccc;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
}
