/* Pixolada App photobook editor styles. Neutral interface, book in its own colours. */
:root {
  color-scheme: only light;
  --ink: #111111; --ink-2: #4b4b4b; --ink-3: #8a8a8a; --line: #e5e5e3; --line-2: #d4d4d1;
  --panel: #ffffff; --bg: #f4f4f2; --paste: #e9e9e6; --hover: #f2f2f0;
  /* Accent derived from the (placeholder) Pixolada mark — swap when the official logo palette is confirmed */
  --accent: #0E706F; --accent-soft: #e2f0ef; --warn: #b4560b; --warn-soft: #fdf1e4; --danger: #b42318;
  --r: 10px; --r-sm: 7px; --shadow: 0 6px 24px rgba(17,17,17,.12), 0 1px 3px rgba(17,17,17,.08);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--ink); font: 14px/1.4 var(--font); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
button:disabled { cursor: not-allowed; opacity: .38; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ic { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.grow { flex: 1; }
.soon { font-style: normal; font-size: 9px; font-weight: 600; letter-spacing: .03em; text-transform: uppercase; color: var(--ink-3); background: var(--hover); border: 1px solid var(--line); border-radius: 99px; padding: 0 5px; line-height: 14px; }
.is-soon { color: var(--ink-3); }
.is-soon .ic { opacity: .65; }

.app { height: 100vh; height: 100dvh; width: 100vw; overflow: hidden; display: flex; flex-direction: column; }

/* ------------------------------------------------ header */
.top { display: grid; grid-template-columns: minmax(0,1fr) auto minmax(0,1fr); align-items: center; gap: 12px; height: 60px; padding: 0 12px; background: var(--panel); border-bottom: 1px solid var(--line); flex: none; position: relative; z-index: 20; }
.tl, .tr { display: flex; align-items: center; gap: 2px; min-width: 0; }
.tr { justify-content: flex-end; gap: 6px; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 16px; letter-spacing: -.01em; padding-right: 6px; white-space: nowrap; }
.brand img { width: 30px; height: 30px; display: block; }
a.brand { color: inherit; text-decoration: none; border-radius: 8px; }
a.brand:hover img { opacity: .82; }
.vsep { width: 1px; height: 28px; background: var(--line); margin: 0 6px; flex: none; }
.hb { display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; min-width: 52px; height: 48px; padding: 0 6px; border-radius: var(--r-sm); font-size: 11px; color: var(--ink-2); position: relative; white-space: nowrap; }
.hb:hover:not(:disabled) { background: var(--hover); color: var(--ink); }
.hb.on { color: var(--accent); }
.hb .soon { position: absolute; top: 1px; right: -2px; }
.title { display: flex; align-items: center; gap: 8px; max-width: min(36vw, 460px); height: 38px; padding: 0 12px; border-radius: var(--r-sm); font-size: 16px; font-weight: 600; border: 1px solid transparent; }
.title span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.title .ic { width: 16px; height: 16px; color: var(--ink-3); }
.title:hover { border-color: var(--line); background: var(--hover); }
.title.editing { padding: 0 4px 0 0; border-color: var(--accent); background: #fff; }
.title.editing input { border: 0; outline: 0; height: 36px; padding: 0 10px; width: min(36vw, 400px); font-weight: 600; font-size: 16px; text-align: center; background: transparent; min-width: 0; }
.ib { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: var(--r-sm); color: var(--ink-2); flex: none; }
.ib:hover { background: var(--hover); color: var(--ink); }
.order { display: inline-flex; align-items: center; gap: 8px; height: 44px; padding: 0 22px; border-radius: 999px; background: var(--ink); color: #fff; font-weight: 700; font-size: 15px; white-space: nowrap; }
.order:hover { background: #2a2a2a; }

.savegrp { display: flex; align-items: stretch; position: relative; border: 1px solid var(--line); border-radius: var(--r-sm); height: 44px; }
.savebtn { display: flex; align-items: center; gap: 8px; padding: 0 10px; border-radius: var(--r-sm) 0 0 var(--r-sm); position: relative; }
.savebtn:hover, .savemenu:hover { background: var(--hover); }
.sv { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.15; }
.sv b { font-size: 13px; } .sv small { font-size: 11px; color: var(--ink-3); white-space: nowrap; }
.savegrp.dirty .sv small { color: var(--warn); }
.savegrp.saving .sv small { color: var(--accent); }
.savemenu { border-left: 1px solid var(--line); width: 28px; display: grid; place-items: center; border-radius: 0 var(--r-sm) var(--r-sm) 0; }
.savemenu .ic { width: 16px; height: 16px; }
.sdot { position: absolute; top: 8px; right: 6px; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.savegrp.dirty .sdot { background: var(--warn); } .savegrp.saving .sdot { animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .2; } }
.menu { position: absolute; top: calc(100% + 6px); right: 0; width: 240px; background: #fff; border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); padding: 6px; z-index: 40; }
.menu button { display: flex; gap: 10px; align-items: center; width: 100%; padding: 9px 10px; border-radius: var(--r-sm); text-align: left; }
.menu button:hover { background: var(--hover); }
.menu-note { font-size: 12px; color: var(--ink-3); padding: 6px 10px 8px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }

/* ------------------------------------------------ desktop body */
.body { flex: 1; min-height: 0; display: flex; }
.center { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.work { flex: 1; min-height: 0; position: relative; display: flex; flex-direction: column; background: var(--paste); }

.dock { display: flex; flex-direction: column; gap: 2px; width: 84px; padding: 8px 6px; background: var(--panel); border-right: 1px solid var(--line); overflow-y: auto; flex: none; }
.tool { position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 2px 8px; border-radius: var(--r-sm); font-size: 11.5px; color: var(--ink-2); text-align: center; }
.tool:hover { background: var(--hover); color: var(--ink); }
.tool.on { background: var(--ink); color: #fff; }
.tool.on.is-soon { color: #fff; }
.tool .soon { position: absolute; top: 3px; right: 2px; }
.tool.on .soon { background: rgba(255,255,255,.15); color: #fff; border-color: transparent; }

.toolpanel, .inspector { background: var(--panel); display: flex; flex-direction: column; min-height: 0; flex: none; }
.toolpanel { width: 300px; border-right: 1px solid var(--line); }
.toolpanel.closed { display: none; }
.inspector { width: 290px; border-left: 1px solid var(--line); }
.inspector.closed { width: 44px; align-items: center; padding-top: 10px; }
.ins-tab { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 4px; border-radius: var(--r-sm); color: var(--ink-2); font-size: 11px; writing-mode: vertical-rl; }
.ins-tab .ic { transform: rotate(90deg); }
.ins-tab:hover { background: var(--hover); }
.tp-h { display: flex; align-items: center; justify-content: space-between; padding: 12px 12px 10px 16px; border-bottom: 1px solid var(--line); flex: none; }
.tp-h b { font-size: 15px; }
.tp-b { flex: 1; overflow-y: auto; padding: 14px 16px 24px; }

/* ------------------------------------------------ tool content */
.hint { color: var(--ink-3); font-size: 12.5px; margin: 10px 0; }
.hint b { color: var(--ink-2); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 36px; padding: 0 14px; border-radius: var(--r-sm); border: 1px solid var(--line-2); background: #fff; font-weight: 600; font-size: 13px; white-space: nowrap; }
.btn:hover:not(:disabled) { background: var(--hover); }
.btn.dark { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn.dark:hover:not(:disabled) { background: #2a2a2a; }
.btn.ghost { border-color: transparent; }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.sm { height: 30px; padding: 0 10px; font-size: 12px; }
.btn.wide { width: 100%; margin-top: 12px; }
.btn .ic { width: 17px; height: 17px; }
.upload { display: grid; gap: 8px; }
.upload .btn { width: 100%; height: 42px; }
.drop { border: 1.5px dashed var(--line-2); border-radius: var(--r); padding: 12px; text-align: center; color: var(--ink-3); font-size: 12.5px; }
.lib-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 16px; font-size: 12.5px; color: var(--ink-2); }
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.tile { position: relative; aspect-ratio: 1; border-radius: var(--r-sm); overflow: hidden; background: var(--hover); border: 2px solid transparent; }
.tile img { width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none; }
.tile:hover { border-color: var(--line-2); }
.tile.used img { opacity: .78; }
.tile .badge { position: absolute; right: 4px; bottom: 4px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 99px; background: var(--ink); color: #fff; font-size: 11px; font-weight: 700; line-height: 18px; }
.tile .lowtag { position: absolute; left: 4px; top: 4px; background: var(--warn); color: #fff; font-size: 9.5px; font-weight: 700; padding: 1px 5px; border-radius: 4px; }
.tile.uploading { display: flex; flex-direction: column; justify-content: center; gap: 6px; padding: 8px; font-size: 10.5px; color: var(--ink-3); }
.tile.uploading span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar { height: 4px; border-radius: 4px; background: var(--line); overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--accent); transition: width .15s; }
.banner { display: flex; align-items: center; gap: 8px; background: var(--accent-soft); color: var(--accent); border-radius: var(--r-sm); padding: 8px 10px; margin-bottom: 12px; font-size: 12.5px; font-weight: 600; }
.banner span { flex: 1; } .banner button { text-decoration: underline; font-weight: 600; }

.target { display: flex; flex-direction: column; gap: 6px; margin-bottom: 4px; font-size: 12px; color: var(--ink-3); }
.seg { display: inline-flex; background: var(--hover); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 2px; gap: 2px; }
.seg button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 30px; padding: 0 10px; border-radius: 5px; font-size: 12.5px; color: var(--ink-2); white-space: nowrap; }
.seg button.on { background: #fff; color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.12); font-weight: 600; }
.seg.sm button { height: 28px; flex: 1; }
.seg.wide { display: flex; margin: 8px 0; } .seg.wide button { flex: 1; }
.seg .ic { width: 17px; height: 17px; }

.acc { border-bottom: 1px solid var(--line); }
.acc-h { display: flex; width: 100%; justify-content: space-between; align-items: center; padding: 12px 2px; font-weight: 600; }
.acc-h .ic { width: 16px; height: 16px; color: var(--ink-3); }
.acc-b.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; padding-bottom: 14px; }
.lay { display: flex; flex-direction: column; align-items: center; gap: 5px; padding: 6px 4px; border-radius: var(--r-sm); font-size: 11px; color: var(--ink-2); border: 1px solid transparent; }
.lay:hover { background: var(--hover); border-color: var(--line); }
.lthumb { width: 100%; max-width: 64px; height: auto; display: block; }
.lthumb .lp { fill: #fff; stroke: var(--line-2); }
.lthumb .lr { fill: #bfc8c8; }
.lthumb .lt { fill: var(--ink-3); }
.check { display: flex; align-items: center; gap: 8px; margin: 12px 0 4px; font-size: 13px; }
h4 { margin: 16px 0 8px; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-3); }
h5 { margin: 16px 0 6px; font-size: 12px; color: var(--ink-3); font-weight: 600; }
.sw { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.swatch { aspect-ratio: 1; border-radius: 50%; border: 1px solid rgba(0,0,0,.14); position: relative; }
.swatch.on { box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--accent); }
.swatch.custom { display: grid; place-items: center; background: conic-gradient(#e8b4a0, #e5c36b, #9cc5a1, #8db3d6, #8e7cc3, #e8b4a0); color: #fff; font-weight: 700; cursor: pointer; overflow: hidden; }
.swatch.custom input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.sw.pat { grid-template-columns: repeat(3, 1fr); }
.patt { aspect-ratio: 1.3; border-radius: var(--r-sm); border: 1px solid var(--line-2); display: flex; align-items: flex-end; padding: 4px; }
.patt span { font-size: 11px; background: rgba(255,255,255,.88); padding: 1px 5px; border-radius: 4px; }
.patt.on { box-shadow: 0 0 0 2px var(--accent); }

.qrform { display: grid; gap: 10px; margin-top: 10px; }
.qrform label, .fld { display: flex; flex-direction: column; gap: 5px; font-size: 12px; color: var(--ink-3); position: relative; margin: 6px 0; }
.qrform input, .qrform select, .fld input, .fld select, .fld textarea { height: 36px; border: 1px solid var(--line-2); border-radius: var(--r-sm); padding: 0 10px; background: #fff; font-size: 13.5px; color: var(--ink); min-width: 0; width: 100%; }
.fld textarea { height: auto; padding: 8px 10px; resize: vertical; }
.fld > i { position: absolute; right: 10px; bottom: 9px; font-style: normal; color: var(--ink-3); font-size: 12px; }
.qrprev { display: flex; gap: 12px; align-items: center; margin-top: 14px; padding: 12px; border: 1px solid var(--line); border-radius: var(--r); background: var(--bg); }
.qrprev .qrsvg { width: 92px; height: 92px; flex: none; border-radius: 4px; }
.qrprev div { display: flex; flex-direction: column; gap: 3px; min-width: 0; font-size: 12px; }
.qrprev span { color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qrprev small { color: var(--ink-3); }
.soon-card { text-align: center; padding: 18px 6px; color: var(--ink-2); }
.soon-card > .ic { width: 32px; height: 32px; color: var(--ink-3); }
.soon-card b { display: block; margin: 8px 0 6px; color: var(--ink); }
.soon-card p { font-size: 12.5px; color: var(--ink-3); margin: 0 0 16px; }
.skel { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.skel i { aspect-ratio: .8; border-radius: var(--r-sm); background: linear-gradient(90deg, var(--hover), #fafaf9, var(--hover)); border: 1px dashed var(--line-2); }

/* inspector content */
.ins-h { display: flex; flex-direction: column; gap: 2px; padding-bottom: 10px; border-bottom: 1px solid var(--line); margin-bottom: 6px; min-width: 0; }
.ins-h .kind { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--accent); font-weight: 700; }
.ins-h b { font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ins-h small { color: var(--ink-3); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.rng { display: flex; align-items: center; gap: 10px; }
.rng input { flex: 1; accent-color: var(--ink); min-width: 0; }
.rng output { width: 46px; text-align: right; color: var(--ink); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.facts { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; font-size: 12.5px; margin: 14px 0 0; }
.facts dt { color: var(--ink-3); } .facts dd { margin: 0; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.chip { width: 14px; height: 14px; border-radius: 4px; border: 1px solid rgba(0,0,0,.15); display: inline-block; }
.warn-t { color: var(--warn); font-weight: 600; }
.res { margin: 14px 0 6px; padding: 10px 12px; border-radius: var(--r-sm); background: var(--bg); font-size: 12px; }
.res > div:first-child { display: flex; justify-content: space-between; align-items: baseline; }
.res b { font-size: 15px; }
.meter { height: 6px; background: var(--line); border-radius: 6px; overflow: hidden; margin: 8px 0 6px; }
.meter i { display: block; height: 100%; background: #3c8d63; }
.res.mid .meter i { background: #c9922e; } .res.low .meter i { background: var(--warn); }
.res.low { background: var(--warn-soft); } .res.low small { color: var(--warn); font-weight: 600; }
.res small { color: var(--ink-3); }
.btnrow { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 12px; }
.btnrow .btn { flex: 1; padding: 0 8px; }

/* ------------------------------------------------ canvas */
.canvas { flex: 1; min-height: 0; overflow: auto; display: flex; touch-action: pan-x pan-y; overscroll-behavior: contain; }
.stage { margin: auto; position: relative; flex: none; }
.sheet-pos { position: absolute; }
.sheet { position: relative; overflow: hidden; background: #fff; box-shadow: 0 2px 6px rgba(0,0,0,.08), 0 12px 32px rgba(0,0,0,.12); }
.pg { position: absolute; top: 0; bottom: 0; }
.pg.locked { background: repeating-linear-gradient(135deg, #e8e8e5 0 8px, #e1e1de 8px 16px); display: grid; place-items: center; }
.lockmsg { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-3); background: rgba(255,255,255,.85); padding: 5px 10px; border-radius: 99px; }
.lockmsg .ic { width: 15px; height: 15px; }
.fold { position: absolute; top: 0; bottom: 0; pointer-events: none; z-index: 5; background: linear-gradient(90deg, transparent, rgba(0,0,0,.08) 45%, rgba(0,0,0,.14) 50%, rgba(0,0,0,.08) 55%, transparent); }
.spine-lines { position: absolute; top: 0; bottom: 0; border-left: 1px dashed rgba(0,0,0,.25); border-right: 1px dashed rgba(0,0,0,.25); pointer-events: none; z-index: 6; }
.safe { position: absolute; border: 1px dashed rgba(14,112,111,.35); pointer-events: none; z-index: 6; }
.el { position: absolute; transform-origin: 50% 50%; }
.el.photo { overflow: hidden; background: #d9dcdc; }
.el.photo img { position: absolute; max-width: none; user-select: none; pointer-events: none; }
.el.photo.fit { background: #f0f0ee; }
.el.photo.empty { background: #d6d9d9; }
.ph { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; color: #6f7676; font-size: 12px; font-weight: 600; }
.ph .ic { width: 26px; height: 26px; }
.ph-t { position: absolute; inset: 0; background: #cfd3d3; }
.el.photo.drop-hit { outline: 3px solid var(--accent); outline-offset: -3px; }
.el.photo.drop-hit::after { content: ""; position: absolute; inset: 0; background: rgba(14,112,111,.18); }
.el.photo.replacing { outline: 3px dashed var(--accent); outline-offset: -3px; }
.lowres { position: absolute; right: 6px; top: 6px; width: 24px; height: 24px; border-radius: 50%; background: var(--warn); color: #fff; display: grid; place-items: center; box-shadow: 0 1px 3px rgba(0,0,0,.3); }
.lowres .ic { width: 15px; height: 15px; stroke-width: 2.2; }
.el.text { display: flex; }
.tx { width: 100%; align-self: center; line-height: 1.2; white-space: pre-wrap; overflow-wrap: anywhere; }
.f-serif { font-family: Georgia, "Times New Roman", serif; }
.f-sans { font-family: var(--font); }
.f-script { font-family: "Segoe Script", "Brush Script MT", "Snell Roundhand", cursive; }
.tph { color: rgba(0,0,0,.35); font-style: italic; }
.el.text.empty { outline: 1px dashed rgba(0,0,0,.25); outline-offset: -1px; }
.k-cover .el.text.empty { outline-color: rgba(0,0,0,.3); }
.el.qr .qrsvg { width: 100%; height: 100%; display: block; }
.thumbclip .el.text.empty, .preview .el.text.empty { outline: 0; }
.thumbclip .safe, .preview .safe { display: none; }
.preview .el.photo.empty { background: transparent; } /* prints as blank space; the top bar says how many */

.ovl { position: absolute; inset: 0; pointer-events: none; z-index: 10; }
.ovl > * { pointer-events: auto; }
.target-ring { position: absolute; top: 0; pointer-events: none !important; box-shadow: inset 0 0 0 2px var(--accent); }
.pagebar { position: absolute; z-index: 12; display: flex; align-items: center; gap: 2px; padding: 3px; background: #fff; border: 1px solid var(--line); border-radius: 999px; box-shadow: 0 2px 10px rgba(0,0,0,.08); white-space: nowrap; }
.pagebar .pb-lab { font-size: 12px; font-weight: 700; color: var(--accent); padding: 0 10px 0 12px; border-right: 1px solid var(--line); margin-right: 2px; }
.pagebar button { display: inline-flex; align-items: center; gap: 5px; height: 30px; padding: 0 10px; border-radius: 99px; font-size: 12.5px; color: var(--ink-2); }
.pagebar button:hover { background: var(--hover); color: var(--ink); }
.pagebar .ic { width: 16px; height: 16px; }
.selbox { position: absolute; transform-origin: 50% 50%; outline: 2px solid var(--accent); cursor: move; touch-action: none; }
.selbox .dims { position: absolute; left: 50%; bottom: -26px; transform: translateX(-50%); font-size: 11px; background: var(--ink); color: #fff; padding: 2px 7px; border-radius: 5px; white-space: nowrap; pointer-events: none; opacity: 0; transition: opacity .15s; }
.selbox:hover .dims, .selbox:active .dims { opacity: .9; }
.hd { position: absolute; width: 12px; height: 12px; background: #fff; border: 2px solid var(--accent); border-radius: 50%; margin: -6px 0 0 -6px; touch-action: none; }
.hd::before { content: ""; position: absolute; inset: -10px; } /* bigger hit area */
.hd-nw { left: 0; top: 0; cursor: nwse-resize; } .hd-n { left: 50%; top: 0; cursor: ns-resize; } .hd-ne { left: 100%; top: 0; cursor: nesw-resize; }
.hd-e { left: 100%; top: 50%; cursor: ew-resize; } .hd-se { left: 100%; top: 100%; cursor: nwse-resize; } .hd-s { left: 50%; top: 100%; cursor: ns-resize; }
.hd-sw { left: 0; top: 100%; cursor: nesw-resize; } .hd-w { left: 0; top: 50%; cursor: ew-resize; }
.hd-rot { position: absolute; left: 50%; top: 100%; margin: 12px 0 0 -14px; width: 28px; height: 28px; border-radius: 50%; background: #fff; border: 1px solid var(--line-2); box-shadow: 0 1px 4px rgba(0,0,0,.15); display: grid; place-items: center; cursor: grab; touch-action: none; color: var(--ink-2); }
.hd-rot .ic { width: 15px; height: 15px; }
.selbox:has(.hd-rot:hover) .dims { opacity: 0; }
.cropghost { position: absolute; transform-origin: 50% 50%; cursor: grab; touch-action: none; }
.cropghost img { position: absolute; max-width: none; opacity: .38; pointer-events: none; }
.selbox.crop { outline: 2px solid #fff; box-shadow: 0 0 0 1px var(--ink), 0 0 0 9999px rgba(20,20,20,.22); cursor: grab; display: grid; place-items: center; }
.crop-hint { display: inline-flex; align-items: center; gap: 6px; background: rgba(17,17,17,.75); color: #fff; font-size: 12px; padding: 5px 10px; border-radius: 99px; pointer-events: none; white-space: nowrap; }
.crop-hint .ic { width: 15px; height: 15px; }

.side-lab { position: absolute; display: flex; align-items: center; justify-content: center; gap: 6px; font-size: 12px; color: var(--ink-3); height: 22px; border-radius: 6px; }
.side-lab:hover:not(:disabled) { color: var(--ink); }
.side-lab.on { color: var(--accent); font-weight: 700; }
.side-lab .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }

.floatbar { position: absolute; z-index: 15; display: flex; align-items: center; gap: 2px; padding: 4px; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); white-space: nowrap; }
.floatbar button { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 10px; border-radius: 8px; font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.floatbar button:hover { background: var(--hover); color: var(--ink); }
.floatbar button.hl { background: var(--ink); color: #fff; }
.floatbar .ic { width: 17px; height: 17px; }
.fb-sep { width: 1px; height: 22px; background: var(--line); margin: 0 3px; }
.fb-note { font-size: 12px; color: var(--ink-3); padding: 0 8px; }

.cropbar { position: absolute; left: 50%; top: 12px; transform: translateX(-50%); z-index: 25; display: flex; align-items: center; gap: 8px; padding: 6px 6px 6px 14px; background: #fff; border-radius: 14px; box-shadow: var(--shadow); max-width: calc(100% - 16px); }
.cb-t { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.cb-t small { color: var(--ink-3); }
.cb-z { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--ink-3); padding: 0 8px; border-left: 1px solid var(--line); border-right: 1px solid var(--line); white-space: nowrap; }
.cb-z input { width: 120px; accent-color: var(--ink); }
.cb-z output { width: 40px; color: var(--ink); font-variant-numeric: tabular-nums; }

.overview { flex: 1; overflow-y: auto; padding: 20px 24px 28px; }
.ov-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 14px; }
.ov-head span { color: var(--ink-3); font-size: 12.5px; }
.ov-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(236px, 1fr)); gap: 18px; }
.ov-card { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 10px; border-radius: var(--r); border: 2px solid transparent; font-size: 12.5px; color: var(--ink-2); }
.ov-card:hover { background: rgba(255,255,255,.6); }
.ov-card.on { border-color: var(--accent); background: #fff; color: var(--ink); font-weight: 600; }
.thumbclip { overflow: hidden; pointer-events: none; }
.thumbclip .sheet { box-shadow: 0 1px 4px rgba(0,0,0,.18); }

/* ------------------------------------------------ bottom nav */
.nav { background: var(--panel); border-top: 1px solid var(--line); flex: none; }
.nav-row { display: flex; align-items: center; gap: 10px; padding: 6px 12px; min-width: 0; }
.nb { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 34px; min-width: 34px; padding: 0 8px; border-radius: var(--r-sm); color: var(--ink-2); font-size: 12.5px; white-space: nowrap; }
.nb:hover:not(:disabled) { background: var(--hover); color: var(--ink); }
.nb.on { color: var(--accent); }
.nb.danger:hover:not(:disabled) { color: var(--danger); }
.nb .ic { width: 18px; height: 18px; }
.pager { display: flex; align-items: center; gap: 2px; border: 1px solid var(--line); border-radius: var(--r-sm); padding: 1px; }
.curlab { min-width: 92px; text-align: center; font-weight: 700; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 6px; }
.zoom { display: flex; align-items: center; gap: 2px; border: 1px solid var(--line); border-radius: var(--r-sm); padding: 1px; }
.pct { min-width: 46px; text-align: center; font-size: 12.5px; font-variant-numeric: tabular-nums; }
.fitb { border-left: 1px solid var(--line); border-radius: 0 6px 6px 0; }
.seg.lab button { height: 30px; }
.pagecount { color: var(--ink-3); font-size: 12.5px; }
.strip-row { display: flex; align-items: stretch; border-top: 1px solid var(--line); min-width: 0; }
.strip { display: flex; gap: 10px; padding: 8px 12px 6px; overflow-x: auto; overflow-y: hidden; flex: 1; min-width: 0; scrollbar-width: thin; }
.th { display: flex; flex-direction: column; align-items: center; gap: 3px; flex: none; padding: 4px; border-radius: var(--r-sm); border: 2px solid transparent; font-size: 11px; color: var(--ink-3); }
.th:hover { background: var(--hover); }
.th.on { border-color: var(--ink); color: var(--ink); font-weight: 700; }
.th.more { justify-content: center; min-width: 64px; border: 1px dashed var(--line-2); color: var(--ink-2); }
.struct { display: flex; flex-direction: column; justify-content: center; flex-wrap: wrap; gap: 2px; padding: 6px 10px; border-left: 1px solid var(--line); max-height: 92px; align-content: flex-start; }
.struct .nb { justify-content: flex-start; height: 28px; font-size: 12px; }

/* ------------------------------------------------ dialogs, preview, toast */
.scrim { position: fixed; inset: 0; background: rgba(17,17,17,.42); display: grid; place-items: center; z-index: 100; padding: 16px; }
.dialog { background: #fff; border-radius: 16px; box-shadow: var(--shadow); width: min(640px, 100%); max-height: calc(100dvh - 32px); display: flex; flex-direction: column; overflow: hidden; }
.dialog.dlg-confirm { width: min(420px, 100%); }
.dlg-h { display: flex; align-items: center; justify-content: space-between; padding: 14px 14px 12px 20px; border-bottom: 1px solid var(--line); font-size: 16px; }
.dlg-b { padding: 18px 20px; overflow-y: auto; }
.dlg-b.ordgrid { display: grid; grid-template-columns: auto 1fr; gap: 18px 22px; }
.ord-cover { align-self: start; }
.ord-info h3 { margin: 0 0 4px; font-size: 18px; }
.checks { grid-column: 1 / -1; }
.checks h4 { margin-top: 0; }
.chk { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: var(--r-sm); margin-bottom: 6px; font-size: 13px; }
.chk span { flex: 1; } .chk .ic { width: 18px; height: 18px; }
.chk.warn { background: var(--warn-soft); color: #7a3a07; } .chk.ok { background: #eaf5ee; color: #1f6a3c; } .chk.info { background: var(--bg); color: var(--ink-2); }
.dlg-f { display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.proto-note { margin-right: auto; font-size: 12px; color: var(--ink-3); }

.preview { position: fixed; inset: 0; z-index: 90; background: #1b1b1b; color: #fff; display: flex; flex-direction: column; }
.pv-top { display: flex; align-items: center; gap: 16px; padding: 12px 16px; }
.pv-top .btn { background: transparent; color: #fff; border-color: rgba(255,255,255,.3); }
.pv-top .btn:hover { background: rgba(255,255,255,.1); }
.pv-note { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: #d8d8d8; }
.pv-note .ic { width: 16px; height: 16px; color: #f2b36b; }
.pv-stage { flex: 1; display: flex; align-items: center; justify-content: center; gap: 12px; min-height: 0; }
.pv-book .sheet { box-shadow: 0 20px 60px rgba(0,0,0,.5); }
.pv-arrow { width: 44px; height: 44px; border-radius: 50%; background: rgba(255,255,255,.1); color: #fff; display: grid; place-items: center; flex: none; }
.pv-arrow:hover:not(:disabled) { background: rgba(255,255,255,.2); }
.pv-lab { text-align: center; padding: 12px; font-size: 13px; color: #cfcfcf; }

#toast { position: fixed; left: 50%; bottom: 150px; transform: translateX(-50%); z-index: 120; pointer-events: none; max-width: calc(100vw - 24px); }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 14px; background: var(--ink); color: #fff; padding: 10px 14px 10px 16px; border-radius: 10px; box-shadow: var(--shadow); font-size: 13px; animation: up .18s ease-out; }
.toast button { color: #9fe0dc; font-weight: 700; }
@keyframes up { from { transform: translateY(8px); opacity: 0; } }

/* nav adapts to the canvas column width, not the window (panels can be open or closed) */
.m-desktop .center { container-type: inline-size; }
@container (max-width: 860px) {
  .pagecount { display: none; }
  .nav-row .nb[data-a="thumbs"] span { display: none; }
}
@container (max-width: 760px) {
  .pager .nb span, .seg.lab button { font-size: 0; gap: 0; }
  .seg.lab button .ic { width: 18px; height: 18px; }
  .fitb span { display: none; }
  .struct { flex-direction: row; max-height: none; }
  .struct .nb span { display: none; }
}

/* ------------------------------------------------ desktop compact (1024–1439) */
@media (max-width: 1439px) {
  .m-desktop .toolpanel { width: 272px; }
  .m-desktop .inspector:not(.closed) { width: 264px; }
  .m-desktop .hb { min-width: 46px; padding: 0 4px; }
  .m-desktop .title { max-width: min(30vw, 380px); }
  .m-desktop .order { padding: 0 18px; }
}
@media (max-width: 1279px) {
  .m-desktop .brand span { display: none; }
  .m-desktop .hb span:not(.soon) { display: none; }
  .m-desktop .hb { height: 40px; min-width: 38px; }
  .m-desktop .struct { max-height: none; flex-direction: row; }
  .m-desktop .struct .nb span { display: none; }
  .m-desktop .nav-row .seg.lab button { padding: 0 8px; }
  .m-desktop .pagecount { display: none; }
}

/* ------------------------------------------------ mobile (portrait / narrow) */
.m-mobile .top { height: 52px; padding: 0 10px; gap: 8px; }
.m-mobile .brand img { width: 28px; height: 28px; }
.m-mobile .title { max-width: 100%; height: 36px; font-size: 15px; padding: 0 8px; }
.m-mobile .title.editing input { width: 100%; font-size: 15px; }
.m-mobile .tc { min-width: 0; }
.m-mobile .order { height: 38px; padding: 0 14px; font-size: 14px; }
.m-mobile .order .ic { width: 18px; height: 18px; }
.actbar { display: flex; align-items: center; gap: 4px; padding: 4px 8px; background: var(--panel); border-bottom: 1px solid var(--line); flex: none; min-width: 0; }
.actbar .hb, .m-mland .hb { min-width: 38px; width: 38px; height: 38px; padding: 0; }
.actbar .hb span:not(.soon), .m-mland .hb span:not(.soon) { display: none; }
.actbar .seg button { height: 30px; padding: 0 8px; }
/* Narrow phones: Magic | Arrange | Studio plus undo, redo, save, preview and the menu must fit in one row. */
@media (max-width: 440px) {
  .actbar { gap: 2px; padding: 4px 4px; }
  .actbar .hb { min-width: 30px; width: 30px; }
  .actbar .seg.modesw { gap: 0; }
  .actbar .seg.modesw button { padding: 0 7px; font-size: 12px; }
}
.actbar .savegrp, .m-mland .savegrp { height: 38px; }
.actbar .savebtn, .m-mland .savebtn { padding: 0 10px; }
.m-mobile .nav-row { padding: 4px 6px; gap: 6px; }
.m-mobile .curlab { min-width: 0; flex: 1; font-size: 12.5px; }
.m-mobile .pager { flex: 1; min-width: 0; }
.m-mobile .nb { min-width: 34px; height: 34px; padding: 0 6px; }
.m-mobile .pct { min-width: 40px; font-size: 12px; }
.m-mobile .strip, .m-mland .strip { padding: 4px 8px 6px; gap: 6px; border-top: 1px solid var(--line); }
.m-mobile .th, .m-mland .th { font-size: 10px; padding: 3px; }
.m-mobile .dock { flex-direction: row; width: auto; height: 62px; padding: 4px 6px calc(4px + env(safe-area-inset-bottom)); border-right: 0; border-top: 1px solid var(--line); overflow-x: auto; overflow-y: hidden; gap: 2px; scroll-snap-type: x proximity; }
.m-mobile .tool { flex: none; width: 70px; padding: 6px 2px; font-size: 10.5px; gap: 2px; scroll-snap-align: start; }
.m-mobile .tool .soon, .m-mland .tool .soon { font-size: 7.5px; padding: 0 3px; line-height: 11px; }
.m-mobile .toast, .m-mland .toast { font-size: 12.5px; }
.m-mobile #toast { bottom: auto; top: 104px; }
.m-mobile .cropbar, .m-mland .cropbar { top: 8px; flex-wrap: wrap; justify-content: center; padding: 8px; gap: 6px; width: calc(100% - 16px); border-radius: 12px; }
.m-mobile .cb-t small, .m-mland .cb-t small { display: none; }
.m-mobile .cropbar { top: auto; bottom: 8px; display: grid; grid-template-columns: 1fr auto auto auto; align-items: center; }
.m-mobile .cropbar .cb-t { display: none; }
.m-mobile .cropbar .cb-z { grid-column: 1 / -1; width: 100%; }
.m-mobile .cropbar .cb-z input { flex: 1; width: auto; }
.m-mobile .cropbar .cb-z > span { display: inline; color: var(--ink-2); }
.m-mobile .cropbar .btn.ghost { justify-self: start; }
.m-mobile .cb-z, .m-mland .cb-z { border: 0; padding: 0; }
.m-mobile .cb-z input, .m-mland .cb-z input { width: 90px; }
.m-mobile .cb-z > span, .m-mland .cb-z > span { display: none; }
.m-mobile .cropbar .btn, .m-mland .cropbar .btn { height: 34px; padding: 0 12px; }
.m-mobile .side-lab, .m-mland .side-lab { font-size: 11px; height: 20px; }
.m-mobile .selbox .dims, .m-mland .selbox .dims { display: none; }
.m-mobile .hd, .m-mland .hd { width: 14px; height: 14px; margin: -7px 0 0 -7px; }

/* bottom sheet (in-flow, so the canvas shrinks instead of being covered) */
.sheet-panel { background: var(--panel); border-top: 1px solid var(--line); box-shadow: 0 -8px 24px rgba(0,0,0,.08); display: flex; flex-direction: column; flex: none; max-height: 46%; min-height: 0; border-radius: 16px 16px 0 0; position: relative; z-index: 5; }
.sh-h { display: flex; align-items: center; gap: 8px; padding: 14px 8px 8px 16px; position: relative; flex: none; }
.sh-h b { font-size: 15px; }
.sh-h .ib { margin-left: auto; }
.grab { position: absolute; left: 50%; top: 5px; width: 36px; height: 4px; border-radius: 4px; background: var(--line-2); transform: translateX(-50%); }
.tchip { font-size: 11.5px; font-weight: 700; color: var(--accent); background: var(--accent-soft); padding: 2px 8px; border-radius: 99px; white-space: nowrap; }
.sh-b { overflow-y: auto; padding: 0 16px 14px; min-height: 0; }
.sh-b .hint { margin: 6px 0; }
.m-mobile .sh-b .upload, .m-mland .sh-b .upload { grid-template-columns: 1fr 1fr; }
.m-mobile .sh-b .upload .btn, .m-mland .sh-b .upload .btn { height: 38px; font-size: 12.5px; padding: 0 8px; }
.m-mobile .sh-b .tiles { display: flex; overflow-x: auto; gap: 8px; padding-bottom: 4px; scroll-snap-type: x proximity; }
.m-mobile .sh-b .tile { width: 84px; flex: none; scroll-snap-align: start; }
.m-mobile .sh-b .tw { width: 84px; flex: none; scroll-snap-align: start; }
.m-mobile .sh-b .tw .tile { width: 100%; }
.m-mland .grab { display: none; }
.m-mland .sh-h { padding-top: 10px; }
.m-mland .sh-b .sw { grid-template-columns: repeat(5, 1fr); }
.carousel { display: flex !important; overflow-x: auto; gap: 8px; padding-bottom: 6px; scroll-snap-type: x proximity; }
.carousel > * { flex: none; scroll-snap-align: start; }
.acc-b.carousel { padding-bottom: 12px; }
.acc-b.carousel .lay { width: 76px; }
.sw.carousel .swatch { width: 38px; }
.sw.pat.carousel .patt { width: 74px; }
.sh-b .acc-h { padding: 8px 2px; }
.sh-b .target { flex-direction: row; align-items: center; gap: 10px; }
.sh-b .target .seg { flex: 1; }
.sh-b .check { margin: 8px 0 0; }
.sh-b h4 { margin: 12px 0 6px; }
.sh-b .qrform { grid-template-columns: 1.4fr 1fr; gap: 8px; }
.sh-b .qrprev { margin-top: 8px; padding: 8px; }
.sh-b .qrprev .qrsvg { width: 64px; height: 64px; }
.sh-b .soon-card { padding: 4px 0; }
.skel.row { display: flex; overflow: hidden; }
.skel.row i { width: 70px; flex: none; }
.pages-actions { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 6px; }
.pages-actions .nb { justify-content: flex-start; height: 40px; border: 1px solid var(--line); }

.ctxbar { display: flex; align-items: center; gap: 4px; padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); background: var(--panel); border-top: 1px solid var(--line); flex: none; min-width: 0; }
.ctx-kind { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--accent); padding: 0 6px; writing-mode: horizontal-tb; flex: none; }
.ctx-items { display: flex; gap: 2px; overflow-x: auto; flex: 1; min-width: 0; scrollbar-width: none; -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 28px), transparent); mask-image: linear-gradient(90deg, #000 calc(100% - 28px), transparent); padding-right: 24px; }
.m-mobile .dock, .m-mobile .strip { -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 24px), transparent); mask-image: linear-gradient(90deg, #000 calc(100% - 24px), transparent); }
.ctx-items button { display: flex; flex-direction: column; align-items: center; gap: 2px; flex: none; min-width: 58px; padding: 5px 4px; border-radius: var(--r-sm); font-size: 10.5px; color: var(--ink-2); }
.ctx-items button:active { background: var(--hover); }
.ctx-done { flex: none; height: 40px; padding: 0 14px; border-radius: var(--r-sm); background: var(--ink); color: #fff; font-weight: 700; font-size: 13px; }

.m-mobile .scrim, .m-mland .scrim { place-items: end center; padding: 0; }
.m-mobile .dialog, .m-mland .dialog { width: 100%; border-radius: 16px 16px 0 0; max-height: 92dvh; }
.m-mobile .dlg-b.ordgrid { grid-template-columns: 1fr; justify-items: center; }
.m-mobile .ord-info { width: 100%; }
.m-mobile .dlg-f .btn, .m-mland .dlg-f .btn { flex: 1; }
.m-mobile .proto-note, .m-mland .proto-note { width: 100%; text-align: center; margin: 0 0 4px; }
.m-mobile .pv-top, .m-mland .pv-top { flex-wrap: wrap; gap: 8px; padding: 10px; }
.m-mobile .pv-top b { display: none; }
.m-mobile .pv-note { margin-left: 0; width: 100%; }
.m-mobile .pv-stage { gap: 0; position: relative; }
.m-mobile .pv-arrow { position: absolute; bottom: -54px; }
.m-mobile .pv-arrow:first-child { left: 16px; } .m-mobile .pv-arrow:last-child { right: 16px; }
.m-mobile .pv-lab { padding: 22px 70px; }

/* ------------------------------------------------ mobile landscape (short height) */
.m-mland .top { height: 46px; padding: 0 8px; gap: 8px; }
.m-mland .tl { gap: 2px; }
.m-mland .brand { padding-right: 2px; } .m-mland .brand img { width: 26px; height: 26px; }
.m-mland .title { height: 34px; font-size: 14px; max-width: 30vw; }
.m-mland .title.editing input { width: 26vw; font-size: 14px; }
.m-mland .order { height: 34px; padding: 0 14px; font-size: 13px; }
.m-mland .order .ic { width: 17px; height: 17px; }
.m-mland .seg button { height: 28px; padding: 0 7px; }
.m-mland .dock { width: 70px; padding: 4px; gap: 0; padding-left: max(4px, env(safe-area-inset-left)); scrollbar-width: none; -webkit-mask-image: linear-gradient(#000 calc(100% - 20px), transparent); mask-image: linear-gradient(#000 calc(100% - 20px), transparent); padding-bottom: 18px; }
.m-mland .dock::-webkit-scrollbar { display: none; }
.m-mland .tool { padding: 5px 0; font-size: 9.5px; gap: 1px; }
.m-mland .tool > span:not(.soon) { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.m-mland .tool .ic { width: 18px; height: 18px; }
.m-mland .sheet-panel { width: 290px; max-height: none; border-radius: 0; border-top: 0; border-right: 1px solid var(--line); box-shadow: none; }
.m-mland .sh-b .upload { grid-template-columns: 1fr; }
.m-mland .sh-b .qrform { grid-template-columns: 1fr; }
.m-mland .nav-row { padding: 2px 6px; gap: 6px; }
.m-mland .nb { height: 32px; min-width: 32px; padding: 0 6px; }
.m-mland .curlab { min-width: 70px; font-size: 12px; }
.m-mland .ctxbar { padding: 3px 6px; }
.m-mland .ctx-items button { flex-direction: row; gap: 5px; min-width: 0; padding: 6px 8px; font-size: 11.5px; }
.m-mland .ctx-items .ic { width: 16px; height: 16px; }
.m-mland .ctx-done { height: 32px; }
.m-mland #toast { bottom: 60px; }
.m-mland .dlg-b.ordgrid { grid-template-columns: auto 1fr; }
.m-mland .pv-top b { display: none; }
.m-mland .pv-note { margin-left: auto; }

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

/* ================================================ Pixory-parity additions (templates, text, stickers, shapes, adjust, checks, versions) */
.m-desktop .tool { padding: 8px 2px 7px; }
.fonts-note { font-size: 11px; color: var(--ink-3); }
.f-elegant { font-family: "Palatino Linotype", "Book Antiqua", Palatino, Georgia, serif; }
.f-rounded { font-family: "Trebuchet MS", "Segoe UI", Verdana, sans-serif; }
.f-condensed { font-family: "Arial Narrow", "Bahnschrift Condensed", "Roboto Condensed", Impact, sans-serif; letter-spacing: .02em; }
.f-mono { font-family: "Courier New", Courier, ui-monospace, monospace; }

/* elements */
.el.shape, .el.sticker { overflow: visible; }
.shp, .stk { width: 100%; height: 100%; display: block; overflow: visible; }
.pborder { position: absolute; inset: 0; pointer-events: none; }
.el.text.inline { outline: 2px solid var(--accent); outline-offset: 2px; z-index: 30; }
.el.text.inline .tx { cursor: text; outline: 0; user-select: text; -webkit-user-select: text; min-height: 1em; }
.guide { position: absolute; pointer-events: none !important; z-index: 9; }
.guide.v { top: 0; width: 0; border-left: 1px dashed #e0457b; }
.guide.h { left: 0; height: 0; border-top: 1px dashed #e0457b; }

/* floating toolbar extras */
.floatbar button.on { background: var(--accent-soft); color: var(--accent); }
.fb-font { height: 34px; border: 1px solid var(--line); border-radius: 8px; padding: 0 6px; font-size: 12.5px; background: #fff; max-width: 132px; }
.fb-size { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 8px; height: 34px; }
.fb-size button { height: 32px; padding: 0 6px; }
.fb-size input { width: 38px; border: 0; text-align: center; font-size: 12.5px; height: 30px; -moz-appearance: textfield; background: transparent; }
.fb-size input::-webkit-inner-spin-button { -webkit-appearance: none; }
.fb-color { position: relative; width: 26px; height: 26px; border-radius: 50%; border: 1px solid rgba(0,0,0,.2); margin: 0 4px; cursor: pointer; flex: none; box-shadow: inset 0 0 0 2px #fff; }
.fb-color input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }
.fb-lab { font-size: 12px; color: var(--ink-3); margin-right: 4px; }
.fb-rel { position: relative; display: inline-flex; }
.fb-menu { position: absolute; top: calc(100% + 8px); left: 50%; transform: translateX(-50%); background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); padding: 4px; display: flex; flex-direction: column; min-width: 160px; z-index: 30; }
.floatbar.below .fb-menu { top: auto; bottom: calc(100% + 8px); }
.fb-menu button { justify-content: flex-start; width: 100%; font-weight: 500; }

/* header project menu, badges */
.projgrp { position: relative; }
.menu.proj { left: 0; right: auto; width: 250px; }
.m-mobile .menu.proj, .m-mland .menu.proj { left: auto; right: 0; }
.menu .tick { margin-left: auto; width: 16px; height: 16px; color: var(--accent); }
.menu kbd, .keys kbd { margin-left: auto; font: 600 11px/1 var(--font); border: 1px solid var(--line-2); border-bottom-width: 2px; border-radius: 5px; padding: 3px 6px; background: #fafaf9; color: var(--ink-2); }
.menu button.is-soon { color: var(--ink-3); }
.cnt { font-style: normal; margin-left: auto; min-width: 18px; height: 18px; line-height: 18px; padding: 0 5px; border-radius: 99px; background: var(--warn); color: #fff; font-size: 10.5px; font-weight: 700; text-align: center; }
.hb .cnt { position: absolute; top: 2px; right: 4px; margin: 0; }
.savegrp.error .sv small { color: var(--danger); } .savegrp.error .sdot { background: var(--danger); }

/* library tools */
.lib-tools { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 8px; }
.lib-tools select { height: 30px; border: 1px solid var(--line); border-radius: var(--r-sm); font-size: 12px; padding: 0 6px; background: #fff; }
.lib-tools select { margin-left: auto; }
.linkbtn { background: none; border: 0; padding: 4px 2px; font-size: 12px; font-weight: 600; color: var(--danger, #c0392b); cursor: pointer; white-space: nowrap; }
.linkbtn:hover { text-decoration: underline; }
.linkbtn:disabled { opacity: .5; cursor: default; }
/* Photo library: remove button on each tile (hover on desktop, always shown on touch screens). */
.tw { position: relative; }
.tw .tile { width: 100%; }
.tile-x { position: absolute; top: 4px; right: 4px; width: 24px; height: 24px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 99px; background: rgba(20, 22, 22, .72); color: #fff; cursor: pointer; opacity: 0; transition: opacity .12s; }
.tile-x svg { width: 14px; height: 14px; }
.tw:hover .tile-x, .tile-x:focus-visible { opacity: 1; }
.tile-x:hover { background: var(--danger, #c0392b); }
.tile-x:disabled { opacity: .3 !important; cursor: default; }
@media (hover: none) { .tile-x { opacity: 1; } }
.m-mobile .tile-x, .m-mland .tile-x { opacity: 1; }
.check.sm { margin: 0; font-size: 12.5px; }

/* templates */
.themes { display: grid; grid-template-columns: 1fr; gap: 10px; }
.theme { display: flex; flex-direction: column; gap: 6px; padding: 8px; border: 1px solid var(--line); border-radius: var(--r); text-align: left; }
.theme:hover { border-color: var(--line-2); background: var(--hover); }
.theme.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.theme > span { display: flex; align-items: center; justify-content: space-between; font-size: 13px; }
.theme em { font-style: normal; font-size: 11px; color: var(--accent); font-weight: 600; }
.ththumb { width: 100%; height: auto; display: block; background: var(--paste); border-radius: 6px; padding: 6px; }
.thprev { max-width: 280px; margin: 0 auto 10px; }
.impact { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; font-size: 13px; }
.impact li { display: flex; gap: 10px; align-items: flex-start; }
.impact .ic { width: 18px; height: 18px; color: var(--accent); margin-top: 1px; }

/* text presets */
.txtpres { display: grid; gap: 6px; }
.txtpre { text-align: left; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-sm); color: var(--ink); }
.txtpre:hover { background: var(--hover); border-color: var(--line-2); }
.fontlist { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; font-size: 14px; color: var(--ink-2); }

/* stickers + shapes */
.stickers { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.stkbtn { aspect-ratio: 1; padding: 8px; border-radius: var(--r-sm); border: 1px solid transparent; background: var(--bg); }
.stkbtn:hover { border-color: var(--line-2); background: #fff; }
.stkbtn svg { width: 100%; height: 100%; display: block; }
.shapes { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 12px; }
.shpbtn { display: flex; flex-direction: column; align-items: center; gap: 5px; padding: 8px 4px 6px; border-radius: var(--r-sm); border: 1px solid transparent; font-size: 10.5px; color: var(--ink-2); }
.shpbtn:hover { background: var(--hover); border-color: var(--line); }
.shpbtn .shp { width: 34px; height: 34px; }
.sw.small { grid-template-columns: repeat(8, 1fr); gap: 6px; }
.sw.mini { grid-template-columns: repeat(8, 1fr); gap: 6px; margin-bottom: 4px; }
.swatch.none { background: linear-gradient(135deg, #fff 45%, var(--danger) 45% 55%, #fff 55%); }
.hint.small { font-size: 11.5px; }

/* inspector: filters, arrange */
.filters { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.flt { display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 10.5px; color: var(--ink-2); padding: 3px; border-radius: var(--r-sm); border: 2px solid transparent; }
.flt img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 5px; display: block; }
.flt.on { border-color: var(--accent); color: var(--ink); font-weight: 600; }
.arr { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.btn.on { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }

/* checks */
.ckgrp { border: 1px solid var(--line); border-radius: var(--r-sm); margin-bottom: 10px; overflow: hidden; }
.ckh { display: flex; align-items: center; gap: 8px; padding: 8px 10px; font-size: 12.5px; background: var(--bg); }
.ckgrp.warn .ckh { background: var(--warn-soft); color: #7a3a07; }
.ckh .ic { width: 16px; height: 16px; }
.ckh span { color: var(--ink-3); }
.lnk { margin-left: auto; font-size: 11.5px; color: var(--ink-2); text-decoration: underline; }
.ckrow { display: flex; align-items: center; gap: 6px; padding: 6px 6px 6px 10px; border-top: 1px solid var(--line); font-size: 12px; }
.ckrow > span { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ckrow small { color: var(--ink-3); }
.ckrow .ib { width: 28px; height: 28px; }
.ckrow .ib .ic { width: 16px; height: 16px; }
.ov-warn { display: inline-block; font-style: normal; min-width: 16px; height: 16px; line-height: 16px; border-radius: 99px; background: var(--warn); color: #fff; font-size: 10px; font-weight: 700; margin-left: 4px; }

/* versions + shortcuts dialogs */
.vlist { display: grid; gap: 6px; }
.vrow { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-sm); cursor: pointer; }
.vrow.on { border-color: var(--accent); background: var(--accent-soft); }
.vrow input { margin-top: 3px; accent-color: var(--accent); }
.vrow span { display: flex; flex-direction: column; }
.vrow small { color: var(--ink-3); font-size: 12px; }
.keys { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; align-items: center; margin: 0; font-size: 13px; }
.keys dt { display: flex; gap: 4px; flex-wrap: wrap; }
.keys dd { margin: 0; color: var(--ink-2); }
.keys kbd { margin: 0; }

/* spread drag-reorder */
.ov-card.movable, .th[draggable=true] { position: relative; }
.ov-card .grip { position: absolute; top: 6px; left: 6px; color: var(--ink-3); opacity: 0; transition: opacity .15s; }
.ov-card:hover .grip { opacity: 1; }
.ov-card .grip .ic { width: 16px; height: 16px; }
.dragging { opacity: .4; }
.drop-before { box-shadow: -4px 0 0 var(--accent); }
.drop-after { box-shadow: 4px 0 0 var(--accent); }

/* mobile carousels for new libraries */
.stickers.carousel, .shapes.carousel { display: flex; overflow-x: auto; gap: 8px; padding-bottom: 4px; }
.stickers.carousel .stkbtn { flex: none; width: 64px; }
.shapes.carousel .shpbtn { flex: none; width: 70px; }
.m-mobile .themes, .m-mland .themes { grid-template-columns: repeat(2, 1fr); }
.m-mobile .filters { grid-template-columns: repeat(7, 64px); overflow-x: auto; }

/* Autofill + Add pages */
.lib-head { flex-wrap: wrap; gap: 6px; }
.lib-btns { display: inline-flex; gap: 6px; }
.dialog.dlg-addpages, .dialog.dlg-autofill { width: min(520px, 100%); }
.dlg-b h4 { margin: 14px 0 6px; font-size: 13px; }
.ap-sum, .af-sum { margin-top: 14px; padding: 12px 14px; border-radius: var(--r-sm); background: var(--bg); font-size: 13px; }
.ap-sum > div { display: flex; align-items: baseline; gap: 10px; }
.ap-sum > div + div { margin-top: 4px; }
.ap-sum span { color: var(--ink-3); min-width: 92px; }
.ap-sum em { font-style: normal; color: var(--accent); font-weight: 600; }
.ap-sum p { margin: 8px 0 0; color: var(--ink-2); font-size: 12.5px; }
.af-sum { display: flex; gap: 10px; align-items: flex-start; background: var(--accent-soft); }
.af-sum > .ic { color: var(--accent); width: 20px; height: 20px; margin-top: 1px; }
.af-sum > div { display: flex; flex-direction: column; gap: 2px; }
.af-sum span { color: var(--ink-2); font-size: 12.5px; }
.af-sum .lo { color: var(--warn); font-weight: 600; }
.af-sum.warn { background: var(--warn-soft); }
.af-row { align-items: end; margin-top: 10px; }
.af-row .check { margin: 0 0 8px; }
.btn.wrap { white-space: normal; height: auto; min-height: 36px; padding: 7px 12px; text-align: center; }
.floatbar, .pagebar { width: max-content; } /* never shrink-to-fit near the stage edge; placement clamps it instead */

/* ================================================ Live mode (connected to the Pixolada App Worker) */
.live-screen { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 24px; text-align: center; background: var(--bg); }
.live-screen img { width: 44px; height: 44px; }
.live-screen b { font-size: 18px; }
.live-screen p { max-width: 420px; margin: 0; color: var(--ink-2); }
.spin { width: 26px; height: 26px; border-radius: 50%; border: 3px solid var(--line-2); border-top-color: var(--accent); animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
/* Print-matched fonts: the PDF uses Times, Helvetica and Courier, so the live editor shows the same families. */
.print-fonts .f-serif, .print-fonts .f-elegant { font-family: "Times New Roman", Times, serif; letter-spacing: normal; }
.print-fonts .f-sans, .print-fonts .f-rounded, .print-fonts .f-condensed { font-family: Arial, Helvetica, sans-serif; letter-spacing: normal; }
.print-fonts .f-mono { font-family: "Courier New", Courier, monospace; }
.print-fonts .f-script { font-family: "Times New Roman", Times, serif; font-style: italic; }
.pg .cover-art { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
.el.qr img.qrsvg { width: 100%; height: 100%; display: block; }
.qrprev img.qrsvg { width: 96px; height: 96px; }
.tile.loading img { opacity: .5; }
.tile.loading::after { content: ""; position: absolute; inset: 0; background: linear-gradient(100deg, transparent 30%, rgba(255,255,255,.55) 50%, transparent 70%); background-size: 200% 100%; animation: shimmer 1.2s infinite; }
@keyframes shimmer { from { background-position: 150% 0; } to { background-position: -50% 0; } }
.covers { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 6px; }
.cov { display: flex; flex-direction: column; gap: 4px; padding: 4px; border: 1px solid var(--line); border-radius: var(--r-sm); font-size: 11px; text-align: left; }
.cov img, .cov .cov-none { width: 100%; aspect-ratio: .71; object-fit: cover; border-radius: 4px; background: var(--hover); display: grid; place-items: center; color: var(--ink-3); font-size: 11px; }
.cov.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.ord-steps { display: flex; gap: 6px; list-style: none; padding: 0; margin: 0 0 12px; counter-reset: s; font-size: 12px; color: var(--ink-3); }
.ord-steps li { flex: 1; padding: 6px 8px; border-radius: var(--r-sm); background: var(--bg); counter-increment: s; }
.ord-steps li::before { content: counter(s) ". "; }
.ord-steps li.on { background: var(--accent-soft); color: var(--ink); font-weight: 600; }
.ord-info .fld { margin-top: 12px; }
.chk.prog .ic { animation: pulse 1.2s infinite; }
@media (max-width: 600px) { .ord-steps { flex-direction: column; } }

/* ------------------------------------------------ Arrange screen (book.editMode = "arrange") */
.modesw button { min-width: 64px; font-weight: 600; }
.actbar .modesw button, .m-mland .modesw button { min-width: 0; padding: 0 9px; }
.body.arr { display: flex; }
.arr-tray { width: 296px; flex: none; display: flex; flex-direction: column; gap: 6px; padding: 14px; background: var(--panel); border-right: 1px solid var(--line); min-height: 0; }
.arr-tray-h { display: flex; align-items: center; gap: 8px; }
.arr-tray-h > span { flex: 1; color: var(--ink-3); font-size: 12px; }
.arr-tray-h > span b { color: var(--ink); }
.arr-tray .hint { margin: 2px 0 4px; }
.arr-tray .banner { margin: 0; }
/* One scroll area for the tray's photos and Magic's Set aside list. The grid itself must not be the flex child that
   shrinks: its rows collapsed (to 4 px) and the photos piled on top of each other once the tray overflowed. */
.arr-tray .tray-scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 2px; }
.arr-tray .tiles { align-content: start; }
.tile.armed { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.tile .badge.zero { background: #fff; color: var(--ink-3); border: 1px solid var(--line-2); }
.arr-pages { flex: 1; min-width: 0; overflow-y: auto; padding: 18px 22px 28px; }
.arr-when { color: var(--ink-3); }
.aside { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line-2); display: flex; flex-direction: column; gap: 8px; }
.aside-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.aside-tile { display: flex; flex-direction: column; gap: 4px; font-size: 11.5px; color: var(--ink-3); }
.aside-tile img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 6px; opacity: .7; display: block; }
/* Selecting photos to delete */
.pickbar { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; padding: 6px 8px; margin: 6px 0; border-radius: var(--r-sm); background: var(--accent-soft); font-size: 12.5px; }
.pickbar .grow { flex: 1; }
.linkbtn.plain { color: var(--accent); }
.btn.danger { background: var(--danger, #c0392b); border-color: var(--danger, #c0392b); color: #fff; }
.btn.danger:disabled { opacity: .45; }
.pickmark { position: absolute; top: 5px; left: 5px; width: 22px; height: 22px; display: grid; place-items: center; border-radius: 99px; border: 2px solid #fff; background: rgba(20, 22, 22, .35); box-shadow: 0 1px 3px rgba(0,0,0,.3); color: #fff; }
.pickmark.on { background: var(--accent); }
.pickmark svg { width: 14px; height: 14px; }
.tile.picked, .aside-pick.picked { border-color: var(--accent); }
.aside-pick { position: relative; display: block; width: 100%; padding: 0; border: 2px solid transparent; border-radius: 8px; background: none; cursor: pointer; }
.arr-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.arr-head > div { display: flex; flex-direction: column; gap: 2px; }
.arr-head > div b { font-size: 16px; }
.arr-head > div span { color: var(--ink-3); font-size: 12.5px; }
.arr-lowres { display: flex; gap: 8px; align-items: flex-start; padding: 10px 12px; margin-bottom: 14px; border-radius: var(--r-sm); background: var(--warn-soft); color: var(--warn); font-size: 12.5px; }
.arr-lowres .ic { width: 18px; height: 18px; }
.arr-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 14px; }
.arr-card { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 10px; border-radius: var(--r); border: 2px solid transparent; background: rgba(255,255,255,.55); min-width: 0; }
.arr-card.on { border-color: var(--accent); background: #fff; }
.arr-lab { align-self: stretch; display: flex; justify-content: space-between; gap: 8px; font-size: 12.5px; color: var(--ink-2); }
.arr-warn { display: inline-flex; align-items: center; gap: 4px; color: var(--warn); font-weight: 600; }
.arr-warn .ic { width: 14px; height: 14px; }
.arr-sheet { position: relative; max-width: 100%; }
.arr-sheet .sheet { box-shadow: 0 1px 4px rgba(0,0,0,.18); }
.arr-sheet .el { pointer-events: none; }
.arr-sheet .el.photo { pointer-events: auto; cursor: pointer; }
.arr-sheet .el.photo.empty { outline: 1px dashed rgba(0,0,0,.25); outline-offset: -1px; }
.arr-sheet .pg[data-a] { cursor: pointer; }
.arr-sheet .pg.drop-hit { box-shadow: inset 0 0 0 3px var(--accent); }
.arr-sheet .ph { font-size: 11px; }
.arr-sheet .ph .ic { width: 20px; height: 20px; }
.arr-sheet .lowres { width: 20px; height: 20px; right: 4px; top: 4px; }
.arr-sheet .lowres .ic { width: 12px; height: 12px; }
.arr-selbox { position: absolute; top: 0; bottom: 0; box-shadow: inset 0 0 0 3px var(--accent); pointer-events: none; z-index: 5; }
.arr-x { position: absolute; left: 4px; top: 4px; width: 22px; height: 22px; border-radius: 50%; background: rgba(17,17,17,.72); color: #fff; display: grid; place-items: center; opacity: 0; transition: opacity .12s; }
.arr-x .ic { width: 13px; height: 13px; stroke-width: 2.2; }
.arr-sheet .el.photo:hover .arr-x, .arr-x:focus-visible, .m-mobile .arr-x, .m-mland .arr-x { opacity: 1; }
.arr-side { width: 272px; flex: none; padding: 14px; background: var(--panel); border-left: 1px solid var(--line); overflow-y: auto; }
.arr-lay { align-self: stretch; }
.arr-lay-h { display: flex; flex-direction: column; gap: 2px; margin-bottom: 10px; }
.arr-lay-h span { color: var(--ink-3); font-size: 12px; }
.arr-lay .hint.small { margin: 4px 0 0; }
/* phones and short landscape: pages scroll, the tray is a strip along the bottom */
.arr-m { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.arr-m .arr-pages { padding: 12px 16px 16px; }
.arr-m .arr-grid { grid-template-columns: 1fr; gap: 10px; }
.arr-m .arr-card { padding: 8px; }
.arr-m .arr-tray { width: auto; border-right: 0; border-top: 1px solid var(--line); padding: 8px 12px 10px; gap: 4px; box-shadow: 0 -6px 18px rgba(0,0,0,.06); }
.arr-m .arr-tray .tiles { display: flex; overflow-x: auto; overflow-y: hidden; gap: 6px; }
.arr-m .arr-tray .tile { width: 68px; flex: none; }
.arr-m .arr-tray .hint { display: none; }
.arr-m .arr-tray .tray-scroll { flex: none; overflow: visible; padding: 0; }
.arr-m .aside { margin-top: 8px; padding-top: 6px; gap: 4px; }
.arr-m .aside-list { display: flex; overflow-x: auto; gap: 6px; }
.arr-m .aside-tile { width: 68px; flex: none; font-size: 10.5px; }
.m-mland .arr-m .arr-tray .tray-scroll { flex: 1; overflow-y: auto; }
.m-mland .arr-m { flex-direction: row; }
.m-mland .arr-m .arr-tray { order: -1; width: 220px; border-top: 0; border-right: 1px solid var(--line); box-shadow: none; }
.m-mland .arr-m .arr-tray .tiles { display: grid; grid-template-columns: repeat(3, 1fr); overflow: visible; }
.m-mland .arr-m .arr-tray .tile { width: auto; }
.modepill { margin-left: 6px; padding: 0 8px; height: 30px; font-size: 12px; font-weight: 600; flex: none; }

/* ------------------------------------------------ first-time chooser: "How do you want to make your book?" */
.dialog.dlg-chooser { width: min(720px, 100%); }
.mode-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.mode-card { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; padding: 16px; border: 1.5px solid var(--line-2); border-radius: var(--r); background: #fff; text-align: left; font-size: 12.5px; color: var(--ink-2); }
.mode-card .ic { width: 26px; height: 26px; color: var(--accent); }
.mode-card b { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 16px; color: var(--ink); }
button.mode-card:hover { border-color: var(--accent); background: var(--accent-soft); }
.mode-card.is-soon { background: var(--hover); border-style: dashed; cursor: default; }
.mode-card.is-soon .ic, .mode-card.is-soon b { color: var(--ink-3); }
@media (max-width: 600px) { .mode-cards { grid-template-columns: 1fr; } .mode-card { padding: 12px 14px; } }

/* ------------------------------------------------ template studio (#studio): sign-in, template list, template mode */
.app.studio { overflow-y: auto; display: block; }
.st-top { display: flex; align-items: center; gap: 10px; height: 60px; padding: 0 16px; background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.st-top img { width: 30px; height: 30px; }
.st-top b { font-size: 16px; }
.st-main { max-width: 880px; margin: 0 auto; padding: 24px 16px 48px; }
.st-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 18px 20px; margin: 0 0 20px; }
#st-signin { max-width: 380px; margin: 40px auto; }
.dialog #st-signin { margin: 0; border: 0; padding: 0; }
.st-card h1, .st-card h2, .st-group h2 { margin: 0 0 6px; font-size: 18px; }
.st-row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; }
.st-row .fld { flex: 1 1 180px; }
.st-row .btn { margin: 6px 0; }
.st-canva-accounts { list-style: none; margin: 4px 0 8px; padding: 0; }
.st-canva-accounts li { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 6px 0; border-top: 1px solid var(--line, #d8d8d8); }
.st-canva-accounts li span { flex: 1 1 160px; min-width: 0; overflow-wrap: anywhere; }
.st-canva-accounts .btn { margin: 0; }
.st-msg { margin: 8px 0 0; min-height: 1.4em; color: var(--warn); font-size: 13px; }
.st-msg:empty { min-height: 0; }
.st-msg[data-canva] { color: var(--ink-2); }
#st-canva .pill { display: inline-block; margin-left: 4px; padding: 1px 8px; border: 1px solid var(--line-2); border-radius: 999px; font-size: 11.5px; font-weight: 600; line-height: 1.5; color: var(--ink-2); vertical-align: 1px; white-space: nowrap; }
.st-help { margin: 12px 0 0; border-top: 1px solid var(--line); padding-top: 10px; font-size: 13px; color: var(--ink-2); }
.st-help summary { cursor: pointer; font-weight: 600; color: var(--ink); padding: 4px 0; width: fit-content; max-width: 100%; }
.st-help summary:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; border-radius: 4px; }
.st-help-b { padding: 4px 0 0; overflow-wrap: anywhere; }
.st-help-b ol, .st-help-b ul { margin: 6px 0 10px; padding-left: 20px; }
.st-help-b li { margin: 4px 0; }
.st-help-b h3 { margin: 12px 0 4px; font-size: 13.5px; color: var(--ink); }
.st-help-b p { margin: 6px 0; }
.st-help-safe { color: var(--ink-3); }
.st-group h2 small { color: var(--ink-3); font-weight: 500; }
.st-list { list-style: none; margin: 0 0 24px; padding: 0; display: grid; gap: 8px; }
.st-item { display: grid; gap: 2px; width: 100%; text-align: left; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; }
.st-item:hover { border-color: var(--accent); }
.st-item span { color: var(--ink-2); font-size: 13px; }
.st-item small { color: var(--ink-3); }
.tpl-title { display: grid; text-align: center; line-height: 1.25; max-width: 40vw; }
.tpl-title b, .tpl-title small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tpl-title small { color: var(--ink-3); font-size: 12px; }
.tpl .tr .btn.sm { height: 34px; }
.menu.proj.tplmenu { left: auto; right: 0; width: 270px; }
.tplmenu .fld { padding: 4px 10px 6px; border-top: 1px solid var(--line); margin-top: 4px; }
.tpl-note { font-size: 12px; color: var(--warn); max-width: 220px; }
.tpl-theme .fld input[type=color] { padding: 2px 4px; }
.tpl-cycle { margin: 0 0 8px; padding-left: 22px; display: grid; gap: 6px; }
.tpl-cycle li { display: flex; gap: 6px; align-items: center; }
.tpl-cycle select { flex: 1; height: 34px; border: 1px solid var(--line-2); border-radius: var(--r-sm); padding: 0 8px; background: #fff; min-width: 0; }
.tpl-check { display: flex; gap: 8px; align-items: center; font-size: 13px; margin: 6px 0; }
.tpl-locked #canvas .sheet { cursor: default; }
/* While a save, version or publish is in flight the template can't change (the code refuses edits too). */
.tpl-busy .body, .tpl-busy .nav { pointer-events: none; cursor: progress; }
/* Canva brand template link (template studio editor) */
.dialog.dlg-tpl-canva { width: min(680px, 100%); }
.dlg-tpl-canva h4 { margin: 14px 0 6px; font-size: 13px; }
.dlg-tpl-canva section + section { border-top: 1px solid var(--line, #e6e6e6); margin-top: 12px; }
.dlg-tpl-canva .st-row input[type=search] { flex: 1 1 220px; min-width: 0; padding: 7px 10px; border: 1px solid var(--line, #d8d8d8); border-radius: var(--r-sm); font: inherit; }
.canva-templates { list-style: none; margin: 8px 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 6px; max-height: 220px; overflow-y: auto; }
.canva-tpl { width: 100%; text-align: left; display: flex; flex-direction: column; gap: 2px; padding: 8px 10px; border: 1px solid var(--line, #d8d8d8); border-radius: var(--r-sm); background: #fff; cursor: pointer; font: inherit; }
.canva-tpl.on { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }
.canva-tpl small { color: var(--ink-2); }
.cr-table { width: 100%; border-collapse: collapse; font-size: 13px; margin: 6px 0; }
.cr-table th, .cr-table td { text-align: left; padding: 4px 6px; border-bottom: 1px solid var(--line, #eee); overflow-wrap: anywhere; }
.cr-table tr.cr-missing td:last-child, .cr-table tr.cr-wrong_type td:last-child { color: #7a3a07; font-weight: 600; }
.cr-list { margin: 0 0 6px; padding-left: 18px; font-size: 13px; overflow-wrap: anywhere; }
.st-msg[data-canva-link] { color: var(--ink-2); }
.canva-fill .fld { margin: 8px 0; }
.canva-fill .fld input[type=file] { height: auto; padding: 6px 0; border: 0; }
.canva-fill .fld code { font-size: 12px; }
.canva-fill a.btn { text-decoration: none; color: inherit; }
.canva-problems { margin: 6px 0; padding-left: 18px; font-size: 13px; color: #7a3a07; overflow-wrap: anywhere; }
.canva-reconnect .st-row, .canva-export .st-row, .canva-spec .st-row { margin: 6px 0; }
.canva-accept { display: flex; gap: 8px; align-items: flex-start; margin: 6px 0; font-size: 13px; }
.canva-accept input { margin-top: 2px; flex: none; }
.canva-formats { margin: 6px 0; padding-left: 18px; font-size: 13px; overflow-wrap: anywhere; }
/* Catalogue stickers: PNG art contained in the box; a reference with no item (or art not loaded) as a dashed box. */
.stkimg { width: 100%; height: 100%; display: block; object-fit: contain; pointer-events: none; }
.el.sticker.missing { outline: 1.5px dashed rgba(0, 0, 0, .35); outline-offset: -1px; background: rgba(0, 0, 0, .03); }
/* QR designs (catalogue items): drawn as one SVG in mm; a design with no content shows the plain code, outlined. */
.el.qr.design > svg.qrd { width: 100%; height: 100%; display: block; overflow: visible; }
.el.qr.missing { outline: 1.5px dashed rgba(0, 0, 0, .35); outline-offset: 1px; }
.qrstyles { display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 6px; margin-top: 10px; }
.qrstyle { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 6px 4px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--bg); font-size: 11.5px; color: var(--ink-2); min-width: 0; }
.qrstyle:hover { border-color: var(--line-2); background: #fff; }
.qrstyle.on { border-color: var(--ink); background: #fff; color: var(--ink); }
.qrstyle > svg, .qrstyle > img { width: 40px; height: 40px; flex: none; display: block; }
.qrstyle span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pg.missing { outline: 1.5px dashed rgba(0, 0, 0, .35); outline-offset: -6px; }
.tpl-qr .fld input[type=color] { padding: 2px 4px; }
.tpl-qr-problem { color: var(--danger); font-size: 13px; font-weight: 600; margin: 10px 0 0; }
.tpl-qr-min { font-size: 13px; color: var(--ink-2); margin: 10px 0 0; }

/* Shop branding (branding 2a). A shop's header colours apply on body.shop-header: icons and text take the header's
   text colour, hover tints follow it, and the mode switch and save group keep their own readable surfaces. The main
   buttons (Order, Approve, Continue to checkout) take --btn-bg / --btn-fg; Pixolada's near-black otherwise. */
.order, .btn.dark { background: var(--btn-bg, var(--ink)); border-color: var(--btn-bg, var(--ink)); color: var(--btn-fg, #fff); }
.order:hover, .btn.dark:hover:not(:disabled) { background: var(--btn-bg, #2a2a2a); filter: brightness(.92); }
body.shop-header .top { background: var(--hdr-bg); color: var(--hdr-fg); border-bottom-color: color-mix(in srgb, var(--hdr-fg) 18%, transparent); }
body.shop-header .top .hb, body.shop-header .top .ib, body.shop-header .top .title .ic, body.shop-header .top .sv small { color: var(--hdr-fg); }
body.shop-header .top .hb:hover:not(:disabled), body.shop-header .top .ib:hover, body.shop-header .top .title:hover,
body.shop-header .top .savebtn:hover, body.shop-header .top .savemenu:hover { background: color-mix(in srgb, var(--hdr-fg) 12%, transparent); color: var(--hdr-fg); }
body.shop-header .top .hb:disabled { opacity: .55; }
body.shop-header .top .hb.on { color: var(--hdr-fg); box-shadow: inset 0 -2px 0 var(--hdr-fg); }
body.shop-header .top .vsep, body.shop-header .top .savemenu { background-color: transparent; border-color: color-mix(in srgb, var(--hdr-fg) 25%, transparent); }
body.shop-header .top .vsep { background: color-mix(in srgb, var(--hdr-fg) 25%, transparent); }
body.shop-header .top .savegrp { border-color: color-mix(in srgb, var(--hdr-fg) 30%, transparent); }
body.shop-header .top .title.editing { color: var(--ink); }
body.shop-header .top .seg { color: var(--ink); }
.brand img.shop-logo { width: auto; height: var(--logo-h, 30px); max-width: min(200px, 30vw); object-fit: contain; }
.m-mobile .brand img.shop-logo, .m-mland .brand img.shop-logo { height: min(var(--logo-h, 30px), 34px); max-width: 120px; }
/* Mid-size desktops: the header's left side has no room for a wide wordmark plus the shop name, so the logo is capped
   and stands for the name. */
@media (max-width: 1439px) {
  .m-desktop .brand img.shop-logo { max-width: 120px; }
  .m-desktop .brand img.shop-logo + span { display: none; }
}

/* Shop font (branding 2b): "Pixolada Shop" is registered from the shop's font file. It is used for the editor's
   interface and for text set in it; it prints in one weight and style, so bold and italic don't apply to it. */
body.shop-font { --font: "Pixolada Shop", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; }
/* The PDF places the font's glyphs without kerning, so the editor doesn't kern either: line breaks match the print. */
.f-shop, .print-fonts .f-shop { font-family: "Pixolada Shop", "Times New Roman", Times, serif; font-weight: normal !important; font-style: normal !important; letter-spacing: normal; font-kerning: none; }

/* Shop print mark (branding 2c): the reserved strip at the bottom of the back cover, with the shop's logo. */
.mark-zone { position: absolute; z-index: 7; pointer-events: none; display: flex; align-items: center; justify-content: center; border: 1px dashed rgba(17,17,17,.45); background: rgba(255,255,255,.55); }
.mark-zone img { display: block; object-fit: contain; }
.mark-zone span { position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%); margin-bottom: 2px; font-size: 10px; white-space: nowrap; color: var(--ink-2); background: rgba(255,255,255,.85); padding: 0 4px; border-radius: 3px; }
.mark-zone.quiet { border: 0; background: none; }
