/* ====================================================================
   Olmess Fashion — surcouche thème (par-dessus le template Affan)
   Charte : bleu #1565c0 · blanc · accents rouge/or pour le sémantique
   ==================================================================== */

:root {
  --olm-primary: #1565c0;
  --olm-primary-dark: #0d47a1;
  --olm-primary-soft: #e8f1fb;
  --olm-red: #c0392b;
  --olm-gold: #d4890a;
  --olm-bg: #f5f8fd;
  --olm-ink: #1f2933;
  --olm-muted: #66727f;
  --olm-line: #e7ebf1;
}

/* --- Réassignation des couleurs Bootstrap du template --- */
.olmess {
  --bs-primary: #1565c0;
  --bs-primary-rgb: 21, 101, 192;
  background-color: var(--olm-bg);
  color: var(--olm-ink);
}
.olmess .btn-primary {
  --bs-btn-bg: var(--olm-primary);
  --bs-btn-border-color: var(--olm-primary);
  --bs-btn-hover-bg: var(--olm-primary-dark);
  --bs-btn-hover-border-color: var(--olm-primary-dark);
  --bs-btn-active-bg: var(--olm-primary-dark);
  --bs-btn-disabled-bg: var(--olm-primary);
  --bs-btn-disabled-border-color: var(--olm-primary);
}
.olmess .text-primary { color: var(--olm-primary) !important; }
.olmess .bg-primary { background-color: var(--olm-primary) !important; }
.olmess a { color: var(--olm-primary); }

