/* =========================================================
   Cindy Menu — admin panel · glassmorphism
   ========================================================= */
:root {
  --brand-green: #34DD63;
  --brand-green-dark: #128A3D;
  --brand-amber: #F7B500;
  --danger: #FF5C6C;
  --bg-0: #06120B;
  --bg-1: #0D2617;
  --text: #F3FFF6;
  --text-dim: rgba(243, 255, 246, 0.72);
  --text-faint: rgba(243, 255, 246, 0.5);
  --glass-bg: rgba(255, 255, 255, 0.07);
  --glass-bg-strong: rgba(255, 255, 255, 0.12);
  --glass-border: rgba(255, 255, 255, 0.14);
  --field-bg: rgba(0, 0, 0, 0.28);
  --radius: 16px;
  --radius-sm: 12px;
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --font-latin: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-arabic: 'Vazirmatn', 'Noto Sans Arabic', Tahoma, sans-serif;
  color-scheme: dark;
}
*, *::before, *::after { box-sizing: border-box; }
body {
  margin: 0; min-height: 100dvh; color: var(--text); font-size: 16px; line-height: 1.55;
  font-family: var(--font-arabic); background: radial-gradient(120% 80% at 50% 0%, var(--bg-1), var(--bg-0) 65%) fixed var(--bg-0);
  touch-action: manipulation;
}
[dir="ltr"] body { font-family: var(--font-latin); }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--brand-amber); outline-offset: 2px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--text-dim); }
.small { font-size: 14px; }
.row { display: flex; align-items: center; flex-wrap: wrap; }
.gap { gap: 10px; }
.grow { flex: 1; }
.ltr { direction: ltr; unicode-bidi: isolate; }

.glass {
  background: var(--glass-bg);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  backdrop-filter: blur(20px) saturate(140%);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.28);
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .glass { background: rgba(14, 34, 22, 0.95); }
}

