/* ===== FRIPSCAN STYLE — v3 propre ===== */
@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700;800;900&family=Plus+Jakarta+Sans:wght@400;500;600;700&display=swap');

:root {
  --bg:       #0d1117;
  --bg2:      #161b24;
  --bg3:      #1e2635;
  --border:   rgba(255,255,255,0.08);
  --primary:  #f72585;
  --purple:   #7b2fff;
  --cyan:     #4facfe;
  --green:    #38ef7d;
  --orange:   #f6ad55;
  --red:      #fc8181;
  --text:     #f0f4f8;
  --text2:    #a0aec0;
  --text3:    #64748b;
  --radius:   14px;
  --font:     'Plus Jakarta Sans', sans-serif;
  --font-h:   'Nunito', sans-serif;
  --shadow:   0 8px 32px rgba(0,0,0,0.4);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; background: var(--bg); color: var(--text); font-family: var(--font); font-size: 15px; line-height: 1.5; -webkit-font-smoothing: antialiased; }

/* ===== CENTRAGE TABLETTE / DESKTOP ===== */
/* Bande sombre sur les côtés pour montrer que c'est une app mobile */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background: radial-gradient(ellipse at 50% 0%, rgba(123,47,255,0.06) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}
#appRoot {
  max-width: 500px;
  width: 100%;
  margin: 0 auto;
  position: relative;
  min-height: 100vh;
  background: var(--bg);
  box-shadow: 0 0 60px rgba(0,0,0,0.8), 0 0 0 1px rgba(255,255,255,0.03);
  isolation: isolate;
}

/* Fond latéral visible uniquement sur grands écrans */
@media (min-width: 520px) {
  body {
    background: #080a10;
  }
}
a { color: var(--cyan); text-decoration: none; }
button { font-family: var(--font); cursor: pointer; border: none; }
input, select, textarea { font-family: var(--font); }

/* ===== PAGES ===== */
#pageAuth, #pageOnboarding, #pageAccueil, #pageTarifs, #pageProfil {
  min-height: 100vh; flex-direction: column; align-items: center;
}
#pageScanner, #pageHistorique { min-height: 100vh; }

/* ===== AUTH ===== */
.auth-bg {
  width: 100%; min-height: 100vh;
  background: radial-gradient(ellipse at 20% 50%, rgba(123,47,255,0.15) 0%, transparent 60%),
              radial-gradient(ellipse at 80% 20%, rgba(247,37,133,0.12) 0%, transparent 50%),
              var(--bg);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.auth-card {
  width: 100%; max-width: 420px;
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: 20px; padding: 36px 28px; box-shadow: var(--shadow);
}
.auth-logo { text-align: center; margin-bottom: 28px; }
.logo-circle {
  width: 72px; height: 72px; border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--purple));
  display: flex; align-items: center; justify-content: center;
  font-size: 32px; margin: 0 auto 12px;
}
.logo-name { font-family: var(--font-h); font-size: 36px; font-weight: 800; color: var(--primary); }
.logo-tagline { color: var(--purple); font-style: italic; font-size: 14px; margin: 6px 0 4px; line-height: 1.4; }
.logo-sub { color: var(--text2); font-size: 13px; }

.btn-google {
  width: 100%; padding: 13px; background: white; border-radius: 10px;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  font-weight: 600; font-size: 14px; color: #333; transition: opacity .2s;
}
.btn-google:hover { opacity: .9; }
.auth-divider { display: flex; align-items: center; gap: 10px; margin: 14px 0; color: var(--text3); font-size: 13px; }
.auth-divider::before, .auth-divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }

.input-group {
  display: flex; align-items: center; gap: 10px;
  background: var(--bg3); border: 1px solid var(--border); border-radius: 10px;
  padding: 12px 14px; margin-bottom: 10px;
}
.input-group input { flex: 1; background: none; border: none; outline: none; color: var(--text); font-size: 14px; }
.input-group input::placeholder { color: var(--text3); }
.input-icon { color: var(--text3); font-size: 14px; flex-shrink: 0; }
.btn-eye { background: none; color: var(--text3); padding: 0; font-size: 14px; }

.link-mdp { display: block; text-align: right; font-size: 13px; color: var(--cyan); margin-bottom: 14px; }

.btn-primary {
  width: 100%; padding: 14px; border-radius: 10px;
  background: linear-gradient(135deg, var(--primary), var(--purple));
  color: white; font-weight: 700; font-size: 15px; transition: opacity .2s;
}
.btn-primary:hover { opacity: .9; }
.btn-secondary {
  width: 100%; padding: 12px; border-radius: 10px;
  background: transparent; border: 1px solid rgba(255,255,255,0.2);
  color: var(--text2); font-weight: 600; font-size: 14px; transition: all .2s;
}
.btn-secondary:hover { border-color: rgba(255,255,255,0.4); color: white; }
.auth-switch { text-align: center; font-size: 13px; color: var(--text2); margin-top: 14px; }
.auth-cgu { text-align: center; font-size: 11px; color: var(--text3); margin-top: 10px; line-height: 1.5; }

