/* ================== Menu Xinh — giao diện trình soạn ================== */
:root {
  --brand: #e8590c; --brand-d: #c94a06; --brand-soft: #fff1e8;
  --bg: #f6f3ee; --card: #fff; --ink: #1f1b16; --muted: #7a736b; --border: #e8e2d9;
  --danger: #d6336c; --ok: #2b8a3e; --warn: #e67700;
  --radius: 16px; --shadow: 0 1px 2px rgba(31,27,22,.05), 0 4px 16px rgba(31,27,22,.06);
  --tabbar-h: 64px; --safe-b: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: 'Be Vietnam Pro', system-ui, -apple-system, sans-serif; background: var(--bg); color: var(--ink); font-size: 15px; line-height: 1.5; -webkit-tap-highlight-color: transparent; }
button, input, textarea, select { font: inherit; color: inherit; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
[hidden] { display: none !important; }
code { background: #f1ece4; padding: 1px 6px; border-radius: 6px; font-size: 13px; }

/* ---------- Top bar ---------- */
.topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 10px; height: 56px; padding: 0 14px; padding-top: env(safe-area-inset-top, 0px);
  background: rgba(246,243,238,.92); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); border-bottom: 1px solid var(--border); }
.brand { display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--ink); font-weight: 800; font-size: 17px; }
.brand-mark { width: 32px; height: 32px; border-radius: 10px; background: var(--brand); color: #fff; display: grid; place-items: center; }
.brand-mark svg { width: 22px; height: 22px; stroke-width: 7; }
.menu-switch { display: flex; align-items: center; gap: 4px; min-width: 0; max-width: 42vw; border: 1px solid var(--border); background: #fff; border-radius: 999px; padding: 5px 10px 5px 14px; font-weight: 600; font-size: 14px; cursor: pointer; }
.menu-switch span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-switch svg { width: 16px; height: 16px; }
.sync { margin-left: auto; display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.sync i { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); }
.sync[data-state="saving"] i { background: var(--warn); animation: pulse 1s infinite; }
.sync[data-state="offline"] i { background: var(--danger); }
@keyframes pulse { 50% { opacity: .3; } }
@media (max-width: 420px) { .brand-name { display: none; } .sync span { display: none; } }

/* ---------- Layout ---------- */
.layout { display: block; }
.editor { max-width: 640px; margin: 0 auto; padding: 16px 14px calc(var(--tabbar-h) + 90px + var(--safe-b)); }
.panel-head { margin: 4px 2px 14px; }
.panel-head h2 { margin: 0 0 4px; font-size: 22px; letter-spacing: -.01em; }
.panel-head p { margin: 0; color: var(--muted); font-size: 14px; }

.card { background: var(--card); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); margin-bottom: 14px; border: 1px solid rgba(232,226,217,.6); }
.card h3 { margin: 0 0 4px; font-size: 16px; }
.sub { margin: 0 0 12px; color: var(--muted); font-size: 13.5px; }
.hint { font-size: 13px; color: var(--muted); margin: 10px 0 0; }
.hint.warn { color: #8a4b00; background: #fff4e0; border-radius: 10px; padding: 10px 12px; }

/* ---------- Forms ---------- */
.field { display: block; margin: 0 0 12px; border: 0; padding: 0; min-width: 0; }
.field > span, .field legend { display: block; font-size: 13px; font-weight: 600; color: #4a443d; margin-bottom: 5px; padding: 0; }
.req { color: var(--danger); }
.field input, .field textarea { width: 100%; border: 1.5px solid var(--border); border-radius: 12px; padding: 11px 13px; background: #fdfcfa; font-size: 16px; outline: none; transition: border-color .15s, box-shadow .15s; }
.field textarea { resize: vertical; min-height: 60px; }
.field input:focus, .field textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(232,89,12,.15); background: #fff; }
.field small { display: block; margin-top: 4px; font-size: 12px; color: var(--muted); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 14px !important; width: 100%; border: 1.5px solid var(--border); border-radius: 12px; padding: 12px; }
.grid-2 { display: grid; grid-template-columns: 1fr; gap: 0 12px; }
@media (min-width: 520px) { .grid-2 { grid-template-columns: 1fr 1fr; } }
.more summary { cursor: pointer; font-weight: 700; list-style: none; display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.more summary::-webkit-details-marker { display: none; }
.more summary::after { content: '+'; margin-left: auto; font-size: 20px; color: var(--muted); line-height: 1; }
.more[open] summary::after { content: '−'; }
.more summary small { font-weight: 400; color: var(--muted); font-size: 13px; }
.more[open] summary { margin-bottom: 14px; }

.logo-field { display: flex; gap: 14px; align-items: flex-start; }
.logo-text { flex: 1; min-width: 0; }
.logo-pick { width: 76px; height: 76px; flex: none; border-radius: 18px; border: 1.5px dashed #cfc6b8; background: #faf7f2; cursor: pointer; position: relative; overflow: hidden; padding: 0; margin-top: 4px; }
.logo-img { position: absolute; inset: 0; background: center/cover no-repeat; }
.logo-plus { font-size: 12px; font-weight: 600; color: var(--muted); }
.logo-pick.has-img .logo-plus { display: none; }
.logo-pick.has-img { border-style: solid; }
.link-btn { background: none; border: 0; padding: 0; color: var(--danger); font-size: 13px; cursor: pointer; text-decoration: underline; }

/* switch */
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; cursor: pointer; font-weight: 500; }
.switch-row + .switch-row { border-top: 1px solid #f1ece4; }
.switch-row input { position: absolute; opacity: 0; pointer-events: none; }
.switch-row i { width: 46px; height: 28px; border-radius: 999px; background: #d9d2c7; position: relative; transition: background .2s; flex: none; }
.switch-row i::after { content: ''; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .2s; }
.switch-row input:checked + i { background: var(--brand); }
.switch-row input:checked + i::after { transform: translateX(18px); }
.switch-row input:focus-visible + i { outline: 3px solid rgba(232,89,12,.35); outline-offset: 2px; }
.toggles { padding-top: 6px; padding-bottom: 6px; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 10px 18px; border-radius: 12px; border: 1.5px solid var(--border); background: #fff; font-weight: 600; font-size: 15px; cursor: pointer; text-decoration: none; color: var(--ink); transition: transform .08s, background .15s; user-select: none; }
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-d); }
.btn-dashed { border-style: dashed; background: transparent; color: var(--brand-d); border-color: #e9b899; }
.btn-danger { color: var(--danger); border-color: #f3c1d3; margin-top: 12px; }
.btn-danger-ghost { color: var(--danger); background: transparent; border-color: transparent; }
.btn-block { width: 100%; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }
.btn-row .btn { flex: 1 1 140px; }
.next { margin-top: 8px; }
.icon-btn { width: 40px; height: 40px; border-radius: 12px; border: 0; background: transparent; display: grid; place-items: center; cursor: pointer; color: var(--muted); }
.icon-btn:hover { background: #f1ece4; color: var(--ink); }
.icon-btn.sm { width: 34px; height: 34px; }
.icon-btn.sm svg { width: 18px; height: 18px; }
.icon-btn:disabled { opacity: .3; cursor: default; background: none; }

.seg { display: inline-flex; background: #ece6dd; border-radius: 12px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: transparent; padding: 7px 16px; border-radius: 9px; font-weight: 600; font-size: 14px; cursor: pointer; color: var(--muted); }
.seg button[aria-pressed="true"] { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.1); }
#paperSeg { margin-bottom: 12px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { border: 1.5px solid var(--border); background: #fff; border-radius: 999px; padding: 6px 13px; font-size: 13.5px; font-weight: 600; cursor: pointer; color: #4a443d; }
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
#tplFilter { margin: 0 0 12px; overflow-x: auto; flex-wrap: nowrap; padding-bottom: 4px; scrollbar-width: none; }
#tplFilter .chip { flex: none; }

/* ---------- Tab bar (mobile: dưới đáy; desktop: trên cùng) ---------- */
.tabbar { position: fixed; z-index: 25; left: 0; right: 0; bottom: 0; display: grid; grid-template-columns: repeat(4, 1fr); height: calc(var(--tabbar-h) + var(--safe-b)); padding-bottom: var(--safe-b);
  background: rgba(255,255,255,.96); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); border-top: 1px solid var(--border); }
.tabbar button { border: 0; background: none; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 11.5px; font-weight: 600; color: var(--muted); cursor: pointer; position: relative; }
.tabbar button svg { width: 23px; height: 23px; }
.tabbar button[aria-selected="true"] { color: var(--brand); }
.tabbar button[aria-selected="true"]::before { content: ''; position: absolute; top: 0; width: 28px; height: 3px; border-radius: 0 0 3px 3px; background: var(--brand); }

/* ---------- Categories & items ---------- */
.cat-card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 14px; overflow: hidden; border: 1px solid rgba(232,226,217,.6); }
.cat-head { display: flex; align-items: center; gap: 4px; padding: 10px 8px 10px 14px; background: #fbf8f4; border-bottom: 1px solid #f1ece4; }
.cat-name { flex: 1; min-width: 0; border: 1.5px solid transparent; background: transparent; font-weight: 800; font-size: 17px; padding: 6px 8px; margin-left: -8px; border-radius: 10px; outline: none; }
.cat-name:hover { border-color: var(--border); }
.cat-name:focus { border-color: var(--brand); background: #fff; }
.cat-count { font-size: 12px; color: var(--muted); white-space: nowrap; margin-right: 4px; }
.item-list { list-style: none; margin: 0; padding: 0; }
.item-row { display: flex; align-items: center; gap: 12px; padding: 10px 8px 10px 14px; border-bottom: 1px solid #f4f0ea; cursor: pointer; }
.item-row:hover { background: #fdfbf8; }
.item-thumb { width: 52px; height: 52px; border-radius: 12px; background: #f3ede5 center/cover no-repeat; flex: none; display: grid; place-items: center; color: #b4a998; font-weight: 800; font-size: 18px; }
.item-info { flex: 1; min-width: 0; }
.item-name { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item-meta { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item-price { color: var(--brand-d); font-weight: 700; margin-right: 6px; }
.item-row.is-soldout .item-name { text-decoration: line-through; color: var(--muted); }
.badge-mini { display: inline-block; font-size: 10.5px; font-weight: 700; padding: 1px 6px; border-radius: 6px; background: #eee; color: #555; margin-right: 4px; vertical-align: 1px; }
.reorder { display: flex; flex-direction: column; }
.reorder .icon-btn { width: 32px; height: 26px; border-radius: 8px; }
.reorder .icon-btn svg { width: 16px; height: 16px; }
.cat-actions { display: flex; gap: 8px; padding: 10px 12px 12px; }
.cat-actions .btn { flex: 1; min-height: 42px; font-size: 14px; }
.cat-actions .add-item { color: var(--brand-d); border-color: #f2cdb4; background: var(--brand-soft); }
.empty-cat { padding: 18px 14px 6px; color: var(--muted); font-size: 14px; text-align: center; }

/* ---------- Template picker ---------- */
.tpl-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-bottom: 14px; }
@media (min-width: 560px) { .tpl-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1024px) { .tpl-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1280px) { .tpl-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.tpl-card { border: 2px solid transparent; border-radius: 16px; padding: 0; background: #fff; cursor: pointer; text-align: left; overflow: hidden; box-shadow: var(--shadow); position: relative; transition: transform .15s, border-color .15s; }
.tpl-card:hover { transform: translateY(-2px); }
.tpl-card[aria-pressed="true"] { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(232,89,12,.2), var(--shadow); }
.tpl-thumb { height: 230px; overflow: hidden; position: relative; pointer-events: none; background: #eee; }
.tpl-thumb-inner { width: 390px; transform-origin: 0 0; position: absolute; top: 0; left: 0; }
.tpl-thumb::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 40px; background: linear-gradient(transparent, rgba(0,0,0,.12)); }
.tpl-meta { padding: 9px 11px 11px; }
.tpl-meta b { display: block; font-size: 14px; }
.tpl-meta span { display: block; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tpl-dots { display: flex; gap: 4px; margin-top: 6px; }
.tpl-dots i { width: 12px; height: 12px; border-radius: 50%; border: 1px solid rgba(0,0,0,.12); }
.tpl-check { position: absolute; top: 8px; right: 8px; z-index: 2; background: var(--brand); color: #fff; border-radius: 999px; font-size: 11.5px; font-weight: 700; padding: 3px 9px 3px 7px; display: none; align-items: center; gap: 3px; }
.tpl-check svg { width: 14px; height: 14px; stroke-width: 3; }
.tpl-card[aria-pressed="true"] .tpl-check { display: flex; }

/* ---------- Share ---------- */
.link-row { display: flex; gap: 8px; align-items: stretch; margin: 10px 0; }
.link-row input { flex: 1; min-width: 0; border: 1.5px solid var(--border); border-radius: 12px; padding: 10px 12px; background: #faf7f2; font-size: 14px; color: var(--brand-d); font-weight: 600; }
.link-row .btn { min-height: 44px; padding: 8px 14px; }
.link-tip { font-size: 13px; color: var(--ok); background: #ebfbee; border-radius: 10px; padding: 8px 12px; margin: 0; }
.qr-stage { display: flex; justify-content: center; padding: 14px; margin: 0 -4px 14px; background: repeating-conic-gradient(#f3eee7 0 25%, #faf7f2 0 50%) 0 0/20px 20px; border-radius: 14px; }
#qrCardHost { width: 260px; }

/* Thẻ QR để bàn — dùng biến màu của template */
.qrcard { width: 420px; height: 592px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 34px 30px; gap: 4px; }
.qrcard .qc-kicker { font-size: 13px; letter-spacing: .3em; text-transform: uppercase; color: var(--accent); font-weight: 700; }
.qrcard .qc-name { font-family: var(--head); font-size: 34px; line-height: 1.1; color: var(--accent); font-weight: 700; margin: 6px 0 16px; word-break: break-word; }
.qrcard .qc-box { background: #fff; padding: 14px; border-radius: 20px; border: 3px solid var(--accent); }
.qrcard .qc-box img { width: 220px; height: 220px; display: block; image-rendering: pixelated; }
.qrcard .qc-cta { margin-top: 18px; font-size: 20px; font-weight: 800; color: var(--ink); font-family: var(--body); }
.qrcard .qc-sub { font-size: 13.5px; color: var(--muted); }
.qrcard .qc-wifi { margin-top: 14px; font-size: 13px; color: var(--ink); border-top: 1px dashed var(--line); padding-top: 10px; width: 80%; }
#qrCardHost .qrcard { transform: scale(.619); transform-origin: 0 0; margin-bottom: -225.5px; box-shadow: 0 6px 24px rgba(0,0,0,.18); border-radius: 18px; }

/* menu list */
.menu-list { list-style: none; margin: 0; padding: 0; }
.menu-list li { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 12px; cursor: pointer; border: 1.5px solid transparent; }
.menu-list li:hover { background: #faf7f2; }
.menu-list li.is-current { border-color: var(--brand); background: var(--brand-soft); }
.menu-list .ml-swatch { width: 40px; height: 40px; border-radius: 12px; flex: none; display: grid; place-items: center; font-weight: 800; color: #fff; }
.menu-list .ml-text { flex: 1; min-width: 0; }
.menu-list b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.menu-list small { color: var(--muted); }

/* ---------- Preview ---------- */
.preview { position: fixed; inset: 0; z-index: 40; background: #2a2622; display: none; flex-direction: column; }
.preview.is-open { display: flex; }
.preview-bar { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px; padding-top: calc(10px + env(safe-area-inset-top, 0px)); }
.preview-bar .seg { background: rgba(255,255,255,.12); }
.preview-bar .seg button { color: rgba(255,255,255,.7); }
.preview-bar .seg button[aria-pressed="true"] { background: #fff; color: var(--ink); }
.preview-close { color: #fff; }
.preview-close:hover { background: rgba(255,255,255,.12); color: #fff; }
.preview-body { flex: 1; overflow: auto; display: flex; justify-content: center; align-items: flex-start; }
.phone { width: 100%; height: 100%; }
.phone-screen { height: 100%; overflow-y: auto; background: #fff; -webkit-overflow-scrolling: touch; }
.paper-wrap { padding: 16px; width: 100%; }
.paper { width: 794px; transform-origin: 0 0; box-shadow: 0 10px 40px rgba(0,0,0,.4); }

.fab { position: fixed; z-index: 26; right: 16px; bottom: calc(var(--tabbar-h) + 16px + var(--safe-b)); display: flex; align-items: center; gap: 8px; border: 0; border-radius: 999px; padding: 13px 20px; background: var(--ink); color: #fff; font-weight: 700; box-shadow: 0 8px 24px rgba(0,0,0,.25); cursor: pointer; }

@media (min-width: 1024px) {
  .layout { display: grid; grid-template-columns: minmax(460px, 1fr) minmax(420px, 520px); gap: 0; max-width: 1360px; margin: 0 auto; }
  .editor { max-width: 720px; width: 100%; padding: 16px 28px 60px; }
  .tabbar { position: sticky; top: 56px; height: auto; padding: 8px 0 10px; margin: -16px -28px 16px; padding-left: 28px; padding-right: 28px; grid-template-columns: repeat(4, auto); justify-content: start; gap: 6px; background: rgba(246,243,238,.95); border-top: 0; border-bottom: 1px solid var(--border); }
  .tabbar button { flex-direction: row; font-size: 14px; gap: 7px; padding: 8px 14px; border-radius: 10px; }
  .tabbar button svg { width: 19px; height: 19px; }
  .tabbar button[aria-selected="true"] { background: #fff; box-shadow: var(--shadow); }
  .tabbar button[aria-selected="true"]::before { display: none; }
  .preview { position: sticky; top: 56px; height: calc(100vh - 56px); display: flex; background: #ece6dd; border-left: 1px solid var(--border); z-index: 1; }
  .preview-bar { padding: 12px 16px; justify-content: center; }
  .preview-bar .seg { background: #ddd5ca; }
  .preview-bar .seg button { color: var(--muted); }
  .preview-close, .fab { display: none !important; }
  .preview-body { padding: 6px 16px 24px; }
  .phone { width: 375px; height: min(760px, calc(100vh - 140px)); border: 10px solid #1d1a17; border-radius: 44px; overflow: hidden; box-shadow: 0 20px 50px rgba(0,0,0,.25); flex: none; position: relative; }
  .phone-screen { border-radius: 34px; }
  .phone-screen::-webkit-scrollbar { width: 0; }
  .paper-wrap { padding: 0; }
}

/* ---------- Dialog sheets ---------- */
.sheet { border: 0; padding: 0; width: 100%; max-width: 560px; max-height: 92vh; max-height: 92dvh; border-radius: 22px 22px 0 0; margin: auto auto 0; background: #fff; color: var(--ink); box-shadow: 0 -10px 40px rgba(0,0,0,.2); }
.sheet[open] { animation: sheetUp .25s cubic-bezier(.2,.8,.2,1); display: flex; }
.sheet > form, .sheet > div { display: flex; flex-direction: column; width: 100%; max-height: inherit; }
.sheet::backdrop { background: rgba(20,16,12,.45); }
@keyframes sheetUp { from { transform: translateY(40px); opacity: 0; } }
@media (min-width: 640px) { .sheet { border-radius: 22px; margin: auto; } }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 12px 6px 20px; }
.sheet-head h3 { margin: 0; font-size: 18px; }
.sheet-body { padding: 6px 20px 8px; overflow-y: auto; flex: 1; }
.sheet-foot { display: flex; gap: 10px; justify-content: space-between; padding: 12px 20px calc(14px + var(--safe-b)); border-top: 1px solid #f1ece4; }
.sheet-foot .btn-primary { flex: 1; max-width: 260px; margin-left: auto; }

.photo-field { margin-bottom: 14px; }
.photo-pick { width: 100%; height: 170px; border-radius: 16px; border: 1.5px dashed #cfc6b8; background: #faf7f2; cursor: pointer; position: relative; overflow: hidden; display: grid; place-items: center; padding: 0; }
.photo-img { position: absolute; inset: 0; background: center/cover no-repeat; }
.photo-empty { display: flex; flex-direction: column; align-items: center; gap: 6px; color: var(--muted); font-weight: 600; font-size: 14px; }
.photo-empty svg { width: 30px; height: 30px; }
.photo-pick.has-img .photo-empty { display: none; }
.photo-pick.is-loading::after { content: 'Đang xử lý ảnh…'; position: absolute; inset: 0; display: grid; place-items: center; background: rgba(255,255,255,.8); font-weight: 600; }
.photo-field .link-btn { margin-top: 6px; }
.price-preview { color: var(--brand-d) !important; font-weight: 600; }

/* ---------- Toast / busy ---------- */
.toast { position: fixed; z-index: 100; left: 50%; bottom: calc(var(--tabbar-h) + 24px + var(--safe-b)); transform: translate(-50%, 20px); background: var(--ink); color: #fff; padding: 11px 18px; border-radius: 12px; font-size: 14px; font-weight: 500; opacity: 0; pointer-events: none; transition: .25s; max-width: calc(100vw - 32px); text-align: center; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.err { background: var(--danger); }
.busy { position: fixed; inset: 0; z-index: 200; background: rgba(20,16,12,.55); display: grid; place-items: center; }
.busy-box { background: #fff; border-radius: 16px; padding: 18px 22px; display: flex; align-items: center; gap: 12px; font-weight: 600; }
.spinner { width: 22px; height: 22px; border-radius: 50%; border: 3px solid #f1d6c5; border-top-color: var(--brand); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
#renderStage { position: absolute; left: 0; top: 0; z-index: -1; pointer-events: none; }
#renderStage:empty { display: none; }

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

/* ---------- Editor: liên kết đầu trang ---------- */
.top-links { display: none; gap: 2px; }
.top-links a { color: var(--muted); text-decoration: none; font-weight: 600; font-size: 14px; padding: 6px 10px; border-radius: 8px; }
.top-links a:hover { background: #ece6dd; color: var(--ink); }
@media (min-width: 760px) { .top-links { display: flex; } }

/* ---------- Editor: tab Mẫu menu ---------- */
.cur-tpl { display: flex; gap: 14px; align-items: stretch; padding: 12px; }
.cur-tpl-thumb { width: 42%; max-width: 190px; flex: none; border-radius: 12px; overflow: hidden; box-shadow: inset 0 0 0 1px rgba(0,0,0,.06); }
.cur-tpl-thumb .tpl-thumb { height: 220px; }
.cur-tpl-info { display: flex; flex-direction: column; gap: 3px; min-width: 0; padding: 4px 0; }
.cur-tpl-info small { font-size: 12px; font-weight: 700; color: var(--brand-d); text-transform: uppercase; letter-spacing: .06em; }
.cur-tpl-info b { font-size: 19px; line-height: 1.25; }
.cur-tpl-info span { font-size: 13.5px; color: var(--muted); }
.cur-tpl-info .tpl-dots { margin: 6px 0 auto; }
.cur-tpl-info .btn { margin-top: 12px; align-self: flex-start; min-height: 40px; padding: 8px 14px; font-size: 14px; }
.quick-head { display: flex; align-items: baseline; justify-content: space-between; margin: 18px 2px 10px; }
.quick-head h3 { margin: 0; font-size: 16px; }
.see-all { color: var(--brand-d); font-weight: 700; font-size: 14px; text-decoration: none; }
.tpl-strip { display: grid; grid-auto-flow: column; grid-auto-columns: 148px; gap: 12px; overflow-x: auto; padding: 4px 4px 14px; margin: 0 -14px; padding-left: 14px; padding-right: 14px; scroll-snap-type: x mandatory; scrollbar-width: thin; }
.tpl-strip > * { scroll-snap-align: start; }
.tpl-strip .tpl-thumb { height: 190px; }
.tpl-strip .tpl-meta span { display: none; }
.tpl-more { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; border-radius: 16px; border: 2px dashed #e2c3ad; color: var(--brand-d); text-decoration: none; background: var(--brand-soft); font-weight: 600; font-size: 13.5px; text-align: center; padding: 10px; }
.tpl-more b { font-size: 26px; }
.library-btn { margin-bottom: 4px; color: var(--brand-d); }
@media (min-width: 1024px) { .tpl-strip { margin: 0; padding-left: 4px; padding-right: 4px; } }
