:root {
  --gold: #7ab3d4;
  --gold-light: #a8cfe3;
  --bg-dark: #161b26;
  --bg-mid: #1a1f2e;
  --surface: #1e2537;
  --surface2: #2a3245;
  --warm-gray: #c2c7cc;
  --border: #2e3a50;
  --transition: all 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body { font-family: 'Inter', sans-serif; background: #1a1f2e; color: var(--warm-gray); overflow-x: hidden; }

/* ── LOGIN ── */
#loginScreen {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: #161b26; padding: 2rem;
}
.login-card {
  background: #1e2537; border: 1px solid var(--border);
  border-radius: 16px; padding: 3rem; width: 100%; max-width: 420px;
}
.login-logo {
  display: flex; align-items: center; gap: 0.8rem;
  font-family: 'Montserrat', sans-serif; font-size: 1.1rem; font-weight: 700;
  color: var(--warm-gray); letter-spacing: 0.08em; text-transform: uppercase;
  margin-bottom: 2.5rem; justify-content: center;
}
.login-logo span { color: var(--gold); }
.login-title { font-family: 'Montserrat', sans-serif; font-size: 1.4rem; font-weight: 400; color: var(--warm-gray); margin-bottom: 0.5rem; text-align: center; }
.login-subtitle { font-size: 0.78rem; color: rgba(194,199,204,0.5); text-align: center; margin-bottom: 2rem; }
.login-field { margin-bottom: 1.2rem; }
.login-field label { display: block; font-size: 0.7rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--warm-gray); margin-bottom: 0.5rem; font-weight: 600; }
.login-field input {
  width: 100%; padding: 0.85rem 1rem; background: #1a1f2e;
  border: 1px solid var(--border); border-radius: 8px;
  font-family: 'Inter', sans-serif; font-size: 0.9rem; color: var(--warm-gray);
  outline: none; transition: border-color 0.2s;
}
.login-field input:focus { border-color: var(--gold); }
.login-field input::placeholder { color: rgba(194,199,204,0.3); }
.login-btn {
  width: 100%; background: var(--gold); color: #1a1f2e; border: none;
  border-radius: 8px; padding: 0.95rem; font-family: 'Montserrat', sans-serif;
  font-size: 0.85rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase;
  cursor: pointer; transition: var(--transition); margin-top: 0.5rem;
}
.login-btn:hover { background: var(--gold-light); }
.login-error { background: rgba(224,112,112,0.12); border: 1px solid rgba(224,112,112,0.3); border-radius: 6px; padding: 0.7rem 1rem; font-size: 0.78rem; color: #e07070; margin-top: 1rem; display: none; text-align: center; }
.login-hint { text-align: center; font-size: 0.72rem; color: rgba(194,199,204,0.3); margin-top: 1.5rem; }

/* ── ADMIN LAYOUT ── */
#adminScreen { display: none; min-height: 100vh; }

.admin-nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  background: #161b26; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 1rem 2rem;
}
.admin-nav-logo {
  font-family: 'Montserrat', sans-serif; font-size: 1rem; font-weight: 700;
  letter-spacing: 0.08em; text-transform: uppercase; color: var(--warm-gray);
  display: flex; align-items: center; gap: 0.6rem;
}
.admin-nav-logo span { color: var(--gold); }
.admin-badge {
  background: rgba(122,179,212,0.15); color: var(--gold); font-size: 0.65rem;
  font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase;
  padding: 0.25rem 0.7rem; border-radius: 20px; border: 1px solid rgba(122,179,212,0.3);
}
.admin-nav-right { display: flex; align-items: center; gap: 1rem; }
.admin-nav-user { font-size: 0.78rem; color: rgba(194,199,204,0.5); }
.admin-nav-user strong { color: var(--warm-gray); }
.btn-logout {
  background: none; border: 1px solid var(--border); border-radius: 6px;
  padding: 0.45rem 1rem; font-size: 0.72rem; color: var(--warm-gray);
  cursor: pointer; transition: var(--transition); letter-spacing: 0.05em;
}
.btn-logout:hover { border-color: #e07070; color: #e07070; }

.admin-sidebar {
  position: fixed; top: 60px; left: 0; bottom: 0; width: 220px;
  background: #1a1f2e; border-right: 1px solid var(--border);
  padding: 1.5rem 1rem; overflow-y: auto;
}
.sidebar-section { margin-bottom: 2rem; }
.sidebar-section-title {
  font-size: 0.6rem; letter-spacing: 0.18em; text-transform: uppercase;
  color: rgba(194,199,204,0.35); margin-bottom: 0.8rem; padding-left: 0.5rem;
}
.sidebar-link {
  display: flex; align-items: center; gap: 0.7rem; padding: 0.65rem 0.8rem;
  border-radius: 8px; font-size: 0.82rem; color: rgba(194,199,204,0.6);
  cursor: pointer; transition: var(--transition); border: none; background: none;
  width: 100%; text-align: left;
}
.sidebar-link:hover { background: rgba(255,255,255,0.05); color: var(--warm-gray); }
.sidebar-link.active { background: rgba(122,179,212,0.12); color: var(--gold); }
.sidebar-link svg { flex-shrink: 0; }

.admin-content {
  margin-left: 220px; padding-top: 60px; min-height: 100vh;
  padding: 60px 0 0;
}
.admin-page { display: none; padding: 2.5rem; }
.admin-page.active { display: block; }

/* ── PAGE HEADERS ── */
.page-header { margin-bottom: 2.5rem; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 1rem; }
.page-title-group {}
.page-tag { font-size: 0.65rem; letter-spacing: 0.2em; text-transform: uppercase; color: var(--gold); margin-bottom: 0.5rem; display: flex; align-items: center; gap: 0.6rem; }
.page-tag::before { content: ''; width: 24px; height: 1px; background: var(--gold); }
.page-title { font-family: 'Montserrat', sans-serif; font-size: 1.8rem; font-weight: 400; color: var(--warm-gray); }
.page-title em { font-style: italic; color: var(--gold); }

/* ── STATS ── */
.stats-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin-bottom: 2rem; }
.stat-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 1.3rem 1.5rem;
}
.stat-card-label { font-size: 0.7rem; letter-spacing: 0.12em; text-transform: uppercase; color: rgba(194,199,204,0.4); margin-bottom: 0.5rem; }
.stat-card-value { font-family: 'Montserrat', sans-serif; font-size: 1.8rem; font-weight: 700; color: var(--warm-gray); }
.stat-card-value.gold { color: var(--gold); }
.stat-card-sub { font-size: 0.72rem; color: rgba(194,199,204,0.4); margin-top: 0.3rem; }

