:root {
  --bg: #f4f5f7;
  --panel: #ffffff;
  --ink: #14171f;
  --muted: #646b7a;
  --line: #e2e5ea;
  --accent: #2f6f6b;
  --accent-soft: #e8f1f0;
  --danger: #c0392b;
  --danger-soft: #fdecea;
  --warn: #9a6200;
  --warn-soft: #fff4e0;
  --ok: #1f7a4d;
  --ok-soft: #e7f5ee;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(20, 23, 31, .06), 0 4px 14px rgba(20, 23, 31, .05);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

header.top {
  background: var(--ink);
  color: #fff;
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 28px;
  position: sticky;
  top: 0;
  z-index: 20;
}
header.top h1 { font-size: 17px; margin: 0; padding: 16px 0; letter-spacing: .2px; font-weight: 650; }
header.top nav { display: flex; gap: 4px; margin-left: auto; }
header.top nav button {
  background: none; border: 0; color: #aeb6c4; padding: 18px 14px; cursor: pointer;
  font: inherit; font-size: 14px; border-bottom: 2px solid transparent;
}
header.top nav button:hover { color: #fff; }
header.top nav button.on { color: #fff; border-bottom-color: #6fc2b4; }

main { max-width: 1180px; margin: 0 auto; padding: 26px 24px 80px; }

.page { display: none; }
.page.on { display: block; }

h2 { font-size: 21px; margin: 0 0 4px; font-weight: 650; }
h3 { font-size: 15px; margin: 0 0 12px; font-weight: 650; }
.sub { color: var(--muted); font-size: 13.5px; margin: 0 0 22px; }

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 18px;
}
.panel.tight { padding: 0; overflow: hidden; }

.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.spacer { flex: 1; }

button.btn {
  background: var(--accent); color: #fff; border: 0; border-radius: 7px;
  padding: 9px 15px; font: inherit; font-size: 14px; font-weight: 550; cursor: pointer;
}
button.btn:hover { filter: brightness(1.08); }
button.btn:disabled { opacity: .5; cursor: not-allowed; }
button.btn.ghost { background: #fff; color: var(--ink); border: 1px solid var(--line); }
button.btn.ghost:hover { background: #f7f8fa; filter: none; }
button.btn.danger { background: var(--danger); }
button.btn.small { padding: 6px 11px; font-size: 13px; }

a.link { color: var(--accent); cursor: pointer; text-decoration: none; font-size: 13.5px; }
a.link:hover { text-decoration: underline; }
a.link.danger { color: var(--danger); }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th {
  text-align: left; font-weight: 600; font-size: 12px; text-transform: uppercase;
  letter-spacing: .05em; color: var(--muted); padding: 12px 16px;
  border-bottom: 1px solid var(--line); background: #fafbfc;
}
td { padding: 13px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tr.dim td { color: var(--muted); }

.tag {
  display: inline-block; padding: 3px 9px; border-radius: 100px;
  font-size: 12px; font-weight: 600; letter-spacing: .02em; white-space: nowrap;
}
.tag.ok { background: var(--ok-soft); color: var(--ok); }
.tag.warn { background: var(--warn-soft); color: var(--warn); }
.tag.danger { background: var(--danger-soft); color: var(--danger); }
.tag.mute { background: #eef0f3; color: var(--muted); }
.tag.accent { background: var(--accent-soft); color: var(--accent); }

code.code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  background: #eef0f3; padding: 2px 7px; border-radius: 5px; font-size: 13px; font-weight: 600;
}

label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 5px; color: #39404e; }
.hint { font-size: 12.5px; color: var(--muted); font-weight: 400; margin-top: 4px; }
input[type=text], input[type=number], input[type=date], input[type=password], select, textarea {
  width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 7px;
  font: inherit; font-size: 14px; background: #fff; color: var(--ink);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
textarea { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; line-height: 1.5; }
.field { margin-bottom: 16px; }
.grid { display: grid; gap: 16px; }
.grid.c2 { grid-template-columns: 1fr 1fr; }
.grid.c3 { grid-template-columns: repeat(3, 1fr); }
.grid.c4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 760px) { .grid.c2, .grid.c3, .grid.c4 { grid-template-columns: 1fr; } }

.radios { display: flex; gap: 18px; padding-top: 4px; }
.radios label { font-weight: 400; display: flex; align-items: center; gap: 7px; margin: 0; cursor: pointer; }
.checks { display: flex; flex-wrap: wrap; gap: 10px 18px; }
.checks label { font-weight: 400; display: flex; align-items: center; gap: 7px; margin: 0; cursor: pointer; }

.alert {
  border-radius: 8px; padding: 12px 15px; font-size: 13.5px; margin-bottom: 14px;
  border: 1px solid transparent;
}
.alert.warn { background: var(--warn-soft); border-color: #f0d9ae; color: #6b4400; }
.alert.danger { background: var(--danger-soft); border-color: #f3c6c0; color: #8c2419; }
.alert.ok { background: var(--ok-soft); border-color: #bfe3d0; color: #14562f; }
.alert strong { font-weight: 650; }

.storecard {
  border: 1px solid var(--line); border-radius: var(--radius); background: #fff;
  padding: 16px 18px; box-shadow: var(--shadow);
}
.storecard h4 { margin: 0 0 2px; font-size: 15px; font-weight: 650; }
.storecard .dom { font-size: 12.5px; color: var(--muted); margin-bottom: 12px; }
.storecard .live { border-top: 1px solid var(--line); padding-top: 12px; margin-top: 12px; font-size: 13.5px; }

.cand {
  border: 1px solid var(--line); border-radius: 8px; padding: 14px; margin-bottom: 12px; background: #fff;
}
.cand .where { font-size: 12px; color: var(--muted); font-family: ui-monospace, Menlo, monospace; word-break: break-all; }
.cand .txt { margin: 8px 0; font-size: 13.5px; }
.cand.picked { border-color: var(--accent); background: var(--accent-soft); }

.logline { font-size: 13px; padding: 8px 16px; border-bottom: 1px solid var(--line); display: flex; gap: 12px; }
.logline:last-child { border-bottom: 0; }
.logline .t { color: var(--muted); font-family: ui-monospace, Menlo, monospace; font-size: 12px; white-space: nowrap; }
.logline.error { background: var(--danger-soft); }
.logline.warn { background: var(--warn-soft); }

dialog {
  border: 0; border-radius: 12px; padding: 0; max-width: 780px; width: 92vw;
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
}
dialog::backdrop { background: rgba(20, 23, 31, .45); }
dialog .dlg-head { padding: 20px 24px 0; }
dialog .dlg-body { padding: 16px 24px; max-height: 68vh; overflow: auto; }
dialog .dlg-foot { padding: 14px 24px 20px; display: flex; gap: 10px; justify-content: flex-end; border-top: 1px solid var(--line); }

.empty { text-align: center; padding: 42px 20px; color: var(--muted); font-size: 14px; }
.spin { display: inline-block; width: 13px; height: 13px; border: 2px solid #ffffff60; border-top-color: #fff; border-radius: 50%; animation: sp .7s linear infinite; vertical-align: -2px; }
@keyframes sp { to { transform: rotate(360deg); } }

#toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%) translateY(140%);
  background: var(--ink); color: #fff; padding: 12px 20px; border-radius: 8px;
  font-size: 14px; z-index: 99; transition: transform .25s; max-width: 90vw;
}
#toast.show { transform: translateX(-50%) translateY(0); }
#toast.bad { background: var(--danger); }

/* Calendrier */
table.cal input[type=text], table.cal input[type=date], table.cal input[type=number] { padding: 5px 7px; font-size: 13px; }
table.cal input.code-in { width: 118px; font-family: ui-monospace, Menlo, monospace; text-transform: uppercase; }
table.cal input.code-in.long { border-color: var(--warn); background: var(--warn-soft); }
table.cal input.offer-in { width: 150px; }
table.cal input.emoji-in { width: 44px; text-align: center; }
table.cal input.val-in { width: 58px; }
table.cal tr.off td { opacity: .45; }
table.cal tr.big td { background: #fff8ec; }
table.cal .why { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
table.cal .stores { display: flex; gap: 4px; flex-wrap: wrap; }
table.cal .stores label { font-size: 11.5px; font-weight: 400; display: flex; gap: 3px; align-items: center; margin: 0; white-space: nowrap; }
.chk { font-size: 11.5px; line-height: 1.35; }
.chk .danger { color: var(--danger); } .chk .warn { color: #8a5a00; } .chk .ok { color: #14562f; }
/* Merchant Center */
.mcchip { display: inline-block; font-size: 12px; border-radius: 6px; padding: 3px 7px; margin: 2px 4px 2px 0; border: 1px solid var(--line); background: #fafbfc; }
.mcchip.LIVE { background: var(--ok-soft); border-color: #bfe3d0; color: #14562f; }
.mcchip.PENDING, .mcchip.A_RENVOYER { background: var(--accent-soft); color: var(--accent); }
.mcchip.REJECTED, .mcchip.err { background: var(--danger-soft); border-color: #f3c6c0; color: #8c2419; }
.mcchip.todo { background: var(--warn-soft); border-color: #f0d9ae; color: #6b4400; }
