/* ════════════════════════════════════════════
   FOODCOST — Cupertino × Pain de Bretagne
   ════════════════════════════════════════════ */

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

/* ── Focus clavier visible partout (WCAG 2.4.7) ── */
:focus-visible {
  outline: 2.5px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}
input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2.5px solid var(--accent);
  outline-offset: 1px;
}

/* ── Lien d'évitement (WCAG 2.4.1) ── */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--navy);
  color: #fff;
  padding: .75rem 1.25rem;
  z-index: 1000;
  border-radius: 0 0 var(--radius-sm) 0;
  font-weight: 700;
}
.skip-link:focus {
  left: 0;
}

/* ── Contenu réservé aux lecteurs d'écran ── */
.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

@import url('https://fonts.googleapis.com/css2?family=Abril+Fatface&family=Source+Sans+Pro:wght@400;600;700&display=swap');
@font-face {
  font-family: "AguilaBold";
  src: url('/static/webfonts/guilaBold/font.woff2') format('woff2'),
       url('/static/webfonts/guilaBold/font.woff') format('woff');
  font-display: swap;
}

:root {
  /* Palette alignée sur le site public et les maquettes mobiles (img/) */
  --navy:        #00427F;
  --navy-dark:   #002D57;
  --navy-light:  #1A5A96;
  --blue-mid:    #2F6FD8;
  --blue-soft:   #EAF1FB;
  --accent:      #2F6FD8;
  --accent-hover:#1A54BC;

  --bg:          #F5F3EE;
  --surface:     #FFFFFF;
  --surface2:    #F5F3EE;
  --border:      rgba(0,66,127,.10);
  --border-mid:  rgba(0,66,127,.18);

  --text:        #0F1A3D;
  --text2:       #3A4A7A;
  --text-muted:  #5C6B93;

  --success:     #1DB070;
  --danger:      #E84040;
  --warning:     #F59E0B;

  --radius-sm:   10px;
  --radius:      14px;
  --radius-lg:   20px;
  --radius-pill: 100px;

  --shadow-sm:   0 2px 8px rgba(15,26,61,.07);
  --shadow:      0 4px 20px rgba(15,26,61,.10);
  --shadow-lg:   0 8px 32px rgba(15,26,61,.14);

  --font: 'Source Sans Pro', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-display: "AguilaBold", 'Abril Fatface', Georgia, serif;

  --navbar-h: 58px;
  --tabbar-h: 60px;
  --safe-b:   env(safe-area-inset-bottom, 0px);
}

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

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  padding-top: var(--navbar-h);
  padding-bottom: calc(var(--tabbar-h) + var(--safe-b) + 8px);
}

a { color: var(--accent); text-decoration: none; }
a:hover { opacity: .8; }

/* ══════════════════════════════
   INFO-BULLE (tooltip générique)
   ══════════════════════════════ */
[data-tooltip] { position: relative; }
[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  background: var(--navy);
  color: #fff;
  font-size: .68rem;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
  padding: .32rem .6rem;
  border-radius: 6px;
  white-space: nowrap;
  box-shadow: var(--shadow);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity .15s, transform .15s;
  z-index: 60;
}
[data-tooltip]::before {
  content: '';
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  margin-bottom: -3px;
  border: 5px solid transparent;
  border-top-color: var(--navy);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity .15s, transform .15s;
  z-index: 60;
}
[data-tooltip]:hover::after, [data-tooltip]:focus-visible::after,
[data-tooltip]:hover::before, [data-tooltip]:focus-visible::before {
  opacity: 1; visibility: visible; transform: translateX(-50%) translateY(0);
}

/* La navbar est collée en haut de l'écran : l'infobulle par défaut (au-dessus)
   sortirait de la fenêtre. On l'affiche donc en dessous pour ces icônes-là. */
.navbar [data-tooltip]::after {
  bottom: auto;
  top: calc(100% + 8px);
  transform: translateX(-50%) translateY(-4px);
}
.navbar [data-tooltip]::before {
  bottom: auto;
  top: 100%;
  margin-bottom: 0;
  margin-top: -3px;
  border-top-color: transparent;
  border-bottom-color: var(--navy);
  transform: translateX(-50%) translateY(-4px);
}
.navbar [data-tooltip]:hover::after, .navbar [data-tooltip]:focus-visible::after,
.navbar [data-tooltip]:hover::before, .navbar [data-tooltip]:focus-visible::before {
  transform: translateX(-50%) translateY(0);
}

/* ══════════════════════════════
   NAVBAR
   ══════════════════════════════ */
.navbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 300;
  height: var(--navbar-h);
  display: flex; align-items: center;
  padding: 0 1.25rem;
  background: var(--navy);
  box-shadow: 0 2px 12px rgba(15,26,61,.25);
}

.navbar-brand {
  font-family: var(--font-display);
  color: #fff;
  font-size: 1.25rem;
  font-weight: 400;
  letter-spacing: -.2px;
  display: flex; align-items: center; gap: .5rem;
}
.navbar-brand:hover { opacity: .9; }

