:root {
  --bg: #0a0c12;
  --bg-2: #12151e;
  --panel: rgba(18, 21, 30, 0.82);
  --sheet: var(--panel);
  --stroke: rgba(234, 88, 12, 0.28);
  --text: #f3f4f6;
  --ink: var(--text);
  --muted: #9ca3af;
  --line: rgba(234, 88, 12, 0.22);
  --cyan: #ea580c;
  --amber: #fbbf24;
  --violet: #fb923c;
  --teal: #2f7c8a;
  --gold: #fbbf24;
  --green: #4ade80;
  --blue: #60a5fa;
  --logo: #ea580c;
  --logo-deep: #c2410c;
  --red: #ff6b8a;
  --orange: #fb923c;
  --danger: #ff6b8a;
  --ok: #4ade80;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
  --top-bg: rgba(10, 12, 18, 0.86);
  --input-bg: #141824;
  --orbit-line: rgba(234, 88, 12, 0.05);
  --font: "Sora", "IBM Plex Sans", system-ui, sans-serif;
  --display: "Orbitron", "Sora", sans-serif;
  --top: 56px;
  --sidebar-w: 15.5rem;
}
html[data-theme="light"] {
  --bg: #f7f5f2;
  --bg-2: #efeae4;
  --panel: #ffffff;
  --sheet: #ffffff;
  --stroke: rgba(194, 65, 12, 0.16);
  --text: #1c1917;
  --ink: #1c1917;
  --muted: #57534e;
  --line: rgba(194, 65, 12, 0.18);
  --cyan: #c2410c;
  --amber: #b45309;
  --violet: #ea580c;
  --green: #15803d;
  --blue: #2563eb;
  --logo: #c2410c;
  --logo-deep: #9a3412;
  --red: #be123c;
  --orange: #ea580c;
  --danger: #be123c;
  --ok: #15803d;
  --shadow: 0 10px 28px rgba(28, 25, 23, 0.08);
  --top-bg: #ffffff;
  --input-bg: #ffffff;
  --orbit-line: transparent;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
html { overflow-x: hidden; }
body {
  font-family: var(--font);
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(234, 88, 12, 0.18), transparent 50%),
    radial-gradient(900px 500px at 110% 0%, rgba(251, 146, 60, 0.10), transparent 45%),
    var(--bg);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.45;
  overflow-x: hidden;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--cyan); text-decoration: none; }
a:hover { text-decoration: underline; }
.boot { padding: 40px; color: var(--muted); }

