/* ============================================================
   BLÉ & LEVAIN — OS  ·  Design system
   Boulangerie artisanale · Pleuven (29) · hors-ligne · zéro dépendance
   Thèmes : Jour (clair) · Nuit (sombre)
   ============================================================ */

/* — Design tokens now live in assets/tokens.css (the canonical Design System
   mirror), linked BEFORE this file in index.html. Palette, surfaces, text,
   semantic colours, type scale, spacing, effects, both themes (Jour/Nuit) and
   the "TeX Gyre Pagella" @font-face all come from there — single source of
   truth. Do not re-declare tokens here; re-sync tokens.css from the canonical
   Design System (Bakery\06_Marketing_and_Branding\Design System\tokens). */

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
/* Supprime le délai de 300ms du double-tap-zoom (pincer-zoomer reste possible) — réponse tactile immédiate. */
html { touch-action: manipulation; }

/* Bandeau du mode démo (?demo=1) — statique en tête de page, pousse le contenu, safe-area incluse. */
.demo-strip {
  padding: calc(7px + env(safe-area-inset-top)) 14px 7px;
  background: var(--croute-fonce); color: #f7ecd7;
  font-size: 12.5px; text-align: center; line-height: 1.45;
}
.demo-strip a { color: var(--ble); font-weight: 700; text-decoration: none; }
body {
  background: var(--bg);
  color: var(--txt);
  font-family: var(--sans);
  font-size: 15px; line-height: 1.5;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
  transition: background var(--t-rapide), color var(--t-rapide);
}
a { color: inherit; }
::selection { background: var(--ble-clair); color: var(--croute-fonce); }

/* ——————————————————————————————— Mise en page */
.app { display: grid; grid-template-columns: 264px 1fr; min-height: 100vh; }

.sidebar {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  background:
    radial-gradient(120% 60% at 20% 0%, rgba(212,169,58,.18), transparent 60%),
    linear-gradient(180deg, var(--croute-fonce), #3a230e 60%, #2e1b09);
  color: #f7ecd7; padding: 22px 14px 30px; z-index: 20;
  scrollbar-width: thin;
}
.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.14); border-radius: 6px; }

.brand { display: flex; align-items: center; gap: 12px; padding: 4px 8px 20px; }
.brand .logo {
  width: 46px; height: 46px; flex: 0 0 46px; border-radius: 14px;
  background: radial-gradient(circle at 32% 28%, var(--ble-clair), var(--or));
  display: grid; place-items: center;
  box-shadow: inset 0 0 0 2px rgba(255,255,255,.28), 0 6px 16px rgba(0,0,0,.3);
}
.brand .logo svg { width: 28px; height: 28px; }
.brand .name { font-family: var(--serif); font-size: 21px; font-weight: 600; line-height: 1.05; }
.brand .sub  { font-size: 10px; opacity: .7; letter-spacing: 3px; text-transform: uppercase; margin-top: 2px; }

