/* ============================================================
   HACCPilot — App CSS
   Tokens: Brand Navy #0C4E7B · Brand Green #3CAD74
   Fonts: Lato Heavy (display) · DM Sans (body)
   ============================================================ */

@import url('./design-tokens.css');
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,400;0,9..40,500;0,9..40,600;1,9..40,400&display=swap');

@font-face {
  font-family: 'Lato';
  src: url('../fonts/Lato-Heavy.ttf') format('truetype');
  font-weight: 800;
  font-style: normal;
  font-display: swap;
}

/* ── 1. TOKENS ──────────────────────────────────────────────── */

:root {
  /* Navy */
  --navy-50:  #e8f2fb;
  --navy-100: #c3daf3;
  --navy-200: #8fb9e6;
  --navy-300: #5a97d8;
  --navy-400: #2d7abf;
  --navy-500: #0C4E7B;
  --navy-600: #0a4269;
  --navy-700: #083457;
  --navy-800: #052745;
  --navy-900: #031832;

  /* Green */
  --green-50:  #eaf7f0;
  --green-100: #c4ecd7;
  --green-200: #8fd9b3;
  --green-300: #62c993;
  --green-400: #4dba82;
  --green-500: #3CAD74;
  --green-600: #2f9460;
  --green-700: #23784d;
  --green-800: #185c3a;
  --green-900: #0d3f27;

  /* Amber */
  --amber-500: #F5A623;
  --amber-700: #b07309;

  /* Red */
  --red-500: #E8423A;
  --red-600: #c83028;

  /* Neutral */
  --neutral-0:   #ffffff;
  --neutral-50:  #f7f8fa;
  --neutral-100: #eef0f3;
  --neutral-200: #dde1e7;
  --neutral-300: #c4cad4;
  --neutral-400: #9aa3af;
  --neutral-500: #6e7a88;
  --neutral-600: #4f5a66;
  --neutral-700: #364049;
  --neutral-800: #212830;
  --neutral-900: #111519;

  /* Semantic */
  --color-primary:         var(--navy-500);
  --color-primary-hover:   var(--navy-400);
  --color-primary-light:   var(--navy-100);
  --color-primary-subtle:  rgba(12, 78, 123, 0.08);
  --color-primary-glow:    rgba(12, 78, 123, 0.20);
  --color-secondary:        var(--green-500);
  --color-secondary-hover:  var(--green-400);
  --color-secondary-subtle: rgba(60, 173, 116, 0.10);
  --color-success:          var(--green-500);
  --color-success-subtle:   rgba(60, 173, 116, 0.10);
  --color-warning:          var(--amber-500);
  --color-warning-subtle:   rgba(245, 166, 35, 0.10);
  --color-error:            var(--red-500);
  --color-error-subtle:     rgba(232, 66, 58, 0.08);

  /* Surfaces */
  --bg:              var(--neutral-50);
  --bg-white:        var(--neutral-0);
  --bg-surface:      var(--neutral-0);
  --bg-surface-2:    var(--neutral-50);
  --bg-surface-3:    var(--neutral-100);
  --bg-dark:         #0A1F30;
  --bg-dark-surface: #0F2D46;

  /* Text */
  --text-primary:    var(--neutral-900);
  --text-secondary:  var(--neutral-600);
  --text-tertiary:   var(--neutral-400);
  --text-on-primary: #ffffff;
  --text-brand:      var(--navy-500);
  --text-green:      var(--green-600);

  /* Borders */
  --border:          var(--neutral-200);
  --border-2:        var(--neutral-300);
  --border-focus:    var(--navy-500);

  /* Typography */
  --font-display: 'Lato', 'Helvetica Neue', sans-serif;
  --font-body:    'DM Sans', 'Helvetica Neue', sans-serif;
  --font-mono:    'JetBrains Mono', 'Fira Code', monospace;

  --text-xs:   11px;
  --text-sm:   13px;
  --text-base: 15px;
  --text-md:   17px;
  --text-lg:   20px;
  --text-xl:   24px;
  --text-2xl:  30px;
  --text-3xl:  38px;

  --weight-regular:  400;
  --weight-medium:   500;
  --weight-semibold: 600;
  --weight-bold:     700;
  --weight-heavy:    800;

  --leading-tight:   1.15;
  --leading-snug:    1.3;
  --leading-normal:  1.5;
  --leading-relaxed: 1.65;

  --tracking-tight:  -0.03em;
  --tracking-snug:   -0.015em;
  --tracking-wide:   0.04em;
  --tracking-wider:  0.08em;

  /* Spacing */
  --space-1:  4px;
  --space-2:  8px;
  --space-3:  12px;
  --space-4:  16px;
  --space-5:  20px;
  --space-6:  24px;
  --space-8:  32px;
  --space-10: 40px;
  --space-12: 48px;
  --space-16: 64px;

  /* Radii */
  --radius-xs:   4px;
  --radius-sm:   8px;
  --radius-md:   12px;
  --radius-lg:   16px;
  --radius-xl:   24px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-xs:      0 1px 2px rgba(0,0,0,0.06);
  --shadow-sm:      0 1px 4px rgba(0,0,0,0.08), 0 0 0 1px rgba(0,0,0,0.04);
  --shadow-md:      0 4px 12px rgba(0,0,0,0.10), 0 1px 3px rgba(0,0,0,0.06);
  --shadow-lg:      0 8px 32px rgba(0,0,0,0.12), 0 2px 8px rgba(0,0,0,0.08);
  --shadow-focus:   0 0 0 3px rgba(12, 78, 123, 0.20);
  --shadow-primary: 0 4px 16px rgba(12, 78, 123, 0.25);
  --shadow-green:   0 4px 16px rgba(60, 173, 116, 0.25);

  /* Animations */
  --ease-spring:  cubic-bezier(0.16, 1, 0.3, 1);
  --ease-out:     cubic-bezier(0.0, 0, 0.2, 1);
  --ease-in:      cubic-bezier(0.4, 0, 1, 1);
  --duration-fast:   120ms;
  --duration-base:   200ms;
  --duration-slow:   300ms;
  --duration-slower: 450ms;

  /* Layout */
  --nav-header-h: 52px;
  --tab-bar-h:    62px;
}

