/* =========================================================
   QR codes Polpoz — charte graphique (livre de marque)
   Typo : Redonda (déposer les fichiers dans /assets/fonts/)
          à défaut : Nunito, police libre aux formes proches
   ========================================================= */

@font-face { font-family: "Redonda"; font-weight: 500; font-style: normal; font-display: swap;
  src: local("Redonda Medium"), local("Redonda-Medium"), url("../fonts/Redonda-Medium.woff2") format("woff2"); }
@font-face { font-family: "Redonda"; font-weight: 500; font-style: italic; font-display: swap;
  src: local("Redonda Medium Italic"), local("Redonda-MediumItalic"), url("../fonts/Redonda-MediumItalic.woff2") format("woff2"); }
@font-face { font-family: "Redonda"; font-weight: 800; font-style: normal; font-display: swap;
  src: local("Redonda ExtraBold"), local("Redonda-ExtraBold"), url("../fonts/Redonda-ExtraBold.woff2") format("woff2"); }

@font-face { font-family: "PolpozFallback"; font-weight: 500; font-style: normal; font-display: swap; src: url("../fonts/nunito-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "PolpozFallback"; font-weight: 500; font-style: italic; font-display: swap; src: url("../fonts/nunito-latin-500-italic.woff2") format("woff2"); }
@font-face { font-family: "PolpozFallback"; font-weight: 700; font-style: normal; font-display: swap; src: url("../fonts/nunito-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "PolpozFallback"; font-weight: 800; font-style: normal; font-display: swap; src: url("../fonts/nunito-latin-800-normal.woff2") format("woff2"); }

:root {
  /* Trio vert */
  --vert-clair: #d6db58; --vert: #0f825e; --vert-fonce: #0a4f38;
  /* Trio orange / fuchsia */
  --orange: #ffb061; --fuchsia: #ad006b; --rose-fonce: #660045;
  /* Trio rose / violet */
  --rose-clair: #ffc9d1; --violet: #6652cc; --violet-fonce: #3d3682;
  /* Base neutre */
  --creme: #f5f0e8; --blanc: #ffffff;

  --ink: var(--violet-fonce);
  --muted: #6f6a8f;
  --line: #e4ddd0;
  --radius: 20px;
  --font: "Redonda", "PolpozFallback", system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--creme); color: var(--ink);
  font-family: var(--font); font-weight: 500; font-size: 16px; line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--vert); }
h1, h2, h3 { font-weight: 800; line-height: 1.12; margin: 0 0 .5em; letter-spacing: -.01em; }
h1 em, h2 em { font-style: italic; font-weight: 500; }
small { font-size: .8em; }
.muted { color: var(--muted); }
code { background: var(--creme); padding: .1em .4em; border-radius: 6px; font-weight: 800; }

/* ---------- Barre du haut ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px clamp(16px, 4vw, 40px); background: var(--blanc);
  border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10;
}
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.brand-logo { height: 40px; width: 59px; display: block; }
.brand-sub { font-weight: 800; color: var(--vert-fonce); background: var(--vert-clair); padding: 3px 10px; border-radius: 99px; font-size: .85rem; }
.topnav { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.topnav a, .linklike {
  color: var(--ink); text-decoration: none; font: inherit; font-weight: 700; font-size: .92rem;
  padding: 7px 12px; border-radius: 99px; background: none; border: 0; cursor: pointer;
}
.topnav a:hover, .linklike:hover { background: var(--creme); }
.topnav a.is-active { background: var(--vert-fonce); color: #fff; }
.topnav form { margin: 0; }

.wrap { max-width: 1200px; margin: 0 auto; padding: clamp(20px, 4vw, 44px) clamp(16px, 4vw, 40px) 80px; }

/* ---------- Titres façon livre de marque ---------- */
.page-title { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; flex-wrap: wrap; margin-bottom: 28px; }
.page-title h1 { font-size: clamp(2rem, 5vw, 3.2rem); color: var(--violet); margin: 0; }
.crumbs { margin-bottom: 14px; }
.crumbs a { text-decoration: none; font-weight: 700; color: var(--muted); }
.crumbs a:hover { color: var(--vert); }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin: 44px 0 16px; }
.section-head h2 { font-size: 1.5rem; margin: 0; color: var(--violet-fonce); }
.section-head em { color: var(--violet); }
.section-head.tight { margin: 0 0 12px; }
.section-head.tight h3 { margin: 0; }

/* ---------- Cartes « sticker » ---------- */
.card {
  background: var(--blanc); border-radius: var(--radius); padding: clamp(18px, 2.5vw, 26px);
  border: 1px solid var(--line);
}
.card h3 { font-size: 1.05rem; color: var(--violet-fonce); }

/* ---------- Boutons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-weight: 800; font-size: .95rem; line-height: 1;
  padding: 13px 20px; border-radius: 99px; border: 2.5px solid var(--vert-fonce);
  background: var(--vert); color: #fff; cursor: pointer; text-decoration: none;
  box-shadow: 0 4px 0 var(--vert-fonce); transition: transform .08s, box-shadow .08s;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 5px 0 var(--vert-fonce); }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--vert-fonce); }
.btn:focus-visible, input:focus-visible, textarea:focus-visible, button:focus-visible, a:focus-visible { outline: 3px solid var(--violet); outline-offset: 2px; }
.btn-secondary { background: var(--violet); border-color: var(--violet-fonce); box-shadow: 0 4px 0 var(--violet-fonce); }
.btn-secondary:hover { box-shadow: 0 5px 0 var(--violet-fonce); }
.btn-ghost { background: var(--blanc); color: var(--ink); border-color: var(--ink); box-shadow: 0 3px 0 var(--ink); }
.btn-danger { background: var(--fuchsia); border-color: var(--rose-fonce); box-shadow: 0 3px 0 var(--rose-fonce); }
.btn-sm { padding: 9px 14px; font-size: .85rem; }
.btn-block { width: 100%; }

/* ---------- Formulaires ---------- */
label { display: block; font-weight: 700; font-size: .9rem; margin-bottom: 14px; color: var(--ink); }
input[type=text], input[type=email], input[type=password], input[type=search], input:not([type]), textarea {
  display: block; width: 100%; margin-top: 6px; font: inherit; font-weight: 500; color: var(--ink);
  padding: 11px 14px; border-radius: 12px; border: 2px solid var(--line); background: #fff;
}
input:focus, textarea:focus { border-color: var(--violet); outline: none; }
textarea { resize: vertical; }
.hint { font-size: .85rem; color: var(--muted); margin: -4px 0 14px; }
.hint.warn { color: var(--fuchsia); font-weight: 700; }
.slug-input { display: flex; align-items: stretch; margin-top: 6px; border: 2px solid var(--line); border-radius: 12px; overflow: hidden; background: #fff; }
.slug-input:focus-within { border-color: var(--violet); }
.slug-input span { background: var(--creme); padding: 11px 10px; color: var(--muted); font-weight: 500; white-space: nowrap; font-size: .9rem; display: flex; align-items: center; }
.slug-input input { border: 0; margin: 0; border-radius: 0; min-width: 0; }
.switch { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.switch input { appearance: none; width: 44px; height: 26px; border-radius: 99px; background: var(--line); position: relative; cursor: pointer; flex: none; margin: 0; transition: background .15s; }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.switch input:checked { background: var(--vert); }
.switch input:checked::after { transform: translateX(18px); }

.flash { padding: 12px 16px; border-radius: 14px; font-weight: 700; margin-bottom: 20px; }
.flash-ok { background: var(--vert-clair); color: var(--vert-fonce); }
.flash-err { background: var(--rose-clair); color: var(--rose-fonce); }
.tag { display: inline-block; font-size: .72rem; font-weight: 800; padding: 3px 9px; border-radius: 99px; background: var(--creme); color: var(--muted); vertical-align: middle; }
.tag-pause { background: var(--orange); color: var(--rose-fonce); }

/* ---------- Création ---------- */
.create { display: none; margin-bottom: 8px; border: 2.5px solid var(--vert); box-shadow: 0 0 0 7px rgba(214, 219, 88, .55); }
.create.is-open, .create:target { display: block; }
.create h2 { color: var(--vert-fonce); font-size: 1.3rem; }
.create-grid { display: grid; grid-template-columns: 1fr 1.4fr 1fr auto; gap: 14px; align-items: end; }
.create-grid label { margin-bottom: 0; }
.create-grid .btn { height: 48px; }
.create .hint { margin: 14px 0 0; }

/* ---------- Tuiles chiffres (trios de couleurs) ---------- */
.tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.tile { border-radius: var(--radius); padding: 18px 20px; display: flex; flex-direction: column; gap: 2px; min-height: 130px; }
.tile strong { font-size: clamp(2rem, 4vw, 2.7rem); font-weight: 800; line-height: 1.05; letter-spacing: -.02em; }
.tile strong.small { font-size: 1.5rem; margin-top: 8px; }
.tile-label { font-weight: 800; font-size: .88rem; }
.tile-foot { font-size: .82rem; margin-top: auto; opacity: .85; }
.t-vert { background: var(--vert-clair); color: var(--vert-fonce); }
.t-orange { background: var(--orange); color: var(--rose-fonce); }
.t-rose { background: var(--rose-clair); color: var(--violet-fonce); }
.t-creme { background: var(--blanc); color: var(--vert-fonce); border: 1px solid var(--line); }

.period { display: inline-flex; background: var(--blanc); border: 1px solid var(--line); border-radius: 99px; padding: 4px; gap: 2px; }
.period a { text-decoration: none; color: var(--ink); font-weight: 700; font-size: .85rem; padding: 6px 12px; border-radius: 99px; }
.period a:hover { background: var(--creme); }
.period a.is-active { background: var(--violet); color: #fff; }

/* ---------- Grilles ---------- */
.grid-main { display: grid; grid-template-columns: 1.7fr 1fr; gap: 16px; margin-top: 16px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-top: 16px; margin-bottom: 16px; }
.grid-detail { display: grid; grid-template-columns: minmax(300px, 420px) 1fr; gap: 16px; align-items: start; }

.chart-box { position: relative; height: 260px; }

/* Classements */
.toplist { list-style: none; padding: 0; margin: 0; counter-reset: t; }
.toplist li { margin-bottom: 12px; counter-increment: t; }
.toplist a { display: flex; justify-content: space-between; gap: 10px; text-decoration: none; color: var(--ink); font-weight: 700; font-size: .92rem; }
.toplist a span::before { content: counter(t) ". "; color: var(--violet); }
.toplist a:hover span { color: var(--vert); }
.bk-bar { display: block; height: 8px; background: var(--creme); border-radius: 99px; overflow: hidden; margin-top: 5px; grid-column: 1 / -1; }
.bk-bar i { display: block; height: 100%; background: var(--violet); border-radius: 99px; }
.breakdown ul { list-style: none; padding: 0; margin: 0; }
.breakdown li { display: grid; grid-template-columns: 1fr auto; margin-bottom: 11px; font-size: .9rem; }
.bk-label { font-weight: 700; }
.bk-val { font-weight: 800; }
.bk-val small { color: var(--muted); font-weight: 500; margin-left: 4px; }
.tone-vert .bk-bar i { background: var(--vert); }
.tone-orange .bk-bar i { background: var(--orange); }
.tone-violet .bk-bar i { background: var(--violet); }
.tone-rose .bk-bar i { background: var(--fuchsia); }

/* ---------- Liste des QR codes ---------- */
.search { max-width: 280px; margin: 0; border-radius: 99px; }
.qr-list { display: grid; gap: 12px; }
.qr-row { display: grid; grid-template-columns: 84px 1fr auto auto; gap: 20px; align-items: center; padding: 14px 20px 14px 14px; transition: border-color .15s; }
.qr-row:hover { border-color: var(--vert-clair); }
.qr-row.is-paused { opacity: .7; }
.qr-thumb { width: 84px; height: 84px; border-radius: 14px; background: var(--creme); display: grid; place-items: center; overflow: hidden; padding: 6px; }
.qr-thumb canvas, .qr-thumb svg { width: 100% !important; height: 100% !important; display: block; }
.qr-info { min-width: 0; }
.qr-info h3 { margin: 0 0 2px; font-size: 1.08rem; }
.qr-info h3 a { color: var(--violet-fonce); text-decoration: none; }
.qr-info h3 a:hover { color: var(--vert); }
.qr-info p { margin: 0; font-size: .88rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qr-target a { color: var(--muted); text-decoration: none; }
.qr-target a:hover { text-decoration: underline; }
.copy {
  font: inherit; font-weight: 800; color: var(--vert); background: none; border: 0; padding: 0; cursor: pointer;
  border-bottom: 2px dashed var(--vert-clair);
}
.copy:hover { color: var(--vert-fonce); }
.copy.is-copied { color: var(--fuchsia); border-color: var(--rose-clair); }
.qr-nums { display: flex; gap: 22px; align-items: center; text-align: right; }
.qr-nums strong { display: block; font-size: 1.4rem; line-height: 1; }
.qr-nums span { font-size: .75rem; color: var(--muted); }
.qr-last { font-size: .78rem; color: var(--muted); min-width: 92px; }
.empty { text-align: center; padding: 40px; }

/* ---------- Designer ---------- */
.designer { text-align: center; position: sticky; top: 90px; }
.qr-preview-wrap {
  background: repeating-conic-gradient(#f1ece3 0 25%, #fff 0 50%) 0 0 / 18px 18px;
  border-radius: 16px; padding: 18px; display: grid; place-items: center;
}
.qr-preview { width: 100%; max-width: 300px; aspect-ratio: 1; }
.qr-preview canvas, .qr-preview svg { width: 100% !important; height: auto !important; display: block; }
.qr-short.big { font-size: 1.05rem; margin: 16px 0; }
.dl { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.custom { text-align: left; margin-top: 22px; border-top: 1px solid var(--line); padding-top: 14px; }
.custom summary, .advanced summary { cursor: pointer; font-weight: 800; color: var(--violet); margin-bottom: 10px; }
fieldset { border: 0; padding: 0; margin: 0 0 14px; }
legend { font-weight: 700; font-size: .85rem; margin-bottom: 8px; padding: 0; }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.swatches button {
  width: 34px; height: 34px; border-radius: 50%; background: var(--c); cursor: pointer;
  border: 2px solid rgba(0,0,0,.12); padding: 0; transition: transform .1s;
}
.swatches button:hover { transform: scale(1.1); }
.swatches button.is-on { box-shadow: 0 0 0 3px #fff, 0 0 0 5px var(--violet); }
.swatches .sw-transp { background: repeating-conic-gradient(#ddd 0 25%, #fff 0 50%) 0 0 / 10px 10px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips button { font: inherit; font-weight: 700; font-size: .82rem; padding: 6px 12px; border-radius: 99px; border: 2px solid var(--line); background: #fff; color: var(--ink); cursor: pointer; }
.chips button.is-on { background: var(--violet-fonce); border-color: var(--violet-fonce); color: #fff; }
.save-state { font-size: .8rem; min-height: 1.2em; margin: 8px 0 0; }
.advanced { margin: 6px 0 16px; }
.form h2 { color: var(--violet-fonce); font-size: 1.25rem; }

/* ---------- Tableaux ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th { text-align: left; font-weight: 800; padding: 8px 10px; border-bottom: 2px solid var(--ink); white-space: nowrap; }
.table td { padding: 9px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }

.danger { margin-top: 16px; border-color: var(--rose-clair); }
.danger h3 { color: var(--fuchsia); }
.danger-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.danger p { font-size: .88rem; margin: 0 0 10px; }
.danger .row { display: flex; gap: 8px; }
.danger .row input { margin: 0; max-width: 200px; }

.userlist { list-style: none; padding: 0; margin: 0 0 20px; }
.userlist li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.userlist form { margin: 0; }
.inline-form h3 { margin-top: 10px; }

/* ---------- Connexion ---------- */
.auth { display: grid; grid-template-columns: 1.1fr 1fr; gap: 0; min-height: calc(100vh - 88px); max-width: 1000px; margin: 0 auto; border-radius: 28px; overflow: hidden; background: #fff; }
.auth-side { background: var(--vert); color: #fff; padding: clamp(28px, 5vw, 56px); position: relative; overflow: hidden; display: flex; flex-direction: column; }
.auth-logo { width: 150px; height: 102px; display: block; margin-bottom: 40px; }
.auth-side h1 { font-size: clamp(2rem, 4.4vw, 3rem); color: #fff; }
.auth-side h1 em { color: var(--vert-clair); }
.auth-side p { font-size: 1.05rem; max-width: 26em; opacity: .95; }
.stickers { position: relative; margin-top: auto; height: 150px; }
.stickers span { position: absolute; border-radius: 26px; border: 4px solid var(--vert-fonce); }
.stickers .s1 { width: 92px; height: 92px; background: var(--vert-clair); left: 0; bottom: 0; transform: rotate(-12deg); box-shadow: 0 0 0 8px rgba(214,219,88,.35); }
.stickers .s2 { width: 74px; height: 74px; background: var(--rose-clair); border-color: var(--violet); left: 110px; bottom: 40px; transform: rotate(14deg); box-shadow: 0 0 0 8px rgba(255,201,209,.4); }
.stickers .s3 { width: 64px; height: 64px; background: var(--orange); border-color: var(--fuchsia); border-radius: 50%; left: 205px; bottom: 6px; box-shadow: 0 0 0 8px rgba(255,176,97,.4); }
.auth-form { border: 0; border-radius: 0; padding: clamp(28px, 5vw, 56px); display: flex; flex-direction: column; justify-content: center; }
.auth-form h2 { color: var(--violet); font-size: 1.7rem; }

/* ---------- Page publique (QR en pause / introuvable) ---------- */
body.public { display: grid; place-items: center; min-height: 100vh; padding: 20px; }
.public-card { background: #fff; border-radius: 28px; padding: 44px 32px; text-align: center; max-width: 440px; border: 3px solid var(--vert); box-shadow: 0 0 0 10px rgba(214,219,88,.55); }
.public-logo { width: 130px; height: 89px; display: block; margin: 0 auto 26px; }
.public-card h1 { color: var(--violet); font-size: 1.7rem; }
.public-card p { margin-bottom: 24px; }

/* ---------- Responsive ---------- */
@media (max-width: 980px) {
  .tiles, .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-main, .grid-detail, .grid-2 { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: 1fr; }
  .create-grid { grid-template-columns: 1fr 1fr; }
  .designer { position: static; }
  .qr-row { grid-template-columns: 72px 1fr auto; }
  .qr-row > .btn { display: none; }
  .qr-thumb { width: 72px; height: 72px; }
}
@media (max-width: 640px) {
  .brand-sub { display: none; }
  .brand-logo { height: 32px; width: 47px; }
  .topnav a, .linklike { padding: 6px 8px; font-size: .85rem; }
  .create-grid { grid-template-columns: 1fr; }
  .qr-row { grid-template-columns: 64px 1fr; gap: 14px; }
  .qr-thumb { width: 64px; height: 64px; }
  .qr-nums { grid-column: 1 / -1; justify-content: flex-start; text-align: left; }
  .auth { grid-template-columns: 1fr; border-radius: 22px; }
  .stickers { display: none; }
  .danger-grid { grid-template-columns: 1fr; }
  .search { max-width: none; width: 100%; }
  .period { overflow-x: auto; max-width: 100%; }
}

/* Choix du logo central */
.logos { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.logos button {
  height: 52px; border-radius: 14px; border: 2px solid var(--line); background: #fff; cursor: pointer;
  display: grid; place-items: center; padding: 8px; font: inherit; font-weight: 700; font-size: .82rem; color: var(--muted);
}
.logos svg { height: 30px; width: 44px; display: block; }
.logos .logo-blanc { background: var(--vert-fonce); border-color: var(--vert-fonce); }
.logos button:hover { border-color: var(--violet); }
.logos button.is-on { box-shadow: 0 0 0 3px #fff, 0 0 0 5px var(--violet); border-color: var(--violet); }