/* ===== ONBOARDING ===== */
.ob-container {
  width: 100%; max-width: 440px; padding: 32px 20px;
  background: radial-gradient(ellipse at top, rgba(123,47,255,0.1), transparent 60%), var(--bg);
  min-height: 100vh;
}
.ob-titre { font-family: var(--font-h); font-size: 26px; font-weight: 700; margin: 16px 0 8px; }
.ob-sub { color: var(--text2); font-size: 13px; margin-bottom: 20px; line-height: 1.6; }
.ob-form { display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px; }
.ob-input {
  width: 100%; padding: 13px 14px; background: var(--bg2);
  border: 1px solid var(--border); border-radius: 10px;
  color: var(--text); font-size: 14px; outline: none; transition: border-color .2s;
}
.ob-input:focus { border-color: var(--purple); }
.ob-input::placeholder { color: var(--text3); }
.mt16 { margin-top: 16px; }
.mt8  { margin-top: 8px; }

/* ===== ACCUEIL ===== */
.accueil-wrap {
  width: 100%; max-width: 500px; margin: 0 auto; padding: 0 0 80px;
  min-height: 100vh;
}
.accueil-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; position: sticky; top: 0; z-index: 10;
  background: var(--bg); border-bottom: 1px solid var(--border);
}
.header-logo { font-family: var(--font-h); font-size: 22px; font-weight: 800; color: var(--primary); }
.header-right { position: relative; }

.btn-avatar {
  width: 40px; height: 40px; border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--purple));
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-h); font-weight: 700; font-size: 16px; color: white; cursor: pointer;
}

.dropdown-menu {
  position: absolute; top: 48px; right: 0; width: 240px;
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: 14px; box-shadow: var(--shadow); overflow: hidden; z-index: 100;
  flex-direction: column;
}
.dropdown-user { display: flex; align-items: center; gap: 12px; padding: 14px 16px; }
.dropdown-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--purple));
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px; color: white;
}
.dropdown-name { font-weight: 600; font-size: 14px; }
.dropdown-sep { height: 1px; background: var(--border); margin: 2px 0; }
.dropdown-item {
  display: block; width: 100%; padding: 12px 16px; text-align: left;
  background: none; color: var(--text); font-size: 14px; transition: background .15s;
}
.dropdown-item:hover { background: var(--bg3); }
.dropdown-item.danger { color: var(--red); }

/* Bandeau plan */
.plan-bandeau {
  margin: 12px 16px; padding: 14px 16px;
  background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius);
}
.plan-info { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.plan-label { color: var(--text2); font-size: 13px; }
.plan-nom { font-weight: 700; font-size: 14px; color: var(--text); }
.plan-link { font-size: 12px; color: var(--cyan); display: block; margin-bottom: 10px; }
.plan-quotas { display: flex; gap: 16px; }
.quota-item { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text2); }
.quota-icon { font-size: 14px; }
.quota-val { font-weight: 600; color: var(--text); }

/* Modes */
.modes-wrap { padding: 8px 16px; display: flex; flex-direction: column; gap: 10px; }
.btn-mode {
  display: flex; align-items: center; gap: 14px; padding: 18px 16px;
  background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius);
  text-align: left; transition: border-color .2s, transform .1s;
}
.btn-mode:active { transform: scale(.98); }
.btn-mode.guided { border-color: rgba(247,37,133,0.3); background: linear-gradient(135deg, rgba(247,37,133,0.08), rgba(123,47,255,0.05)); }
.btn-mode.libre  { border-color: rgba(123,47,255,0.3); background: linear-gradient(135deg, rgba(123,47,255,0.08), rgba(79,172,254,0.05)); }
.mode-icon { font-size: 26px; flex-shrink: 0; }
.mode-info { flex: 1; }
.mode-titre { font-family: var(--font-h); font-weight: 700; font-size: 17px; color: var(--text); }
.mode-desc  { font-size: 12px; color: var(--text2); margin-top: 3px; }
.mode-arrow { color: var(--text3); font-size: 20px; }

/* ===== SCANNER ===== */
.scanner-wrap { max-width: 500px; margin: 0 auto; padding: 0 16px 80px; }
.scanner-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 0; border-bottom: 1px solid var(--border); margin-bottom: 16px;
  position: sticky; top: 0; background: var(--bg); z-index: 5;
}
.scanner-titre { font-family: var(--font-h); font-weight: 700; font-size: 16px; text-align: center; }
.scanner-badge { font-size: 11px; color: var(--purple); text-align: center; margin-top: 2px; }

