/* ─────────────────────────────────────────────────────────────
   HACCPilot — dashboard.css (Vague 1.4 Phase 2 SL-1-2)
   Refonte UI Dashboard V2 mockup mobile-first.
   Cohérent design tokens app.css (CSS vars).
   ───────────────────────────────────────────────────────────── */

body, .app-shell { background: #F8FAFC; }

/* ── Top bar ──────────────────────────────────────────────── */
.dash-topbar {
  background: #fff;
  padding: calc(env(safe-area-inset-top, 0px) + 14px) 20px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid #F1F5F9;
}
.dash-topbar__spacer { width: 36px; flex-shrink: 0; }
/* i18n-T2 — sélecteur de langue dans le topbar (slot gauche, remplace le spacer). EN FLUX
   (pas le calage absolu auth) ; position:relative = contexte d'ancrage du .auth-langs__menu. */
.dash-topbar .auth-langs { position: relative; flex-shrink: 0; }
.dash-topbar__logo {
  width: 150px;
  height: auto;
  display: block;
}
.dash-bell {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  cursor: pointer;
  position: relative;
  color: #374151;
  -webkit-tap-highlight-color: transparent;
}
.dash-bell svg { width: 22px; height: 22px; }
.dash-bell__dot {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-error);
  border: 2px solid #fff;
}

/* ── Greeting ─────────────────────────────────────────────── */
.dash-greeting-wrap {
  padding: 20px 20px 8px;
  text-align: center;
}
.dash-greeting {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  color: #1E3A5F;
  margin: 0;
}
.dash-subtitle {
  font-size: 14px;
  color: #6B7280;
  margin: 4px 0 0;
}

/* ── Scroll body ──────────────────────────────────────────── */
.dash-scroll {
  padding: 0 20px calc(80px + env(safe-area-inset-bottom, 0px));
}
.dash-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 8px;
}

/* ── Card Conformité HACCP ────────────────────────────────── */
.conf-card {
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}
.conf-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.conf-card__title {
  font-size: 14px;
  font-weight: 700;
  color: #1E3A5F;
  margin: 0;
}
.conf-card__info {
  width: 24px;
  height: 24px;
  border: none;
  background: none;
  cursor: pointer;
  color: #9CA3AF;
  font-size: 16px;
  padding: 0;
}
.conf-card__main {
  display: flex;
  align-items: center;
  gap: 20px;
}
.conf-donut {
  flex-shrink: 0;
  width: 130px;
  height: 130px;
  position: relative;
}
.conf-donut svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}
.conf-donut__pct {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 700;
  color: #1E3A5F;
  text-align: center;
  line-height: 1;
}
.conf-donut__pct small {
  font-size: 14px;
  font-weight: 600;
  color: #6B7280;
  display: block;
  margin-top: 2px;
}
.conf-card__right {
  flex: 1;
  min-width: 0;
}
.conf-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 700;
}
.conf-status--ok {
  background: var(--color-success-subtle);
  color: var(--color-success);
}
.conf-status--warn {
  background: var(--color-warning-subtle);
  color: var(--color-warning);
}
.conf-status--alert {
  background: var(--color-error-subtle);
  color: var(--color-error);
}
.conf-status__icon { font-size: 14px; line-height: 1; }
.conf-status__message {
  font-size: 13px;
  font-weight: 500;
  color: #4B5563;
  margin: 8px 0 12px;
  line-height: 1.4;
}
.conf-evolution__label {
  font-size: 11px;
  font-weight: 700;
  color: #9CA3AF;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  display: block;
  margin-bottom: 6px;
}
.conf-evolution__row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.conf-sparkline {
  flex: 1;
  height: 32px;
  background: #F8FAFC;
  border-radius: var(--radius-xs);
  position: relative;
  overflow: hidden;
}
.conf-sparkline svg {
  width: 100%;
  height: 100%;
}
.conf-evolution__delta {
  font-size: 13px;
  font-weight: 700;
  color: var(--color-success);
  flex-shrink: 0;
}
.conf-evolution__delta--negative { color: var(--color-error); }
.conf-footer {
  margin: 16px -20px -20px;
  padding: 12px 20px;
  background: #F8FAFC;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  font-size: 12px;
  color: #6B7280;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.conf-footer__icon {
  width: 14px;
  height: 14px;
  color: var(--color-success);
  flex-shrink: 0;
  display: inline-block;
}
/* SL4.B 28/05 — sizing svg injecté via data-icon-key */
.conf-footer__icon svg { width: 100%; height: 100%; display: block; }