.nav { list-style: none; margin: 6px 0 0; padding: 0; }
.nav li { margin: 1px 0; }
.nav a {
  position: relative; display: flex; align-items: center; gap: 12px;
  padding: 9px 12px; border-radius: 11px; color: rgba(247,236,215,.78);
  text-decoration: none; font-size: 14px; transition: background var(--t-rapide), color var(--t-rapide), transform var(--t-rapide);
}
.nav a .ic { width: 20px; height: 20px; display: grid; place-items: center; opacity: .85; }
.nav a .ic svg { width: 19px; height: 19px; }
.nav a:hover { background: rgba(255,255,255,.08); color: #fff; transform: translateX(2px); }
.nav a.actif { background: linear-gradient(90deg, rgba(212,169,58,.28), rgba(212,169,58,.08)); color: #fff; font-weight: 600; }
.nav a.actif::before {
  content:""; position: absolute; left: -14px; top: 50%; transform: translateY(-50%);
  width: 4px; height: 22px; border-radius: 0 4px 4px 0; background: var(--ble);
  box-shadow: 0 0 12px var(--ble);
}
.nav a .badge {
  margin-left: auto; background: var(--rouge); color: #fff;
  font-size: 11px; font-weight: 700; border-radius: 20px; padding: 1px 7px; min-width: 18px; text-align: center;
}
.nav-sep { margin: 16px 10px 7px; font-size: 9px; letter-spacing: 2.5px; text-transform: uppercase; opacity: .45; }
.side-foot { margin-top: 18px; padding: 12px 10px 0; border-top: 1px solid rgba(255,255,255,.1); font-size: 11px; opacity: .6; line-height: 1.6; }
.side-legal { margin: 4px 10px 0; font-size: 11px; }
.side-legal a { color: #f7ecd7; text-decoration: underline; text-underline-offset: 2px; opacity: .85; }
.side-legal a:hover, .side-legal a:focus-visible { opacity: 1; }

/* — Compte & synchronisation (dans le tiroir / sidebar) — */
.acc-wrap { margin-top: 16px; }
.account { background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.12); border-radius: 13px; padding: 13px 13px 14px; }
.account .acc-title { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 13.5px; color: #fff; }
.account .acc-title svg { width: 17px; height: 17px; color: var(--ble-clair); }
.account .acc-sub { font-size: 11.5px; opacity: .7; margin: 6px 0 11px; line-height: 1.5; }
.account .acc-input {
  width: 100%; box-sizing: border-box; border: 1px solid rgba(255,255,255,.2);
  background: rgba(0,0,0,.18); color: #fff; border-radius: 9px; padding: 10px 12px;
  font: inherit; font-size: 14px; margin-bottom: 9px;
}
.account .acc-input::placeholder { color: rgba(255,255,255,.4); }
.account .acc-input:focus { outline: none; border-color: var(--ble); box-shadow: 0 0 0 3px rgba(212,169,58,.2); }
.account .acc-btn { width: 100%; justify-content: center; }
.account .acc-head { display: flex; align-items: center; gap: 9px; color: #fff; font-weight: 600; }
.account .acc-head svg { width: 18px; height: 18px; color: var(--ble-clair); flex: 0 0 18px; }
.account .acc-mail { font-size: 13px; word-break: break-all; line-height: 1.3; }
.account .acc-status { display: flex; align-items: center; gap: 7px; font-size: 11.5px; opacity: .85; margin: 9px 0; min-height: 16px; }
.account .acc-status:empty { margin: 0; }
.account .acc-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ble-clair); flex: 0 0 7px; }
.account .acc-dot.ok { background: #57c98a; }
.account .acc-dot.bad { background: #e98080; }
.account.signed .acc-btn { background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.16); color: #f7ecd7; }

/* ——————————————————————————————— Barre supérieure */
.main { position: relative; }
.topbar {
  position: sticky; top: 0; z-index: 15;
  display: flex; align-items: center; gap: 14px; padding: 13px 30px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(12px) saturate(1.2);
  border-bottom: 1px solid var(--ligne);
}
.topbar .crumb { font-family: var(--serif); font-size: 20px; font-weight: 600; min-width: 0; }
.topbar .crumb small { font-family: var(--sans); font-size: 12px; color: var(--txt-2); font-weight: 500; display: block; letter-spacing: .3px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .spacer { flex: 1; }

.seg { display: inline-flex; border: 1px solid var(--ligne-fort); border-radius: 30px; overflow: hidden; background: var(--surface); }
.seg button { border: 0; background: transparent; padding: 6px 13px; cursor: pointer; font: inherit;
  font-size: 12px; font-weight: 700; color: var(--txt-2); letter-spacing: .4px; transition: background var(--t-rapide), color var(--t-rapide); }
.seg button.actif { background: var(--ble); color: var(--croute-fonce); }

.icon-btn {
  width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--ligne-fort);
  background: var(--surface); color: var(--txt); cursor: pointer; display: grid; place-items: center;
  transition: background var(--t-rapide), transform var(--t-rapide), border-color var(--t-rapide);
}
.icon-btn:hover { background: var(--surface-2); border-color: var(--ble); transform: translateY(-1px); }
.icon-btn svg { width: 18px; height: 18px; }

.tools { display: flex; gap: 8px; }
.btn {
  border: 1px solid var(--ligne-fort); background: var(--surface); color: var(--txt);
  padding: 8px 14px; border-radius: var(--rayon-sm); cursor: pointer; font: inherit;
  font-size: 13px; font-weight: 600; display: inline-flex; align-items: center; gap: 7px;
  transition: background var(--t-rapide), border-color var(--t-rapide), transform var(--t-rapide), box-shadow var(--t-rapide);
}
.btn svg { width: 15px; height: 15px; }
.btn:hover { background: var(--surface-2); border-color: var(--ble); transform: translateY(-1px); box-shadow: var(--ombre-1); }
.btn:active { transform: translateY(0); }
.btn.primaire { background: linear-gradient(120deg, var(--croute), #8a561f); color: #fff; border-color: transparent; }
.btn.primaire:hover { filter: brightness(1.08); }
.btn.mini { padding: 5px 10px; font-size: 12px; }
.btn.ghost { background: transparent; border-color: transparent; }

/* ——————————————————————————————— Page */
.page { padding: 26px 30px 0; max-width: 1240px; }
.page .lede { color: var(--txt-2); margin: -6px 0 22px; max-width: 760px; font-size: 14.5px; }

.grid { display: grid; gap: 18px; }
.k4 { grid-template-columns: repeat(4,1fr); }
.k3 { grid-template-columns: repeat(3,1fr); }
.k2 { grid-template-columns: repeat(2,1fr); }
.span2 { grid-column: span 2; }

/* ——————————————————————————————— Hero (tableau de bord) */
.hero {
  position: relative; overflow: hidden; border-radius: 22px; margin-bottom: 20px;
  padding: 30px 32px; color: #fff;
  background:
    radial-gradient(130% 120% at 88% -10%, rgba(212,169,58,.42), transparent 52%),
    linear-gradient(120deg, #3f250e, #5a3414 52%, #6f421b);
  box-shadow: var(--ombre-hero);
}
.hero canvas.ambient { position: absolute; inset: 0; width: 100%; height: 100%; opacity: .55; pointer-events: none; }
.hero .hero-grain { position: absolute; inset: 0; opacity: .08; pointer-events: none;
  background-image: radial-gradient(rgba(255,255,255,.7) .5px, transparent .6px); background-size: 4px 4px; }
.hero .inner { position: relative; z-index: 2; display: flex; align-items: center; gap: 26px; flex-wrap: wrap; }
.hero .eyebrow { font-size: 11px; letter-spacing: 4px; text-transform: uppercase; color: var(--ble-clair); }
.hero h1.title { font-family: var(--serif); font-size: 44px; line-height: 1.02; margin: 8px 0 6px; font-weight: 600; }
.hero .addr { color: rgba(255,255,255,.8); font-size: 14px; display: flex; align-items: center; gap: 8px; }
.hero .addr svg { width: 16px; height: 16px; flex: 0 0 16px; opacity: .85; }
.alert > span { flex: 0 0 20px; }
.hero .chips { margin-top: 16px; display: flex; gap: 8px; flex-wrap: wrap; }
.hero .chip { background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.18); color: #fff;
  padding: 5px 12px; border-radius: 30px; font-size: 12.5px; font-weight: 500; backdrop-filter: blur(4px); }
.hero .ring-wrap { margin-left: auto; text-align: center; }
.hero .ring-cap { font-size: 11px; letter-spacing: 2px; text-transform: uppercase; color: rgba(255,255,255,.75); margin-top: 6px; }

.ring { position: relative; width: 132px; height: 132px; }
.ring svg { transform: rotate(-90deg); }
.ring .track { fill: none; stroke: rgba(255,255,255,.16); stroke-width: 9; }
.ring .prog { fill: none; stroke: url(#ringGrad); stroke-width: 9; stroke-linecap: round; }
.ring .ctr { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; text-align: center; row-gap: 3px; }
.ring .ctr b { font-family: var(--serif); font-size: 30px; line-height: 1; color: #fff; font-variant-numeric: tabular-nums; }
.ring .ctr span { font-size: 8.5px; letter-spacing: 1.4px; text-transform: uppercase; color: var(--ble-clair); max-width: 96px; white-space: nowrap; }

/* ——————————————————————————————— Cartes */
.card {
  background: var(--surface); border: 1px solid var(--ligne); border-radius: var(--rayon);
  box-shadow: var(--ombre-1); overflow: hidden;
  transition: transform var(--t-rapide), box-shadow var(--t-rapide), border-color var(--t-rapide);
}
.card:hover { box-shadow: var(--ombre-2); border-color: var(--ligne-fort); }
.card.lift:hover { transform: translateY(-3px); }
.card > .h {
  margin: 0; padding: 14px 18px; font-family: var(--serif); font-size: 16.5px; font-weight: 600;
  display: flex; align-items: center; gap: 10px; border-bottom: 1px solid var(--ligne);
}
.card > .h .hic { width: 26px; height: 26px; border-radius: 8px; background: var(--surface-2);
  display: grid; place-items: center; color: var(--croute); }
.card > .h .hic svg { width: 16px; height: 16px; }
.card > .h .actions { margin-left: auto; display: flex; gap: 7px; }
.card .body { padding: 16px 18px; }
.card .body.flush { padding: 0; }

/* KPI */
.kpi { position: relative; padding: 17px 18px; }
.kpi .label { font-size: 11px; color: var(--txt-2); text-transform: uppercase; letter-spacing: 1.2px; display: flex; align-items: center; gap: 7px; }
.kpi .label svg { width: 14px; height: 14px; color: var(--or); }
.kpi .value { font-family: var(--serif); font-size: 30px; font-weight: 600; margin: 6px 0 0; font-variant-numeric: tabular-nums; }
.kpi .value.sm { font-size: 23px; }
.kpi .foot { font-size: 12px; color: var(--txt-2); margin-top: 3px; }
.kpi.accent { background: linear-gradient(180deg, var(--surface), var(--ambre-bg)); }
.kpi .spark { position: absolute; right: 16px; bottom: 14px; opacity: .5; }

/* ——————————————————————————————— Tableaux */
.tbl-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
thead th { text-align: left; font-size: 11px; letter-spacing: .6px; text-transform: uppercase; color: var(--txt-2);
  font-weight: 700; padding: 11px 14px; background: var(--surface-2); border-bottom: 1px solid var(--ligne); white-space: nowrap; }
tbody td { padding: 10px 14px; border-bottom: 1px solid var(--ligne); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr { transition: background var(--t-rapide); }
tbody tr:hover { background: var(--surface-2); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.center, th.center { text-align: center; }
tfoot td { padding: 11px 14px; border-top: 2px solid var(--ligne-fort); font-weight: 700; background: var(--surface-2); }

.cell-input { width: 100%; min-width: 64px; border: 1px solid transparent; background: transparent; padding: 6px 8px;
  border-radius: 7px; font: inherit; color: inherit; text-align: right; font-variant-numeric: tabular-nums;
  transition: border-color var(--t-rapide), background var(--t-rapide); }
.cell-input:hover { border-color: var(--ligne-fort); }
.cell-input:focus { border-color: var(--ble); background: var(--surface); outline: none; box-shadow: 0 0 0 3px rgba(212,169,58,.18); }
.cell-input.txt { text-align: left; min-width: 120px; }

/* ——————————————————————————————— Pastilles */
.tag { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 20px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.tag.ok{background:var(--vert-bg);color:var(--vert)} .tag.warn{background:var(--ambre-bg);color:var(--ambre)}
.tag.bad{background:var(--rouge-bg);color:var(--rouge)} .tag.info{background:var(--bleu-bg);color:var(--bleu)}
.tag.todo{background:var(--surface-2);color:var(--txt-2)} .tag.gratuit{background:var(--vert);color:#fff}
.dot-pulse { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }

.placeholder-note { display: flex; gap: 11px; align-items: flex-start; background: var(--ambre-bg);
  border: 1px dashed var(--ambre); color: var(--croute-fonce); border-radius: var(--rayon-sm);
  padding: 11px 15px; font-size: 13px; margin: 0 0 16px; }
:root[data-theme="nuit"] .placeholder-note { color: var(--ble-clair); }
.placeholder-note svg { width: 18px; height: 18px; flex: 0 0 18px; color: var(--ambre); }

.alert { display: flex; gap: 12px; align-items: flex-start; background: var(--rouge-bg);
  border-left: 4px solid var(--rouge); border-radius: var(--rayon-sm); padding: 12px 16px; margin-bottom: 12px; }
.alert svg { width: 20px; height: 20px; color: var(--rouge); flex: 0 0 20px; }
.alert .t { font-weight: 700; color: var(--rouge); }
.alert.warn { background: var(--ambre-bg); border-left-color: var(--ambre); }
.alert.warn svg, .alert.warn .t { color: var(--ambre); }
/* alertes cliquables (tableau de bord) — la ligne EST le lien vers la page qui répare */
a.alert { color: var(--txt); text-decoration: none; align-items: center;
  transition: transform var(--t-rapide), box-shadow var(--t-rapide); }
a.alert:hover { transform: translateX(2px); box-shadow: var(--ombre-1); }
a.alert .muted { font-weight: 500; }
.alert-chev { margin-left: auto; display: grid; place-items: center; opacity: .45; }
.alert-chev svg { width: 16px; height: 16px; flex: 0 0 16px; color: currentColor; }
.dash-ok { display: flex; align-items: center; gap: 10px; padding: 14px 4px; color: var(--vert); font-weight: 600; }
.dash-ok svg { width: 20px; height: 20px; flex: 0 0 20px; }
.dash-orders { display: grid; gap: 10px; }
.dash-order { padding: 11px 14px; background: var(--surface-2); border-radius: var(--rayon-sm);
  border-left: 4px solid var(--ble); }
.dash-order .do-client { font-weight: 700; }
.dash-order .do-lines { font-size: 13px; color: var(--txt-2); margin-top: 2px; }
.dash-order .do-note { font-size: 12.5px; color: var(--txt-3); margin-top: 4px; font-style: italic; }

/* listes clé/valeur */
.dl .row { display: flex; justify-content: space-between; gap: 14px; padding: 9px 0; border-bottom: 1px solid var(--ligne); }
.dl .row:last-child { border-bottom: 0; }
.dl .k { color: var(--txt-2); } .dl .v { font-weight: 600; text-align: right; }

.muted { color: var(--txt-2); } .tbd { color: var(--ambre); font-style: italic; }

.bar { height: 9px; background: var(--surface-2); border-radius: 20px; overflow: hidden; }
.bar > span { display: block; height: 100%; border-radius: 20px; width: 0;
  background: linear-gradient(90deg, var(--ble), var(--croute)); transition: width 1.1s cubic-bezier(.34,1,.3,1); }

/* timeline */
.timeline { list-style: none; margin: 0; padding: 4px 4px 4px 8px; }
.timeline li { position: relative; padding: 0 0 18px 28px; border-left: 2px solid var(--ligne); }
.timeline li:last-child { border-left-color: transparent; }
.timeline li .dot { position: absolute; left: -9px; top: 1px; width: 16px; height: 16px; border-radius: 50%;
  background: var(--surface); border: 3px solid var(--ble); }
.timeline li.done .dot { background: var(--vert); border-color: var(--vert); }
.timeline li.urgent .dot { border-color: var(--rouge); }
.timeline li .date { font-size: 12px; color: var(--txt-2); font-weight: 600; }
.timeline li .ttl { font-weight: 600; margin: 1px 0; }
.timeline li .desc { font-size: 13px; color: var(--txt-2); }

.foot-note { text-align: center; color: var(--txt-3); font-size: 12px; padding: 34px 0 0; }
.foot-legal { color: var(--txt-2); text-decoration: underline; text-underline-offset: 2px; }

/* — Recettes — */
.rec-search-wrap { position: relative; margin-bottom: 18px; }
.rec-search-wrap > svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--txt-2); pointer-events: none; }
.rec-search { width: 100%; box-sizing: border-box; padding: 12px 16px 12px 42px; border: 1px solid var(--ligne-fort); border-radius: 30px; background: var(--surface); color: var(--txt); font: inherit; font-size: 15px; }
.rec-search:focus { outline: none; border-color: var(--ble); box-shadow: 0 0 0 3px rgba(212,169,58,.18); }
.rec-cat { margin-bottom: 22px; }
.rec-cat-h { font-family: var(--serif); font-size: 18px; font-weight: 600; margin: 0 2px 11px; }
.rec-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.rec-card { display: flex; align-items: center; gap: 13px; text-align: left; cursor: pointer; width: 100%;
  background: var(--surface); border: 1px solid var(--ligne); border-radius: 13px; padding: 13px 15px; font: inherit; color: inherit;
  transition: transform var(--t-rapide), box-shadow var(--t-rapide), border-color var(--t-rapide); }
.rec-card:hover { transform: translateY(-2px); box-shadow: var(--ombre-2); border-color: var(--ble); }
.rec-emoji { font-size: 26px; flex: 0 0 auto; line-height: 1; }
.rec-info { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.rec-name { font-weight: 600; font-size: 15px; }
.rec-meta { font-size: 12px; color: var(--txt-2); }
.rec-chev { color: var(--txt-3); display: flex; } .rec-chev svg { width: 18px; height: 18px; }
.rec-back { margin-bottom: 14px; }
.rec-detail-head { display: flex; align-items: center; gap: 15px; margin-bottom: 18px; }
.rec-d-emoji { font-size: 40px; line-height: 1; flex: 0 0 auto; }
.rec-d-title { font-family: var(--serif); font-size: 26px; font-weight: 600; line-height: 1.08; }
.rec-d-sub { display: flex; align-items: center; gap: 8px; margin-top: 6px; flex-wrap: wrap; font-size: 13px; }
.calc-times { font-size: 13px; color: var(--txt-2); margin-bottom: 10px; }
.mult-quick { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.mult-btn { border: 1px solid var(--ligne-fort); background: var(--surface-2); color: var(--txt); border-radius: 9px; padding: 9px 15px; font: inherit; font-weight: 700; font-size: 15px; cursor: pointer; transition: background var(--t-rapide), border-color var(--t-rapide); }
.mult-btn:hover { border-color: var(--ble); }
.mult-btn.actif { background: var(--croute); color: #fff; border-color: var(--croute); }
.mult-input { width: 88px; box-sizing: border-box; border: 1px solid var(--ligne-fort); border-radius: 9px; padding: 9px 11px; font: inherit; font-size: 15px; font-weight: 700; text-align: center; background: var(--surface); color: var(--txt); margin-left: auto; }
.mult-input:focus { outline: none; border-color: var(--ble); box-shadow: 0 0 0 3px rgba(212,169,58,.18); }
.calc-out { display: flex; gap: 26px; margin: 16px 0; flex-wrap: wrap; }
.calc-cell { display: flex; flex-direction: column; gap: 2px; }
.calc-cell .muted { font-size: 12px; } .calc-cell b { font-family: var(--serif); font-size: 23px; }
.pdf-btn { width: 100%; justify-content: center; padding: 12px; font-size: 15px; }
.rec-steps { margin: 0; padding-left: 22px; display: grid; gap: 13px; }
.rec-steps li { padding-left: 4px; }
.rec-steps .step-t { font-weight: 700; }
.rec-steps .step-d { color: var(--txt-2); font-size: 14px; margin-top: 3px; line-height: 1.5; }
.rec-allerg { margin-top: 16px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
@media (max-width: 640px) { .rec-grid { grid-template-columns: 1fr; } .mult-input { margin-left: 0; } }

/* — Assistant (chat) — */
.asst-wrap { display: flex; flex-direction: column; min-height: 62vh; }
.asst-feed { flex: 1 1 auto; }
.asst-empty { text-align: center; color: var(--txt-2); padding: 26px 12px; }
.asst-empty .asst-emoji svg { width: 40px; height: 40px; color: var(--croute); }
.asst-empty p { max-width: 430px; margin: 12px auto 18px; line-height: 1.5; }
.asst-sugg { display: flex; flex-direction: column; gap: 8px; max-width: 430px; margin: 0 auto; }
.asst-chip { display: inline-flex; align-items: center; gap: 8px; justify-content: center; border: 1px solid var(--ligne-fort); background: var(--surface); color: var(--txt); border-radius: 30px; padding: 10px 16px; font: inherit; font-size: 14px; cursor: pointer; transition: background var(--t-rapide), border-color var(--t-rapide); }
.asst-chip:hover { border-color: var(--ble); background: var(--surface-2); }
.asst-chip svg { width: 16px; height: 16px; }
.asst-msg { display: flex; margin: 10px 0; }
.asst-msg.user { justify-content: flex-end; }
.asst-msg .bubble { max-width: 85%; padding: 11px 15px; border-radius: 16px; font-size: 14.5px; line-height: 1.5; box-shadow: var(--ombre-1); }
.asst-msg.user .bubble { background: linear-gradient(120deg, var(--croute), #8a561f); color: #fff; border-bottom-right-radius: 5px; }
.asst-msg.bot .bubble { background: var(--surface); border: 1px solid var(--ligne); border-bottom-left-radius: 5px; }
.asst-msg.bot .bubble.err { background: var(--rouge-bg); border-color: var(--rouge); color: var(--rouge); }
.asst-applybtn { margin-top: 11px; }
.asst-applied { margin-top: 9px; display: inline-flex; align-items: center; gap: 6px; color: var(--vert); font-weight: 600; font-size: 13px; }
.asst-applied svg { width: 15px; height: 15px; }
.bubble.typing { display: inline-flex; gap: 4px; align-items: center; }
.bubble.typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--txt-3); animation: asstTyping 1.2s infinite; }
.bubble.typing span:nth-child(2) { animation-delay: .2s; } .bubble.typing span:nth-child(3) { animation-delay: .4s; }
@keyframes asstTyping { 0%,60%,100% { opacity: .3; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-3px); } }
.asst-bar { position: sticky; bottom: 0; display: flex; align-items: flex-end; gap: 8px; padding: 10px 0 12px; background: var(--bg); border-top: 1px solid var(--ligne); }
.asst-input { flex: 1; resize: none; max-height: 120px; box-sizing: border-box; border: 1px solid var(--ligne-fort); border-radius: 20px; padding: 11px 15px; font: inherit; font-size: 15px; background: var(--surface); color: var(--txt); line-height: 1.4; }
.asst-input:focus { outline: none; border-color: var(--ble); box-shadow: 0 0 0 3px rgba(212,169,58,.18); }
.icon-btn.asst-send { background: var(--croute); color: #fff; border-color: var(--croute); flex: 0 0 40px; }
.icon-btn.asst-send:hover { filter: brightness(1.08); }
.asst-auth { display: flex; align-items: center; gap: 12px; color: var(--txt-2); }
.asst-auth svg { width: 22px; height: 22px; color: var(--ble); flex: 0 0 22px; }
@media (max-width: 920px) { .asst-bar { bottom: calc(64px + env(safe-area-inset-bottom)); z-index: 49; } }

/* — Focus visible (accessibilité clavier) — */
.btn:focus-visible, .icon-btn:focus-visible, .nav a:focus-visible, .rec-card:focus-visible, .mult-btn:focus-visible,
.asst-chip:focus-visible, .seg button:focus-visible, .bottomnav a:focus-visible, .bottomnav .more:focus-visible {
  outline: 2px solid var(--ble); outline-offset: 2px;
}

/* ——————————————————————————————— Splash d'introduction */
#splash {
  position: fixed; inset: 0; z-index: 100; display: grid; place-items: center;
  background: radial-gradient(120% 100% at 50% 30%, #5a3414, #2e1b09);
  transition: opacity .6s ease, visibility .6s;
}
#splash.parti { opacity: 0; visibility: hidden; }
#splash .s-inner { text-align: center; color: #f7ecd7; }
#splash .s-logo { width: 96px; height: 96px; margin: 0 auto 18px; }
#splash .s-name { font-family: var(--serif); font-size: 34px; font-weight: 600; letter-spacing: .5px; }
#splash .s-sub { font-size: 11px; letter-spacing: 5px; text-transform: uppercase; opacity: .7; margin-top: 6px; }
#splash .s-bar { width: 160px; height: 3px; background: rgba(255,255,255,.16); border-radius: 4px; margin: 22px auto 0; overflow: hidden; }
#splash .s-bar > i { display: block; height: 100%; width: 0; background: var(--ble); }

/* ——————————————————————————————— Responsive */
@media (max-width: 1120px) { .k4 { grid-template-columns: repeat(2,1fr); } .k3 { grid-template-columns: repeat(2,1fr); } }
@media (max-width: 920px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; }
  .nav { display: grid; grid-template-columns: repeat(2,1fr); gap: 4px; }
  .nav-sep, .side-foot { grid-column: 1/-1; }
  .hero h1.title { font-size: 34px; } .hero .ring-wrap { margin: 0; }
}
@media (max-width: 720px) {
  .k4,.k3,.k2 { grid-template-columns: 1fr; } .span2 { grid-column: auto; }
  .topbar { padding: 11px 16px; flex-wrap: wrap; } .page { padding: 18px 16px 0; }
  .nav { grid-template-columns: 1fr; }
}

@media print {
  .sidebar, .topbar, .topbar .seg, .topbar .tools, .topbar .icon-btn, .btn, #splash, .hero canvas, .nav, .bottomnav { display: none !important; }
  .app { display: block; } body { background: #fff !important; }
  @page { size: A4 portrait; margin: 12mm; }
  /* Production sheet → clean A4: hide every control, keep the work. */
  .lede, .pl-head, .pr-tplbar, .pr-daystrip, .pr-secctl, .pr-secadd, .pr-addsec, .pr-picker,
  .pr-mode, .pr-temptgl, .pr-dowsel, .pr-tplhint, .foot-note,
  .page > .card, #bk-bubble { display: none !important; }   /* merge: keep the calendar nav, events band + AI bubble off the printed A4 sheet */
  .pr-printhead { display: flex !important; align-items: baseline; justify-content: space-between; border-bottom: 2px solid #7a4a1e; padding-bottom: 6px; margin-bottom: 12px; }
  .pr-printhead b { font-family: Georgia, serif; font-size: 19px; color: #2c2620; }
  .pr-printhead span { font-family: Georgia, serif; font-size: 14px; color: #a8761b; }
  .pr-sheet { display: block; gap: 0; }
  .pr-cat, .pr-sec, .pr-bake { background: #fff !important; border: 1px solid #d8c8a6 !important; box-shadow: none !important; break-inside: avoid; margin-bottom: 8px; color: #2c2620 !important; padding: 8px 12px; }
  .pr-cat-h, .pr-sec-h { color: #7a4a1e !important; border-color: #e7dbc2 !important; }
  .pr-sec-lab, .pr-bk-dh b, .pr-label, .pr-bk-nm { color: #2c2620 !important; }
  .pr-row, .pr-bk-row { border-color: #e7dbc2 !important; }
  .bk-in { border: 0 !important; background: none !important; color: #2c2620 !important; box-shadow: none !important; }
  .pr-bk-t { border-bottom: 1px solid #d8c8a6 !important; min-width: 34px; text-align: center; }
  .pr-tempin { border: 1px solid #7a4a1e !important; width: 52px !important; height: 18px; }
  .pr-bk-out, .pr-qunit, .pr-bk-mix, .pr-bk-tot, .pr-tag { color: #7a4a1e !important; background: none !important; }
  .pr-chk { -webkit-appearance: none; appearance: none; width: 13px; height: 13px; border: 1.4px solid #7a4a1e !important; border-radius: 2px; background: #fff !important; }
  .pr-rsub, .pr-mixerline { color: #8c7d66 !important; }
  /* — Production v2 (.pr-paper): the printed sheet is ALWAYS white paper + dark ink, ink-saving —
     even printed from Nuit (dark) mode. Re-point the colour tokens to a print palette so every
     theme/Nuit override (all var-based) resolves light; then strip the remaining fills. — */
  :root, :root[data-theme="nuit"] {
    --bg: #fff; --bg-2: #fff; --surface: #fff; --surface-2: #fff;
    --ligne: #e0d6bf; --ligne-fort: #c9bb9c;
    --txt: #1f1a14; --txt-2: #4a4036; --txt-3: #8c7d66;
    --croute: #6a4a12; --ble: #6a4a12; --ble-clair: #6a4a12; --or: #6a4a12;
  }
  .pr-plive, .pr-paper .pr-secadd { display: none !important; }
  .pr-paper { background: #fff !important; border: 0 !important; box-shadow: none !important; padding: 0 !important; }
  .pr-paper .pr-cat { background: transparent !important; border: 0 !important; padding: 0 !important; margin-bottom: 9px; break-inside: avoid; }
  .pr-paphead { display: flex !important; }
  .pr-chip2 { background: #fff !important; border: 1px solid #c9bb9c !important; }
  .pr-qty, .pr-bk-mix, .pr-bk-tot, .pr-tag, .pr-bk-row.on, .pr-bk-row.tweak, .pp-st, .pr-plive { background: transparent !important; box-shadow: none !important; }
  .pr-sec, .pr-bk-d { break-inside: avoid; }
  /* — AUTO-FIT TO A4: the printed sheet is ZOOMED to fill exactly ONE page — scaled DOWN when the day is full,
     UP when it's light, so it always takes the room. --pf is measured in JS (prod-pdf handler) against the A4
     usable area; we use `zoom` (not transform) so the layout box scales too — no phantom second page. — */
  @page { size: A4 portrait; margin: 6mm; }
  .pr-paper { width: var(--pbw, 720px) !important; max-width: var(--pbw, 720px) !important; margin: 0 !important; zoom: var(--pf, 1); padding: 4px 2px !important; }
  .pr-signoff { margin-top: 8px !important; } .pr-so .line { height: 14px !important; }
  .pr-papfoot { margin-top: 7px !important; padding-top: 4px !important; }
  /* Tighten whitespace for print so the auto-fit gives the TEXT more room (bigger, more readable). Fonts stay screen-size. */
  .pr-paper .pr-cat { margin-bottom: 6px !important; }
  .pr-paper .pr-sec-h { margin-bottom: 3px !important; padding-bottom: 3px !important; }
  .pr-paper .pr-row, .pr-paper .pr-qrow, .pr-paper .pr-srow, .pr-paper .pr-bk-row, .pr-paper .pr-prod, .pr-paper .pr-titem { padding: 2px 0 !important; }
  .pr-paper .pr-bk-dh { margin: 4px 0 2px !important; }
  .pr-paper .pr-chips { margin: 8px 0 2px !important; }
  .pr-paper .bk-in, .pr-paper .pr-bk-t, .pr-paper .pr-qin, .pr-paper .pr-factin { height: auto !important; min-height: 0 !important; padding: 0 2px !important; line-height: 1.05 !important; }
  .pr-paper .pr-row, .pr-paper .pr-qrow, .pr-paper .pr-srow, .pr-paper .pr-bk-row { line-height: 1.1 !important; }
  .pr-paper .pr-cat { margin-bottom: 7px; }
  .pr-chk { width: 13px !important; height: 13px !important; flex: 0 0 13px !important; }
  /* — Ingredient walk-around order sheet: print only the paper, full width — */
  .ing-noprint, .ing-pchips, .ing-pcount, .bk-toolbar { display: none !important; }
  .ing-papwrap { display: block; }
  .ing-paper { max-width: none !important; width: 100% !important; border: 0 !important; padding: 0 !important; }
  .ip-line, .ip-colh { break-inside: avoid; }
  .ip-chk, .ip-blank { border-color: #7a4a1e !important; }
  /* Tray-up "on its own page" toggle: break to a second A4 page before the tray-up section (native print). */
  .pr-paper-split .pr-sec-trayup { break-before: page; }
  .pr-tu-pagetgl { display: none !important; }
}

/* ——————————————————————————————— Mur de connexion (accès réservé) */
body.gated .app { display: none !important; }
#gate {
  position: fixed; inset: 0; z-index: 200; display: grid; place-items: center;
  padding: 24px calc(20px + env(safe-area-inset-right)) calc(24px + env(safe-area-inset-bottom)) calc(20px + env(safe-area-inset-left));
  background:
    radial-gradient(1100px 560px at 50% -8%, rgba(212,169,58,.18), transparent 60%),
    linear-gradient(180deg, var(--croute-fonce), #3a230e 55%, #2e1b09);
  overflow: auto;
}
.gate-card {
  width: 100%; max-width: 384px; box-sizing: border-box; background: var(--surface);
  border: 1px solid var(--ligne-fort); border-radius: 22px; padding: 30px 26px 24px;
  box-shadow: 0 30px 80px rgba(0,0,0,.45); text-align: center;
  animation: gate-in .5s cubic-bezier(.2,.7,.2,1) both;
}
@keyframes gate-in { from { opacity: 0; transform: translateY(14px) scale(.985); } to { opacity: 1; transform: none; } }
.gate-brand { display: flex; flex-direction: column; align-items: center; margin-bottom: 14px; }
.gate-logo { width: 56px; height: 56px; color: var(--croute); padding: 9px; box-sizing: border-box;
  background: radial-gradient(circle at 35% 28%, var(--ble-clair), var(--ble)); border-radius: 16px;
  box-shadow: 0 8px 22px rgba(122,74,30,.3); }
.gate-name { font-family: var(--serif); font-size: 23px; font-weight: 700; color: var(--txt); margin-top: 10px; }
.gate-tag { font-size: 12px; color: var(--txt-2); letter-spacing: .3px; margin-top: 2px; }
.gate-h { font-family: var(--serif); font-size: 19px; color: var(--croute); margin: 12px 0 4px; }
.gate-sub { font-size: 13.5px; color: var(--txt-2); line-height: 1.5; margin-bottom: 16px; }
.gate-input { width: 100%; box-sizing: border-box; padding: 13px 15px; font-size: 15px;
  border: 1px solid var(--ligne-fort); border-radius: 13px; background: var(--surface-2); color: var(--txt); margin-bottom: 10px; }
.gate-input:focus { outline: none; border-color: var(--ble); box-shadow: 0 0 0 3px rgba(212,169,58,.22); background: var(--surface); }
.gate-btn { width: 100%; justify-content: center; padding: 13px; font-size: 15px; }
.gate-status { min-height: 18px; font-size: 13px; font-weight: 600; margin-top: 10px; color: var(--txt-2); }
.gate-status.ok { color: #2e7d4f; }
.gate-status.err { color: #b23b3b; }
.gate-lang { display: inline-flex; margin: 18px auto 0; }
.gate-as { font-size: 13px; color: var(--txt-2); margin-bottom: 14px; }
.gate-as b { color: var(--txt); }
.gate-ver { margin-top: 14px; font-size: 11px; letter-spacing: .5px; color: var(--txt-3); }

/* ——————————————————————————————— Bandeau « mode admin » (pastille flottante) */
.acc-admin-wrap { margin-top: 12px; padding-top: 12px; border-top: 1px solid rgba(255,255,255,.12); }
.acc-admin-t { font-size: 10.5px; text-transform: uppercase; letter-spacing: 1px; color: rgba(247,236,215,.62); margin-bottom: 7px; }
#admin-banner {
  position: fixed; z-index: 120; left: 50%; transform: translateX(-50%);
  bottom: calc(96px + env(safe-area-inset-bottom));
  display: flex; align-items: center; gap: 12px; max-width: calc(100vw - 28px);
  padding: 9px 9px 9px 16px; border-radius: 30px; color: #fff;
  background: linear-gradient(120deg, #8a3b1f, #b2592e);
  font-size: 12.5px; font-weight: 700; box-shadow: 0 14px 34px rgba(0,0,0,.32);
}
#admin-banner .btn { background: rgba(255,255,255,.16); border-color: rgba(255,255,255,.32); color: #fff; padding: 6px 13px; font-size: 12.5px; }
#admin-banner .btn:hover { background: rgba(255,255,255,.26); }
@media (min-width: 921px) { #admin-banner { bottom: 22px; } }

/* ——————————————————————————————— Lien « installer » sur l'écran de connexion */
.gate-install {
  display: inline-flex; align-items: center; gap: 7px; margin-top: 16px;
  background: none; border: 0; cursor: pointer; color: var(--croute); font: inherit;
  font-size: 13px; font-weight: 700; padding: 6px 10px; border-radius: 10px; text-decoration: underline;
}
.gate-install svg { width: 16px; height: 16px; }
.gate-install:hover { background: var(--surface-2); }

/* ——————————————————————————————— Modale guide d'installation PWA */
#install-modal {
  position: fixed; inset: 0; z-index: 240; display: grid; place-items: center;
  padding: 20px; background: rgba(30, 17, 6, .55); backdrop-filter: blur(4px);
  animation: gate-in .25s ease both;
}
.ig-card {
  position: relative; width: 100%; max-width: 560px; box-sizing: border-box;
  background: var(--surface); border: 1px solid var(--ligne-fort); border-radius: 20px;
  padding: 26px 24px; box-shadow: 0 30px 80px rgba(0,0,0,.45); max-height: 88vh; overflow: auto;
}
.ig-close {
  position: absolute; top: 14px; right: 14px; width: 34px; height: 34px; border-radius: 50%;
  border: 1px solid var(--ligne-fort); background: var(--surface-2); color: var(--txt); cursor: pointer;
  display: grid; place-items: center;
}
.ig-close svg { width: 16px; height: 16px; }
.ig-h { display: flex; align-items: center; gap: 10px; font-family: var(--serif); font-size: 21px; color: var(--croute); }
.ig-h svg { width: 22px; height: 22px; }
.ig-sub { font-size: 14px; color: var(--txt-2); line-height: 1.5; margin: 8px 0 18px; }
.ig-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.ig-os { background: var(--surface-2); border: 1px solid var(--ligne); border-radius: 14px; padding: 14px 16px; }
.ig-os.and { border-color: color-mix(in srgb, var(--ble) 45%, var(--ligne)); }
.ig-os-h { font-weight: 800; font-size: 13.5px; color: var(--txt); margin-bottom: 8px; letter-spacing: .2px; }
.ig-steps { margin: 0; padding-left: 18px; }
.ig-steps li { font-size: 13px; color: var(--txt); line-height: 1.55; margin-bottom: 7px; }
.ig-note { margin-top: 16px; font-size: 12.5px; color: var(--txt-2); background: var(--surface-2); border-radius: 10px; padding: 10px 13px; }
@media (max-width: 560px) { .ig-grid { grid-template-columns: 1fr; } }

/* ——————————————————————————————— Logo de marque dans le bandeau latéral */
.brand .logo.logo-img { padding: 0; overflow: hidden; background: #fff; }
.brand .logo.logo-img img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* ——————————————————————————————— Onboarding première connexion */
body.onboarding { overflow: hidden; }
#onboard {
  position: fixed; inset: 0; z-index: 210; display: grid; place-items: center;
  padding: 24px calc(20px + env(safe-area-inset-right)) calc(24px + env(safe-area-inset-bottom)) calc(20px + env(safe-area-inset-left));
  background:
    radial-gradient(1100px 560px at 50% -8%, rgba(212,169,58,.18), transparent 60%),
    linear-gradient(180deg, var(--croute-fonce), #3a230e 55%, #2e1b09);
  overflow: auto;
}
.ob-card {
  width: 100%; max-width: 400px; box-sizing: border-box; background: var(--surface);
  border: 1px solid var(--ligne-fort); border-radius: 22px; padding: 26px 26px 22px;
  box-shadow: 0 30px 80px rgba(0,0,0,.45); text-align: center;
  animation: gate-in .5s cubic-bezier(.2,.7,.2,1) both;
}
.ob-emoji { font-size: 34px; line-height: 1; }
.ob-h { font-family: var(--serif); font-size: 22px; color: var(--croute); margin: 10px 0 4px; }
.ob-sub { font-size: 13.5px; color: var(--txt-2); line-height: 1.5; margin-bottom: 18px; }
.ob-logo {
  width: 104px; height: 104px; margin: 0 auto 6px; display: grid; place-items: center;
  border: 2px dashed var(--ligne-fort); border-radius: 20px; background: var(--surface-2);
  cursor: pointer; overflow: hidden; padding: 0; transition: border-color .18s, background .18s;
}
.ob-logo:hover { border-color: var(--ble); background: #fff; }
.ob-logo-ph { display: grid; place-items: center; gap: 6px; color: var(--txt-2); }
.ob-logo-ph svg { width: 24px; height: 24px; color: var(--croute); }
.ob-logo-ph span { font-size: 11.5px; font-weight: 600; }
.ob-logo-img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ob-logo-cap { font-size: 11.5px; color: var(--txt-3); margin-bottom: 14px; }
.ob-logo-clear {
  display: inline-block; margin-bottom: 14px; background: none; border: 0; cursor: pointer;
  color: #b23b3b; font: inherit; font-size: 12.5px; font-weight: 600; text-decoration: underline;
}
.ob-input {
  width: 100%; box-sizing: border-box; padding: 12px 14px; font-size: 15px; margin-bottom: 10px;
  border: 1px solid var(--ligne-fort); border-radius: 12px; background: var(--surface-2); color: var(--txt);
}
.ob-input:focus { outline: none; border-color: var(--ble); box-shadow: 0 0 0 3px rgba(212,169,58,.22); background: var(--surface); }
.ob-lbl { display: block; text-align: left; font-size: 11.5px; font-weight: 700; color: var(--txt-2); text-transform: uppercase; letter-spacing: .4px; margin: 4px 2px 6px; }
.ob-go { width: 100%; justify-content: center; padding: 13px; font-size: 15px; margin-top: 6px; }
.ob-skip {
  display: block; width: 100%; margin-top: 10px; background: none; border: 0; cursor: pointer;
  color: var(--txt-2); font: inherit; font-size: 13px; font-weight: 600; padding: 6px;
}
.ob-skip:hover { color: var(--croute); }