/* ── 2. RESET & BASE ─────────────────────────────────────────── */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  height: 100%;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  height: 100%;
  background: var(--bg);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: var(--weight-regular);
  line-height: var(--leading-normal);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overscroll-behavior: none;
}

img, svg { display: block; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; }

/* ── 2.5 ICON CONTAINER UNIVERSEL (chantier 26/05/2026) ──────
   Classe générique réutilisable : container neutre uniforme pour
   TOUTES les icônes app. La sémantique passe à la couleur de l'icône
   (currentColor) via la prop CSS `color:` du parent.
   Tokens : --icon-container-{bg,border,radius,size-sm,size-md,size-lg}
   définis dans design-tokens.css. */
.app-icon-container,
.app-icon-container--md {
  width: var(--icon-container-size-md);
  height: var(--icon-container-size-md);
  background: var(--icon-container-bg);
  border: 1px solid var(--icon-container-border);
  border-radius: var(--icon-container-radius);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.app-icon-container--sm {
  width: var(--icon-container-size-sm);
  height: var(--icon-container-size-sm);
}
.app-icon-container--lg {
  width: var(--icon-container-size-lg);
  height: var(--icon-container-size-lg);
}

/* ── 3. TYPOGRAPHY ───────────────────────────────────────────── */

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: var(--weight-heavy);
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-snug);
  color: var(--text-primary);
}

h1 { font-size: var(--text-3xl); }
h2 { font-size: var(--text-2xl); }
h3 { font-size: var(--text-xl); }
h4 { font-size: var(--text-lg); }

p { margin: 0 0 var(--space-4); line-height: var(--leading-relaxed); }
p:last-child { margin-bottom: 0; }
small { font-size: var(--text-sm); color: var(--text-secondary); }

/* ── 4. LAYOUT SHELL ─────────────────────────────────────────── */

.app-shell {
  display: flex;
  flex-direction: column;
  min-height: 100%;
  max-width: 480px;
  margin: 0 auto;
  position: relative;
}

/* Content area between header and tab bar */
.page-content {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: var(--space-4);
  padding-bottom: calc(var(--tab-bar-h) + var(--space-4));
}

.page-content--no-bottom { padding-bottom: var(--space-4); }
.page-content--flush { padding: 0; }

/* ── 5. NAV HEADER ───────────────────────────────────────────── */

.nav-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--color-primary);
  padding: 14px var(--space-4);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-height: var(--nav-header-h);
  -webkit-tap-highlight-color: transparent;
}

.nav-header__back {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  background: rgba(255,255,255,0.12);
  border: none;
  color: #fff;
  flex-shrink: 0;
  transition: background var(--duration-fast);
}
.nav-header__back:hover { background: rgba(255,255,255,0.20); }

.nav-header__title {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: var(--weight-heavy);
  color: #fff;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-header__actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-shrink: 0;
}