/* Guide card */
.guide-card {
  background: var(--bg2); border: 1px solid rgba(123,47,255,0.3);
  border-radius: var(--radius); padding: 18px; margin-bottom: 14px;
}
.guide-card.guide-done { border-color: rgba(56,239,125,0.3); text-align: center; }
.guide-etape-label { font-size: 12px; color: var(--purple); font-weight: 700; margin-bottom: 6px; text-transform: uppercase; letter-spacing: .5px; }
.guide-etape-titre { font-family: var(--font-h); font-size: 20px; font-weight: 700; color: var(--text); margin-bottom: 8px; }
.guide-etape-desc  { font-size: 13px; color: var(--text2); line-height: 1.6; margin-bottom: 12px; }
.guide-conseil { background: rgba(247,37,133,0.08); border-left: 3px solid var(--primary); border-radius: 0 8px 8px 0; padding: 10px 12px; font-size: 13px; color: #fda085; margin-bottom: 14px; line-height: 1.5; }

.btn-photo-guide {
  flex: 2; padding: 14px; background: linear-gradient(135deg, var(--primary), var(--purple));
  color: white; border-radius: 10px; font-weight: 700; font-size: 14px; text-align: center;
}
.btn-photo-guide.full { width: 100%; }
.btn-passer {
  flex: 1; padding: 14px; background: rgba(79,172,254,0.1);
  border: 1px solid var(--cyan); color: var(--cyan); border-radius: 10px; font-weight: 600; font-size: 13px;
}
.guide-sub { text-align: center; font-size: 12px; color: var(--text3); margin-top: 8px; }

/* Progress dots */
.guide-progress { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 14px; justify-content: center; }
.prog-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--bg3); border: 1px solid var(--border); transition: all .3s; }
.prog-dot.done   { background: var(--green); border-color: var(--green); }
.prog-dot.active { background: var(--primary); border-color: var(--primary); transform: scale(1.3); }

/* Status */
.status-ok      { color: var(--green);  font-size: 12px; font-weight: 600; }
.status-warn    { color: var(--orange); font-size: 12px; font-weight: 600; }
.status-loading { color: var(--cyan);   font-size: 12px; font-weight: 600; }

/* Grille miniatures */
.grille-section { margin: 14px 0; }
.grille-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; font-size: 13px; color: var(--text2); }
.scan-grille { display: flex; flex-wrap: wrap; gap: 10px; }
.thumb-wrap { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.thumb-img { position: relative; width: 80px; height: 80px; border-radius: 8px; overflow: visible; flex-shrink: 0; }
.thumb-img img { width: 80px; height: 80px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); display: block; }
.thumb-del {
  position: absolute; top: -5px; left: -5px; width: 18px; height: 18px; border-radius: 50%;
  background: rgba(20,20,40,.9); border: 1px solid rgba(255,80,120,.5);
  color: var(--red); font-size: 10px; display: flex; align-items: center; justify-content: center; z-index: 2;
}
.thumb-qdot {
  position: absolute; top: -5px; right: -5px; width: 18px; height: 18px; border-radius: 50%;
  background: #444; border: 2px solid var(--bg); cursor: pointer; z-index: 2; transition: all .3s;
}
.thumb-label { font-size: 10px; color: var(--text3); text-align: center; max-width: 80px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Bouton photo libre */
.btn-photo-libre {
  width: 100%; padding: 14px; background: var(--bg2);
  border: 1px dashed rgba(79,172,254,0.4); border-radius: 10px;
  color: var(--cyan); font-weight: 600; font-size: 14px;
  display: flex; align-items: center; justify-content: center; gap: 8px; margin: 10px 0;
}

/* Bouton analyser */
.btn-analyser {
  width: 100%; padding: 16px; margin: 16px 0 4px;
  background: linear-gradient(135deg, var(--primary), var(--purple));
  color: white; border-radius: 12px; font-family: var(--font-h);
  font-weight: 700; font-size: 16px;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  box-shadow: 0 4px 20px rgba(247,37,133,0.3);
}
.btn-analyser:disabled { opacity: .7; }
.analyser-sub { text-align: center; font-size: 11px; color: var(--text3); margin-bottom: 8px; }

/* Popup qualité */
.popup-qualite {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%,-50%);
  width: 90%; max-width: 320px; background: var(--bg2);
  border-radius: 14px; padding: 20px; z-index: 9999;
  box-shadow: 0 20px 60px rgba(0,0,0,.7); border: 1px solid var(--border);
}
.pq-header { font-weight: 700; font-size: 15px; margin-bottom: 10px; }
.pq-list { padding-left: 18px; margin-bottom: 10px; font-size: 13px; color: var(--text2); line-height: 1.8; }
.pq-conseil { font-size: 13px; color: var(--orange); font-style: italic; margin-bottom: 14px; }
.pq-btns { display: flex; gap: 8px; }
.btn-reprendre { flex: 1; padding: 11px; background: linear-gradient(135deg, var(--primary), var(--purple)); color: white; border-radius: 8px; font-weight: 700; font-size: 13px; }
.btn-garder    { flex: 1; padding: 11px; background: rgba(79,172,254,.1); border: 1px solid var(--cyan); color: var(--cyan); border-radius: 8px; font-weight: 600; font-size: 13px; }

