/* Back-office v2 — direction « aux couleurs de Marcel » : barre latérale rouge et damier, fond crème, titres Anton.
   Organisation reprise du back-office RXR : rubriques rangées par usage, recherche en haut, tableau de bord. */
:root {
  --red: #aa0000;
  --red-deep: #780000;
  --cream: #f4f3dc;
  --bg: #f4f3dc;
  --panel: #fffef6;
  --ink: #1a1512;
  --muted: #6f675d;
  --line: #e2dfc4;
  --accent: #aa0000;
  --accent-soft: #fde3e3;
  --ok: #1f8a4c;
  --ok-soft: #e3f4ea;
  --warn: #b26a00;
  --warn-soft: #fff1dc;
  --radius: 14px;
  --display: "Anton", "Impact", sans-serif;
  font: 14.5px/1.5 "Inter", system-ui, sans-serif;
  color: var(--ink);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); }
[hidden] { display: none !important; }
h1, h2, h3 { margin: 0; line-height: 1.15; }
.muted { color: var(--muted); }
.error { color: var(--accent); margin: 0; }
a { color: var(--red); }
code { background: #efecd2; padding: 1px 5px; border-radius: 5px; font-size: 13px; }
.damier { height: 10px; background: conic-gradient(var(--cream) 0 25%, var(--red-deep) 0 50%, var(--cream) 0 75%, var(--red-deep) 0) 0 0 / 20px 20px; }

/* ---------------------------------------------------------------- connexion */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; background: var(--red); }
.login-card { width: min(400px, 100%); background: var(--panel); border-radius: 20px; overflow: hidden; box-shadow: 0 20px 60px rgba(0, 0, 0, .25); }
.login-card form { padding: 28px; display: grid; gap: 14px; }
.login-card .brand-big { display: flex; align-items: center; gap: 14px; }
.login-card .brand-big img { width: 56px; height: 56px; }
.login-card h1 { font: 400 30px/1 var(--display); text-transform: uppercase; color: var(--red); }