/* ── BUTTON PRIMARY ── */
.btn-primary {
  display: inline-flex; align-items: center; gap: 0.5rem;
  background: var(--gold); color: #1a1f2e; padding: 0.75rem 1.5rem;
  font-size: 0.78rem; font-weight: 700; letter-spacing: 0.08em;
  text-transform: uppercase; border: none; cursor: pointer; border-radius: 6px;
  transition: var(--transition);
}
.btn-primary:hover { background: var(--gold-light); }

/* ── FACTURES LIST ── */
.table-card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.table-header { padding: 1.2rem 1.5rem; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.table-header h3 { font-size: 0.85rem; font-weight: 600; color: var(--warm-gray); }
.search-input {
  padding: 0.5rem 1rem; background: #1a1f2e; border: 1px solid var(--border);
  border-radius: 6px; font-size: 0.8rem; color: var(--warm-gray); outline: none;
  width: 220px; transition: border-color 0.2s;
}
.search-input:focus { border-color: var(--gold); }
.search-input::placeholder { color: rgba(194,199,204,0.3); }
table { width: 100%; border-collapse: collapse; }
th { font-size: 0.65rem; letter-spacing: 0.12em; text-transform: uppercase; color: rgba(194,199,204,0.4); padding: 0.9rem 1.5rem; text-align: left; border-bottom: 1px solid var(--border); }
td { padding: 1rem 1.5rem; font-size: 0.82rem; color: rgba(194,199,204,0.8); border-bottom: 1px solid rgba(46,58,80,0.5); }
tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(255,255,255,0.02); }
.badge {
  display: inline-block; padding: 0.22rem 0.65rem; border-radius: 4px;
  font-size: 0.65rem; font-weight: 700; letter-spacing: 0.06em; white-space: nowrap;
}
.badge-payee { background: rgba(52,211,153,0.15); color: #34d399; }
.badge-envoyee { background: rgba(122,179,212,0.15); color: var(--gold); }
.badge-brouillon { background: rgba(194,199,204,0.1); color: rgba(194,199,204,0.5); }
.badge-retard { background: rgba(224,112,112,0.15); color: #e07070; }
.action-btn {
  background: none; border: 1px solid var(--border); border-radius: 4px;
  padding: 0.3rem 0.65rem; font-size: 0.7rem; color: rgba(194,199,204,0.6);
  cursor: pointer; transition: var(--transition); margin-right: 0.3rem;
}
.action-btn:hover { border-color: var(--gold); color: var(--gold); }
.action-btn.danger:hover { border-color: #e07070; color: #e07070; }

/* ── MODAL FACTURE ── */
.modal-overlay {
  display: none; position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,0.8); backdrop-filter: blur(4px);
  align-items: center; justify-content: center; padding: 1.5rem; overflow-y: auto;
}
.modal-overlay.open { display: flex; }
.modal-box {
  background: #1e2537; border: 1px solid var(--border); border-radius: 16px;
  width: 100%; max-width: 820px; position: relative; max-height: 92vh; overflow-y: auto;
}
.modal-head {
  background: #1a1f2e; padding: 1.5rem 2rem; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 10; border-radius: 16px 16px 0 0;
}
.modal-head h2 { font-family: 'Montserrat', sans-serif; font-size: 1.1rem; font-weight: 400; color: var(--warm-gray); }
.modal-close {
  background: none; border: none; cursor: pointer; font-size: 1.4rem;
  color: rgba(194,199,204,0.4); line-height: 1; transition: color 0.2s; padding: 0.2rem;
}
.modal-close:hover { color: var(--warm-gray); }
.modal-body { padding: 2rem; }

/* ── FORM FACTURE ── */
.form-section { margin-bottom: 2rem; }
.form-section-title {
  font-size: 0.65rem; letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--gold); font-weight: 700; margin-bottom: 1rem;
  padding-bottom: 0.6rem; border-bottom: 1px solid rgba(122,179,212,0.2);
  display: flex; align-items: center; gap: 0.5rem;
}
.form-section-title::before { content: ''; width: 16px; height: 1px; background: var(--gold); }
.form-row { display: grid; gap: 1rem; margin-bottom: 1rem; }
.form-row-2 { grid-template-columns: 1fr 1fr; }
.form-row-3 { grid-template-columns: 1fr 1fr 1fr; }
.form-field label {
  display: block; font-size: 0.68rem; letter-spacing: 0.1em; text-transform: uppercase;
  color: rgba(194,199,204,0.55); margin-bottom: 0.4rem; font-weight: 600;
}
.form-field input, .form-field select, .form-field textarea {
  width: 100%; padding: 0.7rem 0.9rem; background: #1a1f2e;
  border: 1px solid var(--border); border-radius: 6px;
  font-family: 'Inter', sans-serif; font-size: 0.82rem;
  color: var(--warm-gray); outline: none; transition: border-color 0.2s; resize: none;
}
.form-field input:focus, .form-field select:focus, .form-field textarea:focus { border-color: var(--gold); }
.form-field input::placeholder, .form-field textarea::placeholder { color: rgba(194,199,204,0.25); }
.form-field select option { background: #1e2537; }

/* ── LIGNES FACTURE ── */
.lignes-header {
  display: grid; grid-template-columns: 2fr 1fr 1fr 1fr 40px;
  gap: 0.5rem; margin-bottom: 0.5rem; padding: 0 0.2rem;
}
.lignes-header span { font-size: 0.62rem; letter-spacing: 0.1em; text-transform: uppercase; color: rgba(194,199,204,0.35); font-weight: 600; }
.ligne-row { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr 40px; gap: 0.5rem; margin-bottom: 0.5rem; align-items: center; }
.ligne-row input {
  padding: 0.6rem 0.7rem; background: #1a1f2e; border: 1px solid var(--border);
  border-radius: 5px; font-size: 0.8rem; color: var(--warm-gray); outline: none; width: 100%;
  transition: border-color 0.2s;
}
.ligne-row input:focus { border-color: var(--gold); }
.ligne-row input::placeholder { color: rgba(194,199,204,0.2); }
.ligne-total-val { font-size: 0.85rem; font-weight: 700; color: var(--gold); text-align: right; padding: 0.5rem; }
.btn-del-ligne {
  background: none; border: 1px solid rgba(224,112,112,0.2); border-radius: 5px;
  width: 32px; height: 32px; display: flex; align-items: center; justify-content: center;
  color: rgba(224,112,112,0.5); cursor: pointer; transition: var(--transition); flex-shrink: 0;
}
.btn-del-ligne:hover { border-color: #e07070; color: #e07070; background: rgba(224,112,112,0.08); }
.btn-add-ligne {
  background: none; border: 1px dashed var(--border); border-radius: 6px;
  padding: 0.65rem; width: 100%; font-size: 0.75rem; color: rgba(194,199,204,0.4);
  cursor: pointer; transition: var(--transition); margin-top: 0.5rem; text-align: center;
}
.btn-add-ligne:hover { border-color: var(--gold); color: var(--gold); background: rgba(122,179,212,0.05); }

/* ── TOTAUX ── */
.totaux { background: #1a1f2e; border-radius: 8px; padding: 1.2rem 1.5rem; margin-top: 1rem; }
.totaux-row { display: flex; justify-content: space-between; align-items: center; padding: 0.35rem 0; font-size: 0.82rem; }
.totaux-row.total-ttc { border-top: 1px solid var(--border); margin-top: 0.5rem; padding-top: 0.8rem; }
.totaux-row.total-ttc span:first-child { font-weight: 700; color: var(--warm-gray); }
.totaux-row.total-ttc span:last-child { font-family: 'Montserrat', sans-serif; font-size: 1.2rem; font-weight: 700; color: var(--gold); }
.totaux-row span:first-child { color: rgba(194,199,204,0.5); }
.totaux-row span:last-child { color: var(--warm-gray); font-weight: 600; }

/* ── NOTES FACTURE ── */
.notes-box {
  background: rgba(122,179,212,0.06); border: 1px solid rgba(122,179,212,0.15);
  border-radius: 8px; padding: 1rem 1.2rem; margin-top: 1rem;
}
.notes-box p { font-size: 0.78rem; color: rgba(194,199,204,0.5); line-height: 1.7; }

/* ── MODAL FOOTER ── */
.modal-footer {
  padding: 1.5rem 2rem; border-top: 1px solid var(--border);
  display: flex; justify-content: flex-end; gap: 0.8rem;
  position: sticky; bottom: 0; background: #1e2537; border-radius: 0 0 16px 16px;
}
.btn-secondary-action {
  background: none; border: 1px solid var(--border); border-radius: 6px;
  padding: 0.7rem 1.4rem; font-size: 0.78rem; color: var(--warm-gray);
  cursor: pointer; transition: var(--transition); font-family: 'Inter', sans-serif;
}
.btn-secondary-action:hover { border-color: var(--gold); color: var(--gold); }

/* ── APERÇU FACTURE ── */
.apercu-card {
  background: white; border-radius: 8px; padding: 3rem; color: #1a1a2e;
  font-family: 'Inter', sans-serif; box-shadow: 0 4px 32px rgba(0,0,0,0.4);
  max-width: 760px; margin: 0 auto;
}
.apercu-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 2.5rem; }
.apercu-logo { font-family: 'Montserrat', sans-serif; font-size: 1.3rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: #1a1a2e; }
.apercu-logo span { color: #7ab3d4; }
.apercu-logo-sub { font-size: 0.7rem; letter-spacing: 0.05em; color: #888; margin-top: 0.3rem; }
.apercu-facture-num { text-align: right; }
.apercu-facture-num .num { font-family: 'Montserrat', sans-serif; font-size: 1.5rem; font-weight: 700; color: #7ab3d4; }
.apercu-facture-num .label { font-size: 0.7rem; color: #888; text-transform: uppercase; letter-spacing: 0.1em; }
.apercu-sep { height: 1px; background: #e8ecf0; margin: 1.5rem 0; }
.apercu-parties { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; margin-bottom: 2rem; }
.apercu-partie-label { font-size: 0.6rem; letter-spacing: 0.15em; text-transform: uppercase; color: #7ab3d4; font-weight: 700; margin-bottom: 0.5rem; }
.apercu-partie-name { font-size: 0.95rem; font-weight: 700; color: #1a1a2e; margin-bottom: 0.2rem; }
.apercu-partie-info { font-size: 0.8rem; color: #666; line-height: 1.7; }
.apercu-infos { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; background: #f8fafc; border-radius: 8px; padding: 1rem; margin-bottom: 2rem; }
.apercu-info-item label { font-size: 0.6rem; text-transform: uppercase; letter-spacing: 0.1em; color: #888; display: block; margin-bottom: 0.2rem; }
.apercu-info-item span { font-size: 0.82rem; font-weight: 600; color: #1a1a2e; }
.apercu-table { width: 100%; border-collapse: collapse; margin-bottom: 1.5rem; }
.apercu-table th { font-size: 0.62rem; text-transform: uppercase; letter-spacing: 0.1em; color: #888; padding: 0.7rem 0.8rem; text-align: left; border-bottom: 2px solid #e8ecf0; }
.apercu-table td { padding: 0.8rem 0.8rem; font-size: 0.82rem; color: #333; border-bottom: 1px solid #f0f4f8; }
.apercu-table tfoot td { font-weight: 700; border-top: 2px solid #e8ecf0; border-bottom: none; }
.apercu-table .right { text-align: right; }
.apercu-total-row { display: flex; justify-content: flex-end; }
.apercu-total { background: #7ab3d4; color: white; border-radius: 8px; padding: 1rem 1.5rem; text-align: right; }
.apercu-total-label { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.1em; opacity: 0.8; }
.apercu-total-val { font-family: 'Montserrat', sans-serif; font-size: 1.5rem; font-weight: 700; }
.apercu-footer { margin-top: 2rem; padding-top: 1.5rem; border-top: 1px solid #e8ecf0; font-size: 0.72rem; color: #888; line-height: 1.8; }
.apercu-conditions { background: #f8fafc; border-radius: 6px; padding: 1rem; margin-top: 1rem; }
.apercu-conditions-title { font-size: 0.65rem; text-transform: uppercase; letter-spacing: 0.1em; color: #7ab3d4; font-weight: 700; margin-bottom: 0.5rem; }
.apercu-conditions p { font-size: 0.75rem; color: #666; line-height: 1.7; }

/* ── RESPONSIVE ── */
@media (max-width: 1024px) {
  .admin-sidebar { display: none; }
  .admin-content { margin-left: 0; }
  .stats-row { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 768px) {
  /* FIX ZOOM iOS */
  input, select, textarea { font-size: 16px !important; }

  /* NAV */
  .admin-nav { height: 56px; padding: 0 4vw; }
  .admin-nav-user { display: none; }

  /* LAYOUT */
  .admin-sidebar { display: none; }
  .admin-content { margin-left: 0; padding-top: 56px; padding-bottom: 80px; }
  .admin-page { padding: 1rem; }

  /* STATS */
  .stats-row { grid-template-columns: 1fr 1fr; gap: 0.65rem; margin-bottom: 1rem; }
  .stat-card { padding: 0.9rem 1rem; border-radius: 12px; }
  .stat-card-value { font-size: 1.4rem; }

  /* PAGE HEADER */
  .page-header { margin-bottom: 1.2rem; flex-wrap: wrap; gap: 0.6rem; }
  .page-title { font-size: 1.4rem; }
  .table-header { flex-direction: column; align-items: flex-start; gap: 0.6rem; padding: 0.9rem 1rem; }
  .search-input { width: 100%; }

  /* TABLEAU scrollable */
  table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  th { white-space: nowrap; font-size: 0.6rem; padding: 0.6rem 0.7rem; }
  td { white-space: nowrap; font-size: 0.75rem; padding: 0.65rem 0.7rem; }

  /* FORMS */
  .form-row-2, .form-row-3 { grid-template-columns: 1fr; }
  .ligne-row { grid-template-columns: 1fr 50px 62px 50px 32px; gap: 0.25rem; }
  .ligne-row input { padding: 0.5rem 0.4rem; min-height: 42px; }
  .lignes-header { grid-template-columns: 1fr 50px 62px 50px 32px; font-size: 0.5rem; gap: 0.25rem; }
  .apercu-parties { grid-template-columns: 1fr; }
  .apercu-infos { grid-template-columns: 1fr 1fr; }
  .apercu-card { padding: 1.2rem; }

  /* MODAL — sheet depuis le bas, sans bords noirs */
  .modal-overlay {
    padding: 0;
    align-items: flex-end;
    background: rgba(0,0,0,0.7);
  }
  .modal-box {
    max-width: 100vw;
    width: 100vw;
    border-radius: 20px 20px 0 0;
    max-height: 92dvh;
    margin: 0;
  }
  .modal-head {
    border-radius: 20px 20px 0 0;
    padding: 1.1rem 1.2rem;
  }
  .modal-body { padding: 1rem; }
  .modal-footer {
    padding: 0.9rem 1rem calc(0.9rem + env(safe-area-inset-bottom, 0px));
    flex-wrap: wrap;
    gap: 0.5rem;
    border-radius: 0;
    justify-content: stretch;
  }
  .modal-footer .btn-primary {
    width: 100%;
    justify-content: center;
    min-height: 50px;
    order: -1;
  }
  .modal-footer .btn-secondary-action {
    flex: 1;
    justify-content: center;
    min-height: 44px;
    text-align: center;
  }

  /* BOTTOM NAV */
  .mobile-bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    z-index: 150;
    background: #161b26;
    border-top: 1px solid #2e3a50;
    height: calc(60px + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
    align-items: stretch;
  }
  .mbn-item {
    flex: 1;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    gap: 4px;
    background: none; border: none; cursor: pointer;
    color: rgba(194,199,204,0.45);
    font-size: 0.58rem; font-weight: 500;
    font-family: 'Inter', sans-serif;
    letter-spacing: 0.03em;
    transition: color 0.2s;
    padding: 0 0.5rem;
    -webkit-tap-highlight-color: transparent;
  }
  .mbn-item svg { stroke: currentColor; width: 20px; height: 20px; }
  .mbn-item.active { color: #7ab3d4; }
  .mbn-fab {
    width: 48px; height: 48px;
    border-radius: 50%;
    background: #7ab3d4;
    border: none; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    color: #1a1f2e;
    box-shadow: 0 4px 18px rgba(122,179,212,0.45);
    transition: background 0.2s, transform 0.15s;
    flex-shrink: 0;
    align-self: center;
    margin: 0 4px;
    -webkit-tap-highlight-color: transparent;
  }
  .mbn-fab:active { transform: scale(0.93); background: #a8cfe3; }
}

/* ── LOCK BODY QUAND MODAL OUVERTE (évite le décalage) ── */
body.modal-open {
  overflow: hidden;
  /* NE PAS utiliser position:fixed ici → cause les bords noirs */
  touch-action: none;
}
</style>
  <style>body{font-family:Inter,sans-serif;margin:0;padding:2rem;background:#f0f4f8;}
  .apercu-card{background:white;border-radius:8px;padding:3rem;max-width:780px;margin:0 auto;}
  .apercu-logo{font-family:Montserrat,sans-serif;font-size:1.3rem;font-weight:700;letter-spacing:.08em;text-transform:uppercase;}
  .apercu-logo span{color:#7ab3d4;} .apercu-logo-sub{font-size:.7rem;color:#888;margin-top:.3rem;}
  .apercu-head{display:flex;justify-content:space-between;margin-bottom:2rem;}
  .apercu-facture-num .num{font-family:Montserrat,sans-serif;font-size:1.5rem;font-weight:700;color:#7ab3d4;} 
  .apercu-facture-num .label{font-size:.7rem;color:#888;text-transform:uppercase;letter-spacing:.1em;}
  .apercu-sep{height:1px;background:#e8ecf0;margin:1.5rem 0;}
  .apercu-parties{display:grid;grid-template-columns:1fr 1fr;gap:2rem;margin-bottom:1.5rem;}
  .apercu-partie-label{font-size:.6rem;letter-spacing:.15em;text-transform:uppercase;color:#7ab3d4;font-weight:700;margin-bottom:.4rem;}
  .apercu-partie-name{font-size:.95rem;font-weight:700;margin-bottom:.2rem;} .apercu-partie-info{font-size:.8rem;color:#666;line-height:1.7;}
  .apercu-infos{display:grid;grid-template-columns:repeat(3,1fr);gap:1rem;background:#f8fafc;border-radius:8px;padding:1rem;margin-bottom:1.5rem;}
  .apercu-info-item label{font-size:.6rem;text-transform:uppercase;letter-spacing:.1em;color:#888;display:block;margin-bottom:.2rem;} 
  .apercu-info-item span{font-size:.82rem;font-weight:600;}
  .apercu-table{width:100%;border-collapse:collapse;margin-bottom:1.5rem;}
  .apercu-table th{font-size:.62rem;text-transform:uppercase;letter-spacing:.1em;color:#888;padding:.7rem .8rem;text-align:left;border-bottom:2px solid #e8ecf0;}
  .apercu-table td{padding:.8rem .8rem;font-size:.82rem;color:#333;border-bottom:1px solid #f0f4f8;}
  .apercu-table tfoot td{font-weight:700;border-top:2px solid #e8ecf0;border-bottom:none;}
  .right{text-align:right;} .apercu-total-row{display:flex;justify-content:flex-end;}
  .apercu-total{background:#7ab3d4;color:white;border-radius:8px;padding:1rem 1.5rem;text-align:right;}
  .apercu-total-label{font-size:.7rem;text-transform:uppercase;letter-spacing:.1em;opacity:.8;}
  .apercu-total-val{font-family:Montserrat,sans-serif;font-size:1.5rem;font-weight:700;}
  .apercu-footer{margin-top:1.5rem;padding-top:1.2rem;border-top:1px solid #e8ecf0;font-size:.72rem;color:#888;line-height:1.8;}
  .apercu-conditions{background:#f8fafc;border-radius:6px;padding:1rem;margin-top:1rem;}
  .apercu-conditions-title{font-size:.65rem;text-transform:uppercase;letter-spacing:.1em;color:#7ab3d4;font-weight:700;margin-bottom:.5rem;}
  .apercu-conditions p{font-size:.75rem;color:#666;line-height:1.7;}