/* ===== RÉSULTAT ===== */
.resultat-wrap { margin-top: 20px; }
.resultat-banner {
  background: linear-gradient(135deg, rgba(247,37,133,.2), rgba(123,47,255,.15));
  border: 1px solid rgba(247,37,133,.3); border-radius: 10px;
  padding: 12px 14px; text-align: center; font-size: 12px;
  font-weight: 600; color: var(--primary); margin-bottom: 18px; line-height: 1.5;
}
.resultat-titre { font-family: var(--font-h); font-size: 22px; font-weight: 800; color: var(--primary); margin-bottom: 16px; }
.resultat-bloc { margin-bottom: 14px; }
.bloc-label { font-size: 11px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; margin-bottom: 5px; }
.titre-bloc .bloc-label { color: var(--cyan); }
.desc-bloc  .bloc-label { color: var(--purple); }
.prix-bloc  .bloc-label { color: var(--green); }
.mots-bloc  .bloc-label { color: var(--orange); }
.bloc-content {
  background: var(--bg2); border-radius: 0 10px 10px 0;
  padding: 12px 14px; font-size: 14px; color: var(--text); line-height: 1.6;
}
.titre-bloc .bloc-content { border-left: 3px solid var(--cyan); font-weight: 600; }
.desc-bloc  .bloc-content { border-left: 3px solid var(--purple); }
.mots-bloc  .bloc-content { border-left: 3px solid var(--orange); font-size: 12px; color: var(--text2); }
.bloc-content.pre { white-space: pre-wrap; }
.bloc-content.small { font-size: 12px; }
.bloc-prix {
  background: var(--bg2); border-left: 3px solid var(--green);
  border-radius: 0 10px 10px 0; padding: 12px 14px;
  font-size: 28px; font-weight: 800; color: var(--green);
}
.resultat-conseil {
  background: rgba(246,173,85,.08); border: 1px solid rgba(246,173,85,.25);
  border-radius: 10px; padding: 12px 14px; margin-bottom: 14px;
}
.conseil-label { font-size: 11px; font-weight: 700; color: var(--orange); margin-bottom: 5px; letter-spacing: .5px; }
.conseil-text  { font-size: 13px; color: #fbd38d; line-height: 1.6; }

.resultat-actions { display: flex; gap: 10px; margin: 16px 0 8px; }
.btn-copier {
  flex: 1; padding: 14px; background: linear-gradient(135deg, var(--primary), var(--purple));
  color: white; border-radius: 10px; font-weight: 700; font-size: 14px;
}
.btn-telecharger {
  flex: 1; padding: 14px; background: rgba(79,172,254,.1);
  border: 1px solid var(--cyan); color: var(--cyan); border-radius: 10px; font-weight: 600; font-size: 13px;
}
.btn-nouvelle {
  width: 100%; padding: 12px; background: var(--bg2);
  border: 1px solid var(--border); color: var(--text2); border-radius: 10px; font-size: 13px;
}

/* ===== HISTORIQUE ===== */
.hist-wrap { max-width: 500px; margin: 0 auto; padding: 0 16px 80px; }
.hist-header { display: flex; align-items: center; gap: 16px; padding: 16px 0; border-bottom: 1px solid var(--border); margin-bottom: 16px; }
.hist-titre { font-family: var(--font-h); font-size: 22px; font-weight: 800; color: var(--primary); }
.hist-empty { text-align: center; padding: 40px; color: var(--text2); font-size: 14px; line-height: 2; }

.scan-card { background: var(--bg2); border: 1px solid var(--border); border-radius: 12px; padding: 16px; margin-bottom: 12px; }
.sc-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 10px; }
.sc-date  { font-size: 12px; color: var(--text3); }
.sc-mode  { font-size: 12px; color: var(--purple); margin-top: 2px; }
.sc-actions { display: flex; gap: 6px; }
.sc-btn-voir { padding: 6px 12px; background: rgba(79,172,254,.1); border: 1px solid var(--cyan); color: var(--cyan); border-radius: 6px; font-size: 12px; }
.sc-btn-del  { padding: 6px 10px; background: rgba(252,129,129,.1); border: 1px solid var(--red); color: var(--red); border-radius: 6px; font-size: 12px; }
.sc-titre { font-size: 15px; font-weight: 600; color: var(--text); margin-bottom: 10px; word-break: break-word; }
.sc-meta  { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.sc-prix  { font-size: 18px; font-weight: 700; color: var(--green); }
.sc-check { display: flex; align-items: center; gap: 5px; font-size: 12px; color: var(--text2); cursor: pointer; }
.sc-detail { margin-top: 12px; }
.sc-desc  { background: var(--bg3); border-radius: 8px; padding: 12px; font-size: 13px; color: var(--text2); white-space: pre-wrap; line-height: 1.6; margin-bottom: 10px; }
.sc-btn-group { display: flex; gap: 8px; }

/* ===== TARIFS ===== */
.tarifs-wrap { width: 100%; max-width: 500px; padding: 24px 16px 80px; }
.page-titre { font-family: var(--font-h); font-size: 24px; font-weight: 800; margin: 16px 0 20px; }
.plans-grid { display: flex; flex-direction: column; gap: 12px; }
.plan-card { background: var(--bg2); border: 1px solid var(--border); border-radius: 14px; padding: 20px; }
.plan-card.featured { border-color: rgba(247,37,133,.4); }
.plan-card-nom  { font-family: var(--font-h); font-weight: 700; font-size: 16px; margin-bottom: 4px; }
.plan-card-prix { font-size: 24px; font-weight: 800; color: var(--green); margin-bottom: 12px; }
.plan-card-prix span { font-size: 13px; color: var(--text2); font-weight: 400; }
.plan-features  { padding-left: 18px; font-size: 13px; color: var(--text2); margin-bottom: 14px; line-height: 1.8; }
.badge-actuel   { background: var(--green); color: #000; font-size: 10px; padding: 2px 7px; border-radius: 20px; margin-left: 6px; }
.btn-plan { width: 100%; padding: 12px; border-radius: 8px; font-weight: 600; font-size: 14px; background: var(--bg3); color: var(--text2); }
.btn-plan.free { background: rgba(255,255,255,0.06); color: var(--text); border: 1px solid rgba(255,255,255,0.1); }
.btn-plan.active { background: linear-gradient(135deg, var(--primary), var(--purple)); color: white; }
.btn-plan:disabled { opacity: .5; cursor: not-allowed; }

/* ===== PROFIL ===== */
.profil-wrap { width: 100%; max-width: 500px; padding: 24px 16px; min-height: 100vh; }
.profil-card { background: var(--bg2); border: 1px solid var(--border); border-radius: 14px; padding: 20px; margin-top: 16px; }
.btn-danger { padding: 12px 20px; background: rgba(252,129,129,.1); border: 1px solid var(--red); color: var(--red); border-radius: 8px; font-weight: 600; font-size: 14px; }
.btn-retour-text { background: none; color: var(--text2); font-size: 14px; padding: 4px 0; }
.btn-retour-text:hover { color: var(--text); }

/* ===== FLOATING BUTTONS ===== */
.floating-btns { position: fixed; bottom: 24px; right: 16px; display: flex; flex-direction: column; gap: 10px; z-index: 50; }
@media (min-width: 520px) {
  .floating-btns { position: absolute; bottom: 24px; right: 16px; }
}
.floating-btn {
  width: 48px; height: 48px; border-radius: 50%; font-size: 20px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 16px rgba(0,0,0,.4); transition: transform .2s;
}
.floating-btn:hover { transform: scale(1.1); }
.floating-btn.bug       { background: var(--purple); }
.floating-btn.assistant { background: linear-gradient(135deg, var(--primary), var(--purple)); }

/* ===== MODALS ===== */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.7); z-index: 1000;
  align-items: center; justify-content: center; padding: 20px;
}
.modal-card {
  width: 100%; max-width: 360px; background: var(--bg2);
  border: 1px solid var(--border); border-radius: 18px; padding: 24px;
  box-shadow: var(--shadow);
}
.modal-header { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.modal-icon { font-size: 28px; }
.modal-header h3 { font-family: var(--font-h); font-size: 18px; font-weight: 700; flex: 1; }
.modal-close { background: none; color: var(--text3); font-size: 18px; }
.modal-desc { font-size: 13px; color: var(--text2); margin-bottom: 14px; line-height: 1.6; }

/* ===== CHAT ===== */
.chat-window {
  position: fixed; bottom: 88px; right: 16px; width: 320px; max-width: calc(100vw - 32px);
  background: var(--bg2); border: 1px solid var(--border); border-radius: 16px;
  box-shadow: var(--shadow); z-index: 100; flex-direction: column; overflow: hidden;
}
.chat-header { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.chat-icon { font-size: 24px; }
.chat-titre { font-weight: 700; font-size: 14px; }
.chat-sub   { font-size: 11px; color: var(--text2); }
.chat-messages { flex: 1; padding: 14px; overflow-y: auto; max-height: 280px; display: flex; flex-direction: column; gap: 8px; }
.chat-msg { padding: 10px 12px; border-radius: 10px; font-size: 13px; line-height: 1.6; max-width: 90%; word-break: break-word; }
.chat-msg.user { background: linear-gradient(135deg, var(--primary), var(--purple)); color: white; align-self: flex-end; }
.chat-msg.bot  { background: var(--bg3); color: var(--text); align-self: flex-start; }
.chat-input-wrap { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--border); }
.chat-input { flex: 1; background: var(--bg3); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; color: var(--text); font-size: 13px; outline: none; }
.chat-send  { padding: 10px 14px; background: var(--primary); color: white; border-radius: 8px; font-size: 14px; }

/* ===== NOTIFICATION ===== */
.notif {
  position: fixed; top: 16px; left: 50%; transform: translateX(-50%);
  padding: 12px 20px; border-radius: 10px; font-size: 14px; font-weight: 600;
  z-index: 9999; box-shadow: var(--shadow); max-width: 90vw; text-align: center;
}
.notif-error   { background: var(--red);    color: #fff; }
.notif-success { background: var(--green);  color: #000; }
.notif-warning { background: var(--orange); color: #000; }

/* ===== TOAST ===== */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--bg2); border: 1px solid var(--border); border-radius: 10px;
  padding: 12px 20px; font-size: 14px; font-weight: 600; z-index: 9998;
  box-shadow: var(--shadow); transition: opacity .4s;
}
.toast-hide { opacity: 0; }

/* ===== MISC ===== */
.loading-hist { text-align: center; padding: 30px; color: var(--text2); }
.btn-secondary { padding: 9px 16px; background: var(--bg3); border: 1px solid var(--border); color: var(--text2); border-radius: 8px; font-size: 13px; display: inline-block; cursor: pointer; }
.bug-photo-label { display: block; margin-top: 10px; }

/* ===== RÉSULTAT — accordéons v3.2 ===== */
.accordeon-bloc { background: var(--bg2); border-radius: 10px; overflow: hidden; margin-bottom: 10px; }
.accordeon-toggle {
  width: 100%; display: flex; justify-content: space-between; align-items: center;
  background: none; padding: 12px 14px; color: var(--orange);
  font-size: 11px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase;
  border: none; cursor: pointer; transition: background .15s;
}
.accordeon-toggle:hover { background: rgba(255,255,255,.04); }
.accordeon-arrow { font-size: 10px; opacity: .7; }
.accordeon-content { border-top: 1px solid rgba(255,255,255,.06); }
.accordeon-content .bloc-content {
  border-left: 3px solid var(--orange); border-radius: 0;
  font-size: 12px; color: var(--text2); background: transparent;
}

/* Ordre photos */
.ordre-info-text { font-size: 12px; color: var(--text2); padding: 10px 14px 4px; line-height: 1.5; margin: 0; }
.ordre-liste { padding: 6px 10px 10px; display: flex; flex-direction: column; gap: 6px; }
.ordre-ligne {
  display: flex; align-items: flex-start; gap: 10px;
  background: rgba(255,255,255,.03); border-radius: 8px; padding: 8px 10px;
}
.ordre-num {
  min-width: 22px; height: 22px; border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--purple));
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 800; color: white; flex-shrink: 0; margin-top: 1px;
}
.ordre-info { display: flex; flex-direction: column; gap: 2px; }
.ordre-titre-item { font-size: 13px; font-weight: 600; color: var(--text); }
.ordre-desc-item { font-size: 11px; color: var(--text2); line-height: 1.4; }

