/* ==========================================================================
   Ulis CRM — Feuille de style principale
   ========================================================================== */
:root {
  --brand: #4338ca;
  --brand-600: #4f46e5;
  --brand-700: #3730a3;
  --brand-soft: #eef2ff;
  --accent: #06b6d4;
  --green: #16a34a;
  --green-soft: #dcfce7;
  --orange: #ea580c;
  --orange-soft: #ffedd5;
  --red: #dc2626;
  --red-soft: #fee2e2;
  --amber: #d97706;
  --violet: #7c3aed;
  --teal: #0d9488;

  --ink: #0f172a;
  --ink-2: #334155;
  --muted: #64748b;
  --muted-2: #94a3b8;
  --line: #e6e9f0;
  --bg: #f5f6fb;
  --card: #ffffff;

  --radius: 16px;
  --radius-sm: 11px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .06), 0 1px 3px rgba(15, 23, 42, .04);
  --shadow: 0 6px 18px rgba(15, 23, 42, .07);
  --shadow-lg: 0 18px 44px rgba(15, 23, 42, .16);

  --tab-h: 62px;
  --head-h: 58px;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}

body.modal-open { overflow: hidden; }

h1, h2, h3, h4 { margin: 0; font-weight: 700; letter-spacing: -.01em; }
p { margin: 0; }
a { color: var(--brand); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
svg { flex-shrink: 0; }

/* ---------- Structure application ---------- */
.app-head {
  position: sticky;
  top: 0;
  z-index: 40;
  padding: calc(env(safe-area-inset-top, 0px) + 10px) 16px 10px;
  background: linear-gradient(135deg, var(--brand-700), var(--brand-600));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: var(--head-h);
  box-shadow: 0 4px 16px rgba(55, 48, 163, .22);
}

.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-mark {
  width: 34px; height: 34px;
  border-radius: 11px;
  background: rgba(255, 255, 255, .18);
  border: 1px solid rgba(255, 255, 255, .35);
  display: grid; place-items: center;
  font-weight: 800; font-size: 17px;
  color: #fff;
  flex: none;
}
.brand-mark.big { width: 62px; height: 62px; border-radius: 20px; font-size: 28px; }
.brand-name { font-weight: 700; font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-name em { font-style: normal; font-weight: 500; opacity: .78; font-size: 14px; }

.head-title { font-size: 17px; font-weight: 700; }
.head-sub { font-size: 12px; opacity: .8; }
.head-actions { display: flex; align-items: center; gap: 8px; }

.icon-btn {
  width: 38px; height: 38px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, .28);
  background: rgba(255, 255, 255, .12);
  color: #fff;
  display: grid; place-items: center;
  cursor: pointer;
  transition: background .18s;
}
.icon-btn:hover { background: rgba(255, 255, 255, .24); }

.container {
  padding: 16px;
  padding-bottom: calc(var(--tab-h) + env(safe-area-inset-bottom, 0px) + 28px);
  max-width: 1180px;
  margin: 0 auto;
}

.page-title { font-size: 21px; font-weight: 800; margin-bottom: 2px; }
.page-sub { color: var(--muted); font-size: 13.5px; margin-bottom: 16px; }

/* ---------- Barre d'onglets basse ---------- */
.tabbar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 50;
  height: calc(var(--tab-h) + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: rgba(255, 255, 255, .96);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
  display: flex;
  align-items: stretch;
  max-width: 100%;
}
.tabbar .tab {
  flex: 1;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 3px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  padding-top: 6px;
  transition: color .15s;
}
.tabbar .tab span { line-height: 1; }
.tabbar .tab.active { color: var(--brand); }
.tabbar .tab.active svg { transform: translateY(-1px); }

/* ---------- Cartes ---------- */
.card {
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  padding: 16px;
  margin-bottom: 14px;
}
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; margin-bottom: 12px;
}
.card-head h3 { font-size: 15.5px; }
.card-head .link { font-size: 13px; font-weight: 600; }

