/* ==========================================================================
   Immutable — interface caisse
   Toutes les couleurs passent par des variables CSS (surchargées par /theme.css).
   Mobile-first, cibles tactiles ≥ 48 px, animations sobres (respecte reduced-motion).
   ========================================================================== */

:root {
  --im-bg: #121418;
  --im-surface: #1c1f26;
  --im-surface-2: #262a33;
  --im-text: #f1f3f5;
  --im-text-muted: #9aa3af;
  --im-primary: #f5c518;
  --im-secondary: #3b82f6;
  --im-success: #22a35a;
  --im-danger: #e03131;
  --im-warning: #f08c00;
  --im-radius: 14px;
  --im-border: color-mix(in srgb, var(--im-text) 10%, transparent);
  --im-shadow: 0 10px 30px rgb(0 0 0 / .35);
  --im-topbar: 56px;
  --im-ease: cubic-bezier(.2, .8, .2, 1);
  --im-c0: #3b3f46; --im-c1: #d62828; --im-c2: #9b2c8f; --im-c3: #e07a1f; --im-c4: #2747c9;
  --im-c5: #2f8f3a; --im-c6: #138a8a; --im-c7: #c9a227; --im-c8: #d94a8c; --im-c9: #6b7280;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--im-bg); color: var(--im-text);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}
a { color: var(--im-primary); }
.text-muted, .im-muted { color: var(--im-text-muted) !important; }
::selection { background: var(--im-primary); color: #111; }

/* ---------- Bootstrap harmonisé au thème ---------- */
.card, .modal-content, .dropdown-menu, .list-group-item, .offcanvas {
  background: var(--im-surface); color: var(--im-text); border-color: var(--im-border);
}
.modal-content { border-radius: calc(var(--im-radius) + 4px); box-shadow: var(--im-shadow); }
.modal-header, .modal-footer { border-color: var(--im-border); }
.form-control, .form-select {
  background-color: var(--im-surface-2); color: var(--im-text); border-color: var(--im-border);
  border-radius: calc(var(--im-radius) - 4px); min-height: 46px;
}
.form-control:focus, .form-select:focus {
  background-color: var(--im-surface-2); color: var(--im-text);
  border-color: var(--im-primary); box-shadow: 0 0 0 .2rem color-mix(in srgb, var(--im-primary) 30%, transparent);
}
.form-control::placeholder { color: var(--im-text-muted); }
.form-label { color: var(--im-text-muted); font-size: .85rem; margin-bottom: .25rem; }
.table { --bs-table-bg: transparent; --bs-table-color: var(--im-text); --bs-table-border-color: var(--im-border);
  --bs-table-hover-bg: var(--im-surface-2); --bs-table-hover-color: var(--im-text); --bs-table-striped-color: var(--im-text); }
.btn { border-radius: calc(var(--im-radius) - 4px); font-weight: 600; min-height: 44px;
  transition: transform .08s var(--im-ease), filter .15s, background-color .15s; }
.btn:active { transform: scale(.96); }
.btn-primary { --bs-btn-bg: var(--im-primary); --bs-btn-border-color: var(--im-primary); --bs-btn-color: #111;
  --bs-btn-hover-bg: var(--im-primary); --bs-btn-hover-color: #111; --bs-btn-active-bg: var(--im-primary); --bs-btn-hover-border-color: var(--im-primary); }
.btn-primary:hover { filter: brightness(1.08); }
.btn-success { --bs-btn-bg: var(--im-success); --bs-btn-border-color: var(--im-success); --bs-btn-hover-bg: var(--im-success); --bs-btn-active-bg: var(--im-success); }
.btn-danger { --bs-btn-bg: var(--im-danger); --bs-btn-border-color: var(--im-danger); --bs-btn-hover-bg: var(--im-danger); --bs-btn-active-bg: var(--im-danger); }
.btn-soft { background: var(--im-surface-2); color: var(--im-text); border: 1px solid var(--im-border); }
.btn-soft:hover { background: color-mix(in srgb, var(--im-surface-2) 80%, var(--im-text)); color: var(--im-text); }
.badge-soft { background: var(--im-surface-2); color: var(--im-text); border: 1px solid var(--im-border); font-weight: 600; }
.nav-pills .nav-link { color: var(--im-text-muted); border-radius: calc(var(--im-radius) - 4px); }
.nav-pills .nav-link.active { background: var(--im-primary); color: #111; }

/* ---------- Barre supérieure ---------- */
.im-topbar {
  position: sticky; top: 0; z-index: 1030; height: var(--im-topbar);
  display: flex; align-items: center; gap: .75rem; padding: 0 .75rem;
  background: color-mix(in srgb, var(--im-surface) 92%, transparent);
  backdrop-filter: blur(12px); border-bottom: 1px solid var(--im-border);
}
.im-brand { display: flex; align-items: center; gap: .5rem; color: var(--im-text); text-decoration: none; font-weight: 800; letter-spacing: .02em; }
.im-brand-mark { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--im-primary), color-mix(in srgb, var(--im-primary) 50%, var(--im-secondary))); color: #111; font-weight: 900; }
.im-brand small { display: block; font-weight: 500; color: var(--im-text-muted); font-size: .72rem; line-height: 1; }
.im-topbar-title { flex: 1; min-width: 0; text-align: center; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.im-clock { text-align: right; font-variant-numeric: tabular-nums; line-height: 1.05; }
.im-clock .t { font-weight: 800; color: var(--im-primary); font-size: 1.1rem; }
.im-clock .d { font-size: .7rem; color: var(--im-text-muted); text-transform: capitalize; }
.im-user { display: flex; align-items: center; gap: .4rem; }
.im-avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
  background: var(--im-surface-2); border: 1px solid var(--im-border); font-weight: 700; }
@media (max-width: 575px) { .im-clock .d, .im-brand small, .im-user .name { display: none; } }

.im-main { padding: 1rem; max-width: 1400px; margin: 0 auto; animation: im-in .35s var(--im-ease) both; }
body.is-pos .im-main { max-width: none; padding: .5rem; height: calc(100dvh - var(--im-topbar)); overflow: hidden; }
@keyframes im-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- Accueil (menu principal Gesto modernisé) ---------- */
.im-home { display: grid; gap: 1rem; grid-template-columns: 1fr; max-width: 980px; margin: 0 auto; }
@media (min-width: 768px) { .im-home { grid-template-columns: repeat(2, 1fr); } }
.im-tile {
  position: relative; display: flex; align-items: center; gap: 1rem; padding: 1.25rem 1.4rem; min-height: 110px;
  border-radius: calc(var(--im-radius) + 6px); background: var(--im-surface); border: 1px solid var(--im-border);
  color: var(--im-text); text-decoration: none; overflow: hidden;
  transition: transform .2s var(--im-ease), box-shadow .2s, border-color .2s;
  animation: im-in .45s var(--im-ease) both;
}
.im-tile:nth-child(2) { animation-delay: .04s; } .im-tile:nth-child(3) { animation-delay: .08s; }
.im-tile:nth-child(4) { animation-delay: .12s; } .im-tile:nth-child(5) { animation-delay: .16s; } .im-tile:nth-child(6) { animation-delay: .2s; }
.im-tile:hover { transform: translateY(-3px); box-shadow: var(--im-shadow); border-color: var(--tile, var(--im-primary)); color: var(--im-text); }
.im-tile:active { transform: scale(.98); }
.im-tile::after { content: ""; position: absolute; inset: auto -30% -60% auto; width: 60%; aspect-ratio: 1; border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--tile, var(--im-primary)) 25%, transparent), transparent 70%); }
.im-tile .ico { width: 58px; height: 58px; flex: none; border-radius: 16px; display: grid; place-items: center; font-size: 1.7rem;
  background: color-mix(in srgb, var(--tile, var(--im-primary)) 18%, transparent); color: var(--tile, var(--im-primary)); }
