/* ============================================================================
   Comparateur de prix — styles de l'application (mobile first, thème clair)
   ========================================================================== */

:root {
  --bg: #f4f6f5;
  --surface: #ffffff;
  --surface-alt: #f8faf9;
  --border: #dfe6e3;
  --text: #17211f;
  --text-muted: #5d6b67;
  --primary: #0f766e;
  --primary-dark: #0b5d57;
  --primary-soft: #e6f4f1;
  --accent: #b45309;
  --promo: #c2410c;
  --promo-soft: #fff1e7;
  --danger: #b91c1c;
  --danger-soft: #fee2e2;
  --warn: #a16207;
  --warn-soft: #fef3c7;
  --ok: #15803d;
  --ok-soft: #dcfce7;
  --info: #1d4ed8;
  --info-soft: #dbeafe;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(16, 32, 29, 0.06), 0 1px 3px rgba(16, 32, 29, 0.08);
  --shadow: 0 8px 24px rgba(15, 45, 40, 0.08);
  --shadow-lg: 0 20px 50px rgba(15, 45, 40, 0.18);
  --font: "Inter", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --header-height: 60px;
  --tabbar-height: 64px;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
}

body.modal-open { overflow: hidden; }

h1, h2, h3, h4 { margin: 0; line-height: 1.25; font-weight: 650; letter-spacing: -0.01em; }
p { margin: 0; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font: inherit; }
img { max-width: 100%; display: block; }

.muted { color: var(--text-muted); }
.small { font-size: 0.82rem; }
.hint { color: var(--text-muted); font-size: 0.8rem; margin-top: 0.35rem; }
.link { font-weight: 600; }
.stack { display: flex; flex-direction: column; gap: 0.75rem; }
.row { display: flex; align-items: center; }
.row.gap { gap: 0.5rem; }
.wrap { flex-wrap: wrap; }
.gap { gap: 0.5rem; }

/* ---------------------------------------------------------------- structure */

.container {
  max-width: 1080px;
  margin: 0 auto;
  padding: calc(var(--header-height) + 1rem) 1rem calc(var(--tabbar-height) + 1.5rem);
  min-height: 60dvh;
}

body.is-auth .container { padding-top: 1.5rem; padding-bottom: 2rem; }

.page { display: flex; flex-direction: column; gap: 1rem; }
.page--narrow { max-width: 680px; margin: 0 auto; }

/* ---------------------------------------------------------------- barre haute */

.topbar {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 30;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding-top: env(safe-area-inset-top);
}

.topbar__inner {
  height: var(--header-height);
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.brand { display: flex; align-items: center; gap: 0.5rem; color: var(--text); font-weight: 700; }
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 11px;
  background: linear-gradient(140deg, var(--primary), #14b8a6);
  color: white; display: grid; place-items: center; flex: none;
  box-shadow: 0 4px 12px rgba(15, 118, 110, 0.28);
}
.brand-mark svg { width: 20px; height: 20px; }
.brand__text { font-size: 0.98rem; letter-spacing: -0.02em; }
.topbar__group { flex: 1; min-width: 0; display: flex; }
.topbar__right { display: flex; align-items: center; gap: 0.25rem; }

.group-select {
  width: 100%;
  max-width: 240px;
  border: 1px solid var(--border);
  background: var(--surface-alt);
  border-radius: 999px;
  padding: 0.42rem 0.9rem;
  font: inherit;
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--text);
  text-overflow: ellipsis;
}

.status { display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.3rem 0.6rem; border-radius: 999px; background: var(--surface-alt); border: 1px solid var(--border); font-size: 0.78rem; color: var(--text-muted); white-space: nowrap; }
.status:hover { text-decoration: none; }
.status__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); }
.status__dot--offline { background: var(--warn); }
.status__dot--error { background: var(--danger); }
.status__dot--busy { background: var(--info); animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: 0.35; } }

/* ---------------------------------------------------------------- bannières */