/* ---------- KPI ---------- */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.kpi {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}
.kpi-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.kpi-ico {
  width: 34px; height: 34px; border-radius: 11px;
  display: grid; place-items: center;
  background: var(--brand-soft); color: var(--brand);
}
.kpi-ico.green { background: var(--green-soft); color: var(--green); }
.kpi-ico.orange { background: var(--orange-soft); color: var(--orange); }
.kpi-ico.teal { background: #ccfbf1; color: var(--teal); }
.kpi-value { font-size: 22px; font-weight: 800; letter-spacing: -.02em; }
.kpi-label { font-size: 12.5px; color: var(--muted); font-weight: 500; }
.kpi-delta { font-size: 11.5px; font-weight: 700; }
.kpi-delta.up { color: var(--green); }
.kpi-delta.down { color: var(--red); }

/* ---------- Boutons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 10px 15px;
  font-size: 14px;
  font-weight: 650;
  cursor: pointer;
  background: #fff;
  color: var(--ink-2);
  border-color: var(--line);
  transition: transform .12s, box-shadow .18s, background .18s;
  white-space: nowrap;
}
.btn:active { transform: scale(.98); }
.btn-primary { background: linear-gradient(135deg, var(--brand-600), var(--brand)); color: #fff; border-color: transparent; box-shadow: 0 6px 16px rgba(79, 70, 229, .28); }
.btn-primary:hover { box-shadow: 0 8px 22px rgba(79, 70, 229, .34); }
.btn-ghost { background: #fff; }
.btn-soft { background: var(--brand-soft); color: var(--brand); border-color: #dfe3ff; }
.btn-danger { background: var(--red-soft); color: var(--red); border-color: #fecaca; }
.btn-block { width: 100%; }
.btn-sm { padding: 7px 11px; font-size: 13px; border-radius: 10px; }
.btn-outline-light {
  background: rgba(255, 255, 255, .12);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, .4);
  margin-top: 22px;
}
.btn-outline-light:hover { background: rgba(255, 255, 255, .22); }

/* ---------- Formulaires ---------- */
.field { display: block; margin-bottom: 13px; }
.field > span:first-child { display: block; font-size: 13px; font-weight: 600; color: var(--ink-2); margin-bottom: 6px; }
.field input, .field select, .field textarea {
  width: 100%;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--brand-600);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, .13);
}
.field textarea { min-height: 84px; resize: vertical; }
.field-pwd { position: relative; display: block; }
.field-pwd input { padding-right: 46px; }
.pwd-toggle {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  width: 34px; height: 34px; border: none; background: transparent;
  color: var(--muted); cursor: pointer; display: grid; place-items: center;
}
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-error {
  background: var(--red-soft); color: var(--red);
  border-radius: 11px; padding: 10px 12px; font-size: 13.5px; font-weight: 600;
  margin-bottom: 12px;
}
.form-ok {
  background: var(--green-soft); color: #166534;
  border-radius: 11px; padding: 10px 12px; font-size: 13.5px; font-weight: 600;
  margin-bottom: 12px;
}
.form-hint { font-size: 12.5px; color: var(--muted); margin-top: -6px; margin-bottom: 12px; }

/* ---------- Recherche ---------- */
.search-bar { display: flex; gap: 10px; margin-bottom: 14px; }
.search-input {
  flex: 1; position: relative; display: flex; align-items: center;
}
.search-input svg { position: absolute; left: 12px; color: var(--muted-2); }
.search-input input {
  width: 100%; padding: 11px 13px 11px 40px;
  border: 1px solid var(--line); border-radius: 12px; background: #fff; outline: none;
}
.search-input input:focus { border-color: var(--brand-600); box-shadow: 0 0 0 3px rgba(79, 70, 229, .13); }