.im-tile h2 { font-size: 1.25rem; font-weight: 800; margin: 0; letter-spacing: .02em; }
.im-tile p { margin: .15rem 0 0; color: var(--im-text-muted); font-size: .88rem; }
.im-tile .count { position: absolute; top: .8rem; right: .9rem; }

/* ---------- Écran commandes ---------- */
.im-cmd { display: grid; gap: .75rem; grid-template-columns: 1fr; }
@media (min-width: 992px) { .im-cmd { grid-template-columns: 1fr 420px; height: calc(100dvh - var(--im-topbar) - 2rem); } }
.im-panel { background: var(--im-surface); border: 1px solid var(--im-border); border-radius: calc(var(--im-radius) + 4px); padding: .75rem; min-height: 0; }
.im-panel-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-bottom: .6rem; }
.im-panel-head h3 { font-size: 1rem; font-weight: 800; margin: 0; text-transform: uppercase; letter-spacing: .06em; color: var(--im-text-muted); }
.im-orders { display: grid; gap: .5rem; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); overflow: auto; align-content: start; max-height: 100%; }
.im-order {
  position: relative; text-align: left; padding: .7rem .8rem; border-radius: var(--im-radius); min-height: 92px;
  background: var(--im-surface-2); border: 1px solid var(--im-border); color: var(--im-text);
  transition: transform .15s var(--im-ease), border-color .15s; animation: im-pop .3s var(--im-ease) both;
}
.im-order:hover { border-color: var(--im-primary); }
.im-order:active { transform: scale(.96); }
.im-order .tbl { font-size: 1.4rem; font-weight: 900; line-height: 1; }
.im-order .meta { font-size: .78rem; color: var(--im-text-muted); }
.im-order .amt { position: absolute; right: .7rem; bottom: .6rem; font-weight: 800; color: var(--im-primary); font-variant-numeric: tabular-nums; }
.im-order.is-note { border-color: var(--im-warning); box-shadow: inset 4px 0 0 var(--im-warning); }
.im-order.is-emp { box-shadow: inset 4px 0 0 var(--im-secondary); }
.im-order.is-liv { box-shadow: inset 4px 0 0 var(--im-c2); }
@keyframes im-pop { from { opacity: 0; transform: scale(.92); } to { opacity: 1; transform: none; } }
.im-empty { text-align: center; color: var(--im-text-muted); padding: 2.5rem 1rem; }
.im-empty i { font-size: 2.4rem; display: block; margin-bottom: .5rem; opacity: .5; }

