/* Kamereo Poster — editor chrome (liquid glass)
   Rules borrowed from MKT Hub's glass layer:
   - Only the control layer is glass (top capsules, side panels, page strip). The poster stays solid
     and slides UNDER the glass when you zoom/pan.
   - backdrop-filter lives on ::before, never on the element itself, so fixed-position children
     (menus, dropdowns) are not trapped in a new containing block.
   - No opacity / filter / transform on ancestors of glass (that kills the blur). */
:root {
  --bg: #eceee8;
  --surface: #ffffff;
  --ink: #15181a;
  --ink-2: #3a3f38;
  --ink-3: #6b7167;
  --ink-4: #a0a69b;
  --line: rgba(20, 30, 15, .08);
  --line-2: rgba(20, 30, 15, .14);
  --accent: #2f8f46;
  --accent-ink: #1d6531;
  --accent-soft: rgba(47, 143, 70, .11);
  --lime: #c6ef55;
  --danger: #d43c3c;

  --glass-tint: rgba(255, 255, 255, .55);
  --glass-tint-strong: rgba(255, 255, 255, .80);
  --glass-filter: blur(16px) saturate(190%) brightness(1.04);
  --glass-rim: rgba(255, 255, 255, .95);
  --glass-rim-soft: rgba(255, 255, 255, .22);
  --glass-spec: inset 0 1px 0 rgba(255, 255, 255, .9), inset 0 -1px 0 rgba(255, 255, 255, .35), inset 0 0 12px rgba(255, 255, 255, .28);
  --glass-drop: 0 1px 1.5px rgba(18, 24, 40, .06), 0 8px 26px rgba(18, 24, 40, .10);
  --glass-hover: rgba(20, 30, 15, .06);
  --glass-on: rgba(255, 255, 255, .95);
  --glass-on-shadow: 0 1px 2px rgba(18, 24, 40, .10), 0 3px 10px rgba(18, 24, 40, .06), inset 0 0 0 .5px rgba(18, 24, 40, .06);

  --gap: 10px;
  --top-h: 42px;
  --rail: 66px;  /* icon rail */
  --rp: 340px;   /* panel next to the rail */
  --ctx-h: 38px; /* context bar */
  --cl: calc(var(--gap) * 3 + var(--rail) + var(--rp)); /* where the canvas area starts */
  --pages-h: 66px;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; overflow: hidden;
  background: var(--bg); color: var(--ink);
  font: 13px/1.45 'Be Vietnam Pro', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ───────── Glass material ───────── */
.glass { position: fixed; z-index: 20; isolation: isolate; box-shadow: var(--glass-drop); }
.glass::before {
  content: ""; position: absolute; inset: 0; z-index: -1; border-radius: inherit; pointer-events: none;
  background: linear-gradient(180deg, rgba(255,255,255,.18), rgba(255,255,255,0) 55%), var(--glass-tint);
  -webkit-backdrop-filter: var(--glass-filter); backdrop-filter: var(--glass-filter);
  box-shadow: var(--glass-spec);
}
/* Refraction rim: bright at top-left and bottom-right, fading in between. */
.glass::after {
  content: ""; position: absolute; inset: 0; z-index: -1; border-radius: inherit; pointer-events: none; padding: 1px;
  background: linear-gradient(150deg, var(--glass-rim) 0%, var(--glass-rim-soft) 26%, transparent 48%, transparent 62%, var(--glass-rim-soft) 80%, var(--glass-rim) 100%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
}
.panel.glass::before { background: linear-gradient(180deg, rgba(255,255,255,.22), rgba(255,255,255,0) 40%), var(--glass-tint-strong); }
@media (prefers-reduced-transparency: reduce) {
  .glass::before { -webkit-backdrop-filter: none; backdrop-filter: none; background: var(--surface); }
}

/* ───────── Stage (canvas) ───────── */
.app { position: fixed; inset: 0; }
.stage {
  position: fixed; inset: 0; overflow: auto; overscroll-behavior: contain;
  background:
    radial-gradient(900px 600px at 18% 12%, rgba(198, 239, 85, .30), transparent 60%),
    radial-gradient(800px 600px at 88% 85%, rgba(120, 214, 170, .26), transparent 60%),
    radial-gradient(700px 500px at 75% 10%, rgba(150, 200, 255, .18), transparent 60%),
    radial-gradient(circle, rgba(20, 30, 15, .10) 1px, transparent 1.3px) 0 0 / 22px 22px,
    var(--bg);
  scrollbar-width: thin;
}
.stage.panning, .stage.panning * { cursor: grabbing !important; }
.stage.space * { cursor: grab !important; }
.stage-inner { min-width: 100%; min-height: 100%; display: grid; place-items: center; }
.scaler-box { position: relative; flex: none; border-radius: 4px; box-shadow: 0 18px 50px rgba(20, 30, 10, .20), 0 0 0 1px rgba(0, 0, 0, .04); }
.scaler { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
.overlay { position: absolute; inset: 0; pointer-events: none; z-index: 3; }
/* Graphics parked outside the artboard: dimmed copy behind the poster (editor only) */
.ghost-layer { position: absolute; left: 0; top: 0; opacity: .42; pointer-events: none; z-index: 0; }
.ghost-layer .stk { pointer-events: auto; position: absolute; left: 0; top: 0; cursor: move; user-select: none; touch-action: none; }
.ghost-layer .stk img { display: block; width: 100%; height: auto; pointer-events: none; }
.ghost-layer .stk.txt { white-space: pre; line-height: 1.04; padding: .22em .5em .26em; border-radius: .32em; text-align: center; text-transform: uppercase; }
.scaler .poster { position: relative; z-index: 1; }
.stage.dragging-stk, .stage.dragging-stk * { cursor: grabbing !important; }
.export-root { position: fixed; left: -30000px; top: 0; pointer-events: none; }

/* ───────── Top chrome ───────── */
.chrome-top { position: fixed; z-index: 30; top: var(--gap); left: var(--gap); right: var(--gap); height: var(--top-h); display: flex; align-items: center; justify-content: space-between; gap: 10px; pointer-events: none; }
.chrome-top > * { pointer-events: auto; }
.cap { position: relative; height: var(--top-h); border-radius: calc(var(--top-h) / 2); display: flex; align-items: center; gap: 2px; padding: 0 6px; }
.chrome-top .glass { position: relative; }
.cap-brand { padding-left: 10px; min-width: 0; }
.brand-icon { height: 22px; width: auto; display: block; margin-right: 2px; }
.brand-name { font-weight: 700; font-size: 14px; letter-spacing: -.01em; margin-right: 4px; }
.cap-sep { width: 1px; height: 22px; background: var(--line-2); margin: 0 6px; flex: none; }
.title-input { border: 0; background: transparent; border-radius: 10px; padding: 6px 8px; font-weight: 600; width: 200px; min-width: 60px; }
.title-input:hover { background: var(--glass-hover); }
.title-input:focus { outline: none; background: var(--glass-on); box-shadow: var(--glass-on-shadow); }
.zoom-val { border: 0; background: none; font-weight: 700; font-size: 12px; width: 48px; height: 30px; border-radius: 15px; font-variant-numeric: tabular-nums; }
.zoom-val:hover { background: var(--glass-hover); }

/* ───────── Controls ───────── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 32px; padding: 0 14px; border-radius: 16px; border: 0; background: var(--glass-on); box-shadow: var(--glass-on-shadow); font-weight: 600; white-space: nowrap; transition: background .12s, transform .06s, box-shadow .12s; }
.btn:hover { background: #fff; }
.btn:active { transform: translateY(1px); }
.btn svg { width: 16px; height: 16px; }
.btn.dark { background: #15181a; color: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.2), 0 4px 14px rgba(0,0,0,.18); }
.btn.dark:hover { background: #000; }
.btn.ghost { background: transparent; box-shadow: none; }
.btn.ghost:hover { background: var(--glass-hover); }
.btn.accent { background: var(--accent); color: #fff; box-shadow: 0 2px 10px rgba(47,143,70,.3); }
.btn.accent:hover { background: #287d3d; }
.btn.block { width: 100%; }
.btn.sm { height: 30px; padding: 0 11px; font-size: 12px; border-radius: 15px; }
.btn.danger { color: var(--danger); }
.btn:disabled { opacity: .45; cursor: default; }
.icon-btn { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 16px; border: 0; background: transparent; color: var(--ink-2); flex: none; }
.icon-btn:hover { background: var(--glass-hover); color: var(--ink); }
.icon-btn:disabled { opacity: .3; cursor: default; background: none; }
.icon-btn.sm { width: 28px; height: 28px; }
.icon-btn.sm svg { width: 15px; height: 15px; }
.select { height: 34px; border: 1px solid var(--line-2); border-radius: 10px; padding: 0 28px 0 10px; background: rgba(255,255,255,.75) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b7167' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 8px center / 14px; appearance: none; min-width: 0; font-weight: 500; }
.select.bare { border: 0; background-color: transparent; font-weight: 600; height: 32px; border-radius: 16px; }
.select.bare:hover { background-color: var(--glass-hover); }
.select:focus { outline: none; border-color: var(--accent); }
.avatar { width: 32px; height: 32px; border-radius: 50%; border: 2px solid #fff; background: var(--accent-ink) center/cover; color: #fff; font-weight: 700; display: grid; place-items: center; box-shadow: 0 1px 4px rgba(0,0,0,.15); margin-left: 4px; }
.badge { display: inline-block; font-size: 10.5px; font-weight: 700; padding: 2px 8px; border-radius: 99px; background: var(--accent-soft); color: var(--accent-ink); }

.seg { display: inline-flex; background: rgba(20,30,15,.05); border-radius: 11px; padding: 3px; gap: 2px; }
.seg.wide { display: flex; }
.seg.wide button { flex: 1; }
.seg button { border: 0; background: none; padding: 5px 10px; border-radius: 8px; font-size: 12px; font-weight: 600; color: var(--ink-3); white-space: nowrap; }
.seg button:hover { color: var(--ink); }
.seg button.on { background: var(--glass-on); color: var(--ink); box-shadow: var(--glass-on-shadow); }

/* Menus (solid, they hold text) */
.menu-wrap { position: relative; }
.menu { position: absolute; right: 0; top: calc(100% + 8px); min-width: 240px; background: rgba(255,255,255,.97); border-radius: 16px; box-shadow: 0 14px 44px rgba(18,24,40,.20), 0 0 0 .5px rgba(18,24,40,.08); padding: 6px; z-index: 60; }
.cap-brand .menu { left: 0; right: auto; }
.menu > button { display: flex; flex-direction: column; align-items: flex-start; width: 100%; border: 0; background: none; text-align: left; padding: 8px 10px; border-radius: 10px; }
.menu > button b { font-weight: 600; }
.menu > button small { color: var(--ink-3); font-size: 11.5px; }
.menu > button:hover { background: var(--glass-hover); }
.menu-label { font-size: 10.5px; font-weight: 700; color: var(--ink-3); text-transform: uppercase; letter-spacing: .06em; padding: 8px 10px 5px; }
.menu .seg { margin: 0 6px 6px; }
.menu-user { padding: 8px 10px 10px; display: flex; flex-direction: column; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.menu-user small { color: var(--ink-3); }
.menu-user .badge { align-self: flex-start; margin-top: 4px; }

/* ───────── Panels ───────── */
.panel { top: calc(var(--gap) * 2 + var(--top-h)); bottom: var(--gap); border-radius: 22px; display: flex; flex-direction: column; overflow: hidden; }
/* Canva-style left side: icon rail + panel */
.rail { left: var(--gap); top: calc(var(--gap) * 2 + var(--top-h)); bottom: var(--gap); width: var(--rail); border-radius: 20px; display: flex; flex-direction: column; padding: 6px 5px; overflow-y: auto; scrollbar-width: none; }
.rail::-webkit-scrollbar { display: none; }
.rail-nav, .rail-foot { display: flex; flex-direction: column; gap: 2px; }
.rail-foot { margin-top: auto; padding-top: 6px; border-top: 1px solid var(--line); }
.rail-btn { position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; border: 0; background: none; padding: 4px 0 5px; border-radius: 12px; color: var(--ink-3); font-size: 10px; font-weight: 600; line-height: 1.1; text-align: center; flex: none; }
.rail-btn .ico { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; transition: background-color .15s, color .15s, transform .18s var(--ease); }
.rail-btn .ico svg { width: 18px; height: 18px; }
.rail-btn:hover { color: var(--ink); }
.rail-btn:hover .ico { background: var(--glass-hover); }
.rail-btn:active .ico { transform: scale(.92); }
.rail-btn.on { color: var(--ink); }
.rail-btn.on .ico { background: var(--accent); color: #fff; box-shadow: 0 3px 10px rgba(47,143,70,.35); }
.rail-btn.on.closed .ico { background: var(--accent-soft); color: var(--accent-ink); box-shadow: none; }
.rail-btn .count { position: absolute; top: 1px; right: 7px; min-width: 16px; height: 15px; padding: 0 4px; border-radius: 8px; background: #15181a; color: #fff; font-size: 9.5px; font-weight: 700; line-height: 16px; }
.rail-btn .dot { position: absolute; top: 5px; right: 14px; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 2px #fff; }
.rail-sep { height: 1px; background: var(--line); margin: 4px 10px; flex: none; }
/* Short screens (laptops): icons only, labels become tooltips */
@media (min-width: 901px) and (max-height: 760px) {
  .rail-btn .lbl { display: none; }
  .rail-btn { padding: 3px 0; }
  .rail-btn .count { top: -2px; right: 4px; }
}
.panel-insp { left: calc(var(--gap) * 2 + var(--rail)); width: var(--rp); transition: opacity .2s ease, transform .24s var(--ease), visibility .24s; }
body.insp-hidden { --cl: calc(var(--gap) * 2 + var(--rail)); }
body.insp-hidden .panel-insp { opacity: 0; transform: translateX(-14px); visibility: hidden; pointer-events: none; }
.insp-title .insp-close { margin-left: auto; color: var(--ink-3); }

/* Context bar (Canva's top toolbar): sits above the canvas, never on top of the poster */
.ctxbar { position: fixed; top: calc(var(--gap) * 2 + var(--top-h)); left: calc((var(--cl) + 100vw - var(--gap)) / 2); transform: translateX(-50%);
  height: var(--ctx-h); border-radius: calc(var(--ctx-h) / 2); padding: 0 4px; display: flex; align-items: center; gap: 1px; white-space: nowrap; max-width: calc(100vw - var(--cl) - var(--gap) * 2); overflow-x: auto; scrollbar-width: none; z-index: 25;
  transition: left .24s var(--ease), top .22s var(--ease); animation: ctx-in .18s var(--ease); }
.ctxbar.at-bottom { top: calc(100vh - var(--gap) * 2 - var(--pages-h) - var(--ctx-h)); }
.ctxbar:empty, .ctxbar[data-mode="idle"] { display: none; }
@keyframes ctx-in { from { opacity: 0; transform: translate(-50%, -6px); } }
.cb { display: inline-flex; align-items: center; gap: 5px; height: 30px; padding: 0 9px; border: 0; background: none; border-radius: 15px; font-size: 12px; font-weight: 600; color: var(--ink-2); flex: none; }
.cb svg { width: 15px; height: 15px; }
.cb:hover { background: var(--glass-hover); color: var(--ink); }
.cb.on { color: var(--accent-ink); background: var(--accent-soft); }
.cb.strong { background: #15181a; color: #fff; }
.cb.strong:hover { background: #000; }
.cb-sep { width: 1px; height: 20px; background: var(--line-2); margin: 0 4px; flex: none; }
.cb-label { font-size: 11px; font-weight: 700; color: var(--ink-3); text-transform: uppercase; letter-spacing: .05em; padding: 0 6px 0 8px; }
.cb-hint { font-size: 11.5px; color: var(--ink-3); padding: 0 8px; }
.cb-font { height: 30px; max-width: 140px; font-size: 12px; }
.cb-color { width: 22px; height: 22px; border: 0; padding: 0; border-radius: 50%; background: none; cursor: pointer; box-shadow: 0 0 0 1px rgba(0,0,0,.12); overflow: hidden; margin: 0 3px; flex: none; }
.cb-color.sq { border-radius: 7px; }
.cb-color::-webkit-color-swatch-wrapper { padding: 0; }
.cb-color::-webkit-color-swatch { border: 0; border-radius: inherit; }
.panel-scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 16px 16px 24px; scrollbar-width: thin; }
.panel-head { padding: 6px 8px 8px; }
.panel-kicker { font-size: 10.5px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--ink-3); }
.panel-foot { margin-top: auto; padding-top: 8px; border-top: 1px solid var(--line); }

.section-nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item { position: relative; display: flex; align-items: center; gap: 10px; width: 100%; height: 38px; padding: 0 10px 0 6px; border: 0; background: none; border-radius: 12px; text-align: left; font-weight: 600; color: var(--ink-2); }
.nav-item .ico { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; background: rgba(20,30,15,.05); color: var(--ink-3); flex: none; }
.nav-item .ico svg { width: 15px; height: 15px; }
.nav-item .count { margin-left: auto; font-size: 11px; font-weight: 700; color: var(--ink-3); background: rgba(20,30,15,.06); border-radius: 99px; padding: 1px 8px; }
.nav-item .dot { margin-left: auto; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.nav-item:hover { background: var(--glass-hover); color: var(--ink); }
.nav-item.on { background: var(--glass-on); color: var(--ink); box-shadow: var(--glass-on-shadow); }
.nav-item.on .ico { background: var(--accent); color: #fff; }
.nav-item.small { height: 36px; font-weight: 500; }
.nav-item.small svg { width: 16px; height: 16px; margin: 0 5px; color: var(--ink-3); }

/* Inspector content */
.insp-title { display: flex; align-items: center; gap: 10px; margin: 0 0 4px; }
.insp-title .ico { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: var(--accent); color: #fff; flex: none; }
.insp-title .ico svg { width: 16px; height: 16px; }
.insp-title h2 { margin: 0; font-size: 16px; letter-spacing: -.01em; }
.insp-hint { color: var(--ink-3); font-size: 12px; margin: 2px 0 14px; }
.group { padding: 14px 0; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px; }
.group:first-of-type { border-top: 0; padding-top: 6px; }
.group-label { display: flex; align-items: center; justify-content: space-between; font-size: 12px; font-weight: 700; color: var(--ink); }
.group-label small { font-weight: 500; color: var(--ink-3); }
.field { display: flex; flex-direction: column; gap: 5px; font-size: 11.5px; font-weight: 600; color: var(--ink-3); }
.field > span { display: flex; justify-content: space-between; }
.field output { color: var(--ink); font-weight: 700; font-variant-numeric: tabular-nums; }
.inp, .field input:not([type]), .field textarea { height: 34px; border: 1px solid var(--line-2); border-radius: 10px; padding: 0 10px; background: rgba(255,255,255,.75); color: var(--ink); font-weight: 500; font-size: 13px; width: 100%; }
.field textarea { height: auto; padding: 7px 10px; resize: vertical; min-height: 60px; line-height: 1.35; }
.inp:focus, .field input:not([type]):focus, .field textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); background: #fff; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.check { display: flex; align-items: center; gap: 9px; font-weight: 500; color: var(--ink-2); font-size: 12.5px; cursor: pointer; }
.check input { accent-color: var(--accent); width: 16px; height: 16px; margin: 0; }
.hint { margin: 0; color: var(--ink-3); font-size: 12px; }
.empty { text-align: center; color: var(--ink-3); padding: 18px 8px; font-size: 12.5px; }

/* Slider (haikei-style: thin track, filled part, round thumb) */
input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; height: 18px; background: transparent; margin: 0; --p: 50%; }
input[type=range]::-webkit-slider-runnable-track { height: 4px; border-radius: 4px; background: linear-gradient(90deg, var(--accent) var(--p), rgba(20,30,15,.12) var(--p)); }
input[type=range]::-moz-range-track { height: 4px; border-radius: 4px; background: rgba(20,30,15,.12); }
input[type=range]::-moz-range-progress { height: 4px; border-radius: 4px; background: var(--accent); }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; border-radius: 50%; background: #fff; margin-top: -6px; box-shadow: 0 0 0 1px rgba(0,0,0,.08), 0 1px 4px rgba(0,0,0,.25); }
input[type=range]::-moz-range-thumb { width: 16px; height: 16px; border: 0; border-radius: 50%; background: #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.08), 0 1px 4px rgba(0,0,0,.25); }

/* Themes + colours */
.themes { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.theme-sw { border: 0; border-radius: 12px; padding: 0; overflow: hidden; aspect-ratio: .8; position: relative; box-shadow: inset 0 0 0 1px rgba(0,0,0,.06); }
.theme-sw.on { box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--accent); }
.theme-sw i { position: absolute; left: 14%; right: 14%; bottom: 18%; height: 36%; border-radius: 5px; background: #fff; }
.theme-sw b { position: absolute; left: 14%; top: 14%; width: 52%; height: 17%; border-radius: 4px; }
.theme-sw em { position: absolute; right: 14%; bottom: 40%; width: 30%; height: 13%; border-radius: 0 5px 0 9px; }
.theme-sw span { position: absolute; left: 0; right: 0; bottom: 0; font-size: 9.5px; font-weight: 700; color: #fff; background: rgba(0,0,0,.32); padding: 1px 0; text-align: center; }
.colors { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px 8px; }
.color { display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 10.5px; font-weight: 600; color: var(--ink-3); text-align: center; line-height: 1.2; }
.color input { width: 34px; height: 34px; border: 0; padding: 0; border-radius: 50%; background: none; cursor: pointer; box-shadow: 0 0 0 1px rgba(0,0,0,.1), 0 1px 3px rgba(0,0,0,.12); overflow: hidden; }
.color input::-webkit-color-swatch-wrapper { padding: 0; }
.color input::-webkit-color-swatch { border: 0; border-radius: 50%; }
.color input::-moz-color-swatch { border: 0; border-radius: 50%; }

/* Library grids (hero / logo / background / stickers) */
.lib { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.lib.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.tile { position: relative; border: 0; border-radius: 12px; background: repeating-conic-gradient(#f1f2ee 0 25%, #fff 0 50%) 0 0 / 12px 12px; aspect-ratio: 1; padding: 7px; display: grid; place-items: center; min-width: 0; overflow: hidden; box-shadow: inset 0 0 0 1px var(--line-2); }
.tile:hover { box-shadow: inset 0 0 0 1.5px var(--accent); }
.tile.on { box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--accent); }
/* absolute so % sizes resolve inside the aspect-ratio box (otherwise wide logos get cropped) */
.tile img { position: absolute; inset: 8px; width: calc(100% - 16px); height: calc(100% - 16px); object-fit: contain; pointer-events: none; }
.tile.wide img { inset: 8px 10px 20px; width: calc(100% - 20px); height: calc(100% - 28px); }
.tile.wide { aspect-ratio: 1.6; }
.tile .lbl { position: absolute; left: 4px; right: 4px; bottom: 4px; font-size: 10px; font-weight: 700; color: var(--ink-2); background: rgba(255,255,255,.85); border-radius: 6px; padding: 1px 4px; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile.none { background: rgba(20,30,15,.04); color: var(--ink-3); font-size: 11px; font-weight: 600; text-align: center; line-height: 1.25; }
.tile.none svg { width: 22px; height: 22px; margin-bottom: 2px; }
.tile .x { position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; border-radius: 50%; border: 0; background: rgba(20,24,26,.72); color: #fff; display: none; place-items: center; padding: 0; z-index: 1; }
.tile .x svg { width: 12px; height: 12px; }
.tile:hover .x { display: grid; }
.tile .star { position: absolute; top: 4px; left: 4px; font-size: 9.5px; font-weight: 800; color: #fff; background: var(--accent); border-radius: 6px; padding: 1px 5px; }
.upload { display: flex; align-items: center; justify-content: center; gap: 8px; border: 1.5px dashed var(--line-2); border-radius: 12px; padding: 11px; color: var(--ink-3); font-size: 12px; font-weight: 600; cursor: pointer; background: rgba(255,255,255,.45); width: 100%; }
.upload:hover { border-color: var(--accent); color: var(--accent-ink); background: rgba(255,255,255,.75); }
.upload svg { width: 16px; height: 16px; }
.tile.add { background: rgba(255,255,255,.5); box-shadow: inset 0 0 0 1.5px var(--line-2); border: 0; color: var(--ink-3); font-size: 11px; font-weight: 700; display: flex; flex-direction: column; justify-content: center; gap: 3px; cursor: pointer; background-image: none; }
.tile.add svg { width: 20px; height: 20px; }
.tile.add:hover { color: var(--accent-ink); box-shadow: inset 0 0 0 1.5px var(--accent); background-color: rgba(255,255,255,.85); }
.lg-prev { position: absolute; inset: 8px 8px 22px; display: flex; align-items: center; justify-content: center; gap: 6px; background: #fff; border-radius: 8px; box-shadow: 0 1px 4px rgba(0,0,0,.08); }
.lg-prev img { position: static !important; width: auto !important; height: 70% !important; inset: auto !important; }
.lg-prev span { display: flex; flex-direction: column; line-height: 1; }
.lg-prev b { font: 800 12px 'Montserrat', sans-serif; color: #3d9150; letter-spacing: .03em; }
.lg-prev small { font: 700 5px 'Be Vietnam Pro', sans-serif; color: #3d9150; margin-top: 2px; }
.tile .star { top: 4px; left: 4px; }
.tile .set-def { position: absolute; top: 4px; left: 4px; border: 0; font-size: 9.5px; font-weight: 800; color: var(--ink-2); background: rgba(255,255,255,.92); box-shadow: 0 1px 3px rgba(0,0,0,.15); border-radius: 6px; padding: 2px 6px; display: none; }
.tile:hover .set-def { display: block; }
.tile .set-def:hover { color: var(--accent-ink); }
.sp-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.sp { border: 0; background: none; padding: 0; display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.sp-frame { position: relative; display: block; width: 100%; min-height: 60px; border-radius: 10px; overflow: hidden; box-shadow: 0 0 0 1px rgba(0,0,0,.08), 0 2px 8px rgba(0,0,0,.08); background: #f3f4f0; transition: box-shadow .2s var(--ease), transform .18s var(--ease); }
.sp-frame .poster { position: absolute; left: 0; top: 0; transform-origin: 0 0; pointer-events: none; }
.sp:hover .sp-frame { transform: translateY(-2px); box-shadow: 0 0 0 1px rgba(0,0,0,.08), 0 8px 18px rgba(0,0,0,.14); }
.sp.on .sp-frame { box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--accent); }
.sp.on .opt-lbl { color: var(--ink); }
.designer-note { font-size: 11px; color: var(--accent-ink); background: var(--accent-soft); border-radius: 8px; padding: 6px 9px; }

.text-presets { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.text-presets button { border: 0; background: rgba(255,255,255,.7); box-shadow: inset 0 0 0 1px var(--line-2); border-radius: 12px; padding: 10px 4px; display: grid; place-items: center; min-height: 52px; }
.text-presets button:hover { box-shadow: inset 0 0 0 1.5px var(--accent); }
.text-presets span { display: inline-block; font-weight: 800; font-size: 12.5px; padding: 3px 8px; border-radius: 6px; line-height: 1.1; }

/* Product list in the inspector */
.pick-cta { display: flex; align-items: center; gap: 12px; width: 100%; border: 0; border-radius: 16px; padding: 12px 14px; background: #15181a; color: #fff; text-align: left; box-shadow: 0 4px 16px rgba(0,0,0,.18); }
.pick-cta:hover { background: #000; }
.pick-cta .plus { width: 34px; height: 34px; border-radius: 11px; background: var(--lime); color: #15181a; display: grid; place-items: center; flex: none; }
.pick-cta b { display: block; font-size: 13.5px; }
.pick-cta small { color: rgba(255,255,255,.65); font-size: 11.5px; }
.item-list { display: flex; flex-direction: column; gap: 6px; }
.item { display: grid; grid-template-columns: 16px 44px minmax(0, 1fr); gap: 8px; align-items: start; border-radius: 12px; padding: 7px; background: rgba(255,255,255,.72); box-shadow: inset 0 0 0 1px var(--line); }
.item.focus { box-shadow: inset 0 0 0 2px var(--accent); background: #fff; }
.item.dragging { opacity: .4; }
.item.drop-before { box-shadow: inset 0 3px 0 var(--accent); }
.item.drop-after { box-shadow: inset 0 -3px 0 var(--accent); }
.item .grip { cursor: grab; color: var(--ink-4); padding-top: 14px; }
.item .grip svg { width: 14px; height: 14px; }
.item .thumb { width: 44px; height: 44px; border-radius: 8px; background: #f3f4f0; display: grid; place-items: center; }
.item .thumb img { max-width: 40px; max-height: 40px; }
.item .fields { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.item textarea, .item input { width: 100%; border: 1px solid transparent; border-radius: 7px; padding: 3px 6px; font-size: 12px; background: transparent; resize: none; color: var(--ink); }
.item textarea { font-weight: 600; line-height: 1.3; min-height: 2.7em; }
.item textarea:hover, .item input:hover { border-color: var(--line-2); }
.item textarea:focus, .item input:focus { outline: none; border-color: var(--accent); background: #fff; }
.item .line { display: flex; gap: 4px; align-items: center; }
.item .price { flex: 1.3; font-weight: 700; text-align: right; background: rgba(20,30,15,.04); }
.item .unit { flex: 1; text-transform: uppercase; background: rgba(20,30,15,.04); }
.item .act { border: 0; background: none; color: var(--ink-4); padding: 4px; border-radius: 7px; line-height: 0; }
.item .act:hover { color: var(--ink); background: var(--glass-hover); }
.item .act.del:hover { color: var(--danger); background: #fdecec; }
.item .act svg { width: 14px; height: 14px; }
.item .last-price { font-size: 10.5px; color: var(--ink-3); padding-left: 6px; }
.item .missing { color: var(--danger); font-size: 10.5px; padding-left: 6px; }
details.more { border-top: 1px solid var(--line); padding-top: 12px; }
details.more summary { cursor: pointer; font-weight: 700; font-size: 12px; list-style: none; display: flex; align-items: center; justify-content: space-between; }
details.more summary::after { content: '+'; font-size: 16px; color: var(--ink-3); }
details.more[open] summary::after { content: '−'; }
details.more .group { border: 0; padding-bottom: 0; }

/* ───────── Pages strip ───────── */
.pages {
  position: fixed;
  left: calc((var(--cl) + 100vw - var(--gap)) / 2); transform: translateX(-50%); bottom: var(--gap); transition: left .24s var(--ease);
  width: max-content; max-width: calc(100vw - var(--cl) - var(--gap) * 2);
  height: var(--pages-h); border-radius: 18px; padding: 7px 9px; gap: 8px;
  overflow-x: auto; overflow-y: hidden; scrollbar-width: none;
}
.pages::-webkit-scrollbar { display: none; }
.pg { position: relative; flex: none; height: 100%; border: 0; padding: 0; background: none; border-radius: 10px; }
.pg-frame { height: 100%; border-radius: 9px; overflow: hidden; position: relative; box-shadow: 0 0 0 1px rgba(0,0,0,.08), 0 2px 8px rgba(0,0,0,.10); background: #fff; }
.pg-frame .poster { position: absolute; left: 0; top: 0; transform-origin: 0 0; pointer-events: none; }
.pg.on .pg-frame { box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--accent), 0 4px 12px rgba(0,0,0,.12); }
.pg .num { position: absolute; left: 3px; bottom: 3px; min-width: 15px; height: 15px; padding: 0 4px; border-radius: 8px; font-size: 9.5px !important; line-height: 15px !important; background: rgba(20,24,26,.75); color: #fff; font-size: 10.5px; font-weight: 700; line-height: 18px; text-align: center; z-index: 1; }
.pg .pg-acts { position: absolute; right: 4px; top: 4px; display: none; gap: 3px; z-index: 1; }
.pg:hover .pg-acts, .pg.on .pg-acts { display: flex; }
.pg .pg-acts span { width: 18px; height: 18px; border-radius: 50%; background: rgba(20,24,26,.75); color: #fff; display: grid; place-items: center; }
.pg .pg-acts span:hover { background: #000; }
.pg .pg-acts svg { width: 10px; height: 10px; }
.pg.drop-before { box-shadow: -4px 0 0 var(--accent); }
.pg.drop-after { box-shadow: 4px 0 0 var(--accent); }
.pg-add { flex: none; height: 100%; aspect-ratio: .8; border: 1.5px dashed var(--line-2); border-radius: 9px; background: rgba(255,255,255,.4); color: var(--ink-3); display: grid; place-content: center; justify-items: center; gap: 1px; font-size: 9.5px; font-weight: 600; line-height: 1.1; }
.pg-add svg { width: 15px; height: 15px; }
.pg-add:hover { border-color: var(--accent); color: var(--accent-ink); background: rgba(255,255,255,.7); }

/* Selection + floatbar */
.sel { position: absolute; pointer-events: none; border: calc(1.5px * var(--inv)) solid var(--accent); box-shadow: 0 0 0 calc(1px * var(--inv)) rgba(255,255,255,.7); }
.sel .h { position: absolute; width: calc(16px * var(--inv)); height: calc(16px * var(--inv)); background: #fff; border: calc(2px * var(--inv)) solid var(--accent); border-radius: 50%; pointer-events: auto; transform: translate(-50%, -50%); touch-action: none; box-shadow: 0 calc(1px * var(--inv)) calc(4px * var(--inv)) rgba(0,0,0,.25); transition: transform .12s var(--ease); }
.sel .h::before { content: ''; position: absolute; inset: calc(-10px * var(--inv)); border-radius: 50%; } /* bigger grab area */
.sel .h:hover { transform: translate(-50%, -50%) scale(1.25); }
.sel .h.nw { left: 0; top: 0; cursor: nwse-resize; } .sel .h.ne { left: 100%; top: 0; cursor: nesw-resize; }
.sel .h.sw { left: 0; top: 100%; cursor: nesw-resize; } .sel .h.se { left: 100%; top: 100%; cursor: nwse-resize; }
.sel .h.rot { left: 50%; top: calc(-36px * var(--inv)); cursor: grab; background: var(--accent); border-color: #fff; }
.sel .stem { position: absolute; left: 50%; top: calc(-28px * var(--inv)); height: calc(28px * var(--inv)); border-left: calc(1.5px * var(--inv)) solid var(--accent); }
.sel.dragging .h:not(.rot) { opacity: .6; }
.sel-readout { position: fixed; z-index: 70; pointer-events: none; background: rgba(21,24,26,.9); color: #fff; font-size: 11.5px; font-weight: 700; padding: 4px 8px; border-radius: 8px; font-variant-numeric: tabular-nums; white-space: nowrap; box-shadow: 0 4px 14px rgba(0,0,0,.2); }
.floatbar { position: fixed; z-index: 35; display: flex; gap: 2px; background: rgba(21,24,26,.92); color: #fff; border-radius: 14px; padding: 4px; box-shadow: 0 10px 30px rgba(0,0,0,.25); transform: translate(-50%, -100%); }
.floatbar button svg { width: 16px; height: 16px; }
.floatbar button { border: 0; background: none; color: #fff; height: 32px; min-width: 32px; padding: 0 8px; border-radius: 10px; display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.floatbar button:hover { background: rgba(255,255,255,.14); }
.floatbar button.on { color: var(--lime); }
.floatbar .sep { width: 1px; background: rgba(255,255,255,.18); margin: 4px 2px; }

/* ───────── Dialogs ───────── */
.dialog { border: 0; border-radius: 22px; padding: 22px; width: min(520px, calc(100vw - 32px)); box-shadow: 0 24px 70px rgba(18,24,40,.28); background: #fff; color: var(--ink); }
.dialog::backdrop { background: rgba(20, 26, 18, .32); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
.dialog h3 { margin: 0 0 4px; font-size: 18px; letter-spacing: -.01em; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.progress { height: 8px; background: #f0f1ed; border-radius: 99px; overflow: hidden; margin: 14px 0; }
.progress i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s; }
.sync-log { list-style: none; padding: 0; margin: 0; max-height: 220px; overflow: auto; font-size: 12px; color: var(--ink-3); }
.sync-log li { padding: 3px 0; border-bottom: 1px dashed var(--line); }
.sync-log li.err { color: var(--danger); }

.picker, .saved-dialog { width: min(1100px, calc(100vw - 48px)); height: min(820px, calc(100vh - 48px)); padding: 0; flex-direction: column; overflow: hidden; }
.picker[open], .saved-dialog[open] { display: flex; }
.picker-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 20px 22px 12px; flex-wrap: wrap; }
.picker .chips { padding: 0 22px 12px; }
.picker-body { flex: 1; min-height: 0; overflow-y: auto; padding: 4px 22px 22px; }
.picker-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 22px; border-top: 1px solid var(--line); background: #fafbf8; font-weight: 600; }
.search { display: flex; align-items: center; gap: 8px; height: 40px; width: min(420px, 100%); border-radius: 20px; padding: 0 14px; color: var(--ink-3); background: #f3f4f0; }
.search:focus-within { background: #fff; box-shadow: 0 0 0 2px var(--accent); }
.search input { border: 0; outline: 0; flex: 1; min-width: 0; background: none; color: var(--ink); }
.chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; }
.chip { flex: none; border: 0; background: #f1f2ee; border-radius: 99px; padding: 6px 12px; font-size: 12px; font-weight: 600; color: var(--ink-2); }
.chip:hover { background: #e7e9e3; }
.chip.on { background: #15181a; color: #fff; }
.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.p-pick { position: relative; border: 0; border-radius: 16px; background: #fff; padding: 8px; text-align: left; display: flex; flex-direction: column; gap: 6px; box-shadow: inset 0 0 0 1px var(--line-2); transition: box-shadow .12s, transform .08s; min-width: 0; }
.p-pick:hover { box-shadow: inset 0 0 0 1px var(--line-2), 0 6px 18px rgba(18,24,40,.10); }
.p-pick:active { transform: scale(.98); }
.p-pick.on { box-shadow: inset 0 0 0 2px var(--accent); background: #f5fbf2; }
.p-pick .ph { aspect-ratio: 1; border-radius: 10px; background: #f6f7f3; display: grid; place-items: center; overflow: hidden; }
.p-pick img { width: 86%; height: 86%; object-fit: contain; }
.p-pick .nm { font-size: 12px; font-weight: 600; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.6em; }
.p-pick .meta { display: flex; justify-content: space-between; font-size: 11px; color: var(--ink-3); }
.p-pick .meta b { color: var(--accent-ink); }
.p-pick .tick { position: absolute; top: 12px; right: 12px; width: 24px; height: 24px; border-radius: 50%; background: var(--accent); color: #fff; display: none; place-items: center; box-shadow: 0 2px 6px rgba(0,0,0,.2); }
.p-pick.on .tick { display: grid; }
.p-pick .tick svg { width: 13px; height: 13px; stroke-width: 3; }
.saved-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; }
.saved { border-radius: 16px; overflow: hidden; background: #fff; display: flex; flex-direction: column; box-shadow: inset 0 0 0 1px var(--line-2); }
.saved .thumb { aspect-ratio: .75; background: #f3f4f0 center/contain no-repeat; border: 0; padding: 0; }
.saved .info { padding: 9px 10px 4px; display: flex; flex-direction: column; gap: 2px; }
.saved .info b { font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.saved .info small { color: var(--ink-3); font-size: 11px; }
.saved .acts { display: flex; gap: 2px; padding: 2px 6px 8px; }
.saved .acts button { flex: 1; border: 0; background: none; padding: 6px; border-radius: 8px; font-size: 12px; font-weight: 600; color: var(--ink-3); }
.saved .acts button:hover { background: #f1f2ee; color: var(--ink); }

/* Login */
.login { position: fixed; inset: 0; display: grid; place-items: center; padding: 24px 16px; overflow: auto;
  background: radial-gradient(1000px 600px at 20% 0%, rgba(198,239,85,.45) 0%, transparent 60%), radial-gradient(900px 500px at 100% 100%, rgba(120,214,170,.40) 0%, transparent 60%), var(--bg); }
.login-card { background: rgba(255,255,255,.86); border-radius: 26px; box-shadow: 0 24px 70px rgba(18,24,40,.16), inset 0 1px 0 #fff; padding: 36px 30px; width: min(400px, 100%); text-align: center; }
.login-logo { height: 54px; width: auto; margin-bottom: 14px; }
.login-card h1 { margin: 0 0 6px; font-size: 24px; letter-spacing: -.02em; }
.login-card p { margin: 0 0 24px; color: var(--ink-3); }
#gsi-button { display: flex; justify-content: center; min-height: 44px; }
@media (max-width: 420px) { .login-card { padding: 32px 18px; } }
.login-error { color: var(--danger) !important; margin-top: 16px !important; font-size: 13px; }

/* Toasts / busy */
.toasts { position: fixed; left: 50%; bottom: calc(var(--pages-h) + var(--gap) * 2 + 4px); transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 8px; z-index: 100; pointer-events: none; }
.toast { background: rgba(21,24,26,.92); color: #fff; padding: 10px 16px; border-radius: 14px; box-shadow: 0 10px 30px rgba(0,0,0,.2); font-weight: 500; max-width: min(90vw, 480px); animation: toast-in .18s ease-out; }
.toast.err { background: #b42323; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }
.busy { position: fixed; inset: 0; background: rgba(236,238,232,.55); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); display: grid; place-content: center; justify-items: center; gap: 12px; z-index: 90; font-weight: 600; }
.spinner { width: 36px; height: 36px; border-radius: 50%; border: 4px solid var(--accent-soft); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { * { animation-duration: .01ms !important; transition-duration: .01ms !important; } }

/* ───────── Option tiles (headline / pattern / footer / price tab) ───────── */
.opt-grid { display: grid; gap: 8px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.opt-grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.opt-grid.five { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.opt { border: 0; background: none; padding: 0; display: flex; flex-direction: column; gap: 4px; min-width: 0; color: var(--ink-3); }
.opt-prev { display: grid; place-items: center; border-radius: 11px; overflow: hidden; box-shadow: inset 0 0 0 1px var(--line-2); background: #fff; position: relative; }
.opt:hover .opt-prev { box-shadow: inset 0 0 0 1.5px var(--accent); }
.opt.on .opt-prev { box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--accent); }
.opt-lbl { font-size: 10.5px; font-weight: 600; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.opt.on .opt-lbl { color: var(--ink); }
.hs-prev { width: 100%; height: 62px; display: grid; place-items: center; overflow: hidden; }
.hs-prev .hl { pointer-events: none; }
.pat-prev { display: block; width: 100%; height: 44px; }
.fmock { width: 100%; height: 40px; display: flex; align-items: center; justify-content: center; gap: 4px; padding: 0 6px; background: linear-gradient(180deg, var(--bg1), var(--bg2)); }
.fmock .fm-g { display: flex; align-items: center; gap: 6px; height: 16px; padding: 0 7px 0 3px; background: var(--footBg); border-radius: 99px; }
.fmock i { display: flex; align-items: center; gap: 3px; }
.fmock em { width: 9px; height: 9px; border-radius: 50%; background: var(--footInk); }
.fmock b { width: 16px; height: 3px; border-radius: 2px; background: var(--footInk); opacity: .9; }
.fm-card .fm-g { border-radius: 4px; height: 20px; box-shadow: 0 2px 4px rgba(0,0,0,.15); }
.fm-bar { align-items: flex-end; padding: 0; }
.fm-bar .fm-g { width: 100%; border-radius: 0; height: 15px; justify-content: center; }
.fm-plain .fm-g { background: none; }
.fm-plain em { background: var(--footBg); }
.fm-plain b { background: var(--footBg); }
.tmock { width: 100%; height: 52px; background: #fff; position: relative; display: block; overflow: hidden; }
.tmock .tm-name { position: absolute; left: 5px; top: 7px; width: 42%; height: 3px; border-radius: 2px; background: #9aa395; }
.tmock .tm-name.s { top: 13px; width: 30%; }
.tmock .tm-img { position: absolute; left: 30%; right: 30%; bottom: 6px; height: 16px; border-radius: 3px; background: #e7eae3; }
.tmock .tm-tab { position: absolute; right: 0; top: 0; background: var(--accent); color: #fff; font-size: 8px; font-weight: 800; padding: 3px 4px 3px 7px; border-bottom-left-radius: 10px 12px; line-height: 1; }
.tm-pill .tm-tab { top: 4px; right: 4px; border-radius: 99px; padding: 3px 5px; }
.tm-flag .tm-tab { right: 5px; border-radius: 0; padding: 3px 4px 7px; clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 75%, 0 100%); }
.tm-circle .tm-tab { top: 3px; right: 3px; width: 20px; height: 20px; border-radius: 50%; padding: 0; display: grid; place-items: center; font-size: 6.5px; }
.tm-bar .tm-tab { top: auto; bottom: 0; left: 0; right: 0; border-radius: 0; text-align: center; padding: 3px; }
.tm-bar .tm-img { bottom: 13px; }
.colors.two { grid-template-columns: auto 1fr; align-items: center; }

/* Footer row editor */
.f-edit { display: flex; flex-direction: column; gap: 5px; padding: 8px; border-radius: 12px; background: rgba(255,255,255,.72); box-shadow: inset 0 0 0 1px var(--line); }
.f-edit-top { display: flex; align-items: center; gap: 4px; }
.f-edit .icon-sel { flex: 1; height: 30px; font-size: 12px; }
.f-edit .inp { height: 30px; font-size: 12.5px; }
.chips.wrap { flex-wrap: wrap; overflow: visible; }
.chip-btn { display: inline-flex; align-items: center; background: #fff; border-radius: 99px; box-shadow: inset 0 0 0 1px var(--line-2); }
.chip-btn .chip { background: none; }
.chip-btn .chip:hover { color: var(--accent-ink); }
.chip-x { border: 0; background: none; color: var(--ink-4); width: 24px; height: 24px; display: grid; place-items: center; border-radius: 50%; margin-right: 3px; padding: 0; }
.chip-x:hover { background: #fdecec; color: var(--danger); }
.chip-x svg { width: 12px; height: 12px; }

/* Save state, storage */
.save-state { font-size: 11px; font-weight: 600; color: var(--ink-4); white-space: nowrap; margin: 0 4px; }
.save-state.dirty { color: #b26b00; }
.save-state.dirty::before { content: ''; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: #f0a020; margin-right: 5px; vertical-align: 1px; }
.save-state.saved { color: var(--accent-ink); }
.menu-storage { padding: 8px 10px 10px; border-bottom: 1px solid var(--line); margin-bottom: 4px; display: flex; flex-direction: column; gap: 6px; }
.menu-storage small { color: var(--ink-3); font-size: 11px; line-height: 1.35; }
.ms-row { display: flex; justify-content: space-between; font-size: 12px; }
.ms-row span { color: var(--ink-2); font-variant-numeric: tabular-nums; }
.progress.sm { height: 6px; margin: 0; }
.storage-note { font-size: 11px; }

/* Ask dialog */
.ask { width: min(400px, calc(100vw - 32px)); padding: 26px 24px 20px; text-align: center; }
.ask-icon { width: 44px; height: 44px; border-radius: 14px; margin: 0 auto 12px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.ask-icon.danger { background: #fdecec; color: var(--danger); }
.ask-icon svg { width: 22px; height: 22px; }
.ask h3 { font-size: 17px; }
.ask-msg { margin: 6px 0 0; color: var(--ink-3); line-height: 1.5; }
.ask .inp { margin-top: 14px; height: 40px; text-align: left; }
.ask .dialog-actions { justify-content: center; margin-top: 20px; }
.ask .dialog-actions .btn { min-width: 120px; }
.btn.danger-fill { background: var(--danger); color: #fff; box-shadow: 0 2px 10px rgba(212,60,60,.3); }
.btn.danger-fill:hover { background: #bd2f2f; }

/* Export dialog */
.export-dialog { width: min(980px, calc(100vw - 48px)); height: min(680px, calc(100vh - 48px)); padding: 0; flex-direction: column; overflow: hidden; }
.export-dialog[open] { display: flex; }
.ex-body { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 340px; }
.ex-pages-wrap { min-height: 0; overflow-y: auto; padding: 4px 22px 22px; }
.ex-label { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; font-size: 12.5px; }
.ex-label span { color: var(--ink-3); }
.link { border: 0; background: none; padding: 0; color: var(--accent-ink); font-weight: 600; font-size: 12px; }
.link:hover { text-decoration: underline; }
.ex-pages { display: flex; flex-wrap: wrap; gap: 14px; }
.ex-page { position: relative; border: 0; background: none; padding: 0; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.ex-page .pg-frame { box-shadow: 0 0 0 1px rgba(0,0,0,.08), 0 3px 10px rgba(0,0,0,.08); opacity: .55; transition: opacity .12s; }
.ex-page.on .pg-frame { opacity: 1; box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--accent), 0 4px 14px rgba(0,0,0,.12); }
.ex-check { position: absolute; top: 8px; right: 8px; width: 24px; height: 24px; border-radius: 50%; background: rgba(255,255,255,.9); box-shadow: inset 0 0 0 1.5px var(--line-2); display: grid; place-items: center; color: transparent; }
.ex-page.on .ex-check { background: var(--accent); color: #fff; box-shadow: none; }
.ex-check svg { width: 13px; height: 13px; stroke-width: 3; }
.ex-num { font-size: 12px; font-weight: 600; color: var(--ink-2); }
.ex-opts { border-left: 1px solid var(--line); padding: 4px 22px 22px; overflow-y: auto; display: flex; flex-direction: column; gap: 16px; }
.ex-formats { display: flex; flex-direction: column; gap: 6px; }
.ex-fmt { display: flex; flex-direction: column; align-items: flex-start; border: 0; text-align: left; padding: 10px 12px; border-radius: 12px; background: #f6f7f3; box-shadow: inset 0 0 0 1px transparent; }
.ex-fmt b { font-size: 13px; }
.ex-fmt small { color: var(--ink-3); font-size: 11.5px; }
.ex-fmt:hover { background: #eef0ea; }
.ex-fmt.on { background: #f2faef; box-shadow: inset 0 0 0 2px var(--accent); }
.ex-opts .seg button { font-size: 11.5px; padding: 6px 6px; }

/* ───────── Motion (short, ease-out; disabled by prefers-reduced-motion above) ───────── */
:root { --ease: cubic-bezier(.2, .8, .2, 1); --ease-spring: cubic-bezier(.34, 1.56, .64, 1); }
.dialog[open] { animation: dlg-in .24s var(--ease); }
.dialog[open]::backdrop { animation: fade-in .2s ease; }
@keyframes dlg-in { from { opacity: 0; transform: translateY(10px) scale(.97); } }
@keyframes fade-in { from { opacity: 0; } }
.menu:not([hidden]) { animation: menu-in .17s var(--ease); transform-origin: top right; }
.cap-brand .menu { transform-origin: top left; }
@keyframes menu-in { from { opacity: 0; transform: translateY(-6px) scale(.97); } }
.panel-scroll.enter { animation: insp-in .24s var(--ease); }
@keyframes insp-in { from { opacity: 0; transform: translateX(10px); } }
.nav-item, .opt-prev, .tile, .theme-sw, .p-pick, .pg-frame, .chip, .seg button, .ex-fmt, .item, .f-edit, .pick-cta, .icon-btn, .zoom-val {
  transition: background-color .15s ease, box-shadow .2s var(--ease), transform .18s var(--ease), color .15s ease, opacity .15s ease; }
.opt:active .opt-prev, .tile:active, .theme-sw:active, .chip:active, .pg:active .pg-frame, .ex-page:active .pg-frame { transform: scale(.95); }
.icon-btn:active, .btn:active { transform: scale(.96); }
.opt:hover .opt-prev, .theme-sw:hover { transform: translateY(-1px); }
.p-pick.on .tick { animation: pop .3s var(--ease-spring); }
.ex-page.on .ex-check { animation: pop .3s var(--ease-spring); }
@keyframes pop { from { transform: scale(.3); opacity: 0; } }
.pg.enter { animation: pg-in .32s var(--ease); }
@keyframes pg-in { from { opacity: 0; transform: translateY(12px) scale(.9); } }
.scaler-box.swap { animation: page-swap .28s var(--ease); }
@keyframes page-swap { from { opacity: 0; transform: translateY(8px) scale(.985); } }
.poster.editing .stk.pop { animation: stk-pop .34s var(--ease-spring); }
@keyframes stk-pop { from { scale: .55; opacity: 0; } }
.toast.out { animation: toast-out .18s ease forwards; }
@keyframes toast-out { to { opacity: 0; transform: translateY(6px) scale(.98); } }
.sel { animation: fade-in .12s ease; }
.floatbar:not([hidden]) { animation: fb-in .16s var(--ease); }
@keyframes fb-in { from { opacity: 0; margin-top: 4px; } }
.busy:not([hidden]) { animation: fade-in .18s ease; }
details.more[open] > .group { animation: insp-in .2s var(--ease); }

/* ───────── Collapsible panel ───────── */
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
body.no-motion *, body.no-motion *::before, body.no-motion *::after { animation: none !important; transition: none !important; }

/* ───────── Excel import ───────── */
.picker-tools { display: flex; gap: 8px; align-items: center; flex: 1; justify-content: flex-end; min-width: 0; }
.import-dialog { width: min(1180px, calc(100vw - 40px)); height: min(840px, calc(100vh - 40px)); padding: 0; flex-direction: column; overflow: hidden; }
.import-dialog[open] { display: flex; }
.import-body { flex: 1; min-height: 0; overflow-y: auto; padding: 0 22px 18px; display: flex; flex-direction: column; gap: 12px; }
.import-empty { flex: 1; display: grid; place-content: center; gap: 12px; justify-items: center; padding: 30px 0; }
.drop { width: min(560px, 80vw); border: 2px dashed var(--line-2); border-radius: 22px; padding: 44px 24px; display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; cursor: pointer; background: #fafbf8; transition: border-color .15s, background .15s, transform .18s var(--ease); }
.drop:hover, .drop.over { border-color: var(--accent); background: #f3faf0; }
.drop.over { transform: scale(1.01); }
.drop-ico { width: 54px; height: 54px; border-radius: 16px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; }
.drop-ico svg { width: 26px; height: 26px; }
.drop b { font-size: 15px; }
.drop small { color: var(--ink-3); }
.imp-top { position: sticky; top: 0; z-index: 2; background: #fff; display: flex; flex-direction: column; gap: 10px; padding: 4px 0 10px; border-bottom: 1px solid var(--line); }
.imp-file { display: flex; align-items: center; gap: 8px; }
.imp-fname { font-weight: 700; max-width: 360px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.imp-file .select { width: auto; }
.imp-map { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
.chip.ok.on { background: var(--accent); }
.chip.warn.on { background: #c27a00; }
.chip.bad.on { background: var(--danger); }
.imp-table { display: flex; flex-direction: column; }
.imp-row { display: grid; grid-template-columns: 26px minmax(0, 1.1fr) minmax(0, 1.4fr) 70px 90px; gap: 12px; align-items: center; padding: 8px 6px; border-bottom: 1px solid var(--line); font-size: 12.5px; transition: background .12s, opacity .12s; }
.imp-row:hover { background: #fafbf8; }
.imp-row.head { position: sticky; top: 0; font-size: 11px; font-weight: 700; color: var(--ink-3); text-transform: uppercase; letter-spacing: .04em; border-bottom: 1px solid var(--line-2); background: #fff; }
.imp-row.off { opacity: .5; }
.imp-row .r { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.imp-row input[type=checkbox] { accent-color: var(--accent); width: 16px; height: 16px; }
.imp-src, .imp-match > div { display: flex; flex-direction: column; min-width: 0; }
.imp-src b, .imp-match b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.imp-src small, .imp-match small { color: var(--ink-3); font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.imp-mcell { display: flex; align-items: center; gap: 8px; min-width: 0; }
.imp-match { display: flex; align-items: center; gap: 8px; min-width: 0; flex: 1; }
.imp-match img { width: 36px; height: 36px; object-fit: contain; border-radius: 8px; background: #f3f4f0; flex: none; }
.imp-match > div { flex: 1; }
.imp-match.none span { color: var(--ink-3); flex: 1; }
.imp-badge { flex: none; font-size: 10px; font-weight: 800; padding: 2px 7px; border-radius: 99px; white-space: nowrap; }
.imp-badge.ok { background: var(--accent-soft); color: var(--accent-ink); }
.imp-badge.warn { background: #fff3db; color: #9a5d00; }
.imp-badge.bad { background: #fdecec; color: var(--danger); }
.imp-pop { position: absolute; z-index: 5; width: 380px; background: #fff; border-radius: 16px; box-shadow: 0 14px 44px rgba(18,24,40,.22), 0 0 0 .5px rgba(18,24,40,.08); padding: 10px; display: flex; flex-direction: column; gap: 8px; animation: menu-in .16s var(--ease); }
.imp-pop-list { max-height: 300px; overflow-y: auto; display: flex; flex-direction: column; }
.imp-pop-list button { display: flex; align-items: center; gap: 10px; border: 0; background: none; padding: 6px; border-radius: 10px; text-align: left; }
.imp-pop-list button:hover { background: #f3f4f0; }
.imp-pop-list img { width: 34px; height: 34px; object-fit: contain; border-radius: 6px; background: #f3f4f0; }
.imp-pop-list span { display: flex; flex-direction: column; min-width: 0; }
.imp-pop-list b { font-size: 12.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.imp-pop-list small { color: var(--ink-3); font-size: 11px; }
.import-foot { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; padding: 14px 22px; border-top: 1px solid var(--line); background: #fafbf8; }
.imp-opts { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.imp-opt { display: flex; align-items: center; gap: 10px; font-size: 12.5px; }
.imp-opt .per { width: 64px; height: 30px; }
.imp-go { display: flex; gap: 8px; flex: none; }

/* ───────── Settings ───────── */
.settings-dialog { width: min(980px, calc(100vw - 40px)); height: min(720px, calc(100vh - 40px)); padding: 0; overflow: hidden; }
.settings-dialog[open] { display: grid; grid-template-columns: 230px minmax(0, 1fr); }
.settings-side { background: #f6f7f3; border-right: 1px solid var(--line); padding: 18px 12px; display: flex; flex-direction: column; gap: 14px; }
.settings-title { display: flex; align-items: center; gap: 8px; padding: 0 8px; font-size: 16px; }
.settings-title img { height: 24px; }
.settings-main { position: relative; min-width: 0; min-height: 0; overflow-y: auto; }
.settings-close { position: absolute; top: 14px; right: 14px; z-index: 1; }
.settings-body { padding: 24px 30px 30px; display: flex; flex-direction: column; gap: 16px; }
.settings-body.enter { animation: insp-in .22s var(--ease); }
.settings-body h3 { margin: 0; font-size: 20px; letter-spacing: -.01em; }
.set-sec { display: flex; flex-direction: column; gap: 10px; padding: 16px; border-radius: 16px; background: #fafbf8; box-shadow: inset 0 0 0 1px var(--line); }
.set-sec h4 { margin: 0; font-size: 13.5px; }
.set-sec > .hint { margin-top: -6px; }
.set-row { display: flex; align-items: center; gap: 10px; justify-content: space-between; flex-wrap: wrap; }
.set-row > span { font-weight: 600; font-size: 12.5px; }
.set-row .inp { flex: 1; min-width: 200px; }
.set-list { display: flex; flex-direction: column; gap: 6px; }
.set-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: #fff; border-radius: 12px; box-shadow: inset 0 0 0 1px var(--line); }
.set-item > div { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.set-item small { color: var(--ink-3); font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-weight: 500; cursor: pointer; }
.switch { position: relative; width: 40px; height: 24px; flex: none; }
.switch input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.switch i { position: absolute; inset: 0; border-radius: 99px; background: rgba(20,30,15,.18); transition: background .18s var(--ease); pointer-events: none; }
.switch i::after { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .2s var(--ease-spring); }
.switch input:checked + i { background: var(--accent); }
.switch input:checked + i::after { transform: translateX(16px); }
.lib.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.lib-manage { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.lm-item { display: flex; flex-direction: column; gap: 6px; padding: 8px; border-radius: 14px; background: #fff; box-shadow: inset 0 0 0 1px var(--line); }
.lm-item .inp, .lm-item .select { height: 30px; font-size: 12px; }
.lm-meta { display: flex; align-items: center; justify-content: space-between; }
.lm-meta small { color: var(--ink-3); font-size: 11px; }
.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat { padding: 14px; border-radius: 14px; background: #fafbf8; box-shadow: inset 0 0 0 1px var(--line); display: flex; flex-direction: column; }
.stat b { font-size: 22px; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat small { color: var(--ink-3); }
.meter { display: flex; flex-direction: column; gap: 6px; padding: 14px 16px; border-radius: 14px; background: #fafbf8; box-shadow: inset 0 0 0 1px var(--line); }
.meter small { color: var(--ink-3); }
.meter.warn .progress i { background: #e08a00; }
.meter.warn small { color: #9a5d00; }
.kbd-list { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 16px; }
.kbd-list div { display: flex; align-items: center; gap: 10px; font-size: 12.5px; }
kbd { font: 600 11px 'Be Vietnam Pro', sans-serif; background: #fff; border-radius: 7px; padding: 3px 7px; box-shadow: inset 0 -1px 0 rgba(0,0,0,.12), 0 0 0 1px var(--line-2); white-space: nowrap; }
.acct { display: flex; align-items: center; gap: 14px; }
.acct > div { display: flex; flex-direction: column; gap: 2px; }
.acct small { color: var(--ink-3); }
.acct .badge { align-self: flex-start; }
.avatar.big { width: 56px; height: 56px; font-size: 22px; margin: 0; }
.btn.ghost.danger { color: var(--danger); }

/* ───────── Narrow screens: nav row + bottom sheet ───────── */
@media (max-width: 900px) {
  :root { --gap: 8px; --top-h: 44px; --sheet-h: 44vh; --nav-h: 52px; }
  /* Top bar must fit 360px: keep logo+menu · format+undo · save+export+avatar */
  .brand-name, .title-input, .cap-brand .cap-sep, .cap-actions .btn span, .cap-center .zoom-val, #zoom-in, #zoom-out, #redo, .cap-center .cap-sep, #btn-sync { display: none !important; }
  .chrome-top { gap: 6px; }
  .cap { padding: 0 4px; gap: 0; }
  .cap-brand { padding-left: 8px; }
  .brand-icon { height: 22px; }
  .icon-btn, .avatar { width: 34px; height: 34px; }
  .select.bare { padding: 0 24px 0 8px; max-width: 108px; }
  .btn { padding: 0 10px; height: 34px; }
  .rail { top: auto; bottom: calc(var(--sheet-h) + var(--gap) * 2); left: var(--gap); right: var(--gap); width: auto; height: var(--nav-h); padding: 4px 6px; border-radius: 18px; flex-direction: row; }
  .rail-nav { flex-direction: row; overflow-x: auto; scrollbar-width: none; gap: 2px; flex: 1; }
  .rail-foot { display: none; }
  .rail-sep { width: 1px; height: auto; margin: 8px 2px; }
  .rail-btn { flex: none; width: 60px; padding: 3px 0; font-size: 9.5px; }
  .rail-btn .ico { width: 28px; height: 28px; border-radius: 9px; }
  .rail-btn .count { right: 6px; }
  .panel-insp { top: auto; height: var(--sheet-h); left: var(--gap); right: var(--gap); width: auto; border-radius: 20px; }
  body.insp-hidden .panel-insp { transform: translateY(14px); }
  .ctxbar, .ctxbar.at-bottom { top: calc(var(--top-h) + var(--gap) * 3 + 56px); left: 50%; max-width: calc(100vw - 16px); }
  .cb-hint { display: none; }
  .section-nav { flex-direction: row; overflow-x: auto; scrollbar-width: none; gap: 4px; }
  .nav-item { flex: none; flex-direction: column; justify-content: center; gap: 1px; height: 40px; width: 64px; padding: 0 2px; font-size: 10px; }
  .nav-item .lbl { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
  .nav-item .ico { width: 22px; height: 22px; background: none; }
  .nav-item .count { position: absolute; top: 1px; right: 6px; margin: 0; font-size: 9px; padding: 0 5px; line-height: 14px; background: var(--accent); color: #fff; }
  .nav-item .dot { position: absolute; top: 4px; right: 14px; margin: 0; }
  .pages { top: calc(var(--top-h) + var(--gap) * 2); bottom: auto; left: 50%; height: 56px; padding: 6px 8px; border-radius: 16px; max-width: calc(100vw - 16px); }
  .toasts { bottom: calc(var(--sheet-h) + var(--nav-h) + var(--gap) * 4); }
  .picker, .saved-dialog, .export-dialog, .import-dialog, .settings-dialog { width: 100vw; height: 100vh; max-width: none; max-height: none; border-radius: 0; }
  .settings-dialog[open] { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .settings-side { border-right: 0; border-bottom: 1px solid var(--line); padding: 10px; }
  .settings-side .section-nav { flex-direction: row; overflow-x: auto; }
  .imp-map { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .imp-row { grid-template-columns: 22px minmax(0, 1fr) 70px; }
  .imp-row > :nth-child(3), .imp-row > :nth-child(4) { display: none; }
  .import-foot { flex-direction: column; align-items: stretch; }
  .picker-tools .btn span { display: none; }
  .ex-body { grid-template-columns: 1fr; overflow-y: auto; }
  .ex-pages-wrap, .ex-opts { overflow: visible; }
  .ex-opts { border-left: 0; border-top: 1px solid var(--line); padding-top: 16px; }
  .save-state { display: none; }
  .product-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
}