.nav-header__icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: var(--radius-full);
  background: rgba(255,255,255,0.10);
  border: none;
  color: rgba(255,255,255,0.80);
  transition: background var(--duration-fast), color var(--duration-fast);
}
.nav-header__icon-btn:hover { background: rgba(255,255,255,0.18); color: #fff; }

/* ── 6. TAB BAR ─────────────────────────────────────────────── */

.tab-bar {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  z-index: 100;
  background: var(--bg-white);
  border-top: 1px solid var(--neutral-100);
  display: flex;
  padding: 8px 0 10px;
  box-shadow: 0 -1px 0 var(--neutral-100);
}

.tab-bar__item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  cursor: pointer;
  border: none;
  background: none;
  padding: 4px 0;
  -webkit-tap-highlight-color: transparent;
  transition: opacity var(--duration-fast);
}

.tab-bar__icon {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* SL4.A 28/05 — passage stroke→color pour compat SVG app-icons V2 (paths
   ont stroke="currentColor" EXPLICITE → ne réagissent qu'au color: parent).
   Rétro-compatible Lucide V1 résiduels (paths héritent stroke du svg). */
.tab-bar__icon svg { width: 100%; height: 100%; color: var(--neutral-300); transition: color var(--duration-fast); }
.tab-bar__label { font-size: 10px; font-weight: var(--weight-medium); color: var(--neutral-400); transition: color var(--duration-fast); }

.tab-bar__item.active .tab-bar__icon svg { color: var(--color-primary); }
.tab-bar__item.active .tab-bar__label { color: var(--color-primary); }

/* ── 7. BUTTONS ──────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 10px 20px;
  border-radius: var(--radius-full);
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  border: none;
  cursor: pointer;
  min-height: 44px;
  transition: background var(--duration-fast), box-shadow var(--duration-fast), transform var(--duration-fast);
  -webkit-tap-highlight-color: transparent;
  white-space: nowrap;
  text-decoration: none;
}

.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.48; pointer-events: none; }

.btn--full { width: 100%; }

.btn--primary {
  background: var(--color-primary);
  color: var(--text-on-primary);
  box-shadow: var(--shadow-primary);
}
.btn--primary:hover { background: var(--color-primary-hover); }

.btn--green {
  background: var(--color-secondary);
  color: #fff;
  box-shadow: var(--shadow-green);
}
.btn--green:hover { background: var(--color-secondary-hover); }

.btn--secondary {
  background: var(--color-primary-subtle);
  color: var(--color-primary);
}
.btn--secondary:hover { background: rgba(12, 78, 123, 0.14); }

.btn--ghost {
  background: var(--bg-white);
  color: var(--text-secondary);
  border: 1.5px solid var(--border);
}
.btn--ghost:hover { border-color: var(--border-2); color: var(--text-primary); }

.btn--danger {
  background: var(--color-error-subtle);
  color: var(--color-error);
}
.btn--danger:hover { background: rgba(232, 66, 58, 0.14); }

.btn--sm {
  font-size: var(--text-sm);
  padding: 6px 14px;
  min-height: 34px;
}

.btn--lg {
  font-size: var(--text-md);
  padding: 13px 28px;
  min-height: 52px;
}

/* Icon button */
.btn-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  background: var(--color-primary-subtle);
  color: var(--color-primary);
  border: none;
  cursor: pointer;
  flex-shrink: 0;
  transition: background var(--duration-fast), transform var(--duration-fast);
  -webkit-tap-highlight-color: transparent;
}
.btn-icon:active { transform: scale(0.93); }
.btn-icon:hover { background: var(--color-primary-glow); }

/* FAB */
.fab {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 60px;
  height: 60px;
  border-radius: var(--radius-full);
  background: var(--color-secondary);
  color: #fff;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(60, 173, 116, 0.35);
  transition: background var(--duration-fast), transform var(--duration-fast), box-shadow var(--duration-fast);
  -webkit-tap-highlight-color: transparent;
}
.fab:hover { background: var(--color-secondary-hover); box-shadow: 0 6px 24px rgba(60, 173, 116, 0.45); }
.fab:active { transform: scale(0.93); }

/* ── 8. BADGES ───────────────────────────────────────────────── */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  white-space: nowrap;
  flex-shrink: 0;
}

.badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.badge--ok {
  background: var(--color-success-subtle);
  color: var(--green-600);
}
.badge--ok::before { background: var(--green-500); }

.badge--warn {
  background: var(--color-warning-subtle);
  color: var(--amber-700);
}
.badge--warn::before { background: var(--amber-500); }