/* --- Header / logo --- */
.olmess .header-area { background: #fff; box-shadow: 0 1px 0 var(--olm-line); }
/* surclasse la règle du template (.header-content .logo-wrapper a img { max-height:26px }) */
.olmess .header-content .logo-wrapper a img.olmess-logo-img {
  max-height: 52px; height: 52px; width: auto; display: block;
}

/* Indicateur de connexion : VERT en ligne, ROUGE hors ligne */
.sync-indicator {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px; font-weight: 600; color: #0f6e2e;
  padding: 4px 10px; border-radius: 999px; background: #e8f5ee;
}
.sync-indicator::before {
  content: ""; width: 8px; height: 8px; border-radius: 50%; background: #16a34a;
}
.sync-indicator.offline { background: #fdecea; color: var(--olm-red); }
.sync-indicator.offline::before { background: var(--olm-red); }
.sync-indicator.syncing { background: #fff3cd; color: #8a6d00; }
.sync-indicator.syncing::before { background: var(--olm-gold); animation: syncPulse 1s ease-in-out infinite; }
@keyframes syncPulse { 0%, 100% { opacity: 1; } 50% { opacity: .3; } }

/* --- Layout général --- */
.olmess .page-content-wrapper { padding-top: 12px; min-height: 70vh; }
.olmess .screen { padding-bottom: 90px; }
.screen-title { font-size: 19px; font-weight: 600; margin: 4px 0 14px; }
.section-label {
  font-size: 12px; text-transform: uppercase; letter-spacing: .04em;
  color: var(--olm-muted); margin: 18px 0 8px; font-weight: 600;
}

/* --- Cartes --- */
.olmess .card { border: none; border-radius: 14px; box-shadow: 0 2px 10px rgba(31,41,51,.05); }

/* --- Tableau de bord : stats --- */
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.stat-card {
  background: #fff; border-radius: 14px; padding: 16px;
  box-shadow: 0 2px 10px rgba(31,41,51,.05);
  display: flex; flex-direction: column; gap: 2px;
}
.stat-card .stat-ico {
  width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center;
  font-size: 20px; margin-bottom: 6px;
}
.stat-card .stat-num { font-size: 26px; font-weight: 700; line-height: 1; color: var(--olm-ink); }
.stat-card .stat-lbl { font-size: 12px; color: var(--olm-muted); }
.ico-green { background: var(--olm-primary-soft); color: var(--olm-primary); }
.ico-gold  { background: #fbf0dc; color: var(--olm-gold); }
.ico-red   { background: #fdecea; color: var(--olm-red); }
.ico-blue  { background: #e7f0fb; color: #2563eb; }

/* --- Listes (clients, commandes, rdv) --- */
.list-row {
  display: flex; align-items: center; gap: 12px;
  background: #fff; border-radius: 12px; padding: 12px 14px; margin-bottom: 10px;
  box-shadow: 0 2px 8px rgba(31,41,51,.04); text-decoration: none; color: inherit;
}
.list-row:active { transform: scale(.99); }
.avatar {
  width: 44px; height: 44px; border-radius: 50%; flex: 0 0 auto;
  display: grid; place-items: center; font-weight: 700; color: #fff; font-size: 15px;
  background: var(--olm-primary); aspect-ratio: 1;
}
.avatar.c-purple { background: #7c3aed; }
.avatar.c-blue   { background: #2563eb; }
.avatar.c-pink   { background: #db2777; }
.avatar.c-green  { background: var(--olm-primary); }
.avatar.c-gold   { background: var(--olm-gold); }
.avatar.c-red    { background: var(--olm-red); }
.list-main { flex: 1; min-width: 0; }
.list-main .l-title { font-weight: 600; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-main .l-sub { font-size: 12.5px; color: var(--olm-muted); }
.list-end { text-align: right; font-size: 12px; color: var(--olm-muted); flex: 0 0 auto; }
.list-chevron { flex: 0 0 auto; color: var(--olm-muted); font-size: 20px; margin-left: 4px; }

/* Bandeau « données hors ligne » */
.offline-note {
  display: flex; align-items: center; gap: 8px;
  background: #fff8e1; color: #8a6d00; border: 1px solid #f3e2a8;
  border-radius: 10px; padding: 9px 12px; font-size: 12.5px; margin-bottom: 12px;
}
.offline-note i { font-size: 16px; }

/* --- Badges de statut --- */
.badge-statut {
  display: inline-block; font-size: 11px; font-weight: 600;
  padding: 3px 9px; border-radius: 999px;
}
.st-en_attente    { background: #f1f3f5; color: #5b6770; }
.st-mesures_prises{ background: #e7f0fb; color: #2563eb; }
.st-en_confection { background: #fbf0dc; color: #b9770a; }
.st-en_essayage   { background: #efe7fb; color: #7c3aed; }
.st-terminee      { background: var(--olm-primary-soft); color: var(--olm-primary); }
.st-livree        { background: #e2e8e2; color: #344e3a; }

/* --- Filtres (chips) --- */
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 10px; -webkit-overflow-scrolling: touch; }
.chip {
  flex: 0 0 auto; border: 1px solid var(--olm-line); background: #fff;
  border-radius: 999px; padding: 6px 14px; font-size: 13px; color: var(--olm-muted);
  white-space: nowrap; cursor: pointer;
}
.chip.active { background: var(--olm-primary); color: #fff; border-color: var(--olm-primary); }

/* --- Recherche --- */
.search-box { position: relative; margin-bottom: 12px; }
.search-box i { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--olm-muted); }
.search-box input {
  width: 100%; border: 1px solid var(--olm-line); border-radius: 12px;
  padding: 11px 14px 11px 40px; font-size: 14px; background: #fff;
}
.search-box input:focus { outline: none; border-color: var(--olm-primary); }

/* --- Stepper de statut (labels alternés haut/bas → tient sans scroll) --- */
.stepper { display: flex; align-items: center; width: 100%; padding: 32px 0; position: relative; }
.step { flex: 1 1 0; min-width: 0; text-align: center; position: relative; }
.step .dot {
  width: 24px; height: 24px; border-radius: 50%; margin: 0 auto;
  display: grid; place-items: center; background: #e3e6ea; color: #fff; font-size: 12px;
  position: relative; z-index: 2;
}
.step.done .dot { background: #16a34a; }                 /* étape validée → VERT */
.step.current .dot { background: var(--olm-primary); }   /* étape en cours → bleu */
.step.current .dot { box-shadow: 0 0 0 4px var(--olm-primary-soft); }
.step.done .lbl { color: #16a34a; }
.step .lbl {
  position: absolute; left: 50%; transform: translateX(-50%);
  width: 66px; font-size: 10px; line-height: 1.15; color: var(--olm-muted);
}
.step:nth-child(odd) .lbl { top: 30px; }      /* étapes 1,3,5 : titre EN BAS du chiffre */
.step:nth-child(even) .lbl { bottom: 30px; }  /* étapes 2,4,6 : titre EN HAUT du chiffre */
.step.current .lbl { color: var(--olm-primary); font-weight: 600; }
.step::before {
  content: ""; position: absolute; top: 11px; left: -50%; width: 100%; height: 3px;
  background: #e3e6ea; z-index: 1;
}
.step:first-child::before { display: none; }
.step.done::before, .step.current::before { background: #16a34a; }  /* trait validé → VERT */

/* --- Grille de mesures --- */
.mesure-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.mesure-field label { font-size: 12px; color: var(--olm-muted); display: block; margin-bottom: 3px; }
.mesure-field .inp { display: flex; align-items: center; border: 1px solid var(--olm-line); border-radius: 10px; background: #fff; }
.mesure-field input { border: none; background: transparent; padding: 10px 12px; width: 100%; font-size: 15px; }
.mesure-field input:focus { outline: none; }
.mesure-field .unit { padding: 0 12px; color: var(--olm-muted); font-size: 12px; }

/* --- Paiements : barre de progression --- */
.pay-bar { height: 8px; border-radius: 999px; background: #eceef1; overflow: hidden; }
.pay-bar > span { display: block; height: 100%; background: var(--olm-primary); border-radius: 999px; }

/* --- Photos --- */
.photo-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.photo-thumb { position: relative; aspect-ratio: 1; border-radius: 10px; overflow: hidden; background: #eceef1; }
.photo-thumb img { width: 100%; height: 100%; object-fit: cover; }
.photo-thumb .del { position: absolute; top: 4px; right: 4px; background: rgba(0,0,0,.55); color: #fff; border: none; border-radius: 50%; width: 24px; height: 24px; font-size: 13px; }

/* --- État vide --- */
.empty { text-align: center; color: var(--olm-muted); padding: 48px 20px; }
.empty i { font-size: 44px; opacity: .35; display: block; margin-bottom: 10px; }

/* --- Boutons larges --- */
.btn-block { width: 100%; }
.btn-soft { background: var(--olm-primary-soft); color: var(--olm-primary); border: none; font-weight: 600; }

/* ============================ FAB ============================ */
.olmess-fab-wrap { position: fixed; right: 18px; bottom: 84px; z-index: 1040; }
.olmess-fab {
  width: 56px; height: 56px; border-radius: 50%; border: none;
  background: var(--olm-primary); color: #fff; font-size: 26px;
  box-shadow: 0 6px 18px rgba(15,110,46,.4); display: grid; place-items: center;
  transition: transform .2s;
}
.olmess-fab-wrap.open .olmess-fab { transform: rotate(45deg); }
.olmess-fab-overlay {
  position: fixed; inset: 0; background: rgba(31,41,51,.35);
  opacity: 0; visibility: hidden; transition: .2s; z-index: -1;
}
.olmess-fab-wrap.open .olmess-fab-overlay { opacity: 1; visibility: visible; }
.olmess-fab-menu {
  position: absolute; right: 0; bottom: 70px; display: flex; flex-direction: column;
  gap: 10px; align-items: flex-end; opacity: 0; visibility: hidden; transform: translateY(10px);
  transition: .2s;
}
.olmess-fab-wrap.open .olmess-fab-menu { opacity: 1; visibility: visible; transform: translateY(0); }
.olmess-fab-item {
  display: inline-flex; align-items: center; gap: 10px; background: #fff; border: none;
  border-radius: 999px; padding: 10px 16px; font-size: 13.5px; font-weight: 600; color: var(--olm-ink);
  box-shadow: 0 4px 14px rgba(31,41,51,.15); white-space: nowrap;
}
.olmess-fab-item i { color: var(--olm-primary); font-size: 18px; }

/* ====================== Bottom sheet ====================== */
.olmess-sheet-backdrop {
  position: fixed; inset: 0; background: rgba(31,41,51,.45);
  opacity: 0; visibility: hidden; transition: .2s; z-index: 1050;
}
.olmess-sheet-backdrop.show { opacity: 1; visibility: visible; }
.olmess-sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 1060;
  background: #fff; border-radius: 20px 20px 0 0; padding: 8px 18px calc(24px + env(safe-area-inset-bottom));
  transform: translateY(100%); transition: transform .25s ease;
  max-height: 90vh; overflow-y: auto;
}
.olmess-sheet.show { transform: translateY(0); }
.olmess-sheet-handle { width: 42px; height: 4px; border-radius: 999px; background: #d9dde2; margin: 6px auto 10px; }
.olmess-sheet-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.olmess-sheet-header h6 { font-size: 16px; font-weight: 600; }
.olmess-sheet-close { border: none; background: #f1f3f5; width: 32px; height: 32px; border-radius: 50%; color: var(--olm-muted); }

/* --- Formulaires dans le sheet --- */
.olmess-sheet .form-group { margin-bottom: 14px; }
.olmess-sheet label.flbl { font-size: 13px; color: var(--olm-muted); display: block; margin-bottom: 5px; font-weight: 500; }
.olmess-sheet .req::after { content: " *"; color: var(--olm-red); }
.olmess-sheet input, .olmess-sheet select, .olmess-sheet textarea {
  width: 100%; border: 1px solid var(--olm-line); border-radius: 11px;
  padding: 12px 14px; font-size: 15px; background: #fff; color: var(--olm-ink);
}
.olmess-sheet input:focus, .olmess-sheet select:focus, .olmess-sheet textarea:focus {
  outline: none; border-color: var(--olm-primary);
}
.olmess-sheet textarea { min-height: 78px; resize: vertical; }
.type-picker { display: flex; flex-wrap: wrap; gap: 8px; }
.type-opt {
  border: 1px solid var(--olm-line); border-radius: 999px; padding: 8px 14px;
  font-size: 13px; background: #fff; cursor: pointer;
}
.type-opt.active { background: var(--olm-primary); color: #fff; border-color: var(--olm-primary); }

/* ====================== Confirmation ====================== */
.olmess-confirm-backdrop {
  position: fixed; inset: 0; background: rgba(31,41,51,.5); z-index: 1080;
  display: none; align-items: center; justify-content: center; padding: 24px;
}
.olmess-confirm-backdrop.show { display: flex; }
.olmess-confirm { background: #fff; border-radius: 16px; padding: 22px; max-width: 340px; width: 100%; box-shadow: 0 10px 40px rgba(0,0,0,.2); }
.olmess-confirm p { font-size: 14.5px; }

/* ====================== Toast (rectangle propre + icône) ====================== */
.olmess-toast {
  position: fixed; left: 50%; bottom: 100px; transform: translateX(-50%) translateY(20px);
  display: flex; align-items: center; gap: 10px;
  background: #fff; color: var(--olm-ink); padding: 13px 16px; border-radius: 12px;
  border-left: 4px solid var(--olm-ink);
  box-shadow: 0 8px 28px rgba(31,41,51,.18);
  font-size: 13.5px; line-height: 1.3; z-index: 1090;
  opacity: 0; visibility: hidden; transition: .25s;
  width: calc(100% - 32px); max-width: 420px; text-align: left;
}
.olmess-toast.show { opacity: 1; visibility: visible; transform: translateX(-50%) translateY(0); }
.olmess-toast .t-ico { flex: 0 0 auto; width: 24px; height: 24px; border-radius: 7px; display: grid; place-items: center; font-size: 15px; color: #fff; }
.olmess-toast .t-msg { flex: 1; }
.olmess-toast.err { border-left-color: var(--olm-red); }
.olmess-toast.err .t-ico { background: var(--olm-red); }
.olmess-toast.ok { border-left-color: #16a34a; }
.olmess-toast.ok .t-ico { background: #16a34a; }
.olmess-toast.info .t-ico { background: var(--olm-primary); }
.olmess-toast.info { border-left-color: var(--olm-primary); }

/* --- Footer nav actif en vert --- */
.olmess .footer-nav li.active a, .olmess .footer-nav li.active a i { color: var(--olm-primary); }

/* --- Divers --- */
.row-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.kpi-line { display: flex; justify-content: space-between; font-size: 14px; padding: 7px 0; border-bottom: 1px solid var(--olm-line); }
.kpi-line:last-child { border-bottom: none; }
.kpi-line .v { font-weight: 600; }
.muted { color: var(--olm-muted); }
.fz-12 { font-size: 12px; }
.mb-cta { margin-bottom: 10px; }

/* ====================== Splash / écran de chargement ====================== */
#preloader {
  position: fixed; inset: 0; z-index: 2000;
  background: #fff; display: flex; align-items: center; justify-content: center;
  transition: opacity .4s ease;
}
.olmess-splash { display: flex; flex-direction: column; align-items: center; gap: 16px; }
.splash-logo {
  width: 124px; height: auto;
  animation: splashPulse 1.4s ease-in-out infinite;
}
.splash-text {
  font-size: 20px; font-weight: 700; letter-spacing: .2em;
  background: linear-gradient(90deg, var(--olm-primary) 20%, #8fc0f0 50%, var(--olm-primary) 80%);
  background-size: 200% auto;
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
  animation: splashShine 1.8s linear infinite;
}
.splash-bar { width: 124px; height: 3px; border-radius: 999px; background: var(--olm-primary-soft); overflow: hidden; }
.splash-bar > span {
  display: block; width: 40%; height: 100%; border-radius: 999px; background: var(--olm-primary);
  animation: splashBar 1.15s ease-in-out infinite;
}
@keyframes splashPulse { 0%, 100% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.08); opacity: .82; } }
@keyframes splashShine { to { background-position: -200% center; } }
@keyframes splashBar { 0% { transform: translateX(-130%); } 100% { transform: translateX(330%); } }

/* --- Mini-loader de données (entre écrans), à la place du spinner bleu --- */
.olmess-loading { padding: 46px 20px; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.ol-load-text {
  font-size: 14px; font-weight: 700; letter-spacing: .18em;
  background: linear-gradient(90deg, var(--olm-primary) 20%, #8fc0f0 50%, var(--olm-primary) 80%);
  background-size: 200% auto;
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
  animation: splashShine 1.6s linear infinite;
}
.ol-load-bar { width: 140px; height: 3px; border-radius: 999px; background: var(--olm-primary-soft); overflow: hidden; }
.ol-load-bar > span {
  display: block; width: 40%; height: 100%; border-radius: 999px; background: var(--olm-primary);
  animation: splashBar 1.15s ease-in-out infinite;
}

/* ====================== Connexion (login en dur) ====================== */
body.auth-locked .header-area,
body.auth-locked .footer-nav-area,
body.auth-locked .olmess-fab-wrap { display: none !important; }
.auth-screen {
  min-height: 86vh; display: flex; flex-direction: column;
  align-items: center; justify-content: center; padding: 28px 22px; text-align: center;
}
.auth-logo { width: 112px; height: auto; margin-bottom: 8px; }
.auth-title { font-size: 22px; font-weight: 700; color: var(--olm-ink); margin: 2px 0 0; }
.auth-sub { font-size: 13px; color: var(--olm-muted); margin: 4px 0 22px; }
.auth-card {
  background: #fff; border-radius: 16px; padding: 22px;
  box-shadow: 0 6px 24px rgba(31,41,51,.08); width: 100%; max-width: 360px; text-align: left;
}
.auth-card .form-group { margin-bottom: 14px; }
.auth-card label.flbl { font-size: 13px; color: var(--olm-muted); display: block; margin-bottom: 5px; font-weight: 500; }
.auth-card input {
  width: 100%; border: 1px solid var(--olm-line); border-radius: 11px;
  padding: 12px 14px; font-size: 15px; background: #fff; color: var(--olm-ink);
}
.auth-card input:focus { outline: none; border-color: var(--olm-primary); }