.banners { position: fixed; top: calc(var(--header-height) + env(safe-area-inset-top)); left: 0; right: 0; z-index: 25; display: flex; flex-direction: column; }
.banner { display: flex; align-items: center; gap: 0.5rem; padding: 0.55rem 1rem; font-size: 0.84rem; font-weight: 500; }
.banner svg { width: 16px; height: 16px; flex: none; }
.banner a { margin-left: auto; font-weight: 700; color: inherit; text-decoration: underline; }
.banner--warn { background: var(--warn-soft); color: #78350f; }
.banner--info { background: var(--info-soft); color: #1e3a8a; }
.banner--danger { background: var(--danger-soft); color: #7f1d1d; }
body.is-app:has(.banners .banner) .container { padding-top: calc(var(--header-height) + 3.2rem); }

/* ---------------------------------------------------------------- onglets */

.tabbar {
  position: fixed;
  inset: auto 0 0 0;
  z-index: 30;
  display: flex;
  justify-content: space-around;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom);
}

.tab { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 0.15rem; padding: 0.55rem 0.2rem; color: var(--text-muted); font-size: 0.68rem; font-weight: 600; }
.tab:hover { text-decoration: none; color: var(--primary); }
.tab__icon svg { width: 22px; height: 22px; display: block; }
.tab.is-active { color: var(--primary); }
.tab.is-active .tab__icon { transform: translateY(-1px); }

/* ---------------------------------------------------------------- typographie de page */

.page-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 0.75rem; flex-wrap: wrap; }
.page-header__main { display: flex; align-items: flex-start; gap: 0.5rem; min-width: 0; }
.page-header__actions { display: flex; align-items: center; gap: 0.4rem; }
.page-title { font-size: 1.4rem; letter-spacing: -0.02em; }
.page-subtitle { color: var(--text-muted); font-size: 0.86rem; margin-top: 0.15rem; }
.section { display: flex; flex-direction: column; gap: 0.6rem; }
.section__head { display: flex; align-items: baseline; justify-content: space-between; gap: 0.5rem; }
.section__head h2, .section__title { font-size: 1rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); font-weight: 700; }
.note { background: var(--surface-alt); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 0.65rem 0.8rem; font-size: 0.9rem; color: var(--text-muted); }

.stat { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 0.55rem 0.85rem; display: flex; flex-direction: column; min-width: 76px; box-shadow: var(--shadow-sm); }
.stat__value { font-size: 1.25rem; font-weight: 700; letter-spacing: -0.02em; }
.stat__label { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); }
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 0.5rem; }

/* ---------------------------------------------------------------- recherche */

.searchwrap { position: relative; }
.searchbar { display: flex; align-items: center; gap: 0.5rem; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 0.35rem 0.35rem 0.35rem 0.75rem; box-shadow: var(--shadow-sm); }
.searchbar--plain { margin-top: 0.2rem; }
.searchbar__icon { color: var(--text-muted); display: flex; }
.searchbar__icon svg { width: 20px; height: 20px; }
.input--search { border: 0; background: transparent; padding: 0.55rem 0; font-size: 1rem; box-shadow: none; }
.input--search:focus { outline: none; box-shadow: none; }
.searchbar__scan { flex: none; }

.suggestions { position: absolute; z-index: 12; left: 0; right: 0; top: calc(100% + 0.35rem); background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lg); overflow: hidden; }
.suggestion { display: flex; justify-content: space-between; gap: 1rem; padding: 0.6rem 0.85rem; color: var(--text); border-bottom: 1px solid var(--border); }
.suggestion:last-child { border-bottom: 0; }
.suggestion:hover { background: var(--primary-soft); text-decoration: none; }
.suggestion__label { font-weight: 600; }
.suggestion__detail { color: var(--text-muted); font-size: 0.78rem; }