.badge--err {
  background: var(--color-error-subtle);
  color: var(--red-600);
}
.badge--err::before { background: var(--red-500); }

.badge--navy {
  background: var(--color-primary-subtle);
  color: var(--navy-600);
}
.badge--navy::before { background: var(--navy-500); }

.badge--gray {
  background: var(--neutral-100);
  color: var(--neutral-600);
}
.badge--gray::before { background: var(--neutral-400); }

.badge--no-dot::before { display: none; }
.badge--md { font-size: var(--text-sm); padding: 4px 11px; }

/* ── 9. CARDS ────────────────────────────────────────────────── */

.card {
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  box-shadow: var(--shadow-sm);
}

.card--bordered {
  border: 1px solid var(--border);
  box-shadow: none;
}

/* Product row card */
.product-row {
  background: var(--bg-white);
  border-radius: 14px;
  padding: 14px var(--space-4);
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  gap: 14px;
  transition: box-shadow var(--duration-fast);
}
.product-row:active { box-shadow: var(--shadow-xs); }
.product-row--err { border: 1px solid rgba(232, 66, 58, 0.15); }

.product-row__thumb {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
  background: var(--neutral-100);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.product-row__thumb img { width: 100%; height: 100%; object-fit: cover; }
.product-row__thumb--ok   { background: var(--green-50); }
.product-row__thumb--warn { background: #fff8e6; }
.product-row__thumb--err  { background: #fff1f0; }

.product-row__info { flex: 1; min-width: 0; }
.product-row__name {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: var(--weight-semibold);
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: var(--leading-snug);
}
.product-row__meta {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── 10. FORMS ───────────────────────────────────────────────── */

.form-group { display: flex; flex-direction: column; gap: var(--space-2); }

.form-label {
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--text-secondary);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
}

.form-input,
.form-select {
  width: 100%;
  padding: 11px var(--space-4);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: var(--weight-regular);
  min-height: 48px;
  outline: none;
  transition: border-color var(--duration-fast), box-shadow var(--duration-fast);
  -webkit-appearance: none;
  appearance: none;
}

.form-input:focus,
.form-select:focus {
  border-color: var(--border-focus);
  box-shadow: var(--shadow-focus);
}

.form-input::placeholder { color: var(--text-tertiary); }
.form-input--error { border-color: var(--color-error); }
.form-input--error:focus { box-shadow: 0 0 0 3px rgba(232, 66, 58, 0.18); }

.form-hint { font-size: var(--text-sm); color: var(--text-tertiary); }
.form-error { font-size: var(--text-sm); color: var(--color-error); }

/* ── 11. SCAN SCREEN ──────────────────────────────────────────── */

.scan-view {
  position: relative;
  background: var(--bg-dark);
  overflow: hidden;
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* Camera feed placeholder / actual video */
.scan-camera {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Viewfinder overlay */
.scan-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-6);
}

.scan-frame {
  position: relative;
  width: 260px;
  height: 180px;
}

/* Corner brackets */
.scan-frame__corner {
  position: absolute;
  width: 28px;
  height: 28px;
  border-color: var(--color-secondary);
  border-style: solid;
  opacity: 0.95;
}
.scan-frame__corner--tl { top: 0; left: 0;  border-width: 3px 0 0 3px; border-radius: 3px 0 0 0; }
.scan-frame__corner--tr { top: 0; right: 0; border-width: 3px 3px 0 0; border-radius: 0 3px 0 0; }
.scan-frame__corner--bl { bottom: 0; left: 0;  border-width: 0 0 3px 3px; border-radius: 0 0 0 3px; }
.scan-frame__corner--br { bottom: 0; right: 0; border-width: 0 3px 3px 0; border-radius: 0 0 3px 0; }

/* Scanning line */
.scan-line {
  position: absolute;
  left: 8px;
  right: 8px;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--color-secondary), transparent);
  border-radius: 1px;
  animation: scanline 1.8s linear alternate infinite;
}

.scan-hint {
  font-size: var(--text-sm);
  color: rgba(255,255,255,0.70);
  text-align: center;
  max-width: 220px;
  line-height: var(--leading-relaxed);
}

/* ── 12. RESULT STATES ──────────────────────────────────────────── */

.result-sheet {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg-white);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  padding: var(--space-5) var(--space-4) var(--space-6);
  box-shadow: 0 -4px 32px rgba(0,0,0,0.20);
  transform: translateY(100%);
  transition: transform var(--duration-slower) var(--ease-spring);
  z-index: 10;
}

