/* FLERP Cali — cali.flerp.me. Accent DORÉ FRANC #FFC400 (décision A-D1 Florian
   23-07 : le teal se confondait avec Com/Fact dans le tiers froid ; le doré est
   plus jaune ET plus lumineux que l'orange Reco — jamais confondus) ; le TEXTE
   et les liens accentués utilisent le foncé #7A5C00 (contraste AA sur fond clair —
   l'ambre vif sert aux accents/boutons/états actifs, jamais au texte). Charte suite
   « iOS » 2026-07-01 : fond #F2F2F7, cards blanches PLATES radius 12, police système.
   Gabarit copié de FACT/app/static/css/fact.css (parité suite), re-colorié. */
:root {
  --cali: #FFC400; --cali-d: #7A5C00; --cali-soft: #FFF3C4;
  --bg: #F2F2F7; --panel: #FFFFFF; --ink: #16202E; --muted: #6B7688;
  --line: #E2E2E7; --line-2: #ECECF1;
  --good: #1E9E5A; --ink-2: #0F172A;
  --shadow: none;
  --radius: 12px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font: 15px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased;
  display: flex; flex-direction: column; min-height: 100vh;
}
a { color: inherit; text-decoration: none; }
h1 { font-size: 1.55rem; letter-spacing: -.02em; }
h2 { font-size: 1.15rem; letter-spacing: -.01em; }