/* Compat ancien — caché */
.mots-toggle { display: none; }

/* ===== PAGE PROFIL ===== */
.profil-wrap { width:100%; max-width:500px; margin:0 auto; padding:0 0 80px; min-height:100vh; }
.profil-header { display:flex; align-items:center; gap:16px; padding:16px; border-bottom:1px solid var(--border); position:sticky; top:0; background:var(--bg); z-index:5; }
.profil-titre { font-family:var(--font-h); font-size:20px; font-weight:700; }

.profil-hero { display:flex; align-items:center; gap:16px; padding:20px 16px; border-bottom:1px solid var(--border); }
.profil-avatar-big {
  width:64px; height:64px; border-radius:50%; flex-shrink:0;
  background:linear-gradient(135deg,var(--primary),var(--purple));
  display:flex; align-items:center; justify-content:center;
  font-family:var(--font-h); font-size:26px; font-weight:800; color:white;
}
.profil-hero-nom   { font-family:var(--font-h); font-size:18px; font-weight:700; }
.profil-hero-email { font-size:13px; color:var(--text2); margin:2px 0 8px; }
.profil-plan-badge {
  display:inline-flex; align-items:center; gap:6px; padding:4px 10px;
  background:rgba(123,47,255,0.15); border:1px solid rgba(123,47,255,0.3);
  border-radius:20px; font-size:12px; color:var(--purple);
}