.im-display { background: var(--im-bg); border: 1px solid var(--im-border); border-radius: var(--im-radius); padding: .6rem .9rem; }
.im-display .lbl { font-size: .75rem; color: var(--im-text-muted); text-transform: uppercase; letter-spacing: .08em; }
.im-display .val { font-size: 2rem; font-weight: 900; font-variant-numeric: tabular-nums; color: var(--im-primary); min-height: 2.6rem; }
.im-display.is-active { border-color: var(--im-primary); }

/* ---------- Pavé numérique ---------- */
.im-pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: .45rem; }
.im-pad.cols-4 { grid-template-columns: repeat(4, 1fr); }
.im-key {
  min-height: 58px; border-radius: var(--im-radius); border: 1px solid var(--im-border);
  background: var(--im-surface-2); color: var(--im-text); font-size: 1.45rem; font-weight: 800;
  transition: transform .07s var(--im-ease), background-color .12s; user-select: none;
}
.im-key:active, .im-key.is-down { transform: scale(.93); background: color-mix(in srgb, var(--im-surface-2) 70%, var(--im-text)); }
.im-key.k-ok { background: var(--im-success); border-color: var(--im-success); color: #fff; }
.im-key.k-del { color: var(--im-danger); }
.im-key.k-letter { color: var(--im-primary); }
.im-key.k-sm { font-size: 1rem; }

.im-actions { display: grid; grid-template-columns: repeat(2, 1fr); gap: .45rem; }
.im-action {
  display: flex; align-items: center; gap: .55rem; min-height: 56px; padding: .5rem .75rem; text-align: left;
  border-radius: var(--im-radius); border: 1px solid var(--im-border); background: var(--im-surface-2); color: var(--im-text);
  font-weight: 700; font-size: .92rem; line-height: 1.1; text-decoration: none; transition: transform .08s var(--im-ease), filter .15s;
}
.im-action:hover { color: var(--im-text); }
.im-action i { font-size: 1.35rem; color: var(--a, var(--im-primary)); }
.im-action small { display: block; font-weight: 500; color: var(--im-text-muted); font-size: .72rem; }
.im-action:active { transform: scale(.96); }
.im-action:hover { filter: brightness(1.12); }
.im-action.solid { background: var(--a); border-color: var(--a); color: #fff; }
.im-action.solid i, .im-action.solid small { color: #fff; }

/* ---------- Écran de saisie (POS) ---------- */
.im-pos { display: grid; height: 100%; gap: .5rem; grid-template-columns: 1fr; grid-template-rows: auto 1fr auto; }
@media (min-width: 992px) {
  .im-pos { grid-template-columns: minmax(360px, 42%) 1fr; grid-template-rows: 1fr; }
}
.im-ticket { display: flex; flex-direction: column; min-height: 0; }
.im-ticket-head { display: flex; align-items: center; gap: .5rem; padding: .25rem .25rem .5rem; }
.im-ticket-head .tbl { font-size: 1.5rem; font-weight: 900; cursor: pointer; }
.im-ticket-head .tbl small { display: block; font-size: .7rem; font-weight: 500; color: var(--im-text-muted); }
.im-cv { display: flex; align-items: center; gap: .3rem; margin-left: auto; }
.im-cv .n { min-width: 2.2rem; text-align: center; font-size: 1.3rem; font-weight: 800; }
.im-lines { flex: 1; overflow: auto; border-radius: var(--im-radius); background: var(--im-bg); border: 1px solid var(--im-border); min-height: 160px; }
.im-line {
  display: grid; grid-template-columns: 3.2rem 2.6rem 1fr auto; align-items: center; gap: .35rem;
  padding: .55rem .6rem; border-bottom: 1px solid var(--im-border); cursor: pointer; user-select: none;
  animation: im-line-in .25s var(--im-ease) both; transition: background-color .12s;
}
.im-line:hover { background: color-mix(in srgb, var(--im-surface-2) 60%, transparent); }
.im-line.is-sel { background: color-mix(in srgb, var(--im-primary) 16%, transparent); box-shadow: inset 3px 0 0 var(--im-primary); }
.im-line .code { font-size: .72rem; color: var(--im-text-muted); font-variant-numeric: tabular-nums; }
.im-line .qte { font-weight: 900; font-size: 1.1rem; text-align: center; }
.im-line .lib { font-weight: 600; min-width: 0; }
.im-line .lib small { display: block; color: var(--im-text-muted); font-weight: 500; font-size: .74rem; }
.im-line .tot { font-weight: 800; font-variant-numeric: tabular-nums; text-align: right; }
.im-line .tot small { display: block; font-size: .7rem; color: var(--im-text-muted); font-weight: 500; }
.im-line.is-off .tot { color: var(--im-success); }
.im-line.is-sent .lib::before { content: "\F26E"; font-family: bootstrap-icons; color: var(--im-success); margin-right: .3rem; font-size: .8rem; }
.im-line.is-follow .lib::after { content: "à suivre"; margin-left: .4rem; font-size: .65rem; padding: .05rem .35rem; border-radius: 6px;
  background: var(--im-warning); color: #111; font-weight: 700; vertical-align: middle; }
.im-line.flash { animation: im-flash .6s var(--im-ease); }
@keyframes im-line-in { from { opacity: 0; transform: translateX(-10px); } to { opacity: 1; transform: none; } }
@keyframes im-flash { 0% { background: color-mix(in srgb, var(--im-primary) 35%, transparent); } 100% { background: transparent; } }

.im-total { display: flex; align-items: center; gap: .75rem; margin-top: .5rem; padding: .6rem .9rem; border-radius: var(--im-radius);
  background: linear-gradient(135deg, var(--im-surface-2), var(--im-surface)); border: 1px solid var(--im-border); }
.im-total .amt { font-size: 2rem; font-weight: 900; color: var(--im-primary); font-variant-numeric: tabular-nums; line-height: 1; }
.im-total .amt.bump { animation: im-bump .35s var(--im-ease); }
@keyframes im-bump { 40% { transform: scale(1.08); } }
.im-total .sub { color: var(--im-text-muted); font-size: .8rem; }
.im-mult { margin-left: auto; font-weight: 800; padding: .3rem .6rem; border-radius: 10px; background: var(--im-primary); color: #111; display: none; }
.im-mult.on { display: inline-block; animation: im-pop .2s var(--im-ease); }

.im-tools { display: grid; grid-template-columns: repeat(4, 1fr); gap: .4rem; margin-top: .5rem; }
.im-tools .im-action { min-height: 52px; font-size: .8rem; flex-direction: column; justify-content: center; text-align: center; gap: .15rem; padding: .35rem; }
.im-tools .im-action i { font-size: 1.15rem; }
.im-tools .span-2 { grid-column: span 2; }

/* Catalogue */
.im-cat { display: grid; grid-template-columns: 128px 1fr; gap: .5rem; min-height: 0; }
.im-fams { display: flex; flex-direction: column; gap: .35rem; overflow: auto; }
.im-fam {
  flex: none; min-height: 54px; padding: .4rem .5rem; border-radius: var(--im-radius); border: 1px solid var(--im-border);
  background: var(--im-surface-2); color: var(--im-text); font-weight: 800; font-size: .85rem; line-height: 1.1;
  transition: all .15s var(--im-ease); position: relative; overflow: hidden;
}
.im-fam.active { background: var(--im-primary); color: #111; border-color: var(--im-primary); transform: translateX(3px); }
.im-arts { display: grid; gap: .45rem; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); grid-auto-rows: 84px;
  overflow: auto; align-content: start; padding-right: .15rem; }
.im-art {
  position: relative; display: flex; flex-direction: column; justify-content: space-between; text-align: left;
  padding: .45rem .55rem; border-radius: var(--im-radius); border: 0; color: #fff; overflow: hidden;
  background: linear-gradient(160deg, color-mix(in srgb, var(--c, var(--im-c0)) 100%, #fff 8%), color-mix(in srgb, var(--c, var(--im-c0)) 75%, #000));
  box-shadow: inset 0 1px 0 rgb(255 255 255 / .15), 0 2px 6px rgb(0 0 0 / .25);
  transition: transform .08s var(--im-ease), filter .15s; animation: im-pop .25s var(--im-ease) both;
}
.im-art:hover { filter: brightness(1.1); }
.im-art:active, .im-art.hit { transform: scale(.94); }
.im-art .top { display: flex; justify-content: space-between; font-size: .72rem; font-weight: 700; opacity: .9; font-variant-numeric: tabular-nums; }
.im-art .name { font-weight: 800; font-size: .88rem; line-height: 1.1; text-shadow: 0 1px 2px rgb(0 0 0 / .35);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.im-art .ripple { position: absolute; border-radius: 50%; transform: scale(0); background: rgb(255 255 255 / .45); animation: im-ripple .5s ease-out; pointer-events: none; }
@keyframes im-ripple { to { transform: scale(4); opacity: 0; } }
.im-fly { position: fixed; z-index: 2000; pointer-events: none; padding: .3rem .6rem; border-radius: 10px; background: var(--im-primary);
  color: #111; font-weight: 800; transition: transform .45s var(--im-ease), opacity .45s; }
.im-search { display: flex; gap: .4rem; margin-bottom: .5rem; }
.im-search .form-control { font-size: 1.1rem; font-weight: 700; }

/* Mobile : catalogue sous le ticket, onglets */
@media (max-width: 991px) {
  body.is-pos .im-main { height: auto; overflow: visible; }
  .im-pos { height: auto; }
  .im-lines { max-height: 38vh; }
  .im-cat { grid-template-columns: 1fr; }
  .im-fams { flex-direction: row; overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: .25rem; }
  .im-fam { min-width: 110px; scroll-snap-align: start; }
  .im-fam.active { transform: translateY(-2px); }
  .im-arts { grid-auto-rows: 78px; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); max-height: none; overflow: visible; }
  .im-tools { grid-template-columns: repeat(4, 1fr); }
  .im-pos-bar { position: sticky; bottom: 0; z-index: 20; background: var(--im-bg); padding: .4rem 0; }
}
@media (min-width: 992px) { .im-pos-bar { display: contents; } .im-mbar { display: none !important; } }
.im-mbar { position: fixed; left: .5rem; right: .5rem; bottom: calc(.5rem + env(safe-area-inset-bottom)); z-index: 1040;
  display: flex; align-items: center; gap: .6rem; padding: .5rem; border-radius: calc(var(--im-radius) + 4px);
  background: color-mix(in srgb, var(--im-surface) 92%, transparent); backdrop-filter: blur(12px);
  border: 1px solid var(--im-border); box-shadow: var(--im-shadow); transform: translateY(150%); transition: transform .3s var(--im-ease); }
.im-mbar.on { transform: none; }
.im-mbar .amt { flex: 1; text-align: center; font-size: 1.4rem; font-weight: 900; color: var(--im-primary); font-variant-numeric: tabular-nums; }
@media (max-width: 991px) { body.is-pos .im-main { padding-bottom: 5.5rem; } }

/* Encaissement */
.im-pay-modes { display: grid; grid-template-columns: repeat(2, 1fr); gap: .45rem; }
.im-pay-mode { min-height: 60px; border-radius: var(--im-radius); border: 1px solid var(--im-border); background: var(--im-surface-2);
  color: var(--im-text); font-weight: 800; display: flex; align-items: center; gap: .5rem; padding: .5rem .8rem; }
.im-pay-mode i { font-size: 1.4rem; color: var(--im-primary); }
.im-pay-mode:active, .im-pay-mode.is-down { transform: scale(.96); }
.im-kbd { background: var(--im-bg); color: var(--im-text-muted); border: 1px solid var(--im-border); border-radius: 6px;
  font: 700 .72rem/1 ui-monospace, monospace; padding: .25rem .4rem; box-shadow: 0 2px 0 var(--im-border); }
@media (hover: none) { .im-pay-mode .im-kbd { display: none; } }
.modal-content:focus { outline: none; }
.im-pay-due { font-size: 2.4rem; font-weight: 900; font-variant-numeric: tabular-nums; line-height: 1; }
.im-pay-list .item { display: flex; justify-content: space-between; align-items: center; padding: .45rem .6rem; border-radius: 10px;
  background: var(--im-surface-2); margin-bottom: .35rem; animation: im-line-in .25s var(--im-ease) both; }
.im-success-check { width: 96px; height: 96px; border-radius: 50%; margin: 0 auto 1rem; display: grid; place-items: center;
  background: var(--im-success); color: #fff; font-size: 3rem; animation: im-check .5s var(--im-ease) both; }
@keyframes im-check { 0% { transform: scale(0) rotate(-45deg); } 70% { transform: scale(1.1); } 100% { transform: none; } }

/* ---------- Pages de gestion ---------- */
.im-page-head { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; margin-bottom: 1rem; }
.im-page-head h1 { font-size: 1.5rem; font-weight: 900; margin: 0; }
.im-kpis { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); margin-bottom: 1rem; }
.im-kpi { background: var(--im-surface); border: 1px solid var(--im-border); border-radius: var(--im-radius); padding: .85rem 1rem; animation: im-pop .3s var(--im-ease) both; }
.im-kpi .lbl { color: var(--im-text-muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; }
.im-kpi .val { font-size: 1.55rem; font-weight: 900; font-variant-numeric: tabular-nums; }
.im-kpi.accent .val { color: var(--im-primary); }
.im-table-wrap { background: var(--im-surface); border: 1px solid var(--im-border); border-radius: var(--im-radius); overflow: auto; }
.im-table-wrap .table { margin: 0; }
.im-table-wrap th { position: sticky; top: 0; background: var(--im-surface); color: var(--im-text-muted); font-size: .75rem;
  text-transform: uppercase; letter-spacing: .05em; z-index: 1; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .78rem; }
.im-status { display: inline-flex; align-items: center; gap: .35rem; font-weight: 700; }
.im-status.ok { color: var(--im-success); } .im-status.ko { color: var(--im-danger); }
.im-chain { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.im-chain .card { border-radius: var(--im-radius); }
.im-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; background: var(--im-text-muted); }
.im-dot.ok { background: var(--im-success); box-shadow: 0 0 0 4px color-mix(in srgb, var(--im-success) 25%, transparent); }
.im-dot.ko { background: var(--im-danger); box-shadow: 0 0 0 4px color-mix(in srgb, var(--im-danger) 25%, transparent); }
.im-swatch { width: 100%; height: 46px; padding: 3px; border-radius: 10px; border: 1px solid var(--im-border); background: var(--im-surface-2); cursor: pointer; }

/* ---------- Authentification ---------- */
.im-auth { min-height: 100dvh; display: grid; place-items: center; padding: 1.5rem;
  background: radial-gradient(1200px 600px at 10% -10%, color-mix(in srgb, var(--im-primary) 14%, transparent), transparent),
              radial-gradient(900px 500px at 110% 110%, color-mix(in srgb, var(--im-secondary) 16%, transparent), transparent), var(--im-bg); }
.im-auth-card { width: 100%; max-width: 440px; background: var(--im-surface); border: 1px solid var(--im-border);
  border-radius: calc(var(--im-radius) + 8px); padding: 2rem; box-shadow: var(--im-shadow); animation: im-in .45s var(--im-ease) both; }
.im-auth-card.wide { max-width: 760px; }
.im-auth-logo { display: flex; align-items: center; gap: .6rem; margin-bottom: 1.5rem; }
.im-auth-logo .im-brand-mark { width: 46px; height: 46px; font-size: 1.3rem; }
.im-auth-logo b { font-size: 1.4rem; letter-spacing: .03em; }
.im-pin-users { display: grid; gap: .6rem; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
.im-pin-user { padding: 1rem .5rem; border-radius: var(--im-radius); background: var(--im-surface-2); border: 2px solid transparent;
  color: var(--im-text); font-weight: 700; transition: all .15s var(--im-ease); }
.im-pin-user .im-avatar { width: 52px; height: 52px; margin: 0 auto .4rem; font-size: 1.2rem; background: var(--im-bg); }
.im-pin-user.active { border-color: var(--im-primary); transform: translateY(-2px); }
.im-pin-dots { display: flex; justify-content: center; gap: .8rem; margin: 1rem 0; }
.im-pin-dots span { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--im-text-muted); transition: all .15s; }
.im-pin-dots span.on { background: var(--im-primary); border-color: var(--im-primary); transform: scale(1.15); }
.im-shake { animation: im-shake .4s; }
@keyframes im-shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }

/* ---------- Toasts ---------- */
.im-toasts { position: fixed; z-index: 3000; right: 1rem; bottom: 1rem; display: flex; flex-direction: column; gap: .5rem; max-width: min(420px, calc(100vw - 2rem)); }
.im-toast { display: flex; gap: .6rem; align-items: flex-start; padding: .8rem 1rem; border-radius: var(--im-radius);
  background: var(--im-surface); border: 1px solid var(--im-border); box-shadow: var(--im-shadow); border-left: 4px solid var(--t, var(--im-secondary));
  animation: im-toast-in .35s var(--im-ease) both; }
.im-toast.out { animation: im-toast-out .3s var(--im-ease) forwards; }
.im-toast i { color: var(--t); font-size: 1.2rem; }
@keyframes im-toast-in { from { opacity: 0; transform: translateX(30px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes im-toast-out { to { opacity: 0; transform: translateX(30px); } }

.im-loading { position: fixed; top: 0; left: 0; height: 3px; width: 0; z-index: 4000; background: var(--im-primary); transition: width .3s; }
.im-loading.on { width: 70%; transition: width 2s cubic-bezier(.1, .7, .3, 1); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ==========================================================================
   Écran cuisine (KDS) — lisible à 2 m, gros boutons, couleurs du thème
   ========================================================================== */
body.is-kds .im-main { max-width: none; padding: .6rem; }
.im-kds-bar { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin-bottom: .6rem;
  position: sticky; top: calc(var(--im-topbar) + 0px); z-index: 5; background: var(--im-bg); padding: .3rem 0; }
.im-kds-bar .btn.active { background: var(--im-surface-2); border-color: var(--im-primary); color: var(--im-text); }
.im-dot.ko-orange { background: var(--im-warning); }
.im-kds-grid { display: grid; gap: .7rem; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); align-items: start; }
.im-kds-empty { grid-column: 1 / -1; padding: 5rem 1rem; font-size: 1.2rem; }
.im-kds-card { --k: var(--im-warning); display: flex; flex-direction: column; border-radius: calc(var(--im-radius) + 2px); overflow: hidden;
  background: var(--im-surface); border: 2px solid color-mix(in srgb, var(--k) 70%, transparent);
  box-shadow: 0 6px 18px rgb(0 0 0 / .25); animation: im-pop .3s var(--im-ease) both; transition: border-color .3s; }
.im-kds-card.is-done { --k: var(--im-success); }
.im-kds-card.is-late { --k: var(--im-danger); animation: im-pop .3s var(--im-ease) both, im-kds-late 1.6s ease-in-out infinite; }
@keyframes im-kds-late { 50% { box-shadow: 0 0 0 4px color-mix(in srgb, var(--im-danger) 45%, transparent); } }
.im-kds-card.leaving { animation: im-kds-out .6s var(--im-ease) forwards; }
@keyframes im-kds-out { to { opacity: 0; transform: scale(.92) translateY(-8px); } }
.im-kds-card header { display: grid; grid-template-columns: 1fr auto; gap: 0 .5rem; padding: .55rem .75rem;
  background: var(--k); color: #111; transition: background-color .3s; }
.im-kds-card header .ttl { font-size: 1.35rem; font-weight: 900; line-height: 1.1; }
.im-kds-card header .meta { grid-column: 1; font-size: .8rem; font-weight: 600; opacity: .8; }
.im-kds-card header .timer { grid-row: 1 / span 2; grid-column: 2; align-self: center; font-size: 1.15rem; font-weight: 900;
  font-variant-numeric: tabular-nums; background: rgb(0 0 0 / .14); border-radius: 10px; padding: .2rem .5rem; }
.im-kds-card.is-late header { color: #fff; }
.im-kds-card .bar { height: 5px; background: var(--im-surface-2); }
.im-kds-card .bar span { display: block; height: 100%; background: var(--im-success); transition: width .35s var(--im-ease); }
.im-kds-card .items { display: flex; flex-direction: column; padding: .35rem; gap: .3rem; }
.im-kds-item { display: grid; grid-template-columns: 2.4rem 1fr 1.8rem; align-items: center; gap: .4rem; text-align: left;
  min-height: 54px; padding: .4rem .5rem; border-radius: var(--im-radius); border: 1px solid var(--im-border);
  background: var(--im-surface-2); color: var(--im-text); transition: background-color .2s, transform .08s var(--im-ease), opacity .2s; }
.im-kds-item:active { transform: scale(.97); }
.im-kds-item .q { font-size: 1.5rem; font-weight: 900; text-align: center; color: var(--im-warning); }
.im-kds-item .t { font-size: 1.08rem; font-weight: 700; line-height: 1.15; min-width: 0; }
.im-kds-item .t small { display: block; margin-top: .15rem; font-size: .85rem; font-weight: 700; color: var(--im-primary); font-style: italic; }
.im-kds-item .c { font-size: 1.4rem; color: var(--im-text-muted); text-align: center; }
.im-kds-item.done { background: color-mix(in srgb, var(--im-success) 18%, var(--im-surface)); border-color: color-mix(in srgb, var(--im-success) 45%, transparent); }
.im-kds-item.done .t { text-decoration: line-through; opacity: .65; }
.im-kds-item.done .q { color: var(--im-success); opacity: .7; }
.im-kds-item.done .c { color: var(--im-success); animation: im-check .35s var(--im-ease); }
.im-kds-item.new { border-color: var(--im-warning); animation: im-kds-new 1.2s ease-in-out 4; }
.im-kds-item.new .t::after { content: "NOUVEAU"; margin-left: .4rem; font-size: .62rem; font-weight: 900; padding: .1rem .35rem;
  border-radius: 6px; background: var(--im-warning); color: #111; vertical-align: middle; font-style: normal; }
@keyframes im-kds-new { 50% { background: color-mix(in srgb, var(--im-warning) 22%, var(--im-surface-2)); } }
.im-kds-sep { font-size: .72rem; font-weight: 700; color: var(--im-text-muted); text-transform: uppercase; letter-spacing: .06em;
  padding: .2rem .3rem 0; border-top: 1px dashed var(--im-border); margin-top: .15rem; }
.im-kds-card footer { display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding: .45rem .5rem .55rem; }
.im-kds-card footer .suivre { font-size: .85rem; font-weight: 700; color: var(--im-warning); }
.im-kds-card footer .btn { min-height: 48px; }
@media (max-width: 575px) { .im-kds-grid { grid-template-columns: 1fr; } }

/* Retour cuisine côté salle */
.im-order .kds { position: absolute; top: .55rem; right: .6rem; font-size: .7rem; font-weight: 800; padding: .1rem .4rem; border-radius: 6px;
  background: color-mix(in srgb, var(--im-warning) 25%, transparent); color: var(--im-warning); }
.im-order .kds.ok { background: var(--im-success); color: #fff; animation: im-pop .3s var(--im-ease); }
.im-line.is-ready .lib::before { content: "\F26B"; font-family: bootstrap-icons; color: var(--im-success); margin-right: .3rem; font-size: .8rem; }

/* Filtres par serveur + attribution des commandes */
.im-srv-filters { display: flex; gap: .4rem; overflow-x: auto; padding-bottom: .5rem; margin-bottom: .1rem; scrollbar-width: thin; }
.im-srv-chip { flex: none; display: inline-flex; align-items: center; gap: .35rem; min-height: 40px; padding: .3rem .75rem; border-radius: 999px;
  border: 1px solid var(--im-border); background: var(--im-surface-2); color: var(--im-text); font-weight: 700; font-size: .85rem; white-space: nowrap; }
.im-srv-chip b { background: var(--im-bg); border-radius: 999px; padding: 0 .45rem; font-size: .75rem; }
.im-srv-chip span { color: var(--im-text-muted); font-weight: 600; font-variant-numeric: tabular-nums; }
.im-srv-chip.active { background: var(--im-primary); border-color: var(--im-primary); color: #111; }
.im-srv-chip.active b { background: rgb(0 0 0 / .15); } .im-srv-chip.active span { color: #111; }
.im-order .srv { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; font-size: .6rem; font-weight: 900;
  background: var(--im-bg); color: var(--im-text); border: 1px solid var(--im-border); vertical-align: -4px; }
.im-order.is-mine .srv { background: var(--im-primary); color: #111; border-color: var(--im-primary); }
.im-srv.can { cursor: pointer; text-decoration: underline dotted; color: var(--im-primary); }

/* Onglets « En cours / Réglées » */
.im-seg { display: inline-flex; padding: 3px; border-radius: 12px; background: var(--im-surface-2); border: 1px solid var(--im-border); gap: 2px; }
.im-seg button { border: 0; background: transparent; color: var(--im-text-muted); font-weight: 800; font-size: .85rem; padding: .4rem .8rem;
  border-radius: 9px; min-height: 38px; display: inline-flex; align-items: center; gap: .35rem; transition: background .2s var(--im-ease), color .2s; }
.im-seg button b { background: var(--im-bg); border-radius: 999px; padding: 0 .45rem; font-size: .72rem; color: var(--im-text); }
.im-seg button.active { background: var(--im-primary); color: #111; }
.im-seg button.active b { background: rgb(0 0 0 / .15); color: #111; }

/* Tuiles des commandes réglées */
.im-order.is-paid { background: var(--im-surface-2); opacity: .92; }
.im-order.is-paid .amt { color: var(--im-text); }
.im-order.is-paid.is-fresh { opacity: 1; box-shadow: inset 4px 0 0 var(--im-success); border-color: color-mix(in srgb, var(--im-success) 55%, var(--im-border)); }
.im-order.is-paid.is-cancel { box-shadow: inset 4px 0 0 var(--im-danger); }
.im-order.is-paid.is-cancel .amt { color: var(--im-danger); }
.im-order.is-paid.is-voided { opacity: .6; }
.im-order.is-paid.is-voided .amt { text-decoration: line-through; }
.im-order .kds.bad { background: color-mix(in srgb, var(--im-danger) 25%, transparent); color: var(--im-danger); }

/* Heure de retrait */
.im-ret { display: inline-flex; align-items: center; gap: .25rem; margin-top: .15rem; font-size: .75rem; font-weight: 800; padding: .05rem .4rem;
  border-radius: 6px; background: color-mix(in srgb, var(--im-secondary) 22%, transparent); color: var(--im-text); width: fit-content;
  max-width: 100%; white-space: nowrap; margin-bottom: 1.35rem; }
.im-ret.soon { background: color-mix(in srgb, var(--im-warning) 30%, transparent); color: var(--im-warning); }
.im-ret.late { background: var(--im-danger); color: #fff; animation: im-blink 1.6s ease-in-out infinite; }
.im-ret.ok { background: color-mix(in srgb, var(--im-success) 25%, transparent); color: var(--im-success); }
@keyframes im-blink { 50% { opacity: .55; } }
.im-ret-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; }
.im-ret-grid .im-ret-q { min-height: 64px; font-weight: 800; display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.1; }
.im-ret-grid .im-ret-q small { font-weight: 600; color: var(--im-text-muted); font-size: .75rem; margin-top: .15rem; }
.im-ret-grid .im-ret-q:first-child { grid-column: 1 / -1; min-height: 52px; flex-direction: row; gap: .4rem; }
.im-pos-retrait { cursor: pointer; }
@media (prefers-reduced-motion: reduce) { .im-ret.late { animation: none; } }

/* KDS : heure de retrait */
.im-kds-ret { display: flex; align-items: center; gap: .35rem; padding: .35rem .75rem; font-size: .95rem; font-weight: 700;
  background: color-mix(in srgb, var(--im-secondary) 18%, transparent); border-bottom: 1px solid var(--im-border); }
.im-kds-ret b { font-size: 1.15rem; font-weight: 900; }
.im-kds-ret.soon { background: color-mix(in srgb, var(--im-warning) 30%, transparent); }
.im-kds-ret.late { background: var(--im-danger); color: #fff; }
.im-kds-card.is-soon { --k: var(--im-warning); }
.im-cmd > .im-panel { min-width: 0; }
.im-cmd .im-panel-head { flex-wrap: wrap; }
@media (max-width: 575px) { .im-seg button { padding: .35rem .6rem; font-size: .8rem; } }

/* Réglées mais encore en cuisine */
.im-seg-flag { display: inline-flex; align-items: center; gap: .15rem; font-size: .72rem; font-weight: 800; padding: 0 .4rem; border-radius: 999px;
  background: var(--im-warning); color: #111; }
.im-seg-flag.late { background: var(--im-danger); color: #fff; animation: im-blink 1.6s ease-in-out infinite; }
.im-seg-flag[hidden] { display: none; }
.im-order.is-paid.is-prep { opacity: 1; background: var(--im-surface); box-shadow: inset 4px 0 0 var(--im-warning);
  border-color: color-mix(in srgb, var(--im-warning) 50%, var(--im-border)); }

/* En-tête de saisie : infos modifiables en vrais boutons tactiles */
.im-head-chips { display: flex; flex-wrap: wrap; gap: .4rem; padding: 0 .25rem .55rem; }
.im-hchip { display: inline-flex; align-items: center; gap: .4rem; min-height: 44px; padding: .35rem .8rem; border-radius: 12px;
  border: 1px solid var(--im-border); background: var(--im-surface-2); color: var(--im-text); font-weight: 700; font-size: .9rem;
  line-height: 1.1; white-space: nowrap; touch-action: manipulation; -webkit-tap-highlight-color: transparent;
  transition: transform .12s var(--im-ease), border-color .15s, background .15s; }
button.im-hchip { cursor: pointer; }
button.im-hchip:hover { border-color: var(--im-primary); }
button.im-hchip:active { transform: scale(.95); background: color-mix(in srgb, var(--im-primary) 18%, var(--im-surface-2)); }
.im-hchip > .bi:first-child { font-size: 1.05rem; color: var(--im-primary); }
.im-hchip .ed { font-size: .8rem; color: var(--im-text-muted); margin-left: .1rem; }
.im-hchip.is-time { border-color: color-mix(in srgb, var(--im-secondary) 55%, var(--im-border)); }
.im-hchip.is-time > .bi:first-child { color: var(--im-secondary); }
.im-hchip.is-static { background: transparent; border-style: dashed; color: var(--im-text-muted); font-weight: 600; }
.im-hchip.is-static > .bi:first-child { color: var(--im-text-muted); }
.im-ticket-head .im-cv .btn { min-width: 44px; min-height: 44px; }
/* Cibles tactiles : les écrans tactiles Windows se déclarent souvent « pointer: fine », on ne s'y fie donc pas */
.im-touch { min-width: 44px; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; padding: .3rem .6rem; }
.btn-sm { min-height: 40px; min-width: 40px; }
.im-srv-chip { min-height: 44px; }
@media (pointer: coarse) { .im-hchip, .im-srv-chip, .im-seg button { min-height: 48px; } }
/* Article sans bon cuisine (boissons…) : servi directement */