.nav-links { display: none; list-style: none; gap: .25rem; margin-left: auto; }
.nav-links a {
  color: rgba(255,255,255,.65);
  font-size: .875rem;
  font-weight: 500;
  padding: .4rem .85rem;
  border-radius: var(--radius-pill);
  transition: background .15s, color .15s;
}
.nav-links a:hover  { color: #fff; background: rgba(255,255,255,.1); }
.nav-links a.active { color: #fff; background: rgba(255,255,255,.18); }

.navbar-icons { display: flex; align-items: center; gap: .15rem; margin-left: auto; }

.navbar-icon-btn {
  display: flex; align-items: center; justify-content: center;
  width: 34px; height: 34px;
  border-radius: 50%;
  font-size: 1.05rem;
  color: rgba(255,255,255,.75);
  transition: background .15s, color .15s;
  -webkit-tap-highlight-color: transparent;
}
.navbar-icon-btn:hover  { color: #fff; background: rgba(255,255,255,.1); opacity: 1; }
.navbar-icon-btn.active { color: #fff; background: rgba(255,255,255,.18); }

/* ══════════════════════════════
   TAB BAR — iOS + bouton central surélevé
   ══════════════════════════════ */
.tab-bar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 300;
  height: calc(var(--tabbar-h) + var(--safe-b));
  padding-bottom: var(--safe-b);
  display: flex; align-items: stretch;
  background: var(--surface);
  border-top: 1px solid var(--border);
  box-shadow: 0 -4px 20px rgba(15,26,61,.10);
}

.tab-item {
  flex: 1;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 3px;
  color: var(--text-muted);
  font-size: .58rem;
  font-weight: 600;
  letter-spacing: .03em;
  text-transform: uppercase;
  padding: .4rem 0 .2rem;
  transition: color .15s;
  -webkit-tap-highlight-color: transparent;
  position: relative;
}
.tab-item.active { color: var(--navy); }
.tab-item.active .tab-icon { color: var(--accent); }
.tab-icon { font-size: 1.3rem; line-height: 1; transition: transform .15s; }
.tab-item:active .tab-icon { transform: scale(.9); }
.tab-label { font-size: .58rem; }

/* Bouton central Production surélevé */
.tab-item.tab-center {
  position: relative;
  margin-top: -22px;
}
.tab-center-btn {
  width: 52px; height: 52px;
  border-radius: 50%;
  background: var(--navy);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 16px rgba(26,43,94,.40);
  transition: transform .15s, box-shadow .15s;
  color: #fff;
}
.tab-item.tab-center:active .tab-center-btn {
  transform: scale(.94);
  box-shadow: 0 2px 8px rgba(26,43,94,.30);
}
.tab-center .tab-label { margin-top: 4px; color: var(--navy); font-weight: 700; }

/* ══════════════════════════════
   CONTAINER
   ══════════════════════════════ */
.container { max-width: 980px; margin: 0 auto; padding: 1.25rem 1rem 1.5rem; }

/* ══════════════════════════════
   PAGE HEADER
   ══════════════════════════════ */
.page-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1.25rem; gap: .75rem;
}
.page-header h1 {
  font-family: var(--font-display);
  font-size: 1.7rem;
  font-weight: 400;
  letter-spacing: -.3px;
  color: var(--navy);
}
.prod-surtitle {
  font-size: .7rem; font-weight: 700; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .08em; margin-bottom: .1rem;
}

/* ══════════════════════════════
   MÉTÉO — dashboard
   ══════════════════════════════ */
.weather-grid { display: grid; grid-template-columns: 1fr; }
.weather-day { padding: 1rem 1.1rem; border-bottom: 1px solid var(--border); }
.weather-day:last-child { border-bottom: none; }
.weather-day-label {
  font-size: .68rem; font-weight: 700; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .07em; margin-bottom: .5rem;
}
.weather-main { display: flex; align-items: center; gap: .75rem; margin-bottom: .85rem; }
.weather-emoji { font-size: 2.4rem; line-height: 1; }
.weather-temp { font-family: var(--font-display); font-size: 1.5rem; font-weight: 400; color: var(--navy); letter-spacing: -.2px; }
.weather-desc { font-size: .85rem; color: var(--text2); }
.weather-details { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem 1.25rem; }
.weather-details > div { display: flex; justify-content: space-between; gap: .5rem; font-size: .82rem; }
.weather-details dt { color: var(--text-muted); font-weight: 600; white-space: nowrap; }
.weather-details dd { font-weight: 600; color: var(--text); text-align: right; }

/* Vent & hygrométrie mis en avant, au même niveau visuel que la température */
.weather-highlights { display: flex; gap: .6rem; margin-bottom: .9rem; }
.weather-highlight {
  flex: 1; display: flex; align-items: center; gap: .55rem;
  background: var(--surface2); border-radius: var(--radius-sm);
  padding: .55rem .7rem; border: 1px solid var(--border);
}
.weather-highlight-icon { font-size: 1.3rem; line-height: 1; flex-shrink: 0; }
.weather-highlight-val { font-size: 1.05rem; font-weight: 800; color: var(--navy); line-height: 1.15; }
.weather-highlight-label { font-size: .68rem; color: var(--text-muted); font-weight: 600; }

.wind-compass {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border-radius: 50%; flex-shrink: 0;
  background: var(--surface); border: 1px solid var(--border-mid);
}
.wind-arrow { display: inline-block; font-size: 1.1rem; line-height: 1; color: var(--text-muted); transition: transform .2s; }
.weather-highlight.wind-calme { border-color: rgba(29,176,112,.35); background: rgba(29,176,112,.07); }
.weather-highlight.wind-calme .wind-arrow { color: var(--success); font-size: .9rem; }
.weather-highlight.wind-modere { border-color: rgba(245,158,11,.4); background: rgba(245,158,11,.08); }
.weather-highlight.wind-modere .wind-arrow { color: var(--warning); font-weight: 700; }
.weather-highlight.wind-fort { border-color: var(--danger); background: rgba(232,64,64,.09); }
.weather-highlight.wind-fort .wind-arrow { color: var(--danger); font-weight: 800; font-size: 1.2rem; }
.weather-highlight.wind-fort .weather-highlight-val { color: var(--danger); }

@media (min-width: 640px) {
  .weather-grid { grid-template-columns: 1fr 1fr; }
  .weather-day { border-bottom: none; }
  .weather-day:first-child { border-right: 1px solid var(--border); }
}

/* ══════════════════════════════
   SANTÉ FINANCIÈRE — dashboard
   ══════════════════════════════ */
.finance-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--border); }
.finance-tile { background: var(--surface); padding: 1.1rem; }
.finance-tile-label {
  font-size: .68rem; font-weight: 700; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .06em; margin-bottom: .4rem;
}
.finance-tile-val { font-family: var(--font-display); font-size: 1.6rem; font-weight: 400; color: var(--navy); letter-spacing: -.2px; }
.finance-tile-val.muted { color: var(--text-muted); }
.finance-tile-val.finance-negatif { color: var(--danger); }
.finance-tile-sub { font-size: .78rem; color: var(--text-muted); margin-top: .3rem; }
.finance-note {
  padding: .75rem 1.1rem; font-size: .78rem; color: var(--text-muted);
  border-top: 1px solid var(--border); line-height: 1.5;
}