/* ---------------------------------------------------------------- cartes */

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; box-shadow: var(--shadow-sm); display: flex; flex-direction: column; gap: 0.7rem; }
.card--accent { border-color: #bfe4dd; background: linear-gradient(180deg, #f2fbf9, #ffffff); }
.card--danger { border-color: #f3c9c9; background: linear-gradient(180deg, #fff7f7, #ffffff); }
.card__head { display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; flex-wrap: wrap; }
.card__head h2 { font-size: 1.02rem; }

.quick-actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0.6rem; }
.quick-actions--compact { grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); }
.quick { display: flex; flex-direction: column; gap: 0.15rem; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 0.8rem; color: var(--text); box-shadow: var(--shadow-sm); transition: transform 0.12s ease, border-color 0.12s ease; }
.quick:hover { text-decoration: none; transform: translateY(-1px); border-color: #bfe4dd; }
.quick__icon { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary-dark); margin-bottom: 0.3rem; }
.quick__icon svg { width: 19px; height: 19px; }
.quick__label { font-weight: 650; font-size: 0.92rem; }
.quick__detail { font-size: 0.76rem; color: var(--text-muted); }
.quick--sm { flex-direction: row; align-items: center; gap: 0.5rem; padding: 0.55rem 0.7rem; }
.quick--sm .quick__icon { margin: 0; width: 28px; height: 28px; border-radius: 8px; }
.quick--sm .quick__icon svg { width: 16px; height: 16px; }
.quick--sm .quick__label { font-size: 0.85rem; }

/* ---------------------------------------------------------------- listes */

.list { display: flex; flex-direction: column; gap: 0.45rem; }
.list--flush { gap: 0; border-top: 1px solid var(--border); }
.list--flush .list-item { border: 0; border-bottom: 1px solid var(--border); border-radius: 0; box-shadow: none; background: transparent; padding-left: 0.15rem; padding-right: 0.15rem; }

