/* The app (index.html) and its account pages (register, reset-password,
 * admin). Same dark look as the landing page: colours, radii, shadows and
 * fonts all come from css/tokens.css, loaded before this file. */

*{ box-sizing:border-box; }
[hidden]{ display:none !important; }
html,body{ margin:0; height:100%; }
body{
  background:var(--canvas);
  color:var(--ink);
  font:400 15px/1.5 var(--sans);
  -webkit-font-smoothing:antialiased;
  display:flex; flex-direction:column; height:100%; overflow:hidden;
}
:focus-visible{ outline:2px solid var(--focus); outline-offset:2px; }
button, input, select, textarea{ font-family:inherit; }

/* standalone account pages (register, reset-password): the card centred on the login backdrop */
body.auth-page{
  height:auto; min-height:100%; overflow-y:auto;
  align-items:center; justify-content:center; padding:24px 16px;
  background:var(--backdrop);
}

/* ---------- brand: the wordmark alone, same as on the landing page ---------- */
.brand{ display:inline-flex; align-items:center; text-decoration:none; color:var(--ink); }
.brand-name{ font-weight:200; letter-spacing:-.01em; white-space:nowrap; font-size:18px; }
.brand-name b{ font-weight:700; }

/* ---------- Header ---------- */
/* One left edge: in the overview the header content lines up with the project
   grid (both use --ov-side, measured on the viewport so the overview's own
   scrollbar doesn't shift it), in the editor with the form panel (26px). */
