:root {
  --bg: #f4f6fa; --surface: #fff; --fg: #0f172a; --muted: #64748b; --line: #e2e8f0;
  --primary: #4338ca; --primary-hover: #3730a3; --primary-soft: #eef2ff;
  --ok: #047857; --okbg: #d1fae5; --soon: #b45309; --soonbg: #fef3c7; --ko: #b91c1c; --kobg: #fee2e2;
  --radius: 12px; --shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 4px 16px rgba(15, 23, 42, .04);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 15px/1.55 -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, sans-serif; color: var(--fg); background: var(--bg); }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* En-tête */
.top { position: sticky; top: 0; z-index: 10; background: rgba(255, 255, 255, .92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.bar { max-width: 1120px; margin: 0 auto; padding: 0 20px; min-height: 60px; display: flex; align-items: center; gap: 24px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; color: var(--fg); letter-spacing: -.01em; }
.brand:hover { text-decoration: none; }
.brand::before { content: ""; width: 26px; height: 26px; border-radius: 8px; background: linear-gradient(135deg, #6366f1, #4338ca); box-shadow: inset 0 0 0 6px rgba(255, 255, 255, .18); }
.menu { display: flex; align-items: center; gap: 24px; flex: 1; }
.menu nav { display: flex; gap: 4px; flex: 1; }
.menu nav a { color: var(--muted); font-weight: 500; padding: 7px 12px; border-radius: 8px; }
.menu nav a:hover { background: var(--primary-soft); color: var(--primary); text-decoration: none; }
.user { display: flex; align-items: center; gap: 10px; margin: 0; }
.user .name { color: var(--muted); font-size: 14px; }
.nav-toggle { position: absolute; opacity: 0; pointer-events: none; }
.burger { display: none; margin-left: auto; width: 44px; height: 44px; border-radius: 10px; cursor: pointer; align-items: center; justify-content: center; flex-direction: column; gap: 5px; }
.burger span { display: block; width: 20px; height: 2px; background: var(--fg); border-radius: 2px; }
.nav-toggle:focus-visible + .burger { outline: 2px solid var(--primary); }

/* Contenu */
main { max-width: 1120px; margin: 0 auto; padding: 28px 20px 56px; }
h1 { font-size: 26px; line-height: 1.25; letter-spacing: -.02em; margin: 0 0 20px; display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
h2 { font-size: 16px; margin: 32px 0 12px; letter-spacing: -.01em; }
.muted { color: var(--muted); }
.inline { display: inline-flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 0; }

/* Boutons */
button, .btn { font: inherit; font-weight: 600; font-size: 14px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; padding: 0 16px; border: 1px solid transparent; border-radius: 10px; background: var(--primary); color: #fff; cursor: pointer; transition: background .15s, box-shadow .15s; }
button:hover, .btn:hover { background: var(--primary-hover); text-decoration: none; }
.btn.secondary, button.secondary { background: var(--surface); color: var(--fg); border-color: #cbd5e1; }
.btn.secondary:hover, button.secondary:hover { background: #f8fafc; }
button.link { background: none; border: 0; color: var(--primary); min-height: 0; padding: 4px 8px; font-weight: 500; }
button.link:hover { background: var(--primary-soft); border-radius: 6px; }

/* Cartes de synthèse */
.cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 8px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px; color: var(--muted); font-size: 14px; display: flex; flex-direction: column; gap: 4px; }
a.card { color: var(--muted); transition: transform .15s, border-color .15s; }
a.card:hover { text-decoration: none; border-color: #c7d2fe; transform: translateY(-1px); }
.card b { font-size: 32px; line-height: 1.1; color: var(--fg); letter-spacing: -.02em; }

/* Badges */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 600; white-space: nowrap; vertical-align: middle; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.ok { background: var(--okbg); color: var(--ok); }
.badge.soon { background: var(--soonbg); color: var(--soon); }
.badge.ko { background: var(--kobg); color: var(--ko); }
.badge.na { background: #e2e8f0; color: var(--muted); }
h1 .badge { font-size: 13px; }

/* Tableaux */
table { width: 100%; border-collapse: separate; border-spacing: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
th, td { text-align: left; padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { background: #f8fafc; color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
tbody tr:last-child td, table tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: #fafbff; }
td.empty { color: var(--muted); text-align: center; padding: 28px 16px; }

/* Formulaires */
form.stack p { margin: 0 0 18px; }
form.stack label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 6px; }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=number], select, textarea {
  width: 100%; max-width: 480px; min-height: 42px; padding: 9px 12px; border: 1px solid #cbd5e1; border-radius: 10px; font: inherit; background: var(--surface); color: var(--fg);
}
input[type=file] { max-width: 100%; font: inherit; }
input:focus, select:focus, textarea:focus { outline: 0; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(67, 56, 202, .18); }
input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--primary); vertical-align: middle; }
.helptext { display: block; color: var(--muted); font-size: 13px; margin-top: 4px; }
.errorlist { list-style: none; margin: 0 0 6px; padding: 0; color: var(--ko); font-size: 13px; font-weight: 500; }

/* Messages et zones */
.msg { padding: 12px 16px; border-radius: 10px; margin-bottom: 16px; background: var(--primary-soft); border: 1px solid #c7d2fe; overflow-wrap: anywhere; }
.msg.success { background: var(--okbg); border-color: #a7f3d0; }
.msg.error { background: var(--kobg); border-color: #fecaca; }
.box { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 28px; max-width: 460px; margin: 24px auto 0; }
.box h1 { margin-bottom: 16px; }
.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 20px; flex-wrap: wrap; }
.toolbar input[type=text] { width: 280px; }
.toolbar select { width: auto; min-width: 0; }
.qr { width: 200px; height: 200px; display: block; margin: 12px 0; border: 1px solid var(--line); border-radius: 10px; padding: 8px; background: #fff; }
code { background: #f1f5f9; padding: 2px 6px; border-radius: 6px; font-size: 13px; overflow-wrap: anywhere; }
.lead { line-height: 1.7; margin: 0 0 20px; }
.steps { padding-left: 22px; margin: 16px 0 20px; }
.steps li { margin-bottom: 18px; padding-left: 4px; }
.store-group { margin-top: 10px; }
.store-name { display: block; font-weight: 600; font-size: 14px; margin-bottom: 6px; }
.store-links { display: flex; flex-wrap: wrap; gap: 8px; }
.store-links .btn { min-height: 38px; }
.btn.danger, button.danger { background: #fff; color: var(--ko); border-color: #fca5a5; }
.btn.danger:hover, button.danger:hover { background: var(--ko); color: #fff; border-color: var(--ko); }

/* Mobile */
@media (max-width: 820px) {
  .cards { grid-template-columns: repeat(2, 1fr); gap: 12px; }
}
@media (max-width: 720px) {
  body { font-size: 16px; }
  .bar { flex-wrap: wrap; gap: 0; padding: 0 16px; min-height: 56px; }
  .burger { display: flex; }
  .menu { display: none; flex-basis: 100%; flex-direction: column; align-items: stretch; gap: 8px; padding: 8px 0 16px; border-top: 1px solid var(--line); }
  .nav-toggle:checked ~ .menu { display: flex; }
  .menu nav { flex-direction: column; }
  .menu nav a { padding: 12px; font-size: 16px; }
  .user { justify-content: space-between; padding: 8px 12px 0; border-top: 1px solid var(--line); }
  main { padding: 20px 16px 40px; }
  h1 { font-size: 22px; }
  button, .btn { min-height: 46px; }
  input[type=text], input[type=email], input[type=password], input[type=date], input[type=number], select, textarea { font-size: 16px; min-height: 46px; max-width: none; }
  .toolbar { flex-direction: column; align-items: stretch; }
  .toolbar .inline, .toolbar form { display: flex; width: 100%; }
  .toolbar input[type=text] { flex: 1; width: auto; }
  .toolbar .btn, .toolbar > button { width: 100%; }
  .box { padding: 20px; margin-top: 8px; }

  /* Tableaux -> cartes empilées */
  table, tbody, tr, td { display: block; width: 100%; }
  table { background: none; border: 0; box-shadow: none; overflow: visible; }
  tr:has(th) { display: none; }
  tr { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 12px; padding: 6px 0; }
  td { display: flex; justify-content: space-between; gap: 16px; text-align: right; padding: 8px 16px; border: 0; overflow-wrap: anywhere; }
  td::before { content: attr(data-label); flex: none; color: var(--muted); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; text-align: left; padding-top: 2px; }
  td.empty { display: block; text-align: center; }
  td.empty::before { content: none; }
  tbody tr:hover td { background: none; }
}