.orbit {
  pointer-events: none;
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(var(--orbit-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--orbit-line) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(circle at 50% 20%, #000 20%, transparent 75%);
  z-index: 0;
}

.app-shell { min-height: 100vh; position: relative; z-index: 1; }
.sidebar {
  width: var(--sidebar-w);
  background:
    linear-gradient(180deg, rgba(180, 36, 36, 0.22), transparent 42%),
    #1a0c0e;
  color: #f3e8e0;
  display: flex;
  flex-direction: column;
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 40;
  border-right: 1px solid rgba(220, 60, 60, 0.38);
}
.sidebar-brand {
  display: flex;
  align-items: flex-start;
  gap: 0.4rem;
  padding: 1rem 0.85rem 0.9rem;
  border-bottom: 1px solid rgba(234, 88, 12, 0.28);
}
.sidebar .brand {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  min-width: 0;
  flex: 1;
  color: inherit;
  text-decoration: none;
}
.sidebar .brand:hover { text-decoration: none; }
.brand__mark {
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 0.7rem;
  display: grid;
  place-items: center;
  overflow: hidden;
  flex: none;
  background: rgba(255, 255, 255, 0.06);
}
.brand__mark img,
.sidebar-brand-mark {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block !important;
}
.brand__text {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
  line-height: 1.1;
}
.sidebar-brand-word {
  display: block !important;
  width: auto;
  height: 1.15rem;
  max-width: 9.5rem;
  object-fit: contain;
  object-position: left center;
}
.brand__text em { font-style: normal; color: #c4b5a8; font-size: 0.72rem; }
/* Menu toujours foncé : ne jamais laisser delta-theme masquer le logo sidebar */
html[data-theme="light"] .sidebar .sidebar-brand-mark,
html[data-theme="light"] .sidebar .sidebar-brand-word,
html[data-theme="dark"] .sidebar .sidebar-brand-mark,
html[data-theme="dark"] .sidebar .sidebar-brand-word,
html:not([data-theme]) .sidebar .sidebar-brand-mark,
html:not([data-theme]) .sidebar .sidebar-brand-word {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
}
.sidebar-close,
.sidebar-open {
  display: none;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  border-radius: 0.35rem;
  padding: 0.25rem;
}
.sidebar-close:hover,
.sidebar-open:hover { background: #2a160c; color: #fff; }
.sidebar-nav {
  flex: 1;
  overflow: auto;
  padding: 0.45rem 0 1rem;
}
.side-label {
  margin: 0.85rem 1.15rem 0.25rem;
  font-size: 0.62rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #a89080;
}
/* Spécificité > html[data-theme="light"] a (delta-theme) pour éviter le bleu des liens. */
html body .sidebar button.side-link,
html body .sidebar a.side-link,
html body .sidebar a.side-link:link,
html body .sidebar a.side-link:visited,
html body .sidebar a.side-link:hover,
html body .sidebar a.side-link:active {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  width: 100%;
  padding: 0.55rem 1.05rem;
  color: #f3e8e0;
  text-decoration: none;
  border: 0;
  border-left: 2px solid transparent;
  background: transparent;
  text-align: left;
  font: inherit;
  cursor: pointer;
}
html body .sidebar .side-link:hover {
  background: #2a160c;
  color: #fff;
  text-decoration: none;
}
html body .sidebar .side-link.is-active {
  background: #2a160c;
  color: #fff;
  border-left-color: #ea580c;
}
html body .sidebar .side-link__ico {
  display: grid;
  place-items: center;
  width: 1.15rem;
  height: 1.15rem;
  flex: 0 0 auto;
  color: #fb923c;
}
html body .sidebar .side-link.is-active .side-link__ico,
html body .sidebar .side-link:hover .side-link__ico { color: #fdba74; }
.side-link__ico svg,
.side-link .menu-ico { width: 1.05rem; height: 1.05rem; display: block; }
.side-link-text { min-width: 0; display: flex; flex-direction: column; }
.side-link-label { font-size: 0.875rem; font-weight: 500; color: inherit; }
html body .sidebar .side-link-sub {
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #a89080;
}
.app-main {
  margin-left: var(--sidebar-w);
  min-width: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.app-top {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.55rem 1rem;
  background: var(--top-bg);
  backdrop-filter: blur(12px);
}
.app-kicker {
  font-size: 0.68rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}
.app-rule { height: 0; border-top: 1px solid var(--stroke); }
.who {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
}
.who .who-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  border: 0;
  background: transparent;
  padding: 0.2rem 0.35rem 0.2rem 0.2rem;
  border-radius: 999px;
  cursor: pointer;
  color: inherit;
  font: inherit;
  min-width: 0;
}
.who .who-btn:hover {
  background: rgba(234, 88, 12, 0.1);
}
html[data-theme="light"] .who .who-btn:hover {
  background: rgba(194, 65, 12, 0.08);
}
.km-modal-actions a.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}
.km-logout-dialog {
  border: 1px solid var(--stroke);
  border-radius: 0.85rem;
  padding: 0;
  background: var(--bg-2);
  color: var(--ink);
  max-width: min(22rem, calc(100vw - 2rem));
}
.km-logout-dialog::backdrop { background: rgba(10, 12, 18, 0.55); }
.km-logout-box { margin: 0; padding: 1rem 1.1rem 1.05rem; }
.km-logout-box h2 { margin: 0 0 0.45rem; font-size: 1.05rem; }
.km-logout-box p { margin: 0 0 0.9rem; color: var(--muted); }
.km-logout-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; justify-content: flex-end; }
.km-logout-actions a.btn { display: inline-flex; align-items: center; text-decoration: none; }

/* Mode pages PHP : #app est déjà le stage */
body.kommandia-app #app.stage { display: block; }
body.kommandia-app #app.stage > .subnav { margin: -0.25rem -0.25rem 0.75rem; }
.who__avatar,
.avatar {
  width: 2.15rem;
  height: 2.15rem;
  border-radius: 50%;
  background: linear-gradient(180deg, #fb923c, #ea580c);
  color: #fff;
  display: grid;
  place-items: center;
  font-family: var(--display);
  font-weight: 700;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  flex: none;
  box-shadow: 0 0 0 2px rgba(234, 88, 12, 0.35);
}
.who__meta,
.id-text { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.who__name,
.id-text strong { font-size: 0.88rem; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who__role,
.id-text span { font-size: 0.72rem; color: var(--muted); }
.who__out {
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border-radius: 999px;
  color: var(--muted);
  flex: none;
}
.who__out:hover { color: var(--danger); background: rgba(255, 107, 138, 0.12); text-decoration: none; }
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(16, 12, 9, 0.62);
  z-index: 30;
}
.sidebar-backdrop.is-open { display: block; }

.brand { display: flex; align-items: center; gap: 10px; }
.brand img { display: block; height: auto; }

.page.stage { width: calc(100% - 2rem); max-width: none; margin: 1.5rem 1rem 3rem; padding: 0; }
.page-home { margin-top: 0.75rem; }
.home { max-width: 920px; margin: 12px auto 48px; }
.home-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.home-card {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 16px;
  text-align: left;
  background: var(--panel);
  border: 1px solid var(--stroke);
  border-radius: 12px;
  padding: 18px 20px;
  min-height: 96px;
  box-shadow: var(--shadow);
  color: var(--ink);
}
.home-ico {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: rgba(234, 88, 12, 0.14);
  color: var(--violet);
  display: grid;
  place-items: center;
  flex: none;
}
.home-copy { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.home-card strong { font-size: 17px; font-weight: 650; }
.home-copy span { color: var(--muted); font-size: 13px; line-height: 1.4; }
.home-card:hover { border-color: rgba(234, 88, 12, 0.55); }
.home-more { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 26px; }
@media (max-width: 720px) {
  .home-grid { grid-template-columns: 1fr; }
}
.home-more button { background: none; border: 0; padding: 4px 0; color: var(--muted); }
.home-more button:hover { color: var(--ink); }

.gate-body {
  min-height: 100%;
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(234, 88, 12, 0.18), transparent 50%),
    radial-gradient(900px 500px at 110% 0%, rgba(251, 146, 60, 0.10), transparent 45%),
    var(--bg);
  color: var(--ink);
}
.gate-stage {
  min-height: 100vh;
  display: grid;
  place-items: center;
  position: relative;
  padding: 32px 16px;
}
.gate-box { width: min(440px, calc(100vw - 48px)); z-index: 1; }
.gate-box[hidden] { display: none; }
.gate-box.is-pinned { position: fixed; margin: 0; }
.gate-box .km-modal-header { cursor: grab; }
.gate-box.is-max .km-modal-header,
.gate-box.is-min .km-modal-header { cursor: default; }
.gate-brand { margin: 4px 0 8px; }
.gate-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 28px 28px 26px;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}
.gate-form p { margin: 0; color: var(--muted); line-height: 1.45; }
.gate-form .fld { gap: 6px; font-size: 12px; }
.gate-form .fld input {
  min-width: 0;
  padding: 10px 12px;
  border-radius: 8px;
}
.pass-wrap { position: relative; display: block; }
.pass-wrap input { width: 100%; padding-right: 40px; }
.pass-eye {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  border: 0;
  background: transparent;
  color: #6b6558;
  padding: 4px;
  display: flex;
  border-radius: 6px;
}
.pass-eye:hover { color: var(--ink); background: #f4f1e6; }
.pass-eye .eye-off { display: none; }
.pass-eye.is-on .eye-on { display: none; }
.pass-eye.is-on .eye-off { display: block; }
.gate-form .btn { align-self: flex-start; margin-top: 6px; padding: 10px 18px; }
.gate-error { color: var(--red); }
.gate-box.is-max {
  width: min(720px, calc(100vw - 32px));
  height: min(640px, calc(100vh - 32px));
  max-height: none;
}
.gate-box.is-min {
  position: fixed;
  left: 18px;
  bottom: 18px;
  width: auto;
  height: auto;
  max-height: none;
  border-radius: 999px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.16);
}
.gate-box.is-min .gate-form,
.gate-box.is-min .km-modal-resize { display: none; }
.gate-box.is-min .km-modal-header { border: 0; border-radius: 999px; padding: 8px 12px; background: #fff; }
.gate-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 22px;
}
.gate-hero[hidden] { display: none; }
.gate-hero img { display: block; height: auto; }
.gate-hero .btn { padding: 12px 26px; font-size: 16px; }
.ai-kpis { display: flex; flex-wrap: wrap; gap: 10px; margin: 0 0 14px; }
.ai-kpis div { background: #fff; border: 1px solid #e4e7dc; border-radius: 8px; padding: 10px 14px; min-width: 140px; }
.ai-kpis strong { display: block; font-size: 16px; }
.ai-kpis span { color: var(--muted); font-size: 12px; }
.settings-panel { max-width: 640px; display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.settings-panel .fld { width: 100%; }
.settings-panel .fld input, .user-form input, .user-form select { width: 100%; }
table.data.accounts { table-layout: fixed; }
table.data.accounts col.col-act { width: 118px; }
table.data.accounts td { vertical-align: middle; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
table.data.accounts td.act { overflow: visible; text-align: right; }
.subnav {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  padding: 0 12px;
  background: var(--top-bg);
  border-bottom: 1px solid var(--stroke);
}
.subnav button {
  border: 0;
  background: transparent;
  padding: 9px 16px;
  color: var(--muted);
}
.subnav button.active {
  background: transparent;
  font-weight: 700;
  color: var(--ink);
  box-shadow: inset 0 -2px 0 var(--logo);
}
.user-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; }
.user-form-modal { display: flex; flex-direction: column; gap: 12px; }
.role-field { display: flex; flex-direction: column; gap: 6px; }
.role-field > span { font-size: 11px; color: var(--muted); letter-spacing: 0.03em; }
.role {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 10px 4px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
  border: 1px solid transparent;
}
.role i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex: none;
}
.role-user { background: #e5f4ea; color: #1b5c34; }
.role-user i { background: #2c7a45; box-shadow: 0 0 0 3px #c5e6d0; }
.role-magasinier { background: #e3f3f6; color: #1a5562; }
.role-magasinier i { background: #2f7c8a; box-shadow: 0 0 0 3px #c5e4ea; }
.role-supervisor { background: #fbf3df; color: #7a5610; }
.role-supervisor i { background: #b8862a; box-shadow: 0 0 0 3px #f0dfb4; }
.role-admin { background: #f3e9fc; color: #4c1594; }
.role-admin i { background: #6818d0; box-shadow: 0 0 0 3px #e0cff6; }
.role-pick { display: flex; flex-wrap: wrap; gap: 8px; }
.role-pick button {
  cursor: pointer;
  font: inherit;
  background: #f7f4ec;
  color: #6d675c;
  border-color: #e4dfd2;
}
.role-pick button i { background: #c4bfb2; box-shadow: none; }
.role-pick button.is-on { box-shadow: 0 1px 0 rgba(28, 36, 22, 0.04), 0 0 0 2px currentColor; }
.role-pick button.is-on.role-user { background: #e5f4ea; color: #1b5c34; border-color: #b7dfc4; }
.role-pick button.is-on.role-user i { background: #2c7a45; box-shadow: 0 0 0 3px #c5e6d0; }
.role-pick button.is-on.role-magasinier { background: #e3f3f6; color: #1a5562; border-color: #b7dbe3; }
.role-pick button.is-on.role-magasinier i { background: #2f7c8a; box-shadow: 0 0 0 3px #c5e4ea; }
.role-pick button.is-on.role-supervisor { background: #fbf3df; color: #7a5610; border-color: #ead7a4; }
.role-pick button.is-on.role-supervisor i { background: #b8862a; box-shadow: 0 0 0 3px #f0dfb4; }
.role-pick button.is-on.role-admin { background: #f3e9fc; color: #4c1594; border-color: #d7c0f3; }
.role-pick button.is-on.role-admin i { background: #6818d0; box-shadow: 0 0 0 3px #e0cff6; }
label.check { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink); }
.import-opt {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 2px 0 12px;
  font-size: 13px;
  color: var(--ink);
}
.import-opt input { width: 16px; height: 16px; accent-color: #2c7a45; flex: none; }
.import-total {
  display: flex;
  justify-content: flex-end;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin: 10px 0 2px;
  font-size: 15px;
}
.import-total .muted { font-size: 12px; }
.page-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-end;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.page-head h1 { font-size: 20px; margin: 0 0 2px; font-weight: 700; }
.page-head p { margin: 0; color: var(--muted); font-size: 13px; }
.row-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.btn, .modes button { border-radius: 0.45rem; }
.btn {
  border: 1px solid var(--stroke);
  background: var(--input-bg);
  padding: 7px 11px;
  font-size: 13px;
  color: var(--ink);
}
.btn:hover { border-color: var(--cyan); }
.btn-primary {
  background: linear-gradient(180deg, #fb923c, var(--logo));
  border-color: var(--logo-deep);
  color: white;
}
.btn-primary:hover { filter: brightness(1.08); }
.btn-green { background: var(--green); border-color: var(--green); color: #0a0c12; }
.btn-gold { background: #c4922e; border-color: #a87a1d; color: #1c2416; }
.btn-ghost { background: transparent; }
.btn-danger { background: transparent; color: var(--red); border-color: rgba(255, 107, 138, 0.35); }
.btn[disabled] { opacity: 0.45; cursor: not-allowed; }
.btn-catalog {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 650;
  background: rgba(234, 88, 12, 0.1);
  border-color: var(--stroke);
}
.btn-catalog:hover { border-color: var(--logo); color: var(--violet); }
.btn-ico { display: block; flex: none; }

.modes { display: flex; gap: 8px; flex-wrap: wrap; }
.modes button {
  border: 1px solid var(--stroke);
  background: var(--input-bg);
  color: var(--ink);
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
}
.modes button.active[data-lens="all"] { background: #1c1917; color: white; border-color: #1c1917; }
.modes button.active[data-lens="commande"] { background: #2563eb; color: white; border-color: #2563eb; }
.modes button.active[data-lens="dp"] { background: #57534e; color: white; border-color: #57534e; }
.modes button.active[data-lens="stock"] { background: #c4922e; color: #1c2416; border-color: #a87a1d; }
.grille-tabs {
  display: flex;
  gap: 0;
  flex-wrap: wrap;
  margin: 0 0 12px;
  border-bottom: 1px solid var(--line);
}
.grille-tab {
  appearance: none;
  border: 0;
  border-bottom: 3px solid transparent;
  background: transparent;
  color: var(--muted);
  padding: 0.65rem 1rem;
  margin-bottom: -1px;
  font: inherit;
  font-size: 13px;
  font-weight: 650;
  cursor: pointer;
}
.grille-tab:hover { color: var(--ink); }
.grille-tab.active { color: var(--ink); }
.grille-tab.phase-besoin.active { border-bottom-color: #3c8c9c; color: #2a6a76; }
.grille-tab.phase-ressources.active { border-bottom-color: #e0b25a; color: #8a6a20; }
.grille-tab.phase-selection.active { border-bottom-color: #3e8f55; color: #2a6a3a; }
.grille-tab.phase-validation.active { border-bottom-color: #3d6ea8; color: #2a4f7a; }
html[data-theme="dark"] .grille-tab.phase-besoin.active,
html:not([data-theme="light"]) .grille-tab.phase-besoin.active { color: #7ec8d4; }
html[data-theme="dark"] .grille-tab.phase-ressources.active,
html:not([data-theme="light"]) .grille-tab.phase-ressources.active { color: #f0d08a; }
html[data-theme="dark"] .grille-tab.phase-selection.active,
html:not([data-theme="light"]) .grille-tab.phase-selection.active { color: #8fd4a0; }
html[data-theme="dark"] .grille-tab.phase-validation.active,
html:not([data-theme="light"]) .grille-tab.phase-validation.active { color: #8eb6e0; }
.sheet-tabbed { max-width: 100%; }

.workbar {
  display: grid;
  grid-template-columns: minmax(240px, 320px) 1fr;
  gap: 10px;
  margin-bottom: 10px;
}
.dropzone {
  border: 1.5px dashed rgba(234, 88, 12, 0.45);
  background: rgba(234, 88, 12, 0.06);
  padding: 6px 10px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  line-height: 1.25;
  border-radius: 0.5rem;
}
.dropzone strong { font-size: 13px; }
.dropzone span, .hint { color: var(--muted); font-size: 12px; }
.dropzone.hot { background: rgba(74, 222, 128, 0.12); border-color: var(--green); }
.meta-card {
  background: var(--sheet);
  border: 1px solid var(--line);
  padding: 6px 10px;
  display: grid;
  grid-template-columns: 1.4fr 1.2fr 88px 1.4fr;
  gap: 8px;
  align-items: center;
}
label.fld { display: flex; flex-direction: column; gap: 3px; font-size: 11px; color: var(--muted); letter-spacing: 0.03em; }
label.fld input, label.fld select, .table input, .table select, .paper input, .paper select, .form input, .form select {
  border: 1px solid var(--stroke);
  background: var(--input-bg);
  color: var(--ink);
  padding: 6px 7px;
  border-radius: 0.4rem;
  width: 100%;
}
.alerts { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }
.alert {
  padding: 8px 10px;
  font-size: 13px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}
.alert-warn { background: #fff4d4; border: 1px solid #e3c56a; }
.alert-bad { background: #fde8e4; border: 1px solid #e3b0a8; }
.alert button { background: transparent; border: 0; font-weight: 700; text-decoration: underline; padding: 0; }

.legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin: 0 0 8px; }
.sw { display: inline-block; width: 11px; height: 11px; margin-right: 4px; vertical-align: -1px; border: 1px solid rgba(0,0,0,.12); }
.sw.g { background: #bfe8b8; }
.sw.r { background: #f6c7c1; }
.sw.o { background: #f6c07a; }
.sw.v { background: #9ed7ae; }
.sw.b { background: #d5ebf0; }

.sheet-scroll {
  overflow: auto;
  max-height: calc(100vh - 220px);
  background: var(--panel);
  border: 1px solid var(--stroke);
  box-shadow: var(--shadow);
}
.grid { border-collapse: separate; border-spacing: 0; min-width: 100%; font-size: 12.5px; }
.grid th, .grid td {
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 0;
  vertical-align: middle;
  background: var(--panel);
  height: 32px;
}
.grid thead th {
  position: sticky;
  z-index: 4;
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 6px;
  white-space: nowrap;
}
.grid thead tr:nth-child(1) th { top: 0; height: 28px; }
.grid thead tr:nth-child(2) th { top: 28px; height: 24px; }
.grid thead tr:nth-child(3) th { top: 52px; height: 22px; font-weight: 600; }
.grid th.sticky, .grid td.sticky { position: sticky; z-index: 5; }
.grid td.sticky { z-index: 2; }
.grid thead th.sticky { z-index: 7; }
.grid thead th.phase-besoin { background: #3c8c9c; color: white; }
.grid thead th.phase-ressources { background: #e0b25a; color: #2b2416; }
.grid thead th.phase-selection { background: #3e8f55; color: white; }
.grid thead th.phase-validation { background: #3d6ea8; color: white; }
.grid thead th.sub-besoin { background: #d5ebf0; color: #1c3d44; }
.grid thead th.sub-stock { background: #f6e3b4; color: #3a3018; }
.grid thead th.sub-autre { background: #f6d2cc; color: #5c2b26; }
.grid thead th.sub-field { background: #f4f6f1; color: #3d4636; }
.grid thead th.sticky-span { border-right-color: transparent; }
.grid thead th.phase-besoin.sticky-span { border-right-color: #3c8c9c; }
.grid thead th.sub-besoin.sticky-span { border-right-color: #d5ebf0; }
.phase-besoin { background: #3c8c9c; color: white; }
.phase-ressources { background: #e0b25a; color: #2b2416; }
.phase-selection { background: #3e8f55; color: white; }
.phase-validation { background: #3d6ea8; color: white; }
.phase-start { box-shadow: inset 3px 0 0 #6d7a55; }
.sub-besoin { background: #d5ebf0; color: #1c3d44; }
.sub-stock { background: #f6e3b4; color: #3a3018; }
.sub-autre { background: #f6d2cc; color: #5c2b26; }
.sub-field { background: #f4f6f1; color: #3d4636; }
.grid tfoot td {
  position: sticky;
  bottom: 0;
  z-index: 3;
  background: #f6f3e8;
  font-weight: 700;
  text-align: right;
  padding: 6px;
  height: 34px;
}
.grid tfoot td.sticky { z-index: 6; background: #efe8d4; }
.grid td.num, .grid th.num { text-align: right; font-variant-numeric: tabular-nums; }
.grid input.cell, .grid select.cell {
  width: 100%;
  height: 30px;
  border: 0;
  background: transparent;
  padding: 4px 6px;
}
.grid input.cell:focus, .grid select.cell:focus { outline: 2px solid #2a62b0; background: #fff; }
.cellfill {
  display: block;
  width: 100%;
  height: 30px;
  border: 0;
  background: transparent;
  text-align: right;
  padding: 0 6px;
  font-weight: inherit;
  color: inherit;
  cursor: pointer;
}
.grid input.num { text-align: right; }
.tone-green { background: #c8ebc0 !important; color: #0f5c28; font-weight: 700; }
.tone-red { background: #f7ccc6 !important; color: #8c2218; font-weight: 650; }
.from-dp { box-shadow: inset 3px 0 0 #2a62b0; }
.from-hand { box-shadow: inset 3px 0 0 #6b4c9a; }
.st-vide { background: #fff; }
.st-dp { background: #f8d7a8 !important; font-weight: 700; }
.st-cmd { background: #b7e4c4 !important; font-weight: 700; }
.st-stock { background: #c5e4ef !important; font-weight: 700; }
.st-partiel { background: #fff3bf !important; font-weight: 700; }
.st-trouver { background: #f6d0ea !important; font-weight: 700; }
tr.is-uncovered td.sticky-mark { box-shadow: inset 3px 0 0 #d97816; }
td.sticky-mark {
  text-align: center;
  vertical-align: middle;
  padding: 0 2px;
}
td.sticky-mark .danger-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  margin: 0 auto;
  font-size: 1rem;
  line-height: 1;
}
.sw.mark {
  width: 3px;
  height: 12px;
  background: #d97816;
  border: 0;
  vertical-align: -2px;
}
td.pad, th.pad { padding: 4px 6px; }
td.center, th.center { text-align: center; }
.check {
  width: 16px;
  height: 16px;
  accent-color: #2c7a45;
}
.dp-draft { accent-color: #d97816; }
.cmd-box { accent-color: #2c7a45; }
.muted { color: var(--muted); }
.tiny { font-size: 10px; letter-spacing: 0.02em; }
.lock { font-size: 10px; color: var(--muted); }
.lens-commande td.col-dp,
.lens-commande td.col-stock { opacity: 0.38; }
.lens-dp td.col-cmd,
.lens-dp td.col-stock { opacity: 0.38; }
.lens-stock td.col-dp,
.lens-stock td.col-cmd { opacity: 0.38; }
tr.draft td { background: #fbfaf4; }

.nego {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 8px;
  margin-top: 10px;
}
.nego-card {
  background: white;
  border: 1px solid var(--line);
  padding: 10px 12px;
}
.nego-card b { display: block; font-size: 20px; font-variant-numeric: tabular-nums; margin: 2px 0; }
.nego-card span { color: var(--muted); font-size: 12px; }
.nego-card.best { background: #e7f6e4; border-color: #8fce9a; }
.nego-card em { font-style: normal; color: var(--red); font-size: 12px; }
.bundles { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.bundle {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
  background: white;
  border: 1px solid var(--line);
  padding: 8px 10px;
  flex-wrap: wrap;
}
.foot-note { margin-top: 12px; color: var(--muted); font-size: 12px; }

.stock-bar { max-width: 460px; margin-bottom: 10px; }
.stock-bar .fld input { width: 100%; }
.stock-table, .list-scroll { max-height: calc(100vh - 280px); }
.th-sort {
  appearance: none;
  background: none;
  border: 0;
  padding: 0;
  margin: 0;
  font: inherit;
  font-weight: 700;
  color: inherit;
  cursor: pointer;
  text-align: left;
}
.th-sort:hover { text-decoration: underline; }
table.data th.is-sorted, table.grid th.is-sorted { background: rgba(234, 88, 12, 0.16); }
.list-sentinel td { text-align: center; color: var(--muted); font-size: 12px; }
.table-wrap { overflow: auto; background: var(--panel); border: 1px solid var(--stroke); box-shadow: var(--shadow); border-radius: 0.55rem; }
table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data th, table.data td { border-bottom: 1px solid var(--line); padding: 8px 10px; text-align: left; vertical-align: top; }
table.data th.num, table.data td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.data th.num .th-sort { display: block; text-align: right; width: 100%; }
table.data th {
  background: var(--bg-2);
  font-size: 12px;
  position: sticky;
  top: 0;
  z-index: 2;
}
table.data thead tr:first-child th { top: 0; z-index: 3; }
table.data thead tr.th-filters th {
  top: 2.55rem;
  z-index: 2;
  font-weight: 400;
  padding: 4px 6px;
  background: var(--panel);
  vertical-align: middle;
}
table.data thead th { pointer-events: none; }
table.data thead .th-sort,
table.data thead .th-filter,
table.data thead .th-filter-cell { pointer-events: auto; }
table.data .th-filter {
  display: block;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  margin: 0;
  padding: 4px 6px;
  border: 1px solid var(--line);
  border-radius: 0.35rem;
  background: var(--input-bg);
  color: var(--ink);
  font: inherit;
  font-size: 12px;
  font-weight: 400;
}
table.data th.num .th-filter { text-align: right; }
table.data .th-filter::placeholder { color: var(--muted); opacity: 0.85; }
table.data .th-filter:focus {
  outline: 2px solid rgba(234, 88, 12, 0.35);
  outline-offset: 0;
  border-color: rgba(234, 88, 12, 0.55);
}
table.data tr:hover td { background: rgba(234, 88, 12, 0.08); }
table.data tr.prep-row,
table.data tr.meteor-row { cursor: pointer; }
.sheet-supplier { padding: 4px 2px 8px; }
.sheet-supplier dd { white-space: pre-line; }
.pill {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 700;
  background: #eeeae0;
}
.pill.orange { background: #f8d7a8; }
.pill.green { background: #b7e4c4; }
.pill.blue { background: #d5e4f6; }
.pill.red { background: #f6d0cc; }
.pill.gold { background: #f6e3b4; }

.view-switch {
  display: inline-flex;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 8px;
  overflow: hidden;
}
.view-switch button {
  border: 0;
  background: transparent;
  width: 36px;
  height: 34px;
  padding: 0;
  color: var(--muted);
  display: grid;
  place-items: center;
}
.view-switch svg { display: block; }
.view-switch button.active {
  background: #efeae0;
  color: var(--ink);
  font-weight: 700;
}
.dp-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 12px;
  align-items: start;
}
.dp-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  box-shadow: 0 1px 0 rgba(28, 36, 22, 0.04);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.dp-head { display: flex; align-items: flex-start; gap: 10px; }
.dp-id { min-width: 0; flex: 1; }
.dp-id h3 { margin: 0; font-size: 15px; }
.dp-id p { margin: 2px 0 0; color: var(--muted); font-size: 12px; line-height: 1.35; }
.dp-card ul { margin: 0; padding-left: 18px; font-size: 13px; }
.dp-card li { margin: 2px 0; }
.dp-more { margin: 0; font-size: 12px; }
.dp-card .row-actions { margin-top: 4px; }
.sup-logo {
  width: 112px;
  height: 48px;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  border: 1px solid #ece7dc;
  border-radius: 8px;
  overflow: hidden;
  padding: 5px 8px;
  box-sizing: border-box;
}
.sup-logo img {
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  object-fit: contain;
  object-position: center;
  display: block;
}
.sup-logo.is-fallback { font-weight: 700; font-size: 12px; letter-spacing: 0.03em; color: var(--ink); }
.sup-cell { display: flex; align-items: center; gap: 10px; min-width: 0; }
.sup-cell strong { line-height: 1.2; }
.sup-cell .sup-logo { width: 108px; height: 44px; }
.sup-cell.is-compact { gap: 8px; }
.sup-cell.is-compact .sup-logo { width: 100px; height: 40px; padding: 2px 6px; }
.sup-cell.is-compact strong { font-size: 13px; white-space: nowrap; }
table.data td:has(.sup-cell) { vertical-align: middle; }
.dp-list td { vertical-align: middle; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 10px; }
.card {
  background: var(--panel);
  border: 1px solid var(--stroke);
  padding: 12px 14px;
  border-radius: 0.55rem;
}
.card h3 { margin: 0 0 6px; font-size: 16px; }
.card ul { margin: 6px 0; padding-left: 18px; }
.split { display: grid; grid-template-columns: 280px 1fr; gap: 12px; align-items: start; }
.paper {
  background: var(--panel);
  border: 1px solid var(--stroke);
  box-shadow: var(--shadow);
  padding: 22px 24px 28px;
  max-width: 860px;
  border-radius: 0.55rem;
}
.paper h2 { margin: 0 0 4px; letter-spacing: 0.04em; }
.paper .who { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 12px 0; }
.form { display: grid; gap: 8px; }
.form.two { grid-template-columns: 1fr 1fr; }
html.km-modal-open,
html.km-modal-open body {
  overflow: hidden !important;
  overscroll-behavior: none;
}
.backdrop, .km-modal {
  position: fixed;
  inset: 0;
  z-index: 45;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px 16px;
  overscroll-behavior: contain;
}
.km-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(22, 28, 18, 0.32);
  backdrop-filter: blur(4px);
  overscroll-behavior: none;
  touch-action: none;
}
.modal, .km-modal-box {
  position: relative;
  z-index: 1;
  background: var(--bg-2);
  color: var(--ink);
  width: min(560px, 100%);
  max-height: min(86vh, 860px);
  border-radius: 14px;
  border: 1px solid var(--stroke);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.km-modal-box.is-wide { width: min(920px, 100%); }
.km-modal-box.is-user { width: min(640px, 100%); }
.km-modal-box.is-catalog {
  width: min(1180px, calc(100vw - 40px));
  height: min(92vh, 980px);
  max-height: calc(100vh - 32px);
}
.km-modal.is-max .km-modal-box.is-catalog {
  width: 100%;
  height: 100%;
  max-height: none;
}
.km-modal-box.is-catalog .km-modal-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
  overscroll-behavior: contain;
}
.km-modal-body,
.km-modal .table-wrap,
.km-modal .list-scroll,
.km-modal .catalog-pick-table {
  overscroll-behavior: contain;
}
.catalog-pane,
.catalog-pick {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
  min-height: 0;
}
.catalog-pane .fld input { width: 100%; }
.catalog-tools {
  display: flex;
  align-items: flex-end;
  gap: 16px 20px;
  flex-wrap: wrap;
}
.catalog-tools .fld { flex: 1; min-width: 220px; margin: 0; }
.chk { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; font-size: 13px; white-space: nowrap; }
.photo-switch {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  padding-bottom: 1px;
}
.photo-switch-label {
  font-size: 13px;
  font-weight: 650;
  color: var(--ink);
}
.photo-switch-track {
  --tri-pad: 3px;
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  width: 4.6rem;
  height: 1.7rem;
  padding: var(--tri-pad);
  border-radius: 999px;
  background: #efeae0;
  border: 1px solid var(--line);
  box-shadow: inset 0 1px 2px rgba(28, 36, 22, 0.08);
}
.photo-switch-thumb {
  position: absolute;
  z-index: 0;
  top: var(--tri-pad);
  left: var(--tri-pad);
  width: calc((100% - (2 * var(--tri-pad))) / 3);
  height: calc(100% - (2 * var(--tri-pad)));
  border-radius: 999px;
  background: #6d7a68;
  box-shadow: 0 1px 3px rgba(28, 36, 22, 0.22);
  transform: translateX(100%);
  transition: transform 0.22s cubic-bezier(0.34, 1.2, 0.64, 1), background 0.18s ease;
  pointer-events: none;
}
.photo-switch[data-state="with"] .photo-switch-thumb { transform: translateX(0); background: var(--green); }
.photo-switch[data-state="any"] .photo-switch-thumb { transform: translateX(100%); background: #6d7a68; }
.photo-switch[data-state="without"] .photo-switch-thumb { transform: translateX(200%); background: var(--red); }
.photo-switch-opt {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  border-radius: 999px;
  cursor: pointer;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  user-select: none;
}
.photo-switch-opt input {
  position: absolute;
  inset: 0;
  opacity: 0;
  margin: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
}
.photo-switch-opt:hover { color: var(--ink); }
.photo-switch-opt.is-active,
.photo-switch-opt:has(input:checked) { color: #fff; }
.catalog-loading {
  flex: 1;
  min-height: 180px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--muted);
}
.spin {
  width: 14px;
  height: 14px;
  border: 2px solid #e6e0d2;
  border-top-color: var(--logo);
  border-radius: 50%;
  display: inline-block;
  animation: km-spin 0.7s linear infinite;
  vertical-align: -2px;
}
.spin.is-lg { width: 28px; height: 28px; border-width: 3px; }
@keyframes km-spin { to { transform: rotate(360deg); } }
mark.hit { background: #ffe08a; color: inherit; padding: 0 1px; border-radius: 2px; }
.catalog-row { cursor: pointer; }
table.data th.catalog-photo,
table.data td.catalog-photo {
  width: 58px;
  padding: 4px 8px;
  vertical-align: middle;
  text-align: center;
}
.catalog-thumb {
  display: block;
  width: 44px;
  height: 44px;
  object-fit: contain;
  margin: 0 auto;
  background: #f6f3ea;
  border: 1px solid #e6e0d2;
  border-radius: 4px;
}
.catalog-thumb-empty { background: #efeae0; }
table.data td.act { text-align: right; white-space: nowrap; width: 1%; }
.sheet {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}
.sheet-backdrop { position: absolute; inset: 0; background: rgba(22, 28, 18, 0.28); }
.sheet-box {
  position: relative;
  z-index: 1;
  width: min(760px, 100%);
  max-height: min(86vh, 840px);
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.18);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.sheet-box.is-pinned {
  position: fixed;
  margin: 0;
  z-index: 2;
}
.sheet-body {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 16px;
  padding: 16px 18px 20px;
  overflow: auto;
}
.sheet-photo {
  background: #f6f3ea;
  border: 1px solid #e6e0d2;
  min-height: 180px;
  display: grid;
  place-items: center;
  padding: 10px;
}
.sheet-photo img { max-width: 100%; max-height: 240px; object-fit: contain; }
.sheet-empty { color: var(--muted); font-size: 13px; }
.sheet-kicker { margin: 0 0 6px; color: var(--muted); font-size: 13px; }
.sheet-price { margin: 0 0 12px; font-size: 18px; font-weight: 700; }
.sheet-grid { display: grid; grid-template-columns: minmax(120px, 180px) 1fr; gap: 6px 12px; margin: 0; }
.sheet-grid dt { color: var(--muted); font-size: 12px; }
.sheet-grid dd { margin: 0; }
@media (max-width: 680px) {
  .sheet-body { grid-template-columns: 1fr; }
}
.catalog-pane .list-scroll {
  flex: 1;
  min-height: 220px;
  max-height: none;
}
.catalog-pane .foot-note { margin: 0; }
.km-modal-box.is-pinned {
  position: fixed;
  max-height: none;
  margin: 0;
}
.km-modal-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  background: rgba(234, 88, 12, 0.08);
  border-bottom: 1px solid var(--stroke);
  cursor: grab;
  user-select: none;
  flex-shrink: 0;
}
.km-modal-header h2, .modal h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 650;
  flex: 1;
  min-width: 0;
}
.km-modal-win {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-left: auto;
  flex-shrink: 0;
}
.km-win {
  width: 18px;
  height: 18px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  position: relative;
  flex-shrink: 0;
  box-shadow:
    0 2px 3px rgba(0, 0, 0, 0.28),
    0 1px 0 rgba(255, 255, 255, 0.45) inset,
    0 -1px 1px rgba(0, 0, 0, 0.18) inset;
  transition: transform 0.12s ease, filter 0.12s ease;
}
.km-win:hover { transform: scale(1.1); filter: brightness(1.05); }
.km-win:active { transform: scale(0.96); filter: brightness(0.96); }
.km-win-min {
  background:
    radial-gradient(120% 90% at 30% 18%, #ffe27a 0%, #ffc53d 38%, #f5a623 72%, #d8890c 100%);
}
.km-win-max {
  background:
    radial-gradient(120% 90% at 30% 18%, #7dff8f 0%, #3fd65a 38%, #22c53e 72%, #14a32e 100%);
}
.km-win-close {
  background:
    radial-gradient(120% 90% at 30% 18%, #ff9a93 0%, #ff6b63 38%, #ff3b30 72%, #d92018 100%);
}
.km-win::before {
  content: "";
  position: absolute;
  left: 14%;
  right: 14%;
  top: 8%;
  height: 38%;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.78), rgba(255, 255, 255, 0));
  pointer-events: none;
}
.km-win::after {
  content: "";
  position: absolute;
  inset: 3px;
  background: center / 11px 11px no-repeat;
  opacity: 1;
  pointer-events: none;
}
.km-win-min::after {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.2 6h7.6' stroke='%231a1a1a' stroke-width='2.2' stroke-linecap='round'/%3E%3C/svg%3E");
}
.km-win-max::after {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Crect x='2.6' y='2.6' width='6.8' height='6.8' rx='0.6' fill='none' stroke='%23fff' stroke-width='1.7'/%3E%3C/svg%3E");
}
.km-win-max.is-restore::after {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M4.2 2.8h5v5' fill='none' stroke='%23fff' stroke-width='1.5'/%3E%3Crect x='2.4' y='4' width='5.2' height='5.2' rx='0.4' fill='none' stroke='%23fff' stroke-width='1.5'/%3E%3C/svg%3E");
}
.km-win-close::after {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M3 3l6 6M9 3L3 9' stroke='%23fff' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
}
.km-modal-body {
  padding: 16px 18px 8px;
  overflow: auto;
  min-height: 0;
  overscroll-behavior: contain;
}
.km-modal-actions, .modal .actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
  margin: 0;
  padding: 12px 16px 14px;
  border-top: 1px solid #ebe6da;
  background: #fff;
  flex-shrink: 0;
}
.km-modal-resize {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 16px;
  height: 16px;
  cursor: nwse-resize;
  z-index: 2;
}
.km-modal-resize::after {
  content: "";
  position: absolute;
  right: 4px;
  bottom: 4px;
  width: 8px;
  height: 8px;
  border-right: 2px solid #b7b09e;
  border-bottom: 2px solid #b7b09e;
}
.km-modal.is-max { padding: 12px; }
.km-modal.is-max .km-modal-box {
  width: 100%;
  height: 100%;
  max-height: none;
}
.km-modal.is-max .km-modal-resize { display: none; }
.km-modal.is-min {
  pointer-events: none;
  align-items: flex-end;
  justify-content: flex-start;
  padding: 0 0 18px 18px;
}
.km-modal.is-min .km-modal-backdrop,
.km-modal.is-min .km-modal-box { display: none; }
.km-dock {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: min(320px, 80vw);
  background: #fff;
  border: 0;
  border-radius: 999px;
  padding: 8px 14px 8px 10px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.16);
  font-weight: 650;
}
.km-dock i {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #febc2e;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.12);
}
.km-dock span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.toast {
  position: fixed;
  bottom: 16px;
  right: 16px;
  background: #1c2416;
  color: white;
  padding: 10px 14px;
  z-index: 48;
  max-width: 360px;
  box-shadow: var(--shadow);
}
.guide-veil {
  position: fixed;
  inset: 0;
  z-index: 70;
  pointer-events: none;
}
.guide-veil.is-dimmed .guide-hole:not([hidden]) {
  box-shadow: 0 0 0 9999px rgba(22, 26, 18, 0.28);
}
.guide-hole {
  position: fixed;
  border-radius: 10px;
  outline: 2px solid #fff;
  outline-offset: 1px;
  transition: top 0.25s ease, left 0.25s ease, width 0.25s ease, height 0.25s ease;
  pointer-events: none;
}
.guide-dock {
  position: fixed;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  z-index: 92;
  pointer-events: auto;
  width: min(640px, calc(100vw - 24px));
  background: var(--bg-2);
  border: 1px solid var(--stroke);
  border-radius: 12px;
  color: var(--ink);
  box-shadow: 0 18px 42px rgba(40, 44, 24, 0.22);
  padding: 14px 16px 12px;
}
.guide-dock-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.guide-dock-tools {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: none;
}
.guide-kicker {
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--logo);
}
.guide-dock .guide-x {
  border: 0;
  background: transparent;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  font-size: 20px;
  line-height: 1;
  color: var(--muted);
}
.guide-dock .guide-x:hover { background: #efeae0; color: var(--ink); }
.guide-voice {
  border: 1px solid #e0d9cb;
  background: #fff;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 650;
  color: var(--muted);
  line-height: 1.2;
}
.guide-voice.is-on {
  border-color: rgba(104, 24, 208, 0.35);
  color: var(--logo);
  background: #f6f0ff;
}
.guide-voice:hover { background: #efeae0; color: var(--ink); }
.guide-dock h2 {
  margin: 8px 0 6px;
  font-size: 18px;
  font-weight: 700;
}
.guide-text {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
  min-height: 2.9em;
}
.guide-nav {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  flex-wrap: wrap;
}
.guide-nav .btn[disabled] {
  opacity: 0.45;
  cursor: default;
}
.affaire-select {
  width: 100%;
  min-height: 9.5rem;
  font-size: 13px;
  line-height: 1.35;
}
.catalog-pick-tools {
  display: flex;
  align-items: flex-end;
  gap: 12px 16px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.catalog-pick-tools .fld { flex: 1; min-width: 180px; margin: 0; }
.catalog-pick-tools .photo-switch { padding-bottom: 2px; }
.catalog-pick-tools .btn { flex-shrink: 0; }
.catalog-pick-table {
  flex: 1;
  min-height: 180px;
  max-height: none;
  overflow: auto;
  margin-top: 8px;
  overscroll-behavior: contain;
}
.catalog-pick-row { cursor: pointer; }
.catalog-pick-row:hover td { background: #f6f0ff; }
.catalog-pick-row.is-on td { background: #efe4ff; }
.catalog-pick-ref {
  font: inherit;
  font-weight: 700;
  text-align: left;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}
.catalog-pick-ref:hover { color: var(--purple, #6b3fa0); }
.doc-link { font: inherit; font-weight: 700; }
.doc-detail .doc-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  margin: 0 0 12px;
}
.doc-detail .who { margin-bottom: 12px; }
.doc-detail .table-wrap { max-height: min(46vh, 420px); overflow: auto; }
.km-modal-actions .btn[disabled] {
  opacity: 0.45;
  cursor: default;
}
.guide-step-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 10px 0 4px;
  font-size: 12px;
  color: var(--muted);
}
.guide-step-eta {
  font-weight: 600;
  color: var(--ink);
  min-height: 1.2em;
}
.guide-step-count {
  flex: none;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}
.guide-progress {
  height: 5px;
  background: #ebe5d8;
  border-radius: 999px;
  margin: 0 0 12px;
  overflow: hidden;
}
.guide-progress span {
  display: block;
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--logo), #8b45e0);
  border-radius: inherit;
  transition: none;
}
.guide-hint {
  margin: 8px 0 0;
  font-size: 12px;
  color: var(--muted);
}
.is-guide-on {
  outline: 2px solid var(--logo);
  outline-offset: 3px;
  position: relative;
  z-index: 71;
}
body:has(.guide-dock) .page { padding-bottom: 220px; }
body:has(.guide-dock) .toast { bottom: auto; top: 80px; z-index: 93; }
@media (max-width: 720px) {
  .guide-dock {
    left: 12px;
    right: 12px;
    width: auto;
    transform: none;
  }
}
.busy {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(10, 12, 18, 0.72);
}
.busy-card {
  width: min(360px, calc(100vw - 48px));
  background: var(--bg-2);
  border: 1px solid var(--stroke);
  color: var(--ink);
  box-shadow: var(--shadow);
  padding: 18px 20px 16px;
  border-radius: 0.65rem;
}
.busy-label {
  font-weight: 700;
  margin-bottom: 12px;
}
.busy-track {
  height: 8px;
  background: #ebe6da;
  border-radius: 99px;
  overflow: hidden;
}
.busy-track > span {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--logo-deep), var(--logo));
  transition: width 0.28s ease;
}
.busy-pct {
  margin-top: 8px;
  font-size: 12px;
  font-weight: 650;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.page-tabs {
  display: flex;
  gap: 2px;
  margin: 0 0 14px;
  border-bottom: 1px solid var(--stroke);
}
.page-tabs button {
  border: 1px solid transparent;
  border-bottom: 0;
  background: transparent;
  padding: 9px 16px;
  color: var(--muted);
  border-radius: 3px 3px 0 0;
}
.page-tabs button.active {
  background: var(--panel);
  border-color: var(--stroke);
  font-weight: 700;
  color: var(--ink);
  margin-bottom: -1px;
}
.meteor-bar { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin: 0 0 12px; }
.meteor-bar .fld { margin: 0; min-width: 240px; }
.meteor-order { margin: 0 0 12px; }
.meteor-order h3 { margin-bottom: 4px; }
.linkish { background: none; border: 0; color: var(--blue); padding: 0; font-weight: 700; }
.danger-link { color: var(--red); }

@media (max-width: 980px) {
  .workbar, .meta-card, .split, .nego, .form.two, .paper .who, .home-grid { grid-template-columns: 1fr; }
  .home-card:first-child { grid-column: auto; }
  .sheet-scroll { max-height: none; }
}
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); transition: transform 0.2s ease; }
  .sidebar.is-open { transform: none; }
  .sidebar-close, .sidebar-open { display: inline-flex; }
  .app-main { margin-left: 0; }
  .app-kicker { display: none; }
  .who { margin-left: auto; }
  .who__meta { display: none; }
  .page.stage { width: calc(100% - 1rem); margin: 1rem 0.5rem 2.5rem; }
  .table-wrap,
  .sheet-scroll,
  .list-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
  }
  table.data,
  table.grid {
    min-width: 0;
    width: 100%;
  }
  .row-actions .btn { flex: 1 1 auto; }
  .workbar { grid-template-columns: 1fr; }
}

/* —— Besoin 2 : vue cartes (sources en lignes) —— */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.b2-toolbar {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
  margin: 0.75rem 0 1rem;
}
.b2-search {
  flex: 1 1 16rem;
  min-width: 12rem;
}
.b2-search input {
  width: 100%;
  height: 2.6rem;
  border: 1px solid var(--stroke);
  border-radius: 0.7rem;
  padding: 0 1rem 0 2.5rem;
  background: var(--panel) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E") 0.85rem center no-repeat;
  color: var(--ink);
  font: inherit;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.03);
}
.b2-add {
  height: 2.6rem;
  border-radius: 0.7rem;
  padding: 0 1.1rem;
  white-space: nowrap;
}
.b2-board {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(288px, 1fr));
  gap: 1rem;
  align-items: stretch;
}
.b2-card {
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--stroke);
  border-radius: 1rem;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.06);
  overflow: hidden;
  min-height: 100%;
}
.b2-card-head {
  display: grid;
  grid-template-columns: 64px 1fr auto;
  gap: 0.75rem;
  align-items: start;
  padding: 1rem 1rem 0.85rem;
  border-bottom: 1px solid var(--line);
}
.b2-thumb {
  width: 64px;
  height: 64px;
  border-radius: 0.75rem;
  background: #eef2f7;
  display: grid;
  place-items: center;
  overflow: hidden;
  flex: 0 0 auto;
}
html:not([data-theme="light"]) .b2-thumb { background: #1a2030; }
.b2-thumb-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.b2-thumb-fallback {
  font-weight: 700;
  font-size: 1.35rem;
  color: var(--muted);
}
.del-line-preview {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 1rem;
  align-items: start;
}
.del-line-thumb {
  width: 72px;
  height: 72px;
}
.b2-search-go { flex: 0 0 auto; }
.b2-card-meta h3 {
  margin: 0;
  font-size: 1rem;
  line-height: 1.25;
  color: var(--ink);
}
.b2-ref {
  margin: 0.2rem 0 0.45rem;
  color: var(--muted);
  font-size: 0.82rem;
}
.b2-qty {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.82rem;
  color: var(--muted);
}
.b2-qty-input {
  width: 4.2rem;
  height: 1.7rem;
  border: 1px solid var(--stroke);
  border-radius: 0.4rem;
  padding: 0 0.4rem;
  background: var(--input-bg);
  color: var(--ink);
  font: inherit;
  font-weight: 650;
}
.b2-del {
  font-size: 1.25rem;
  line-height: 1;
  padding: 0.15rem 0.35rem;
}
.b2-sources {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  padding: 0.75rem 0.85rem;
  flex: 1 1 auto;
}
.b2-source {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.55rem;
  align-items: center;
  padding: 0.7rem 0.75rem;
  border-radius: 0.75rem;
  border: 1px solid transparent;
  background: rgba(148, 163, 184, 0.08);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
.b2-source input {
  width: 1.05rem;
  height: 1.05rem;
  accent-color: #2563eb;
  margin: 0;
}
.b2-source-name {
  font-weight: 650;
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}
.b2-source-val {
  font-weight: 700;
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  justify-self: end;
  text-align: right;
}
.b2-badge {
  font-style: normal;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  background: #dcfce7;
  color: #166534;
}
html:not([data-theme="light"]) .b2-badge {
  background: rgba(74, 222, 128, 0.18);
  color: #86efac;
}
.b2-source.is-on.is-buy,
.b2-source.is-best.is-on {
  background: rgba(37, 99, 235, 0.12);
  border-color: rgba(37, 99, 235, 0.35);
  box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.12);
}
.b2-source.is-ask {
  background: rgba(245, 158, 11, 0.1);
}
.b2-source.is-ask.is-on {
  background: rgba(245, 158, 11, 0.18);
  border-color: rgba(245, 158, 11, 0.4);
}
.b2-ask {
  color: #b45309;
  font-weight: 650;
}
html:not([data-theme="light"]) .b2-ask { color: #fbbf24; }
.b2-ask-ico {
  width: 0.7rem;
  height: 0.7rem;
  display: inline-block;
  background: currentColor;
  clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%);
}
.b2-source.is-stock.no-stock {
  background: rgba(244, 63, 94, 0.08);
  color: var(--muted);
  cursor: not-allowed;
}
.b2-source.is-stock.no-stock .b2-source-val { color: #be123c; font-weight: 650; }
html:not([data-theme="light"]) .b2-source.is-stock.no-stock .b2-source-val { color: #fb7185; }
.b2-source.is-stock.has-stock {
  background: rgba(22, 163, 74, 0.08);
}
.b2-source.is-stock.is-on {
  background: rgba(22, 163, 74, 0.16);
  border-color: rgba(22, 163, 74, 0.4);
}
.b2-stock-ico {
  width: 0.95rem;
  height: 0.95rem;
  display: inline-block;
  background: currentColor;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M3 10.5 12 3l9 7.5V21a1 1 0 0 1-1 1h-5v-7H9v7H4a1 1 0 0 1-1-1z'/%3E%3C/svg%3E") center / contain no-repeat;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M3 10.5 12 3l9 7.5V21a1 1 0 0 1-1 1h-5v-7H9v7H4a1 1 0 0 1-1-1z'/%3E%3C/svg%3E") center / contain no-repeat;
  opacity: 0.85;
}
.b2-source.is-stock.no-stock .b2-stock-ico { color: #be123c; }
.b2-source.is-stock.has-stock .b2-stock-ico { color: #15803d; }
.b2-cta {
  margin: 0 0.85rem 0.85rem;
  height: 2.75rem;
  border: 0;
  border-radius: 0.8rem;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  color: #fff;
  background: #2563eb;
}
.b2-cta.is-buy { background: #2563eb; }
.b2-cta.is-stock { background: #16a34a; }
.b2-cta.is-dp { background: #d97706; }
.b2-cta.is-muted,
.b2-cta:disabled {
  background: #94a3b8;
  cursor: not-allowed;
  opacity: 0.85;
}
.b2-cta:not(:disabled):hover { filter: brightness(1.06); }
.b2-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 2.5rem 1rem;
  color: var(--muted);
  border: 1.5px dashed var(--stroke);
  border-radius: 1rem;
  background: rgba(148, 163, 184, 0.06);
}
.b2-empty .btn { margin-top: 0.75rem; }

@media (max-width: 720px) {
  .b2-toolbar { flex-direction: column; align-items: stretch; }
  .b2-add { width: 100%; }
  .b2-board { grid-template-columns: 1fr; }
}

@media print {
  .orbit, .sidebar, .sidebar-backdrop, .app-top, .app-rule, .subnav, .page-head, .workbar, .alerts, .legend, .nego, .bundles, .row-actions, .no-print, .km-modal, .guide-veil, .guide-dock, .b2-toolbar { display: none !important; }
  .app-main { margin-left: 0 !important; }
  .page { padding: 0; margin: 0; width: 100%; }
  .sheet-scroll, .paper, .table-wrap { box-shadow: none; border: 0; max-height: none; overflow: visible; }
  body { background: white; color: #111; }
}