.profil-menu { padding:8px 12px; }
.profil-item {
  display:flex; align-items:center; gap:14px; width:100%; padding:16px 8px;
  background:none; border-bottom:1px solid var(--border); text-align:left;
  transition:background .15s; border-radius:0;
}
.profil-item:hover { background:rgba(255,255,255,0.03); }
.profil-item-icon { width:40px; height:40px; border-radius:12px; display:flex; align-items:center; justify-content:center; font-size:18px; flex-shrink:0; }
.profil-item-text { flex:1; }
.profil-item-titre { font-weight:600; font-size:14px; color:var(--text); }
.profil-item-sub   { font-size:12px; color:var(--text2); margin-top:2px; }
.profil-item-arrow { color:var(--text3); font-size:18px; }

.profil-securite { display:flex; align-items:flex-start; gap:10px; padding:16px; margin:8px 12px; background:rgba(56,239,125,0.05); border:1px solid rgba(56,239,125,0.15); border-radius:12px; font-size:12px; color:var(--text2); line-height:1.5; }

/* Modals profil */
.modal-full { max-width:480px; width:100%; padding:0; border-radius:16px; overflow:hidden; }
.modal-back { background:none; color:var(--text); font-size:20px; padding:0; }
.modal-header { display:flex; align-items:center; justify-content:space-between; padding:16px 20px; border-bottom:1px solid var(--border); }
.modal-header h3 { font-family:var(--font-h); font-size:16px; font-weight:700; }