.result-sheet.is-open {
  transform: translateY(0);
}

.result-sheet__handle {
  width: 36px;
  height: 4px;
  background: var(--neutral-200);
  border-radius: var(--radius-full);
  margin: 0 auto var(--space-5);
}

.result-sheet__icon {
  width: 64px;
  height: 64px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto var(--space-4);
}

.result-sheet__icon--ok   { background: var(--color-success-subtle); color: var(--color-success); }
.result-sheet__icon--warn { background: var(--color-warning-subtle); color: var(--color-warning); }
.result-sheet__icon--err  { background: var(--color-error-subtle);   color: var(--color-error); }

/* DLC display — big Lato Heavy number */
.dlc-display {
  font-family: var(--font-display);
  font-weight: var(--weight-heavy);
  font-size: var(--text-2xl);
  letter-spacing: var(--tracking-tight);
  text-align: center;
  margin-bottom: var(--space-2);
}
.dlc-display--ok   { color: var(--color-success); }
.dlc-display--warn { color: var(--color-warning); }
.dlc-display--err  { color: var(--color-error); }

/* ── 13. EMPTY & ERROR STATES ──────────────────────────────────── */

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-4);
  padding: var(--space-12) var(--space-6);
  text-align: center;
}

.empty-state__icon {
  width: 72px;
  height: 72px;
  border-radius: var(--radius-full);
  background: var(--neutral-100);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--neutral-400);
}

.empty-state__title {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: var(--weight-heavy);
  color: var(--text-primary);
}

.empty-state__body {
  font-size: var(--text-base);
  color: var(--text-secondary);
  max-width: 260px;
  line-height: var(--leading-relaxed);
}

/* ── 14. STAT CARDS (dashboard) ─────────────────────────────── */

.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3);
}

.stat-card {
  background: var(--bg-white);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.stat-card__value {
  font-family: var(--font-display);
  font-weight: var(--weight-heavy);
  font-size: var(--text-2xl);
  letter-spacing: var(--tracking-tight);
  line-height: 1;
}

.stat-card__label {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  font-weight: var(--weight-medium);
}

.stat-card--primary .stat-card__value { color: var(--color-primary); }
.stat-card--ok      .stat-card__value { color: var(--color-success); }
.stat-card--warn    .stat-card__value { color: var(--color-warning); }
.stat-card--err     .stat-card__value { color: var(--color-error); }

/* ── 15. SECTION HEADERS ────────────────────────────────────── */

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-3);
}

.section-header__title {
  font-size: 13px;
  font-weight: 600;
  color: #6B7280;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.section-header__action {
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--text-brand);
}

/* ── 16. OFFLINE BANNER ─────────────────────────────────────── */

.offline-banner {
  display: none;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  background: var(--color-warning-subtle);
  border-bottom: 1px solid rgba(245, 166, 35, 0.20);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--amber-700);
}

.offline-banner.is-visible { display: flex; }

/* ── 17. TOAST ───────────────────────────────────────────────── */

.toast-container {
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  z-index: 200;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: var(--space-2);
  gap: var(--space-2);
}

.toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: var(--space-3);
  background: var(--neutral-800);
  color: #fff;
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  box-shadow: var(--shadow-lg);
  animation: toastslide 3.5s var(--ease-spring) forwards;
  max-width: calc(100% - 32px);
}