.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 12px; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  border: 1px solid var(--line); background: #fff; color: var(--ink-2);
  border-radius: 999px; padding: 7px 14px; font-size: 13px; font-weight: 600;
  cursor: pointer; white-space: nowrap;
}
.chip.active { background: var(--brand); border-color: var(--brand); color: #fff; }

/* ---------- Listes / fiches ---------- */
.list { display: flex; flex-direction: column; gap: 10px; }
.row-item {
  display: flex; align-items: center; gap: 12px;
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 14px; box-shadow: var(--shadow-sm);
  cursor: pointer; transition: box-shadow .18s, transform .12s;
}
.row-item:hover { box-shadow: var(--shadow); }
.row-item:active { transform: scale(.995); }
.row-main { flex: 1; min-width: 0; }
.row-name { font-weight: 700; font-size: 15px; display: flex; align-items: center; gap: 7px; }
.row-meta { font-size: 12.5px; color: var(--muted); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-end { text-align: right; flex: none; }
.row-amount { font-weight: 750; font-size: 14.5px; }
.avatar {
  width: 42px; height: 42px; border-radius: 13px; flex: none;
  display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 14.5px;
  letter-spacing: .3px;
}
.avatar.sm { width: 32px; height: 32px; border-radius: 10px; font-size: 12px; }

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11.5px; font-weight: 700; padding: 3px 9px; border-radius: 999px;
  background: var(--brand-soft); color: var(--brand);
}
.badge.actif, .badge.gagne { background: var(--green-soft); color: #15803d; }
.badge.inactif, .badge.perdu { background: var(--red-soft); color: #b91c1c; }
.badge.prospect { background: var(--orange-soft); color: #c2410c; }
.badge.gray { background: #f1f5f9; color: var(--muted); }
.tag { font-size: 11.5px; font-weight: 600; color: var(--muted); background: #f1f5f9; border-radius: 7px; padding: 2px 8px; }

.empty {
  text-align: center; padding: 34px 18px; color: var(--muted);
  background: #fff; border: 1px dashed var(--line); border-radius: var(--radius);
}
.empty svg { color: var(--muted-2); margin-bottom: 8px; }

/* ---------- Pipeline (glisser-déposer) ---------- */
.pipeline-wrap { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 12px; scroll-snap-type: x mandatory; }
.stage-col {
  flex: 0 0 82%;
  max-width: 320px;
  scroll-snap-align: start;
  background: #eef1f8;
  border-radius: var(--radius);
  padding: 10px;
  display: flex; flex-direction: column;
  min-height: 180px;
  transition: background .18s, outline-color .18s;
  outline: 2px dashed transparent;
}
.stage-col.drag-over { background: #e0e7ff; outline-color: var(--brand-600); }
.stage-col-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 9px; padding: 0 4px; }
.stage-col-title { display: flex; align-items: center; gap: 7px; font-weight: 700; font-size: 13.5px; }
.stage-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.stage-count { font-size: 12px; font-weight: 700; color: var(--muted); background: #fff; border-radius: 999px; padding: 2px 9px; }
.stage-total { font-size: 11.5px; color: var(--muted); padding: 0 4px 8px; font-weight: 600; }
.stage-cards { display: flex; flex-direction: column; gap: 9px; min-height: 40px; flex: 1; }

.p-card {
  background: #fff; border-radius: var(--radius-sm); padding: 11px;
  box-shadow: var(--shadow-sm); border: 1px solid var(--line);
  cursor: grab; touch-action: pan-y;
}
.p-card:active { cursor: grabbing; }
.p-card.dragging { opacity: .45; }
.p-card-top { display: flex; align-items: center; gap: 9px; }
.p-card-name { font-weight: 700; font-size: 14px; }
.p-card-co { font-size: 12px; color: var(--muted); }
.p-card-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 9px; }
.p-amount { font-weight: 750; font-size: 14px; }
.p-prob { font-size: 11.5px; font-weight: 700; color: var(--brand); background: var(--brand-soft); border-radius: 999px; padding: 2px 8px; }
.p-hint { font-size: 11px; color: var(--muted-2); margin-top: 7px; display: flex; align-items: center; gap: 5px; }

/* ---------- Agenda ---------- */
.agenda-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.week-strip { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 5px; margin-bottom: 14px; }
.day-cell {
  background: #fff; border: 1px solid var(--line); border-radius: 12px;
  padding: 8px 3px; text-align: center; cursor: pointer;
  transition: background .15s, border-color .15s;
}
.day-cell .dow { font-size: 10.5px; color: var(--muted); text-transform: uppercase; font-weight: 700; }
.day-cell .num { font-size: 15px; font-weight: 750; }
.day-cell.today .num { color: var(--brand); }
.day-cell.active { background: var(--brand); border-color: var(--brand); }
.day-cell.active .dow, .day-cell.active .num { color: #fff; }
.day-cell .dot { width: 5px; height: 5px; border-radius: 50%; background: var(--brand); margin: 3px auto 0; }
.day-cell.active .dot { background: #fff; }

.rdv-item {
  display: flex; gap: 12px; background: #fff; border: 1px solid var(--line);
  border-radius: var(--radius); padding: 12px 14px; margin-bottom: 10px;
  box-shadow: var(--shadow-sm); cursor: pointer;
}
.rdv-time { flex: none; width: 62px; text-align: center; }
.rdv-hour { font-weight: 800; font-size: 15px; }
.rdv-dur { font-size: 11px; color: var(--muted); }
.rdv-line { width: 4px; border-radius: 4px; background: var(--brand); flex: none; }
.rdv-body { flex: 1; min-width: 0; }
.rdv-title { font-weight: 700; font-size: 14.5px; }
.rdv-meta { font-size: 12.5px; color: var(--muted); margin-top: 2px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.rdv-actions { display: flex; gap: 6px; margin-top: 9px; flex-wrap: wrap; }
.rdv-item.done { opacity: .62; }
.rdv-item.done .rdv-line { background: var(--green); }
.rdv-item.cancelled { opacity: .55; }
.rdv-item.cancelled .rdv-line { background: var(--red); }

/* ---------- Graphiques ---------- */
.chart-box { position: relative; height: 220px; }
.bars { display: flex; align-items: flex-end; gap: 8px; height: 160px; padding-top: 8px; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.bar {
  width: 100%; max-width: 34px; border-radius: 8px 8px 4px 4px;
  background: linear-gradient(180deg, var(--brand-600), var(--brand));
  min-height: 4px; transition: height .5s ease;
}
.bar-label { font-size: 10.5px; color: var(--muted); font-weight: 600; }
.share-row { display: flex; align-items: center; gap: 10px; margin-bottom: 9px; }
.share-label { flex: 1; font-size: 13px; font-weight: 600; }
.share-track { flex: 1.2; height: 8px; border-radius: 999px; background: #eef1f8; overflow: hidden; }
.share-fill { height: 100%; border-radius: 999px; background: var(--brand); }
.share-val { width: 46px; text-align: right; font-size: 12.5px; font-weight: 700; color: var(--muted); }

.donut-wrap { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.legend { display: flex; flex-direction: column; gap: 7px; flex: 1; min-width: 130px; }
.legend-item { display: flex; align-items: center; gap: 8px; font-size: 12.5px; }
.legend-item .stage-dot { width: 10px; height: 10px; }
.legend-item b { margin-left: auto; font-size: 12.5px; }

/* ---------- Activités ---------- */
.timeline { display: flex; flex-direction: column; gap: 2px; }
.tl-item { display: flex; gap: 11px; padding: 9px 0; }
.tl-ico { width: 30px; height: 30px; border-radius: 10px; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; flex: none; }
.tl-text { font-size: 13.5px; font-weight: 600; }
.tl-date { font-size: 11.5px; color: var(--muted); }

/* ---------- Modale / tiroir ---------- */
.modal {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(15, 23, 42, .45);
  display: flex; align-items: flex-end; justify-content: center;
  padding: 0;
  animation: fade .18s ease;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.modal-card {
  background: #fff;
  width: 100%;
  max-width: 620px;
  max-height: 92vh;
  overflow-y: auto;
  border-radius: 22px 22px 0 0;
  padding: 18px 16px calc(22px + env(safe-area-inset-bottom, 0px));
  animation: slideUp .24s cubic-bezier(.2, .8, .3, 1);
}
@keyframes slideUp { from { transform: translateY(30px); opacity: .6; } to { transform: translateY(0); opacity: 1; } }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.modal-head h3 { font-size: 17px; }
.modal-close {
  border: none; background: #f1f5f9; color: var(--muted);
  width: 34px; height: 34px; border-radius: 11px; cursor: pointer;
  display: grid; place-items: center; flex: none;
}
.modal-actions { display: flex; gap: 10px; margin-top: 6px; }
.modal-actions .btn { flex: 1; }
.sheet-grab { width: 42px; height: 4px; border-radius: 999px; background: var(--line); margin: -6px auto 12px; }

.detail-hero { display: flex; align-items: center; gap: 13px; margin-bottom: 14px; }
.detail-hero .avatar { width: 54px; height: 54px; border-radius: 17px; font-size: 18px; }
.detail-name { font-size: 18px; font-weight: 800; }
.detail-co { font-size: 13px; color: var(--muted); }
.info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.info-cell { background: #f8fafc; border-radius: 12px; padding: 10px 12px; }
.info-cell .k { font-size: 11px; color: var(--muted); text-transform: uppercase; font-weight: 700; letter-spacing: .04em; }
.info-cell .v { font-size: 14px; font-weight: 650; word-break: break-word; }
.section-label { font-size: 12px; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin: 16px 0 9px; }
.note-item { background: #f8fafc; border-radius: 12px; padding: 11px 13px; margin-bottom: 8px; }
.note-text { font-size: 13.5px; }
.note-meta { font-size: 11.5px; color: var(--muted); margin-top: 5px; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.note-del { border: none; background: transparent; color: var(--red); cursor: pointer; font-size: 11.5px; font-weight: 700; padding: 0; }

/* ---------- Connexion ---------- */
.auth-wrap { min-height: 100vh; display: flex; flex-direction: column; }
.auth-aside {
  background: linear-gradient(150deg, var(--brand-700) 0%, var(--brand-600) 55%, #6d28d9 100%);
  color: #fff;
  padding: calc(env(safe-area-inset-top, 0px) + 40px) 24px 34px;
}
.auth-aside-inner { max-width: 460px; margin: 0 auto; }
.auth-aside h1 { font-size: 30px; margin: 16px 0 8px; }
.auth-tagline { opacity: .9; font-size: 14.5px; margin-bottom: 20px; max-width: 380px; }
.auth-points { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.auth-points li { display: flex; align-items: center; gap: 10px; font-size: 13.5px; opacity: .95; }
.auth-panel { flex: 1; display: flex; align-items: center; justify-content: center; padding: 26px 18px 40px; }
.auth-card { width: 100%; max-width: 420px; background: #fff; border-radius: 20px; padding: 22px; box-shadow: var(--shadow); border: 1px solid var(--line); }
.auth-card-head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.auth-card-head .brand-mark { background: var(--brand); border-color: transparent; }
.auth-card-head h2 { font-size: 19px; }
.auth-card-head p { font-size: 13px; color: var(--muted); }
.auth-note { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--muted); margin-top: 14px; }

/* ---------- Installation PWA ---------- */
.install-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(15, 23, 42, .5);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.install-modal {
  background: #fff; border-radius: 20px; padding: 22px 20px;
  max-width: 400px; width: 100%; position: relative; box-shadow: var(--shadow-lg);
}
.install-modal h3 { font-size: 17px; margin-bottom: 10px; }
.install-modal p { font-size: 13.5px; color: var(--ink-2); margin-bottom: 10px; }
.install-alt { color: var(--muted) !important; }
.install-logos { display: flex; gap: 14px; margin-top: 14px; }
.install-logos span { display: flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 700; color: var(--muted); }

/* ---------- Toasts ---------- */
.toast-stack { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--tab-h) + 22px); z-index: 300; display: flex; flex-direction: column; gap: 8px; width: max-content; max-width: 92vw; }
.toast {
  background: var(--ink); color: #fff; padding: 11px 16px; border-radius: 12px;
  font-size: 13.5px; font-weight: 600; box-shadow: var(--shadow-lg);
  animation: toastIn .22s ease;
}
.toast-success { background: var(--green); }
.toast-error { background: var(--red); }
.toast-info { background: var(--brand-700); }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.toast-out { opacity: 0; transition: opacity .3s; }

/* ---------- Tableaux (administration) ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); }
table.data { width: 100%; border-collapse: collapse; min-width: 560px; }
table.data th, table.data td { text-align: left; padding: 11px 13px; font-size: 13.5px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.data th { font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); background: #f8fafc; font-weight: 800; }
table.data tr:last-child td { border-bottom: none; }
table.data td.actions { display: flex; gap: 6px; }

/* ---------- FAB ---------- */
.fab {
  position: fixed; right: 18px;
  bottom: calc(var(--tab-h) + env(safe-area-inset-bottom, 0px) + 16px);
  z-index: 45;
  width: 56px; height: 56px; border-radius: 18px; border: none;
  background: linear-gradient(135deg, var(--brand-600), var(--brand));
  color: #fff; display: grid; place-items: center; cursor: pointer;
  box-shadow: 0 12px 26px rgba(79, 70, 229, .4);
}
.fab:active { transform: scale(.95); }

/* ---------- Menu latéral admin ---------- */
.admin-menu {
  position: fixed; inset: 0; z-index: 120; background: rgba(15, 23, 42, .45);
  display: flex; justify-content: flex-end;
}
.admin-menu-panel {
  width: min(84vw, 320px); height: 100%; background: #fff; padding: 18px 16px;
  display: flex; flex-direction: column; gap: 4px;
  padding-top: calc(env(safe-area-inset-top, 0px) + 18px);
  animation: slideLeft .2s ease;
}
@keyframes slideLeft { from { transform: translateX(30px); opacity: .7; } to { transform: translateX(0); opacity: 1; } }
.admin-menu-panel a {
  display: flex; align-items: center; gap: 11px; padding: 12px; border-radius: 12px;
  color: var(--ink-2); font-weight: 650; font-size: 14.5px;
}
.admin-menu-panel a.active { background: var(--brand-soft); color: var(--brand); }
.admin-menu-panel .sep { height: 1px; background: var(--line); margin: 8px 0; }

/* ---------- Écran de changement de mot de passe ---------- */
.gate {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 24px 18px; background: linear-gradient(150deg, var(--brand-700), var(--brand-600) 60%, #6d28d9);
}
.gate-card { background: #fff; border-radius: 20px; padding: 24px 20px; width: 100%; max-width: 420px; box-shadow: var(--shadow-lg); }
.gate-card h2 { font-size: 20px; margin-bottom: 6px; }
.gate-card > p { font-size: 13.5px; color: var(--muted); margin-bottom: 18px; }

/* ---------- Divers ---------- */
.stat-line { display: flex; align-items: center; justify-content: space-between; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.stat-line:last-child { border-bottom: none; }
.stat-line span { color: var(--muted); }
.stat-line b { font-weight: 750; }
.grid-2 { display: grid; grid-template-columns: 1fr; gap: 14px; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mb-14 { margin-bottom: 14px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.skeleton { background: linear-gradient(90deg, #eef1f8 25%, #e2e7f2 37%, #eef1f8 63%); background-size: 400% 100%; animation: sk 1.2s ease infinite; border-radius: 10px; height: 14px; }
@keyframes sk { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

/* ---------- Responsive ---------- */
@media (min-width: 720px) {
  .kpi-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .grid-2 { grid-template-columns: 1.15fr .85fr; }
  .stage-col { flex: 0 0 268px; }
  .modal { align-items: center; padding: 24px; }
  .modal-card { border-radius: 20px; max-height: 88vh; }
  .auth-wrap { flex-direction: row; }
  .auth-aside { flex: 1; display: flex; align-items: center; padding-top: 60px; }
  .auth-panel { flex: 1; }
  .auth-card { max-width: 430px; }
  .fab { bottom: calc(var(--tab-h) + 22px); }
}

@media (min-width: 1024px) {
  .kpi-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .container { padding: 22px 24px calc(var(--tab-h) + 40px); }
}