.list-item { display: flex; align-items: center; gap: 0.7rem; background: var(--surface); border: 1px solid var(--border); border-radius: 13px; padding: 0.6rem 0.75rem; color: var(--text); box-shadow: var(--shadow-sm); }
a.list-item:hover { text-decoration: none; border-color: #bfe4dd; }
.list-item--static:hover { border-color: var(--border); }
.list-item__icon { width: 34px; height: 34px; border-radius: 10px; background: var(--surface-alt); display: grid; place-items: center; color: var(--primary-dark); flex: none; }
.list-item__icon svg { width: 18px; height: 18px; }
.list-item__body { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.list-item__title { font-weight: 620; font-size: 0.94rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-item__meta { font-size: 0.78rem; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; }
.list-item__side { display: flex; flex-direction: column; align-items: flex-end; gap: 0.1rem; flex: none; }
.list-item__price { font-weight: 700; font-size: 0.95rem; }
.list-item__chevron { color: var(--text-muted); display: flex; }
.list-item__chevron svg { width: 18px; height: 18px; }

.thumb { position: relative; width: 52px; height: 52px; border-radius: 12px; overflow: hidden; background: var(--surface-alt); display: grid; place-items: center; flex: none; border: 1px solid var(--border); }
.thumb--sm { width: 42px; height: 42px; border-radius: 10px; }
/* Positionnement absolu indispensable : dans une grille, height: 100% se résout
   en auto ; l'image débordait vers le bas et se retrouvait rognée en haut. */
.thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center; }
.thumb__placeholder { color: #9fb3ae; display: flex; }
.thumb__placeholder svg { width: 22px; height: 22px; }

.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--primary-soft); color: var(--primary-dark); display: grid; place-items: center; font-weight: 700; flex: none; }

.recents { display: grid; grid-template-columns: repeat(auto-fill, minmax(148px, 1fr)); gap: 0.6rem; }
.recent { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; overflow: hidden; color: var(--text); box-shadow: var(--shadow-sm); }
.recent:hover { text-decoration: none; border-color: #bfe4dd; }
.recent__body { padding: 0.55rem 0.65rem 0.65rem; display: flex; flex-direction: column; gap: 0.12rem; }
.recent__name { font-weight: 620; font-size: 0.88rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recent__meta { font-size: 0.74rem; color: var(--text-muted); }
.recent__price { font-size: 0.8rem; font-weight: 600; color: var(--primary-dark); }
.recent .thumb { width: 100%; height: 92px; border-radius: 0; border: 0; }
.recent .thumb__placeholder svg { width: 28px; height: 28px; }

/* ---------------------------------------------------------------- prix */

.price { display: flex; flex-direction: column; }
.price--unknown { color: var(--text-muted); font-size: 0.85rem; }
.price__main { font-weight: 700; font-variant-numeric: tabular-nums; }
.price__main--promo { color: var(--promo); }
.price__unit { font-size: 0.78rem; color: var(--text-muted); font-variant-numeric: tabular-nums; }

.price-row { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 0.85rem; display: flex; flex-direction: column; gap: 0.5rem; box-shadow: var(--shadow-sm); }
.price-row__head { display: flex; justify-content: space-between; gap: 0.75rem; align-items: flex-start; }
.price-row__store { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.35rem; min-width: 0; }
.price-row__prices { display: flex; align-items: center; gap: 0.45rem; flex-wrap: wrap; justify-content: flex-end; font-size: 1rem; }

.compare { display: flex; flex-direction: column; gap: 0.5rem; }
.compare__row { display: flex; align-items: center; gap: 0.7rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 0.7rem 0.85rem; box-shadow: var(--shadow-sm); }
.compare__row--best { border-color: #86efac; background: linear-gradient(180deg, #f0fdf4, #ffffff); }
.compare__rank { width: 22px; font-weight: 700; color: var(--text-muted); font-variant-numeric: tabular-nums; flex: none; text-align: center; }
.compare__body { display: flex; flex-direction: column; gap: 0.15rem; flex: 1; min-width: 0; }
.compare__name { font-weight: 650; color: var(--text); }
.compare__meta { font-size: 0.78rem; color: var(--text-muted); }
.compare__prices { display: flex; align-items: center; gap: 0.4rem; flex-wrap: wrap; }
.compare__side { display: flex; flex-direction: column; align-items: flex-end; gap: 0.25rem; flex: none; }
.compare__unit { font-weight: 700; font-variant-numeric: tabular-nums; color: var(--primary-dark); }

/* ---------------------------------------------------------------- fiche produit */

.product-head { display: flex; gap: 1rem; align-items: flex-start; flex-wrap: wrap; }
.product-photo { position: relative; width: 132px; height: 132px; border-radius: 18px; overflow: hidden; background: var(--surface); border: 1px solid var(--border); display: grid; place-items: center; box-shadow: var(--shadow-sm); flex: none; }
/* Même contrainte que .thumb img (height: 100% inopérant en grille). */
.product-photo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center; }
.product-photo--empty { color: #a9bcb7; }
.product-photo--empty svg { width: 34px; height: 34px; }
.product-head__info { flex: 1; min-width: 220px; display: flex; flex-direction: column; gap: 0.6rem; }

.history { border-top: 1px dashed var(--border); padding-top: 0.5rem; }
.history summary { cursor: pointer; font-size: 0.82rem; color: var(--text-muted); font-weight: 600; }
.history__body { display: flex; flex-direction: column; gap: 0.5rem; padding-top: 0.5rem; }
.history__body h4 { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); margin: 0.25rem 0; }
.history__list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.2rem; }
.history__list li { display: flex; align-items: center; gap: 0.6rem; font-size: 0.82rem; padding: 0.25rem 0; border-bottom: 1px solid var(--surface-alt); }
.history__list li span:first-child { font-weight: 600; font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------- badges, chips, pills */

.badge { display: inline-flex; align-items: center; gap: 0.25rem; padding: 0.15rem 0.5rem; border-radius: 999px; font-size: 0.7rem; font-weight: 700; letter-spacing: 0.02em; text-transform: uppercase; background: var(--surface-alt); color: var(--text-muted); border: 1px solid var(--border); }
.badge--ok { background: var(--ok-soft); color: #14532d; border-color: #bbf7d0; }
.badge--warn { background: var(--warn-soft); color: #78350f; border-color: #fde68a; }
.badge--danger { background: var(--danger-soft); color: #7f1d1d; border-color: #fecaca; }
.badge--info { background: var(--info-soft); color: #1e3a8a; border-color: #bfdbfe; }
.badge--promo { background: var(--promo-soft); color: var(--promo); border-color: #fed7aa; }
.badge--neutral { background: var(--surface-alt); }

.chip { display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.28rem 0.65rem; background: var(--surface); border: 1px solid var(--border); border-radius: 999px; font-size: 0.8rem; font-weight: 600; color: var(--text); }
.chip--link:hover { border-color: var(--primary); color: var(--primary-dark); text-decoration: none; }
.chips { display: flex; flex-wrap: wrap; gap: 0.35rem; }

.pill { font-size: 0.72rem; padding: 0.15rem 0.5rem; border-radius: 999px; background: var(--surface-alt); border: 1px solid var(--border); color: var(--text-muted); }
.pill--warn { background: var(--warn-soft); color: #78350f; border-color: #fde68a; }
.pill--danger { background: var(--danger-soft); color: #7f1d1d; border-color: #fecaca; }

/* ---------------------------------------------------------------- boutons */

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem; border-radius: 11px; border: 1px solid transparent; padding: 0.6rem 0.95rem; font-weight: 650; font-size: 0.9rem; cursor: pointer; transition: background 0.12s ease, border-color 0.12s ease, transform 0.08s ease; text-decoration: none; white-space: nowrap; }
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn svg { width: 17px; height: 17px; }
.btn--primary { background: var(--primary); color: #fff; }
.btn--primary:hover { background: var(--primary-dark); }
.btn--ghost { background: var(--surface); border-color: var(--border); color: var(--text); }
.btn--ghost:hover { border-color: #bfe4dd; background: var(--surface-alt); }
.btn--danger { background: var(--danger); color: #fff; }
.btn--danger:hover { background: #991b1b; }
.btn--danger-text { color: var(--danger); }
.btn--small { padding: 0.42rem 0.7rem; font-size: 0.82rem; border-radius: 9px; }
.btn--small svg { width: 15px; height: 15px; }
.btn--block { width: 100%; }
.btn--icon { padding: 0.5rem; }
.btn--icon svg { width: 19px; height: 19px; }

/* ---------------------------------------------------------------- formulaires */

.form { display: flex; flex-direction: column; gap: 0.8rem; }
.form__grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 0.8rem; }
.field { display: flex; flex-direction: column; gap: 0.3rem; }
.field__label { font-size: 0.8rem; font-weight: 650; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.field__labelrow { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; }
.fieldset { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 0.8rem; display: flex; flex-direction: column; gap: 0.7rem; }
.fieldset legend { font-size: 0.78rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); padding: 0 0.35rem; }
.input { width: 100%; border: 1px solid var(--border); background: var(--surface); border-radius: 10px; padding: 0.62rem 0.75rem; font: inherit; font-size: 0.95rem; color: var(--text); }
.input:focus { outline: 2px solid rgba(15, 118, 110, 0.25); outline-offset: 1px; border-color: var(--primary); }
.input.is-invalid,
.input.is-valid { transition: border-color 150ms ease, background-color 150ms ease; }
.input.is-invalid { border-color: var(--danger); background: var(--danger-soft); box-shadow: inset 3px 0 0 var(--danger); }
.input.is-invalid:focus { border-color: var(--danger); outline-color: rgba(185, 28, 28, 0.25); }
.input.is-valid { border-color: var(--ok); background: var(--ok-soft); box-shadow: inset 3px 0 0 var(--ok); }
.input.is-valid:focus { border-color: var(--ok); outline-color: rgba(21, 128, 61, 0.25); }
textarea.input { resize: vertical; min-height: 76px; }
.input-group { display: flex; gap: 0.4rem; }
.input-group .input { flex: 1; }
.input-suffix { display: flex; align-items: center; padding: 0 0.7rem; border: 1px solid var(--border); background: var(--surface-alt); border-radius: 10px; font-size: 0.9rem; font-weight: 650; color: var(--text-muted); }
.input:disabled { background: var(--surface-alt); color: var(--text-muted); }
.photo-field { display: flex; align-items: flex-start; gap: 0.8rem; flex-wrap: wrap; }
.photo-field .product-photo { padding: 0; cursor: pointer; font: inherit; color: inherit; }
.photo-field__actions { display: flex; flex-direction: column; gap: 0.4rem; align-items: flex-start; }
.product-photo__icon { width: 100%; height: 100%; display: grid; place-items: center; }
.product-photo__icon svg { width: 34px; height: 34px; }
.product-photo__icon[hidden], .product-photo img[hidden] { display: none; }

.alert { border-radius: 10px; padding: 0.6rem 0.8rem; font-size: 0.85rem; border: 1px solid transparent; }
.alert--error { background: var(--danger-soft); color: #7f1d1d; border-color: #fecaca; }
.alert--warn { background: var(--warn-soft); color: #78350f; border-color: #fde68a; }
.alert--info { background: var(--info-soft); color: #1e3a8a; border-color: #bfdbfe; }

/* ---------------------------------------------------------------- vide, chargement */

.empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 0.5rem; padding: 2rem 1rem; background: var(--surface); border: 1px dashed var(--border); border-radius: var(--radius); }
.empty__icon { width: 44px; height: 44px; border-radius: 14px; background: var(--surface-alt); color: #8fa6a1; display: grid; place-items: center; }
.empty__icon svg { width: 24px; height: 24px; }
.empty__title { font-size: 1rem; }
.empty__text { color: var(--text-muted); font-size: 0.86rem; max-width: 42ch; }

.loading { display: flex; align-items: center; gap: 0.5rem; color: var(--text-muted); font-size: 0.88rem; padding: 1rem 0; }
.spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--border); border-top-color: var(--primary); animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------------------------------------------------------- auth */

.auth { min-height: calc(100dvh - 3rem); display: flex; align-items: center; justify-content: center; padding: 1rem 0; }
.auth__card { width: min(440px, 100%); background: var(--surface); border: 1px solid var(--border); border-radius: 20px; padding: 1.5rem; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 0.85rem; }
.auth__brand { display: flex; align-items: center; gap: 0.65rem; }
.auth__brand strong { display: block; font-size: 0.98rem; }
.auth__brand span { display: block; font-size: 0.76rem; color: var(--text-muted); }
.auth__title { font-size: 1.45rem; letter-spacing: -0.02em; }
.auth__subtitle { color: var(--text-muted); font-size: 0.88rem; }
.auth__footer { border-top: 1px solid var(--border); padding-top: 0.8rem; }
.auth__links { display: flex; flex-wrap: wrap; gap: 0.4rem; font-size: 0.85rem; color: var(--text-muted); }

/* ---------------------------------------------------------------- modales */

.modal-backdrop { position: fixed; left: 0; right: 0; top: var(--vv-top, 0px); height: var(--vv-height, 100dvh); background: rgba(11, 32, 28, 0.45); backdrop-filter: blur(3px); display: flex; align-items: flex-end; justify-content: center; z-index: 100; padding: 0; }
.modal { background: var(--surface); width: min(520px, 100%); border-radius: 20px 20px 0 0; padding: 1.25rem 1.25rem 0; box-shadow: var(--shadow-lg); display: flex; flex-direction: column; gap: 0.8rem; max-height: 100%; overflow: auto; overscroll-behavior: contain; scroll-padding-bottom: 5rem; }
.modal__body { display: flex; flex-direction: column; gap: 0.7rem; }
.modal__title { font-size: 1.1rem; }
.modal__text { color: var(--text-muted); font-size: 0.9rem; }
.modal__actions { position: sticky; bottom: 0; display: flex; justify-content: flex-end; gap: 0.5rem; flex-wrap: wrap; background: var(--surface); padding: 0.6rem 0 calc(0.75rem + env(safe-area-inset-bottom)); }
.choice-list { display: flex; flex-direction: column; gap: 0.4rem; max-height: 50dvh; overflow: auto; }
.choice { text-align: left; background: var(--surface-alt); border: 1px solid var(--border); border-radius: 11px; padding: 0.6rem 0.75rem; cursor: pointer; display: flex; flex-direction: column; }
.choice:hover { border-color: var(--primary); background: var(--primary-soft); }
.choice__title { font-weight: 650; font-size: 0.9rem; }
.choice__desc { font-size: 0.76rem; color: var(--text-muted); }

/* ---------------------------------------------------------------- toasts */

.toasts { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--tabbar-height) + 1rem); z-index: 200; display: flex; flex-direction: column; gap: 0.4rem; width: min(480px, calc(100% - 2rem)); pointer-events: none; }
body.is-auth .toasts { bottom: 1.5rem; }
.toast { background: #16302b; color: #f8fafc; padding: 0.65rem 0.85rem; border-radius: 11px; font-size: 0.86rem; box-shadow: var(--shadow-lg); opacity: 0; transform: translateY(8px); transition: opacity 0.2s ease, transform 0.2s ease; }
.toast.is-visible { opacity: 1; transform: translateY(0); }
.toast--success { background: #14532d; }
.toast--error { background: #7f1d1d; }
.toast--warn { background: #78350f; }

/* ---------------------------------------------------------------- scanner */

.scanner { position: relative; border-radius: var(--radius); overflow: hidden; background: #0b1512; min-height: 220px; display: grid; place-items: center; }
.scanner video { width: 100%; max-height: 60dvh; object-fit: cover; }

/* ---------------------------------------------------------------- parcours guidé */

.progress { height: 8px; background: var(--surface-alt); border-radius: 999px; overflow: hidden; border: 1px solid var(--border); }
.progress__bar { height: 100%; background: linear-gradient(90deg, var(--primary), #14b8a6); transition: width 0.3s ease; }
.steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.5rem; }
.step { display: flex; align-items: center; gap: 0.75rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 0.75rem 0.85rem; flex-wrap: wrap; box-shadow: var(--shadow-sm); }
.step--done { border-color: #bbf7d0; background: linear-gradient(180deg, #f0fdf4, #ffffff); }
.step__index { width: 30px; height: 30px; border-radius: 50%; background: var(--surface-alt); display: grid; place-items: center; font-weight: 700; font-size: 0.85rem; color: var(--text-muted); flex: none; }
.step--done .step__index { background: var(--ok-soft); color: var(--ok); }
.step__index svg { width: 16px; height: 16px; }
.step__body { flex: 1; min-width: 180px; }
.step__title { font-size: 0.94rem; }
.step__text { font-size: 0.8rem; color: var(--text-muted); }

/* ---------------------------------------------------------------- responsive */

@media (min-width: 720px) {
  .modal-backdrop { align-items: center; padding: 1rem; }
  .modal { border-radius: 20px; }
  .toasts { bottom: 1.5rem; }
  .container { padding-bottom: 2rem; }
  .tabbar { position: sticky; top: 0; }
}

@media (min-width: 900px) {
  :root { --header-height: 66px; }
  .container { padding-left: 1.5rem; padding-right: 1.5rem; }
  .page-title { font-size: 1.6rem; }
  .product-photo { width: 168px; height: 168px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

/* ---------------------------------------------------------------- très petits écrans */

@media (max-width: 520px) {
  .brand__text { display: none; }
}
  .topbar__inner { gap: 0.45rem; padding: 0 0.5rem; }
  .status { padding: 0.28rem 0.5rem; }
  .stat { min-width: 64px; padding: 0.45rem 0.6rem; }
  .stat__value { font-size: 1.1rem; }
  .quick-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .compare__row { gap: 0.5rem; padding: 0.6rem; }
  .compare__rank { display: none; }
}

/* Champs placés dans une rangée flexible (ex. invitation) */
.row > .input,
.row > select.input {
  flex: 1 1 200px;
  width: auto;
  min-width: 0;
}
