/* ---- Promo Plan : complements a base.css (charte Groupe SEB de l'outil Promo Nationale) ---- */
:root { --ui-amber: #B26A00; --ui-amber-tint: #FFF4E0; --ui-blue-tint: #EAF2FB; --ui-blue: #1F5FA8; }

.appTop .topbarInner { max-width: 1480px; gap: 20px; }
.appTop .brandLockup { text-decoration: none; color: inherit; flex: 0 0 auto; }
.appTop .sebMark { height: 48px; }
.appTop .brandText h1 { font-size: 21px; }
.mainNav { display: flex; gap: 4px; flex-wrap: wrap; flex: 1; }
.mainNav a {
  text-decoration: none; color: var(--ui-muted); font-weight: 600; font-size: 14.5px;
  padding: 8px 14px; border-radius: 999px; transition: background .15s, color .15s;
}
.mainNav a:hover { color: var(--ui-ink); background: var(--ui-bg); }
.mainNav a.active { color: var(--seb-red-dark); background: var(--seb-red-tint); }
.userBox { position: relative; flex: 0 0 auto; }
.userBtn {
  display: flex; align-items: center; gap: 10px; background: #fff; border: 1.5px solid var(--ui-line); border-radius: 999px;
  padding: 6px 8px 6px 14px; font: inherit; font-size: 14px; font-weight: 600; color: var(--ui-ink); cursor: pointer;
}
.userBtn:hover { border-color: var(--ui-line-strong); }
.roleBadge {
  font-size: 11.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; padding: 3px 9px; border-radius: 999px;
  background: var(--ui-bg); color: var(--ui-muted);
}
.roleBadge.marketing, .roleBadge.admin { background: var(--seb-red-tint); color: var(--seb-red-dark); }
.roleBadge.logistique { background: var(--ui-blue-tint); color: var(--ui-blue); }
.roleBadge.sales { background: var(--ui-green-tint); color: var(--ui-green); }
.userMenu {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; background: #fff; border: 1px solid var(--ui-line);
  border-radius: 12px; box-shadow: var(--shadow-lg); min-width: 230px; padding: 6px; display: grid;
}
.userMenu a, .userMenu button {
  text-align: left; background: none; border: 0; font: inherit; font-size: 14px; color: var(--ui-ink); padding: 9px 12px;
  border-radius: 8px; cursor: pointer; text-decoration: none;
}
.userMenu a:hover, .userMenu button:hover { background: var(--ui-bg); }

.appMain { max-width: 1480px; margin: 0 auto; padding: 24px 24px 64px; }
.appMain:focus { outline: none; }
.pageHead { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.pageHead h2 { margin: 0; font-size: 24px; letter-spacing: -0.01em; }
.pageHead p { margin: 4px 0 0; color: var(--ui-muted); font-size: 14.5px; max-width: 80ch; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

.card {
  background: var(--ui-card); border: 1px solid var(--ui-line); border-radius: var(--radius); box-shadow: var(--shadow-md);
  padding: 22px 24px; margin-bottom: 20px;
}
.card h3 { margin: 0 0 4px; font-size: 17px; }
.card .sub { margin: 0 0 16px; color: var(--ui-muted); font-size: 14px; }

/* ---- formulaires ---- */
.formGrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px 18px; }
.field { display: grid; gap: 6px; min-width: 0; }
.field > span { font-size: 12.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--ui-muted); }
.input, .select, textarea.input {
  width: 100%; font: inherit; font-size: 14.5px; color: var(--ui-ink); background: #fff;
  border: 1.5px solid var(--ui-line-strong); border-radius: 10px; padding: 9px 12px;
}
.select { appearance: none; -webkit-appearance: none; padding-right: 36px;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='9' viewBox='0 0 14 9' fill='none' stroke='%236E6561' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M1 1.5l6 6 6-6'/%3E%3C/svg%3E") no-repeat right 12px center; }
.input:focus, .select:focus, textarea.input:focus { outline: none; border-color: var(--seb-red); box-shadow: 0 0 0 4px rgba(210,64,47,.15); }
textarea.input { resize: vertical; font-family: Consolas, "Courier New", monospace; font-size: 13px; line-height: 1.5; }
.formError { color: #A3222F; font-weight: 600; font-size: 14px; min-height: 1.2em; }
.hint { color: var(--ui-muted); font-size: 13.5px; }

/* ---- connexion ---- */
.authWrap { min-height: calc(100vh - 140px); display: grid; place-items: center; padding: 24px 0; }
.authCard { width: min(440px, 100%); }
.authCard h2 { margin: 0 0 6px; font-size: 24px; }
.authCard form { display: grid; gap: 14px; margin-top: 18px; }
.authCard .btn { width: 100%; }
.tempPw {
  font: 700 18px Consolas, "Courier New", monospace; letter-spacing: .06em; background: var(--ui-bg); border: 1.5px dashed var(--ui-line-strong);
  border-radius: 10px; padding: 12px 14px; user-select: all; text-align: center;
}

/* ---- barre d'outils et tableau ---- */
.toolbar {
  display: flex; flex-wrap: wrap; gap: 10px 12px; align-items: center; margin-bottom: 12px;
  background: var(--ui-card); border: 1px solid var(--ui-line); border-radius: 12px; padding: 10px 12px;
}
.toolbar .input, .toolbar .select { width: auto; min-width: 150px; padding-top: 7px; padding-bottom: 7px; font-size: 14px; }
.toolbar .search { min-width: 240px; flex: 1 1 240px; }
.toolbar .spacer { flex: 1; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; color: var(--ui-ink); cursor: pointer; white-space: nowrap; }
.check input { width: 16px; height: 16px; accent-color: var(--seb-red-btn); }
.countLine { font-size: 13.5px; color: var(--ui-muted); white-space: nowrap; }

.tableWrap {
  background: #fff; border: 1px solid var(--ui-line); border-radius: 12px; overflow: auto; max-height: calc(100vh - 290px);
  box-shadow: var(--shadow-sm);
}
table.grid { border-collapse: separate; border-spacing: 0; width: max-content; min-width: 100%; font-size: 13.5px; }
table.grid th, table.grid td { padding: 0; border-bottom: 1px solid var(--ui-line); border-right: 1px solid #F1EDEA; white-space: nowrap; }
table.grid thead th {
  position: sticky; top: 0; z-index: 2; background: #FAF8F7; text-align: left; font-size: 12px; font-weight: 700;
  letter-spacing: .03em; text-transform: uppercase; color: var(--ui-muted); padding: 9px 10px;
}
table.grid thead tr.groupRow th { top: 0; background: #F3EFEC; color: var(--ui-ink); text-align: center; }
table.grid thead tr.groupRow + tr th { top: 35px; }
table.grid td .c { padding: 7px 10px; min-height: 33px; display: flex; align-items: center; gap: 6px; }
table.grid td.num .c { justify-content: flex-end; font-variant-numeric: tabular-nums; }
table.grid td.edit { cursor: text; background: #fff; }
table.grid td.edit:hover { background: #FFFBF3; box-shadow: inset 0 0 0 1px #F0D9B0; }
table.grid td.edit.empty .c::after { content: "—"; color: #C9C2BD; }
table.grid td.ro .c { color: #4A4440; }
table.grid td.calc { background: #FBFAF9; }
table.grid td.sticky, table.grid th.sticky { position: sticky; left: 0; z-index: 1; background: #fff; box-shadow: 1px 0 0 var(--ui-line); }
table.grid thead th.sticky { z-index: 3; background: #FAF8F7; }
table.grid tr:hover td { background-color: #FCFAF9; }
table.grid tr:hover td.edit { background: #FFFBF3; }
table.grid tr.archived td { opacity: .55; }
table.grid td input.cellInput {
  width: 100%; min-width: 70px; border: 0; outline: 2px solid var(--seb-red); outline-offset: -2px; padding: 7px 9px;
  font: inherit; font-size: 13.5px; background: #fff; text-align: inherit;
}
table.grid td.saving { background: #FFF8E6 !important; }
table.grid td.saved { animation: flashOk 1.2s ease; }
@keyframes flashOk { from { background: var(--ui-green-tint); } to { background: transparent; } }
.linkCell { background: none; border: 0; padding: 0; font: inherit; color: var(--seb-red-dark); font-weight: 700; cursor: pointer; text-align: left; }
.linkCell:hover { text-decoration: underline; }
.flag { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--seb-red); flex: 0 0 auto; }
.chans { display: flex; gap: 3px; }
.chan { font-size: 10.5px; font-weight: 700; padding: 1px 5px; border-radius: 5px; background: #F1EEEC; color: #B4ACA6; }
.chan.on { background: var(--ui-green-tint); color: var(--ui-green); }
.ovw { font-size: 12.5px; color: #4A4440; }
.pill { display: inline-block; font-size: 11.5px; font-weight: 700; padding: 2px 8px; border-radius: 999px; }
.pill.red { background: var(--seb-red-tint); color: var(--seb-red-dark); }
.pill.amber { background: var(--ui-amber-tint); color: var(--ui-amber); }
.pill.green { background: var(--ui-green-tint); color: var(--ui-green); }
.pill.grey { background: var(--ui-bg); color: var(--ui-muted); }
.emptyRow td { padding: 30px; text-align: center; color: var(--ui-muted); }

/* ---- totaux (resume) ---- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-bottom: 14px; }
.stat { background: #fff; border: 1px solid var(--ui-line); border-radius: 12px; padding: 14px 16px; }
.stat .k { font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--ui-muted); }
.stat .v { font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; margin-top: 2px; }

/* ---- panneau lateral (fiche produit) ---- */
.drawerBack { position: fixed; inset: 0; background: rgba(28,24,22,.35); z-index: 40; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(760px, 100%); z-index: 41; background: var(--ui-bg);
  box-shadow: -10px 0 40px rgba(0,0,0,.18); overflow-y: auto; display: flex; flex-direction: column;
}
.drawerHead {
  position: sticky; top: 0; z-index: 2; background: #fff; border-bottom: 1px solid var(--ui-line);
  padding: 16px 22px; display: flex; gap: 14px; align-items: flex-start; justify-content: space-between;
}
.drawerHead h3 { margin: 0; font-size: 19px; }
.drawerHead .meta { color: var(--ui-muted); font-size: 13.5px; margin-top: 3px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.drawerBody { padding: 18px 22px 40px; display: grid; gap: 16px; }
.closeBtn { background: none; border: 0; font-size: 26px; line-height: 1; color: var(--ui-muted); cursor: pointer; padding: 2px 6px; border-radius: 8px; }
.closeBtn:hover { background: var(--ui-bg); color: var(--ui-ink); }
.section { background: #fff; border: 1px solid var(--ui-line); border-radius: 12px; padding: 16px 18px; }
.section h4 { margin: 0 0 12px; font-size: 14px; letter-spacing: .03em; text-transform: uppercase; color: var(--ui-muted); }
.kv { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px 16px; }
.kv .field .refVal { font-size: 12px; color: var(--ui-muted); }
.kv .field.over .input { border-color: var(--seb-red); background: #FFF8F7; }
.miniTable { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.miniTable th, .miniTable td { padding: 6px 8px; border-bottom: 1px solid var(--ui-line); text-align: left; vertical-align: middle; }
.miniTable th { font-size: 11.5px; text-transform: uppercase; letter-spacing: .03em; color: var(--ui-muted); }
.miniTable td.num { text-align: right; font-variant-numeric: tabular-nums; }
.miniTable .input { padding: 5px 8px; font-size: 13.5px; border-radius: 7px; min-width: 70px; }
.histItem { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; padding: 9px 0; border-bottom: 1px solid var(--ui-line); font-size: 13.5px; }
.histItem:last-child { border-bottom: 0; }
.histItem .when { color: var(--ui-muted); font-size: 12.5px; }
.histItem .chg { color: var(--ui-ink); }
.histItem .chg s { color: #A3222F; }
.histItem .chg b { color: var(--ui-green); font-weight: 600; }
.histItem.undone { opacity: .5; }
.imgPrev { max-width: 160px; max-height: 120px; border: 1px solid var(--ui-line); border-radius: 8px; background: #fff; object-fit: contain; }

/* ---- boite de dialogue ---- */
.modalBack { position: fixed; inset: 0; z-index: 60; background: rgba(28,24,22,.5); display: grid; place-items: center; padding: 20px; }
.dialog { width: min(560px, 100%); background: #fff; border-radius: 16px; box-shadow: var(--shadow-lg); padding: 22px 24px; max-height: 90vh; overflow: auto; }
.dialog h3 { margin: 0 0 6px; font-size: 19px; }
.dialog .row { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; flex-wrap: wrap; }

/* ---- notifications ---- */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 80; background: var(--ui-ink); color: #fff;
  padding: 11px 18px; border-radius: 12px; font-size: 14px; font-weight: 600; box-shadow: var(--shadow-lg); max-width: min(560px, 90vw);
}
.toast.err { background: #A3222F; }

/* ---- generation ---- */
.genGrid { display: grid; grid-template-columns: minmax(260px, 320px) 1fr; gap: 20px; align-items: start; }
.chipsWrap { display: grid; grid-template-columns: repeat(auto-fill, minmax(124px, 1fr)); gap: 8px; }
.clientTable { max-height: 460px; overflow: auto; border: 1px solid var(--ui-line); border-radius: 10px; }
.clientTable table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.clientTable th { position: sticky; top: 0; background: #FAF8F7; z-index: 1; font-size: 11.5px; text-transform: uppercase; letter-spacing: .03em; color: var(--ui-muted); text-align: left; padding: 8px 10px; }
.clientTable td { padding: 5px 10px; border-top: 1px solid var(--ui-line); }
.clientTable .input { padding: 6px 9px; font-size: 13.5px; border-radius: 7px; }
.clientTable tr.isNew td { background: #FFFBF0; }
.saveState { font-size: 13px; color: var(--ui-muted); }
.saveState.ok { color: var(--ui-green); }

@media (max-width: 980px) {
  .genGrid { grid-template-columns: 1fr; }
  .appTop .topbarInner { flex-wrap: wrap; }
  .mainNav { order: 3; flex-basis: 100%; }
}
@media (max-width: 640px) {
  .appMain { padding: 16px 12px 48px; }
  .appTop .brandText span { display: none; }
  .tableWrap { max-height: none; }
}
@media print {
  .appTop, .appMain, .toast, .drawer, .drawerBack, .modalBack { display: none !important; }
}