@media (min-width: 640px) {
  .finance-grid { grid-template-columns: repeat(4, 1fr); }
}

/* ══════════════════════════════
   STAT CARDS — dashboard
   ══════════════════════════════ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: .875rem;
  margin-bottom: 1.25rem;
}

.stat-card {
  position: relative;
  overflow: hidden;
  background-color: var(--navy);
  background-size: cover;
  background-position: center;
  border-radius: var(--radius);
  padding: 1.1rem 1rem;
  min-height: 108px;
  display: flex; flex-direction: column; justify-content: flex-end; gap: .2rem;
  text-decoration: none;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  transition: transform .12s, box-shadow .12s;
  -webkit-tap-highlight-color: transparent;
}
.stat-card::before {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(15,26,61,.10) 0%, rgba(15,26,61,.80) 100%);
}
.stat-card:active { transform: scale(.98); box-shadow: none; }
.stat-value {
  position: relative; z-index: 1;
  font-family: var(--font-display);
  font-size: 2.1rem; font-weight: 400;
  color: #fff; letter-spacing: -.3px; line-height: 1;
  text-shadow: 0 1px 4px rgba(0,0,0,.4);
}
.stat-label {
  position: relative; z-index: 1;
  font-size: .75rem; font-weight: 600;
  color: rgba(255,255,255,.9); letter-spacing: .01em;
  text-shadow: 0 1px 3px rgba(0,0,0,.4);
}

/* ══════════════════════════════
   CARDS
   ══════════════════════════════ */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  overflow: hidden;
}

.card-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: .875rem 1.1rem;
  border-bottom: 1px solid var(--border);
}
.card-header h2 {
  font-size: .72rem; font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .07em;
}

.mt-4 { margin-top: 1.25rem; }
.mb-3 { margin-bottom: 1rem; }

/* ══════════════════════════════
   BOUTONS
   ══════════════════════════════ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .35rem;
  padding: .55rem 1.1rem;
  border-radius: var(--radius-pill);
  border: none;
  font-family: var(--font);
  font-size: .85rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity .15s, transform .12s;
  text-decoration: none;
  line-height: 1.3;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(.97); }
.btn:hover  { opacity: .88; text-decoration: none; }

.btn-primary   { background: var(--navy); color: #fff; }
.btn-primary:hover { background: var(--navy-light); opacity: 1; }
.btn-secondary { background: var(--surface2); color: var(--text2); border: 1px solid var(--border-mid); }
.btn-outline   { background: transparent; color: var(--accent); border: 1.5px solid var(--accent); }
.btn-danger    { background: var(--danger); color: #fff; }

.btn-sm { padding: .35rem .75rem; font-size: .78rem; }
.btn-group { display: flex; gap: .5rem; flex-wrap: wrap; }

/* ══════════════════════════════
   TABLEAUX
   ══════════════════════════════ */
.table-scroll-outer {
  position: relative;
  overflow: hidden;
}
.table-scroll-outer::after {
  content: '';
  position: absolute;
  top: 0; right: 0; bottom: 0;
  width: 36px;
  background: linear-gradient(to right, transparent, var(--surface));
  pointer-events: none;
  transition: opacity .2s;
}
.table-scroll-outer.scrolled-end::after { opacity: 0; }

