:root {
  --ink: #171a21;
  --ink-2: #4a5160;
  --ink-3: #7b8394;
  --line: #e3e6ec;
  --bg: #f6f7f9;
  --card: #ffffff;
  --accent: #ff5a36;
  --accent-ink: #ffffff;
  --accent-soft: #fff0eb;
  --ok: #138a4a;
  --warn: #b26b00;
  --bad: #c62828;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.06), 0 4px 16px rgba(16, 24, 40, 0.06);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
}
html[lang="ar"] { font-family: "Cairo", ui-sans-serif, system-ui, "Segoe UI", Tahoma, Arial, sans-serif; }
html[lang="ar"] body { line-height: 1.45; }

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); min-height: 100vh; display: flex; flex-direction: column; }
a { color: inherit; }
img { max-width: 100%; display: block; }
h1, h2, h3 { line-height: 1.15; margin: 0 0 .5em; }
[hidden] { display: none !important; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 20;
  background: rgba(255, 255, 255, .92); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.site-header .inner { display: flex; align-items: center; gap: 24px; height: 60px; }
.brand { font-weight: 800; font-size: 20px; letter-spacing: -.02em; text-decoration: none; display: flex; align-items: center; gap: 8px; }
.brand-mark { width: 26px; height: 26px; border-radius: 8px; background: var(--accent); color: #fff; display: grid; place-items: center; font-size: 15px; }
.site-header nav { display: flex; gap: 20px; margin-inline-start: auto; align-items: center; }
.lang-toggle { font-weight: 700; }
html[lang="en"] .lang-toggle { font-family: "Cairo", sans-serif; }
.site-header nav a { text-decoration: none; color: var(--ink-2); font-weight: 500; }
.site-header nav a:hover { color: var(--ink); }
.cart-link { display: inline-flex; align-items: center; gap: 6px; }
.badge { min-width: 20px; height: 20px; border-radius: 10px; padding: 0 6px; background: var(--accent); color: #fff; font-size: 12px; font-weight: 700; display: inline-grid; place-items: center; }

.container { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 20px; }
main { flex: 1; }
.site-footer { border-top: 1px solid var(--line); color: var(--ink-3); font-size: 14px; padding: 24px 0; margin-top: 48px; background: #fff; }

/* ---------- Buttons & form ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid var(--line); background: #fff; color: var(--ink);
  font: inherit; font-weight: 600; font-size: 14px;
  padding: 9px 14px; border-radius: 10px; cursor: pointer; text-decoration: none;
  transition: background .15s, border-color .15s, transform .05s;
}
.btn:hover { border-color: #c9ced8; background: #fafbfc; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: #f04a26; border-color: #f04a26; }
.btn-dark { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn-dark:hover { background: #2a2f3a; border-color: #2a2f3a; }
.btn-lg { padding: 13px 20px; font-size: 16px; border-radius: 12px; }
.btn-block { width: 100%; }
.btn-sm { padding: 6px 10px; font-size: 13px; border-radius: 8px; }
.btn-icon { width: 36px; height: 36px; padding: 0; }
.btn.active { background: var(--ink); color: #fff; border-color: var(--ink); }
.btn-danger { color: var(--bad); }

label { font-size: 13px; font-weight: 600; color: var(--ink-2); display: block; margin-bottom: 6px; }
input[type=text], input[type=email], input[type=tel], input[type=number], input[type=password], select, textarea {
  width: 100%; font: inherit; font-size: 14px; color: var(--ink);
  border: 1px solid var(--line); border-radius: 10px; padding: 9px 11px; background: #fff;
}
input:focus, select:focus, textarea:focus { outline: 2px solid #ffc6b8; border-color: var(--accent); }
textarea { resize: vertical; min-height: 64px; }
input[type=color] { width: 40px; height: 36px; padding: 2px; border: 1px solid var(--line); border-radius: 8px; background: #fff; cursor: pointer; }
input[type=range] { width: 100%; accent-color: var(--accent); }
.field { margin-bottom: 14px; }
.row { display: flex; gap: 10px; align-items: center; }
.row > * { flex: 1; }
.row > .shrink { flex: 0 0 auto; }
.muted { color: var(--ink-3); }
.small { font-size: 13px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }

/* ---------- Toast ---------- */
#toast-root { position: fixed; bottom: calc(20px + env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); z-index: 100; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { background: var(--ink); color: #fff; padding: 11px 16px; border-radius: 10px; font-size: 14px; box-shadow: var(--shadow); animation: toast-in .2s ease-out; pointer-events: auto; max-width: 90vw; }
.toast.error { background: var(--bad); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* ---------- Home ---------- */
.hero { padding: 64px 0 40px; display: grid; grid-template-columns: 1.1fr 1fr; gap: 40px; align-items: center; }
.hero h1 { font-size: clamp(34px, 5vw, 56px); letter-spacing: -.03em; }
.hero h1 em { font-style: normal; color: var(--accent); }
.hero p { font-size: 18px; color: var(--ink-2); max-width: 520px; line-height: 1.55; }
.hero-art { position: relative; aspect-ratio: 5 / 4; }
.hero-art img { position: absolute; width: 58%; filter: drop-shadow(0 18px 30px rgba(0,0,0,.12)); }
.hero-art img:nth-child(1) { left: 0; top: 4%; }
.hero-art img:nth-child(2) { right: 0; top: 0; width: 50%; }
.hero-art img:nth-child(3) { left: 28%; bottom: -4%; width: 44%; }
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin: 16px 0 48px; }
.step { padding: 20px; }
.step .num { width: 30px; height: 30px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-weight: 800; display: grid; place-items: center; margin-bottom: 10px; }
.step h3 { font-size: 17px; margin-bottom: 4px; }
.step p { margin: 0; color: var(--ink-2); font-size: 14px; line-height: 1.5; }
.section-title { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 16px; }
.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 20px; }
.product-card { overflow: hidden; display: flex; flex-direction: column; text-decoration: none; transition: transform .15s, box-shadow .15s; }
.product-card:hover { transform: translateY(-2px); box-shadow: 0 8px 28px rgba(16, 24, 40, .12); }
.product-card .thumb { background: linear-gradient(180deg, #f1f3f6, #e8ebf0); aspect-ratio: 5 / 5; display: grid; place-items: center; overflow: hidden; }
.product-card .thumb { position: relative; }
.product-card .thumb img { width: 86%; }
.saved-badge { position: absolute; top: 10px; inset-inline-start: 10px; background: var(--ok, #12805c); color: #fff; font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 999px; }
.product-card .body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.product-card h3 { font-size: 16px; margin: 0; }
.product-card .desc { font-size: 13px; color: var(--ink-3); margin: 0; line-height: 1.45; flex: 1; }
.product-card .foot { display: flex; align-items: center; justify-content: space-between; margin-top: 6px; }
.price { font-weight: 700; }
.dots { display: flex; gap: 4px; }
.dot { width: 14px; height: 14px; border-radius: 50%; border: 1px solid rgba(0,0,0,.18); }

/* ---------- Editor ---------- */
body.editor-page { height: 100vh; height: 100dvh; min-height: 0; overflow: hidden; }
body.editor-page main { display: flex; min-height: 0; }
.editor { display: grid; grid-template-columns: 76px minmax(0, 1fr) 320px; flex: 1; min-height: 0; width: 100%; }
.tools { background: #fff; border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: 10px 8px; gap: 4px; overflow-y: auto; }
.tool { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 4px; border-radius: 10px; border: 0; background: none; cursor: pointer; font: inherit; font-size: 11px; font-weight: 600; color: var(--ink-2); }
.tool svg { width: 22px; height: 22px; }
.tool:hover, .tool.open { background: var(--bg); color: var(--ink); }
.stage-wrap { position: relative; display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.stage-hint { position: absolute; bottom: 14px; left: 50%; transform: translateX(-50%); max-width: calc(100% - 32px); width: max-content;
  background: rgba(22, 24, 29, .82); color: #fff; font-size: 13px; line-height: 1.5; padding: 8px 14px; border-radius: 12px; text-align: center; pointer-events: none; z-index: 3; }
@media (max-width: 380px) { #preview-open-m span { display: none; } }
body.sheet-product .stage-hint, body.sheet-props .stage-hint { display: none; }
.stage-bar { display: flex; align-items: center; gap: 8px; padding: 10px 14px; background: #fff; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.stage-bar .spacer { flex: 1; }
.side-tabs { display: flex; background: var(--bg); padding: 3px; border-radius: 10px; gap: 2px; }
.side-tab { border: 0; background: none; font: inherit; font-size: 13px; font-weight: 600; color: var(--ink-2); padding: 6px 14px; border-radius: 8px; cursor: pointer; display: flex; align-items: center; gap: 6px; }
.side-tab.active { background: #fff; color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.side-tab .has { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.stage { flex: 1; min-height: 0; display: flex; overflow: auto; padding: 16px; direction: ltr; background:
  radial-gradient(circle at 50% 40%, #ffffff 0, #eef0f4 70%); }
.stage .canvas-container { margin: auto; flex: none; }
.flyout { position: absolute; inset-inline-start: 0; top: 0; width: 280px; max-height: calc(100% - 20px); overflow: auto; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); padding: 14px; z-index: 10; margin: 10px; }
.flyout h4 { margin: 0 0 10px; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); }
.shape-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.shape-btn { aspect-ratio: 1; border: 1px solid var(--line); border-radius: 10px; background: #fff; cursor: pointer; display: grid; place-items: center; }
.shape-btn:hover { border-color: var(--accent); background: var(--accent-soft); }
.shape-btn svg { width: 60%; height: 60%; }
.text-preset { display: block; width: 100%; text-align: start; border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: 10px 12px; cursor: pointer; margin-bottom: 8px; font-family: inherit; }
.text-preset:hover { border-color: var(--accent); background: var(--accent-soft); }
.dropzone { border: 2px dashed #cfd4dd; border-radius: 12px; padding: 22px 12px; text-align: center; color: var(--ink-2); font-size: 14px; cursor: pointer; }
.dropzone:hover, .dropzone.over { border-color: var(--accent); background: var(--accent-soft); }

.panel { background: #fff; border-left: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.panel-scroll { overflow-y: auto; padding: 16px; flex: 1; }
.panel-section { padding-bottom: 16px; margin-bottom: 16px; border-bottom: 1px solid var(--line); }
.panel-section:last-child { border-bottom: 0; margin-bottom: 0; }
.panel-section h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); margin-bottom: 12px; }
.product-title { font-size: 18px; font-weight: 700; margin-bottom: 2px; }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.swatch { width: 30px; height: 30px; border-radius: 50%; border: 1px solid rgba(0,0,0,.2); cursor: pointer; padding: 0; position: relative; }
.swatch.active::after { content: ""; position: absolute; inset: -5px; border: 2px solid var(--ink); border-radius: 50%; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 6px 10px; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
.chip.active { border-color: var(--ink); background: var(--ink); color: #fff; }
.btn-group { display: flex; }
.btn-group .btn { border-radius: 0; margin-inline-start: -1px; flex: 1; }
.btn-group .btn:first-child { border-start-start-radius: 8px; border-end-start-radius: 8px; margin-inline-start: 0; }
.btn-group .btn:last-child { border-start-end-radius: 8px; border-end-end-radius: 8px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.quality { font-size: 13px; padding: 8px 10px; border-radius: 8px; font-weight: 600; }
.quality.good { background: #e7f6ee; color: var(--ok); }
.quality.ok { background: #fff4e0; color: var(--warn); }
.quality.low { background: #fdecec; color: var(--bad); }
.empty-props { color: var(--ink-3); font-size: 14px; line-height: 1.5; }
.layers { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.layers li { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 8px; border: 1px solid var(--line); font-size: 13px; cursor: pointer; }
.layers li.active { border-color: var(--accent); background: var(--accent-soft); }
.layers li span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.layers li button { border: 0; background: none; cursor: pointer; color: var(--ink-3); padding: 2px; }
.panel-foot { border-top: 1px solid var(--line); padding: 14px 16px; background: #fff; }
.foot-actions { display: flex; gap: 8px; }
.foot-actions #add-to-cart { flex: 1; }
.foot-actions #save-draft { flex: none; }
.price-line { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 10px; }
.price-line .amount { font-size: 22px; font-weight: 800; }
.price-note { font-size: 12px; color: var(--ink-3); }

.overlay-busy { position: fixed; inset: 0; background: rgba(255,255,255,.75); display: grid; place-items: center; z-index: 50; font-weight: 600; }
.spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--accent); animation: spin .8s linear infinite; margin: 0 auto 10px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Cart & checkout ---------- */
.page-head { padding: 32px 0 16px; }
.cart-layout { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 24px; align-items: start; }
.cart-item { display: grid; grid-template-columns: 110px 1fr auto; gap: 16px; padding: 14px; align-items: center; }
.cart-item + .cart-item { border-top: 1px solid var(--line); }
.cart-item img { width: 110px; height: 132px; object-fit: contain; background: #f1f3f6; border-radius: 10px; }
.cart-item h3 { font-size: 16px; margin-bottom: 4px; }
.cart-item .meta { font-size: 13px; color: var(--ink-3); line-height: 1.6; }
.cart-item .actions { display: flex; gap: 6px; margin-top: 8px; }
.summary { padding: 18px; position: sticky; top: 80px; }
.summary .line { display: flex; justify-content: space-between; padding: 4px 0; font-size: 14px; }
.summary .total { font-size: 18px; font-weight: 800; border-top: 1px solid var(--line); margin-top: 8px; padding-top: 12px; }
.notice { background: var(--accent-soft); border-radius: 10px; padding: 10px 12px; font-size: 13px; color: #8a2b12; line-height: 1.45; }
.empty { text-align: center; padding: 56px 20px; }

/* ---------- Order status ---------- */
.order-items { display: grid; gap: 12px; }
.status-steps { display: flex; gap: 4px; margin-top: 10px; }
.status-steps div { flex: 1; height: 6px; border-radius: 3px; background: var(--line); }
.status-steps div.done { background: var(--accent); }
.status-label { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.pill { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; text-transform: capitalize; }
.pill.queued { background: #eef1f6; color: var(--ink-2); }
.pill.printing { background: #fff1d6; color: #8a5300; }
.pill.printed { background: #e4efff; color: #1d4fa8; }
.pill.shipped { background: #e3f5ea; color: var(--ok); }

/* ---------- Admin ---------- */
.login { max-width: 360px; margin: 80px auto; padding: 24px; }
.stats { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }
.stat { padding: 12px 16px; min-width: 120px; }
.stat b { font-size: 22px; display: block; }
.stat span { font-size: 12px; color: var(--ink-3); text-transform: uppercase; letter-spacing: .05em; font-weight: 700; }
.now-printing { display: grid; grid-template-columns: 300px 1fr; gap: 24px; padding: 20px; }
.now-printing .previews { display: grid; gap: 10px; }
.now-printing .previews img { background: #f1f3f6; border-radius: 10px; }
.spec { display: grid; grid-template-columns: 140px 1fr; gap: 6px 12px; font-size: 14px; margin: 14px 0; }
.spec dt { color: var(--ink-3); }
.spec dd { margin: 0; font-weight: 600; }
.print-files { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.queue-list { display: grid; gap: 8px; }
.queue-row { display: grid; grid-template-columns: 56px 1fr auto; gap: 12px; align-items: center; padding: 8px 12px; }
.queue-row img { width: 56px; height: 66px; object-fit: contain; background: #f1f3f6; border-radius: 8px; }
.tabs { display: flex; gap: 6px; margin-bottom: 20px; }
table.orders { width: 100%; border-collapse: collapse; font-size: 14px; }
table.orders th, table.orders td { text-align: start; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.orders th { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-3); }
.mini-items { display: flex; gap: 6px; flex-wrap: wrap; }
.mini-items img { width: 40px; height: 48px; object-fit: contain; background: #f1f3f6; border-radius: 6px; }

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
  .hero { grid-template-columns: 1fr; padding-top: 32px; }
  .hero-art { max-width: 480px; }
  .cart-layout { grid-template-columns: 1fr; }
  .now-printing { grid-template-columns: 1fr; }
  body.editor-page { height: auto; overflow: auto; }
  .editor { grid-template-columns: 1fr; grid-template-rows: auto auto auto; }
  .tools { flex-direction: row; border-right: 0; border-bottom: 1px solid var(--line); overflow-x: auto; padding: 6px; }
  .tool { min-width: 64px; }
  .stage { min-height: 70vh; }
  .panel { border-left: 0; border-top: 1px solid var(--line); }
  .flyout { top: 0; }
}
@media (max-width: 640px) {
  .steps { grid-template-columns: 1fr; }
  .site-header nav { gap: 14px; }
  .site-header .inner { gap: 12px; }
  .container { padding: 0 16px; }
  .cart-item { grid-template-columns: 80px 1fr; }
  .cart-item img { width: 80px; height: 96px; }
  .cart-item > .price { grid-column: 2; }
  .spec { grid-template-columns: 110px 1fr; }
  .hide-sm { display: none; }
}

/* ---------- Added: language, categories, editor extras ---------- */
.text-end { text-align: end; }
.cat-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.cat-chips .chip { padding: 8px 14px; border-radius: 999px; }
.zoom-group { display: flex; align-items: center; gap: 2px; background: var(--bg); border-radius: 10px; padding: 3px; }
.zoom-group button { border: 0; background: none; width: 30px; height: 30px; border-radius: 8px; cursor: pointer; font: inherit; font-weight: 700; color: var(--ink-2); }
.zoom-group button:hover { background: #fff; color: var(--ink); }
.zoom-group span { min-width: 44px; text-align: center; font-size: 12px; font-weight: 700; color: var(--ink-2); }
.preset-group { font-size: 12px; font-weight: 700; color: var(--ink-3); margin: 12px 0 6px; text-transform: uppercase; letter-spacing: .05em; }
.preset-group:first-of-type { margin-top: 0; }
.template-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.template-btn { border: 1px solid var(--line); border-radius: 10px; background: #fff; cursor: pointer; padding: 0; overflow: hidden; display: flex; flex-direction: column; font: inherit; font-size: 12px; font-weight: 600; color: var(--ink-2); }
.template-btn:hover { border-color: var(--accent); }
.template-btn img { width: 100%; aspect-ratio: 1; object-fit: contain; background: #f1f3f6; }
.template-btn span { padding: 6px; }
details.font-picker { border: 1px solid var(--line); border-radius: 10px; background: #fff; }
details.font-picker summary { list-style: none; cursor: pointer; padding: 8px 11px; display: flex; justify-content: space-between; align-items: center; font-size: 15px; }
details.font-picker summary::-webkit-details-marker { display: none; }
details.font-picker summary::after { content: "▾"; color: var(--ink-3); font-size: 12px; }
details.font-picker[open] summary { border-bottom: 1px solid var(--line); }
.font-list { max-height: 240px; overflow-y: auto; padding: 6px; }
.font-list .group { font-size: 11px; font-weight: 700; color: var(--ink-3); text-transform: uppercase; letter-spacing: .05em; padding: 6px 6px 2px; }
.font-option { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; width: 100%; border: 0; background: none; padding: 7px 8px; border-radius: 8px; cursor: pointer; font-size: 17px; color: var(--ink); text-align: start; }
.font-option small { font-family: ui-sans-serif, system-ui, sans-serif; font-size: 11px; color: var(--ink-3); }
.font-option:hover { background: var(--bg); }
.font-option.active { background: var(--accent-soft); }
.toggles { display: flex; flex-direction: column; gap: 6px; }
.check { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 500; color: var(--ink); margin: 0; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--accent); }
.layers li.locked span { opacity: .6; }
.layers li button.on { color: var(--accent); }
.pay-box { border: 2px solid var(--accent); border-radius: 10px; padding: 10px 12px; margin: 12px 0; background: var(--accent-soft); }
.pay-box strong { display: block; }
.pay-box span { font-size: 13px; color: var(--ink-2); }
@media (max-width: 960px) {
  .panel-foot { position: sticky; bottom: 0; z-index: 5; box-shadow: 0 -6px 18px rgba(16,24,40,.08); }
  .stage-bar { gap: 6px; padding: 8px 10px; }
}

/* ---------- Editor v3: groups, palettes, photo tools, stickers ---------- */
.mobile-only { display: none !important; }
.fly-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.fly-head h4 { margin: 0; }
.fly-close { border: 0; background: var(--bg); width: 30px; height: 30px; border-radius: 50%; cursor: pointer; font-size: 14px; color: var(--ink-2); flex: none; }
.fly-close:hover { background: var(--line); }
.sheet-head { display: none; }
.quick-actions { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; margin-bottom: 12px; }
.quick-actions .btn { padding: 8px 0; }
details.pgroup { border: 1px solid var(--line); border-radius: 12px; margin-bottom: 10px; background: #fff; }
details.pgroup > summary { list-style: none; cursor: pointer; padding: 10px 12px; font-size: 13px; font-weight: 700; color: var(--ink-2); display: flex; justify-content: space-between; align-items: center; }
details.pgroup > summary::-webkit-details-marker { display: none; }
details.pgroup > summary::after { content: "▾"; color: var(--ink-3); transition: transform .15s; }
details.pgroup:not([open]) > summary::after { transform: rotate(-90deg); }
html[dir="rtl"] details.pgroup:not([open]) > summary::after { transform: rotate(90deg); }
.pgroup-body { padding: 2px 12px 12px; }
.pgroup-body .field:last-child { margin-bottom: 0; }
.color-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.color-row input[type=color] { flex: none; }
.palette { display: flex; flex-wrap: wrap; gap: 5px; flex: 1; min-width: 0; }
.pal { width: 22px; height: 22px; border-radius: 50%; border: 1px solid rgba(0,0,0,.18); cursor: pointer; padding: 0; }
.pal:hover { transform: scale(1.12); }
.grad-preview { flex: 1; height: 30px; border-radius: 8px; border: 1px solid var(--line); }
.mask-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.mask-btn { border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: 8px 2px 6px; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 4px; font: inherit; }
.mask-btn small { font-size: 11px; color: var(--ink-2); }
.mask-btn.active { border-color: var(--accent); background: var(--accent-soft); }
.mask-icon { width: 22px; height: 22px; background: var(--ink-2); display: block; }
.mask-none { background: none; border: 2px dashed var(--ink-3); border-radius: 3px; }
.mask-circle { border-radius: 50%; }
.mask-rounded { border-radius: 6px; }
.mask-heart { clip-path: path("M11 20 C4 15 0 11 0 6.2 C0 2.6 2.6 0 5.9 0 C8.1 0 9.9 1.1 11 3.1 C12.1 1.1 13.9 0 16.1 0 C19.4 0 22 2.6 22 6.2 C22 11 18 15 11 20 Z"); }
.mask-star { clip-path: polygon(50% 0, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%); }
.mask-hexagon { clip-path: polygon(25% 5%, 75% 5%, 100% 50%, 75% 95%, 25% 95%, 0 50%); }
.mask-arch { border-radius: 11px 11px 2px 2px; }
.small-chips .chip { padding: 5px 10px; font-size: 12px; }
.sticker-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; max-height: 340px; overflow-y: auto; }
.sticker-btn { aspect-ratio: 1; border: 1px solid var(--line); border-radius: 10px; background: #fff; cursor: pointer; padding: 6px; }
.sticker-btn:hover { border-color: var(--accent); background: var(--accent-soft); }
.sticker-btn img { width: 100%; height: 100%; object-fit: contain; }
.btn-label { margin-inline-start: 4px; }

/* ---------- Phone layout ---------- */
@media (max-width: 820px) {
  .mobile-only { display: flex !important; }
  /* The editor fills exactly the visible screen (--app-h is set from the
     browser's real inner height), so the tool bar never falls off the bottom. */
  /* min-height: 0 undoes the site-wide body min-height of 100vh, which on
     phones is the full screen including the address bar area. */
  body.editor-page { height: 100vh; height: 100dvh; height: min(100svh, 100dvh, var(--app-h, 100dvh)); min-height: 0; overflow: hidden; display: flex; flex-direction: column; }
  body.editor-page .site-header { flex: none; }
  body.editor-page .site-header .inner { height: 50px; }
  body.editor-page .site-header nav a[href="/#products"] { display: none; }
  body.editor-page main { flex: 1; min-height: 0; height: auto; display: block; }
  .editor { display: flex; flex-direction: column; height: 100%; }
  .stage-wrap { order: 1; flex: 1; min-height: 0; position: relative; }
  .panel { order: 2; border: 0; border-top: 1px solid var(--line); }
  /* Tools sit at the top, under the header: some Android phones draw the
     page behind the system navigation bar, which hid a bottom tool bar. */
  .tools {
    order: 0; flex-direction: row; justify-content: space-around; gap: 0;
    border: 0; border-bottom: 1px solid var(--line); padding: 2px;
    overflow-x: auto; flex: none;
  }
  .tool { min-width: 48px; flex: 1 1 0; padding: 6px 1px; font-size: 10.5px; }
  .tool.open { background: var(--accent-soft); color: var(--accent); }
  .stage { padding: 8px; min-height: 0; }
  .stage-bar { padding: 6px 8px; gap: 4px; flex-wrap: nowrap; overflow-x: auto; }
  .stage-bar .btn-label, #zoom-in, #zoom-out, #zoom-label { display: none; }
  .stage-bar .btn { padding: 7px 9px; }
  .side-tab { padding: 6px 10px; }

  /* Settings slide up from the bottom; the canvas shrinks to stay visible. */
  .panel-scroll { display: none; max-height: 36dvh; padding: 0 14px 12px; }
  body.sheet-props .panel-scroll, body.sheet-product .panel-scroll { display: block; }
  body.sheet-props .sheet-head, body.sheet-product .sheet-head {
    display: flex; align-items: center; justify-content: space-between; padding: 10px 14px 8px;
  }
  .sheet-head strong { font-size: 15px; }
  #sec-product, #sec-props, #sec-layers { display: none; }
  body.sheet-product #sec-product, body.sheet-product #sec-layers { display: block; }
  body.sheet-props #sec-props { display: block; border: 0; }
  body.sheet-props #sec-props > h3 { display: none; }
  .panel-section { padding-bottom: 12px; margin-bottom: 12px; }

  .panel-foot { position: static; display: flex; align-items: center; gap: 10px; padding: 8px 12px calc(8px + env(safe-area-inset-bottom)); box-shadow: none; border-top: 1px solid var(--line); }
  .panel-foot .price-line { margin: 0; flex: 1; min-width: 0; }
  .panel-foot .price-line > .text-end { display: none; }
  .panel-foot .amount { font-size: 18px; }
  .panel-foot .price-note { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .panel-foot #add-to-cart, .panel-foot #save-draft, .panel-foot #preview-open-m { width: auto; flex: none; padding: 10px 12px; font-size: 14px; }
  .panel-foot .price-note { display: none; }
  .tools { flex: none; }
  .panel-foot #preview-open-m { gap: 5px; align-items: center; }
  .foot-actions { flex: none; }

  .flyout {
    position: fixed; inset-inline: 0; bottom: 0; top: auto; width: auto; margin: 0;
    max-height: 62dvh; border-radius: 18px 18px 0 0; z-index: 40;
    padding: 12px 14px calc(16px + env(safe-area-inset-bottom));
    box-shadow: 0 -10px 40px rgba(16, 24, 40, .18);
  }
  .sticker-grid { grid-template-columns: repeat(5, 1fr); max-height: none; }
  .template-grid { grid-template-columns: repeat(3, 1fr); }
  .quick-actions .btn { padding: 10px 0; }
  .pal { width: 26px; height: 26px; }
}

/* ---------- Print check ---------- */
.check-chip { border: 0; border-radius: 999px; padding: 6px 11px; font: inherit; font-size: 12px; font-weight: 700; cursor: pointer; white-space: nowrap; }
.check-chip.ok { background: #e7f6ee; color: var(--ok); }
.check-chip.warn { background: #fff4e0; color: var(--warn); }
.check-chip.bad { background: #fdecec; color: var(--bad); }
.check-legend { list-style: none; margin: 0 0 10px; padding: 0; display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--ink-2); }
.check-legend li { display: flex; align-items: center; gap: 8px; }
.lg { width: 22px; height: 0; flex: none; border-top: 2px dashed; }
.lg-trim { border-color: rgba(255, 90, 54, .9); }
.lg-safe { border-top: 2px dotted rgba(47, 158, 68, .9); }
.lg-bleed { border-top: 2px solid rgba(28, 126, 214, .85); }
.check-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.check-list li { display: flex; gap: 8px; font-size: 13px; line-height: 1.4; padding: 8px 10px; border-radius: 10px; cursor: pointer; }
.check-list li.ok { background: #e7f6ee; color: var(--ok); cursor: default; }
.check-list li.warn { background: #fff8eb; color: #7a4a00; }
.check-list li.error { background: #fdecec; color: #8a1c1c; }

/* ---------- Live preview ---------- */
.pv-modal { position: fixed; inset: 0; background: rgba(15, 17, 22, .55); z-index: 60; display: grid; place-items: center; padding: 20px; }
.pv-box { background: #fff; border-radius: 18px; width: min(920px, 100%); height: min(860px, 100%); display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.pv-head { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.pv-head h3 { margin: 0; font-size: 17px; }
.pv-head .pv-tabs { margin-inline-start: auto; }
.pv-sides { margin: 10px auto 0; }
.pv-body { flex: 1; min-height: 0; display: grid; place-items: center; background: radial-gradient(circle at 50% 35%, #ffffff 0, #e9ecf1 75%); overflow: hidden; }
.pv-canvas { max-width: 100%; max-height: 100%; object-fit: contain; display: block; }
.pv-3d { width: 100%; height: 100%; cursor: grab; touch-action: none; }
.pv-3d canvas { width: 100% !important; height: 100% !important; display: block; }
.pv-loading { text-align: center; color: var(--ink-2); font-weight: 600; }
.pv-proof { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; padding: 16px; width: 100%; height: 100%; }
.pv-proof figure { margin: 0; display: flex; flex-direction: column; align-items: center; min-height: 0; }
.pv-proof img { flex: 1; min-height: 0; max-width: 100%; object-fit: contain; }
.pv-proof figcaption { font-size: 13px; font-weight: 700; color: var(--ink-2); margin-top: 6px; }
.pv-foot { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--line); }
.pv-foot #pv-hint { flex: 1; }
@media (max-width: 820px) {
  .pv-modal { padding: 0; }
  .pv-box { width: 100%; height: 100%; border-radius: 0; }
  .pv-foot { padding-bottom: calc(12px + env(safe-area-inset-bottom)); }
  .pv-head { padding: 10px 12px; }
  .pv-proof { grid-template-columns: 1fr; grid-template-rows: 1fr 1fr; }
  .check-chip span { display: none; }
  #sec-check { display: none; }
  body.sheet-product #sec-check { display: block; }
}
.print-files-block { margin-bottom: 14px; }
.print-files .rec { font-weight: 500; opacity: .85; }

.film-row { grid-template-columns: 22px 56px 1fr; cursor: pointer; }
.film-row input { width: 18px; height: 18px; accent-color: var(--accent); }

/* ---------- Floating bar next to the selection ---------- */
.float-bar { position: absolute; left: 0; top: 0; z-index: 6; display: flex; gap: 2px; padding: 4px; background: #16181d; border-radius: 12px;
  box-shadow: 0 8px 24px rgba(16, 24, 40, .28); max-width: calc(100% - 12px); overflow-x: auto; scrollbar-width: none; }
.float-bar[hidden] { display: none; }
.float-bar button { display: inline-flex; align-items: center; gap: 5px; border: 0; background: transparent; color: #fff; font: inherit; font-size: 13px; font-weight: 600;
  padding: 7px 9px; border-radius: 9px; cursor: pointer; white-space: nowrap; min-height: 36px; }
.float-bar button:hover { background: rgba(255, 255, 255, .12); }
.float-bar button.danger { color: #ff8a80; }
@media (pointer: coarse) { .float-bar button { min-height: 42px; padding: 8px 10px; } }

/* ---------- Layout tools ---------- */
.align-row { display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; }
.align-row .btn { padding: 6px 0; justify-content: center; }
[data-distribute] svg { vertical-align: middle; }

/* ---------- Layers: drag handle ---------- */
.layers li .grip { cursor: grab; color: var(--muted); padding: 2px 6px; margin-inline-end: 2px; touch-action: none; user-select: none; font-size: 14px; letter-spacing: -2px; }
.layers li .lname { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.layers li.dragging { opacity: .55; }
.layers li.drop-before { box-shadow: inset 0 3px 0 var(--accent); }
.layers li.drop-after { box-shadow: inset 0 -3px 0 var(--accent); }

/* ---------- Text styles ---------- */
.fx-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.fx-chip { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 2px 4px; border: 1px solid var(--line); border-radius: 10px; background: #fff; cursor: pointer; font: inherit; color: var(--ink); min-width: 0; }
.fx-chip.active { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.fx-chip small { font-size: 10px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.fx-sample { font-size: 19px; font-weight: 700; line-height: 1.25; color: #16181d; display: block; padding: 0 2px; }
.fx-shadow { text-shadow: 2px 2px 3px rgba(0,0,0,.35); }
.fx-neon { color: #ffd1ea; text-shadow: 0 0 4px #ff2d95, 0 0 9px #ff2d95; background: #1c1d22; border-radius: 6px; }
.fx-extrude { color: #ff5a36; text-shadow: 2px 2px 0 #8c2c16; }
.fx-retro { color: #ff5a36; -webkit-text-stroke: 1px #16181d; text-shadow: 3px 3px 0 #fcc419; }
.fx-outline { color: transparent; -webkit-text-stroke: 1.2px #16181d; }
.fx-sticker { color: #ff5a36; text-shadow: 0 0 0 #fff, 2px 0 #fff, -2px 0 #fff, 0 2px #fff, 0 -2px #fff, 1px 3px 4px rgba(0,0,0,.3); background: #e9ecf1; border-radius: 6px; }
.fx-sunset, .fx-gold, .fx-ocean { -webkit-background-clip: text; background-clip: text; color: transparent; }
.fx-sunset { background-image: linear-gradient(#ff5a36, #fcc419); }
.fx-gold { background-image: linear-gradient(#f7d774, #b8860b); }
.fx-ocean { background-image: linear-gradient(#22d3ee, #1c3faa); }
@media (max-width: 380px) { .fx-grid { grid-template-columns: repeat(4, 1fr); } }

/* ---------- Colour single words ---------- */
.word-chips { display: flex; flex-wrap: wrap; gap: 5px; }
.word-chip { border: 1px solid var(--line); background: #f6f7f9; border-radius: 999px; padding: 4px 10px; font: inherit; font-weight: 700; cursor: pointer; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-shadow: 0 0 1px rgba(0,0,0,.25); }
.word-chip.active { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); background: #fff; }

/* ---------- Text background shapes ---------- */
.bg-shapes { flex-wrap: wrap; }
.bg-shapes .btn { gap: 5px; }
.bgs { display: inline-block; width: 18px; height: 10px; background: currentColor; opacity: .75; }
.bgs-box { border-radius: 3px; }
.bgs-pill { border-radius: 6px; }
.bgs-banner { clip-path: polygon(0 0, 100% 0, 80% 50%, 100% 100%, 0 100%, 20% 50%); }
.bgs-ticket { -webkit-mask: radial-gradient(circle at 0 50%, transparent 3px, #000 3.5px) left / 51% 100% no-repeat, radial-gradient(circle at 100% 50%, transparent 3px, #000 3.5px) right / 51% 100% no-repeat; mask: radial-gradient(circle at 0 50%, transparent 3px, #000 3.5px) left / 51% 100% no-repeat, radial-gradient(circle at 100% 50%, transparent 3px, #000 3.5px) right / 51% 100% no-repeat; }

/* ---------- Shared design page ---------- */
.share-layout { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 20px; align-items: start; }
.share-previews { padding: 14px; display: flex; flex-direction: column; align-items: center; gap: 12px; background: linear-gradient(180deg, #f1f3f6, #e8ebf0); }
.share-tabs:empty { display: none; }
.share-previews img { width: 100%; max-width: 560px; height: auto; display: block; }
.share-panel { padding: 18px; position: sticky; top: 80px; }
.share-votes { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 12px 0; }
.share-thanks { background: var(--ok-soft, #e6f6ec); color: var(--ok); font-weight: 600; padding: 10px 12px; border-radius: 10px; }
.share-replies-title { font-size: 15px; margin: 18px 0 8px; }
.share-replies { list-style: none; padding: 0; margin: 0 0 14px; display: flex; flex-direction: column; gap: 8px; max-height: 340px; overflow: auto; }
.share-replies li { border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; }
.share-replies li.up { border-color: #b7e4c7; background: #f3fbf6; }
.share-replies li.change { border-color: #ffd8a8; background: #fff9f0; }
.share-replies p { margin: 4px 0; white-space: pre-wrap; overflow-wrap: anywhere; }
@media (max-width: 860px) { .share-layout { grid-template-columns: 1fr; } .share-panel { position: static; } }

/* ---------- Share sheet in the editor ---------- */
.share-dialog { position: fixed; inset: 0; z-index: 70; background: rgba(15, 17, 22, .5); display: grid; place-items: center; padding: 16px; }
.share-dialog[hidden] { display: none; }
.share-dialog .box { background: #fff; border-radius: 16px; width: min(460px, 100%); max-height: calc(100% - 20px); overflow: auto; padding: 18px; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.share-dialog .head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.share-dialog .head h3 { margin: 0; font-size: 18px; }
.share-link-row { display: flex; gap: 6px; margin: 12px 0; }
.share-link-row input { flex: 1; min-width: 0; direction: ltr; font-size: 13px; }
.share-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.btn-whatsapp { background: #25d366; color: #fff; border-color: #25d366; }
.btn-whatsapp:hover { background: #1ebe5b; }
.share-dialog .share-replies { max-height: 220px; }

/* ---------- AI help ---------- */
.ai-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; background: var(--bg); padding: 3px; border-radius: 10px; margin-bottom: 12px; }
.ai-tabs button { border: 0; background: none; font: inherit; font-size: 13px; font-weight: 600; color: var(--ink-2); padding: 7px; border-radius: 8px; cursor: pointer; }
.ai-tabs button.active { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.ai-chips { display: flex; flex-wrap: wrap; gap: 5px; }
.ai-chips .chip { padding: 5px 10px; font-size: 12.5px; }
.ai-results { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; }
.ai-slogan { text-align: start; border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: 9px 11px; cursor: pointer; font-size: 17px; line-height: 1.35; color: var(--ink); }
.ai-slogan:hover { border-color: var(--accent); }
.ai-logos { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 12px; }
.ai-logo { border: 1px solid var(--line); border-radius: 10px; background: #fff; padding: 4px; cursor: pointer; display: flex; flex-direction: column; gap: 3px; align-items: center; font: inherit; color: var(--ink); }
.ai-logo:hover { border-color: var(--accent); }
.ai-logo img { width: 100%; aspect-ratio: 1; object-fit: contain; border-radius: 6px; }
.ai-logo small { font-size: 11px; color: var(--muted); text-align: center; }
.ai-note { font-size: 12px; color: var(--muted); margin: 8px 0 0; }
.ai-spinner { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; margin-top: 12px; }
.ai-spinner .spinner { width: 18px; height: 18px; border-width: 2px; }

/* ---------- Photo quality boost ---------- */
.boost-box { border: 1px dashed var(--line); border-radius: 10px; padding: 10px; margin-top: 8px; }
.boost-box p { margin: 0 0 8px; font-size: 12.5px; color: var(--ink-2); line-height: 1.5; }

.tool[hidden] { display: none !important; }

/* ---------- Order notifications (admin) ---------- */
.notify-card { padding: 14px 16px; margin-bottom: 14px; }
.notify-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.notify-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 6px 14px; }
.notify-row { display: flex; align-items: center; gap: 8px; font-size: 13.5px; }
.notify-row .muted { margin-inline-start: auto; }
.notify-row .dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.notify-row .dot.on { background: var(--ok); }
.notify-row .dot.off { background: #ced4da; }
.notify-cell { display: flex; gap: 4px; flex-wrap: wrap; }
.notify-cell .nb { font-size: 12px; padding: 2px 6px; border-radius: 999px; white-space: nowrap; }
.notify-cell .nb.ok { background: #e6f6ec; color: var(--ok); }
.notify-cell .nb.bad { background: #fdecec; color: #c92a2a; }
.order-wa { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 14px; padding: 12px; border-radius: 12px; background: #effaf3; border: 1px solid #b7e4c7; }
.order-wa p { margin: 0; flex: 1; min-width: 200px; font-size: 14px; }

/* ---------- Ready-made designs ---------- */
.promo { display: flex; align-items: center; gap: 20px; padding: 20px 22px; margin-bottom: 28px;
  background: linear-gradient(120deg, #16181d, #2b2f3a); color: #fff; border: 0; }
.promo h2 { margin: 0 0 4px; font-size: 20px; }
.promo p { margin: 0; color: #c9ccd2; font-size: 14px; line-height: 1.5; }
.promo .btn { margin-inline-start: auto; flex: none; }
.promo-art { width: 74px; height: 74px; flex: none; border-radius: 14px; background: #ff5a36; display: grid; place-items: center; font-size: 34px; }
@media (max-width: 640px) { .promo { flex-wrap: wrap; } .promo .btn { margin-inline-start: 0; width: 100%; } }
.design-card .thumb img { width: 100%; height: 100%; object-fit: cover; }
.design-card .thumb img:not([src]) { visibility: hidden; }
.design-card h3 { font-size: 17px; }
.dp-layout { display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: 20px; align-items: start; padding-top: 20px; }
.dp-layout > * { min-width: 0; } /* the product strip scrolls instead of widening the page */
.dp-stage { padding: 10px; position: relative; background: linear-gradient(180deg, #f1f3f6, #e8ebf0); }
.dp-picture { position: relative; display: grid; place-items: center; min-height: 320px; }
.dp-picture img { width: 100%; max-width: 620px; height: auto; display: block; transition: opacity .2s; }
.dp-picture img:not([src]) { visibility: hidden; height: 420px; }
.dp-picture .spinner { position: absolute; }
.dp-3d { position: absolute; bottom: 14px; inset-inline-start: 14px; gap: 6px; background: #fff; }
.dp-panel { padding: 18px; position: sticky; top: 80px; }
.dp-panel h1 { font-size: 26px; margin: 4px 0 14px; }
.dp-products { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; scroll-snap-type: x proximity; }
.dp-product { flex: none; width: 82px; border: 1px solid var(--line); border-radius: 12px; background: #fff; padding: 4px 4px 6px; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 3px; font: inherit; scroll-snap-align: center; }
.dp-product img { width: 66px; height: 66px; object-fit: contain; }
.dp-product span { font-size: 11px; line-height: 1.25; text-align: center; color: var(--ink-2); }
.dp-product.active { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.dp-price { display: flex; align-items: baseline; gap: 10px; margin: 8px 0 12px; }
.dp-price .amount { font-size: 26px; font-weight: 800; }
#dp-edit { margin-top: 8px; }
@media (max-width: 900px) { .dp-layout { grid-template-columns: minmax(0, 1fr); padding-top: 12px; } .dp-panel { position: static; } .dp-picture { min-height: 0; } }

/* ---------- Ready designs (admin) ---------- */
.lib-add { padding: 16px; margin-bottom: 14px; }
.lib-form { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 10px; }
@media (max-width: 860px) { .lib-form { grid-template-columns: 1fr 1fr; } .lib-form .field:first-child { grid-column: 1 / -1; } }
.lib-row { display: grid; grid-template-columns: 56px 1fr auto; gap: 12px; align-items: center; }
.lib-row.is-hidden { opacity: .55; }
.lib-thumb { width: 56px; height: 56px; border-radius: 10px; background: #f1f3f6; display: grid; place-items: center; overflow: hidden; font-weight: 800; color: var(--muted); }
.lib-thumb img { width: 100%; height: 100%; object-fit: contain; }
.lib-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
@media (max-width: 640px) { .lib-row { grid-template-columns: 48px 1fr; } .lib-actions { grid-column: 1 / -1; justify-content: flex-start; } }

/* ---------- Personalised books ---------- */
.bk-layout { display: grid; grid-template-columns: minmax(0, 1fr) 420px; gap: 20px; align-items: start; padding-top: 20px; }
.bk-layout > * { min-width: 0; }
.bk-stage { padding: 14px; position: sticky; top: 80px; background: linear-gradient(180deg, #f1f3f6, #e8ebf0); }
.bk-page { position: relative; display: grid; place-items: center; }
.bk-page img { width: 100%; max-width: 640px; aspect-ratio: 1; height: auto; display: block; border-radius: 6px; box-shadow: 0 10px 30px rgba(20, 24, 33, .18); background: #fff; transition: opacity .2s; }
.bk-page .spinner { position: absolute; }
.bk-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 42px; height: 42px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, .92); box-shadow: 0 2px 10px rgba(0, 0, 0, .18); font-size: 26px; line-height: 1; cursor: pointer; color: var(--ink); }
.bk-nav:disabled { opacity: .35; cursor: default; }
.bk-prev { inset-inline-start: 8px; }
.bk-next { inset-inline-end: 8px; }
[dir="rtl"] .bk-nav { transform: translateY(-50%) scaleX(-1); }
.bk-count { text-align: center; margin: 10px 0 6px; }
.bk-thumbs { display: flex; gap: 6px; overflow-x: auto; padding: 4px 2px 6px; scroll-snap-type: x proximity; }
.bk-thumbs button { flex: none; width: 58px; height: 58px; padding: 0; border: 2px solid transparent; border-radius: 6px; background: #fff; cursor: pointer; scroll-snap-align: center; overflow: hidden; }
.bk-thumbs button.active { border-color: var(--accent); }
.bk-thumbs img { width: 100%; height: 100%; object-fit: cover; display: block; }
.bk-sample { text-align: center; margin: 6px 0 0; }
.bk-panel { padding: 18px; }
.bk-panel h1 { font-size: 24px; margin: 0 0 6px; }
.bk-blurb { margin: 0 0 14px; line-height: 1.55; }
.bk-panel textarea { width: 100%; font: inherit; border: 1px solid var(--line); border-radius: 10px; padding: 10px; resize: vertical; }
.bk-crop canvas { width: 100%; max-width: 320px; aspect-ratio: 1; display: block; margin: 0 auto; border-radius: 12px; touch-action: none; cursor: grab; }
.bk-crop-tools { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.bk-crop-tools input[type=range] { flex: 1; }
.bk-photo-saved { display: flex; align-items: center; gap: 8px; }
.bk-pics { gap: 6px; }
.bk-pics .chip { display: inline-flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 8px; min-width: 64px; }
.bk-pics .chip img { width: 40px; height: 40px; object-fit: contain; }
.bk-pics .chip span { font-size: 12px; }
@media (max-width: 900px) {
  .bk-layout { grid-template-columns: minmax(0, 1fr); padding-top: 12px; }
  .bk-stage { position: static; }
}

.bk-ai { display: flex; gap: 10px; align-items: flex-start; padding: 12px; border: 1px solid var(--line); border-radius: 12px; margin: 0 0 14px; cursor: pointer; background: #fff; }
.bk-ai input { margin-top: 4px; flex: none; }