/* ---- Topbar (verre dépoli, charte §2) ---- */
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 22px;
  padding: 0 clamp(16px, 4vw, 34px); height: 62px;
  background: rgba(255,255,255,.86); backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid var(--line);
}
.brand { display: inline-flex; align-items: center; gap: 10px; }
.brand-ic { width: 30px; height: 30px; }
.brand-txt { font-weight: 600; font-size: 1.05rem; letter-spacing: -.01em; white-space: nowrap; }
.brand-txt b { color: var(--cali-d); font-weight: 700; }
.topnav { display: flex; gap: 4px; margin-left: 8px; overflow-x: auto; scrollbar-width: none; }
.topnav::-webkit-scrollbar { display: none; }
.topnav a {
  padding: 8px 14px; border-radius: 10px; color: var(--muted); font-weight: 500;
  white-space: nowrap; transition: background .15s, color .15s;
}
.topnav a:hover { background: var(--line-2); color: var(--ink); }
.topnav a.on { background: var(--cali-soft); color: var(--cali-d); }
.topright { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.whoami { text-align: right; line-height: 1.2; }
.who-name { display: block; font-weight: 600; font-size: .9rem; }
.who-meta { display: block; font-size: .76rem; color: var(--muted); }
.btn-portal {
  width: 34px; height: 34px; display: grid; place-items: center; border-radius: 9px;
  border: 1px solid var(--line); color: var(--muted); font-size: 1rem; flex: none;
}
.btn-portal:hover { border-color: var(--cali); color: var(--cali-d); }
.btn-portal img.flerp-mol { width: 22px; height: 22px; display: block; }
.btn-logout {
  padding: 8px 14px; border-radius: 10px; font-weight: 600; font-size: .85rem;
  color: var(--cali-d); background: var(--cali-soft); white-space: nowrap;
}
.btn-logout:hover { background: #FFEFB8; }

/* ---- Layout ---- */
.wrap { flex: 1; width: 100%; max-width: 1180px; margin: 0 auto;
  padding: clamp(20px, 4vw, 38px) clamp(16px, 4vw, 34px); }
.wrap.centered { display: grid; place-items: center; }
.foot { text-align: center; color: var(--muted); font-size: .8rem; padding: 22px; }
@media (min-width: 900px) {
  .foot { padding: 8px 12px 12px; font-size: .7rem; }
}
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.eyebrow { color: var(--cali-d); font-weight: 600; font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; }
.lead { color: var(--muted); margin-top: 4px; }
.section-h { margin: 30px 0 14px; }
.page-new { flex: none; white-space: nowrap; align-self: center; }
.head-actions { display: flex; gap: 10px; flex: none; align-self: center; flex-wrap: wrap; }

/* ---- KPIs ---- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; max-width: 560px; margin: 0 0 16px; }
.kpi { background: var(--panel); border: 1px solid transparent; border-radius: var(--radius);
  padding: 18px 16px; }
.kpi-n { display: block; font-size: 2rem; font-weight: 700; letter-spacing: -.03em;
  font-variant-numeric: tabular-nums; line-height: 1; }
.kpi-n.acc { color: var(--cali-d); }
.kpi-n.ok { color: var(--good); }
.kpi-n.bad { color: #B42318; }
.kpi-l { display: flex; align-items: baseline; gap: 6px; color: var(--muted); font-size: .82rem; margin-top: 6px; }
.kpis.kpis-dash { max-width: none; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.kpis.kpis-dash .kpi-n { font-size: 1.65rem; white-space: nowrap; }
.dash-block { margin-top: 20px; }

/* ---- Bloc BUSCADOR IA du tablero (C1 : INERTE et honnête — « llega en C6 ») ---- */
.ia-box { background: var(--panel); border: 1.5px dashed var(--line); border-radius: var(--radius);
  padding: 14px 16px; margin: 0 0 14px; display: flex; align-items: center; gap: 12px; }
.ia-box .ia-ic { font-size: 1.3rem; flex: none; }
.ia-box input { flex: 1; min-width: 120px; height: 40px; padding: 0 12px; border: 1px solid var(--line);
  border-radius: 10px; font: inherit; font-size: .92rem; background: var(--bg); color: var(--muted); }
.ia-box .pill { flex: none; }

/* ---- Modules (tuiles inicio) ---- */
.modules { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.mod {
  position: relative; background: var(--panel); border: 1px solid transparent;
  border-radius: var(--radius); padding: 22px;
  transition: transform .18s, border-color .18s, box-shadow .25s; display: block;
}
a.mod:hover { transform: translateY(-3px); border-color: rgba(255,196,0,.6);
  box-shadow: 0 18px 40px -20px rgba(227,135,0,.55); }
.mod-ic { width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center;
  background: var(--cali-soft); font-size: 1.5rem; margin-bottom: 14px; }
.mod h3 { font-size: 1.05rem; margin-bottom: 6px; }
.mod p { color: var(--muted); font-size: .88rem; }
.tag { position: absolute; top: 18px; right: 18px; font-size: .68rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .05em; padding: 4px 9px; border-radius: 999px;
  background: var(--line-2); color: var(--muted); }
.tag.ok { background: #E4F6EC; color: var(--good); }
.tag.soon { background: var(--cali-soft); color: var(--cali-d); }

/* ---- Tables ---- */
.table-wrap { background: var(--panel); border: 1px solid transparent; border-radius: var(--radius);
  overflow: auto; }
.table-wrap.flat { border: 1px solid var(--line-2); }
table.data { width: 100%; border-collapse: collapse; font-size: .9rem; }
table.data th { text-align: left; padding: 13px 16px; color: var(--muted); font-weight: 600;
  font-size: .76rem; text-transform: uppercase; letter-spacing: .04em; border-bottom: 1px solid var(--line); }
table.data td { padding: 13px 16px; border-bottom: 1px solid var(--line-2); }
table.data tr:last-child td { border-bottom: none; }
table.data tbody tr:hover { background: #FAFBFD; }
table.data.compact th, table.data.compact td { padding: 8px 10px; font-size: .8rem; }
table.data th.num { text-align: right; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .84rem; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: .8rem; }
.pill { display: inline-block; font-size: .74rem; font-weight: 600; padding: 3px 10px;
  border-radius: 999px; background: var(--line-2); color: var(--muted); }
.pill.on { background: #E4F6EC; color: var(--good); }
.pill.off { background: #FDECEC; color: #B42318; }
.pill.warn { background: #FFF3E6; color: #B45309; }
.pill.info { background: #E8F1FF; color: #1D63D8; }
.pill.amber { background: var(--cali-soft); color: var(--cali-d); }
.pill.big { font-size: .85rem; padding: 6px 14px; align-self: center; }
.cell-link { color: var(--cali-d); font-weight: 600; }
.cell-link.plain { color: var(--ink); font-weight: 500; }
.cell-link:hover { text-decoration: underline; }

/* ---- Cards / formulaires ---- */
.card { background: var(--panel); border: 1px solid transparent; border-radius: var(--radius);
  overflow: auto; margin-bottom: 16px; }
.card-h { padding: 16px 18px; border-bottom: 1px solid var(--line); font-size: 1rem; }
.card-h.bare { border: none; padding: 14px 0 10px; }
.card-h-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.pad { padding: 16px 18px; }
.form-card { padding: 26px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 22px; }
.form-grid label { display: flex; flex-direction: column; gap: 6px; font-size: .84rem;
  font-weight: 600; color: var(--muted); }
.form-grid label.wide { grid-column: 1 / -1; }
.form-grid label.chk { flex-direction: row; align-items: center; gap: 8px; }
.form-grid label.chk input { width: 17px; height: 17px; accent-color: var(--cali-d); }
.form-grid input:not([type=checkbox]), .form-grid select, .form-grid textarea,
.inline-row input, .inline-row select, .search-row input, .search-row select {
  height: 42px; padding: 0 12px; border: 1px solid var(--line); border-radius: 10px;
  font: inherit; font-size: 16px; color: var(--ink); background: #fff; }
.form-grid textarea { height: auto; min-height: 84px; padding: 10px 12px; }
.form-grid input[type=file] { padding: 8px 12px; height: auto; }
.form-grid input:focus, .form-grid select:focus, .form-grid textarea:focus,
.inline-row input:focus, .search-row input:focus {
  outline: 2px solid rgba(255,196,0,.55); outline-offset: 1px; border-color: var(--cali); }
.form-grid input:disabled { background: var(--line-2); color: var(--muted); }
.form-actions { display: flex; gap: 14px; align-items: center; margin-top: 20px; }
.inline-row { display: flex; gap: 14px; flex-wrap: wrap; align-items: flex-end; margin-top: 12px; }
.inline-row label { display: flex; flex-direction: column; gap: 6px; font-size: .84rem;
  font-weight: 600; color: var(--muted); }
.estado-row { padding-top: 14px; margin-top: 18px; border-top: 1px solid var(--line-2); }
.acciones { display: flex; gap: 6px; align-items: center; }
.acciones form { display: inline-flex; margin: 0; }

/* ---- Boutons (min 44px tactile, charte §2) ---- */
.btn-cali { display: inline-flex; align-items: center; justify-content: center; width: 100%;
  height: 50px; border-radius: 13px; font-weight: 700; font-size: 1rem; color: #fff;
  border: 0; cursor: pointer;
  background: linear-gradient(135deg, #FFCB1F, #DB9F00);
  box-shadow: 0 10px 24px -8px rgba(227,135,0,.6);
  transition: transform .15s, box-shadow .2s; }
.btn-cali:hover { transform: translateY(-2px); box-shadow: 0 16px 32px -10px rgba(227,135,0,.7); }
.btn-cali.ghost { background: none; color: var(--cali-d); border: 1.5px solid var(--cali); box-shadow: none; }
.btn-cali.slim { width: auto; height: 44px; padding: 0 20px; font-size: .92rem; border-radius: 11px; }
.btn-sec { display: inline-flex; align-items: center; height: 44px; padding: 0 18px; border-radius: 11px;
  font-weight: 600; font-size: .92rem; color: var(--cali-d); border: 1.5px solid var(--cali);
  background: #fff; cursor: pointer; font-family: inherit; transition: background .15s; }
.btn-sec:hover { background: var(--cali-soft); }
.btn-sec.slim-h { height: 42px; }
.btn-cancel { display: inline-flex; align-items: center; height: 44px; padding: 0 16px;
  color: var(--muted); font-weight: 600; font-size: .92rem; }
.btn-cancel:hover { color: var(--ink); }
.btn-danger { display: inline-flex; align-items: center; height: 42px; padding: 0 18px;
  border-radius: 11px; border: 1.5px solid #E05B5B; background: none; color: #B42318;
  font: inherit; font-weight: 600; cursor: pointer; }
.btn-danger:hover { background: #FDECEC; }
.mini-btn { border: 1px solid var(--line); background: var(--panel); border-radius: 8px;
  height: 34px; width: 38px; cursor: pointer; font-size: .9rem; }
.mini-btn:hover { border-color: var(--cali); background: var(--cali-soft); }
a.mini-btn { display: inline-flex; align-items: center; justify-content: center; }
button.mini-btn { white-space: nowrap; display: inline-flex; align-items: center;
  justify-content: center; gap: 4px; width: auto; min-width: 38px; padding: 0 10px; }
.acciones input[name=motivo] { height: 34px; width: 150px; padding: 0 8px;
  border: 1px solid var(--line); border-radius: 8px; font: inherit; font-size: .8rem;
  color: var(--ink); background: #fff; }
.acciones input[name=motivo]:focus { outline: 2px solid rgba(255,196,0,.55);
  outline-offset: 1px; border-color: var(--cali); }

/* ---- Login ---- */
.login-card { background: var(--panel); border: 1px solid transparent; border-radius: 22px;
  padding: 44px 40px; max-width: 400px; text-align: center; }
.login-ic { width: 66px; height: 66px; margin: 0 auto 18px; display: block; }
.login-card h1 { font-size: 1.7rem; } .login-card h1 b { color: var(--cali-d); }
.login-sub { color: var(--muted); margin: 8px 0 26px; }
.login-note { color: var(--muted); font-size: .84rem; margin-top: 16px; }

/* ---- Bannières / flash ---- */
.banner-error { background: #FDECEC; color: #B42318; border-radius: 12px; padding: 12px 16px;
  font-weight: 600; margin-bottom: 14px; }
.banner-ok { background: #E4F6EC; color: var(--good); border-radius: 12px; padding: 12px 16px; font-weight: 600; margin-bottom: 14px; }
.banner-info { background: var(--cali-soft); color: var(--cali-d); border-radius: 12px; padding: 12px 16px; font-weight: 600; margin-bottom: 14px; }
.banner-warn { background: #FFF3E6; color: #B45309; border-radius: 12px; padding: 12px 16px; font-weight: 600; margin-bottom: 14px; }
.flash-ok { color: var(--good); font-weight: 600; margin: 0 0 14px; }

/* ---- Onglets de page (souligné accent, charte §3.4) ---- */
.rtabs { display: flex; gap: 22px; border-bottom: 1px solid var(--line);
  margin: 4px 0 18px; overflow-x: auto; -webkit-overflow-scrolling: touch;
  touch-action: pan-x; scrollbar-width: none; }
.rtabs::-webkit-scrollbar { display: none; }
.rtabs a { display: inline-flex; align-items: center; gap: 7px; flex-shrink: 0;
  padding: 9px 2px 11px; color: var(--muted); font-weight: 650; text-decoration: none;
  border-bottom: 2.5px solid transparent; white-space: nowrap; }
.rtabs a:hover { color: var(--ink); }
.rtabs a.on { color: var(--cali-d); border-bottom-color: var(--cali); }

/* ---- Recherche liste ---- */
.search-row { display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.search-row input[type=search] { flex: 1; min-width: 200px; }

/* ---- Fiche document / méta ---- */
.meta-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px 24px; margin: 6px 0 4px; }
.meta-grid dt { font-size: .76rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.meta-grid dd { margin: 2px 0 0; font-weight: 600; overflow-wrap: anywhere; }
.meta-grid dd.sha { font-weight: 500; font-size: .78rem; }
.nv-row label { min-width: 220px; }
.hist { margin-top: 14px; }
.hist > summary { cursor: pointer; color: var(--muted); font-weight: 600; font-size: .88rem; }
.hist-list { list-style: none; margin: 10px 0 4px; display: flex; flex-direction: column; gap: 6px; }
.hist-list li { font-size: .86rem; padding: 6px 0; border-bottom: 1px solid var(--line-2); }

/* ---- Registros : réponses colorées par la RÈGLE versionnée (jamais un seuil en dur :
   la classe est posée par le serveur d'après reglas résolues et FIGÉES) ---- */
.resp-ok { color: var(--good); font-weight: 700; }
.resp-optimo { color: var(--good); font-weight: 700; }
.resp-warn { color: #B45309; font-weight: 700; }
.resp-bad { color: #B42318; font-weight: 700; }
.regla-nota { font-size: .78rem; color: var(--muted); }
.firma-line { display: flex; gap: 8px; align-items: center; font-size: .86rem; padding: 6px 0; }

/* ---- QR (zonas/equipos, impression ADMIN) ---- */
.qr-card { text-align: center; }
.qr-card img { width: 220px; height: 220px; image-rendering: pixelated; margin: 10px auto; display: block; }
.qr-token { font-size: .72rem; color: var(--muted); overflow-wrap: anywhere; }
@media print {
  .topbar, .sidebar, .foot, .bbar-m, .no-print { display: none !important; }
  body, body.with-side { display: block; background: #fff; }
  .qr-card { border: 1px solid #000; page-break-inside: avoid; }
}

/* ---- Usuarios / roles / audit (même grammaire que Reco/Agro/Fact) ---- */
tr.u-nuevo td { background: var(--cali-soft); }
.u-nuevo-badge { font-size: .82rem; }
details.usr-card { border: 1px solid var(--line); border-radius: 12px; padding: 0;
  margin: 10px 0; background: var(--panel); }
details.usr-card summary { cursor: pointer; padding: 12px 14px; border-radius: 12px; }
details.usr-card summary:hover { background: var(--line-2); }
details.usr-card[open] summary { border-bottom: 1px solid var(--line-2); }
details.usr-card > form, details.usr-card > p { padding: 14px; }
details.usr-card.u-nuevo { border-color: var(--cali); background: var(--cali-soft); }
.rol-inline { display: inline-flex; gap: 6px; align-items: center; }
.rol-inline select { height: 34px; padding: 0 8px; border: 1px solid var(--line);
  border-radius: 8px; font: inherit; font-size: .84rem; }
.rol-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 8px 16px; margin-top: 12px; }
.rol-grid .chk { display: flex; gap: 8px; align-items: center; font-size: .88rem; }
.rol-grid .chk input { width: 17px; height: 17px; accent-color: var(--cali-d); }
.usr-nota { margin-bottom: 16px; }
.aud-filtros { grid-template-columns: repeat(3, 1fr); }

/* ---- Pages-squelettes du plan C2+ (futuro.html) ---- */
.ciclo { display: flex; align-items: center; gap: 8px; list-style: none;
  overflow-x: auto; -webkit-overflow-scrolling: touch; padding: 6px 2px 10px;
  margin: 4px 0 8px; scrollbar-width: none; }
.ciclo::-webkit-scrollbar { display: none; }
.ciclo li { flex: none; display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.ciclo li + li::before { content: "→"; color: var(--muted); font-weight: 400; }
.ciclo .chip { font-size: .82rem; font-weight: 600; color: var(--cali-d);
  background: var(--cali-soft); border-radius: 999px; padding: 5px 12px; }
.spec-h { margin: 18px 0 6px; font-size: .95rem; }
.spec-list { margin: 4px 0; padding-left: 1.25em; }
.spec-list li { margin: 5px 0; }

/* ---- Configuración divers ---- */
.lang-row { display: flex; gap: 10px; margin-top: 8px; }
.btn-sec.lang-on { background: var(--cali-soft); box-shadow: 0 0 0 2px rgba(255,196,0,.35); }
.guia .guia-steps { margin: 8px 0 4px; padding-left: 1.25em; }
.guia .guia-steps li { margin: 10px 0; }
.disp-form { display: flex; gap: 10px; align-items: center; margin-top: 10px; max-width: 460px; }
.disp-form select { flex: 1; min-width: 0; height: 42px; padding: 0 12px;
  border-radius: 10px; border: 1px solid var(--line); background: #fff; font: inherit;
  font-size: 16px; color: var(--ink); }
.disp-form select:focus { outline: 2px solid rgba(255,196,0,.55); outline-offset: 1px;
  border-color: var(--cali); }

/* ---- Sidebar hybride (bureau ≥ 900 px) — patron suite, DISPOSITION PAR DÉFAUT ---- */
.sidebar { display: none; }
body.with-side { display: grid; grid-template-columns: 232px minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr) auto; height: 100vh; }
body.with-side > .sidebar { display: flex; flex-direction: column; gap: 2px;
  grid-column: 1; grid-row: 1 / span 3;
  padding: 16px 12px; background: var(--panel); border-right: 1px solid var(--line-2);
  overflow-y: auto; }
body.with-side > .topbar { grid-column: 2; grid-row: 1; }
body.with-side > .wrap { grid-column: 2; grid-row: 2; overflow-y: auto; max-width: none; }
body.with-side > .foot { grid-column: 2; grid-row: 3; }
.side-brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 16px; }
.side-nav { display: flex; flex-direction: column; gap: 2px; }
.side-nav a { display: flex; align-items: center; gap: 11px; padding: 10px 12px;
  border-radius: 10px; font-size: .92rem; font-weight: 500; color: var(--muted);
  white-space: nowrap; }
.side-nav a:hover { background: var(--line-2); color: var(--ink); }
.side-nav a.on { background: var(--cali-soft); color: var(--cali-d); font-weight: 600; }
.side-nav .nav-ne { width: 18px; display: inline-flex; justify-content: center; flex: none; }
@media (min-width: 900px) {
  body.with-side .topbar .topnav { display: none; }
  body.with-side .topbar > .brand { display: none; }
}
@media (max-width: 899px) {
  body.with-side { display: flex; flex-direction: column; height: auto; min-height: 100vh; }
  body.with-side > .sidebar { display: none; }
  body.with-side > .wrap { overflow-y: visible; max-width: 1180px; }
}

/* ---- Confort bureau : carte 🖥️ de Mi perfil en sections ---- */
.aj-sec { padding-top: 20px; margin-top: 20px; border-top: 1px solid var(--line-2); }
.aj-sec.first { padding-top: 0; margin-top: 0; border-top: 0; }
label.check { display: flex; flex-direction: row; align-items: center; gap: 10px;
  font-weight: 500; color: var(--ink); }
label.check input { width: 17px; height: 17px; accent-color: var(--cali-d); }
.check.inline { display: inline-flex; align-items: center; gap: 6px; }

/* ---- Buscador de menús (tablero — patron Agro #menu-q/#menu-sug, accent ambre) ---- */
.menu-search { position: relative; }
.dash-search { margin: 14px 0 0; }
.menu-search input { height: 38px; width: 230px; padding: 0 12px; border: 1px solid var(--line);
  border-radius: 10px; font: inherit; font-size: .88rem; background: var(--panel);
  color: var(--ink); transition: width .15s; }
.menu-search input:focus { outline: none; border-color: var(--cali); width: 290px; }
.menu-sug { position: absolute; top: 44px; left: 0; min-width: 250px; background: var(--panel);
  border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 18px 40px -20px rgba(22,32,46,.35);
  padding: 6px; display: flex; flex-direction: column; gap: 2px; z-index: 40; }
.menu-sug[hidden] { display: none; }
.menu-sug-it { text-align: left; padding: 9px 12px; border: 0; background: none; border-radius: 8px;
  font: inherit; font-size: .9rem; cursor: pointer; color: var(--ink); }
.menu-sug-it:hover, .menu-sug-it.on { background: var(--cali-soft); color: var(--cali-d); }
@media (max-width: 900px) { .dash-search .menu-search input { width: 100%; } }

/* ---- Filtre par colonne (filter.js — patron Reco .filter-row) ---- */
.filter-row { display: flex; gap: 8px; align-items: center; padding: 10px 14px;
  border-bottom: 1px solid var(--line-2); background: var(--bg); position: sticky; left: 0; }
.filter-sel { height: 36px; padding: 0 8px; border: 1px solid var(--line); border-radius: 9px;
  background: var(--panel); font: inherit; font-size: .85rem; color: var(--muted); max-width: 45%; }
.filter-q { flex: 1; min-width: 120px; height: 36px; padding: 0 12px; border: 1px solid var(--line);
  border-radius: 9px; font: inherit; font-size: .9rem; background: var(--panel); color: var(--ink); }
.filter-q:focus { outline: none; border-color: var(--cali); }
.filter-count { font-size: .78rem; color: var(--muted); font-variant-numeric: tabular-nums;
  white-space: nowrap; }

/* =====================================================================
   MODE NOCTURNE (patron suite) : palette « ambre sur brun très sombre »,
   PAS une inversion. theme.js pose data-theme="dark" sur <html> AVANT le
   premier paint (clé localStorage `cali_theme`, sinon prefers-color-scheme).
   ===================================================================== */
#theme-toggle { width: 34px; height: 34px; display: grid; place-items: center; padding: 0;
  border-radius: 9px; border: 1px solid var(--line); background: none;
  color: var(--muted); font-size: 1.02rem; line-height: 1; cursor: pointer; flex: none; }
#theme-toggle:hover { border-color: var(--cali); }
#theme-toggle .tt-sun { display: none; }
html[data-theme="dark"] #theme-toggle .tt-sun { display: block; }
html[data-theme="dark"] #theme-toggle .tt-moon { display: none; }

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #1A1608; --panel: #241E0C;
  --ink: #EFE9D8; --ink-2: #F8F3E4; --muted: #ACA283;
  --line: #3D341B; --line-2: #332B16;
  --cali: #FFCE33;                       /* bordures/focus : doré éclairci */
  --cali-d: #FFD75C;                     /* accent texte clair (AA sur fond sombre) */
  --cali-soft: #3A2F0E;                  /* OPAQUE : fonds actifs */
  --good: #4FC382;
}
@media (prefers-reduced-motion: no-preference) {
  html[data-theme="dark"] body, html[data-theme="dark"] .topbar,
  html[data-theme="dark"] .sidebar, html[data-theme="dark"] .card,
  html[data-theme="dark"] .kpi, html[data-theme="dark"] .mod {
    transition: background-color .2s ease, color .2s ease, border-color .2s ease; }
}
html[data-theme="dark"] .topbar { background: rgba(28, 24, 10, .86); }
html[data-theme="dark"] .btn-logout:hover { background: rgba(255, 206, 51, .28); }
html[data-theme="dark"] .btn-logout:not(:hover) { background: var(--cali-soft); }
html[data-theme="dark"] a.mod:hover { border-color: rgba(255,206,51,.5);
  box-shadow: 0 18px 40px -20px rgba(0,0,0,.8); }
html[data-theme="dark"] .menu-sug { box-shadow: 0 18px 40px -20px rgba(0,0,0,.8); }
html[data-theme="dark"] .form-grid input:not([type=checkbox]),
html[data-theme="dark"] .form-grid select, html[data-theme="dark"] .form-grid textarea,
html[data-theme="dark"] .inline-row input, html[data-theme="dark"] .inline-row select,
html[data-theme="dark"] .search-row input, html[data-theme="dark"] .search-row select,
html[data-theme="dark"] .disp-form select,
html[data-theme="dark"] .acciones input[name=motivo] { background-color: #332A10; color: var(--ink); }
html[data-theme="dark"] .form-grid input:disabled { background: var(--line-2); color: var(--muted); }
html[data-theme="dark"] ::placeholder { color: #8B8170; }
html[data-theme="dark"] .btn-sec { background: transparent; }
html[data-theme="dark"] .btn-sec:hover { background: var(--cali-soft); }
html[data-theme="dark"] .btn-sec.lang-on { background: var(--cali-soft); }
html[data-theme="dark"] .btn-danger:hover { background: #3D2223; }
html[data-theme="dark"] table.data tbody tr:hover { background: #2E250E; }
html[data-theme="dark"] .tag.ok, html[data-theme="dark"] .pill.on { background: #1D3A2A; color: var(--good); }
html[data-theme="dark"] .pill.off { background: #3D2223; color: #F1968E; }
html[data-theme="dark"] .pill.warn { background: #3B2E1B; color: #E5A54E; }
html[data-theme="dark"] .pill.info { background: #1B2C4A; color: #6EA8FE; }
html[data-theme="dark"] .pill.amber { background: var(--cali-soft); color: var(--cali-d); }
html[data-theme="dark"] .banner-error { background: #3D2223; color: #F1968E; }
html[data-theme="dark"] .banner-ok { background: #1D3A2A; color: var(--good); }
html[data-theme="dark"] .banner-info { background: var(--cali-soft); color: var(--cali-d); }
html[data-theme="dark"] .banner-warn { background: #3B2E1B; color: #E5A54E; }
html[data-theme="dark"] .filter-row { background: #2B230D; }
html[data-theme="dark"] tr.u-nuevo td { background: var(--cali-soft); }
html[data-theme="dark"] details.usr-card.u-nuevo { background: var(--cali-soft); }
html[data-theme="dark"] .ia-box input { background: #191405; }
html[data-theme="dark"] .resp-warn { color: #E5A54E; }
html[data-theme="dark"] .resp-bad { color: #F1968E; }

/* ---- Responsive (mobile-first suite : cibles 44px, font 16px inputs) ---- */
@media (max-width: 1000px) {
  .modules { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 680px) {
  .topnav { display: flex; overflow-x: auto; -webkit-overflow-scrolling: touch;
    scrollbar-width: none; gap: 4px; padding-bottom: 6px; }
  .topnav::-webkit-scrollbar { display: none; }
  .topnav a { white-space: nowrap; flex: 0 0 auto; }
  .whoami { display: none; }
  .modules { grid-template-columns: 1fr; }
  .form-grid, .aud-filtros { grid-template-columns: 1fr; }
  .page-head { flex-direction: column; align-items: flex-start; }
  .page-new { width: 100%; text-align: center; margin-top: 6px; }
  table.data { font-size: .82rem; min-width: 430px; }
  table.data th, table.data td { padding: 10px 10px; white-space: nowrap; }
  .card, .table-wrap { -webkit-overflow-scrolling: touch; }
  .wrap { padding-left: 12px; padding-right: 12px; }
}

/* ══════════ Bottom bar MOBILE (modèle AGRO, parité suite — palette ambre) ══════════ */
.bbar-m { display: none; }
.bsheet { display: none; }
@media (max-width: 899px) {
  .bbar-m { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    display: grid; grid-template-columns: repeat(5, 1fr);
    background: rgba(255,255,255,.96);
    -webkit-backdrop-filter: saturate(160%) blur(12px);
    backdrop-filter: saturate(160%) blur(12px);
    border-top: 1px solid var(--line);
    padding: 4px 20px calc(12px + env(safe-area-inset-bottom)); }
  .bbar-m a { display: flex; flex-direction: column; align-items: center; gap: 3px;
    padding: 6px 2px 4px; min-height: 48px; color: var(--muted); border-radius: 10px;
    text-decoration: none; min-width: 0; }
  .bbar-m .ne { font-size: 20px; height: 22px; line-height: 22px; flex: none;
    font-style: normal; }
  .bbar-m a > span:last-child { font-size: .6rem; font-weight: 600; max-width: 100%;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .bbar-m a.on { color: var(--cali-d); }
  main.wrap { padding-bottom: 100px; }
  .foot { padding-bottom: 92px; }
  .bbar-m a.blink { color: var(--cali-d); }
  .bbar-m a.blink .ne, .bbar-m a.blink span { animation: bblink .55s step-end infinite; }
  @keyframes bblink { 50% { opacity: .25; } }
  .bsheet { display: flex; position: fixed; inset: 0; z-index: 50;
    flex-direction: column; justify-content: flex-end; background: rgba(36,28,10,.38); }
  .bsheet[hidden] { display: none; }
  .bsheet-in { background: var(--bg); border-radius: 20px 20px 0 0; max-height: 78vh;
    overflow-y: auto; padding: 14px 16px calc(18px + env(safe-area-inset-bottom)); }
  .bsheet-h { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
  .bsheet-h b { font-size: 1.02rem; }
  .bsheet-h button { appearance: none; border: 0; background: var(--line-2); color: var(--muted);
    width: 30px; height: 30px; border-radius: 50%; font-size: .9rem; cursor: pointer; }
  .bsheet-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .bsheet-grid a { display: flex; flex-direction: column; align-items: center; gap: 6px;
    background: var(--panel); border: 1px solid var(--line-2); border-radius: 12px;
    padding: 12px 6px 10px; font-size: .66rem; font-weight: 600; color: var(--ink);
    text-align: center; min-width: 0; }
  .bsheet-grid a .ne { font-size: 20px; font-style: normal; }
  .bsheet-grid a.on { border-color: var(--cali); background: var(--cali-soft); color: var(--cali-d); }
  .bsheet-grid a .nl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
}
.bbar-m a, .bbar-m a * {
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-user-drag: none;
}
.bbar-m a { -webkit-tap-highlight-color: transparent; }
html[data-theme="dark"] .bbar-m { background: rgba(28, 24, 10, .97); }
html[data-theme="dark"] .bsheet { background: rgba(0, 0, 0, .6); }

/* ---- tri par colonne (sort.js) : en-têtes cliquables + flèche du sens ---- */
table.data thead th { cursor: pointer; user-select: none; }
table.data thead th.sort-asc::after { content: " ▲"; font-size: .7em; color: var(--cali-d); }
table.data thead th.sort-desc::after { content: " ▼"; font-size: .7em; color: var(--cali-d); }

/* ═════════════ v6 — retours Florian 23-07 (logos société · tablero v2 · QR móvil) ═══ */

/* ---- ① logo de la SOCIÉTÉ (mapping whitelisté base.html, fail-soft) ---- */
.soc-logo { object-fit: contain; background: #fff; border-radius: 8px; }
.top-soc { height: 30px; max-width: 96px; padding: 2px 6px; border: 1px solid var(--line-2); flex: none; }
.side-soc { display: block; margin: 0 auto 12px; max-width: 150px; max-height: 46px; padding: 4px 8px; border: 1px solid var(--line-2); }
html[data-theme="dark"] .soc-logo { background: #F4F4F6; border-color: var(--line); }
@media (max-width: 680px) { .top-soc { display: none; } }

/* ---- ② tablero v2 : Temperatura · Alertas · Cámaras · Analítica ---- */
.dash-v2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 16px; margin: 4px 0 20px; }
.dash-v2 .card { margin-bottom: 0; }
.temp-body { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.temp-gauge { width: 150px; flex: none; }
.temp-num { font: 700 26px system-ui, sans-serif; fill: var(--ink); }
.temp-num.muted { fill: var(--muted); }
.temp-arc { stroke: currentColor; }
.temp-arc.temp-ok { color: var(--good); }
.temp-arc.temp-warn { color: #E08700; }
.temp-arc.temp-bad { color: #B42318; }
.temp-comp { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: .88rem; min-width: 0; }
.temp-comp a { color: var(--cali-d); font-weight: 600; }
.temp-comp a:hover { text-decoration: underline; }
.alert-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.alert-list li { padding: 9px 12px; border-radius: 10px; background: var(--line-2); font-size: .9rem; }
.alert-list li.al-aviso { background: #FFF3E6; }
.alert-list li.al-rojo, .alert-list li.al-caducado { background: #FDECEC; }
html[data-theme="dark"] .alert-list li { background: var(--line-2); }
html[data-theme="dark"] .alert-list li.al-aviso { background: #3B2E1B; }
html[data-theme="dark"] .alert-list li.al-rojo, html[data-theme="dark"] .alert-list li.al-caducado { background: #3D2223; }
.cam-list { list-style: none; margin: 6px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: .95rem; }

/* ---- ② certificados (onglets GG/GRASP — cartes depuis la table) ---- */
.cert-card { padding: 10px 0; border-bottom: 1px solid var(--line-2); }
.cert-card:last-of-type { border-bottom: none; }
.cert-edit { margin-top: 8px; }
.cert-edit > summary { cursor: pointer; }
.cert-form { margin-top: 10px; }
.cert-borrar { margin-top: 10px; }

/* ---- ④ bandeau RÈGLES très lisible + coloration live ---- */
.banner-reglas { background: var(--cali-soft); color: var(--cali-d); border-radius: 12px;
  padding: 14px 16px; margin-bottom: 14px; font-size: 1rem; }
.banner-reglas .br-linea { margin-top: 6px; font-weight: 600; color: var(--ink); }
html[data-theme="dark"] .banner-reglas .br-linea { color: var(--ink); }
.regla-live { font-weight: 700; font-size: .88rem; }
.obs-rec { display: block; font-size: .85rem; margin-bottom: 4px; }

/* ---- ④ écran d'exécution MOBILE-FIRST (venu d'un QR → .ej-qr ; sinon <900 px) ---- */
.ej-qr .banner-reglas { font-size: 1.08rem; padding: 16px 18px; }
.ej-qr .form-grid { grid-template-columns: 1fr; }
.ej-qr .form-grid label { font-size: 1rem; }
.ej-qr .form-grid input:not([type=checkbox]), .ej-qr .form-grid select,
.ej-qr .form-grid textarea { min-height: 52px; font-size: 18px; }
.ej-qr .btn-cali.slim { width: 100%; height: 54px; font-size: 1.05rem; }
@media (max-width: 899px) {
  .banner-reglas { font-size: 1.05rem; }
  #ej-form .form-grid input:not([type=checkbox]), #ej-form .form-grid select,
  #ej-form .form-grid textarea { min-height: 52px; font-size: 18px; }
  #ej-form .btn-cali.slim { width: 100%; height: 54px; font-size: 1.05rem; }
}

/* ---- ④ destination d'un scan (qr_destino.html — grosse typo, pleine largeur) ---- */
.qrd { max-width: 640px; margin: 0 auto; }
.qrd-btn { width: 100%; height: auto; min-height: 64px; font-size: 1.12rem;
  margin: 0 0 14px; padding: 14px 18px; text-align: left; justify-content: flex-start; }
.qrd-hecho { border: 1px solid var(--line-2); }
.qrd-hecho-t { font-weight: 700; font-size: 1.05rem; color: var(--good); }
.qrd-acciones { display: flex; gap: 12px; margin-top: 12px; flex-wrap: wrap; }
.qrd-btn2 { flex: 1; justify-content: center; min-height: 50px; font-size: 1rem; }
.qrd-lista { margin-top: 18px; text-align: center; }