.profil-form { padding:16px 20px; }
.profil-field { padding:14px 0; border-bottom:1px solid var(--border); }
.profil-field-label { font-size:12px; color:var(--text2); font-weight:500; display:block; margin-bottom:6px; }
.profil-field-val { display:flex; align-items:center; gap:10px; }
.profil-input { flex:1; background:none; border:none; outline:none; color:var(--text); font-size:14px; font-family:var(--font); }
.profil-input::placeholder { color:var(--text3); }
.profil-edit-btn { background:none; color:var(--text3); font-size:16px; flex-shrink:0; }

.mdp-rules { margin-top:16px; padding:12px; background:var(--bg3); border-radius:10px; font-size:12px; }
.mdp-rules > div:first-child { color:var(--text2); margin-bottom:6px; font-weight:500; }
.mdp-rule { color:var(--text3); margin-top:4px; }
.mdp-rule.valid { color:var(--green); }

.alerte-danger { display:flex; gap:12px; align-items:flex-start; padding:14px; background:rgba(252,129,129,0.1); border:1px solid rgba(252,129,129,0.3); border-radius:10px; margin:16px 20px 0; }
.btn-danger-full { width:100%; padding:14px; background:linear-gradient(135deg,#fc8181,#f5576c); color:white; border-radius:10px; font-weight:700; font-size:15px; margin:0 20px; width:calc(100% - 40px); }
.modal-full .btn-primary, .modal-full .btn-nouvelle, .modal-full .btn-danger-full { margin-left:20px; margin-right:20px; width:calc(100% - 40px); }
.modal-full .profil-form + .btn-primary { margin-top:0; }

/* ===== AUTOFILL CHROME — fond sombre ===== */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
input:-webkit-autofill:active {
  -webkit-box-shadow: 0 0 0 1000px #1e2635 inset !important;
  -webkit-text-fill-color: #f0f4f8 !important;
  caret-color: #f0f4f8;
  transition: background-color 9999s ease-in-out 0s;
}

/* ===== MODAL CONFIRMATION RETOUR ===== */
.modal-confirm {
  position: fixed; inset: 0; background: rgba(0,0,0,0.7);
  z-index: 9999; display: flex; align-items: flex-end;
  justify-content: center; padding-bottom: 0;
}
.modal-confirm-card {
  width: 100%; max-width: 500px;
  background: var(--bg2); border-radius: 20px 20px 0 0;
  padding: 28px 20px 36px; border-top: 1px solid var(--border);
  animation: slideUp .2s ease;
}
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
.modal-confirm-icon { font-size: 36px; text-align: center; margin-bottom: 12px; }
.modal-confirm-titre { font-family: var(--font-h); font-size: 18px; font-weight: 700; text-align: center; margin-bottom: 8px; }
.modal-confirm-sub { font-size: 14px; color: var(--text2); text-align: center; margin-bottom: 24px; line-height: 1.5; }
.modal-confirm-btns { display: flex; flex-direction: column; gap: 10px; }

/* ===== BOUTONS ÉTAPE GUIDÉE ===== */
.etape-btns { display: flex; gap: 8px; margin-top: 12px; }
.btn-etape-prev {
  flex: 1; padding: 13px; background: var(--bg3);
  border: 1px solid var(--border); color: var(--text2);
  border-radius: 10px; font-weight: 600; font-size: 13px;
}
.btn-etape-photo {
  flex: 2; padding: 13px;
  background: none; border: 1.5px dashed rgba(79,172,254,0.5);
  color: var(--cyan); border-radius: 10px;
  font-weight: 600; font-size: 14px; text-align: center;
}
.btn-etape-passer {
  flex: 1; padding: 13px; background: rgba(79,172,254,0.08);
  border: 1px solid var(--cyan); color: var(--cyan);
  border-radius: 10px; font-weight: 600; font-size: 13px;
}

/* ===== CHAT IA — panel fixe bas droite v3 ===== */
.chat-overlay {
  position: fixed;
  bottom: 90px; right: 16px;
  width: 360px; height: 520px;
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - 110px);
  z-index: 2000;
  display: flex; flex-direction: column;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
  overflow: hidden;
  animation: slideUpChat .2s ease;
}
@keyframes slideUpChat {
  from { opacity:0; transform: translateY(20px); }
  to   { opacity:1; transform: translateY(0); }
}
.chat-modal { display: contents; }
.chat-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; border-bottom: 1px solid var(--border);
  background: var(--bg2); flex-shrink: 0; border-radius: 0;
}
.chat-header-info { display: flex; align-items: center; gap: 10px; }
.chat-avatar {
  width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(135deg, var(--primary), var(--purple));
  display: flex; align-items: center; justify-content: center; font-size: 18px;
}
.chat-titre { font-weight: 700; font-size: 14px; }
.chat-status { font-size: 11px; color: var(--green); margin-top: 1px; }
.chat-close {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--bg3); color: var(--text2); font-size: 13px;
  display: flex; align-items: center; justify-content: center; border: none; cursor: pointer;
  flex-shrink: 0;
}
.chat-messages {
  flex: 1; overflow-y: auto; padding: 14px 12px;
  display: flex; flex-direction: column; gap: 8px;
  scroll-behavior: smooth;
}
.chat-bubble-date {
  text-align: center; font-size: 11px; color: var(--text3);
  margin: 2px 0; font-weight: 500;
}
.chat-msg { max-width: 85%; padding: 10px 13px; border-radius: 16px; font-size: 13px; line-height: 1.5; }
.chat-msg.user {
  background: linear-gradient(135deg, var(--primary), var(--purple));
  color: white; align-self: flex-end; border-bottom-right-radius: 4px;
}
.chat-msg.bot {
  background: var(--bg3); color: var(--text); align-self: flex-start;
  border-bottom-left-radius: 4px; border: 1px solid var(--border);
}
.chat-msg-intro { max-width: 92%; }
.chat-input-wrap {
  display: flex; gap: 8px; padding: 12px;
  border-top: 1px solid var(--border); flex-shrink: 0;
  background: var(--bg2);
}
.chat-input {
  flex: 1; background: var(--bg3); border: 1px solid var(--border);
  border-radius: 20px; padding: 10px 14px; color: var(--text);
  font-size: 13px; outline: none; font-family: var(--font);
}
.chat-input:focus { border-color: var(--purple); }
.chat-send {
  width: 38px; height: 38px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(135deg, var(--primary), var(--purple));
  border: none; cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: transform .15s;
}
.chat-send:hover { transform: scale(1.05); }