.toast--ok   { background: var(--green-700); }
.toast--warn { background: #b07309; }
.toast--err  { background: var(--red-600); }

/* ── 18. LOADING ─────────────────────────────────────────────── */

.spinner {
  display: inline-block;
  width: 22px;
  height: 22px;
  border: 2.5px solid rgba(255,255,255,0.30);
  border-top-color: #fff;
  border-radius: var(--radius-full);
  animation: spin 0.65s linear infinite;
}

.spinner--navy {
  border-color: var(--color-primary-subtle);
  border-top-color: var(--color-primary);
}

.spinner--sm { width: 16px; height: 16px; border-width: 2px; }
.spinner--lg { width: 32px; height: 32px; border-width: 3px; }

/* Page loading overlay */
.page-loader {
  position: fixed;
  inset: 0;
  background: var(--bg-white);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 300;
  transition: opacity var(--duration-slow);
}
.page-loader.is-hidden { opacity: 0; pointer-events: none; }

/* ── 19. DIVIDERS & SEPARATORS ───────────────────────────────── */

.divider {
  height: 1px;
  background: var(--border);
  margin: var(--space-4) 0;
}

.section-gap { height: var(--space-5); }

/* ── 20. KEYFRAMES ───────────────────────────────────────────── */

@keyframes scanline {
  0%   { top: 8%; }
  100% { top: 84%; }
}

@keyframes checkpop {
  0%   { transform: scale(0) rotate(-15deg); opacity: 0; }
  60%  { transform: scale(1.18) rotate(3deg); opacity: 1; }
  100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

@keyframes ringgrow {
  0%   { transform: scale(0.8); opacity: 0.7; }
  100% { transform: scale(1.8); opacity: 0; }
}

@keyframes toastslide {
  0%        { transform: translateY(-100%); opacity: 0; }
  12%, 85%  { transform: translateY(0);    opacity: 1; }
  100%      { transform: translateY(-100%); opacity: 0; }
}

@keyframes slideUp {
  from { transform: translateY(20px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.3; }
}

@keyframes shake {
  0%, 100%      { transform: translateX(0); }
  20%, 60% { transform: translateX(-4px); }
  40%, 80% { transform: translateX(4px); }
}

@keyframes cornerpulse {
  0%, 100% { opacity: 1;   transform: scale(1); }
  50%      { opacity: 0.6; transform: scale(0.97); }
}

/* ── 21. UTILITY CLASSES ─────────────────────────────────────── */

.u-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

.u-flex      { display: flex; }
.u-flex-col  { display: flex; flex-direction: column; }
.u-items-center { align-items: center; }
.u-justify-between { justify-content: space-between; }
.u-gap-2     { gap: var(--space-2); }
.u-gap-3     { gap: var(--space-3); }
.u-gap-4     { gap: var(--space-4); }
.u-mt-3      { margin-top: var(--space-3); }
.u-mt-4      { margin-top: var(--space-4); }
.u-mt-5      { margin-top: var(--space-5); }
.u-mt-6      { margin-top: var(--space-6); }
.u-mb-4      { margin-bottom: var(--space-4); }
.u-p-4       { padding: var(--space-4); }
.u-text-center { text-align: center; }
.u-text-sm   { font-size: var(--text-sm); }
.u-text-secondary { color: var(--text-secondary); }
.u-font-display { font-family: var(--font-display); font-weight: var(--weight-heavy); }
.u-truncate  { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.u-animate-slidein { animation: slideUp var(--duration-slow) var(--ease-spring) both; }

/* ── 22. SAFE AREAS (PWA) ───────────────────────────────────── */

@supports (padding: env(safe-area-inset-bottom)) {
  .tab-bar {
    padding-bottom: calc(10px + env(safe-area-inset-bottom));
    --tab-bar-h: calc(62px + env(safe-area-inset-bottom));
  }
  .page-content {
    padding-bottom: calc(var(--tab-bar-h) + var(--space-4));
  }
}

/* ── 23. RESPONSIVE ─────────────────────────────────────────── */

@media (min-width: 481px) {
  .app-shell {
    box-shadow: var(--shadow-lg);
    min-height: 100vh;
  }
  body { display: flex; align-items: flex-start; justify-content: center; background: var(--neutral-200); }
}

/* ── 24. PRODUCT ROW — STRIPE VARIANT ────────────────────────── */

/* Stripe: colored left border, no thumb, compact */
.product-row--stripe {
  border-left: 4px solid var(--neutral-200);
  border-radius: 0 14px 14px 0;
  padding-left: var(--space-4);
}
.product-row--stripe.stripe--ok   { border-left-color: var(--green-500); }
.product-row--stripe.stripe--warn { border-left-color: var(--amber-500); }
.product-row--stripe.stripe--err  { border-left-color: var(--red-500); }
.product-row--stripe.stripe--gray { border-left-color: var(--neutral-300); }

/* Mono date chip in product row */
.product-row__date {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: var(--weight-medium);
  color: var(--text-secondary);
  flex-shrink: 0;
  min-width: 38px;
  text-align: right;
}

/* ── 25. RESULT SHEET — REDESIGNED ──────────────────────────── */

.result-dlc-section {
  text-align: center;
  margin-bottom: var(--space-4);
}

.result-dlc-label {
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-wider);
  color: var(--text-tertiary);
  text-transform: uppercase;
  margin-bottom: var(--space-1);
}

.result-product-section {
  margin-bottom: var(--space-4);
}

.result-product-label {
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-wider);
  color: var(--text-tertiary);
  text-transform: uppercase;
  margin-bottom: var(--space-1);
}

/* ── 26. SCAN FRAME STATE OVERLAYS ──────────────────────────── */

/* Scan frame tints for ok/error states */
.scan-frame--ok .scan-frame__corner   { border-color: var(--green-500); opacity: 1; }
.scan-frame--err .scan-frame__corner  { border-color: var(--red-500);   opacity: 1; }

/* DLC detected pill overlay */
.scan-detected {
  position: absolute;
  bottom: -48px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(60, 173, 116, 0.95);
  color: #fff;
  padding: 6px 16px;
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  white-space: nowrap;
  box-shadow: 0 2px 12px rgba(60,173,116,0.35);
}

/* ── 27. LOGIN PAGE ──────────────────────────────────────────── */

.login-hero {
  background: var(--color-primary);
  padding: var(--space-10) var(--space-6) var(--space-8);
  text-align: center;
}

.login-hero__wordmark {
  font-family: var(--font-display);
  font-weight: var(--weight-heavy);
  font-size: 36px;
  letter-spacing: -0.02em;
  color: #fff;
}

.login-hero__wordmark span {
  color: var(--green-400);
}

.login-hero__tagline {
  font-size: var(--text-sm);
  color: rgba(255,255,255,0.65);
  margin-top: var(--space-2);
}

/* ── Logo de marque (chantier branding 05/05/2026) ─────────────
   Classe partagée pour insertion du logo HACCPilot dans les headers
   des pages métier. Hauteur 28px, ratio préservé. flex-shrink:0 pour
   éviter compression dans un parent flex. */
.brand-logo {
  height: 28px;
  width: auto;
  flex-shrink: 0;
}

/* ── Logo onboarding V2 (chantier 2A V2 step4 — 09/05/2026) ─────
   Modifier de .brand-logo pour les pages onboarding V2. Hauteur 48px
   (plus grand que le 28px utilitaire des pages métier brandées le 5 mai).
   Réutilisable pour step1/2/3/5/6 V2 lors du Volet B refonte visuelle. */
.onb-topbar__logo {
  height: 48px;
}

/* ── Stepper de seuils réglementaires (TEMP-04S-2) ─────────────
   Composant frontend/js/temp-stepper.js. Mobile-first, cibles ≥44px,
   valeur en <output> (lecture seule, pas de clavier). Pas de hover requis. */
.temp-stepper { display: flex; flex-direction: column; gap: 12px; }
.temp-stepper__row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.temp-stepper__label { font-size: 0.95rem; color: #374151; }
.temp-stepper__control { display: flex; align-items: center; gap: 8px; }
.temp-stepper__btn {
  min-width: 44px; min-height: 44px;
  border: 1px solid #d1d5db; border-radius: 10px; background: #fff;
  font-size: 1.5rem; line-height: 1; color: #111827; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
  transition: background-color 0.12s ease, opacity 0.12s ease;
}
.temp-stepper__btn:active { background: #f3f4f6; }
/* Bloqué : grisé MAIS cliquable (pas de [disabled] natif → le tap déclenche le toast). */
.temp-stepper__btn--blocked {
  opacity: 0.38; color: #9ca3af; border-color: #e5e7eb; background: #f9fafb;
}
.temp-stepper__value {
  min-width: 64px; text-align: center;
  font-size: 1.15rem; font-weight: 600; color: #111827; font-variant-numeric: tabular-nums;
}
/* Valeur hors-borne (04S-3a, mode honnête B+C) : la vraie valeur reste affichée mais
   signalée en alerte (rouge sur fond ambré). Le message contextuel est porté par l'appelant. */
.temp-stepper__value--out {
  color: #b91c1c; background: #fef2f2;
  border-radius: 6px; padding: 0 6px;
}
.temp-stepper__non-juge {
  border: 1px dashed #d1d5db; border-radius: 12px; background: #f9fafb;
  padding: 14px 16px; color: #4b5563;
}
.temp-stepper__non-juge strong { display: block; margin-bottom: 4px; color: #374151; }
.temp-stepper__non-juge p { margin: 0; font-size: 0.9rem; }

/* ── Modales bottom-sheet (relocalisé de configuration.html inline, 04S-3b-1) ──
   Partagé par configuration.html (equip-modal, team-modal) ET la modale équipement
   extraite (js/equipment-modal.js) + Step4. Aucune divergence : règles à l'identique. */
.cfg-modal {
  display: none; position: fixed; inset: 0; z-index: 9999;
  background: rgba(0,0,0,0.6); align-items: flex-end; justify-content: center;
}
.cfg-modal--open { display: flex; }
.cfg-modal__sheet {
  background: #fff; border-radius: 20px 20px 0 0; width: 100%; max-width: 520px;
  padding: 20px; display: flex; flex-direction: column; gap: 14px;
  max-height: 92dvh; overflow-y: auto;
}
.cfg-modal__handle {
  width: 36px; height: 4px; border-radius: 2px; background: #CBD5E1;
  margin: 0 auto -6px;
}
.cfg-modal__title { font-size: 17px; font-weight: 800; color: #1E293B; }
.cfg-modal__label { font-size: 13px; font-weight: 600; color: #374151; margin-bottom: 5px; display: block; }
.cfg-modal__input, .cfg-modal__select {
  width: 100%; padding: 11px 12px; border: 1.5px solid #E2E8F0; border-radius: 10px;
  font-size: 15px; color: #1E293B; font-family: inherit; background: #fff;
}
.cfg-modal__input:focus, .cfg-modal__select:focus { border-color: #2563EB; outline: none; }
.cfg-modal__select {
  appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748B' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px; cursor: pointer;
}
.cfg-modal__row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.cfg-modal__btns { display: flex; gap: 10px; padding-top: 4px; }
.btn-modal-cancel {
  flex: 1; padding: 13px; border-radius: 10px; font-size: 15px; font-weight: 600;
  background: #F1F5F9; color: #64748B; border: none; cursor: pointer; font-family: inherit;
}
.btn-modal-save {
  flex: 2; padding: 13px; border-radius: 10px; font-size: 15px; font-weight: 700;
  background: #2563EB; color: #fff; border: none; cursor: pointer; font-family: inherit;
}
.btn-modal-save--green { background: #16A34A; }
.btn-modal-save:disabled { opacity: 0.5; }

/* Modale équipement extraite — notes contextuelles (04S-3b-1). */
.eqm-note { margin: 0; font-size: 0.82rem; color: #64748B; }      /* « valeurs proposées » (discret) */
.eqm-error { margin: 0; font-size: 0.85rem; color: #b91c1c; font-weight: 600; } /* out-of-range */

/* ────────────────────────────────────────────────
   Sélecteur de langue — STYLE DE COMPOSANT (.auth-langs__*) déplacé d'auth.css vers app.css
   (i18n-T2). Source unique partagée : pages auth/forgot/reset/profil/plan + Dashboard (qui ne
   charge pas auth.css). Style INCHANGÉ. Variables : design-tokens (importé en tête d'app.css).
   Le CALAGE de position (.auth-langs{position…}) N'est PAS ici : c'est du layout de page,
   propre à chaque hôte (auth.css = coin haut-droit card ; dashboard.css = slot topbar).
   T-selector-final harmonisera ce style une fois pour les 6.
   ──────────────────────────────────────────────── */
.auth-langs__trigger {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  background: transparent;
  border: none;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  color: var(--color-text-secondary);
  cursor: pointer;
  border-radius: 10px;
  -webkit-tap-highlight-color: transparent;
}
.auth-langs__trigger:hover { background: var(--color-bg-soft); }
.auth-langs__trigger svg { color: var(--color-text-secondary); }
/* i18n-T-selector — drapeau emoji (remplace le globe au runtime) : taille/alignement.
   Le globe (.auth-langs__globe) n'existe plus à l'exécution (converti en __flag par le JS). */
.auth-langs__flag { font-size: 16px; line-height: 1; display: inline-block; }
/* i18n-T-selector-2c — chevron : le SVG injecté est 24×24 (attrs width/height du fix WebKit) ;
   la CSS l'emporte sur les attributs de présentation → calé à 16px (échelle du flag / chevron natif).
   Seul svg du trigger depuis le retrait du globe → ciblage sans effet de bord. */
.auth-langs__chevron svg { width: 16px; height: 16px; }

.auth-langs__menu {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  background: var(--color-bg);
  border: 1px solid var(--color-border-light);
  border-radius: 12px;
  box-shadow: var(--shadow-floating);
  padding: 6px;
  min-width: 140px;
  z-index: 10;
}
.auth-langs__menu[hidden] { display: none; }

.auth-langs__option {
  display: block;
  width: 100%;
  padding: 8px 12px;
  background: transparent;
  border: none;
  text-align: left;
  font-family: inherit;
  font-size: 14px;
  color: var(--color-text-primary);
  cursor: pointer;
  border-radius: 8px;
  -webkit-tap-highlight-color: transparent;
}
.auth-langs__option:hover { background: var(--color-bg-soft); }
.auth-langs__option--active {
  color: var(--color-primary-active);
  font-weight: 600;
}
