:root {
    --bg: #f4f5f7; --card: #fff; --ink: #16181d; --muted: #6b7280; --line: #e3e5ea;
    --accent: #0a66d6; --accent-ink: #fff; --ok: #1f9d55; --warn: #c2410c; --radius: 12px;
  }
  * { box-sizing: border-box; }
  body { margin: 0; font: 15px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif; background: var(--bg); color: var(--ink); }
  button, input, select { font: inherit; }
  button { cursor: pointer; border: 1px solid var(--line); background: var(--card); color: var(--ink); border-radius: 8px; padding: 7px 12px; }
  button:hover { border-color: #c7cbd3; }
  button.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
  button.danger { color: #b42318; }
  button.small { padding: 4px 9px; font-size: 13px; }
  button:disabled { opacity: .5; cursor: default; }
  input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], select {
    border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; background: #fff; width: 100%;
  }
  label { display: block; font-size: 13px; color: var(--muted); margin: 10px 0 4px; }
  .hidden { display: none !important; }
  .muted { color: var(--muted); }
  .row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
  .grow { flex: 1; min-width: 0; }

  /* Connexion */
  form.auth { max-width: 360px; margin: 12vh auto; background: var(--card); padding: 28px; border-radius: var(--radius); box-shadow: 0 2px 20px rgba(0,0,0,.06); }
  form.auth h1 { margin: 0 0 4px; font-size: 22px; }
  form.auth button { width: 100%; margin-top: 18px; }
  .error { color: #b42318; font-size: 14px; margin-top: 10px; min-height: 1em; }

  /* Mise en page */
  header { display: flex; align-items: center; gap: 12px; padding: 12px 20px; background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
  header h1 { font-size: 17px; margin: 0; }
  header .who { margin-left: auto; color: var(--muted); font-size: 14px; }
  #app { display: grid; grid-template-columns: 260px 1fr; min-height: calc(100vh - 54px); }
  nav { border-right: 1px solid var(--line); background: #fafbfc; padding: 14px; }
  nav h2 { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 6px 4px 8px; }
  nav .item { display: block; width: 100%; text-align: left; border: 0; background: transparent; padding: 8px 10px; border-radius: 8px; }
  nav .item.active { background: #e8f0fc; color: var(--accent); font-weight: 600; }
  nav .item small { display: block; color: var(--muted); font-weight: 400; }
  main { padding: 22px 28px 60px; max-width: 1100px; }
  main h2 { margin: 0 0 4px; font-size: 22px; }
  section.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; margin-top: 16px; }
  section.card h3 { margin: 0 0 10px; font-size: 16px; }
  .grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
  .list > * + * { border-top: 1px solid var(--line); }
  .screen { display: grid; grid-template-columns: 1fr auto; gap: 8px; padding: 10px 0; align-items: center; }
  .dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: #c4c8cf; margin-right: 6px; }
  .dot.on { background: var(--ok); }

  /* Éditeur */
  .editor { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 20px; align-items: start; }
  .preview-wrap { position: sticky; top: 74px; }
  .preview { aspect-ratio: 16/9; border-radius: var(--radius); overflow: hidden; position: relative; color: #fff; background: #222; background-size: cover; background-position: center; }
  .preview .shade { position: absolute; inset: 0; }
  .preview .txt { position: absolute; inset: 0; padding: 7%; display: flex; flex-direction: column; }
  .preview .shop { font-size: 20px; font-weight: 700; }
  .preview .tag { font-size: 9px; letter-spacing: .1em; text-transform: uppercase; opacity: .85; }
  .preview .promo { margin-top: auto; margin-bottom: auto; }
  .preview .ptitle { font-size: 22px; font-weight: 700; line-height: 1.1; }
  .preview .pdetail { font-size: 10px; opacity: .9; margin-top: 4px; }
  .preview .price { display: inline-block; margin-top: 6px; padding: 3px 9px; border-radius: 999px; background: rgba(0,0,0,.35); font-weight: 700; font-size: 12px; }
  .preview .logo { position: absolute; right: 6%; top: 7%; max-width: 22%; max-height: 18%; }
  .preview .badge { position: absolute; left: 8px; bottom: 8px; font-size: 11px; background: rgba(0,0,0,.45); padding: 2px 8px; border-radius: 999px; }
  .save { font-size: 13px; color: var(--muted); margin-top: 8px; }
  .chips { display: flex; flex-wrap: wrap; gap: 8px; }
  .chip { border-radius: 999px; padding: 6px 12px; display: flex; gap: 6px; align-items: center; }
  .chip.on { background: var(--accent); color: #fff; border-color: var(--accent); }
  .swatch { width: 14px; height: 14px; border-radius: 50%; display: inline-block; }
  .seg { display: inline-flex; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; }
  .seg button { border: 0; border-radius: 0; }
  .seg button.on { background: var(--accent); color: #fff; }
  .photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; margin-top: 10px; }
  .photos .ph { position: relative; aspect-ratio: 16/10; border-radius: 8px; background: #ddd center/cover; }
  .photos .ph button { position: absolute; top: 4px; right: 4px; padding: 0 7px; background: rgba(0,0,0,.6); color: #fff; border: 0; }
  .promo-row { display: grid; grid-template-columns: 46px 1fr 1fr 120px 64px auto; gap: 6px; padding: 8px 0; align-items: center; }
  .sched-row { display: grid; grid-template-columns: 1fr 150px 150px auto; gap: 6px; padding: 6px 0; align-items: center; }
  .pad { display: grid; grid-template-columns: repeat(3, 38px); gap: 4px; }
  .pad button { height: 30px; padding: 0; }
  .pad button.on { background: var(--accent); border-color: var(--accent); }
  .logo-box { display: flex; gap: 12px; align-items: center; margin-top: 10px; }
  .logo-box img { max-height: 60px; max-width: 160px; background: repeating-conic-gradient(#eee 0 25%, #fff 0 50%) 0 0/14px 14px; border-radius: 6px; padding: 4px; }
  input[type=range] { width: 100%; }
  input[type=color] { width: 54px; height: 34px; border: 1px solid var(--line); border-radius: 8px; padding: 2px; background: #fff; }
  dialog { border: 0; border-radius: var(--radius); padding: 22px; width: min(440px, 92vw); box-shadow: 0 10px 40px rgba(0,0,0,.2); }
  dialog h3 { margin: 0 0 6px; }
  dialog .actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
  .toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: #16181d; color: #fff; padding: 10px 16px; border-radius: 10px; font-size: 14px; z-index: 50; }
  @media (max-width: 900px) {
    #app { grid-template-columns: 1fr; } nav { border-right: 0; border-bottom: 1px solid var(--line); }
    .editor { grid-template-columns: 1fr; } .preview-wrap { position: static; order: -1; }
    .promo-row, .sched-row, .grid2 { grid-template-columns: 1fr; }
  }

label.check { display: flex; gap: 8px; align-items: center; color: var(--ink); font-size: 14px; margin-top: 14px; }
button.link { border: 0; background: none; color: var(--accent); }
.banner { background: #fff4e5; border: 1px solid #f5c37a; color: #7a4100; padding: 12px 16px; border-radius: var(--radius); margin-top: 14px; }
.codes { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px 18px; font: 600 16px ui-monospace, Menlo, monospace; background: #f6f7f9; padding: 14px; border-radius: 10px; margin: 10px 0; }
.qr { width: 200px; height: 200px; image-rendering: pixelated; border: 1px solid var(--line); border-radius: 10px; }
.secret { font: 600 15px ui-monospace, Menlo, monospace; letter-spacing: .05em; }
table.t { width: 100%; border-collapse: collapse; font-size: 14px; }
table.t th { text-align: left; color: var(--muted); font-weight: 500; padding: 6px 8px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: #fff; }
table.t td { padding: 6px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.scroll { max-height: 420px; overflow: auto; border: 1px solid var(--line); border-radius: 10px; }
.pthumb { width: 46px; height: 46px; border-radius: 8px; background: #eee center/contain no-repeat; border: 1px solid var(--line); cursor: pointer; flex: none; }
.tag-ok { color: var(--ok); font-weight: 600; }
.tag-off { color: var(--muted); }
@media print { header, nav, .noprint { display: none !important; } }

/* Diffusion */
.onair { margin: 8px 0 4px; padding: 8px 12px; border-radius: 10px; background: #fff4e5; color: #7a4100; font-size: 14px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.onair.yes { background: #e7f6ec; color: #135c2e; }

/* Aperçu fidèle */
.preview { container-type: inline-size; }
.pv-bg { position: absolute; inset: 0; background-size: cover; background-position: center; }
.pv-bg.kb { animation: kb 14s ease-out both; }
@keyframes kb { from { transform: scale(1.04); } to { transform: scale(1.14) translateX(-2%); } }
.pv-head { position: absolute; left: 6%; top: 6%; right: 6%; z-index: 3; }
.pv-head .shop { font-size: 5.5cqw; font-weight: 700; }
.pv-head .tag { font-size: 1.5cqw; letter-spacing: .12em; text-transform: uppercase; opacity: .85; margin-top: .4cqw; }
.pv-logo { max-height: 9cqw; max-width: 34cqw; display: block; filter: drop-shadow(0 1px 4px rgba(0,0,0,.6)); }
.pv-stage { position: absolute; inset: 22% 6% 10% 6%; z-index: 2; text-shadow: 0 2px 10px rgba(0,0,0,.45); animation: pvin .9s cubic-bezier(.2,.9,.3,1.2) both; }
@keyframes pvin { from { opacity: 0; transform: translateX(6%); } to { opacity: 1; transform: none; } }
.pv-title { font-size: 5.6cqw; font-weight: 800; line-height: 1.05; }
.pv-detail { font-size: 2cqw; opacity: .92; margin-top: 1cqw; }
.pv-empty { opacity: .7; }
.pv-classic { height: 100%; display: flex; flex-direction: column; }
.pv-pill { display: inline-block; align-self: flex-start; margin-top: 1.6cqw; padding: .8cqw 2.4cqw; border-radius: 99px; background: rgba(0,0,0,.35); font-weight: 800; font-size: 3cqw; }
.pv-vedette { height: 100%; display: grid; grid-template-columns: 52% 1fr; align-items: center; gap: 3%; }
.pv-vedette.noimg { grid-template-columns: 1fr; text-align: center; }
.pv-vedette.noimg .pv-side { display: flex; flex-direction: column; align-items: center; }
.pv-hero { position: relative; height: 100%; display: grid; place-items: center; animation: pvhero 1s cubic-bezier(.2,.9,.3,1.3) both; }
@keyframes pvhero { from { opacity: 0; transform: translateX(30%) scale(.4) rotate(-18deg); } to { opacity: 1; transform: none; } }
.pv-halo { position: absolute; width: 95%; aspect-ratio: 1; border-radius: 50%; filter: blur(6px); animation: breathe 3s ease-in-out infinite; }
@keyframes breathe { 50% { transform: scale(1.06); } }
.pv-pic { position: relative; background: center/cover no-repeat; box-shadow: 0 1.5cqw 3cqw rgba(0,0,0,.45); }
.pv-pic.card { width: 78%; aspect-ratio: 1; border-radius: 6%; border: .5cqw solid rgba(255,255,255,.85); animation: float 3.6s ease-in-out infinite; }
.pv-pic.round { width: 100%; height: 100%; border-radius: 50%; border: .5cqw solid #fff; }
@keyframes float { 50% { transform: translateY(-3%) rotate(1.5deg); } }
.pv-side { display: flex; flex-direction: column; gap: 1.5cqw; }
.pv-burst { width: 22cqw; aspect-ratio: 1.6; display: grid; place-items: center; transform: rotate(-7deg); animation: pop .6s .9s cubic-bezier(.2,1.6,.4,1) both;
  background: linear-gradient(135deg, #ffe27a, var(--gold), #e8a317);
  clip-path: polygon(50% 0%,56% 9%,65% 2%,69% 12%,79% 6%,80% 17%,91% 14%,88% 25%,99% 26%,93% 36%,100% 44%,92% 50%,100% 56%,93% 64%,99% 74%,88% 75%,91% 86%,80% 83%,79% 94%,69% 88%,65% 98%,56% 91%,50% 100%,44% 91%,35% 98%,31% 88%,21% 94%,20% 83%,9% 86%,12% 75%,1% 74%,7% 64%,0% 56%,8% 50%,0% 44%,7% 36%,1% 26%,12% 25%,9% 14%,20% 17%,21% 6%,31% 12%,35% 2%,44% 9%); }
.pv-burst span { font-weight: 900; font-size: 3.4cqw; filter: brightness(.55); text-shadow: none; padding: 0 12%; text-align: center; line-height: 1.05; }
@keyframes pop { from { opacity: 0; transform: scale(0) rotate(-45deg); } to { opacity: 1; transform: rotate(-7deg); } }
.pv-plein { height: 100%; display: flex; align-items: flex-end; justify-content: space-between; gap: 3cqw; }
.pv-plein .pv-texts { max-width: 62%; }
.pv-etiquette { height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1.5cqw; }
.pv-etiquette .pv-title { font-size: 4.4cqw; }
.pv-medal { position: relative; width: 24cqw; aspect-ratio: 1; border-radius: 50%; padding: 1cqw; isolation: isolate; animation: pvhero 1s cubic-bezier(.2,.9,.3,1.3) both; }
.pv-medal::before { content: ''; position: absolute; inset: 0; border-radius: 50%; z-index: -1; filter: drop-shadow(0 0 1.5cqw var(--ring));
  background: conic-gradient(var(--ring), #fff, var(--ring), #fff, var(--ring)); animation: spin 8s linear infinite; }
@keyframes spin { to { rotate: 360deg; } }
@keyframes unspin { to { rotate: -360deg; } }
.pv-tag { position: absolute; left: 92%; top: 4cqw; padding: 1cqw 2.4cqw; border-radius: 1.4cqw; font-weight: 900; font-size: 3cqw; text-shadow: none;
  background: linear-gradient(#fff4c2, var(--gold)); filter: drop-shadow(0 .8cqw 1cqw rgba(0,0,0,.4)); transform-origin: 50% -5cqw; animation: swing 2.4s ease-in-out infinite; white-space: nowrap; }
@keyframes swing { 0%,100% { transform: rotate(7deg); } 50% { transform: rotate(-5deg); } }
.pv-dots { position: absolute; left: 6%; bottom: 5%; display: flex; gap: .8cqw; z-index: 3; }
.pv-dots i { width: 1.2cqw; height: 1.2cqw; border-radius: 9px; background: #fff; opacity: .45; }
.pv-dots i.on { width: 4cqw; opacity: 1; }
.pv-garland { position: absolute; left: 0; right: 0; top: 0; height: 7cqw; z-index: 4; display: flex; justify-content: space-around; align-items: flex-start;
  background: radial-gradient(ellipse 60% 100% at 50% -40%, transparent 70%, rgba(20,60,30,.9) 71%, transparent 76%); }
.pv-garland i { width: 1.4cqw; height: 1.8cqw; border-radius: 50%; margin-top: 2cqw; box-shadow: 0 0 1.6cqw currentColor; animation: twinkle 1.5s ease-in-out infinite alternate; }
.pv-garland i:nth-child(odd) { margin-top: 3.6cqw; }
@keyframes twinkle { to { opacity: .35; } }
.pv-snow { position: absolute; inset: -20% 0 0 0; z-index: 4; pointer-events: none;
  background-image: radial-gradient(circle, #fff 0 1.5px, transparent 2px), radial-gradient(circle, rgba(255,255,255,.8) 0 1px, transparent 1.5px);
  background-size: 60px 60px, 37px 37px; background-position: 0 0, 18px 22px; animation: snow 9s linear infinite; opacity: .85; }
.pv-snow.s2 { background-size: 90px 90px, 51px 51px; animation-duration: 14s; opacity: .55; }
@keyframes snow { to { transform: translateY(20%); background-position: 30px 120px, 0 140px; } }
.pv-hearts, .pv-confetti { position: absolute; inset: 0; z-index: 4; pointer-events: none; opacity: .7; animation: snow 12s linear infinite; }
.pv-hearts { background-image: radial-gradient(circle, #ff8fb1 0 3px, transparent 4px); background-size: 70px 70px; }
.pv-confetti { background-image: linear-gradient(45deg, #ffd60a 0 4px, transparent 4px), linear-gradient(-30deg, #ff3b30 0 4px, transparent 4px); background-size: 50px 50px, 64px 64px; }
.preview .badge { z-index: 5; left: auto; right: 8px; }
.pv-logo.plaque { background: rgba(255,255,255,.92); padding: .9cqw 1.6cqw; border-radius: 1.4cqw; box-shadow: 0 .8cqw 2cqw rgba(0,0,0,.35); filter: none; max-height: 11cqw; }