/* ── CTA Scanner ──────────────────────────────────────────── */
.scan-cta {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 20px;
  /* Bleu vif primary-active mockup (var pas dispo app.css, fallback hexa) */
  background: #064CFC;
  color: #fff;
  border-radius: var(--radius-lg);
  text-decoration: none;
  box-shadow: 0 4px 16px rgba(6, 76, 252, 0.25);
  transition: transform 0.15s, box-shadow 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.scan-cta:active { transform: scale(0.98); }
.scan-cta__icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.18);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.scan-cta__icon svg { width: 24px; height: 24px; color: #fff; }
.scan-cta__text { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.scan-cta__text strong {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.scan-cta__text span { font-size: 13px; opacity: 0.85; }
.scan-cta__arrow { font-size: 20px; opacity: 0.85; }

/* ── À faire aujourd'hui ──────────────────────────────────── */
.todo-card {
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  box-shadow: var(--shadow-sm);
}
.todo-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.todo-card__header h3 {
  font-size: 14px;
  font-weight: 700;
  color: #1E3A5F;
  margin: 0;
}
.todo-card__badge {
  background: var(--color-warning-subtle);
  color: var(--color-warning);
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: var(--radius-full);
}
.todo-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: #fff;
  border: 1px solid #F1F5F9;
  border-left: 3px solid var(--color-warning);
  border-radius: var(--radius-md);
}
.todo-item__icon {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}
.todo-item__icon svg {
  width: 24px;
  height: 24px;
}
.todo-item__icon--warning {
  background: var(--color-warning-subtle);
  color: var(--color-warning);
}
.todo-item__icon--critical {
  background: var(--color-error-subtle);
  color: var(--color-error);
}
.todo-item__icon--info {
  background: rgba(37, 99, 235, 0.10);
  color: #2563EB;
}
/* Empty state "Tout est à jour 👍" */
.todo-item--empty {
  background: var(--color-success-subtle);
  border: 1px solid transparent;
  border-left: 3px solid var(--color-success);
  justify-content: center;
  text-align: center;
}
.todo-item--empty .todo-item__text strong {
  color: var(--color-success);
  font-size: 14px;
}
.todo-item__text { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.todo-item__text strong { font-size: 13px; color: #1E3A5F; }
.todo-item__text span { font-size: 12px; color: #6B7280; }
.todo-item__cta {
  font-size: 13px;
  font-weight: 600;
  color: #064CFC;
  text-decoration: none;
  flex-shrink: 0;
}

/* ── Accès rapides 2×2 ────────────────────────────────────── */
.quick-section__title {
  font-size: 14px;
  font-weight: 700;
  color: #1E3A5F;
  margin: 8px 0 12px;
}
.quick-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* ───────────────────────────────────────────────────────────────
   Refonte 28/05 SL4.B — layout VERTICAL iOS/Material.
   Hauteur fixe 120px, icône haut-gauche (Container universel 44×44
   intact), titre + sous-titre dessous, flèche absolute bas-droite.
   Préserve `min-width: 0` (défense piège grid 1fr 1fr).
   Anciens patches A+B+C1 (overflow:hidden sur > div, flex horizontal,
   ellipsis sub-only) supprimés : devenus inutiles avec ce layout —
   la pile horizontale icon+texte+arrow qui forçait le débordement
   n'existe plus. Ellipsis défensif gardé sur titre ET sous-titre pour
   robustesse future (i18n textes longs en EN/ES/IT).
   ─────────────────────────────────────────────────────────────── */
.quick-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
  height: 120px;
  background: #fff;
  border-radius: var(--radius-md);
  text-decoration: none;
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s, box-shadow 0.15s;
  -webkit-tap-highlight-color: transparent;
  min-width: 0; /* défense piège grid 1fr 1fr min-content */
}
.quick-card:active { transform: scale(0.97); }
/* a11y — focus visible clavier (touch target ≥ 44px conservé via height 120) */
.quick-card:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; }

/* Container icône — haut-gauche, pattern Container universel 44×44 intact */
.quick-card__icon {
  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: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.quick-card__icon--temp   { color: var(--color-error); }
.quick-card__icon--clean  { color: var(--color-success); }
.quick-card__icon--stock  { color: var(--color-warning); }
.quick-card__icon--config { color: var(--color-primary); }
.quick-card__icon svg { width: 22px; height: 22px; display: block; }

/* Bloc texte — sous l'icône, prend l'espace vertical restant.
   Ellipsis défensif 1 ligne sur titre ET sous-titre (i18n robuste).
   padding-right réserve l'espace de la flèche bas-droite (évite chevauchement). */
.quick-card > div {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  min-width: 0;
  padding-right: 22px;
}
.quick-card > div strong {
  font-size: 13px;
  color: #1E3A5F;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.quick-card > div span {
  font-size: 11px;
  color: #6B7280;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Flèche bas-droite — positionnement absolute hors flow (convention iOS) */
.quick-card__arrow {
  position: absolute;
  bottom: 12px;
  right: 14px;
  font-size: 18px;
  line-height: 1;
  color: #9CA3AF;
}

/* ── Activité du jour ─────────────────────────────────────── */
.activity-card {
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  box-shadow: var(--shadow-sm);
}
.activity-card__title {
  font-size: 14px;
  font-weight: 700;
  color: #1E3A5F;
  margin: 0 0 12px;
}
.activity-stats {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
}
.activity-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 8px 4px;
}
.activity-stat__label {
  font-size: 10px;
  font-weight: 600;
  color: #9CA3AF;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.activity-stat__value {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 700;
  color: #1E3A5F;
  margin: 4px 0;
  line-height: 1;
}
.activity-stat__value--warning { color: var(--color-warning); }
.activity-stat__value--error   { color: var(--color-error); }
.activity-stat__value--success { color: var(--color-success); }
.activity-stat__sub {
  font-size: 11px;
  color: #6B7280;
}

/* ── Tip "Bon à savoir" ───────────────────────────────────── */
.tip-card {
  display: flex;
  gap: 12px;
  padding: 14px 16px;
  background: var(--color-success-subtle);
  border-radius: var(--radius-md);
  border-left: 3px solid var(--color-success);
}
/* SL4.B 28/05 — tip-card emoji → SVG via data-icon-key */
.tip-card__icon { width: 20px; height: 20px; flex-shrink: 0; color: var(--color-success); display: inline-block; }
.tip-card__icon svg { width: 100%; height: 100%; display: block; }
.tip-card__content { flex: 1; display: flex; flex-direction: column; gap: 4px; }
.tip-card__content strong {
  font-size: 13px;
  font-weight: 700;
  color: var(--color-success);
}
.tip-card__content p {
  font-size: 12px;
  color: #4B5563;
  margin: 0;
  line-height: 1.4;
}
.tip-card__link {
  font-size: 12px;
  font-weight: 600;
  color: #064CFC;
  text-decoration: none;
  margin-top: 4px;
}

/* ── Responsive bonus (>768px tablet/desktop) ─────────────── */
@media (min-width: 768px) {
  .dash-scroll { max-width: 720px; margin: 0 auto; }
  .conf-card__main { gap: 28px; }
  .conf-donut { width: 160px; height: 160px; }
  .conf-donut__pct { font-size: 32px; }
}