/* ===== BOUTON SAUVEGARDE SCAN EN COURS ===== */
.btn-sauvegarder-scan {
  width: 100%; padding: 12px; margin: 8px 0;
  background: rgba(56,239,125,0.08); border: 1px solid rgba(56,239,125,0.3);
  color: var(--green); border-radius: 10px; font-weight: 600; font-size: 13px;
  display: flex; align-items: center; justify-content: center; gap: 8px;
}
.scan-sauvegarde-badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px;
  background: rgba(56,239,125,0.1); border: 1px solid rgba(56,239,125,0.3);
  border-radius: 20px; font-size: 11px; color: var(--green); margin-top: 6px;
}


/* ===== CENTRAGE DESKTOP — force les fixed à rester dans la colonne ===== */
@media (min-width: 520px) {
  /* transform crée un nouveau containing block pour position:fixed */
  #appRoot {
    transform: translateZ(0);
  }
  /* Les éléments fixed deviennent relatifs à appRoot sur desktop */
  .floating-btns {
    position: fixed;
    right: calc(50vw - 250px + 16px);
  }
  .chat-bubble {
    position: fixed;
    right: calc(50vw - 250px + 16px);
  }
  .toast {
    left: 50%;
    transform: translateX(-50%);
    max-width: 480px;
    width: auto;
  }
  /* Pages — s'assurent de remplir le container */
  #pageAccueil, #pageScanner, #pageHistorique, #pageTarifs, #pageProfil, #pageAuth {
    width: 100%;
  }
}

/* Toast — forcer au-dessus de appRoot transform */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 99999;
}