:root{ --ov-side:max(28px, calc((100vw - 1064px) / 2)); }
@media (max-width:520px){ :root{ --ov-side:16px; } }
header{
  flex:0 0 auto; position:relative; z-index:5;
  height:64px; padding:0 26px;
  display:flex; align-items:center; gap:14px;
  background:var(--bar); border-bottom:1px solid var(--line);
  -webkit-backdrop-filter:blur(16px); backdrop-filter:blur(16px);
}
header:has(#backBtn[hidden]){ padding-inline:var(--ov-side); }
header .sub{
  padding-left:14px; border-left:1px solid var(--line);
  font-size:13px; font-weight:600; color:var(--muted); white-space:nowrap;
}

/* ---------- Layout ---------- */
main{
  flex:1 1 auto; display:grid;
  grid-template-columns:400px 1fr;
  min-height:0;
}
/* Mobile layout overrides live at the END of this file (after all base
   component rules) so they win by source order — see the @media block below. */

/* ---------- Form panel ---------- */
.panel{
  background:var(--bg);
  border-right:1px solid var(--line);
  padding:28px 26px 60px;
  overflow-y:auto; min-height:0;
}
.group{ margin-bottom:32px; }
.group > .legend{
  font-size:13.5px; font-weight:650; color:var(--ink-2); margin-bottom:16px;
  display:flex; align-items:center; gap:12px;
}
.group > .legend::after{
  content:""; flex:1; height:1px; background:var(--line);
}
label.f{ display:block; margin-bottom:14px; }
label.f > span{
  display:block; font-size:13px; font-weight:600;
  color:var(--ink-2); margin-bottom:6px;
}
input[type=text], input[type=tel], input[type=email], input[type=url], input[type=password], textarea, select{
  width:100%; background:var(--canvas); color:var(--ink);
  border:1px solid var(--line-strong); border-radius:var(--radius-sm);
  padding:11px 14px; font-size:15px; line-height:1.3;
  transition:border-color .15s ease, box-shadow .15s ease;
}
select{
  -webkit-appearance:none; appearance:none; cursor:pointer; padding-right:38px;
  background:var(--canvas) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238D9097' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m7 10 5 5 5-5'/%3E%3C/svg%3E") no-repeat right 12px center / 18px;
}
input::placeholder, textarea::placeholder{ color:var(--faint); }
textarea{ resize:vertical; line-height:1.45; }
input:hover, textarea:hover, select:hover{ border-color:var(--muted); }
input:focus-visible, textarea:focus-visible, select:focus-visible{
  outline:none; border-color:var(--accent); box-shadow:0 0 0 3px var(--accent-ring);
}
/* keep the field look when the browser autofills (e.g. the password) */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus{
  -webkit-text-fill-color:var(--ink);
  -webkit-box-shadow:0 0 0 1000px var(--canvas) inset;
  box-shadow:0 0 0 1000px var(--canvas) inset;
  caret-color:var(--ink);
  transition:background-color 9999s ease-out 0s;
}
.row2{ display:grid; grid-template-columns:1fr 1fr; gap:12px; }
.stat-row{ display:grid; grid-template-columns:1fr 1.3fr 40px; gap:8px; margin-bottom:10px; align-items:center; }

/* small square icon buttons */
.row-del, .hdr-icon, .stbtn{
  display:inline-grid; place-items:center; padding:0;
  background:var(--bg); border:1px solid var(--line); border-radius:var(--radius-sm);
  color:var(--ink-2); cursor:pointer; line-height:1;
  transition:border-color .15s ease, background-color .15s ease, color .15s ease;
}
.row-del:hover, .hdr-icon:hover, .stbtn:hover{ border-color:var(--line-strong); background:var(--fill); color:var(--ink); }
.row-del svg, .hdr-icon svg, .stbtn svg{ width:18px; height:18px; fill:none; stroke:currentColor; stroke-width:1.9; stroke-linecap:round; stroke-linejoin:round; }
.row-del{ width:40px; height:44px; font-size:20px; }
.row-del:hover{ color:var(--danger); }

.add-row{
  width:100%; margin-top:2px; padding:11px 14px;
  background:none; border:1.5px dashed var(--line-strong); border-radius:var(--radius-sm);
  color:var(--ink-2); font-size:14px; font-weight:600; cursor:pointer;
  transition:border-color .15s ease, color .15s ease, background-color .15s ease;
}
.add-row:hover{ border-color:var(--accent); color:var(--accent); background:var(--accent-soft); }
.add-row:disabled{ opacity:.45; cursor:not-allowed; }

/* image overview */
.img-ov{ margin-top:20px; }
/* small section label, same as the group legends */
.img-ov-title{ font-size:13.5px; font-weight:650; color:var(--ink-2); margin-bottom:10px; }
.img-ov-grid{ display:flex; flex-wrap:wrap; gap:10px; }
.img-ov-empty{ font-size:13px; color:var(--muted); }
.img-thumb{ position:relative; background:none; border:none; padding:0; cursor:grab; width:60px; }
.img-thumb:active{ cursor:grabbing; }
.img-thumb .t{
  display:block; width:60px; height:60px; border-radius:var(--radius-sm);
  border:1px solid var(--line); background-size:cover; background-position:center;
  transition:border-color .15s ease, box-shadow .15s ease;
}
.img-thumb:hover .t{ border-color:var(--line-strong); box-shadow:var(--shadow-sm); }
.img-thumb[aria-current=true] .t{ border-color:var(--accent); box-shadow:0 0 0 2px var(--accent); }
.img-thumb.logo .t{ background-color:#D9DBE0; background-size:contain; background-repeat:no-repeat; } /* logos are mostly dark artwork */
.img-thumb-del{
  position:absolute; top:3px; right:3px; width:20px; height:20px; border:none; padding:0;
  background:rgba(0,0,0,.72); color:#fff; cursor:pointer; font-size:13px; line-height:1;
  opacity:0; transition:opacity .15s ease, background-color .15s ease;
}
.img-thumb:hover .img-thumb-del, .img-thumb:focus-within .img-thumb-del{ opacity:1; }
.img-thumb-del:hover{ background:var(--danger); }
.img-thumb .c{ display:block; margin-top:5px; font-size:11px; color:var(--muted); text-align:center; line-height:1.25; }

/* ---------- views ---------- */
.view{ flex:1 1 auto; min-height:0; }
#overview{ overflow-y:auto; }

/* header controls */
.hdr-back{
  background:none; border:none; color:var(--ink-2); cursor:pointer;
  font-size:14px; font-weight:600; padding:8px 12px 8px 0; margin-right:2px;
  border-right:1px solid var(--line);
}
.hdr-back:hover{ color:var(--accent); }
.hdr-right{ margin-left:auto; display:flex; align-items:center; gap:10px; }
/* beats the generic input rule above (same element, higher specificity) */
.hdr-right input.hdr-name{ width:220px; padding:9px 13px; font-size:14px; }
.hdr-icon{ width:40px; height:40px; }

/* buttons — same as on the landing page: silver for the action, dark beside it */
.btn-sm, button.export{
  display:inline-flex; align-items:center; justify-content:center; gap:8px;
  height:40px; padding:0 20px; border:none; border-radius:var(--radius-pill);
  background:var(--grad); color:var(--on-grad); box-shadow:var(--shadow-btn);
  font-size:14px; font-weight:600; line-height:1; white-space:nowrap; cursor:pointer; text-decoration:none;
  transition:transform .18s ease, box-shadow .18s ease;
}
.btn-sm:hover, button.export:hover{ transform:translateY(-1px); box-shadow:var(--shadow-btn-hover); }
.btn-ghost, button.ghost{
  display:inline-flex; align-items:center; justify-content:center; gap:8px;
  height:40px; padding:0 16px; border:1px solid var(--line-strong); border-radius:var(--radius-pill);
  background:var(--bg); color:var(--ink);
  font-size:14px; font-weight:600; line-height:1; white-space:nowrap; cursor:pointer; text-decoration:none;
  transition:border-color .18s ease, box-shadow .18s ease;
}
.btn-ghost:hover, button.ghost:hover{ border-color:var(--line-hover); background:var(--fill); }
.filebtn{ margin:0; }

/* ---------- overview / gallery ---------- */
.ov-inner{ padding:44px var(--ov-side) 72px; }
.ov-head{ display:flex; align-items:flex-end; justify-content:space-between; gap:20px; margin-bottom:28px; flex-wrap:wrap; }
.ov-title{ font-weight:700; font-size:clamp(2rem,1.6vw + 1.5rem,2.6rem); letter-spacing:-.035em; line-height:1.05; margin:0;
  background:var(--grad-text); -webkit-background-clip:text; background-clip:text; color:transparent; }
.ov-sub{ margin:8px 0 0; font-size:15px; color:var(--muted); }
.ov-actions{ display:flex; gap:10px; align-items:center; flex-wrap:wrap; }
.ov-grid{ display:grid; grid-template-columns:repeat(auto-fill,minmax(220px,1fr)); gap:20px; }

.pcard{
  position:relative; aspect-ratio:4/5; overflow:hidden; cursor:pointer; text-align:left;
  background:var(--bg); border:1px solid var(--line); border-radius:var(--radius-md);
  box-shadow:var(--shadow-sm);
  transition:transform .2s ease, box-shadow .2s ease;
}
.pcard:hover{ transform:translateY(-3px); box-shadow:var(--shadow); }
.pcard .ph{ position:absolute; inset:0; background-size:cover; background-position:center; }
/* no photo yet: the brand's house on a soft gradient */
.pcard .mono{ position:absolute; inset:0; display:grid; place-items:center; background:var(--grad-soft); }
.pcard .mono svg{ width:64px; height:64px; margin-bottom:22%; fill:none; stroke:var(--accent); stroke-width:1.5; stroke-linecap:round; stroke-linejoin:round; opacity:.55; }
.pcard .veil{ position:absolute; inset:0;
  background:linear-gradient(to top, rgba(0,0,0,.88) 0%, rgba(0,0,0,.32) 44%, rgba(0,0,0,0) 72%); }
/* without a photo there is nothing to darken: dark text on the light placeholder */
.pcard .mono ~ .veil{ display:none; }
.pcard .mono ~ .pinfo .pname{ color:var(--ink); }
.pcard .mono ~ .pinfo .pmeta{ color:var(--muted); }
.pcard .pinfo{ position:absolute; left:0; right:0; bottom:0; padding:14px 16px 16px; }
.pcard .pname{ display:block; font-size:17px; font-weight:700; letter-spacing:-.01em; color:#fff; line-height:1.25; }
.pcard .pmeta{ display:block; margin-top:4px; font-size:12.5px; font-weight:500; color:rgba(255,255,255,.82); }
.pcard .ptag{
  position:absolute; top:12px; left:12px; padding:5px 11px; border-radius:var(--radius-pill);
  background:var(--grad); color:var(--on-grad); font-size:11px; font-weight:750; letter-spacing:.06em; text-transform:uppercase;
}
.pcard .pdel{
  position:absolute; top:10px; right:10px; width:32px; height:32px; border:none;
  background:var(--glass-strong); color:var(--ink); border:1px solid var(--line-strong);
  -webkit-backdrop-filter:blur(8px); backdrop-filter:blur(8px);
  cursor:pointer; font-size:18px; line-height:1;
  opacity:0; transition:opacity .15s ease, color .15s ease;
}
.pcard:hover .pdel, .pcard:focus-within .pdel{ opacity:1; }
.pcard .pdel:hover{ color:var(--danger); }

.pcard.new{
  display:flex; flex-direction:column; align-items:center; justify-content:center; gap:14px;
  background:var(--glass); border:1px dashed var(--line-strong); box-shadow:none;
}
.pcard.new:hover{ border-color:var(--accent); background:var(--bg); box-shadow:var(--shadow-sm); }
.pcard.new .plus{
  width:48px; height:48px; display:grid; place-items:center;
  background:var(--grad); color:var(--on-grad); box-shadow:var(--shadow-btn);
  font-size:28px; font-weight:300; line-height:1;
}
.pcard.new .ntxt{ font-size:15px; font-weight:700; color:var(--ink-2); }

@media (max-width:520px){
  .ov-inner{ padding:26px var(--ov-side) 52px; }
  .ov-grid{ grid-template-columns:1fr 1fr; gap:12px; }
  .pcard .pname{ font-size:15px; }
}

/* settings boxes (overview): appearance, brand, business card */
.brand-box{
  margin-top:24px; padding:20px 24px;
  background:var(--bg); border:1px solid var(--line); border-radius:var(--radius);
  box-shadow:var(--shadow-sm);
}
.ov-grid + .brand-box{ margin-top:40px; }
.brand-head{ display:flex; align-items:center; justify-content:space-between; gap:16px; }
.brand-panel{ margin-top:18px; padding-top:20px; border-top:1px solid var(--line); }
.brand-grid{ display:grid; grid-template-columns:1fr 1fr; gap:28px; }
.brand-actions{ display:flex; align-items:center; gap:14px; margin-top:8px; flex-wrap:wrap; }
.brand-saved{ font-size:14px; font-weight:700; color:var(--ok); }
@media (max-width:640px){
  .brand-box{ padding:18px 16px; }
  .brand-grid{ grid-template-columns:1fr; }
}

/* ---------- theme (appearance) picker ---------- */
.theme-grid{ display:grid; grid-template-columns:repeat(5,1fr); gap:14px; margin-bottom:22px; }
@media (max-width:820px){ .theme-grid{ grid-template-columns:repeat(2,1fr); } }
.theme-card{
  display:flex; flex-direction:column; gap:8px; padding:11px; text-align:left; cursor:pointer;
  background:var(--bg); border:1px solid var(--line); border-radius:var(--radius-md);
  transition:border-color .15s ease, box-shadow .15s ease;
}
.theme-card:hover{ border-color:var(--line-strong); box-shadow:var(--shadow-sm); }
/* selected: gradient outline, like the highlighted cards of the landing page */
.theme-card[aria-pressed="true"]{
  padding:10px; border:2px solid transparent; box-shadow:var(--shadow-sm);
  background:linear-gradient(var(--bg),var(--bg)) padding-box, var(--grad) border-box;
}
.theme-swatch{ display:flex; height:40px; overflow:hidden; box-shadow:inset 0 0 0 1px var(--line-strong); }
.theme-swatch span{ flex:1; }
/* rendered post of the design (4:5), see js/theme-preview.js */
.theme-preview{ aspect-ratio:4/5; overflow:hidden; background:var(--fill); box-shadow:inset 0 0 0 1px var(--line); }
.theme-preview img, .theme-preview canvas{ display:block; width:100%; height:100%; object-fit:cover; }
.theme-card .tc-label{ font-size:14px; font-weight:700; color:var(--ink); }
.theme-card .tc-fonts{ font-size:12px; color:var(--muted); }
.theme-accents{ display:flex; flex-wrap:wrap; gap:20px; margin-bottom:18px; }
.theme-accent{ display:flex; align-items:center; gap:10px; }
.theme-accent label{ font-size:13px; font-weight:600; color:var(--ink-2); }
.theme-accent input[type=color]{
  width:38px; height:38px; padding:3px; cursor:pointer;
  background:var(--bg); border:1px solid var(--line-strong);
}

/* toggle switch */
.toggle{ display:flex; align-items:center; gap:12px; cursor:pointer; user-select:none; }
.toggle input{ position:absolute; opacity:0; width:0; height:0; }
.toggle .track{
  position:relative; flex:0 0 auto; width:44px; height:26px; border-radius:var(--radius-pill);
  background:var(--fill); box-shadow:inset 0 0 0 1px var(--line-strong);
  transition:background .2s ease, box-shadow .2s ease;
}
.toggle .knob{
  position:absolute; top:3px; left:3px; width:20px; height:20px;
  background:var(--ink); box-shadow:0 1px 3px var(--drop);
  transition:transform .2s ease, background-color .2s ease;
}
.toggle input:checked + .track{ background:var(--grad); box-shadow:none; }
.toggle input:checked + .track .knob{ transform:translateX(18px); background:var(--on-grad); }
.toggle input:focus-visible + .track{ outline:3px solid var(--focus); outline-offset:2px; }
.toggle-label{ font-size:14px; font-weight:500; color:var(--ink-2); }
.transparent-toggle{ flex:0 0 auto; max-width:380px; }
.transparent-toggle .toggle-label{ font-size:13px; line-height:1.35; color:var(--muted); }

/* file inputs */
.file{
  display:flex; align-items:center; gap:12px; margin-bottom:8px; padding:12px 14px; cursor:pointer;
  background:var(--bg); border:1.5px dashed var(--line-strong); border-radius:var(--radius-md);
  transition:border-color .15s ease, background-color .15s ease;
}
.file:hover{ border-color:var(--accent); background:var(--accent-soft); }
.file input{ display:none; }
.file .ico{
  flex:0 0 auto; width:38px; height:38px; border-radius:var(--radius-sm); display:grid; place-items:center;
  background:var(--grad-soft); color:var(--accent);
}
.file .ico svg{ width:20px; height:20px; fill:none; stroke:currentColor; stroke-width:1.8; stroke-linecap:round; stroke-linejoin:round; }
.file .txt{ font-size:14px; font-weight:600; color:var(--ink); min-width:0; }
.file .txt small{ display:block; margin-top:2px; font-size:12.5px; font-weight:400; color:var(--muted); }
.file .clear{
  margin-left:auto; padding:6px; background:none; border:none; cursor:pointer;
  color:var(--danger); font-size:13px; font-weight:600;
}
.file .clear:hover{ text-decoration:underline; }

.hint{ font-size:12.5px; color:var(--muted); line-height:1.5; margin-top:6px; }
.hint a{ color:var(--accent); text-decoration-color:var(--line-strong); text-underline-offset:3px; }
.hint a:hover{ text-decoration-color:currentColor; }

/* ---------- Preview panel ---------- */
.preview{
  padding:24px; display:flex; flex-direction:column;
  align-items:center; gap:18px; min-height:0; overflow:hidden;
  background:var(--canvas);
}

/* slide bar */
.slidebar{ display:flex; gap:8px; flex-wrap:wrap; align-items:center; flex:0 0 auto; width:100%; justify-content:center; }
.schip{
  display:inline-flex; align-items:center; gap:8px; padding:5px 14px 5px 5px; cursor:pointer;
  background:var(--bg); border:1px solid var(--line); border-radius:var(--radius-pill);
  color:var(--ink-2); font-size:13px; font-weight:600;
  transition:border-color .15s ease, color .15s ease, background-color .15s ease;
}
.schip:hover{ border-color:var(--line-strong); color:var(--ink); }
.schip[aria-pressed=true]{ background:var(--ink); border-color:var(--ink); color:var(--canvas); }
.schip.drag-over{ border-color:var(--accent); background:var(--accent-soft); color:var(--ink); }
.schip .snum{
  width:24px; height:24px; display:grid; place-items:center;
  background:var(--fill); color:var(--ink); font-size:12px; font-weight:800; line-height:1;
}
.schip[aria-pressed=true] .snum{ background:var(--canvas); color:var(--ink); }
.schip-add{
  width:36px; height:36px; padding:0; cursor:pointer;
  background:none; border:1px dashed var(--line-strong);
  color:var(--ink-2); font-size:16px; line-height:1;
}
.schip-add:hover{ border-color:var(--accent); color:var(--accent); background:var(--accent-soft); }

.slidetools{ display:flex; align-items:center; gap:14px; flex:0 0 auto; flex-wrap:wrap; justify-content:center; }
.slidetools .tpl{ display:flex; align-items:center; gap:8px; }
.slidetools .tpl span{ font-size:13px; font-weight:600; color:var(--muted); }
#tplSelect{ width:auto; padding:8px 36px 8px 12px; font-size:14px; }
.slidetools-btns{ display:flex; gap:6px; }
.stbtn{ width:38px; height:38px; }
.stbtn:disabled{ opacity:.4; cursor:not-allowed; }
.stbtn:disabled:hover{ background:var(--bg); border-color:var(--line); color:var(--ink-2); }

.stage{
  flex:1 1 auto; display:flex; align-items:center; justify-content:center;
  width:100%; min-height:0;
}
canvas{
  max-width:100%; max-height:100%; height:auto; width:auto;
  /* dark behind the preview: the transparent overlay export is mostly white text */
  background:var(--fill); box-shadow:var(--shadow);
  display:block;
  cursor:grab; touch-action:none;
}
canvas:active{ cursor:grabbing; }
canvas.drag-over{ outline:3px dashed var(--accent); outline-offset:4px; }

.actions{ display:flex; gap:12px; align-items:center; flex:0 0 auto; flex-wrap:wrap; justify-content:center; }
.actions button{ height:46px; padding:0 26px; font-size:15px; }

/* ---------- login overlay ---------- */
.login-overlay{
  position:fixed; inset:0; z-index:100; overflow-y:auto;
  display:flex; align-items:center; justify-content:center; padding:24px 16px;
  background:var(--backdrop);
}
.login-card{
  position:relative; width:100%; max-width:400px; margin:auto 0;
  display:flex; flex-direction:column; padding:36px 30px 28px;
  background:var(--bg);
  border:1px solid var(--line-strong); box-shadow:var(--shadow);
}
.login-card::before{ content:""; position:absolute; top:-1px; left:12%; right:12%; height:1px; background:var(--edge); pointer-events:none; }
.login-mark{ display:flex; align-items:center; justify-content:center; text-decoration:none; color:var(--ink); }
.login-mark .brand-name{ font-size:22px; }
.login-sub{ text-align:center; font-size:15px; font-weight:500; color:var(--muted); margin:12px 0 26px; }
.login-card label.f{ margin-bottom:16px; }
.login-card .hint{ margin:0 0 14px; }
.login-error{
  margin:2px 0 14px; padding:10px 12px; border-radius:var(--radius-sm);
  background:var(--danger-bg); color:var(--danger); font-size:13.5px; line-height:1.45;
}
.login-error.is-info{ background:var(--fill); color:var(--ink-2); }
.login-note{
  margin:0 0 18px; padding:10px 12px; border-radius:var(--radius-sm);
  background:var(--ok-bg); color:var(--ok); font-size:13.5px; line-height:1.45; text-align:center;
}
.login-submit{ width:100%; height:46px; margin-top:4px; font-size:15px; }
.login-pay{ margin:0 0 10px; }
.login-plans{ display:grid; grid-template-columns:1fr 1fr; gap:10px; margin:0 0 12px; }
.login-plans[hidden]{ display:none; }
.login-plans .plan{ cursor:pointer; }
.login-plans .plan input{ position:absolute; opacity:0; pointer-events:none; }
.login-plans .plan-in{ display:flex; flex-direction:column; gap:2px; padding:10px 12px; border:1px solid var(--line-strong); border-radius:var(--radius-sm); background:var(--bg); font-size:12.5px; color:var(--muted); }
.login-plans .plan-in b{ color:var(--ink); font-size:14px; }
.login-plans .plan-in em{ font-style:normal; color:var(--signal-ink); font-weight:700; font-size:11.5px; }
.login-plans .plan input:checked + .plan-in{ border-color:var(--accent); box-shadow:0 0 0 3px var(--accent-ring); }
.login-plans .plan input:focus-visible + .plan-in{ outline:2px solid var(--focus); outline-offset:2px; }
/* with the payment button shown, « Se connecter » steps back to a secondary button */
.login-pay:not([hidden]) ~ .login-submit{
  background:var(--bg); color:var(--ink); border:1px solid var(--line); box-shadow:none;
}
.login-links{
  display:flex; align-items:center; justify-content:space-between; gap:12px;
  margin-top:20px; font-size:13.5px;
}
.login-links a, .link-btn{
  color:var(--accent); font-weight:600;
  text-decoration:underline; text-decoration-color:var(--line-strong); text-underline-offset:3px;
  background:none; border:none; font-size:13.5px; cursor:pointer; padding:0;
}
.login-links a:hover, .link-btn:hover{ text-decoration-color:currentColor; }

@media (prefers-reduced-motion:reduce){ *{ transition:none !important; } }

/* ---------- Mobile / narrow layout (placed last so it wins by source order) ---------- */
@media (max-width:920px){
  main{ display:flex; flex-direction:column; }
  .preview{ order:-1; flex:0 0 auto; height:64vh; border-bottom:1px solid var(--line); padding:10px 12px; gap:8px; }
  .panel{ flex:1 1 auto; border-right:none; padding:20px 16px 48px; }
  header{ height:56px; padding:0 16px; gap:10px; } /* = the panel's side padding */
  header:has(#backBtn[hidden]){ padding-inline:var(--ov-side); }
header .sub{ display:none; }
  /* editor open: the project name and save button need the room */
  header:has(.hdr-right:not([hidden])) .brand{ display:none; }
  .hdr-right input.hdr-name{ width:130px; font-size:16px; }
  .hdr-icon{ display:none; }
  /* 16px keeps iOS from zooming into a focused field */
  input[type=text], input[type=tel], input[type=email], input[type=url], input[type=password], textarea, select{ font-size:16px; }
  .actions{ width:100%; flex-wrap:nowrap; gap:10px; }
  .actions button{ flex:1 1 0; min-width:0; height:42px; padding:0 10px; font-size:14px; }

  /* keep the canvas visible: give the stage priority, compact the chrome */
  .stage{ min-height:34vh; }

  /* slide chips on one scrollable row instead of wrapping to several lines */
  .slidebar{ flex-wrap:nowrap; justify-content:flex-start; overflow-x:auto; gap:6px; padding-bottom:2px; scrollbar-width:none; }
  .slidebar::-webkit-scrollbar{ display:none; }
  .schip{ flex:0 0 auto; padding:4px 11px 4px 4px; font-size:12.5px; }
  .schip .snum{ width:22px; height:22px; font-size:11px; }
  .schip-add{ flex:0 0 auto; width:32px; height:32px; }

  /* slide tools: tighter, on one row (the select keeps its aria-label without the visible « Modèle ») */
  .slidetools{ gap:8px; flex-wrap:nowrap; }
  .slidetools .tpl span{ display:none; }
  #tplSelect{ padding:6px 30px 6px 10px; font-size:14px; background-position:right 8px center; }
  .stbtn{ width:32px; height:34px; }

  /* toggles: smaller so they don't eat the canvas height */
  .transparent-toggle{ max-width:none; }
  .transparent-toggle .toggle-label{ font-size:12px; line-height:1.3; }
  .toggle .track{ width:38px; height:22px; }
  .toggle .knob{ width:16px; height:16px; }
  .toggle input:checked + .track .knob{ transform:translateX(16px); }

  /* collapse the controls around the canvas while scrolling the form down,
     giving the form more room; they return when scrolled back to the top */
  .preview{ transition:height .25s ease; }
  #editor.chrome-hidden .preview{ height:26vh; }
  #editor.chrome-hidden .slidebar,
  #editor.chrome-hidden .slidetools,
  #editor.chrome-hidden .transparent-toggle,
  #editor.chrome-hidden .actions{ display:none; }
  #editor.chrome-hidden .stage{ min-height:0; }
}
@media (max-width:380px){
  .hdr-right input.hdr-name{ width:104px; }
  .hdr-right .btn-sm{ padding:0 14px; }
}

/* ============ carte de visite ============ */
.card-quick-actions{ display:flex; justify-content:flex-end; margin-top:14px; }
.card-panel{ margin-top:18px; padding-top:20px; border-top:1px solid var(--line); }
.card-editor{ display:grid; grid-template-columns:340px 1fr; gap:40px; align-items:start; }
.card-fields{ display:flex; flex-direction:column; }
.card-actions{ display:flex; flex-wrap:wrap; align-items:center; gap:14px; margin-top:10px; }
.card-preview{ display:flex; flex-wrap:wrap; gap:36px; justify-content:center; padding:24px; border-radius:var(--radius-md); background:var(--canvas); }
.card-face{ display:flex; flex-direction:column; align-items:center; gap:10px; }
.card-face canvas{
  width:260px; height:auto; cursor:default;
  box-shadow:var(--shadow);
}
.card-face-label{ font-size:13px; font-weight:600; color:var(--muted); }

@media (max-width:820px){
  .card-editor{ grid-template-columns:1fr; }
  .card-preview{ order:-1; padding:16px; gap:20px; }
  .card-face canvas{ width:min(260px,100%); }
}

/* in-page confirm dialog (projects.js askConfirm) */
.ask-dialog{border:1px solid var(--line-strong);border-radius:var(--radius-md);padding:22px 24px;max-width:min(92vw,380px);background:var(--bg);color:var(--ink);box-shadow:var(--shadow)}
.ask-dialog::backdrop{background:var(--scrim)}
.ask-dialog p{margin:0 0 18px;line-height:1.45}
.ask-row{display:flex;gap:10px;justify-content:flex-end}
.ask-no{background:transparent;color:var(--ink);box-shadow:none;border:1px solid var(--line-strong)}

/* ============ onboarding (js/onboarding.js): setup wizard + guided tours ============ */
.onb{
  width:min(960px, calc(100vw - 32px)); max-height:min(760px, calc(100dvh - 32px));
  padding:0; display:flex; flex-direction:column; overflow:hidden;
  border:1px solid var(--line-strong); background:var(--bg); color:var(--ink); box-shadow:var(--shadow);
}
.onb:not([open]){ display:none; }
.onb::backdrop{ background:var(--scrim); }
.onb.is-done{ width:min(560px, calc(100vw - 32px)); }
.onb-head{
  display:flex; align-items:center; justify-content:space-between; gap:16px;
  padding:16px 24px; border-bottom:1px solid var(--line);
}
.onb-progress{ display:flex; gap:20px; margin:0; padding:0; list-style:none; counter-reset:onb; flex-wrap:wrap; }
.onb-progress li{
  counter-increment:onb; display:flex; align-items:center; gap:8px;
  font-size:13px; font-weight:600; color:var(--muted);
}
.onb-progress li::before{
  content:counter(onb); width:22px; height:22px; display:grid; place-items:center;
  border:1px solid var(--line-strong); font-size:12px; font-weight:700; color:var(--muted);
}
.onb-progress li.is-current{ color:var(--ink); }
.onb-progress li.is-current::before{ background:var(--grad); border-color:transparent; color:var(--on-grad); }
.onb-progress li.is-done::before{ content:"✓"; background:var(--ok-bg); border-color:transparent; color:var(--ok); }
.onb-later{
  background:none; border:none; padding:6px 0; cursor:pointer;
  color:var(--muted); font-size:13.5px; font-weight:600;
  text-decoration:underline; text-decoration-color:var(--line-strong); text-underline-offset:3px;
}
.onb-later:hover{ color:var(--ink); }
.onb-body{ flex:1 1 auto; min-height:0; display:grid; grid-template-columns:1fr 300px; }
.onb.is-done .onb-body{ grid-template-columns:1fr; }
.onb-main{ min-height:0; overflow-y:auto; padding:26px 28px 20px; }
.onb-side{
  display:flex; flex-direction:column; align-items:center; gap:12px; padding:26px 24px;
  background:var(--canvas); border-left:1px solid var(--line);
}
.onb-live{ width:100%; height:auto; max-height:100%; cursor:default; box-shadow:var(--shadow-sm); }
.onb-side-note{ margin:0; font-size:12.5px; color:var(--muted); text-align:center; line-height:1.45; }
.onb-title{
  margin:0 0 8px; font-size:26px; font-weight:700; letter-spacing:-.03em; line-height:1.1;
  background:var(--grad-text); -webkit-background-clip:text; background-clip:text; color:transparent;
}
.onb-lead{ margin:0 0 20px; color:var(--ink-2); font-size:15px; line-height:1.5; max-width:56ch; }
.onb-logo{ margin-bottom:18px; }
.onb-fields{ display:grid; grid-template-columns:1fr 1fr; gap:0 16px; }
.onb-themes{ display:grid; grid-template-columns:repeat(auto-fill, minmax(140px, 1fr)); gap:12px; }
.onb-list{ margin:0 0 18px; padding:0; list-style:none; display:grid; gap:10px; }
.onb-list li{ display:flex; align-items:center; gap:10px; font-weight:600; color:var(--muted); }
.onb-list li::before{
  content:""; width:20px; height:20px; flex:0 0 auto; border:1.5px dashed var(--line-strong);
}
.onb-list li.ok{ color:var(--ink); }
.onb-list li.ok::before{ content:"✓"; display:grid; place-items:center; border:none; background:var(--ok-bg); color:var(--forest); font-size:13px; font-weight:800; }
.onb-foot{
  display:flex; align-items:center; justify-content:flex-end; gap:10px; flex-wrap:wrap;
  padding:14px 24px; border-top:1px solid var(--line);
}
.onb-foot .btn-sm{ min-width:120px; }
.onb-foot .btn-sm:disabled{ opacity:.6; cursor:progress; }
.onb-error{ margin:0 auto 0 0; font-size:13.5px; color:var(--danger); }
@media (max-width:760px){
  .onb{ width:100vw; max-width:100vw; height:100dvh; max-height:100dvh; border:none; }
  .onb.is-done{ width:100vw; }
  .onb-head{ padding:12px 16px; }
  .onb-progress{ gap:12px; }
  .onb-progress li{ font-size:0; gap:0; }               /* numbers only */
  .onb-progress li.is-current{ font-size:13px; gap:8px; }
  .onb-body{ grid-template-columns:1fr; grid-template-rows:auto 1fr; overflow-y:auto; }
  .onb-side{ order:-1; padding:14px 16px 10px; border-left:none; border-bottom:1px solid var(--line); }
  .onb-live{ width:auto; max-width:100%; height:30dvh; }
  .onb-main{ overflow:visible; padding:20px 16px; }
  .onb-fields{ grid-template-columns:1fr; }
  .onb-themes{ grid-template-columns:repeat(2, 1fr); }
  .onb-title{ font-size:22px; }
  .onb-foot{ padding:12px 16px calc(12px + env(safe-area-inset-bottom)); }
  .onb-foot .btn-sm, .onb-foot .btn-ghost{ flex:1 1 0; min-width:0; }
}

/* guided tour: a spotlight cut out of a scrim, and a card next to it */
.tour-block{ position:fixed; inset:0; z-index:200; }
.tour-spot{
  position:fixed; z-index:201; pointer-events:none;
  box-shadow:0 0 0 200vmax var(--scrim), 0 0 0 2px var(--accent-2);
  transition:top .25s var(--ease-in-out), left .25s var(--ease-in-out), width .25s var(--ease-in-out), height .25s var(--ease-in-out);
}
.tour-pop{
  position:fixed; z-index:202; width:min(340px, calc(100vw - 24px));
  padding:18px 20px 16px; background:var(--bg); color:var(--ink);
  border:1px solid var(--line-strong); box-shadow:var(--shadow);
}
.tour-pop::before{ content:""; position:absolute; top:-1px; left:12%; right:12%; height:1px; background:var(--edge); pointer-events:none; }
.tour-count{ font-size:12px; font-weight:700; letter-spacing:.06em; color:var(--signal-ink); }
.tour-title{ margin:4px 0 6px; font-size:17px; font-weight:700; letter-spacing:-.01em; }
.tour-text{ margin:0 0 16px; font-size:14px; line-height:1.5; color:var(--ink-2); }
.tour-row{ display:flex; align-items:center; gap:8px; }
.tour-row .link-btn{ margin-right:auto; color:var(--muted); }
.tour-row .btn-sm, .tour-row .btn-ghost{ height:36px; padding:0 14px; }
.tour-pop.is-sheet{ left:12px; right:12px; bottom:calc(12px + env(safe-area-inset-bottom)); width:auto; }
.tour-pop.is-sheet.is-top{ bottom:auto; top:12px; }