.bg-blobs { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.bg-blobs span { position: absolute; border-radius: 50%; filter: blur(80px); opacity: .45; }
.bg-blobs span:nth-child(1) { width: 55vmax; height: 55vmax; background: #1FBF55; top: -25vmax; left: -20vmax; }
.bg-blobs span:nth-child(2) { width: 40vmax; height: 40vmax; background: #F7B500; bottom: -22vmax; right: -15vmax; opacity: .25; }
.bg-blobs span:nth-child(3) { width: 30vmax; height: 30vmax; background: #0E7A3A; top: 45%; left: 40%; opacity: .35; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px; border-radius: var(--radius-sm); cursor: pointer;
  background: var(--glass-bg-strong); border: 1px solid var(--glass-border);
  font-weight: 600; text-decoration: none; white-space: nowrap;
  transition: transform .15s var(--ease), background-color .2s var(--ease), opacity .2s;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--brand-green-dark); border-color: rgba(255,255,255,.2); color: #fff; }
.btn-primary:hover { background: #159A45; }
.btn-amber { background: var(--brand-amber); color: #1A1200; border-color: transparent; }
.btn-danger { background: rgba(255, 92, 108, .16); color: #FFB3BB; border-color: rgba(255, 92, 108, .35); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--glass-bg); }
.btn-block { width: 100%; }
.btn-icon { width: 44px; padding: 0; }
.btn .spinner { width: 18px; height: 18px; border-width: 2px; }

.spinner { display: inline-block; width: 32px; height: 32px; border-radius: 50%;
  border: 3px solid rgba(255,255,255,.2); border-top-color: var(--brand-amber); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading { display: grid; place-items: center; min-height: 40vh; }

/* ---------- forms ---------- */
.form-grid { display: grid; gap: 14px; }
.form-2 { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); align-items: start; }
label { display: grid; gap: 6px; font-size: 14px; font-weight: 600; color: var(--text-dim); }
.lbl { display: flex; align-items: center; flex-wrap: wrap; gap: 2px; }
input:not([type="checkbox"]):not([type="radio"]):not([type="color"]):not([type="file"]), select, textarea {
  width: 100%; min-height: 46px; padding: 10px 14px; border-radius: var(--radius-sm);
  background: var(--field-bg); border: 1px solid var(--glass-border); color: var(--text); font-size: 16px;
  transition: border-color .2s var(--ease);
}
textarea { min-height: 76px; resize: vertical; }
input:focus, select, textarea:focus { outline: none; border-color: var(--brand-amber); }
select option { background: #0D2617; }
input[type="color"] { width: 64px; height: 46px; padding: 4px; border-radius: var(--radius-sm); background: var(--field-bg); border: 1px solid var(--glass-border); cursor: pointer; }
fieldset { border: 1px solid var(--glass-border); border-radius: var(--radius); padding: 14px; margin: 0; display: grid; gap: 12px; }
legend { padding: 0 8px; font-weight: 800; color: var(--text); }
.req::after { content: " *"; color: var(--brand-amber); }
.field-error { color: #FFB3BB; font-size: 13px; font-weight: 600; }
.check { display: flex; align-items: center; gap: 10px; min-height: 44px; cursor: pointer; color: var(--text); }
.check input { width: 20px; height: 20px; accent-color: var(--brand-green); }
.lang-tag { font-size: 11px; font-weight: 800; padding: 1px 6px; border-radius: 6px; background: var(--glass-bg-strong); color: var(--text-dim); margin-inline-start: 6px; }

/* switch */
.switch { position: relative; display: inline-flex; width: 52px; height: 30px; flex: none; cursor: pointer; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch .track { position: absolute; inset: 0; border-radius: 999px; background: rgba(255,255,255,.18); transition: background-color .2s var(--ease); }
.switch .track::after { content: ""; position: absolute; top: 3px; inset-inline-start: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: transform .2s var(--ease); }
.switch input:checked + .track { background: var(--brand-green-dark); }
.switch input:checked + .track::after { transform: translateX(22px); }
[dir="rtl"] .switch input:checked + .track::after { transform: translateX(-22px); }
.switch input:focus-visible + .track { outline: 3px solid var(--brand-amber); outline-offset: 2px; }
.switch-wrap { display: inline-grid; place-items: center; min-width: 44px; min-height: 44px; }

.alert { padding: 12px 14px; border-radius: var(--radius-sm); background: rgba(255, 92, 108, .15); border: 1px solid rgba(255, 92, 108, .35); color: #FFD0D5; font-weight: 600; }
.note { padding: 12px 14px; border-radius: var(--radius-sm); background: rgba(247, 181, 0, .1); border: 1px solid rgba(247, 181, 0, .3); color: #FFE6A3; font-size: 14px; }

/* ---------- auth ---------- */
.auth-page { display: grid; place-items: center; padding: 24px 16px; }
.auth-card { width: min(440px, 100%); padding: 28px 22px; display: grid; gap: 16px; text-align: center; }
.auth-card .form-grid { text-align: start; }
.auth-card h1 { margin: 0; font-size: 22px; }
.auth-logo { width: 180px; height: auto; margin: 0 auto; }
.auth-card .row { justify-content: center; }
.auth-card code { background: var(--field-bg); padding: 2px 6px; border-radius: 6px; }

/* ---------- app layout ---------- */
.app-header {
  margin: 10px; padding: 8px 12px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand img { height: 36px; width: auto; }
.brand-sub { font-size: 13px; font-weight: 800; padding: 2px 10px; border-radius: 999px; background: var(--brand-amber); color: #1A1200; }
.tabs {
  position: sticky; top: 8px; z-index: 30; display: flex; gap: 4px; justify-content: center;
  width: fit-content; margin: 0 auto 8px; padding: 6px; border-radius: 16px;
  background: rgba(10, 28, 18, .82); -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
}
.tabs a {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 16px; border-radius: var(--radius-sm);
  text-decoration: none; font-weight: 600; color: var(--text-dim); transition: background-color .2s var(--ease), color .2s;
}
.tabs a[aria-current="page"] { background: var(--brand-green-dark); color: #fff; }
.header-actions { display: flex; gap: 4px; }
.app-main { max-width: 1100px; margin: 0 auto; padding: 8px 12px 110px; }

@media (max-width: 760px) {
  .app-header { margin: 8px; padding: 6px 8px; }
  .brand img { height: 30px; }
  .header-actions .btn { padding: 0 10px; font-size: 14px; }
  .tabs {
    position: fixed; top: auto; bottom: 10px; left: 10px; right: 10px; z-index: 40; width: auto; margin: 0;
    justify-content: space-around; border-radius: 18px;
    padding-bottom: calc(6px + env(safe-area-inset-bottom));
  }
  .tabs a { flex-direction: column; gap: 0; padding: 4px 8px; font-size: 12px; flex: 1; min-height: 52px; justify-content: center; }
  .tabs a span:first-child { font-size: 18px; }
}

/* ---------- page parts ---------- */
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 12px 4px 14px; }
.page-head h1 { margin: 0; font-size: 24px; }
.panel { padding: 16px; margin-bottom: 16px; }
.panel-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.panel-head h2 { margin: 0; font-size: 20px; display: flex; align-items: center; gap: 8px; }

/* category chips */
.cat-strip { display: flex; gap: 8px; overflow-x: auto; padding: 4px 2px 12px; scrollbar-width: thin; }
.cat-chip {
  flex: none; display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 14px;
  border-radius: 999px; border: 1px solid var(--glass-border); background: var(--glass-bg); cursor: pointer; font-weight: 600;
}
.cat-chip .count { font-size: 12px; padding: 0 7px; border-radius: 999px; background: rgba(0,0,0,.3); }
.cat-chip[aria-pressed="true"] { background: var(--chip, var(--brand-green-dark)); color: var(--chip-ink, #fff); border-color: transparent; }
.cat-chip.is-hidden { opacity: .55; }
.dot { width: 12px; height: 12px; border-radius: 50%; flex: none; }

/* item rows */
.list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.row-item {
  display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: var(--radius-sm);
  background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.08);
}
.row-item.is-off { opacity: .6; }
.handle { cursor: grab; display: grid; place-items: center; width: 32px; min-height: 44px; color: var(--text-faint); font-size: 20px; user-select: none; touch-action: none; }
.thumb { width: 56px; height: 56px; border-radius: 10px; object-fit: cover; flex: none; background: rgba(255,255,255,.08); display: grid; place-items: center; font-size: 24px; }
.row-text { flex: 1; min-width: 0; }
.row-title { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-sub { font-size: 13px; color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-flags { display: flex; gap: 4px; margin-top: 2px; }
.flag { font-size: 11px; font-weight: 800; padding: 1px 7px; border-radius: 999px; background: rgba(247,181,0,.18); color: #FFD25C; }
.flag.off { background: rgba(255,92,108,.18); color: #FFB3BB; }
.price-tag { font-family: var(--font-latin); font-weight: 800; background: var(--brand-amber); color: #1A1200; padding: 4px 10px; border-radius: 9px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.sortable-ghost { opacity: .35; }
.sortable-chosen { box-shadow: 0 0 0 2px var(--brand-amber); }
.empty-state { text-align: center; padding: 32px 12px; color: var(--text-dim); }

@media (max-width: 520px) {
  .row-item { flex-wrap: wrap; }
  .row-text { flex-basis: calc(100% - 110px); }
  .row-item .price-tag { margin-inline-start: 42px; }
}

/* prices table */
.price-row { display: grid; grid-template-columns: 1fr 150px; gap: 10px; align-items: center; padding: 6px 0; border-bottom: 1px solid rgba(255,255,255,.06); }
.price-row input { text-align: center; font-family: var(--font-latin); font-weight: 700; direction: ltr; }
.price-row input.dirty { border-color: var(--brand-amber); background: rgba(247,181,0,.12); }
.save-bar {
  position: sticky; bottom: 84px; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 14px; margin-top: 12px;
}
@media (min-width: 761px) { .save-bar { bottom: 12px; } }

/* modal */
.modal { padding: 0; border: 0; background: transparent; color: var(--text); width: min(680px, calc(100% - 20px)); max-height: calc(100dvh - 20px); }
.modal::backdrop { background: rgba(0,0,0,.5); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.modal[open] .modal-card { animation: pop .22s var(--ease); }
@keyframes pop { from { transform: translateY(16px) scale(.98); opacity: 0; } }
.modal-card { background: rgba(12, 30, 19, .9); padding: 0; display: flex; flex-direction: column; max-height: calc(100dvh - 20px); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--glass-border); }
.modal-head h2 { margin: 0; font-size: 20px; }
.modal-body { padding: 16px; overflow-y: auto; display: grid; gap: 14px; }
.modal-foot { display: flex; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--glass-border); flex-wrap: wrap; }
.modal-foot .spacer { flex: 1; }

/* photo picker */
.photo { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.photo-preview { width: 120px; height: 120px; border-radius: var(--radius); object-fit: cover; background: rgba(255,255,255,.06); border: 1px dashed var(--glass-border); display: grid; place-items: center; font-size: 40px; overflow: hidden; }
.photo-preview img { width: 100%; height: 100%; object-fit: cover; }
.photo-actions { display: grid; gap: 8px; }
.file-btn { position: relative; overflow: hidden; }
.file-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.toggles { display: flex; flex-wrap: wrap; gap: 4px 18px; }

/* ---------- SVG icons (assets/js/icons.js, app/icons.php) ---------- */
.ic { width: 1.15em; height: 1.15em; flex: none; vertical-align: -.2em; }
.ic-fill { fill: currentColor; }
[dir="rtl"] .ic-flip { transform: scaleX(-1); }
.btn .ic { width: 18px; height: 18px; }
.btn-icon .ic { width: 20px; height: 20px; }
.tabs a .ic { width: 20px; height: 20px; }
.handle .ic { width: 20px; height: 20px; }
.heart { color: #FF4D6D; }
.big-ic { color: var(--text-dim); }
.big-ic .ic { width: 56px; height: 56px; stroke-width: 1.6; }
.flag .ic { width: 13px; height: 13px; vertical-align: -2px; }
.thumb .ic { color: var(--text-dim); }
.cat-chip .chip-ic { display: inline-grid; }
.cat-chip .chip-ic .ic { width: 18px; height: 18px; }
.merchant-meta .ic, .merchant-url .ic { width: 15px; height: 15px; vertical-align: -3px; opacity: .85; }

/* category icon badge (category header, picker preview) */
.cat-ic { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; flex: none;
  background: var(--chip, var(--brand-green-dark)); color: var(--chip-ink, #fff); }
.cat-ic .ic { width: 20px; height: 20px; }
.cat-ic.is-lg { width: 52px; height: 52px; border-radius: 14px; }
.cat-ic.is-lg .ic { width: 28px; height: 28px; }

/* icon picker */
.icon-field { border: 1px solid var(--glass-border); border-radius: var(--radius-sm); padding: 10px 12px 12px; margin: 0; min-width: 0; }
.icon-field legend { padding: 0 6px; font-weight: 600; }
.icon-top { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.icon-top input[type="search"] { width: 100%; }
.icon-pick { max-height: 248px; overflow-y: auto; display: grid; gap: 10px; padding-inline-end: 4px; overscroll-behavior: contain; }
.icon-group[hidden] { display: none; }
.icon-group-name { margin: 0 0 6px; font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--text-faint); }
.icon-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(46px, 1fr)); gap: 6px; }
.icon-opt { height: 46px; display: grid; place-items: center; border-radius: 10px; cursor: pointer; color: var(--text);
  border: 1px solid var(--glass-border); background: var(--glass-bg); transition: background .15s, border-color .15s, transform .15s; touch-action: manipulation; }
.icon-opt[hidden] { display: none; }
.icon-opt .ic { width: 22px; height: 22px; }
.icon-opt:hover { background: rgba(255,255,255,.14); }
.icon-opt:active { transform: scale(.94); }
.icon-opt[aria-pressed="true"] { background: var(--brand-green-dark); border-color: var(--brand-green); color: #fff; box-shadow: 0 0 0 2px rgba(52,221,99,.35); }
.icon-opt:focus-visible { outline: 2px solid var(--brand-amber); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { .icon-opt { transition: none; } }

/* QR */
.qr-layout { display: grid; gap: 16px; grid-template-columns: 1fr; }
@media (min-width: 900px) { .qr-layout { grid-template-columns: 1fr 380px; } }
.qr-preview { display: grid; place-items: center; padding: 20px; background: #fff; border-radius: var(--radius); }
.qr-preview canvas, .qr-preview svg { width: 100% !important; height: auto !important; max-width: 340px; }
.qr-url { font-family: var(--font-latin); direction: ltr; word-break: break-all; text-align: center; color: var(--text-dim); font-size: 14px; }

/* ---------- platform: wordmark, landing, impersonation ---------- */
.wordmark { display: inline-flex; align-items: center; gap: 10px; direction: ltr; justify-content: center; }
.wordmark img { width: 40px; height: 40px; border-radius: 11px; }
.wordmark span { font-family: var(--font-latin); font-size: 22px; font-weight: 600; letter-spacing: -.02em; color: var(--text); }
.wordmark b { font-weight: 800; color: var(--brand-amber); }
.app-header .wordmark img { width: 34px; height: 34px; }
.app-header .wordmark span { font-size: 19px; }
.brand-name { font-size: 19px; font-weight: 800; }
.landing-card { width: min(560px, 100%); padding: 36px 26px; }
.landing-card h1 { font-size: 30px; line-height: 1.25; }
.landing-card h1 .muted { font-size: 20px; font-family: var(--font-arabic); }
.impersonate-bar {
  display: flex; align-items: center; justify-content: center; gap: 12px; flex-wrap: wrap;
  padding: 6px 12px; background: linear-gradient(90deg, rgba(247,181,0,.22), rgba(247,181,0,.12)); border-bottom: 1px solid rgba(247,181,0,.35);
  color: #FFE6A3; font-size: 14px;
}
.impersonate-bar .btn { min-height: 36px; padding: 0 14px; font-size: 14px; }

/* ---------- super-admin portal ---------- */
.stats { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); margin: 12px 0 4px; }
.stat { padding: 16px; display: grid; gap: 2px; }
.stat-n { font-family: var(--font-latin); font-size: 30px; font-weight: 800; line-height: 1.1; }
.stat-l { color: var(--text-dim); font-size: 14px; font-weight: 600; }
.stat:first-child .stat-n { color: var(--brand-green); }
.merchant-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.merchant { padding: 16px; display: grid; gap: 12px; position: relative; overflow: hidden; }
.merchant::before { content: ""; position: absolute; inset: 0 0 auto; height: 4px; background: linear-gradient(90deg, var(--m), var(--a)); }
.merchant.is-suspended { opacity: .72; }
.merchant.is-suspended::before { background: rgba(255,255,255,.25); }
.merchant-top { display: flex; align-items: center; gap: 12px; }
.m-logo { width: 56px; height: 56px; flex: none; border-radius: 14px; display: grid; place-items: center; overflow: hidden; font-size: 26px; font-weight: 800; box-shadow: inset 0 0 0 1px rgba(255,255,255,.18); }
.m-logo img { width: 84%; height: 84%; object-fit: contain; }
.merchant-name { margin: 0; font-size: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.merchant-url { display: block; max-width: 100%; padding: 0; min-height: 28px; border: 0; background: none; cursor: pointer; text-align: start;
  font-family: var(--font-latin); font-size: 13px; color: var(--brand-green); direction: ltr; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
[dir="rtl"] .merchant-url { text-align: end; }
.merchant-url:hover { text-decoration: underline; }
.status { flex: none; font-size: 12px; font-weight: 800; padding: 3px 10px; border-radius: 999px; }
.status.active { background: rgba(52,221,99,.16); color: #8FF0AB; }
.status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; display: inline-block; margin-inline-end: 6px; vertical-align: middle; }
.status.suspended { background: rgba(255,92,108,.16); color: #FFB3BB; }

.merchant-meta { display: grid; gap: 2px; font-size: 14px; }
.merchant-meta .muted { font-size: 13px; }
.merchant-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.merchant-actions .btn-primary { flex: 1; }
.slug-field { display: flex; align-items: stretch; direction: ltr; border-radius: var(--radius-sm); overflow: hidden; border: 1px solid var(--glass-border); background: var(--field-bg); }
.slug-field span { display: grid; place-items: center; padding: 0 10px; font-family: var(--font-latin); font-weight: 400; font-size: 13px; color: var(--text-faint); background: rgba(255,255,255,.05); white-space: nowrap; flex: none; }
.slug-field input { min-width: 0; flex: 1; }
.slug-field input { border: 0 !important; border-radius: 0 !important; background: transparent !important; }

/* ---------- branding ---------- */
#brand-form .photo-preview { width: 200px; background: color-mix(in srgb, var(--brand-green-dark) 45%, #06120B); border-style: solid; }
#brand-form .photo-preview img { object-fit: contain; padding: 10px; }
.brand-swatch { width: 120px; height: 46px; border-radius: var(--radius-sm); display: grid; place-items: center; align-self: end; box-shadow: inset 0 0 0 1px rgba(255,255,255,.2); }
.brand-swatch span { font-family: var(--font-latin); font-weight: 800; font-size: 14px; padding: 3px 10px; border-radius: 8px; }

/* ---------- print studio ---------- */
.print-layout { display: grid; gap: 16px; grid-template-columns: 1fr; align-items: start; }
@media (min-width: 980px) {
  .print-layout { grid-template-columns: 380px 1fr; }
  .print-controls { position: sticky; top: 76px; max-height: calc(100dvh - 90px); overflow-y: auto; }
}
.tpl-pick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.tpl-card { position: relative; display: grid; gap: 2px; padding: 8px; border-radius: var(--radius-sm); border: 1px solid var(--glass-border); background: var(--glass-bg); cursor: pointer; text-align: center; }
.tpl-card input { position: absolute; opacity: 0; }
.tpl-card:has(input:checked) { border-color: var(--brand-amber); box-shadow: 0 0 0 2px var(--brand-amber); }
.tpl-card:has(input:focus-visible) { outline: 3px solid var(--brand-amber); outline-offset: 2px; }
.tpl-name { color: var(--text); font-size: 13px; font-weight: 800; }
.tpl-desc { font-size: 11px; font-weight: 400; color: var(--text-faint); }
.tpl-thumb { display: grid; gap: 4px; align-content: start; aspect-ratio: 210 / 297; padding: 10% 12%; border-radius: 6px; margin-bottom: 4px; }
.tpl-thumb i { display: block; height: 7px; border-radius: 3px; }
.tpl-thumb i:first-child { height: 16px; margin-bottom: 4px; }
.tpl-thumb.tpl-signature { background: radial-gradient(80% 50% at 50% 0, rgba(52,221,99,.45), transparent), #08140D; box-shadow: inset 0 0 0 3px #08140D, inset 0 0 0 4px #C9A23A; }
.tpl-thumb.tpl-signature i { background: rgba(247,181,0,.75); }
.tpl-thumb.tpl-signature i + i { background: rgba(255,255,255,.35); }
.tpl-thumb.tpl-classic { background: #FBF7EE; box-shadow: inset 0 0 0 3px #FBF7EE, inset 0 0 0 4px #9DB38A; }
.tpl-thumb.tpl-classic i { background: #2E4A2A; width: 70%; justify-self: center; }
.tpl-thumb.tpl-classic i + i { background: #BDB4A0; width: 100%; }
.tpl-thumb.tpl-cards { background: linear-gradient(#34DD63, #F7B500) top / 100% 5px no-repeat, #F6F8F7; grid-template-columns: 1fr 1fr; padding-top: 14%; }
.tpl-thumb.tpl-cards i { height: 26px; background: linear-gradient(#9BC9A8 60%, #fff 60%); box-shadow: 0 0 0 1px #DDE3DF; }
.tpl-thumb.tpl-cards i:first-child { grid-column: 1 / -1; height: 14px; background: #D9F2E0; box-shadow: none; }
.lang-pick { display: grid; gap: 2px; }
.lang-opt { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.primary-pick { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 10px; border-radius: 999px; cursor: pointer; font-size: 12px; color: var(--text-faint); border: 1px solid transparent; }
.primary-pick input { position: absolute; opacity: 0; }
.primary-pick:has(input:checked) { color: #1A1200; background: var(--brand-amber); }
.primary-pick:has(input:disabled) { opacity: .35; cursor: not-allowed; }
.primary-pick:has(input:focus-visible) { outline: 3px solid var(--brand-amber); outline-offset: 2px; }
.cat-pick { display: grid; gap: 2px; max-height: 340px; overflow-y: auto; }
.cat-opt { padding: 0 8px; border-radius: 10px; border-inline-start: 3px solid var(--chip); }
.cat-opt:hover { background: var(--glass-bg); }
.cat-opt .count { font-size: 12px; padding: 0 8px; border-radius: 999px; background: rgba(0,0,0,.3); color: var(--text-dim); }
.print-preview { padding: 10px; position: sticky; top: 76px; }
.preview-bar { display: flex; justify-content: space-between; padding: 2px 6px 8px; }
.preview-frame { position: relative; border-radius: 12px; overflow: hidden; background: #4E5652; }
.preview-frame iframe { display: block; width: 100%; height: calc(100dvh - 160px); min-height: 480px; border: 0; }
.preview-loading { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(6, 18, 11, .55); }
@media (max-width: 979px) {
  .print-preview { position: static; }
  .preview-frame iframe { height: 75dvh; }
}

/* SweetAlert2 glass theme */
.swal2-popup { background: rgba(12, 30, 19, .94) !important; color: var(--text) !important; border: 1px solid var(--glass-border); border-radius: 18px !important; font-family: inherit !important; }
.swal2-title, .swal2-html-container { color: var(--text) !important; }
.swal2-styled.swal2-confirm { background: var(--brand-green-dark) !important; border-radius: 12px !important; min-height: 44px; }
.swal2-styled.swal2-deny, .swal2-styled.swal2-confirm.is-danger { background: #C7303F !important; }
.swal2-styled.swal2-cancel { background: rgba(255,255,255,.14) !important; border-radius: 12px !important; min-height: 44px; }
.swal2-toast { background: rgba(12, 30, 19, .95) !important; }

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

/* ---------- photo field (camera / gallery -> crop -> WebP) ---------- */
.photo-actions { flex: 1; min-width: 220px; }
.photo-btns { display: flex; flex-wrap: wrap; gap: 8px; }
.photo-hint { margin: 0; font-size: 13px; line-height: 1.5; color: var(--text-dim); }
.photo-info { margin: 0; font-size: 13px; color: #8FF0AB; display: flex; gap: 6px; align-items: center; }
.photo-info[hidden] { display: none; }
.link-btn { background: none; border: 0; padding: 4px 0; min-height: 32px; font: inherit; font-weight: 600; color: var(--brand-amber);
  cursor: pointer; display: inline-flex; align-items: center; gap: 4px; }
.link-btn .ic { width: 16px; height: 16px; }
.photo-preview.photo-item { width: 160px; height: 120px; }
.photo-preview.photo-category { width: 192px; height: 108px; }
.photo-preview.is-busy { opacity: .45; }
.photo.is-drop .photo-preview { border-color: var(--brand-green); background: rgba(52,221,99,.14); }
.tips-list { text-align: start; margin: 0; padding-inline-start: 22px; display: grid; gap: 8px; line-height: 1.55; font-size: 15px; }

/* ---------- photo tool dialog (assets/js/imgtool.js) ---------- */
.imgtool { padding: 0; border: 0; background: transparent; color: var(--text); width: min(760px, 100%); max-width: 100%; max-height: 100dvh; margin: auto; }
.imgtool::backdrop { background: rgba(0,0,0,.75); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.imgtool-card { background: rgba(10,24,16,.97); border: 1px solid var(--glass-border); border-radius: var(--radius);
  display: flex; flex-direction: column; gap: 10px; padding: 12px 14px 14px; max-height: 100dvh; overflow-y: auto; }
.it-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.it-head h2 { margin: 0; font-size: 18px; display: flex; gap: 8px; align-items: center; }
.it-hint { margin: 0; font-size: 14px; line-height: 1.5; color: var(--text-dim); }
.it-loading { display: flex; gap: 10px; align-items: center; justify-content: center; padding: 48px 16px; }

.it-cam, .it-stage { position: relative; direction: ltr; background: #000; border-radius: var(--radius-sm); overflow: hidden; }
.it-cam { height: min(62dvh, 520px); }
.it-cam video { width: 100%; height: 100%; object-fit: contain; display: block; }
.it-frame { position: absolute; border-radius: 6px; pointer-events: none; box-shadow: 0 0 0 100vmax rgba(0,0,0,.45); }
.it-frame .g { position: absolute; background: rgba(255,255,255,.35); }
.it-frame .g1, .it-frame .g2 { top: 0; bottom: 0; width: 1px; }
.it-frame .g1 { left: 33.333%; } .it-frame .g2 { left: 66.666%; }
.it-frame .g3, .it-frame .g4 { left: 0; right: 0; height: 1px; }
.it-frame .g3 { top: 33.333%; } .it-frame .g4 { top: 66.666%; }
.it-target { position: absolute; left: 50%; top: 50%; width: 40px; height: 40px; margin: -20px 0 0 -20px; border: 2px solid rgba(255,255,255,.9); border-radius: 50%; }
.it-target::before, .it-target::after { content: ""; position: absolute; background: rgba(255,255,255,.9); }
.it-target::before { left: 50%; top: 9px; bottom: 9px; width: 2px; margin-left: -1px; }
.it-target::after { top: 50%; left: 9px; right: 9px; height: 2px; margin-top: -1px; }
.it-frame .c { position: absolute; width: 26px; height: 26px; border: 3px solid var(--brand-green); }
.it-frame .c1 { top: -3px; left: -3px; border-right: 0; border-bottom: 0; border-top-left-radius: 8px; }
.it-frame .c2 { top: -3px; right: -3px; border-left: 0; border-bottom: 0; border-top-right-radius: 8px; }
.it-frame .c3 { bottom: -3px; left: -3px; border-right: 0; border-top: 0; border-bottom-left-radius: 8px; }
.it-frame .c4 { bottom: -3px; right: -3px; border-left: 0; border-top: 0; border-bottom-right-radius: 8px; }
.it-cam-msg { position: absolute; inset: 0; margin: 0; padding: 24px; display: grid; place-items: center; text-align: center;
  color: #fff; background: rgba(0,0,0,.65); line-height: 1.6; direction: rtl; }
[dir="ltr"] .it-cam-msg { direction: ltr; }
.it-cam-msg[hidden] { display: none; }
.it-cam-msg .ic { color: var(--brand-amber); }
.it-tips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 16px; font-size: 13px; color: var(--text-dim); }
.it-tips li { display: inline-flex; align-items: center; gap: 6px; }
.it-tips .ic { width: 16px; height: 16px; color: var(--brand-amber); }
.it-bar { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px; }
.it-bar > :first-child { justify-self: start; }
.it-bar > :last-child { justify-self: end; }
.it-bar-end { display: flex; flex-wrap: wrap; }
.it-bar-end .spacer { flex: 1; }
.it-shutter { width: 72px; height: 72px; padding: 5px; border-radius: 50%; border: 4px solid #fff; background: transparent; cursor: pointer; touch-action: manipulation; }
.it-shutter span { display: block; width: 100%; height: 100%; border-radius: 50%; background: #fff; transition: transform .15s var(--ease); }
.it-shutter:active span { transform: scale(.86); }
.it-shutter:disabled { opacity: .35; cursor: default; }
.it-shutter:focus-visible { outline: 3px solid var(--brand-amber); outline-offset: 3px; }

.it-stage { height: min(58dvh, 480px); }
.it-stage img { display: block; max-width: 100%; }
.it-warn { margin: 0; font-size: 13px; color: #FFD27A; display: flex; gap: 6px; align-items: center; }
.it-warn[hidden] { display: none; }
.it-tools { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; }

/* cropper.js in brand colours, with a bigger centre cross */
.imgtool .cropper-view-box { outline: 2px solid rgba(52,221,99,.95); outline-color: rgba(52,221,99,.95); }
.imgtool .cropper-line, .imgtool .cropper-point { background-color: var(--brand-green); }
.imgtool .cropper-dashed { border-color: rgba(255,255,255,.55); }
.imgtool .cropper-modal { background-color: #000; opacity: .55; }
.imgtool .cropper-center { opacity: 1; }
.imgtool .cropper-center::before { left: -14px; top: -1px; width: 28px; height: 2px; background-color: rgba(255,255,255,.95); }
.imgtool .cropper-center::after { top: -14px; left: -1px; width: 2px; height: 28px; background-color: rgba(255,255,255,.95); }

@media (max-width: 600px) {
  .imgtool { width: 100%; height: 100dvh; max-height: 100dvh; }
  .imgtool-card { min-height: 100dvh; border-radius: 0; border: 0; padding-top: max(12px, env(safe-area-inset-top)); padding-bottom: max(14px, env(safe-area-inset-bottom)); }
  .it-cam { height: auto; flex: 1; min-height: 52dvh; }
  .it-stage { height: auto; flex: 1; min-height: 46dvh; }
  .imgtool .cropper-point.point-se, .imgtool .cropper-point.point-nw, .imgtool .cropper-point.point-ne, .imgtool .cropper-point.point-sw { width: 14px; height: 14px; opacity: 1; }
  .imgtool .cropper-point.point-nw { left: -7px; top: -7px; } .imgtool .cropper-point.point-ne { right: -7px; top: -7px; }
  .imgtool .cropper-point.point-sw { left: -7px; bottom: -7px; } .imgtool .cropper-point.point-se { right: -7px; bottom: -7px; }
}
@media (prefers-reduced-motion: reduce) { .it-shutter span { transition: none; } }

/* bulk available / sold out for a whole category */
.bulk-avail { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.bulk-avail .btn[data-act="all-off"]:not(:disabled) { color: #FFB3BB; border-color: rgba(255,92,108,.35); }
.bulk-avail .btn[data-act="all-on"]:not(:disabled) { color: #8FF0AB; border-color: rgba(52,221,99,.35); }
.bulk-avail .btn:disabled { opacity: .45; cursor: default; }
