/* Outil à thème unique : clair, bleu Sodexo. Plan : barre du haut, onglets, 3 colonnes (pages / aperçu / formulaire). */
:root {
  --bg: #F3F5FB; --panel: #FFFFFF; --ink: #1B2468; --text: #2A3050; --muted: #667096; --line: #DDE2F3;
  --brand: #283593; --brand-2: #3A4BC4; --brand-soft: #E8EBFA; --red: #E23B45; --green: #2E9E5B; --amber: #E9A21A;
  --font: 'Segoe UI', system-ui, sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--text); font: 14px/1.45 var(--font); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--brand-2); outline-offset: 2px; }
.app { min-height: 100%; display: flex; flex-direction: column; }

/* barre du haut */
.top { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; padding: 10px 20px; background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.brand { font-weight: 800; color: var(--ink); font-size: 17px; letter-spacing: -.01em; margin-right: 6px; }
.brand small { display: block; font-weight: 600; font-size: 11px; color: var(--muted); letter-spacing: 0; }
.ctl { display: flex; align-items: center; gap: 6px; }
.ctl label { font-size: 12px; color: var(--muted); font-weight: 600; }
select, input[type=text], input[type=month], input[type=number], textarea, .num {
  border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; background: #fff; min-width: 0; width: 100%;
}
.top select, .top input[type=month] { width: auto; font-weight: 600; color: var(--ink); }
textarea { resize: vertical; line-height: 1.4; }
.spacer { flex: 1; }
.status { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.status i { width: 8px; height: 8px; border-radius: 50%; background: var(--green); display: inline-block; }
.status.busy i { background: var(--amber); } .status.err i { background: var(--red); }
.btn { border: 1px solid var(--line); background: #fff; color: var(--ink); padding: 8px 14px; border-radius: 9px; font-weight: 700; display: inline-flex; align-items: center; gap: 6px; }
.btn:hover { border-color: #B8C0E6; background: #F8F9FE; }
.btn.primary { background: var(--brand); color: #fff; border-color: var(--brand); }
.btn.primary:hover { background: var(--brand-2); }
.btn.danger { color: var(--red); }
.btn.small { padding: 4px 9px; font-size: 12px; border-radius: 7px; }
.btn[disabled] { opacity: .55; cursor: default; }

/* onglets */
.tabs { display: flex; gap: 4px; padding: 10px 20px 0; }
.tab { border: 0; background: transparent; padding: 9px 16px; font-weight: 700; color: var(--muted); border-bottom: 3px solid transparent; }
.tab[aria-selected=true] { color: var(--ink); border-bottom-color: var(--brand); }

/* corps */
.main { flex: 1; display: grid; grid-template-columns: 270px minmax(0, 1fr) 380px; gap: 16px; padding: 16px 20px 28px; align-items: start; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; }
.col-pages { padding: 12px; position: sticky; top: 112px; max-height: calc(100vh - 128px); overflow: auto; }
.col-pages h3, .col-form h3 { margin: 4px 4px 10px; font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.plist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 3px; }
.pitem { display: flex; align-items: center; gap: 6px; padding: 5px 6px; border-radius: 9px; border: 1px solid transparent; }
.pitem.sel { background: var(--brand-soft); border-color: #C8D0F3; }
.pitem.off .plabel { color: #9BA2C0; text-decoration: line-through; text-decoration-color: #C5CAE0; }
.pitem input[type=checkbox] { width: 17px; height: 17px; accent-color: var(--brand); flex: none; }
.plabel { flex: 1; min-width: 0; text-align: left; background: none; border: 0; padding: 3px 2px; font-weight: 600; color: var(--ink); line-height: 1.25; }
.dot { width: 9px; height: 9px; border-radius: 3px; flex: none; }
.mv { display: flex; flex: none; }
.mv button { border: 0; background: none; color: var(--muted); padding: 2px 5px; border-radius: 6px; font-size: 13px; line-height: 1; }
.mv button:hover { background: #fff; color: var(--ink); }
.addp { margin-top: 12px; display: flex; flex-direction: column; gap: 6px; }

.stage-wrap { min-width: 0; }
.stage-box { width: 100%; background: #E4E8F6; border-radius: 14px; padding: 14px; }
.stage { position: relative; margin: 0 auto; overflow: hidden; border-radius: 8px; box-shadow: 0 6px 28px rgba(27, 36, 104, .16); background: #fff; }
.stage > .rp-slide { transform-origin: 0 0; position: absolute; left: 0; top: 0; }
.rp-slot:hover { outline: 3px solid rgba(58, 75, 196, .55); outline-offset: -3px; }
.nav { display: flex; align-items: center; justify-content: center; gap: 12px; margin: 12px 0 4px; color: var(--muted); font-weight: 600; }
.hint { color: var(--muted); font-size: 12.5px; margin: 8px 2px; }

.col-form { padding: 14px 14px 18px; position: sticky; top: 112px; max-height: calc(100vh - 128px); overflow: auto; }
.col-form h2 { margin: 0 0 2px; font-size: 18px; color: var(--ink); }
.fld { margin: 12px 0; }
.fld > label, .lbl { display: block; font-weight: 700; font-size: 12.5px; color: var(--ink); margin-bottom: 4px; }
.fld .sub { font-weight: 500; color: var(--muted); font-size: 12px; }
.group { border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px 10px; margin: 12px 0; background: #FAFBFF; }
.group > .lbl { margin-bottom: 6px; }
.mrow { display: grid; grid-template-columns: 1fr 112px; gap: 8px; align-items: center; margin: 7px 0; }
.mrow .name { font-weight: 600; color: var(--ink); font-size: 13px; }
.mrow .name small { display: block; font-weight: 500; color: var(--muted); font-size: 11.5px; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.checks { display: grid; gap: 4px; margin-top: 2px; }
.checks label { display: flex; gap: 8px; align-items: center; font-weight: 500; color: var(--text); font-size: 13px; }
.checks input { accent-color: var(--brand); width: 16px; height: 16px; }
.slot { display: grid; grid-template-columns: 76px 1fr; gap: 10px; align-items: center; border: 1.5px dashed #B8C0E6; border-radius: 10px; padding: 8px; background: #fff; }
.slot.over { background: var(--brand-soft); border-color: var(--brand-2); }
.slot .thumb { width: 76px; height: 56px; border-radius: 6px; background: #EEF0FA center/cover no-repeat; display: grid; place-items: center; color: #98A0C8; font-size: 22px; }
.slot .thumb.contain { background-size: contain; }
.slot .acts { display: flex; gap: 6px; flex-wrap: wrap; }
.slot .t { font-size: 12.5px; font-weight: 700; color: var(--ink); width: 100%; }
.slot .busy { font-size: 12px; color: var(--amber); font-weight: 700; }
.rowcard { border: 1px solid var(--line); border-radius: 10px; padding: 8px; margin: 8px 0; background: #FAFBFF; display: grid; gap: 6px; }
.rowcard .rc { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.rowcard label { font-size: 11.5px; color: var(--muted); font-weight: 600; display: block; margin-bottom: 2px; }
.rowcard .full { grid-column: 1 / -1; }
.rowcard .del { justify-self: end; }
.note { font-size: 12.5px; color: var(--muted); background: var(--brand-soft); border-radius: 8px; padding: 8px 10px; }
.delta { font-size: 11.5px; font-weight: 700; }
.delta.up { color: var(--green); } .delta.down { color: var(--red); }

/* onglets pleine largeur */
.full { grid-column: 1 / -1; }
.panel { padding: 18px 20px; }
.panel h2 { margin: 0 0 4px; color: var(--ink); font-size: 19px; }
.panel p.lead { margin: 0 0 14px; color: var(--muted); }
.tbl-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 10px; max-height: 68vh; }
table.grid { border-collapse: separate; border-spacing: 0; width: max-content; min-width: 100%; }
.grid th, .grid td { border-bottom: 1px solid var(--line); border-right: 1px solid #EEF0F8; padding: 0; background: #fff; }
.grid thead th { position: sticky; top: 0; background: #EEF1FC; z-index: 2; padding: 8px 6px; font-size: 12px; color: var(--ink); text-align: center; min-width: 84px; }
.grid th.rowh { position: sticky; left: 0; z-index: 1; background: #fff; text-align: left; padding: 6px 10px; min-width: 250px; font-weight: 600; color: var(--ink); font-size: 13px; }
.grid thead th.rowh { z-index: 3; background: #EEF1FC; }
.grid tr.grp th { background: #F6F7FD; font-size: 11.5px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); padding: 6px 10px; text-align: left; position: sticky; left: 0; }
.grid td input { border: 0; border-radius: 0; text-align: right; padding: 8px 8px; background: transparent; font-variant-numeric: tabular-nums; }
.grid td input:focus { outline: 2px solid var(--brand-2); outline-offset: -2px; background: #fff; }
.grid td.cur, .grid th.cur { background: #FFF8E4; }
.grid thead th.cur { background: #FCE9A8; }
.two { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px 28px; }
.empty { padding: 60px 20px; text-align: center; }
.empty h2 { color: var(--ink); }
.toast { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 11px 18px; border-radius: 10px; font-weight: 600; box-shadow: 0 8px 28px rgba(0, 0, 0, .25); z-index: 50; max-width: 90vw; }
.toast.err { background: #A81F29; }
.modal-bg { position: fixed; inset: 0; background: rgba(20, 26, 70, .45); display: grid; place-items: center; z-index: 60; padding: 16px; }
.modal { background: #fff; border-radius: 14px; padding: 20px; width: min(440px, 100%); }
.modal h3 { margin: 0 0 8px; color: var(--ink); }
.modal .acts { display: flex; gap: 8px; justify-content: flex-end; margin-top: 14px; }

@media (max-width: 1180px) {
  .main { grid-template-columns: 1fr; }
  .col-pages, .col-form { position: static; max-height: none; }
  .stage-wrap { order: -1; }
}
@media (max-width: 560px) { .top, .tabs, .main { padding-left: 12px; padding-right: 12px; } .rowcard .rc { grid-template-columns: 1fr; } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ===== v2 : saisie sur une page, connexion, vue d'ensemble, administration ===== */
:root { --amber: #E9A21A; }
.main.three { display: grid; }
.main.one { display: block; max-width: 1280px; width: 100%; margin: 0 auto; }
.main.saisie { display: block; }
.saisie-wrap { max-width: 1040px; margin: 0 auto; display: flex; flex-direction: column; gap: 16px; padding-bottom: 90px; }
.panel h2 { display: flex; align-items: center; gap: 10px; }
.stepno { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--brand); color: #fff; font-size: 14px; font-weight: 800; flex: none; }
.gtitle { margin: 18px 0 6px; font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.mgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(330px, 1fr)); gap: 2px 28px; }
.mgrid .fld { margin: 7px 0; }
.mgrid .mrow { grid-template-columns: 1fr 120px; }
.count { color: var(--muted); }
.notes { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 4px 20px; }
.notes .wide { grid-column: 1 / -1; }
.drop { border: 2px dashed #B8C0E6; border-radius: 12px; padding: 22px; display: flex; flex-direction: column; align-items: center; gap: 4px; color: var(--muted); cursor: pointer; background: #FAFBFF; }
.drop strong { color: var(--ink); font-size: 15px; }
.drop:hover, .drop.over { border-color: var(--brand); background: var(--brand-soft); }
.pgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; margin-top: 12px; }
.pcard { border: 1px solid var(--line); border-radius: 12px; padding: 8px; display: flex; flex-direction: column; gap: 6px; background: #fff; }
.pimg { aspect-ratio: 4 / 3; border-radius: 8px; background: #EEF0FA center / cover no-repeat; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px 6px 9px; font-weight: 600; color: var(--muted); background: #fff; cursor: pointer; }
.chip.on { color: var(--ink); border-color: var(--brand); background: var(--brand-soft); }
.chip input { accent-color: var(--brand); width: 15px; height: 15px; }
.chip i { width: 9px; height: 9px; border-radius: 3px; }
.actbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 25; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 12px 24px; background: rgba(255, 255, 255, .96); border-top: 1px solid var(--line); box-shadow: 0 -6px 24px rgba(27, 36, 104, .08); backdrop-filter: blur(6px); }
.actbar .ai { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--muted); }
.actbar .ai i { width: 8px; height: 8px; border-radius: 50%; background: var(--amber); }
.actbar .ai.ok i { background: var(--green); }
.btn.big { padding: 11px 20px; font-size: 15px; border-radius: 11px; }
/* connexion */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: linear-gradient(135deg, var(--brand-soft), #fff); }
.lg-card { width: min(400px, 100%); padding: 28px; }
.lg-brand { font-size: 24px; font-weight: 800; color: var(--ink); }
.lg-err { color: var(--red); font-weight: 600; min-height: 22px; margin: 6px 0; }
.lead { color: var(--muted); }
/* tableaux */
.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; padding: 8px 10px; background: #F6F7FD; position: sticky; top: 0; }
.tbl td { padding: 10px; border-top: 1px solid var(--line); vertical-align: middle; }
.tbl td.r { text-align: right; white-space: nowrap; }
.tbl-wrap.short { max-height: none; }
.muted { color: var(--muted); }
.bar { height: 8px; background: #EEF0F8; border-radius: 4px; overflow: hidden; min-width: 110px; margin-bottom: 4px; }
.bar i { display: block; height: 100%; border-radius: 4px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin-bottom: 16px; }
.tile { border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; background: #FAFBFF; }
.tv { font-size: 28px; font-weight: 800; color: var(--ink); }
.tl { font-size: 12.5px; color: var(--muted); }
/* styles */
.themes { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.theme { display: flex; flex-direction: column; gap: 4px; border: 2px solid var(--line); border-radius: 12px; padding: 12px; cursor: pointer; background: #fff; }
.theme.sel { border-color: var(--brand); background: var(--brand-soft); }
.theme input { position: absolute; opacity: 0; }
.theme small { color: var(--muted); }
.theme .sw { display: flex; gap: 4px; margin-bottom: 4px; }
.theme .sw i { width: 26px; height: 26px; border-radius: 8px; }
.cpicks { display: flex; gap: 18px; flex-wrap: wrap; margin-top: 12px; }
.cpick { display: flex; align-items: center; gap: 8px; font-weight: 600; color: var(--ink); }
.cpick input { width: 44px; height: 32px; padding: 0; border: 1px solid var(--line); border-radius: 6px; }
/* menu utilisateur et fenêtres */
.um { position: relative; }
.um summary { cursor: pointer; font-weight: 700; color: var(--ink); padding: 6px 10px; border: 1px solid var(--line); border-radius: 9px; list-style: none; }
.um[open] .umenu { position: absolute; right: 0; top: 40px; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 12px; display: flex; flex-direction: column; gap: 8px; min-width: 230px; box-shadow: 0 10px 30px rgba(0, 0, 0, .12); z-index: 40; }
.stack { display: flex; flex-direction: column; gap: 8px; }
.row { display: flex; gap: 6px; }
.sitebox { max-height: 160px; overflow: auto; border: 1px solid var(--line); border-radius: 8px; padding: 8px; }
.inl { display: flex; gap: 8px; align-items: center; font-size: 13px; }
.modal { width: min(480px, 100%); max-height: 90vh; overflow: auto; }
@media (max-width: 700px) { .actbar { padding: 10px 12px; } .mgrid { grid-template-columns: 1fr; } }

.card, .pcard, .tile, .theme, .rowcard, .group { border-color: #C3CCF0; }
.theme.sel, .chip.on { border-color: var(--brand); }

/* ===== v2.1 : validation, anomalies, comparatif, import, rappels ===== */
.schip { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.schip.draft { background: #EEF0F8; color: var(--muted); } .schip.wait { background: #FFF1D6; color: #8A5A00; } .schip.ok { background: #DDF3E6; color: #1E7A44; }
.statusbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; padding: 12px 16px; }
.sb-main { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 240px; } .sb-acts { display: flex; gap: 8px; flex-wrap: wrap; }
.sb-com { width: 100%; font-size: 13px; color: var(--text); background: #FFF8E4; border-radius: 8px; padding: 8px 10px; }
.anoms { background: #FFF8E4; border: 1px solid #F0D58A; border-radius: 10px; padding: 8px 12px; margin: 8px 0; font-size: 13px; color: #6B4A00; } .anoms:empty { display: none; }
.mrow.warn { background: #FFF8E4; border-radius: 8px; box-shadow: 0 0 0 4px #FFF8E4; } .mrow.warn input { border-color: #E9A21A; }
.warn-t { color: #8A5A00; font-weight: 700; } .late { color: var(--red); font-weight: 700; }
.sector-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 14px; }
.cmp-ctl { display: flex; gap: 18px; flex-wrap: wrap; margin: 8px 0 14px; }
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 13px; margin-top: 6px; } .legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; }
.modal.wide { width: min(720px, 100%); } .imp-out { margin-top: 8px; }
.ptools { display: flex; gap: 4px; } .ptools select { padding: 3px 4px; font-size: 12px; }
.rem { margin-top: 16px; } .rem summary { cursor: pointer; padding: 2px 0; }
.qr { width: 190px; margin: 8px auto; } .qr svg { width: 100%; height: auto; }
.tpls { display: flex; flex-wrap: wrap; gap: 10px; } .tpl { display: flex; flex-direction: column; gap: 4px; border: 1px solid #C3CCF0; border-radius: 10px; padding: 10px 12px; min-width: 180px; }
.tplbar { display: flex; gap: 8px; margin-bottom: 8px; }