/* ---------------------------------------------------------------- charpente */
.shell { display: grid; grid-template-columns: 252px minmax(0, 1fr); min-height: 100vh; }
.side { background: var(--red); color: #ffecec; position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; }
.side-top { display: flex; align-items: center; gap: 11px; padding: 18px 18px 6px; }
.side-top img { width: 42px; height: 42px; flex: none; border-radius: 50%; box-shadow: 0 0 0 2px var(--cream); }  /* macaron rouge sur fond rouge */
.side-top .mark { width: 42px; height: 42px; border-radius: 50%; background: var(--cream); color: var(--red); display: grid; place-items: center; font: 400 17px var(--display); flex: none; }
.side-top b { color: #fff; font-size: 15px; line-height: 1.15; display: block; }
.side-top small { color: rgba(255, 255, 255, .65); font-size: 12px; }
.side select { margin: 10px 14px 0; width: calc(100% - 28px); background: var(--red-deep); color: #fff; border-color: rgba(255, 255, 255, .25); }
.burger { display: none; margin-left: auto; background: none; border: 0; padding: 6px; cursor: pointer; }
.burger span { display: block; width: 20px; height: 2px; background: #fff; margin: 4px 0; border-radius: 2px; }
#nav { display: flex; flex-direction: column; padding: 4px 12px 14px; flex: 1; }
.nav-sec { margin-top: 16px; }
.nav-sec p { margin: 0 0 4px 10px; font-size: 10.5px; letter-spacing: .13em; text-transform: uppercase; color: rgba(255, 255, 255, .6); font-weight: 700; }
#nav a { position: relative; display: flex; align-items: center; gap: 11px; padding: 8px 10px; border-radius: 10px; color: #ffecec; text-decoration: none; font-weight: 500; }
#nav a svg { width: 18px; height: 18px; flex: none; opacity: .85; }
#nav a:hover { background: rgba(255, 255, 255, .1); color: #fff; }
#nav a.active { background: var(--cream); color: var(--red); font-weight: 700; }
#nav a.active svg { opacity: 1; }
#nav a i { margin-left: auto; font-style: normal; background: var(--cream); color: var(--red); font-size: 11px; font-weight: 800; padding: 1px 7px; border-radius: 99px; }
#nav a.active i { background: var(--red); color: #fff; }
.side-foot { margin-top: auto; padding: 12px; border-top: 1px solid rgba(255, 255, 255, .2); display: grid; gap: 2px; }
.side-foot a, .side-foot button { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 9px; color: rgba(255, 255, 255, .8); text-decoration: none; font: inherit; font-size: 13px; background: none; border: 0; cursor: pointer; text-align: left; }
.side-foot a:hover, .side-foot button:hover { background: rgba(255, 255, 255, .1); color: #fff; }
.side-foot svg { width: 16px; height: 16px; }
.side-foot .me { padding: 4px 10px 0; font-size: 12px; color: rgba(255, 255, 255, .55); word-break: break-all; }

.main { min-width: 0; display: flex; flex-direction: column; }
.top { position: sticky; top: 0; z-index: 15; display: flex; align-items: center; gap: 14px; padding: 12px clamp(16px, 3vw, 36px);
  background: rgba(244, 243, 220, .92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.search { position: relative; flex: 1; max-width: 540px; }
.search > div { display: flex; align-items: center; gap: 8px; background: var(--panel); border: 1px solid var(--line); border-radius: 11px; padding: 0 12px; color: var(--muted); }
.search > div:focus-within { border-color: var(--red); box-shadow: 0 0 0 3px rgba(170, 0, 0, .12); }
.search input { border: 0; outline: 0; background: none; padding: 10px 0; width: 100%; }
.search svg { width: 17px; height: 17px; flex: none; }
.results { position: absolute; top: calc(100% + 6px); left: 0; right: 0; background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, .14); max-height: 70vh; overflow-y: auto; padding: 6px; }
.results p { margin: 8px 10px 4px; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.results a { display: flex; gap: 10px; align-items: baseline; padding: 8px 10px; border-radius: 8px; color: var(--ink); text-decoration: none; }
.results a:hover, .results a.on { background: var(--cream); }
.results a b { min-width: 34px; color: var(--red); }
.results a span { margin-left: auto; color: var(--muted); font-size: 13px; white-space: nowrap; }
.live { margin-left: auto; display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 13px; white-space: nowrap; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 4px rgba(31, 138, 76, .15); flex: none; }
.dot.off { background: #b9b4a0; box-shadow: none; }
.dot.warn { background: var(--warn); box-shadow: 0 0 0 4px rgba(178, 106, 0, .15); }
.view { padding: 26px clamp(16px, 3vw, 36px) 70px; max-width: 1320px; width: 100%; }

.view-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 14px; margin-bottom: 22px; }
.view-head h2 { font: 400 38px/1 var(--display); text-transform: uppercase; color: var(--red); letter-spacing: .01em; }
.view-head p { margin: 6px 0 0; color: var(--muted); max-width: 70ch; }
.intro { margin: -10px 0 20px; color: var(--muted); max-width: 80ch; }

/* ---------------------------------------------------------------- éléments */
label { display: grid; gap: 5px; font-weight: 600; font-size: 13.5px; }
input, select, textarea { font: inherit; font-weight: 400; padding: 9px 11px; border: 1px solid var(--line); border-radius: 9px;
  background: #fff; color: var(--ink); width: 100%; }
textarea { min-height: 70px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 0; border-color: var(--red); box-shadow: 0 0 0 3px rgba(170, 0, 0, .12); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; font: inherit; font-weight: 700; font-size: 13.5px; padding: 9px 15px;
  border-radius: 10px; border: 1px solid var(--line); background: var(--panel); cursor: pointer; color: var(--ink); text-decoration: none; white-space: nowrap; }
.btn:hover { border-color: #c6c1a2; }
.btn.primary { background: var(--red); border-color: var(--red); color: #fff; }
.btn.primary:hover { background: var(--red-deep); }
.btn.small { padding: 5px 10px; font-size: 12.5px; border-radius: 8px; }
.btn:disabled { opacity: .5; cursor: wait; }
.link { background: none; border: 0; color: inherit; text-decoration: underline; cursor: pointer; padding: 0; text-align: left; font: inherit; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.card + .card { margin-top: 14px; }
.card h3 { font: 400 19px/1.1 var(--display); text-transform: uppercase; margin-bottom: 12px; display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.card h3 a, .card h3 .more { font: 600 12.5px "Inter", sans-serif; color: var(--muted); text-decoration: none; text-transform: none; }
.card h3 a:hover { color: var(--red); }
.cols { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 14px; margin-top: 14px; align-items: start; }
.stack { display: grid; gap: 14px; }

.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.kpi small { color: var(--muted); font-weight: 600; font-size: 13px; }
.kpi b { display: block; font: 400 34px/1.1 var(--display); margin-top: 6px; }
.kpi .delta { font-size: 12.5px; font-weight: 700; color: var(--muted); }
.kpi .delta.up { color: var(--ok); }
.kpi .delta.down { color: var(--accent); }
.split { display: flex; height: 8px; border-radius: 99px; overflow: hidden; margin-top: 12px; background: #ebe8cf; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 8px; font-size: 12px; color: var(--muted); }
.legend em { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 5px; }
.src-kiosk { background: var(--ink); } .src-web { background: var(--red); } .src-counter { background: #c9c4a2; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.stat b { display: block; font: 400 26px/1.15 var(--display); margin-top: 2px; }

table { width: 100%; border-collapse: collapse; background: var(--panel); border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; font-size: 14px; }
th { background: #f9f7e6; font-weight: 700; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .05em; }
tr:last-child td { border-bottom: 0; }
.num { text-align: right; white-space: nowrap; }
.lines { margin: 0; padding-left: 16px; color: var(--muted); }
.bignum { font: 400 24px/1 var(--display); color: var(--red); }
.card table { border: 0; border-radius: 0; background: none; }
.card table td { padding: 10px 6px; }
.live-list td { vertical-align: middle; }
.live-list .sub { font-size: 12.5px; color: var(--muted); }

.pill { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: 12px; font-weight: 700; white-space: nowrap; background: #ece9d2; color: #4d483f; }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.bad { background: var(--accent-soft); color: var(--accent); }

.empty { padding: 26px; text-align: center; color: var(--muted); }
.devices { display: grid; gap: 9px; }
.devices div { display: flex; align-items: center; gap: 10px; }
.devices div .pill { margin-left: auto; }
.stock { display: grid; gap: 8px; }
.stock label { display: flex; justify-content: space-between; align-items: center; padding: 8px 10px; border-radius: 10px; background: var(--cream); font-weight: 600; cursor: pointer; }

.chart { display: flex; align-items: flex-end; gap: 6px; height: 140px; margin-top: 4px; }
.chart div { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 4px; }
.chart i { display: block; width: 100%; background: #e6e3c8; border-radius: 5px 5px 0 0; min-height: 2px; }
.chart i.hot { background: var(--red); }
.chart span { font-size: 11px; color: var(--muted); }
.chart b { font-size: 11px; color: var(--ink); }
.bars { display: grid; gap: 8px; }
.bars div { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 10px; font-size: 13.5px; }
.bars i { grid-column: 1 / -1; display: block; height: 7px; border-radius: 99px; background: var(--red); }

.cat-block { margin-bottom: 24px; }
.cat-title { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; gap: 10px; }
.cat-title h3 { font: 400 22px/1 var(--display); text-transform: uppercase; color: var(--red); }
.product { display: grid; grid-template-columns: 56px 1fr auto auto; gap: 14px; align-items: center;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px; margin-bottom: 8px; }
.product.off { opacity: .55; }
.thumb { width: 56px; height: 56px; border-radius: 10px; background: #ece9d2 center/cover; }
.thumb.drawn { background: var(--red); display: grid; place-items: center; padding: 6px; }
.thumb.drawn svg { width: 100%; height: auto; }
.product h4 { margin: 0; font-size: 15px; }
.product .meta { font-size: 13px; color: var(--muted); }
.price { font-weight: 800; white-space: nowrap; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.chips a { padding: 7px 13px; border-radius: 99px; background: var(--panel); border: 1px solid var(--line); color: var(--ink); text-decoration: none; font-weight: 700; font-size: 13px; }
.chips a:hover { border-color: var(--red); color: var(--red); }

.switch { position: relative; display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13px; font-weight: 600; }
.switch input { appearance: none; width: 38px; height: 22px; border-radius: 99px; background: #cfcab0; padding: 0;
  border: 0; position: relative; cursor: pointer; transition: background .15s; flex: none; }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; }
.switch input:checked { background: var(--ok); }
.switch input:checked::after { transform: translateX(16px); }
.switch input:focus { box-shadow: 0 0 0 3px rgba(31, 138, 76, .2); }

.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; }
.checks label { display: flex; gap: 6px; align-items: center; font-weight: 400; }
.checks input { width: auto; }
.opt-row { display: grid; grid-template-columns: 1fr 110px auto auto auto; gap: 8px; align-items: center; margin-bottom: 6px; }
fieldset.card { margin: 0; }
fieldset.card legend { font-weight: 800; padding: 0 6px; }

dialog { border: 0; border-radius: 18px; padding: 0; width: min(660px, calc(100vw - 32px)); max-height: 90vh; background: var(--panel); }
dialog::backdrop { background: rgba(26, 21, 18, .5); }
#modal-body { padding: 24px; display: grid; gap: 14px; }
#modal-body h3 { font: 400 26px/1 var(--display); text-transform: uppercase; color: var(--red); }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 6px; flex-wrap: wrap; }
.secret { font-family: ui-monospace, monospace; background: var(--cream); padding: 10px; border-radius: 8px; word-break: break-all; }

.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff;
  padding: 10px 18px; border-radius: 10px; font-weight: 600; z-index: 40; max-width: calc(100vw - 32px); }
.toast.bad { background: var(--accent); }

.quota { margin: 4px 0 14px; font-size: 14px; }
.quota-track { height: 8px; border-radius: 99px; background: var(--ok-soft); overflow: hidden; margin-top: 6px; }
.quota-fill { height: 100%; border-radius: 99px; background: var(--ok); }
.quota-fill.warn { background: var(--warn); }
.quota-fill.bad { background: var(--accent); }
.qr { display: flex; justify-content: center; margin: 8px 0 12px; }
.qr svg { width: 240px; height: 240px; }
.slot-row { display: grid; grid-template-columns: 70px 1fr auto; gap: 12px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); }
.slot-row:first-child { border-top: 0; }
.slot-row > b { font: 400 20px var(--display); color: var(--red); }

/* ---------------------------------------------------------------- mobile */
@media (max-width: 1080px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } .cols { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: sticky; height: auto; z-index: 20; overflow: visible; }
  .burger { display: block; }
  #nav, .side-foot, .side select { display: none; }
  .side.open #nav { display: flex; }
  .side.open .side-foot { display: grid; }
  .side.open select { display: block; }
  .side.open { max-height: 100vh; overflow-y: auto; }
  .side-top { padding: 10px 14px; }
  .top { top: 62px; padding: 10px 14px; }
  .live span:last-child { display: none; }
  .grid2, .grid3 { grid-template-columns: 1fr; }
  .product { grid-template-columns: 48px 1fr; }
  .product > :nth-child(n+3) { grid-column: 2; }
  table { display: block; overflow-x: auto; }
  .view-head h2 { font-size: 32px; }
  .kpi b { font-size: 26px; }
  .kpis { gap: 10px; }
}