.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
}

.table { width: 100%; border-collapse: collapse; font-size: .875rem; min-width: 520px; }
.table tr.current-week td { background: var(--blue-soft); }
.table tr.current-week td:first-child { box-shadow: inset 3px 0 0 var(--accent); }

.table th {
  padding: .65rem 1rem;
  text-align: left;
  background: var(--surface2);
  font-size: .68rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .07em;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.table th.sortable { padding: 0; }
.table th.sortable a {
  display: flex; align-items: center; gap: .3rem;
  padding: .65rem 1rem;
  color: inherit;
  text-decoration: none;
  user-select: none;
}
.table th.sortable a:hover { color: var(--text); opacity: 1; }
.table th.sortable.sorted { color: var(--accent); }
.table th.text-right.sortable a { justify-content: flex-end; }
.table th.text-center.sortable a { justify-content: center; }
.sort-arrow { font-size: .6rem; }
.table td {
  padding: .8rem 1rem;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  vertical-align: middle;
}
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr { transition: background .1s; }
.table tbody tr:hover td { background: var(--blue-soft); }
.table tfoot td {
  padding: .8rem 1rem;
  background: var(--surface2);
  font-weight: 700;
  border-top: 1px solid var(--border-mid);
  border-bottom: none;
  color: var(--navy);
}

.table-toolbar {
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: .5rem;
  padding: .65rem 1rem;
  border-bottom: 1px solid var(--border);
}

.file-btn { position: relative; overflow: hidden; cursor: pointer; }
.file-btn input[type=file] {
  position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%;
}

.col-toggle { position: relative; display: inline-block; margin-left: auto; }
.col-toggle-menu {
  display: none;
  position: absolute; right: 0; top: calc(100% + 6px);
  background: var(--surface); border: 1px solid var(--border-mid);
  border-radius: var(--radius); box-shadow: var(--shadow-lg);
  padding: .4rem; min-width: 190px; z-index: 50;
}
.col-toggle.open .col-toggle-menu { display: block; }
.col-toggle-menu label {
  display: flex; align-items: center; gap: .5rem;
  padding: .4rem .5rem; border-radius: var(--radius-sm);
  font-size: .82rem; font-weight: 500;
  text-transform: none; letter-spacing: 0;
  color: var(--text); cursor: pointer;
}
.col-toggle-menu label:hover { background: var(--surface2); }
.col-toggle-menu input { width: auto; flex: none; }

.text-right  { text-align: right !important; }
.text-center { text-align: center !important; }
.price    { font-family: var(--font); font-size: .82rem; }
.highlight { color: var(--accent); font-weight: 700; }
.muted     { color: var(--text-muted); font-size: .85rem; }
.actions   { white-space: nowrap; display: flex; gap: .35rem; align-items: center; }
.inline    { display: inline; }

/* ══════════════════════════════
   ALERTES
   ══════════════════════════════ */
.alert {
  padding: .85rem 1rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
  font-size: .875rem;
  font-weight: 500;
  display: flex; align-items: center; gap: .5rem;
  border: 1px solid;
}
.alert-success { background: rgba(29,176,112,.08); border-color: rgba(29,176,112,.25); color: #0d7c50; }
.alert-warning { background: rgba(245,158,11,.08); border-color: rgba(245,158,11,.25); color: #9a6a00; }
.alert-danger  { background: rgba(232,64,64,.08);  border-color: rgba(232,64,64,.25);  color: #b52020; }

/* ══════════════════════════════
   FORMULAIRES
   ══════════════════════════════ */
.form-card { padding: 0; }

.form-grid { display: grid; grid-template-columns: 1fr; }

.form-group {
  display: flex; flex-direction: column;
  padding: .85rem 1.1rem;
  border-bottom: 1px solid var(--border);
  gap: .25rem;
}
.form-group:last-child { border-bottom: none; }
.form-group.full { grid-column: 1 / -1; }

.form-hint { font-size: .78rem; color: var(--text-muted); margin: .3rem 0 0; }

label {
  font-size: .68rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .07em;
}

input[type=text],
input[type=email],
input[type=number],
input[type=date],
input[type=tel],
input[type=password],
select,
textarea {
  padding: .35rem 0;
  border: none;
  border-radius: 0;
  font-family: var(--font);
  font-size: .975rem;
  font-weight: 500;
  width: 100%;
  background: transparent;
  color: var(--text);
  outline: none;
  -webkit-appearance: none;
}
select { cursor: pointer; }
textarea { resize: vertical; min-height: 72px; }

/* ── Bascule afficher/masquer mot de passe ── */
.password-field { position: relative; display: flex; align-items: center; }
.password-field input[type=password],
.password-field input[type=text] { padding-right: 2rem; }
.password-toggle-btn {
  position: absolute; right: 0; top: 50%; transform: translateY(-50%);
  background: none; border: none; cursor: pointer;
  font-size: 1rem; line-height: 1; padding: .25rem;
  color: var(--text-muted);
}
.password-toggle-btn:hover { color: var(--text); }

.input-group { display: flex; align-items: center; gap: .5rem; }
.input-group input { flex: 1; }
.input-addon {
  font-size: .9rem; font-weight: 600;
  color: var(--text-muted);
}
.required { color: var(--danger); }

.form-actions {
  display: flex; flex-direction: column;
  gap: .625rem; margin-top: 1.25rem;
}
.form-actions .btn {
  width: 100%;
  padding: .85rem 1rem;
  font-size: 1rem;
  border-radius: var(--radius);
}

.filter-bar {
  display: flex; flex-wrap: wrap; gap: .5rem;
  align-items: center; padding: .75rem 1rem;
}
.filter-bar input,
.filter-bar select {
  flex: 1; min-width: 120px;
  padding: .45rem .75rem;
  border: 1px solid var(--border-mid);
  border-radius: var(--radius-sm);
  background: var(--surface2);
  font-size: .875rem; font-weight: 500;
  color: var(--text);
  outline: none;
  -webkit-appearance: none;
}
.filter-bar input:focus,
.filter-bar select:focus { border-color: var(--accent); }

/* ══════════════════════════════
   DETAIL RECETTE / PRODUCTION
   ══════════════════════════════ */
.detail-grid { display: grid; grid-template-columns: 1fr; gap: 1rem; }

.cost-summary {
  padding: 1.75rem 1rem;
  text-align: center;
  background: var(--navy);
  color: #fff;
}
.cost-big {
  font-size: 2.5rem;
  font-weight: 800;
  font-family: var(--font);
  letter-spacing: -1.5px;
  color: #fff;
}
.cost-big.highlight { color: #64B5F6; }
.cost-label {
  font-size: .68rem; font-weight: 700;
  color: rgba(255,255,255,.55);
  text-transform: uppercase; letter-spacing: .1em;
  margin-top: .3rem;
}
.cost-divider { height: 1px; background: rgba(255,255,255,.15); margin: 1.1rem auto; width: 50%; }

.info-list { display: flex; flex-direction: column; }
.info-list dt {
  font-size: .68rem; font-weight: 700; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .07em;
  padding: .65rem 1.1rem .1rem;
}
.info-list dd {
  padding: 0 1.1rem .65rem;
  border-bottom: 1px solid var(--border);
  font-weight: 500;
}

/* ══════════════════════════════
   PRODUCTIONS
   ══════════════════════════════ */
.badge {
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--blue-soft); color: var(--accent);
  border-radius: var(--radius-pill);
  padding: .15rem .6rem;
  font-size: .72rem; font-weight: 700;
}
.badge-lg { font-size: .82rem; font-weight: 700; color: var(--text-muted); }

.prod-banner {
  display: flex; flex-wrap: wrap;
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.prod-banner-item {
  flex: 1 1 140px;
  display: flex; flex-direction: column;
  padding: 1rem 1.1rem;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.prod-banner-item:last-child { border-right: none; }
.prod-banner-label {
  font-size: .67rem; font-weight: 700; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .07em; margin-bottom: .3rem;
}
.prod-banner-value { font-size: .95rem; font-weight: 600; color: var(--text); }
.prod-banner-value.big { font-size: 1.5rem; font-weight: 800; letter-spacing: -.4px; color: var(--navy); }
.prod-banner-value.highlight { color: var(--accent); }
.prod-banner-value a { color: var(--accent); }
.prod-notes p { padding: .875rem 1.1rem; font-size: .9rem; color: var(--text2); }

code.lot-num {
  font-family: var(--font);
  font-size: .8rem;
  background: var(--blue-soft);
  color: var(--accent);
  padding: .15rem .45rem;
  border-radius: 6px;
  font-weight: 600;
}

.dlc-ok      { color: var(--success); font-weight: 600; }
.dlc-expired { color: var(--danger);  font-weight: 700; }
tr.row-danger td { background: rgba(232,64,64,.04); }

.trace-card-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: .875rem 1.1rem;
  border-bottom: 1px solid var(--border);
  gap: .75rem; flex-wrap: wrap;
}
.trace-ing  { font-weight: 700; font-size: .95rem; }
.trace-body { padding: .25rem 0; }
.trace-dl {
  display: grid; grid-template-columns: auto 1fr;
  gap: .4rem 1.25rem; padding: .5rem 1.1rem; align-items: baseline;
}
.trace-dl dt {
  font-size: .68rem; font-weight: 700; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .07em; white-space: nowrap;
}
.trace-dl dd { font-size: .9rem; font-weight: 500; }
.tracabilite-header p { color: var(--text2); font-size: .9rem; margin-bottom: .5rem; }

/* inputs lots */
.lot-num-input   { min-width: 120px; font-family: var(--font); font-size: .85rem; }
.lot-qte-input   { width: 90px; }
.lot-dlc-input   { min-width: 130px; }
.lot-notes-input { min-width: 120px; }
.lot-ing-select  { min-width: 160px; }

/* ══════════════════════════════
   MISC
   ══════════════════════════════ */
.pct-bar-wrap { display: flex; align-items: center; gap: .5rem; }
.pct-bar {
  height: 5px; background: var(--accent); border-radius: 3px;
  min-width: 2px; transition: width .4s cubic-bezier(.4,0,.2,1); opacity: .55;
}

.empty-state {
  padding: 2.75rem 1rem; text-align: center;
  color: var(--text-muted); font-size: .9rem;
}
.empty-state a { color: var(--accent); font-weight: 600; }

/* ══════════════════════════════
   FICHE PRODUIT (publique)
   ══════════════════════════════ */
.thumb-lg {
  display: block; width: 160px; height: 110px; object-fit: cover;
  border-radius: var(--radius-sm); border: 1px solid var(--border);
}
.thumb-gallery { display: flex; flex-wrap: wrap; gap: .875rem; }
.thumb-remove { display: flex; flex-direction: column; gap: .3rem; align-items: center; font-size: .78rem; color: var(--text-muted); }
.fiche-cards-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: .875rem;
}
.fiche-card {
  background: var(--surface); border-radius: var(--radius);
  border: 1px solid var(--border); box-shadow: var(--shadow-sm);
  overflow: hidden; text-decoration: none; color: var(--text);
  transition: transform .12s, box-shadow .12s;
}
.fiche-card:active { transform: scale(.98); }
.fiche-card-photo { width: 100%; aspect-ratio: 4/3; object-fit: cover; display: block; background: var(--surface2); }
.fiche-card-photo--empty {
  display: flex; align-items: center; justify-content: center;
  font-size: 2rem; color: var(--text-muted);
}
.fiche-card-body { padding: .75rem .85rem; }
.fiche-card-nom { font-weight: 700; font-size: .92rem; }
.fiche-card-sous-titre { font-size: .78rem; color: var(--text-muted); margin-top: .15rem; }

.fiche-produit { overflow: hidden; }
.fiche-hero { width: 100%; aspect-ratio: 16/9; object-fit: cover; display: block; }
.fiche-hero--empty {
  display: flex; align-items: center; justify-content: center;
  font-size: 3rem; color: var(--text-muted); background: var(--surface2);
}
.fiche-body { padding: 1.25rem 1.1rem; }
.fiche-title { font-size: 1.7rem; font-weight: 800; letter-spacing: -.5px; color: var(--text); }
.fiche-subtitle { font-size: 1rem; color: var(--text-muted); font-weight: 500; margin-top: .2rem; }
.fiche-description { font-size: .92rem; line-height: 1.6; color: var(--text2); margin-top: 1rem; }
.fiche-section-title {
  font-size: .72rem; font-weight: 700; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .07em;
  margin-top: 1.5rem; margin-bottom: .5rem;
}
.fiche-ing-list { list-style: none; }
.fiche-ing-list li {
  display: flex; justify-content: space-between; gap: 1rem;
  padding: .6rem 0; border-bottom: 1px solid var(--border); font-size: .9rem;
}
.fiche-ing-list li:last-child { border-bottom: none; }
.fiche-ing-qte { color: var(--text-muted); font-family: var(--font); font-size: .82rem; white-space: nowrap; }

.producteur-box { display: flex; gap: .9rem; align-items: flex-start; padding: 1.1rem; }
.producteur-avatar {
  width: 44px; height: 44px; border-radius: 50%; flex-shrink: 0;
  background: var(--blue-soft); color: var(--accent);
  display: flex; align-items: center; justify-content: center; font-size: 1.3rem;
}
.producteur-name { font-weight: 700; color: var(--text); }
.producteur-meta { font-size: .82rem; color: var(--text-muted); margin-top: .2rem; }

/* ══════════════════════════════
   HACCP
   ══════════════════════════════ */
.haccp-grid { display: grid; grid-template-columns: 1fr; gap: .875rem; margin-bottom: 1.25rem; }
@media (min-width: 640px) { .haccp-grid { grid-template-columns: repeat(3, 1fr); } }

.haccp-tile {
  background: var(--surface); border-radius: var(--radius); border: 1px solid var(--border);
  box-shadow: var(--shadow-sm); padding: 1.1rem; text-decoration: none; color: var(--text);
  display: flex; flex-direction: column; gap: .3rem;
  transition: transform .12s, box-shadow .12s;
}
.haccp-tile:active { transform: scale(.98); box-shadow: none; }
.haccp-tile-icon { font-size: 1.6rem; }
.haccp-tile-label { font-weight: 700; }
.haccp-tile-desc { font-size: .78rem; color: var(--text-muted); }

.etat-badge {
  display: inline-block; padding: .2rem .6rem; border-radius: var(--radius-pill);
  font-size: .72rem; font-weight: 700; white-space: nowrap;
}
.etat-conforme     { background: rgba(29,176,112,.12); color: #0d7c50; }
.etat-reserve      { background: rgba(245,158,11,.12); color: #9a6a00; }
.etat-non_conforme { background: rgba(232,64,64,.12);  color: #b52020; }
.thumb {
  width: 44px; height: 44px; object-fit: cover; border-radius: 8px;
  border: 1px solid var(--border); display: block;
}
.thumb-empty {
  background: var(--surface2); color: var(--text-muted);
  display: flex; align-items: center; justify-content: center;
}

/* ══════════════════════════════
   MESSAGES (SMS)
   ══════════════════════════════ */
.msg-list { display: flex; flex-direction: column; gap: .35rem; }
.msg-card {
  background: var(--surface); border-radius: var(--radius-sm); border: 1px solid var(--border);
  box-shadow: var(--shadow-sm); padding: .5rem .65rem;
}
.msg-row { display: flex; align-items: flex-start; gap: .55rem; }
.msg-checkbox { width: 16px; height: 16px; flex-shrink: 0; margin-top: .2rem; cursor: pointer; }

.msg-content { flex: 1 1 160px; min-width: 140px; }
.msg-card-header { display: flex; align-items: baseline; gap: .5rem; margin-bottom: .15rem; }
.msg-from-block { display: flex; align-items: baseline; gap: .4rem; flex-wrap: wrap; min-width: 0; }
.msg-client-nom { font-weight: 700; color: var(--navy); font-size: .84rem; text-decoration: none; }
.msg-client-nom:hover { text-decoration: underline; opacity: 1; }
.msg-from { font-weight: 600; color: var(--text-muted); font-family: var(--font); font-size: .7rem; text-decoration: none; }
.msg-from:hover { text-decoration: underline; opacity: 1; color: var(--accent); }
.msg-date { font-size: .68rem; color: var(--text-muted); white-space: nowrap; margin-left: auto; }
.msg-body { font-size: .82rem; line-height: 1.35; color: var(--text2); white-space: pre-wrap; margin: 0; }

.msg-side { flex: 0 0 auto; max-width: 44%; display: flex; flex-direction: column; align-items: flex-end; gap: .25rem; }

.msg-card--traite { opacity: .55; }
.msg-card--traite:hover { opacity: 1; }
.msg-card--traite .msg-body { display: none; }
.msg-card--traite .msg-row { align-items: center; }
.msg-card--traite .msg-side { flex-direction: row; align-items: center; }

.batch-submit:disabled { opacity: .4; cursor: not-allowed; }

.commande-pressentie {
  display: flex; flex-direction: column; align-items: flex-end; gap: .1rem;
  background: var(--blue-soft);
  border-radius: var(--radius-sm);
  padding: .35rem .55rem;
  font-size: .78rem;
  text-decoration: none;
  max-width: 100%;
}
.commande-pressentie:hover { opacity: .85; }
.commande-pressentie-icon { font-size: .72rem; }
.commande-pressentie-texte { color: var(--text); line-height: 1.35; text-align: right; }
.commande-pressentie-texte strong { color: var(--navy); }
.commande-pressentie-coupe { color: var(--text-muted); font-size: .72rem; }

@media (max-width: 480px) {
  .msg-row { flex-wrap: wrap; }
  .msg-side { max-width: 100%; align-items: flex-start; margin-left: 1.65rem; }
  .commande-pressentie { align-items: flex-start; }
  .commande-pressentie-texte { text-align: left; }
}

.pagination-bar {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 1.25rem; gap: .75rem;
}

/* ══════════════════════════════
   CONVERSATION SMS
   ══════════════════════════════ */
.conversation-card { padding: 1rem; max-height: 60vh; overflow-y: auto; }
.conversation-fil { display: flex; flex-direction: column; gap: .5rem; }

.bulle { display: flex; flex-direction: column; max-width: 78%; }
.bulle--entrant { align-self: flex-start; align-items: flex-start; }
.bulle--sortant { align-self: flex-end; align-items: flex-end; }

.bulle-corps {
  padding: .5rem .75rem; border-radius: var(--radius);
  font-size: .88rem; line-height: 1.4; white-space: pre-wrap;
}
.bulle--entrant .bulle-corps { background: var(--surface2); color: var(--text); border-bottom-left-radius: 4px; }
.bulle--sortant .bulle-corps { background: var(--navy); color: #fff; border-bottom-right-radius: 4px; }

.bulle-meta { font-size: .68rem; color: var(--text-muted); margin-top: .15rem; padding: 0 .3rem; }

.envoi-form { padding: 1rem; }
.envoi-form textarea {
  width: 100%; border: 1px solid var(--border-mid); border-radius: var(--radius-sm);
  padding: .6rem .75rem; font-family: var(--font); font-size: .92rem; resize: vertical;
}
.envoi-footer {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: .6rem; gap: .75rem; flex-wrap: wrap;
}
.envoi-compteur { font-size: .76rem; color: var(--text-muted); font-family: var(--font); }
.envoi-compteur--alerte { color: var(--warning); font-weight: 600; }

/* ══════════════════════════════
   COMMANDES
   ══════════════════════════════ */
.statut-nouvelle  { background: rgba(47,111,216,.12); color: var(--accent); }
.statut-confirmee { background: rgba(29,176,112,.12); color: #0d7c50; }
.statut-livree    { background: rgba(122,136,176,.15); color: var(--text2); }
.statut-annulee   { background: rgba(232,64,64,.12);  color: #b52020; }
/* ══════════════════════════════
   CLIENTS
   ══════════════════════════════ */
.statut-actif    { background: rgba(29,176,112,.12); color: #0d7c50; }
.statut-en_pause { background: rgba(245,158,11,.12); color: #9a6a00; }
.statut-resilie  { background: rgba(232,64,64,.12);  color: #b52020; }
.solde-negatif { color: var(--danger); }

.checkbox-label { display: flex; align-items: center; gap: .5rem; text-transform: none; letter-spacing: 0; font-size: .9rem; font-weight: 500; color: var(--text); cursor: pointer; }
.checkbox-label input { width: auto; }

.sms-client-liste { list-style: none; }
.sms-client-liste li { border-bottom: 1px solid var(--border); }
.sms-client-liste li:last-child { border-bottom: none; }
.sms-client-liste .checkbox-label { padding: .6rem 1.1rem; gap: .6rem; }
.sms-client-nom { font-weight: 600; }
.sms-client-tel { font-family: var(--font); font-size: .8rem; margin-left: auto; }

.sms-client-indispo { padding: .6rem 1.1rem; gap: .6rem; opacity: .55; cursor: default; }
.sms-client-indispo .sms-client-nom { font-weight: 500; }
.sms-client-icon { font-size: .95rem; flex-shrink: 0; cursor: help; }

.sms-resilies { border-top: 1px solid var(--border); }
.sms-resilies summary {
  padding: .6rem 1.1rem;
  font-size: .78rem; font-weight: 700; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .06em;
  cursor: pointer; list-style: none;
  display: flex; align-items: center; gap: .4rem;
  user-select: none;
}
.sms-resilies summary::-webkit-details-marker { display: none; }
.sms-resilies-fleche { display: inline-block; transition: transform .15s; font-size: .8rem; }
.sms-resilies[open] .sms-resilies-fleche { transform: rotate(90deg); }
.sms-resilies .sms-client-liste { border-top: 1px solid var(--border); }

/* ══════════════════════════════
   PARAMÈTRES
   ══════════════════════════════ */
.parametres-grid { display: grid; grid-template-columns: 1fr; gap: 1.25rem; }
@media (min-width: 900px) { .parametres-grid { grid-template-columns: repeat(3, 1fr); } }

.parametre-liste { list-style: none; }
.parametre-liste li {
  display: flex; align-items: center; justify-content: space-between;
  padding: .7rem 1.1rem; border-bottom: 1px solid var(--border);
  font-size: .9rem; font-weight: 500;
}
.parametre-liste li:last-child { border-bottom: none; }

/* ══════════════════════════════
   GRAPHIQUE HISTORIQUE PRIX
   ══════════════════════════════ */
.chart-wrap { padding: 1.1rem; }
.price-chart { width: 100%; height: 220px; display: block; overflow: visible; }
.price-line { fill: none; stroke: var(--accent); stroke-width: 2.5; }
.price-dot  { fill: var(--accent); }
.chart-labels {
  display: flex; justify-content: space-between; flex-wrap: wrap;
  gap: .25rem .6rem; margin-top: .5rem;
  font-size: .68rem; font-weight: 600; color: var(--text-muted);
}

/* ══════════════════════════════
   TABLETTE & DESKTOP ≥ 640px
   ══════════════════════════════ */
@media (min-width: 640px) {
  body { padding-top: var(--navbar-h); padding-bottom: 0; }
  .tab-bar { display: none; }
  .nav-links { display: flex; }

  .container { padding: 1.75rem 1.5rem 2.5rem; }

  .stats-grid { grid-template-columns: repeat(4, 1fr); gap: 1rem; }
  .stat-card { padding: 1.25rem 1.1rem; min-height: 130px; }
  .stat-value { font-size: 2.25rem; }

  .form-grid { grid-template-columns: 1fr 1fr; }
  .form-group { border-right: 1px solid var(--border); }
  .form-group:nth-child(even) { border-right: none; }
  .form-group.full { grid-column: 1 / -1; border-right: none; }

  .form-actions { flex-direction: row; flex-wrap: wrap; }
  .form-actions .btn {
    width: auto;
    padding: .6rem 1.4rem;
    font-size: .9rem;
    border-radius: var(--radius-pill);
  }

  .detail-grid { grid-template-columns: 1fr 260px; gap: 1.25rem; }
  .cost-summary { border-radius: var(--radius); }

  .info-list {
    display: grid; grid-template-columns: auto 1fr;
    gap: .4rem 1.25rem; padding: .875rem 1.1rem; align-items: start;
  }
  .info-list dt { padding: 0; }
  .info-list dd { padding: 0; border: none; }
}

@media (min-width: 900px) {
  .container { padding: 2rem 2rem 3rem; }
  .page-header h1 { font-size: 1.85rem; }
}

/* ══════════════════════════════
   CMS — pages du site
   ══════════════════════════════ */
.cms-editeur {
  font-family: var(--font); font-size: .82rem; line-height: 1.5;
  padding: .75rem; border: 1px solid var(--border-mid); border-radius: var(--radius-sm);
  background: var(--surface2); resize: vertical;
}

.cms-page-corps { padding: 1.5rem; line-height: 1.7; color: var(--text); }
.cms-page-corps h1, .cms-page-corps h2, .cms-page-corps h3 { margin: 1.2rem 0 .6rem; color: var(--navy); }
.cms-page-corps h1:first-child, .cms-page-corps h2:first-child, .cms-page-corps h3:first-child { margin-top: 0; }
.cms-page-corps p { margin-bottom: 1rem; }
.cms-page-corps ul, .cms-page-corps ol { margin: 0 0 1rem 1.4rem; }
.cms-page-corps a { color: var(--accent); text-decoration: underline; }
.cms-page-corps img { max-width: 100%; border-radius: var(--radius-sm); }
